var ZC=Object.defineProperty;var JC=(pt,g,Ae)=>g in pt?ZC(pt,g,{enumerable:!0,configurable:!0,writable:!0,value:Ae}):pt[g]=Ae;var I=(pt,g,Ae)=>(JC(pt,typeof g!="symbol"?g+"":g,Ae),Ae);var DESettingsPluginPages=function(pt,g,Ae){var Ap,Fp,zp,Wp,Bp,Hp,Vp,Rp,gr,xn;"use strict";function Fl(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const q=Fl(g),Wi=Fl(Ae);var zl={exports:{}},Bi={};/**
 * @license React
 * react-jsx-runtime.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var qp=g,Yp=Symbol.for("react.element"),Kp=Symbol.for("react.fragment"),Gp=Object.prototype.hasOwnProperty,Xp=qp.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Qp={key:!0,ref:!0,__self:!0,__source:!0};function Wl(e,t,n){var s,i={},o=null,r=null;n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(r=t.ref);for(s in t)Gp.call(t,s)&&!Qp.hasOwnProperty(s)&&(i[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)i[s]===void 0&&(i[s]=t[s]);return{$$typeof:Yp,type:e,key:o,ref:r,props:i,_owner:Xp.current}}Bi.Fragment=Kp,Bi.jsx=Wl,Bi.jsxs=Wl,zl.exports=Bi;var l=zl.exports;function Bl(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Bl(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function ue(){for(var e,t,n=0,s="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Bl(e))&&(s&&(s+=" "),s+=t);return s}function Zp({soft:e=!1,className:t,...n}){return l.jsx("hr",{role:"presentation",...n,className:ue(t,"w-full border-t",e&&"border-neutral-950/5 dark:border-white/5",!e&&"border-neutral-950/10 dark:border-white/10")})}const Hl=g.createContext(null);function Jp({initialValues:e={},onChange:t,children:n}){const[s,i]=g.useState(e),o=(a,d)=>{i(c=>{const u=typeof d=="function"?d(c[a]):d,h=eg(c,a,u);return t==null||t(h),h})},r=g.useMemo(()=>({values:s,setValue:o}),[s]);return l.jsx(Hl.Provider,{value:r,children:n})}function Je(){const e=g.useContext(Hl);return e||{values:{},setValue:()=>{}}}function eg(e,t,n){if(!t||!t.includes("."))return{...e,[t]:n};const s=t.split("."),i={...e};let o=i;for(let r=0;r<s.length-1;r++){const a=s[r];o[a]={...o[a]??{}},o=o[a]}return o[s[s.length-1]]=n,i}function tg({onSave:e,onReset:t,resetTo:n,saveLabel:s="Save",resetLabel:i="Reset",saveState:o="idle",disabled:r=!1,...a}){const{values:d,setValue:c}=Je();async function u(w){var _;(_=w==null?void 0:w.preventDefault)==null||_.call(w),e?await e(d):alert("Settings saved!")}async function h(w){var _;if((_=w==null?void 0:w.preventDefault)==null||_.call(w),t){await t();return}n&&c?Object.keys(n).forEach(y=>c(y,n[y])):alert("Settings reset!")}const f=o==="saving",m=o==="saved",p=o==="error",b=f?"Saving…":m?"Saved":p?"Retry":s,x="inline-flex items-center px-4 py-2 rounded text-white font-semibold transition disabled:opacity-60 "+(m?"bg-green-600 hover:bg-green-700":p?"bg-red-600 hover:bg-red-700":"bg-indigo-600 hover:bg-indigo-700");return l.jsxs("div",{className:"mt-10",...a,children:[l.jsx(Zp,{}),l.jsxs("div",{className:"flex flex-col-reverse sm:flex-row gap-3 mt-10 justify-end items-stretch sm:items-center",children:[l.jsx("button",{type:"button",className:"inline-flex items-center px-4 py-2 rounded bg-neutral-200 text-neutral-900 font-semibold hover:bg-neutral-300 transition dark:bg-neutral-800 dark:text-white dark:hover:bg-neutral-700",onClick:h,disabled:f||r,children:i}),l.jsx("button",{type:"button",className:x,onClick:u,disabled:f||r,"aria-live":"polite",children:b})]})]})}const Vl=typeof window<"u"&&((Ap=window.diviEngineApiSettings)!=null&&Ap.restUrl)?window.diviEngineApiSettings.restUrl.replace(/\/?$/,"/"):"/wp-json/",Rl=typeof window<"u"&&((Fp=window.diviEngineApiSettings)==null?void 0:Fp.nonce)||"",ng=()=>{var t;return(typeof window<"u"&&((t=window.diviEngineSettingsObject)==null?void 0:t.organization)||"divi-engine")==="wp-enhanced"?"wpe/v1":"de/v1"};function Fe({slug:e,defaults:t={}}){const[n,s]=g.useState(t),[i,o]=g.useState(!0),[r,a]=g.useState("idle"),d=ng(),c=async()=>{const h=await fetch(`${Vl}${d}/settings/${e}`,{credentials:"same-origin",headers:{"X-WP-Nonce":Rl}});if(!h.ok)throw new Error(`Load failed: ${h.status}`);return h.json()},u=async h=>{const f=await fetch(`${Vl}${d}/settings/${e}`,{method:"PUT",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":Rl},body:JSON.stringify(h)});if(!f.ok)throw new Error(`Save failed: ${f.status}`);return f.json()};return g.useEffect(()=>{let h=!0;return(async()=>{try{const f=await c();if(!h)return;s({...t,...f||{}})}catch{s(t)}finally{h&&o(!1)}})(),()=>{h=!1}},[e]),g.useMemo(()=>({slug:e,loading:i,initialValues:n,defaults:t,saveState:r,async saveWithState(h){try{return a("saving"),await u(h),a("saved"),setTimeout(()=>a("idle"),1200),"success"}catch{return a("error"),setTimeout(()=>a("idle"),2e3),"error"}}}),[e,i,n,t,r])}/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const sg=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ig=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,s)=>s?s.toUpperCase():n.toLowerCase()),$l=e=>{const t=ig(e);return t.charAt(0).toUpperCase()+t.slice(1)},Ul=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===n).join(" ").trim(),og=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */var rg={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ag=g.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:i="",children:o,iconNode:r,...a},d)=>g.createElement("svg",{ref:d,...rg,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:Ul("lucide",i),...!o&&!og(a)&&{"aria-hidden":"true"},...a},[...r.map(([c,u])=>g.createElement(c,u)),...Array.isArray(o)?o:[o]]));/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const re=(e,t)=>{const n=g.forwardRef(({className:s,...i},o)=>g.createElement(ag,{ref:o,iconNode:t,className:Ul(`lucide-${sg($l(e))}`,`lucide-${e}`,s),...i}));return n.displayName=$l(e),n};/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ql=re("activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const lg=re("bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const dg=re("calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const js=re("chart-bar",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 16h8",key:"srdodz"}],["path",{d:"M7 11h12",key:"127s9w"}],["path",{d:"M7 6h3",key:"w9rmul"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Xt=re("chart-column",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ns=re("chart-pie",[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const cg=re("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ug=re("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hg=re("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Yl=re("circle-help",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const br=re("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const fg=re("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Kl=re("file-down",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Gl=re("file-spreadsheet",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const mg=re("file-text",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const pg=re("file-type",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 13v-1h6v1",key:"1bb014"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M11 18h2",key:"12mj7e"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const gg=re("files",[["path",{d:"M20 7h-3a2 2 0 0 1-2-2V2",key:"x099mo"}],["path",{d:"M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z",key:"18t6ie"}],["path",{d:"M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8",key:"1nja0z"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Xl=re("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Yn=re("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ql=re("mail",[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bg=re("mailbox",[["path",{d:"M22 17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9.5C2 7 4 5 6.5 5H18c2.2 0 4 1.8 4 4v8Z",key:"1lbycx"}],["polyline",{points:"15,9 18,9 18,11",key:"1pm9c0"}],["path",{d:"M6.5 5C9 5 11 7 11 9.5V17a2 2 0 0 1-2 2",key:"15i455"}],["line",{x1:"6",x2:"7",y1:"10",y2:"10",key:"1e2scm"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xr=re("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Kn=re("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xg=re("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const wg=re("settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const _g=re("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Zl=re("trash-2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Hi=re("trending-up",[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Jl=re("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const yg=re("truck",[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ed=re("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const td=re("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),vg=typeof document<"u"?g.useLayoutEffect:()=>{},Qt=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},wn=e=>e&&"window"in e&&e.window===e?e:Qt(e).defaultView||window;function kg(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function jg(e){return kg(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let Ng=!1;function wr(){return Ng}function _n(e,t){if(!wr())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!==null;){if(n===e)return!0;n.tagName==="SLOT"&&n.assignedSlot?n=n.assignedSlot.parentNode:jg(n)?n=n.host:n=n.parentNode}return!1}const _r=(e=document)=>{var t;if(!wr())return e.activeElement;let n=e.activeElement;for(;n&&"shadowRoot"in n&&(!((t=n.shadowRoot)===null||t===void 0)&&t.activeElement);)n=n.shadowRoot.activeElement;return n};function nd(e){return wr()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function Sg(e){if(Cg())e.focus({preventScroll:!0});else{let t=Mg(e);e.focus(),Tg(t)}}let Vi=null;function Cg(){if(Vi==null){Vi=!1;try{document.createElement("div").focus({get preventScroll(){return Vi=!0,!0}})}catch{}}return Vi}function Mg(e){let t=e.parentNode,n=[],s=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==s;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return s instanceof HTMLElement&&n.push({element:s,scrollTop:s.scrollTop,scrollLeft:s.scrollLeft}),n}function Tg(e){for(let{element:t,scrollTop:n,scrollLeft:s}of e)t.scrollTop=n,t.scrollLeft=s}function Ri(e){var t;if(typeof window>"u"||window.navigator==null)return!1;let n=(t=window.navigator.userAgentData)===null||t===void 0?void 0:t.brands;return Array.isArray(n)&&n.some(s=>e.test(s.brand))||e.test(window.navigator.userAgent)}function sd(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function Gn(e){let t=null;return()=>(t==null&&(t=e()),t)}const $i=Gn(function(){return sd(/^Mac/i)}),Pg=Gn(function(){return sd(/^iPad/i)||$i()&&navigator.maxTouchPoints>1}),Eg=Gn(function(){return Ri(/AppleWebKit/i)&&!Dg()}),Dg=Gn(function(){return Ri(/Chrome/i)}),Og=Gn(function(){return Ri(/Android/i)}),Ig=Gn(function(){return Ri(/Firefox/i)});function Ss(e,t,n=!0){var s,i;let{metaKey:o,ctrlKey:r,altKey:a,shiftKey:d}=t;Ig()&&(!((i=window.event)===null||i===void 0||(s=i.type)===null||s===void 0)&&s.startsWith("key"))&&e.target==="_blank"&&($i()?o=!0:r=!0);let c=Eg()&&$i()&&!Pg()?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:o,ctrlKey:r,altKey:a,shiftKey:d}):new MouseEvent("click",{metaKey:o,ctrlKey:r,altKey:a,shiftKey:d,detail:1,bubbles:!0,cancelable:!0});Ss.isOpening=n,Sg(e),e.dispatchEvent(c),Ss.isOpening=!1}Ss.isOpening=!1;function id(){let e=g.useRef(new Map),t=g.useCallback((i,o,r,a)=>{let d=a!=null&&a.once?(...c)=>{e.current.delete(r),r(...c)}:r;e.current.set(r,{type:o,eventTarget:i,fn:d,options:a}),i.addEventListener(o,d,a)},[]),n=g.useCallback((i,o,r,a)=>{var d;let c=((d=e.current.get(r))===null||d===void 0?void 0:d.fn)||r;i.removeEventListener(o,c,a),e.current.delete(r)},[]),s=g.useCallback(()=>{e.current.forEach((i,o)=>{n(i.eventTarget,i.type,o,i.options)})},[n]);return g.useEffect(()=>s,[s]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:s}}function Lg(e){return e.pointerType===""&&e.isTrusted?!0:Og()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function od(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Ag(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function rd(e){let t=g.useRef({isFocused:!1,observer:null});return vg(()=>{const n=t.current;return()=>{n.observer&&(n.observer.disconnect(),n.observer=null)}},[]),g.useCallback(n=>{if(n.target instanceof HTMLButtonElement||n.target instanceof HTMLInputElement||n.target instanceof HTMLTextAreaElement||n.target instanceof HTMLSelectElement){t.current.isFocused=!0;let s=n.target,i=o=>{if(t.current.isFocused=!1,s.disabled){let r=od(o);e==null||e(r)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};s.addEventListener("focusout",i,{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&s.disabled){var o;(o=t.current.observer)===null||o===void 0||o.disconnect();let r=s===document.activeElement?null:document.activeElement;s.dispatchEvent(new FocusEvent("blur",{relatedTarget:r})),s.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:r}))}}),t.current.observer.observe(s,{attributes:!0,attributeFilter:["disabled"]})}},[e])}let Fg=!1,Cs=null;const yr=new Set;let Ms=new Map,yn=!1,vr=!1;const zg={Tab:!0,Escape:!0};function kr(e,t){for(let n of yr)n(e,t)}function Wg(e){return!(e.metaKey||!$i()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function Ui(e){yn=!0,!Ss.isOpening&&Wg(e)&&(Cs="keyboard",kr("keyboard",e))}function Xn(e){Cs="pointer","pointerType"in e&&e.pointerType,(e.type==="mousedown"||e.type==="pointerdown")&&(yn=!0,kr("pointer",e))}function ad(e){!Ss.isOpening&&Lg(e)&&(yn=!0,Cs="virtual")}function ld(e){e.target===window||e.target===document||Fg||!e.isTrusted||(!yn&&!vr&&(Cs="virtual",kr("virtual",e)),yn=!1,vr=!1)}function dd(){yn=!1,vr=!0}function jr(e){if(typeof window>"u"||typeof document>"u"||Ms.get(wn(e)))return;const t=wn(e),n=Qt(e);let s=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){yn=!0,s.apply(this,arguments)},n.addEventListener("keydown",Ui,!0),n.addEventListener("keyup",Ui,!0),n.addEventListener("click",ad,!0),t.addEventListener("focus",ld,!0),t.addEventListener("blur",dd,!1),typeof PointerEvent<"u"&&(n.addEventListener("pointerdown",Xn,!0),n.addEventListener("pointermove",Xn,!0),n.addEventListener("pointerup",Xn,!0)),t.addEventListener("beforeunload",()=>{cd(e)},{once:!0}),Ms.set(t,{focus:s})}const cd=(e,t)=>{const n=wn(e),s=Qt(e);t&&s.removeEventListener("DOMContentLoaded",t),Ms.has(n)&&(n.HTMLElement.prototype.focus=Ms.get(n).focus,s.removeEventListener("keydown",Ui,!0),s.removeEventListener("keyup",Ui,!0),s.removeEventListener("click",ad,!0),n.removeEventListener("focus",ld,!0),n.removeEventListener("blur",dd,!1),typeof PointerEvent<"u"&&(s.removeEventListener("pointerdown",Xn,!0),s.removeEventListener("pointermove",Xn,!0),s.removeEventListener("pointerup",Xn,!0)),Ms.delete(n))};function Bg(e){const t=Qt(e);let n;return t.readyState!=="loading"?jr(e):(n=()=>{jr(e)},t.addEventListener("DOMContentLoaded",n)),()=>cd(e,n)}typeof document<"u"&&Bg();function Nr(){return Cs!=="pointer"}const Hg=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Vg(e,t,n){let s=Qt(n==null?void 0:n.target);const i=typeof window<"u"?wn(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,o=typeof window<"u"?wn(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,r=typeof window<"u"?wn(n==null?void 0:n.target).HTMLElement:HTMLElement,a=typeof window<"u"?wn(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||s.activeElement instanceof i&&!Hg.has(s.activeElement.type)||s.activeElement instanceof o||s.activeElement instanceof r&&s.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof a&&!zg[n.key])}function Rg(e,t,n){jr(),g.useEffect(()=>{if((n==null?void 0:n.enabled)===!1)return;let s=(i,o)=>{Vg(!!(n!=null&&n.isTextInput),i,o)&&e(Nr())};return yr.add(s),()=>{yr.delete(s)}},t)}function $g(e){let{isDisabled:t,onFocus:n,onBlur:s,onFocusChange:i}=e;const o=g.useCallback(d=>{if(d.target===d.currentTarget)return s&&s(d),i&&i(!1),!0},[s,i]),r=rd(o),a=g.useCallback(d=>{const c=Qt(d.target),u=c?_r(c):_r();d.target===d.currentTarget&&u===nd(d.nativeEvent)&&(n&&n(d),i&&i(!0),r(d))},[i,n,r]);return{focusProps:{onFocus:!t&&(n||i||s)?a:void 0,onBlur:!t&&(s||i)?o:void 0}}}function Ug(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:s,onFocusWithinChange:i}=e,o=g.useRef({isFocusWithin:!1}),{addGlobalListener:r,removeAllGlobalListeners:a}=id(),d=g.useCallback(h=>{_n(h.currentTarget,h.target)&&o.current.isFocusWithin&&!_n(h.currentTarget,h.relatedTarget)&&(o.current.isFocusWithin=!1,a(),n&&n(h),i&&i(!1))},[n,i,o,a]),c=rd(d),u=g.useCallback(h=>{if(!_n(h.currentTarget,h.target))return;const f=Qt(h.target),m=_r(f);if(!o.current.isFocusWithin&&m===nd(h.nativeEvent)){s&&s(h),i&&i(!0),o.current.isFocusWithin=!0,c(h);let p=h.currentTarget;r(f,"focus",b=>{if(o.current.isFocusWithin&&!_n(p,b.target)){let x=new f.defaultView.FocusEvent("blur",{relatedTarget:b.target});Ag(x,p);let w=od(x);d(w)}},{capture:!0})}},[s,i,c,r,d]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:u,onBlur:d}}}let Sr=!1,qi=0;function qg(){Sr=!0,setTimeout(()=>{Sr=!1},50)}function ud(e){e.pointerType==="touch"&&qg()}function Yg(){if(!(typeof document>"u"))return qi===0&&typeof PointerEvent<"u"&&document.addEventListener("pointerup",ud),qi++,()=>{qi--,!(qi>0)&&typeof PointerEvent<"u"&&document.removeEventListener("pointerup",ud)}}function Ts(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:s,isDisabled:i}=e,[o,r]=g.useState(!1),a=g.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;g.useEffect(Yg,[]);let{addGlobalListener:d,removeAllGlobalListeners:c}=id(),{hoverProps:u,triggerHoverEnd:h}=g.useMemo(()=>{let f=(b,x)=>{if(a.pointerType=x,i||x==="touch"||a.isHovered||!_n(b.currentTarget,b.target))return;a.isHovered=!0;let w=b.currentTarget;a.target=w,d(Qt(b.target),"pointerover",_=>{a.isHovered&&a.target&&!_n(a.target,_.target)&&m(_,_.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:w,pointerType:x}),n&&n(!0),r(!0)},m=(b,x)=>{let w=a.target;a.pointerType="",a.target=null,!(x==="touch"||!a.isHovered||!w)&&(a.isHovered=!1,c(),s&&s({type:"hoverend",target:w,pointerType:x}),n&&n(!1),r(!1))},p={};return typeof PointerEvent<"u"&&(p.onPointerEnter=b=>{Sr&&b.pointerType==="mouse"||f(b,b.pointerType)},p.onPointerLeave=b=>{!i&&_n(b.currentTarget,b.target)&&m(b,b.pointerType)}),{hoverProps:p,triggerHoverEnd:m}},[t,n,s,i,a,d,c]);return g.useEffect(()=>{i&&h({currentTarget:a.target},a.pointerType)},[i]),{hoverProps:u,isHovered:o}}function Ps(e={}){let{autoFocus:t=!1,isTextInput:n,within:s}=e,i=g.useRef({isFocused:!1,isFocusVisible:t||Nr()}),[o,r]=g.useState(!1),[a,d]=g.useState(()=>i.current.isFocused&&i.current.isFocusVisible),c=g.useCallback(()=>d(i.current.isFocused&&i.current.isFocusVisible),[]),u=g.useCallback(m=>{i.current.isFocused=m,i.current.isFocusVisible=Nr(),r(m),c()},[c]);Rg(m=>{i.current.isFocusVisible=m,c()},[n,o],{enabled:o,isTextInput:n});let{focusProps:h}=$g({isDisabled:s,onFocusChange:u}),{focusWithinProps:f}=Ug({isDisabled:!s,onFocusWithinChange:u});return{isFocused:o,isFocusVisible:a,focusProps:s?f:h}}var Kg=Object.defineProperty,Gg=(e,t,n)=>t in e?Kg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Cr=(e,t,n)=>(Gg(e,typeof t!="symbol"?t+"":t,n),n);let Xg=class{constructor(){Cr(this,"current",this.detect()),Cr(this,"handoffState","pending"),Cr(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},kt=new Xg;function vn(e){var t;return kt.isServer?null:e==null?document:(t=e==null?void 0:e.ownerDocument)!=null?t:document}function Mr(e){var t,n;return kt.isServer?null:e==null?document:(n=(t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))!=null?n:document}function hd(e){var t,n;return(n=(t=Mr(e))==null?void 0:t.activeElement)!=null?n:null}function Tr(e){return hd(e)===e}function Yi(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function at(){let e=[],t={addEventListener(n,s,i,o){return n.addEventListener(s,i,o),t.add(()=>n.removeEventListener(s,i,o))},requestAnimationFrame(...n){let s=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(s))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let s=setTimeout(...n);return t.add(()=>clearTimeout(s))},microTask(...n){let s={current:!0};return Yi(()=>{s.current&&n[0]()}),t.add(()=>{s.current=!1})},style(n,s,i){let o=n.style.getPropertyValue(s);return Object.assign(n.style,{[s]:i}),this.add(()=>{Object.assign(n.style,{[s]:o})})},group(n){let s=at();return n(s),this.add(()=>s.dispose())},add(n){return e.includes(n)||e.push(n),()=>{let s=e.indexOf(n);if(s>=0)for(let i of e.splice(s,1))i()}},dispose(){for(let n of e.splice(0))n()}};return t}function Ft(){let[e]=g.useState(at);return g.useEffect(()=>()=>e.dispose(),[e]),e}let me=(e,t)=>{kt.isServer?g.useEffect(e,t):g.useLayoutEffect(e,t)};function Zt(e){let t=g.useRef(e);return me(()=>{t.current=e},[e]),t}let K=function(e){let t=Zt(e);return g.useCallback((...n)=>t.current(...n),[t])};function Qg(e){let t=e.width/2,n=e.height/2;return{top:e.clientY-n,right:e.clientX+t,bottom:e.clientY+n,left:e.clientX-t}}function Zg(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function Ki({disabled:e=!1}={}){let t=g.useRef(null),[n,s]=g.useState(!1),i=Ft(),o=K(()=>{t.current=null,s(!1),i.dispose()}),r=K(a=>{if(i.dispose(),t.current===null){t.current=a.currentTarget,s(!0);{let d=vn(a.currentTarget);i.addEventListener(d,"pointerup",o,!1),i.addEventListener(d,"pointermove",c=>{if(t.current){let u=Qg(c);s(Zg(u,t.current.getBoundingClientRect()))}},!1),i.addEventListener(d,"pointercancel",o,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:r,onPointerUp:o,onClick:o}}}function Ke(e){return g.useMemo(()=>e,Object.values(e))}let fd=g.createContext(void 0);function Qn(){return g.useContext(fd)}function Jg({value:e,children:t}){return g.createElement(fd.Provider,{value:e},t)}function Pr(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function Ge(e,t,...n){if(e in t){let i=t[e];return typeof i=="function"?i(...n):i}let s=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(i=>`"${i}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(s,Ge),s}var Zn=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Zn||{}),Jt=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(Jt||{});function we(){let e=tb();return g.useCallback(t=>eb({mergeRefs:e,...t}),[e])}function eb({ourProps:e,theirProps:t,slot:n,defaultTag:s,features:i,visible:o=!0,name:r,mergeRefs:a}){a=a??nb;let d=md(t,e);if(o)return Gi(d,n,s,r,a);let c=i??0;if(c&2){let{static:u=!1,...h}=d;if(u)return Gi(h,n,s,r,a)}if(c&1){let{unmount:u=!0,...h}=d;return Ge(u?0:1,{0(){return null},1(){return Gi({...h,hidden:!0,style:{display:"none"}},n,s,r,a)}})}return Gi(d,n,s,r,a)}function Gi(e,t={},n,s,i){let{as:o=n,children:r,refName:a="ref",...d}=Er(e,["unmount","static"]),c=e.ref!==void 0?{[a]:e.ref}:{},u=typeof r=="function"?r(t):r;"className"in d&&d.className&&typeof d.className=="function"&&(d.className=d.className(t)),d["aria-labelledby"]&&d["aria-labelledby"]===d.id&&(d["aria-labelledby"]=void 0);let h={};if(t){let f=!1,m=[];for(let[p,b]of Object.entries(t))typeof b=="boolean"&&(f=!0),b===!0&&m.push(p.replace(/([A-Z])/g,x=>`-${x.toLowerCase()}`));if(f){h["data-headlessui-state"]=m.join(" ");for(let p of m)h[`data-${p}`]=""}}if(Es(o)&&(Object.keys(en(d)).length>0||Object.keys(en(h)).length>0))if(!g.isValidElement(u)||Array.isArray(u)&&u.length>1||ib(u)){if(Object.keys(en(d)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${s} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(en(d)).concat(Object.keys(en(h))).map(f=>`  - ${f}`).join(`
`),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(f=>`  - ${f}`).join(`
`)].join(`
`))}else{let f=u.props,m=f==null?void 0:f.className,p=typeof m=="function"?(...w)=>Pr(m(...w),d.className):Pr(m,d.className),b=p?{className:p}:{},x=md(u.props,en(Er(d,["ref"])));for(let w in h)w in x&&delete h[w];return g.cloneElement(u,Object.assign({},x,h,c,{ref:i(sb(u),c.ref)},b))}return g.createElement(o,Object.assign({},Er(d,["ref"]),!Es(o)&&c,!Es(o)&&h),u)}function tb(){let e=g.useRef([]),t=g.useCallback(n=>{for(let s of e.current)s!=null&&(typeof s=="function"?s(n):s.current=n)},[]);return(...n)=>{if(!n.every(s=>s==null))return e.current=n,t}}function nb(...e){return e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}function md(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let s of e)for(let i in s)i.startsWith("on")&&typeof s[i]=="function"?(n[i]!=null||(n[i]=[]),n[i].push(s[i])):t[i]=s[i];if(t.disabled||t["aria-disabled"])for(let s in n)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(s)&&(n[s]=[i=>{var o;return(o=i==null?void 0:i.preventDefault)==null?void 0:o.call(i)}]);for(let s in n)Object.assign(t,{[s](i,...o){let r=n[s];for(let a of r){if((i instanceof Event||(i==null?void 0:i.nativeEvent)instanceof Event)&&i.defaultPrevented)return;a(i,...o)}}});return t}function Jn(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let s of e)for(let i in s)i.startsWith("on")&&typeof s[i]=="function"?(n[i]!=null||(n[i]=[]),n[i].push(s[i])):t[i]=s[i];for(let s in n)Object.assign(t,{[s](...i){let o=n[s];for(let r of o)r==null||r(...i)}});return t}function xe(e){var t;return Object.assign(g.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function en(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function Er(e,t=[]){let n=Object.assign({},e);for(let s of t)s in n&&delete n[s];return n}function sb(e){return g.version.split(".")[0]>="19"?e.props.ref:e.ref}function Es(e){return e===g.Fragment||e===Symbol.for("react.fragment")}function ib(e){return Es(e.type)}function pd(e,t,n){let[s,i]=g.useState(n),o=e!==void 0,r=g.useRef(o),a=g.useRef(!1),d=g.useRef(!1);return o&&!r.current&&!a.current?(a.current=!0,r.current=o,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!o&&r.current&&!d.current&&(d.current=!0,r.current=o,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[o?e:s,K(c=>(o||Ae.flushSync(()=>i(c)),t==null?void 0:t(c)))]}function gd(e){let[t]=g.useState(e);return t}function bd(e={},t=null,n=[]){for(let[s,i]of Object.entries(e))wd(n,xd(t,s),i);return n}function xd(e,t){return e?e+"["+t+"]":t}function wd(e,t,n){if(Array.isArray(n))for(let[s,i]of n.entries())wd(e,xd(t,s.toString()),i);else n instanceof Date?e.push([t,n.toISOString()]):typeof n=="boolean"?e.push([t,n?"1":"0"]):typeof n=="string"?e.push([t,n]):typeof n=="number"?e.push([t,`${n}`]):n==null?e.push([t,""]):rb(n)&&!g.isValidElement(n)&&bd(n,t,e)}function ob(e){var t,n;let s=(t=e==null?void 0:e.form)!=null?t:e.closest("form");if(s){for(let i of s.elements)if(i!==e&&(i.tagName==="INPUT"&&i.type==="submit"||i.tagName==="BUTTON"&&i.type==="submit"||i.nodeName==="INPUT"&&i.type==="image")){i.click();return}(n=s.requestSubmit)==null||n.call(s)}}function rb(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}let ab="span";var kn=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(kn||{});function lb(e,t){var n;let{features:s=1,...i}=e,o={ref:t,"aria-hidden":(s&2)===2?!0:(n=i["aria-hidden"])!=null?n:void 0,hidden:(s&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(s&4)===4&&(s&2)!==2&&{display:"none"}}};return we()({ourProps:o,theirProps:i,slot:{},defaultTag:ab,name:"Hidden"})}let es=xe(lb),_d=g.createContext(null);function db(e){let[t,n]=g.useState(null);return g.createElement(_d.Provider,{value:{target:t}},e.children,g.createElement(es,{features:kn.Hidden,ref:n}))}function cb({children:e}){let t=g.useContext(_d);if(!t)return g.createElement(g.Fragment,null,e);let{target:n}=t;return n?Ae.createPortal(g.createElement(g.Fragment,null,e),n):null}function yd({data:e,form:t,disabled:n,onReset:s,overrides:i}){let[o,r]=g.useState(null),a=Ft();return g.useEffect(()=>{if(s&&o)return a.addEventListener(o,"reset",s)},[o,t,s]),g.createElement(cb,null,g.createElement(ub,{setForm:r,formId:t}),bd(e).map(([d,c])=>g.createElement(es,{features:kn.Hidden,...en({key:d,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:d,value:c,...i})})))}function ub({setForm:e,formId:t}){return g.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:g.createElement(es,{features:kn.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let s=n.closest("form");s&&e(s)}})}let vd=g.createContext(void 0);function Xi(){return g.useContext(vd)}function hb({id:e,children:t}){return g.createElement(vd.Provider,{value:e},t)}function kd(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function zt(e){return kd(e)&&"tagName"in e}function lt(e){return zt(e)&&"accessKey"in e}function Wt(e){return zt(e)&&"tabIndex"in e}function fb(e){return zt(e)&&"style"in e}function mb(e){return lt(e)&&e.nodeName==="IFRAME"}function Qi(e){return lt(e)&&e.nodeName==="INPUT"}function Dr(e){return lt(e)&&e.nodeName==="LABEL"}function pb(e){return lt(e)&&e.nodeName==="FIELDSET"}function jd(e){return lt(e)&&e.nodeName==="LEGEND"}function gb(e){return zt(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function Or(e){let t=e.parentElement,n=null;for(;t&&!pb(t);)jd(t)&&(n=t),t=t.parentElement;let s=(t==null?void 0:t.getAttribute("disabled"))==="";return s&&bb(n)?!1:s}function bb(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(jd(t))return!1;t=t.previousElementSibling}return!0}let Nd=Symbol();function xb(e,t=!0){return Object.assign(e,{[Nd]:t})}function We(...e){let t=g.useRef(e);g.useEffect(()=>{t.current=e},[e]);let n=K(s=>{for(let i of t.current)i!=null&&(typeof i=="function"?i(s):i.current=s)});return e.every(s=>s==null||(s==null?void 0:s[Nd]))?void 0:n}let Zi=g.createContext(null);Zi.displayName="DescriptionContext";function Sd(){let e=g.useContext(Zi);if(e===null){let t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,Sd),t}return e}function Ir(){var e,t;return(t=(e=g.useContext(Zi))==null?void 0:e.value)!=null?t:void 0}function Lr(){let[e,t]=g.useState([]);return[e.length>0?e.join(" "):void 0,g.useMemo(()=>function(n){let s=K(o=>(t(r=>[...r,o]),()=>t(r=>{let a=r.slice(),d=a.indexOf(o);return d!==-1&&a.splice(d,1),a}))),i=g.useMemo(()=>({register:s,slot:n.slot,name:n.name,props:n.props,value:n.value}),[s,n.slot,n.name,n.props,n.value]);return g.createElement(Zi.Provider,{value:i},n.children)},[t])]}let wb="p";function _b(e,t){let n=g.useId(),s=Qn(),{id:i=`headlessui-description-${n}`,...o}=e,r=Sd(),a=We(t);me(()=>r.register(i),[i,r.register]);let d=Ke({...r.slot,disabled:s||!1}),c={ref:a,...r.props,id:i};return we()({ourProps:c,theirProps:o,slot:d,defaultTag:wb,name:r.name||"Description"})}let yb=xe(_b),Ji=Object.assign(yb,{});var Ie=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(Ie||{});let eo=g.createContext(null);eo.displayName="LabelContext";function Cd(){let e=g.useContext(eo);if(e===null){let t=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,Cd),t}return e}function ts(e){var t,n,s;let i=(n=(t=g.useContext(eo))==null?void 0:t.value)!=null?n:void 0;return((s=e==null?void 0:e.length)!=null?s:0)>0?[i,...e].filter(Boolean).join(" "):i}function Ar({inherit:e=!1}={}){let t=ts(),[n,s]=g.useState([]),i=e?[t,...n].filter(Boolean):n;return[i.length>0?i.join(" "):void 0,g.useMemo(()=>function(o){let r=K(d=>(s(c=>[...c,d]),()=>s(c=>{let u=c.slice(),h=u.indexOf(d);return h!==-1&&u.splice(h,1),u}))),a=g.useMemo(()=>({register:r,slot:o.slot,name:o.name,props:o.props,value:o.value}),[r,o.slot,o.name,o.props,o.value]);return g.createElement(eo.Provider,{value:a},o.children)},[s])]}let vb="label";function kb(e,t){var n;let s=g.useId(),i=Cd(),o=Xi(),r=Qn(),{id:a=`headlessui-label-${s}`,htmlFor:d=o??((n=i.props)==null?void 0:n.htmlFor),passive:c=!1,...u}=e,h=We(t);me(()=>i.register(a),[a,i.register]);let f=K(b=>{let x=b.currentTarget;if(!(b.target!==b.currentTarget&&gb(b.target))&&(Dr(x)&&b.preventDefault(),i.props&&"onClick"in i.props&&typeof i.props.onClick=="function"&&i.props.onClick(b),Dr(x))){let w=document.getElementById(x.htmlFor);if(w){let _=w.getAttribute("disabled");if(_==="true"||_==="")return;let y=w.getAttribute("aria-disabled");if(y==="true"||y==="")return;(Qi(w)&&(w.type==="file"||w.type==="radio"||w.type==="checkbox")||w.role==="radio"||w.role==="checkbox"||w.role==="switch")&&w.click(),w.focus({preventScroll:!0})}}}),m=Ke({...i.slot,disabled:r||!1}),p={ref:h,...i.props,id:a,htmlFor:d,onClick:f};return c&&("onClick"in p&&(delete p.htmlFor,delete p.onClick),"onClick"in u&&delete u.onClick),we()({ourProps:p,theirProps:u,slot:m,defaultTag:d?vb:"div",name:i.name||"Label"})}let jb=xe(kb),Fr=Object.assign(jb,{}),Nb=g.createContext(()=>{});function Sb({value:e,children:t}){return g.createElement(Nb.Provider,{value:e},t)}function ns(e,t,n){let s=n.initialDeps??[],i,o=!0;function r(){var a,d,c;let u;n.key&&((a=n.debug)!=null&&a.call(n))&&(u=Date.now());const h=e();if(!(h.length!==s.length||h.some((p,b)=>s[b]!==p)))return i;s=h;let m;if(n.key&&((d=n.debug)!=null&&d.call(n))&&(m=Date.now()),i=t(...h),n.key&&((c=n.debug)!=null&&c.call(n))){const p=Math.round((Date.now()-u)*100)/100,b=Math.round((Date.now()-m)*100)/100,x=b/16,w=(_,y)=>{for(_=String(_);_.length<y;)_=" "+_;return _};console.info(`%c⏱ ${w(b,5)} /${w(p,5)} ms`,`
            font-size: .6rem;
            font-weight: bold;
            color: hsl(${Math.max(0,Math.min(120-120*x,120))}deg 100% 31%);`,n==null?void 0:n.key)}return n!=null&&n.onChange&&!(o&&n.skipInitialOnChange)&&n.onChange(i),o=!1,i}return r.updateDeps=a=>{s=a},r}function Md(e,t){if(e===void 0)throw new Error(`Unexpected undefined${t?`: ${t}`:""}`);return e}const Cb=(e,t)=>Math.abs(e-t)<1.01,Mb=(e,t,n)=>{let s;return function(...i){e.clearTimeout(s),s=e.setTimeout(()=>t.apply(this,i),n)}},Td=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},Tb=e=>e,Pb=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),s=[];for(let i=t;i<=n;i++)s.push(i);return s},Eb=(e,t)=>{const n=e.scrollElement;if(!n)return;const s=e.targetWindow;if(!s)return;const i=r=>{const{width:a,height:d}=r;t({width:Math.round(a),height:Math.round(d)})};if(i(Td(n)),!s.ResizeObserver)return()=>{};const o=new s.ResizeObserver(r=>{const a=()=>{const d=r[0];if(d!=null&&d.borderBoxSize){const c=d.borderBoxSize[0];if(c){i({width:c.inlineSize,height:c.blockSize});return}}i(Td(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return o.observe(n,{box:"border-box"}),()=>{o.unobserve(n)}},Pd={passive:!0},Ed=typeof window>"u"?!0:"onscrollend"in window,Db=(e,t)=>{const n=e.scrollElement;if(!n)return;const s=e.targetWindow;if(!s)return;let i=0;const o=e.options.useScrollendEvent&&Ed?()=>{}:Mb(s,()=>{t(i,!1)},e.options.isScrollingResetDelay),r=u=>()=>{const{horizontal:h,isRtl:f}=e.options;i=h?n.scrollLeft*(f&&-1||1):n.scrollTop,o(),t(i,u)},a=r(!0),d=r(!1);n.addEventListener("scroll",a,Pd);const c=e.options.useScrollendEvent&&Ed;return c&&n.addEventListener("scrollend",d,Pd),()=>{n.removeEventListener("scroll",a),c&&n.removeEventListener("scrollend",d)}},Ob=(e,t,n)=>{if(t!=null&&t.borderBoxSize){const s=t.borderBoxSize[0];if(s)return Math.round(s[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},Ib=(e,{adjustments:t=0,behavior:n},s)=>{var i,o;const r=e+t;(o=(i=s.scrollElement)==null?void 0:i.scrollTo)==null||o.call(i,{[s.options.horizontal?"left":"top"]:r,behavior:n})};class Lb{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.currentScrollToIndex=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let n=null;const s=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(i=>{i.forEach(o=>{const r=()=>{this._measureElement(o.target,o)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()})}));return{disconnect:()=>{var i;(i=s())==null||i.disconnect(),n=null},observe:i=>{var o;return(o=s())==null?void 0:o.observe(i,{box:"border-box"})},unobserve:i=>{var o;return(o=s())==null?void 0:o.unobserve(i)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([s,i])=>{typeof i>"u"&&delete n[s]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Tb,rangeExtractor:Pb,onChange:()=>{},measureElement:Ob,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...n}},this.notify=n=>{var s,i;(i=(s=this.options).onChange)==null||i.call(s,this,n)},this.maybeNotify=ns(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=o,this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,s)=>{const i=new Map,o=new Map;for(let r=s-1;r>=0;r--){const a=n[r];if(i.has(a.lane))continue;const d=o.get(a.lane);if(d==null||a.end>d.end?o.set(a.lane,a):a.end<d.end&&i.set(a.lane,!0),i.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((r,a)=>r.end===a.end?r.index-a.index:r.end-a.end)[0]:void 0},this.getMeasurementOptions=ns(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(n,s,i,o,r,a)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:s,scrollMargin:i,getItemKey:o,enabled:r,lanes:a}),{key:!1}),this.getMeasurements=ns(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:s,scrollMargin:i,getItemKey:o,enabled:r,lanes:a},d)=>{if(!r)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const f of this.laneAssignments.keys())f>=n&&this.laneAssignments.delete(f);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(f=>{this.itemSizeCache.set(f.key,f.size)}));const c=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1);const u=this.measurementsCache.slice(0,c),h=new Array(a).fill(void 0);for(let f=0;f<c;f++){const m=u[f];m&&(h[m.lane]=f)}for(let f=c;f<n;f++){const m=o(f),p=this.laneAssignments.get(f);let b,x;if(p!==void 0&&this.options.lanes>1){b=p;const v=h[b],j=v!==void 0?u[v]:void 0;x=j?j.end+this.options.gap:s+i}else{const v=this.options.lanes===1?u[f-1]:this.getFurthestMeasurement(u,f);x=v?v.end+this.options.gap:s+i,b=v?v.lane:f%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(f,b)}const w=d.get(m),_=typeof w=="number"?w:this.options.estimateSize(f),y=x+_;u[f]={index:f,start:x,size:_,end:y,key:m,lane:b},h[b]=f}return this.measurementsCache=u,u},{key:!1,debug:()=>this.options.debug}),this.calculateRange=ns(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,s,i,o)=>this.range=n.length>0&&s>0?Ab({measurements:n,outerSize:s,scrollOffset:i,lanes:o}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=ns(()=>{let n=null,s=null;const i=this.calculateRange();return i&&(n=i.startIndex,s=i.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,s]},(n,s,i,o,r)=>o===null||r===null?[]:n({startIndex:o,endIndex:r,overscan:s,count:i}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const s=this.options.indexAttribute,i=n.getAttribute(s);return i?parseInt(i,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this._measureElement=(n,s)=>{const i=this.indexFromElement(n),o=this.measurementsCache[i];if(!o)return;const r=o.key,a=this.elementsCache.get(r);a!==n&&(a&&this.observer.unobserve(a),this.observer.observe(n),this.elementsCache.set(r,n)),n.isConnected&&this.resizeItem(i,this.options.measureElement(n,s,this))},this.resizeItem=(n,s)=>{const i=this.measurementsCache[n];if(!i)return;const o=this.itemSizeCache.get(i.key)??i.size,r=s-o;r!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(i,r,this):i.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=r,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(i.index),this.itemSizeCache=new Map(this.itemSizeCache.set(i.key,s)),this.notify(!1))},this.measureElement=n=>{if(!n){this.elementsCache.forEach((s,i)=>{s.isConnected||(this.observer.unobserve(s),this.elementsCache.delete(i))});return}this._measureElement(n,void 0)},this.getVirtualItems=ns(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,s)=>{const i=[];for(let o=0,r=n.length;o<r;o++){const a=n[o],d=s[a];i.push(d)}return i},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const s=this.getMeasurements();if(s.length!==0)return Md(s[Dd(0,s.length-1,i=>Md(s[i]).start,n)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(n,s,i=0)=>{if(!this.scrollElement)return 0;const o=this.getSize(),r=this.getScrollOffset();s==="auto"&&(s=n>=r+o?"end":"start"),s==="center"?n+=(i-o)/2:s==="end"&&(n-=o);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,n),0)},this.getOffsetForIndex=(n,s="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const i=this.measurementsCache[n];if(!i)return;const o=this.getSize(),r=this.getScrollOffset();if(s==="auto")if(i.end>=r+o-this.options.scrollPaddingEnd)s="end";else if(i.start<=r+this.options.scrollPaddingStart)s="start";else return[r,s];if(s==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),s];const a=s==="end"?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,s,i.size),s]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(n,{align:s="start",behavior:i}={})=>{i==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,s),{adjustments:void 0,behavior:i})},this.scrollToIndex=(n,{align:s="auto",behavior:i}={})=>{i==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),n=Math.max(0,Math.min(n,this.options.count-1)),this.currentScrollToIndex=n;let o=0;const r=10,a=c=>{if(!this.targetWindow)return;const u=this.getOffsetForIndex(n,c);if(!u){console.warn("Failed to get offset for index:",n);return}const[h,f]=u;this._scrollToOffset(h,{adjustments:void 0,behavior:i}),this.targetWindow.requestAnimationFrame(()=>{if(!this.targetWindow)return;const m=()=>{if(this.currentScrollToIndex!==n)return;const p=this.getScrollOffset(),b=this.getOffsetForIndex(n,f);if(!b){console.warn("Failed to get offset for index:",n);return}Cb(b[0],p)||d(f)};this.isDynamicMode()?this.targetWindow.requestAnimationFrame(m):m()})},d=c=>{this.targetWindow&&this.currentScrollToIndex===n&&(o++,o<r?this.targetWindow.requestAnimationFrame(()=>a(c)):console.warn(`Failed to scroll to index ${n} after ${r} attempts.`))};a(s)},this.scrollBy=(n,{behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+n,{adjustments:void 0,behavior:s})},this.getTotalSize=()=>{var n;const s=this.getMeasurements();let i;if(s.length===0)i=this.options.paddingStart;else if(this.options.lanes===1)i=((n=s[s.length-1])==null?void 0:n.end)??0;else{const o=Array(this.options.lanes).fill(null);let r=s.length-1;for(;r>=0&&o.some(a=>a===null);){const a=s[r];o[a.lane]===null&&(o[a.lane]=a.end),r--}i=Math.max(...o.filter(a=>a!==null))}return Math.max(i-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:s,behavior:i})=>{this.options.scrollToFn(n,{behavior:i,adjustments:s},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(t)}}const Dd=(e,t,n,s)=>{for(;e<=t;){const i=(e+t)/2|0,o=n(i);if(o<s)e=i+1;else if(o>s)t=i-1;else return i}return e>0?e-1:0};function Ab({measurements:e,outerSize:t,scrollOffset:n,lanes:s}){const i=e.length-1,o=d=>e[d].start;if(e.length<=s)return{startIndex:0,endIndex:i};let r=Dd(0,i,o,n),a=r;if(s===1)for(;a<i&&e[a].end<n+t;)a++;else if(s>1){const d=Array(s).fill(0);for(;a<i&&d.some(u=>u<n+t);){const u=e[a];d[u.lane]=u.end,a++}const c=Array(s).fill(n+t);for(;r>=0&&c.some(u=>u>=n);){const u=e[r];c[u.lane]=u.start,r--}r=Math.max(0,r-r%s),a=Math.min(i,a+(s-1-a%s))}return{startIndex:r,endIndex:a}}const Od=typeof document<"u"?q.useLayoutEffect:q.useEffect;function Fb({useFlushSync:e=!0,...t}){const n=q.useReducer(()=>({}),{})[1],s={...t,onChange:(o,r)=>{var a;e&&r?Ae.flushSync(n):n(),(a=t.onChange)==null||a.call(t,o,r)}},[i]=q.useState(()=>new Lb(s));return i.setOptions(s),Od(()=>i._didMount(),[]),Od(()=>i._willUpdate()),i}function zb(e){return Fb({observeElementRect:Eb,observeElementOffset:Db,scrollToFn:Ib,...e})}function Wb(e,t){return e!==null&&t!==null&&typeof e=="object"&&typeof t=="object"&&"id"in e&&"id"in t?e.id===t.id:e===t}function Bb(e=Wb){return g.useCallback((t,n)=>{if(typeof e=="string"){let s=e;return(t==null?void 0:t[s])===(n==null?void 0:n[s])}return e(t,n)},[e])}function Id(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function Ld(e,t,n=!1){let[s,i]=g.useState(()=>Id(t));return me(()=>{if(!t||!e)return;let o=at();return o.requestAnimationFrame(function r(){o.requestAnimationFrame(r),i(a=>{let d=Id(t);return d.width===a.width&&d.height===a.height?a:d})}),()=>{o.dispose()}},[t,e]),n?{width:`${s.width}px`,height:`${s.height}px`}:s}var zr=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(zr||{});function Hb(e){let t=g.useRef(null),n=K(i=>{t.current=i.pointerType,!Or(i.currentTarget)&&i.pointerType==="mouse"&&i.button===zr.Left&&(i.preventDefault(),e(i))}),s=K(i=>{t.current!=="mouse"&&(Or(i.currentTarget)||e(i))});return{onPointerDown:n,onClick:s}}let Ad=class extends Map{constructor(t){super(),this.factory=t}get(t){let n=super.get(t);return n===void 0&&(n=this.factory(t),this.set(t,n)),n}};var Vb=Object.defineProperty,Rb=(e,t,n)=>t in e?Vb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$b=(e,t,n)=>(Rb(e,typeof t!="symbol"?t+"":t,n),n),Fd=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},dt=(e,t,n)=>(Fd(e,t,"read from private field"),n?n.call(e):t.get(e)),Wr=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},zd=(e,t,n,s)=>(Fd(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n),jt,Ds,Os;let Wd=class{constructor(t){Wr(this,jt,{}),Wr(this,Ds,new Ad(()=>new Set)),Wr(this,Os,new Set),$b(this,"disposables",at()),zd(this,jt,t),kt.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return dt(this,jt)}subscribe(t,n){if(kt.isServer)return()=>{};let s={selector:t,callback:n,current:t(dt(this,jt))};return dt(this,Os).add(s),this.disposables.add(()=>{dt(this,Os).delete(s)})}on(t,n){return kt.isServer?()=>{}:(dt(this,Ds).get(t).add(n),this.disposables.add(()=>{dt(this,Ds).get(t).delete(n)}))}send(t){let n=this.reduce(dt(this,jt),t);if(n!==dt(this,jt)){zd(this,jt,n);for(let s of dt(this,Os)){let i=s.selector(dt(this,jt));Bd(s.current,i)||(s.current=i,s.callback(i))}for(let s of dt(this,Ds).get(t.type))s(dt(this,jt),t)}}};jt=new WeakMap,Ds=new WeakMap,Os=new WeakMap;function Bd(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null?!1:Array.isArray(e)&&Array.isArray(t)?e.length!==t.length?!1:Br(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:Br(e.entries(),t.entries()):Hd(e)&&Hd(t)?Br(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function Br(e,t){do{let n=e.next(),s=t.next();if(n.done&&s.done)return!0;if(n.done||s.done||!Object.is(n.value,s.value))return!1}while(!0)}function Hd(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}var Ub=Object.defineProperty,qb=(e,t,n)=>t in e?Ub(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Vd=(e,t,n)=>(qb(e,typeof t!="symbol"?t+"":t,n),n),Rd=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(Rd||{});let Yb={0(e,t){let n=t.id,s=e.stack,i=e.stack.indexOf(n);if(i!==-1){let o=e.stack.slice();return o.splice(i,1),o.push(n),s=o,{...e,stack:s}}return{...e,stack:[...e.stack,n]}},1(e,t){let n=t.id,s=e.stack.indexOf(n);if(s===-1)return e;let i=e.stack.slice();return i.splice(s,1),{...e,stack:i}}},Kb=class $p extends Wd{constructor(){super(...arguments),Vd(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),Vd(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new $p({stack:[]})}reduce(t,n){return Ge(n.type,Yb,t,n)}};const to=new Ad(()=>Kb.new());var $d={exports:{}},Ud={};/**
 * @license React
 * use-sync-external-store-with-selector.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Is=g;function Gb(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Xb=typeof Object.is=="function"?Object.is:Gb,Qb=Is.useSyncExternalStore,Zb=Is.useRef,Jb=Is.useEffect,e0=Is.useMemo,t0=Is.useDebugValue;Ud.useSyncExternalStoreWithSelector=function(e,t,n,s,i){var o=Zb(null);if(o.current===null){var r={hasValue:!1,value:null};o.current=r}else r=o.current;o=e0(function(){function d(m){if(!c){if(c=!0,u=m,m=s(m),i!==void 0&&r.hasValue){var p=r.value;if(i(p,m))return h=p}return h=m}if(p=h,Xb(u,m))return p;var b=s(m);return i!==void 0&&i(p,b)?(u=m,p):(u=m,h=b)}var c=!1,u,h,f=n===void 0?null:n;return[function(){return d(t())},f===null?void 0:function(){return d(f())}]},[t,n,s,i]);var a=Qb(e,o[0],o[1]);return Jb(function(){r.hasValue=!0,r.value=a},[a]),t0(a),a},$d.exports=Ud;var n0=$d.exports;function Ee(e,t,n=Bd){return n0.useSyncExternalStoreWithSelector(K(s=>e.subscribe(s0,s)),K(()=>e.state),K(()=>e.state),K(t),n)}function s0(e){return e}function Ls(e,t){let n=g.useId(),s=to.get(t),[i,o]=Ee(s,g.useCallback(r=>[s.selectors.isTop(r,n),s.selectors.inStack(r,n)],[s,n]));return me(()=>{if(e)return s.actions.push(n),()=>s.actions.pop(n)},[s,e,n]),e?o?i:!0:!1}let Hr=new Map,As=new Map;function qd(e){var t;let n=(t=As.get(e))!=null?t:0;return As.set(e,n+1),n!==0?()=>Yd(e):(Hr.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>Yd(e))}function Yd(e){var t;let n=(t=As.get(e))!=null?t:1;if(n===1?As.delete(e):As.set(e,n-1),n!==1)return;let s=Hr.get(e);s&&(s["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",s["aria-hidden"]),e.inert=s.inert,Hr.delete(e))}function Kd(e,{allowed:t,disallowed:n}={}){let s=Ls(e,"inert-others");me(()=>{var i,o;if(!s)return;let r=at();for(let d of(i=n==null?void 0:n())!=null?i:[])d&&r.add(qd(d));let a=(o=t==null?void 0:t())!=null?o:[];for(let d of a){if(!d)continue;let c=vn(d);if(!c)continue;let u=d.parentElement;for(;u&&u!==c.body;){for(let h of u.children)a.some(f=>h.contains(f))||r.add(qd(h));u=u.parentElement}}return r.dispose},[s,t,n])}function Gd(e,t,n){let s=Zt(i=>{let o=i.getBoundingClientRect();o.x===0&&o.y===0&&o.width===0&&o.height===0&&n()});g.useEffect(()=>{if(!e)return;let i=t===null?null:lt(t)?t:t.current;if(!i)return;let o=at();if(typeof ResizeObserver<"u"){let r=new ResizeObserver(()=>s.current(i));r.observe(i),o.add(()=>r.disconnect())}if(typeof IntersectionObserver<"u"){let r=new IntersectionObserver(()=>s.current(i));r.observe(i),o.add(()=>r.disconnect())}return()=>o.dispose()},[t,s,e])}let no=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","details>summary","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),i0=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var Bt=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e[e.AutoFocus=64]="AutoFocus",e))(Bt||{}),Vr=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(Vr||{}),o0=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(o0||{});function r0(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(no)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function a0(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(i0)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Xd=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Xd||{});function l0(e,t=0){var n;return e===((n=vn(e))==null?void 0:n.body)?!1:Ge(t,{0(){return e.matches(no)},1(){let s=e;for(;s!==null;){if(s.matches(no))return!0;s=s.parentElement}return!1}})}var d0=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(d0||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function Ht(e){e==null||e.focus({preventScroll:!0})}let c0=["textarea","input"].join(",");function u0(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,c0))!=null?n:!1}function Qd(e,t=n=>n){return e.slice().sort((n,s)=>{let i=t(n),o=t(s);if(i===null||o===null)return 0;let r=i.compareDocumentPosition(o);return r&Node.DOCUMENT_POSITION_FOLLOWING?-1:r&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function Fs(e,t,{sorted:n=!0,relativeTo:s=null,skipElements:i=[]}={}){let o=Array.isArray(e)?e.length>0?Mr(e[0]):document:Mr(e),r=Array.isArray(e)?n?Qd(e):e:t&64?a0(e):r0(e);i.length>0&&r.length>1&&(r=r.filter(m=>!i.some(p=>p!=null&&"current"in p?(p==null?void 0:p.current)===m:p===m))),s=s??(o==null?void 0:o.activeElement);let a=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),d=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,r.indexOf(s))-1;if(t&4)return Math.max(0,r.indexOf(s))+1;if(t&8)return r.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),c=t&32?{preventScroll:!0}:{},u=0,h=r.length,f;do{if(u>=h||u+h<=0)return 0;let m=d+u;if(t&16)m=(m+h)%h;else{if(m<0)return 3;if(m>=h)return 1}f=r[m],f==null||f.focus(c),u+=a}while(f!==hd(f));return t&6&&u0(f)&&f.select(),2}function Zd(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function h0(){return/Android/gi.test(window.navigator.userAgent)}function Rr(){return Zd()||h0()}function ss(e,t,n,s){let i=Zt(n);g.useEffect(()=>{if(!e)return;function o(r){i.current(r)}return document.addEventListener(t,o,s),()=>document.removeEventListener(t,o,s)},[e,t,s])}function Jd(e,t,n,s){let i=Zt(n);g.useEffect(()=>{if(!e)return;function o(r){i.current(r)}return window.addEventListener(t,o,s),()=>window.removeEventListener(t,o,s)},[e,t,s])}const ec=30;function tc(e,t,n){let s=Zt(n),i=g.useCallback(function(a,d){if(a.defaultPrevented)return;let c=d(a);if(c===null||!c.getRootNode().contains(c)||!c.isConnected)return;let u=function h(f){return typeof f=="function"?h(f()):Array.isArray(f)||f instanceof Set?f:[f]}(t);for(let h of u)if(h!==null&&(h.contains(c)||a.composed&&a.composedPath().includes(h)))return;return!l0(c,Xd.Loose)&&c.tabIndex!==-1&&a.preventDefault(),s.current(a,c)},[s,t]),o=g.useRef(null);ss(e,"pointerdown",a=>{var d,c;Rr()||(o.current=((c=(d=a.composedPath)==null?void 0:d.call(a))==null?void 0:c[0])||a.target)},!0),ss(e,"pointerup",a=>{if(Rr()||!o.current)return;let d=o.current;return o.current=null,i(a,()=>d)},!0);let r=g.useRef({x:0,y:0});ss(e,"touchstart",a=>{r.current.x=a.touches[0].clientX,r.current.y=a.touches[0].clientY},!0),ss(e,"touchend",a=>{let d={x:a.changedTouches[0].clientX,y:a.changedTouches[0].clientY};if(!(Math.abs(d.x-r.current.x)>=ec||Math.abs(d.y-r.current.y)>=ec))return i(a,()=>Wt(a.target)?a.target:null)},!0),Jd(e,"blur",a=>i(a,()=>mb(window.document.activeElement)?window.document.activeElement:null),!0)}function zs(...e){return g.useMemo(()=>vn(...e),[...e])}var f0=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(f0||{});const Ws={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},m0=200,nc=5;function p0(e,{trigger:t,action:n,close:s,select:i}){let o=g.useRef(null),r=g.useRef(null),a=g.useRef(null);ss(e&&t!==null,"pointerdown",d=>{kd(d==null?void 0:d.target)&&t!=null&&t.contains(d.target)&&(r.current=d.x,a.current=d.y,o.current=d.timeStamp)}),ss(e&&t!==null,"pointerup",d=>{var c,u;let h=o.current;if(h===null||(o.current=null,!Wt(d.target))||Math.abs(d.x-((c=r.current)!=null?c:d.x))<nc&&Math.abs(d.y-((u=a.current)!=null?u:d.y))<nc)return;let f=n(d);switch(f.kind){case 0:return;case 1:{d.timeStamp-h>m0&&(i(f.target),s());break}case 2:{s();break}}},{capture:!0})}function $r(e,t,n,s){let i=Zt(n);g.useEffect(()=>{e=e??window;function o(r){i.current(r)}return e.addEventListener(t,o,s),()=>e.removeEventListener(t,o,s)},[e,t,s])}function sc(e){let t=g.useRef({value:"",selectionStart:null,selectionEnd:null});return $r(e,"blur",n=>{let s=n.target;Qi(s)&&(t.current={value:s.value,selectionStart:s.selectionStart,selectionEnd:s.selectionEnd})}),K(()=>{if(!Tr(e)&&Qi(e)&&e.isConnected){if(e.focus({preventScroll:!0}),e.value!==t.current.value)e.setSelectionRange(e.value.length,e.value.length);else{let{selectionStart:n,selectionEnd:s}=t.current;n!==null&&s!==null&&e.setSelectionRange(n,s)}t.current={value:"",selectionStart:null,selectionEnd:null}}})}function ic(e,t){return g.useMemo(()=>{var n;if(e.type)return e.type;let s=(n=e.as)!=null?n:"button";if(typeof s=="string"&&s.toLowerCase()==="button"||(t==null?void 0:t.tagName)==="BUTTON"&&!t.hasAttribute("type"))return"button"},[e.type,e.as,t])}function g0(e){return g.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function b0(e,t){let n=e(),s=new Set;return{getSnapshot(){return n},subscribe(i){return s.add(i),()=>s.delete(i)},dispatch(i,...o){let r=t[i].call(n,...o);r&&(n=r,s.forEach(a=>a()))}}}function x0(){let e;return{before({doc:t}){var n;let s=t.documentElement,i=(n=t.defaultView)!=null?n:window;e=Math.max(0,i.innerWidth-s.clientWidth)},after({doc:t,d:n}){let s=t.documentElement,i=Math.max(0,s.clientWidth-s.offsetWidth),o=Math.max(0,e-i);n.style(s,"paddingRight",`${o}px`)}}}function w0(){return Zd()?{before({doc:e,d:t,meta:n}){function s(i){for(let o of n().containers)for(let r of o())if(r.contains(i))return!0;return!1}t.microTask(()=>{var i;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let a=at();a.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>a.dispose()))}let o=(i=window.scrollY)!=null?i:window.pageYOffset,r=null;t.addEventListener(e,"click",a=>{if(Wt(a.target))try{let d=a.target.closest("a");if(!d)return;let{hash:c}=new URL(d.href),u=e.querySelector(c);Wt(u)&&!s(u)&&(r=u)}catch{}},!0),t.group(a=>{t.addEventListener(e,"touchstart",d=>{if(a.dispose(),Wt(d.target)&&fb(d.target))if(s(d.target)){let c=d.target;for(;c.parentElement&&s(c.parentElement);)c=c.parentElement;a.style(c,"overscrollBehavior","contain")}else a.style(d.target,"touchAction","none")})}),t.addEventListener(e,"touchmove",a=>{if(Wt(a.target)){if(Qi(a.target))return;if(s(a.target)){let d=a.target;for(;d.parentElement&&d.dataset.headlessuiPortal!==""&&!(d.scrollHeight>d.clientHeight||d.scrollWidth>d.clientWidth);)d=d.parentElement;d.dataset.headlessuiPortal===""&&a.preventDefault()}else a.preventDefault()}},{passive:!1}),t.add(()=>{var a;let d=(a=window.scrollY)!=null?a:window.pageYOffset;o!==d&&window.scrollTo(0,o),r&&r.isConnected&&(r.scrollIntoView({block:"nearest"}),r=null)})})}}:{}}function _0(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function oc(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let jn=b0(()=>new Map,{PUSH(e,t){var n;let s=(n=this.get(e))!=null?n:{doc:e,count:0,d:at(),meta:new Set,computedMeta:{}};return s.count++,s.meta.add(t),s.computedMeta=oc(s.meta),this.set(e,s),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t),n.computedMeta=oc(n.meta)),this},SCROLL_PREVENT(e){let t={doc:e.doc,d:e.d,meta(){return e.computedMeta}},n=[w0(),x0(),_0()];n.forEach(({before:s})=>s==null?void 0:s(t)),n.forEach(({after:s})=>s==null?void 0:s(t))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});jn.subscribe(()=>{let e=jn.getSnapshot(),t=new Map;for(let[n]of e)t.set(n,n.documentElement.style.overflow);for(let n of e.values()){let s=t.get(n.doc)==="hidden",i=n.count!==0;(i&&!s||!i&&s)&&jn.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&jn.dispatch("TEARDOWN",n)}});function y0(e,t,n=()=>({containers:[]})){let s=g0(jn),i=t?s.get(t):void 0,o=i?i.count>0:!1;return me(()=>{if(!(!t||!e))return jn.dispatch("PUSH",t,n),()=>jn.dispatch("POP",t,n)},[e,t]),o}function rc(e,t,n=()=>[document.body]){let s=Ls(e,"scroll-lock");y0(s,t,i=>{var o;return{containers:[...(o=i.containers)!=null?o:[],n]}})}function ac(e){return[e.screenX,e.screenY]}function v0(){let e=g.useRef([-1,-1]);return{wasMoved(t){let n=ac(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=ac(t)}}}function k0(e=0){let[t,n]=g.useState(e),s=g.useCallback(d=>n(d),[]),i=g.useCallback(d=>n(c=>c|d),[]),o=g.useCallback(d=>(t&d)===d,[t]),r=g.useCallback(d=>n(c=>c&~d),[]),a=g.useCallback(d=>n(c=>c^d),[]);return{flags:t,setFlag:s,addFlag:i,hasFlag:o,removeFlag:r,toggleFlag:a}}var lc,dc;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((lc=process==null?void 0:process.env)==null?void 0:lc.NODE_ENV)==="test"&&typeof((dc=Element==null?void 0:Element.prototype)==null?void 0:dc.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
`)),[]});var j0=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(j0||{});function cc(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function uc(e,t,n,s){let[i,o]=g.useState(n),{hasFlag:r,addFlag:a,removeFlag:d}=k0(e&&i?3:0),c=g.useRef(!1),u=g.useRef(!1),h=Ft();return me(()=>{var f;if(e){if(n&&o(!0),!t){n&&a(3);return}return(f=s==null?void 0:s.start)==null||f.call(s,n),N0(t,{inFlight:c,prepare(){u.current?u.current=!1:u.current=c.current,c.current=!0,!u.current&&(n?(a(3),d(4)):(a(4),d(2)))},run(){u.current?n?(d(3),a(4)):(d(4),a(3)):n?d(1):a(1)},done(){var m;u.current&&M0(t)||(c.current=!1,d(7),n||o(!1),(m=s==null?void 0:s.end)==null||m.call(s,n))}})}},[e,n,t,h]),e?[i,{closed:r(1),enter:r(2),leave:r(4),transition:r(2)||r(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function N0(e,{prepare:t,run:n,done:s,inFlight:i}){let o=at();return C0(e,{prepare:t,inFlight:i}),o.nextFrame(()=>{n(),o.requestAnimationFrame(()=>{o.add(S0(e,s))})}),o.dispose}function S0(e,t){var n,s;let i=at();if(!e)return i.dispose;let o=!1;i.add(()=>{o=!0});let r=(s=(n=e.getAnimations)==null?void 0:n.call(e).filter(a=>a instanceof CSSTransition))!=null?s:[];return r.length===0?(t(),i.dispose):(Promise.allSettled(r.map(a=>a.finished)).then(()=>{o||t()}),i.dispose)}function C0(e,{inFlight:t,prepare:n}){if(t!=null&&t.current){n();return}let s=e.style.transition;e.style.transition="none",n(),e.offsetHeight,e.style.transition=s}function M0(e){var t,n;return((n=(t=e.getAnimations)==null?void 0:t.call(e))!=null?n:[]).some(s=>s instanceof CSSTransition&&s.playState!=="finished")}function T0(e,{container:t,accept:n,walk:s}){let i=g.useRef(n),o=g.useRef(s);g.useEffect(()=>{i.current=n,o.current=s},[n,s]),me(()=>{if(!t||!e)return;let r=vn(t);if(!r)return;let a=i.current,d=o.current,c=Object.assign(h=>a(h),{acceptNode:a}),u=r.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,c,!1);for(;u.nextNode();)d(u.currentNode)},[t,e,i,o])}function Bs(e,t){let n=g.useRef([]),s=K(e);g.useEffect(()=>{let i=[...n.current];for(let[o,r]of t.entries())if(n.current[o]!==r){let a=s(t,i);return n.current=t,a}},[s,...t])}function so(){return typeof window<"u"}function is(e){return hc(e)?(e.nodeName||"").toLowerCase():"#document"}function st(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Nt(e){var t;return(t=(hc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function hc(e){return so()?e instanceof Node||e instanceof st(e).Node:!1}function Xe(e){return so()?e instanceof Element||e instanceof st(e).Element:!1}function St(e){return so()?e instanceof HTMLElement||e instanceof st(e).HTMLElement:!1}function fc(e){return!so()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof st(e).ShadowRoot}const P0=new Set(["inline","contents"]);function Hs(e){const{overflow:t,overflowX:n,overflowY:s,display:i}=gt(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&!P0.has(i)}const E0=new Set(["table","td","th"]);function D0(e){return E0.has(is(e))}const O0=[":popover-open",":modal"];function io(e){return O0.some(t=>{try{return e.matches(t)}catch{return!1}})}const I0=["transform","translate","scale","rotate","perspective"],L0=["transform","translate","scale","rotate","perspective","filter"],A0=["paint","layout","strict","content"];function Ur(e){const t=qr(),n=Xe(e)?gt(e):e;return I0.some(s=>n[s]?n[s]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||L0.some(s=>(n.willChange||"").includes(s))||A0.some(s=>(n.contain||"").includes(s))}function F0(e){let t=tn(e);for(;St(t)&&!os(t);){if(Ur(t))return t;if(io(t))return null;t=tn(t)}return null}function qr(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const z0=new Set(["html","body","#document"]);function os(e){return z0.has(is(e))}function gt(e){return st(e).getComputedStyle(e)}function oo(e){return Xe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function tn(e){if(is(e)==="html")return e;const t=e.assignedSlot||e.parentNode||fc(e)&&e.host||Nt(e);return fc(t)?t.host:t}function mc(e){const t=tn(e);return os(t)?e.ownerDocument?e.ownerDocument.body:e.body:St(t)&&Hs(t)?t:mc(t)}function Vs(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=mc(e),o=i===((s=e.ownerDocument)==null?void 0:s.body),r=st(i);if(o){const a=Yr(r);return t.concat(r,r.visualViewport||[],Hs(i)?i:[],a&&n?Vs(a):[])}return t.concat(i,Vs(i,[],n))}function Yr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function W0(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:s}=t;return n+"/"+s}).join(" "):navigator.userAgent}const Nn=Math.min,Be=Math.max,Rs=Math.round,ro=Math.floor,Ct=e=>({x:e,y:e}),B0={left:"right",right:"left",bottom:"top",top:"bottom"},H0={start:"end",end:"start"};function pc(e,t,n){return Be(e,Nn(t,n))}function rs(e,t){return typeof e=="function"?e(t):e}function nn(e){return e.split("-")[0]}function $s(e){return e.split("-")[1]}function gc(e){return e==="x"?"y":"x"}function bc(e){return e==="y"?"height":"width"}const V0=new Set(["top","bottom"]);function Vt(e){return V0.has(nn(e))?"y":"x"}function xc(e){return gc(Vt(e))}function R0(e,t,n){n===void 0&&(n=!1);const s=$s(e),i=xc(e),o=bc(i);let r=i==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(r=ao(r)),[r,ao(r)]}function $0(e){const t=ao(e);return[Kr(e),t,Kr(t)]}function Kr(e){return e.replace(/start|end/g,t=>H0[t])}const wc=["left","right"],_c=["right","left"],U0=["top","bottom"],q0=["bottom","top"];function Y0(e,t,n){switch(e){case"top":case"bottom":return n?t?_c:wc:t?wc:_c;case"left":case"right":return t?U0:q0;default:return[]}}function K0(e,t,n,s){const i=$s(e);let o=Y0(nn(e),n==="start",s);return i&&(o=o.map(r=>r+"-"+i),t&&(o=o.concat(o.map(Kr)))),o}function ao(e){return e.replace(/left|right|bottom|top/g,t=>B0[t])}function G0(e){return{top:0,right:0,bottom:0,left:0,...e}}function X0(e){return typeof e!="number"?G0(e):{top:e,right:e,bottom:e,left:e}}function lo(e){const{x:t,y:n,width:s,height:i}=e;return{width:s,height:i,top:n,left:t,right:t+s,bottom:n+i,x:t,y:n}}function yc(e,t,n){let{reference:s,floating:i}=e;const o=Vt(t),r=xc(t),a=bc(r),d=nn(t),c=o==="y",u=s.x+s.width/2-i.width/2,h=s.y+s.height/2-i.height/2,f=s[a]/2-i[a]/2;let m;switch(d){case"top":m={x:u,y:s.y-i.height};break;case"bottom":m={x:u,y:s.y+s.height};break;case"right":m={x:s.x+s.width,y:h};break;case"left":m={x:s.x-i.width,y:h};break;default:m={x:s.x,y:s.y}}switch($s(t)){case"start":m[r]-=f*(n&&c?-1:1);break;case"end":m[r]+=f*(n&&c?-1:1);break}return m}async function vc(e,t){var n;t===void 0&&(t={});const{x:s,y:i,platform:o,rects:r,elements:a,strategy:d}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:f=!1,padding:m=0}=rs(t,e),p=X0(m),x=a[f?h==="floating"?"reference":"floating":h],w=lo(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(x)))==null||n?x:x.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:d})),_=h==="floating"?{x:s,y:i,width:r.floating.width,height:r.floating.height}:r.reference,y=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),v=await(o.isElement==null?void 0:o.isElement(y))?await(o.getScale==null?void 0:o.getScale(y))||{x:1,y:1}:{x:1,y:1},j=lo(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:_,offsetParent:y,strategy:d}):_);return{top:(w.top-j.top+p.top)/v.y,bottom:(j.bottom-w.bottom+p.bottom)/v.y,left:(w.left-j.left+p.left)/v.x,right:(j.right-w.right+p.right)/v.x}}const Q0=async(e,t,n)=>{const{placement:s="bottom",strategy:i="absolute",middleware:o=[],platform:r}=n,a=o.filter(Boolean),d=await(r.isRTL==null?void 0:r.isRTL(t));let c=await r.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:h}=yc(c,s,d),f=s,m={},p=0;for(let x=0;x<a.length;x++){var b;const{name:w,fn:_}=a[x],{x:y,y:v,data:j,reset:k}=await _({x:u,y:h,initialPlacement:s,placement:f,strategy:i,middlewareData:m,rects:c,platform:{...r,detectOverflow:(b=r.detectOverflow)!=null?b:vc},elements:{reference:e,floating:t}});u=y??u,h=v??h,m={...m,[w]:{...m[w],...j}},k&&p<=50&&(p++,typeof k=="object"&&(k.placement&&(f=k.placement),k.rects&&(c=k.rects===!0?await r.getElementRects({reference:e,floating:t,strategy:i}):k.rects),{x:u,y:h}=yc(c,f,d)),x=-1)}return{x:u,y:h,placement:f,strategy:i,middlewareData:m}},Z0=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:i,middlewareData:o,rects:r,initialPlacement:a,platform:d,elements:c}=t,{mainAxis:u=!0,crossAxis:h=!0,fallbackPlacements:f,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:b=!0,...x}=rs(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const w=nn(i),_=Vt(a),y=nn(a)===a,v=await(d.isRTL==null?void 0:d.isRTL(c.floating)),j=f||(y||!b?[ao(a)]:$0(a)),k=p!=="none";!f&&k&&j.push(...K0(a,b,p,v));const C=[a,...j],S=await d.detectOverflow(t,x),T=[];let D=((s=o.flip)==null?void 0:s.overflows)||[];if(u&&T.push(S[w]),h){const $=R0(i,r,v);T.push(S[$[0]],S[$[1]])}if(D=[...D,{placement:i,overflows:T}],!T.every($=>$<=0)){var P,L;const $=(((P=o.flip)==null?void 0:P.index)||0)+1,O=C[$];if(O&&(!(h==="alignment"?_!==Vt(O):!1)||D.every(M=>Vt(M.placement)===_?M.overflows[0]>0:!0)))return{data:{index:$,overflows:D},reset:{placement:O}};let F=(L=D.filter(H=>H.overflows[0]<=0).sort((H,M)=>H.overflows[1]-M.overflows[1])[0])==null?void 0:L.placement;if(!F)switch(m){case"bestFit":{var W;const H=(W=D.filter(M=>{if(k){const E=Vt(M.placement);return E===_||E==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(E=>E>0).reduce((E,V)=>E+V,0)]).sort((M,E)=>M[1]-E[1])[0])==null?void 0:W[0];H&&(F=H);break}case"initialPlacement":F=a;break}if(i!==F)return{reset:{placement:F}}}return{}}}},J0=new Set(["left","top"]);async function ex(e,t){const{placement:n,platform:s,elements:i}=e,o=await(s.isRTL==null?void 0:s.isRTL(i.floating)),r=nn(n),a=$s(n),d=Vt(n)==="y",c=J0.has(r)?-1:1,u=o&&d?-1:1,h=rs(t,e);let{mainAxis:f,crossAxis:m,alignmentAxis:p}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&typeof p=="number"&&(m=a==="end"?p*-1:p),d?{x:m*u,y:f*c}:{x:f*c,y:m*u}}const tx=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:i,y:o,placement:r,middlewareData:a}=t,d=await ex(t,e);return r===((n=a.offset)==null?void 0:n.placement)&&(s=a.arrow)!=null&&s.alignmentOffset?{}:{x:i+d.x,y:o+d.y,data:{...d,placement:r}}}}},nx=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:i,platform:o}=t,{mainAxis:r=!0,crossAxis:a=!1,limiter:d={fn:w=>{let{x:_,y}=w;return{x:_,y}}},...c}=rs(e,t),u={x:n,y:s},h=await o.detectOverflow(t,c),f=Vt(nn(i)),m=gc(f);let p=u[m],b=u[f];if(r){const w=m==="y"?"top":"left",_=m==="y"?"bottom":"right",y=p+h[w],v=p-h[_];p=pc(y,p,v)}if(a){const w=f==="y"?"top":"left",_=f==="y"?"bottom":"right",y=b+h[w],v=b-h[_];b=pc(y,b,v)}const x=d.fn({...t,[m]:p,[f]:b});return{...x,data:{x:x.x-n,y:x.y-s,enabled:{[m]:r,[f]:a}}}}}},sx=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:i,rects:o,platform:r,elements:a}=t,{apply:d=()=>{},...c}=rs(e,t),u=await r.detectOverflow(t,c),h=nn(i),f=$s(i),m=Vt(i)==="y",{width:p,height:b}=o.floating;let x,w;h==="top"||h==="bottom"?(x=h,w=f===(await(r.isRTL==null?void 0:r.isRTL(a.floating))?"start":"end")?"left":"right"):(w=h,x=f==="end"?"top":"bottom");const _=b-u.top-u.bottom,y=p-u.left-u.right,v=Nn(b-u[x],_),j=Nn(p-u[w],y),k=!t.middlewareData.shift;let C=v,S=j;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(S=y),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(C=_),k&&!f){const D=Be(u.left,0),P=Be(u.right,0),L=Be(u.top,0),W=Be(u.bottom,0);m?S=p-2*(D!==0||P!==0?D+P:Be(u.left,u.right)):C=b-2*(L!==0||W!==0?L+W:Be(u.top,u.bottom))}await d({...t,availableWidth:S,availableHeight:C});const T=await r.getDimensions(a.floating);return p!==T.width||b!==T.height?{reset:{rects:!0}}:{}}}};function kc(e){const t=gt(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const i=St(e),o=i?e.offsetWidth:n,r=i?e.offsetHeight:s,a=Rs(n)!==o||Rs(s)!==r;return a&&(n=o,s=r),{width:n,height:s,$:a}}function Gr(e){return Xe(e)?e:e.contextElement}function as(e){const t=Gr(e);if(!St(t))return Ct(1);const n=t.getBoundingClientRect(),{width:s,height:i,$:o}=kc(t);let r=(o?Rs(n.width):n.width)/s,a=(o?Rs(n.height):n.height)/i;return(!r||!Number.isFinite(r))&&(r=1),(!a||!Number.isFinite(a))&&(a=1),{x:r,y:a}}const ix=Ct(0);function jc(e){const t=st(e);return!qr()||!t.visualViewport?ix:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ox(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==st(e)?!1:t}function Sn(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=Gr(e);let r=Ct(1);t&&(s?Xe(s)&&(r=as(s)):r=as(e));const a=ox(o,n,s)?jc(o):Ct(0);let d=(i.left+a.x)/r.x,c=(i.top+a.y)/r.y,u=i.width/r.x,h=i.height/r.y;if(o){const f=st(o),m=s&&Xe(s)?st(s):s;let p=f,b=Yr(p);for(;b&&s&&m!==p;){const x=as(b),w=b.getBoundingClientRect(),_=gt(b),y=w.left+(b.clientLeft+parseFloat(_.paddingLeft))*x.x,v=w.top+(b.clientTop+parseFloat(_.paddingTop))*x.y;d*=x.x,c*=x.y,u*=x.x,h*=x.y,d+=y,c+=v,p=st(b),b=Yr(p)}}return lo({width:u,height:h,x:d,y:c})}function co(e,t){const n=oo(e).scrollLeft;return t?t.left+n:Sn(Nt(e)).left+n}function Nc(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-co(e,n),i=n.top+t.scrollTop;return{x:s,y:i}}function rx(e){let{elements:t,rect:n,offsetParent:s,strategy:i}=e;const o=i==="fixed",r=Nt(s),a=t?io(t.floating):!1;if(s===r||a&&o)return n;let d={scrollLeft:0,scrollTop:0},c=Ct(1);const u=Ct(0),h=St(s);if((h||!h&&!o)&&((is(s)!=="body"||Hs(r))&&(d=oo(s)),St(s))){const m=Sn(s);c=as(s),u.x=m.x+s.clientLeft,u.y=m.y+s.clientTop}const f=r&&!h&&!o?Nc(r,d):Ct(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-d.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-d.scrollTop*c.y+u.y+f.y}}function ax(e){return Array.from(e.getClientRects())}function lx(e){const t=Nt(e),n=oo(e),s=e.ownerDocument.body,i=Be(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),o=Be(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let r=-n.scrollLeft+co(e);const a=-n.scrollTop;return gt(s).direction==="rtl"&&(r+=Be(t.clientWidth,s.clientWidth)-i),{width:i,height:o,x:r,y:a}}const Sc=25;function dx(e,t){const n=st(e),s=Nt(e),i=n.visualViewport;let o=s.clientWidth,r=s.clientHeight,a=0,d=0;if(i){o=i.width,r=i.height;const u=qr();(!u||u&&t==="fixed")&&(a=i.offsetLeft,d=i.offsetTop)}const c=co(s);if(c<=0){const u=s.ownerDocument,h=u.body,f=getComputedStyle(h),m=u.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,p=Math.abs(s.clientWidth-h.clientWidth-m);p<=Sc&&(o-=p)}else c<=Sc&&(o+=c);return{width:o,height:r,x:a,y:d}}const cx=new Set(["absolute","fixed"]);function ux(e,t){const n=Sn(e,!0,t==="fixed"),s=n.top+e.clientTop,i=n.left+e.clientLeft,o=St(e)?as(e):Ct(1),r=e.clientWidth*o.x,a=e.clientHeight*o.y,d=i*o.x,c=s*o.y;return{width:r,height:a,x:d,y:c}}function Cc(e,t,n){let s;if(t==="viewport")s=dx(e,n);else if(t==="document")s=lx(Nt(e));else if(Xe(t))s=ux(t,n);else{const i=jc(e);s={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return lo(s)}function Mc(e,t){const n=tn(e);return n===t||!Xe(n)||os(n)?!1:gt(n).position==="fixed"||Mc(n,t)}function hx(e,t){const n=t.get(e);if(n)return n;let s=Vs(e,[],!1).filter(a=>Xe(a)&&is(a)!=="body"),i=null;const o=gt(e).position==="fixed";let r=o?tn(e):e;for(;Xe(r)&&!os(r);){const a=gt(r),d=Ur(r);!d&&a.position==="fixed"&&(i=null),(o?!d&&!i:!d&&a.position==="static"&&!!i&&cx.has(i.position)||Hs(r)&&!d&&Mc(e,r))?s=s.filter(u=>u!==r):i=a,r=tn(r)}return t.set(e,s),s}function fx(e){let{element:t,boundary:n,rootBoundary:s,strategy:i}=e;const r=[...n==="clippingAncestors"?io(t)?[]:hx(t,this._c):[].concat(n),s],a=r[0],d=r.reduce((c,u)=>{const h=Cc(t,u,i);return c.top=Be(h.top,c.top),c.right=Nn(h.right,c.right),c.bottom=Nn(h.bottom,c.bottom),c.left=Be(h.left,c.left),c},Cc(t,a,i));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function mx(e){const{width:t,height:n}=kc(e);return{width:t,height:n}}function px(e,t,n){const s=St(t),i=Nt(t),o=n==="fixed",r=Sn(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const d=Ct(0);function c(){d.x=co(i)}if(s||!s&&!o)if((is(t)!=="body"||Hs(i))&&(a=oo(t)),s){const m=Sn(t,!0,o,t);d.x=m.x+t.clientLeft,d.y=m.y+t.clientTop}else i&&c();o&&!s&&i&&c();const u=i&&!s&&!o?Nc(i,a):Ct(0),h=r.left+a.scrollLeft-d.x-u.x,f=r.top+a.scrollTop-d.y-u.y;return{x:h,y:f,width:r.width,height:r.height}}function Xr(e){return gt(e).position==="static"}function Tc(e,t){if(!St(e)||gt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Nt(e)===n&&(n=n.ownerDocument.body),n}function Pc(e,t){const n=st(e);if(io(e))return n;if(!St(e)){let i=tn(e);for(;i&&!os(i);){if(Xe(i)&&!Xr(i))return i;i=tn(i)}return n}let s=Tc(e,t);for(;s&&D0(s)&&Xr(s);)s=Tc(s,t);return s&&os(s)&&Xr(s)&&!Ur(s)?n:s||F0(e)||n}const gx=async function(e){const t=this.getOffsetParent||Pc,n=this.getDimensions,s=await n(e.floating);return{reference:px(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function bx(e){return gt(e).direction==="rtl"}const xx={convertOffsetParentRelativeRectToViewportRelativeRect:rx,getDocumentElement:Nt,getClippingRect:fx,getOffsetParent:Pc,getElementRects:gx,getClientRects:ax,getDimensions:mx,getScale:as,isElement:Xe,isRTL:bx};function Ec(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function wx(e,t){let n=null,s;const i=Nt(e);function o(){var a;clearTimeout(s),(a=n)==null||a.disconnect(),n=null}function r(a,d){a===void 0&&(a=!1),d===void 0&&(d=1),o();const c=e.getBoundingClientRect(),{left:u,top:h,width:f,height:m}=c;if(a||t(),!f||!m)return;const p=ro(h),b=ro(i.clientWidth-(u+f)),x=ro(i.clientHeight-(h+m)),w=ro(u),y={rootMargin:-p+"px "+-b+"px "+-x+"px "+-w+"px",threshold:Be(0,Nn(1,d))||1};let v=!0;function j(k){const C=k[0].intersectionRatio;if(C!==d){if(!v)return r();C?r(!1,C):s=setTimeout(()=>{r(!1,1e-7)},1e3)}C===1&&!Ec(c,e.getBoundingClientRect())&&r(),v=!1}try{n=new IntersectionObserver(j,{...y,root:i.ownerDocument})}catch{n=new IntersectionObserver(j,y)}n.observe(e)}return r(!0),o}function _x(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:d=!1}=s,c=Gr(e),u=i||o?[...c?Vs(c):[],...Vs(t)]:[];u.forEach(w=>{i&&w.addEventListener("scroll",n,{passive:!0}),o&&w.addEventListener("resize",n)});const h=c&&a?wx(c,n):null;let f=-1,m=null;r&&(m=new ResizeObserver(w=>{let[_]=w;_&&_.target===c&&m&&(m.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var y;(y=m)==null||y.observe(t)})),n()}),c&&!d&&m.observe(c),m.observe(t));let p,b=d?Sn(e):null;d&&x();function x(){const w=Sn(e);b&&!Ec(b,w)&&n(),b=w,p=requestAnimationFrame(x)}return n(),()=>{var w;u.forEach(_=>{i&&_.removeEventListener("scroll",n),o&&_.removeEventListener("resize",n)}),h==null||h(),(w=m)==null||w.disconnect(),m=null,d&&cancelAnimationFrame(p)}}const Qr=vc,yx=tx,vx=nx,kx=Z0,jx=sx,Nx=(e,t,n)=>{const s=new Map,i={platform:xx,...n},o={...i.platform,_c:s};return Q0(e,t,{...i,platform:o})};var Sx=typeof document<"u",Cx=function(){},uo=Sx?g.useLayoutEffect:Cx;function ho(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,s,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!ho(e[s],t[s]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,i[s]))return!1;for(s=n;s--!==0;){const o=i[s];if(!(o==="_owner"&&e.$$typeof)&&!ho(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function Dc(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Oc(e,t){const n=Dc(e);return Math.round(t*n)/n}function Zr(e){const t=q.useRef(e);return uo(()=>{t.current=e}),t}function Mx(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:i,elements:{reference:o,floating:r}={},transform:a=!0,whileElementsMounted:d,open:c}=e,[u,h]=q.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,m]=q.useState(s);ho(f,s)||m(s);const[p,b]=q.useState(null),[x,w]=q.useState(null),_=q.useCallback(M=>{M!==k.current&&(k.current=M,b(M))},[]),y=q.useCallback(M=>{M!==C.current&&(C.current=M,w(M))},[]),v=o||p,j=r||x,k=q.useRef(null),C=q.useRef(null),S=q.useRef(u),T=d!=null,D=Zr(d),P=Zr(i),L=Zr(c),W=q.useCallback(()=>{if(!k.current||!C.current)return;const M={placement:t,strategy:n,middleware:f};P.current&&(M.platform=P.current),Nx(k.current,C.current,M).then(E=>{const V={...E,isPositioned:L.current!==!1};$.current&&!ho(S.current,V)&&(S.current=V,Wi.flushSync(()=>{h(V)}))})},[f,t,n,P,L]);uo(()=>{c===!1&&S.current.isPositioned&&(S.current.isPositioned=!1,h(M=>({...M,isPositioned:!1})))},[c]);const $=q.useRef(!1);uo(()=>($.current=!0,()=>{$.current=!1}),[]),uo(()=>{if(v&&(k.current=v),j&&(C.current=j),v&&j){if(D.current)return D.current(v,j,W);W()}},[v,j,W,D,T]);const O=q.useMemo(()=>({reference:k,floating:C,setReference:_,setFloating:y}),[_,y]),F=q.useMemo(()=>({reference:v,floating:j}),[v,j]),H=q.useMemo(()=>{const M={position:n,left:0,top:0};if(!F.floating)return M;const E=Oc(F.floating,u.x),V=Oc(F.floating,u.y);return a?{...M,transform:"translate("+E+"px, "+V+"px)",...Dc(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:E,top:V}},[n,a,F.floating,u.x,u.y]);return q.useMemo(()=>({...u,update:W,refs:O,elements:F,floatingStyles:H}),[u,W,O,F,H])}const Ic=(e,t)=>({...yx(e),options:[e,t]}),Tx=(e,t)=>({...vx(e),options:[e,t]}),Px=(e,t)=>({...kx(e),options:[e,t]}),Ex=(e,t)=>({...jx(e),options:[e,t]}),Lc={...q},Dx=Lc.useInsertionEffect||(e=>e());function Ac(e){const t=q.useRef(()=>{});return Dx(()=>{t.current=e}),q.useCallback(function(){for(var n=arguments.length,s=new Array(n),i=0;i<n;i++)s[i]=arguments[i];return t.current==null?void 0:t.current(...s)},[])}var Jr=typeof document<"u"?g.useLayoutEffect:g.useEffect;let Fc=!1,Ox=0;const zc=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Ox++;function Ix(){const[e,t]=q.useState(()=>Fc?zc():void 0);return Jr(()=>{e==null&&t(zc())},[]),q.useEffect(()=>{Fc=!0},[]),e}const Lx=Lc.useId||Ix;function Ax(){const e=new Map;return{emit(t,n){var s;(s=e.get(t))==null||s.forEach(i=>i(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var s;e.set(t,((s=e.get(t))==null?void 0:s.filter(i=>i!==n))||[])}}}const Fx=q.createContext(null),zx=q.createContext(null),Wx=()=>{var e;return((e=q.useContext(Fx))==null?void 0:e.id)||null},Bx=()=>q.useContext(zx),Hx="data-floating-ui-focusable";function Vx(e){const{open:t=!1,onOpenChange:n,elements:s}=e,i=Lx(),o=q.useRef({}),[r]=q.useState(()=>Ax()),a=Wx()!=null,[d,c]=q.useState(s.reference),u=Ac((m,p,b)=>{o.current.openEvent=m?p:void 0,r.emit("openchange",{open:m,event:p,reason:b,nested:a}),n==null||n(m,p,b)}),h=q.useMemo(()=>({setPositionReference:c}),[]),f=q.useMemo(()=>({reference:d||s.reference||null,floating:s.floating||null,domReference:s.reference}),[d,s.reference,s.floating]);return q.useMemo(()=>({dataRef:o,open:t,onOpenChange:u,elements:f,events:r,floatingId:i,refs:h}),[t,u,f,r,i,h])}function Rx(e){e===void 0&&(e={});const{nodeId:t}=e,n=Vx({...e,elements:{reference:null,floating:null,...e.elements}}),s=e.rootContext||n,i=s.elements,[o,r]=q.useState(null),[a,d]=q.useState(null),u=(i==null?void 0:i.domReference)||o,h=q.useRef(null),f=Bx();Jr(()=>{u&&(h.current=u)},[u]);const m=Mx({...e,elements:{...i,...a&&{reference:a}}}),p=q.useCallback(y=>{const v=Xe(y)?{getBoundingClientRect:()=>y.getBoundingClientRect(),contextElement:y}:y;d(v),m.refs.setReference(v)},[m.refs]),b=q.useCallback(y=>{(Xe(y)||y===null)&&(h.current=y,r(y)),(Xe(m.refs.reference.current)||m.refs.reference.current===null||y!==null&&!Xe(y))&&m.refs.setReference(y)},[m.refs]),x=q.useMemo(()=>({...m.refs,setReference:b,setPositionReference:p,domReference:h}),[m.refs,b,p]),w=q.useMemo(()=>({...m.elements,domReference:u}),[m.elements,u]),_=q.useMemo(()=>({...m,...s,refs:x,elements:w,nodeId:t}),[m,x,w,t,s]);return Jr(()=>{s.dataRef.current.floatingContext=_;const y=f==null?void 0:f.nodesRef.current.find(v=>v.id===t);y&&(y.context=_)}),q.useMemo(()=>({...m,context:_,refs:x,elements:w}),[m,x,w,_])}const Wc="active",Bc="selected";function ea(e,t,n){const s=new Map,i=n==="item";let o=e;if(i&&e){const{[Wc]:r,[Bc]:a,...d}=e;o=d}return{...n==="floating"&&{tabIndex:-1,[Hx]:""},...o,...t.map(r=>{const a=r?r[n]:null;return typeof a=="function"?e?a(e):null:a}).concat(e).reduce((r,a)=>(a&&Object.entries(a).forEach(d=>{let[c,u]=d;if(!(i&&[Wc,Bc].includes(c)))if(c.indexOf("on")===0){if(s.has(c)||s.set(c,[]),typeof u=="function"){var h;(h=s.get(c))==null||h.push(u),r[c]=function(){for(var f,m=arguments.length,p=new Array(m),b=0;b<m;b++)p[b]=arguments[b];return(f=s.get(c))==null?void 0:f.map(x=>x(...p)).find(x=>x!==void 0)}}}else r[c]=u}),r),{})}}function $x(e){e===void 0&&(e=[]);const t=e.map(a=>a==null?void 0:a.reference),n=e.map(a=>a==null?void 0:a.floating),s=e.map(a=>a==null?void 0:a.item),i=q.useCallback(a=>ea(a,e,"reference"),t),o=q.useCallback(a=>ea(a,e,"floating"),n),r=q.useCallback(a=>ea(a,e,"item"),s);return q.useMemo(()=>({getReferenceProps:i,getFloatingProps:o,getItemProps:r}),[i,o,r])}function Hc(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const Ux=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:s,onFallbackChange:i,offset:o=0,index:r=0,minItemsVisible:a=4,referenceOverflowThreshold:d=0,scrollRef:c,...u}=rs(e,t),{rects:h,elements:{floating:f}}=t,m=n.current[r],p=(c==null?void 0:c.current)||f,b=f.clientTop||p.clientTop,x=f.clientTop!==0,w=p.clientTop!==0,_=f===p;if(!m)return{};const y={...t,...await Ic(-m.offsetTop-f.clientTop-h.reference.height/2-m.offsetHeight/2-o).fn(t)},v=await Qr(Hc(y,p.scrollHeight+b+f.clientTop),u),j=await Qr(y,{...u,elementContext:"reference"}),k=Be(0,v.top),C=y.y+k,D=(p.scrollHeight>p.clientHeight?P=>P:Rs)(Be(0,p.scrollHeight+(x&&_||w?b*2:0)-k-Be(0,v.bottom)));if(p.style.maxHeight=D+"px",p.scrollTop=k,i){const P=p.offsetHeight<m.offsetHeight*Nn(a,n.current.length)-1||j.top>=-d||j.bottom>=-d;Wi.flushSync(()=>i(P))}return s&&(s.current=await Qr(Hc({...y,y:C},p.offsetHeight+b+f.clientTop),u)),{y:C}}});function qx(e,t){const{open:n,elements:s}=e,{enabled:i=!0,overflowRef:o,scrollRef:r,onChange:a}=t,d=Ac(a),c=q.useRef(!1),u=q.useRef(null),h=q.useRef(null);q.useEffect(()=>{if(!i)return;function m(b){if(b.ctrlKey||!p||o.current==null)return;const x=b.deltaY,w=o.current.top>=-.5,_=o.current.bottom>=-.5,y=p.scrollHeight-p.clientHeight,v=x<0?-1:1,j=x<0?"max":"min";p.scrollHeight<=p.clientHeight||(!w&&x>0||!_&&x<0?(b.preventDefault(),Wi.flushSync(()=>{d(k=>k+Math[j](x,y*v))})):/firefox/i.test(W0())&&(p.scrollTop+=x))}const p=(r==null?void 0:r.current)||s.floating;if(n&&p)return p.addEventListener("wheel",m),requestAnimationFrame(()=>{u.current=p.scrollTop,o.current!=null&&(h.current={...o.current})}),()=>{u.current=null,h.current=null,p.removeEventListener("wheel",m)}},[i,n,s.floating,o,r,d]);const f=q.useMemo(()=>({onKeyDown(){c.current=!0},onWheel(){c.current=!1},onPointerMove(){c.current=!1},onScroll(){const m=(r==null?void 0:r.current)||s.floating;if(!(!o.current||!m||!c.current)){if(u.current!==null){const p=m.scrollTop-u.current;(o.current.bottom<-.5&&p<-1||o.current.top<-.5&&p>1)&&Wi.flushSync(()=>d(b=>b+p))}requestAnimationFrame(()=>{u.current=m.scrollTop})}}}),[s.floating,d,o,r]);return q.useMemo(()=>i?{floating:f}:{},[i,f])}let Us=g.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Us.displayName="FloatingContext";let ta=g.createContext(null);ta.displayName="PlacementContext";function Yx(e){return g.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function Kx(){return g.useContext(Us).setReference}function Gx(){let{getFloatingProps:e,slot:t}=g.useContext(Us);return g.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function Xx(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=g.useContext(ta),n=g.useMemo(()=>e,[JSON.stringify(e,(i,o)=>{var r;return(r=o==null?void 0:o.outerHTML)!=null?r:o})]);me(()=>{t==null||t(n??null)},[t,n]);let s=g.useContext(Us);return g.useMemo(()=>[s.setFloating,e?s.styles:{}],[s.setFloating,e,s.styles])}let Vc=4;function Qx({children:e,enabled:t=!0}){let[n,s]=g.useState(null),[i,o]=g.useState(0),r=g.useRef(null),[a,d]=g.useState(null);Zx(a);let c=t&&n!==null&&a!==null,{to:u="bottom",gap:h=0,offset:f=0,padding:m=0,inner:p}=Jx(n,a),[b,x="center"]=u.split(" ");me(()=>{c&&o(0)},[c]);let{refs:w,floatingStyles:_,context:y}=Rx({open:c,placement:b==="selection"?x==="center"?"bottom":`bottom-${x}`:x==="center"?`${b}`:`${b}-${x}`,strategy:"absolute",transform:!1,middleware:[Ic({mainAxis:b==="selection"?0:h,crossAxis:f}),Tx({padding:m}),b!=="selection"&&Px({padding:m}),b==="selection"&&p?Ux({...p,padding:m,overflowRef:r,offset:i,minItemsVisible:Vc,referenceOverflowThreshold:m,onFallbackChange(P){var L,W;if(!P)return;let $=y.elements.floating;if(!$)return;let O=parseFloat(getComputedStyle($).scrollPaddingBottom)||0,F=Math.min(Vc,$.childElementCount),H=0,M=0;for(let E of(W=(L=y.elements.floating)==null?void 0:L.childNodes)!=null?W:[])if(lt(E)){let V=E.offsetTop,z=V+E.clientHeight+O,A=$.scrollTop,U=A+$.clientHeight;if(V>=A&&z<=U)F--;else{M=Math.max(0,Math.min(z,U)-Math.max(V,A)),H=E.clientHeight;break}}F>=1&&o(E=>{let V=H*F-M+O;return E>=V?E:V})}}):null,Ex({padding:m,apply({availableWidth:P,availableHeight:L,elements:W}){Object.assign(W.floating.style,{overflow:"auto",maxWidth:`${P}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${L}px)`})}})].filter(Boolean),whileElementsMounted:_x}),[v=b,j=x]=y.placement.split("-");b==="selection"&&(v="selection");let k=g.useMemo(()=>({anchor:[v,j].filter(Boolean).join(" ")}),[v,j]),C=qx(y,{overflowRef:r,onChange:o}),{getReferenceProps:S,getFloatingProps:T}=$x([C]),D=K(P=>{d(P),w.setFloating(P)});return q.createElement(ta.Provider,{value:s},q.createElement(Us.Provider,{value:{setFloating:D,setReference:w.setReference,styles:_,getReferenceProps:S,getFloatingProps:T,slot:k}},e))}function Zx(e){me(()=>{if(!e)return;let t=new MutationObserver(()=>{let n=window.getComputedStyle(e).maxHeight,s=parseFloat(n);if(isNaN(s))return;let i=parseInt(n);isNaN(i)||s!==i&&(e.style.maxHeight=`${Math.ceil(s)}px`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{t.disconnect()}},[e])}function Jx(e,t){var n,s,i;let o=na((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),r=na((s=e==null?void 0:e.offset)!=null?s:"var(--anchor-offset, 0)",t),a=na((i=e==null?void 0:e.padding)!=null?i:"var(--anchor-padding, 0)",t);return{...e,gap:o,offset:r,padding:a}}function na(e,t,n=void 0){let s=Ft(),i=K((d,c)=>{if(d==null)return[n,null];if(typeof d=="number")return[d,null];if(typeof d=="string"){if(!c)return[n,null];let u=$c(d,c);return[u,h=>{let f=Rc(d);{let m=f.map(p=>window.getComputedStyle(c).getPropertyValue(p));s.requestAnimationFrame(function p(){s.nextFrame(p);let b=!1;for(let[w,_]of f.entries()){let y=window.getComputedStyle(c).getPropertyValue(_);if(m[w]!==y){m[w]=y,b=!0;break}}if(!b)return;let x=$c(d,c);u!==x&&(h(x),u=x)})}return s.dispose}]}return[n,null]}),o=g.useMemo(()=>i(e,t)[0],[e,t]),[r=o,a]=g.useState();return me(()=>{let[d,c]=i(e,t);if(a(d),!!c)return c(a)},[e,t]),r}function Rc(e){let t=/var\((.*)\)/.exec(e);if(t){let n=t[1].indexOf(",");if(n===-1)return[t[1]];let s=t[1].slice(0,n).trim(),i=t[1].slice(n+1).trim();return i?[s,...Rc(i)]:[s]}return[]}function $c(e,t){let n=document.createElement("div");t.appendChild(n),n.style.setProperty("margin-top","0px","important"),n.style.setProperty("margin-top",e,"important");let s=parseFloat(window.getComputedStyle(n).marginTop)||0;return t.removeChild(n),s}function ew({children:e,freeze:t},n){let s=sa(t,e);return g.isValidElement(s)?g.cloneElement(s,{ref:n}):g.createElement(g.Fragment,null,s)}const tw=g.forwardRef(ew);function sa(e,t){let[n,s]=g.useState(t);return!e&&n!==t&&s(t),e?n:t}let fo=g.createContext(null);fo.displayName="OpenClosedContext";var Qe=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Qe||{});function qs(){return g.useContext(fo)}function Uc({value:e,children:t}){return g.createElement(fo.Provider,{value:e},t)}function nw({children:e}){return g.createElement(fo.Provider,{value:null},e)}function sw(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let Mt=[];sw(()=>{function e(t){if(!Wt(t.target)||t.target===document.body||Mt[0]===t.target)return;let n=t.target;n=n.closest(no),Mt.unshift(n??t.target),Mt=Mt.filter(s=>s!=null&&s.isConnected),Mt.splice(10)}window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})});function iw(e){throw new Error("Unexpected object: "+e)}var Le=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(Le||{});function qc(e,t){let n=t.resolveItems();if(n.length<=0)return null;let s=t.resolveActiveIndex(),i=s??-1;switch(e.focus){case 0:{for(let o=0;o<n.length;++o)if(!t.resolveDisabled(n[o],o,n))return o;return s}case 1:{i===-1&&(i=n.length);for(let o=i-1;o>=0;--o)if(!t.resolveDisabled(n[o],o,n))return o;return s}case 2:{for(let o=i+1;o<n.length;++o)if(!t.resolveDisabled(n[o],o,n))return o;return s}case 3:{for(let o=n.length-1;o>=0;--o)if(!t.resolveDisabled(n[o],o,n))return o;return s}case 4:{for(let o=0;o<n.length;++o)if(t.resolveId(n[o],o,n)===e.id)return o;return s}case 5:return null;default:iw(e)}}function ia(e){let t=K(e),n=g.useRef(!1);g.useEffect(()=>(n.current=!1,()=>{n.current=!0,Yi(()=>{n.current&&t()})}),[t])}let Yc=g.createContext(!1);function ow(){return g.useContext(Yc)}function Kc(e){return g.createElement(Yc.Provider,{value:e.force},e.children)}function rw(e){let t=ow(),n=g.useContext(Xc),[s,i]=g.useState(()=>{var o;if(!t&&n!==null)return(o=n.current)!=null?o:null;if(kt.isServer)return null;let r=e==null?void 0:e.getElementById("headlessui-portal-root");if(r)return r;if(e===null)return null;let a=e.createElement("div");return a.setAttribute("id","headlessui-portal-root"),e.body.appendChild(a)});return g.useEffect(()=>{s!==null&&(e!=null&&e.body.contains(s)||e==null||e.body.appendChild(s))},[s,e]),g.useEffect(()=>{t||n!==null&&i(n.current)},[n,i,t]),s}let Gc=g.Fragment,aw=xe(function(e,t){let{ownerDocument:n=null,...s}=e,i=g.useRef(null),o=We(xb(f=>{i.current=f}),t),r=zs(i.current),a=n??r,d=rw(a),c=g.useContext(oa),u=Ft(),h=we();return ia(()=>{var f;d&&d.childNodes.length<=0&&((f=d.parentElement)==null||f.removeChild(d))}),d?Ae.createPortal(g.createElement("div",{"data-headlessui-portal":"",ref:f=>{u.dispose(),c&&f&&u.add(c.register(f))}},h({ourProps:{ref:o},theirProps:s,slot:{},defaultTag:Gc,name:"Portal"})),d):null});function lw(e,t){let n=We(t),{enabled:s=!0,ownerDocument:i,...o}=e,r=we();return s?g.createElement(aw,{...o,ownerDocument:i,ref:n}):r({ourProps:{ref:n},theirProps:o,slot:{},defaultTag:Gc,name:"Portal"})}let dw=g.Fragment,Xc=g.createContext(null);function cw(e,t){let{target:n,...s}=e,i={ref:We(t)},o=we();return g.createElement(Xc.Provider,{value:n},o({ourProps:i,theirProps:s,defaultTag:dw,name:"Popover.Group"}))}let oa=g.createContext(null);function uw(){let e=g.useContext(oa),t=g.useRef([]),n=K(o=>(t.current.push(o),e&&e.register(o),()=>s(o))),s=K(o=>{let r=t.current.indexOf(o);r!==-1&&t.current.splice(r,1),e&&e.unregister(o)}),i=g.useMemo(()=>({register:n,unregister:s,portals:t}),[n,s,t]);return[t,g.useMemo(()=>function({children:o}){return g.createElement(oa.Provider,{value:i},o)},[i])]}let hw=xe(lw),Qc=xe(cw),Zc=Object.assign(hw,{Group:Qc});const Ys={Idle:{kind:"Idle"},Tracked:e=>({kind:"Tracked",position:e}),Moved:{kind:"Moved"}};function Jc(e){let t=e.getBoundingClientRect();return`${t.x},${t.y}`}function fw(e,t,n){let s=at();if(t.kind==="Tracked"){let i=function(){o!==Jc(e)&&(s.dispose(),n())},{position:o}=t,r=new ResizeObserver(i);r.observe(e),s.add(()=>r.disconnect()),s.addEventListener(window,"scroll",i,{passive:!0}),s.addEventListener(window,"resize",i)}return()=>s.dispose()}var mw=Object.defineProperty,pw=(e,t,n)=>t in e?mw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,eu=(e,t,n)=>(pw(e,typeof t!="symbol"?t+"":t,n),n),se=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(se||{}),it=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(it||{}),Tt=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))(Tt||{}),tu=(e=>(e[e.OpenCombobox=0]="OpenCombobox",e[e.CloseCombobox=1]="CloseCombobox",e[e.GoToOption=2]="GoToOption",e[e.SetTyping=3]="SetTyping",e[e.RegisterOption=4]="RegisterOption",e[e.UnregisterOption=5]="UnregisterOption",e[e.DefaultToFirstOption=6]="DefaultToFirstOption",e[e.SetActivationTrigger=7]="SetActivationTrigger",e[e.UpdateVirtualConfiguration=8]="UpdateVirtualConfiguration",e[e.SetInputElement=9]="SetInputElement",e[e.SetButtonElement=10]="SetButtonElement",e[e.SetOptionsElement=11]="SetOptionsElement",e[e.MarkInputAsMoved=12]="MarkInputAsMoved",e))(tu||{});function ra(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,s=t(e.options.slice()),i=s.length>0&&s[0].dataRef.current.order!==null?s.sort((r,a)=>r.dataRef.current.order-a.dataRef.current.order):Qd(s,r=>r.dataRef.current.domRef.current),o=n?i.indexOf(n):null;return o===-1&&(o=null),{options:i,activeOptionIndex:o}}let gw={1(e){var t;if((t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===1)return e;let n=e.inputElement?Ys.Tracked(Jc(e.inputElement)):e.inputPositionState;return{...e,activeOptionIndex:null,comboboxState:1,isTyping:!1,activationTrigger:2,inputPositionState:n,__demoMode:!1}},0(e){var t,n;if((t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===0)return e;if((n=e.dataRef.current)!=null&&n.value){let s=e.dataRef.current.calculateIndex(e.dataRef.current.value);if(s!==-1)return{...e,activeOptionIndex:s,comboboxState:0,__demoMode:!1,inputPositionState:Ys.Idle}}return{...e,comboboxState:0,inputPositionState:Ys.Idle,__demoMode:!1}},3(e,t){return e.isTyping===t.isTyping?e:{...e,isTyping:t.isTyping}},2(e,t){var n,s,i,o;if((n=e.dataRef.current)!=null&&n.disabled||e.optionsElement&&!((s=e.dataRef.current)!=null&&s.optionsPropsRef.current.static)&&e.comboboxState===1)return e;if(e.virtual){let{options:c,disabled:u}=e.virtual,h=t.focus===Le.Specific?t.idx:qc(t,{resolveItems:()=>c,resolveActiveIndex:()=>{var m,p;return(p=(m=e.activeOptionIndex)!=null?m:c.findIndex(b=>!u(b)))!=null?p:null},resolveDisabled:u,resolveId(){throw new Error("Function not implemented.")}}),f=(i=t.trigger)!=null?i:2;return e.activeOptionIndex===h&&e.activationTrigger===f?e:{...e,activeOptionIndex:h,activationTrigger:f,isTyping:!1,__demoMode:!1}}let r=ra(e);if(r.activeOptionIndex===null){let c=r.options.findIndex(u=>!u.dataRef.current.disabled);c!==-1&&(r.activeOptionIndex=c)}let a=t.focus===Le.Specific?t.idx:qc(t,{resolveItems:()=>r.options,resolveActiveIndex:()=>r.activeOptionIndex,resolveId:c=>c.id,resolveDisabled:c=>c.dataRef.current.disabled}),d=(o=t.trigger)!=null?o:2;return e.activeOptionIndex===a&&e.activationTrigger===d?e:{...e,...r,isTyping:!1,activeOptionIndex:a,activationTrigger:d,__demoMode:!1}},4:(e,t)=>{var n,s,i,o;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:[...e.options,t.payload]};let r=t.payload,a=ra(e,c=>(c.push(r),c));e.activeOptionIndex===null&&(i=(s=e.dataRef.current).isSelected)!=null&&i.call(s,t.payload.dataRef.current.value)&&(a.activeOptionIndex=a.options.indexOf(r));let d={...e,...a,activationTrigger:2};return(o=e.dataRef.current)!=null&&o.__demoMode&&e.dataRef.current.value===void 0&&(d.activeOptionIndex=0),d},5:(e,t)=>{var n;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:e.options.filter(i=>i.id!==t.id)};let s=ra(e,i=>{let o=i.findIndex(r=>r.id===t.id);return o!==-1&&i.splice(o,1),i});return{...e,...s,activationTrigger:2}},6:(e,t)=>e.defaultToFirstOption===t.value?e:{...e,defaultToFirstOption:t.value},7:(e,t)=>e.activationTrigger===t.trigger?e:{...e,activationTrigger:t.trigger},8:(e,t)=>{var n,s;if(e.virtual===null)return{...e,virtual:{options:t.options,disabled:(n=t.disabled)!=null?n:()=>!1}};if(e.virtual.options===t.options&&e.virtual.disabled===t.disabled)return e;let i=e.activeOptionIndex;if(e.activeOptionIndex!==null){let o=t.options.indexOf(e.virtual.options[e.activeOptionIndex]);o!==-1?i=o:i=null}return{...e,activeOptionIndex:i,virtual:{options:t.options,disabled:(s=t.disabled)!=null?s:()=>!1}}},9:(e,t)=>e.inputElement===t.element?e:{...e,inputElement:t.element},10:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},11:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element},12(e){return e.inputPositionState.kind!=="Tracked"?e:{...e,inputPositionState:Ys.Moved}}},bw=class Up extends Wd{constructor(t){super(t),eu(this,"actions",{onChange:n=>{let{onChange:s,compare:i,mode:o,value:r}=this.state.dataRef.current;return Ge(o,{0:()=>s==null?void 0:s(n),1:()=>{let a=r.slice(),d=a.findIndex(c=>i(c,n));return d===-1?a.push(n):a.splice(d,1),s==null?void 0:s(a)}})},registerOption:(n,s)=>(this.send({type:4,payload:{id:n,dataRef:s}}),()=>{this.state.activeOptionIndex===this.state.dataRef.current.calculateIndex(s.current.value)&&this.send({type:6,value:!0}),this.send({type:5,id:n})}),goToOption:(n,s)=>(this.send({type:6,value:!1}),this.send({type:2,...n,trigger:s})),setIsTyping:n=>{this.send({type:3,isTyping:n})},closeCombobox:()=>{var n,s;this.send({type:1}),this.send({type:6,value:!1}),(s=(n=this.state.dataRef.current).onClose)==null||s.call(n)},openCombobox:()=>{this.send({type:0}),this.send({type:6,value:!0})},setActivationTrigger:n=>{this.send({type:7,trigger:n})},selectActiveOption:()=>{let n=this.selectors.activeOptionIndex(this.state);if(n!==null){if(this.actions.setIsTyping(!1),this.state.virtual)this.actions.onChange(this.state.virtual.options[n]);else{let{dataRef:s}=this.state.options[n];this.actions.onChange(s.current.value)}this.actions.goToOption({focus:Le.Specific,idx:n})}},setInputElement:n=>{this.send({type:9,element:n})},setButtonElement:n=>{this.send({type:10,element:n})},setOptionsElement:n=>{this.send({type:11,element:n})}}),eu(this,"selectors",{activeDescendantId:n=>{var s,i;let o=this.selectors.activeOptionIndex(n);if(o!==null)return n.virtual?(i=n.options.find(r=>!r.dataRef.current.disabled&&n.dataRef.current.compare(r.dataRef.current.value,n.virtual.options[o])))==null?void 0:i.id:(s=n.options[o])==null?void 0:s.id},activeOptionIndex:n=>{if(n.defaultToFirstOption&&n.activeOptionIndex===null&&(n.virtual?n.virtual.options.length>0:n.options.length>0)){if(n.virtual){let{options:i,disabled:o}=n.virtual,r=i.findIndex(a=>{var d;return!((d=o==null?void 0:o(a))!=null&&d)});if(r!==-1)return r}let s=n.options.findIndex(i=>!i.dataRef.current.disabled);if(s!==-1)return s}return n.activeOptionIndex},activeOption:n=>{var s,i;let o=this.selectors.activeOptionIndex(n);return o===null?null:n.virtual?n.virtual.options[o??0]:(i=(s=n.options[o])==null?void 0:s.dataRef.current.value)!=null?i:null},isActive:(n,s,i)=>{var o;let r=this.selectors.activeOptionIndex(n);return r===null?!1:n.virtual?r===n.dataRef.current.calculateIndex(s):((o=n.options[r])==null?void 0:o.id)===i},shouldScrollIntoView:(n,s,i)=>!(n.virtual||n.__demoMode||n.comboboxState!==0||n.activationTrigger===0||!this.selectors.isActive(n,s,i)),didInputMove(n){return n.inputPositionState.kind==="Moved"}});{let n=this.state.id,s=to.get(null);this.disposables.add(s.on(Rd.Push,i=>{!s.selectors.isTop(i,n)&&this.state.comboboxState===0&&this.actions.closeCombobox()})),this.on(0,()=>s.actions.push(n)),this.on(1,()=>s.actions.pop(n))}this.disposables.group(n=>{this.on(1,s=>{s.inputElement&&(n.dispose(),n.add(fw(s.inputElement,s.inputPositionState,()=>{this.send({type:12})})))})})}static new({id:t,virtual:n=null,__demoMode:s=!1}){var i;return new Up({id:t,dataRef:{current:{}},comboboxState:s?0:1,isTyping:!1,options:[],virtual:n?{options:n.options,disabled:(i=n.disabled)!=null?i:()=>!1}:null,activeOptionIndex:null,activationTrigger:2,inputElement:null,buttonElement:null,optionsElement:null,__demoMode:s,inputPositionState:Ys.Idle})}reduce(t,n){return Ge(n.type,gw,t,n)}};const nu=g.createContext(null);function Ks(e){let t=g.useContext(nu);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,su),n}return t}function su({id:e,virtual:t=null,__demoMode:n=!1}){let s=g.useMemo(()=>bw.new({id:e,virtual:t,__demoMode:n}),[]);return ia(()=>s.dispose()),s}let Gs=g.createContext(null);Gs.displayName="ComboboxDataContext";function ls(e){let t=g.useContext(Gs);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,ls),n}return t}let iu=g.createContext(null);function xw(e){let t=Ks("VirtualProvider"),n=ls("VirtualProvider"),{options:s}=n.virtual,i=Ee(t,m=>m.optionsElement),[o,r]=g.useMemo(()=>{let m=i;if(!m)return[0,0];let p=window.getComputedStyle(m);return[parseFloat(p.paddingBlockStart||p.paddingTop),parseFloat(p.paddingBlockEnd||p.paddingBottom)]},[i]),a=zb({enabled:s.length!==0,scrollPaddingStart:o,scrollPaddingEnd:r,count:s.length,estimateSize(){return 40},getScrollElement(){return t.state.optionsElement},overscan:12}),[d,c]=g.useState(0);me(()=>{c(m=>m+1)},[s]);let u=a.getVirtualItems(),h=Ee(t,m=>m.activationTrigger===Tt.Pointer),f=Ee(t,t.selectors.activeOptionIndex);return u.length===0?null:g.createElement(iu.Provider,{value:a},g.createElement("div",{style:{position:"relative",width:"100%",height:`${a.getTotalSize()}px`},ref:m=>{m&&(h||f!==null&&s.length>f&&a.scrollToIndex(f))}},u.map(m=>{var p;return g.createElement(g.Fragment,{key:m.key},g.cloneElement((p=e.children)==null?void 0:p.call(e,{...e.slot,option:s[m.index]}),{key:`${d}-${m.key}`,"data-index":m.index,"aria-setsize":s.length,"aria-posinset":m.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${m.start}px)`,overflowAnchor:"none"}}))})))}let ww=g.Fragment;function _w(e,t){let n=g.useId(),s=Qn(),{value:i,defaultValue:o,onChange:r,form:a,name:d,by:c,invalid:u=!1,disabled:h=s||!1,onClose:f,__demoMode:m=!1,multiple:p=!1,immediate:b=!1,virtual:x=null,nullable:w,..._}=e,y=gd(o),[v=p?[]:void 0,j]=pd(i,r,y),k=su({id:n,virtual:x,__demoMode:m}),C=g.useRef({static:!1,hold:!1}),S=Bb(c),T=K(Y=>x?c===null?x.options.indexOf(Y):x.options.findIndex(ee=>S(ee,Y)):k.state.options.findIndex(ee=>S(ee.dataRef.current.value,Y))),D=g.useCallback(Y=>Ge(W.mode,{[it.Multi]:()=>v.some(ee=>S(ee,Y)),[it.Single]:()=>S(v,Y)}),[v]),P=Ee(k,Y=>Y.virtual),L=K(()=>f==null?void 0:f()),W=g.useMemo(()=>({__demoMode:m,immediate:b,optionsPropsRef:C,value:v,defaultValue:y,disabled:h,invalid:u,mode:p?it.Multi:it.Single,virtual:x?P:null,onChange:j,isSelected:D,calculateIndex:T,compare:S,onClose:L}),[m,b,C,v,y,h,u,p,x,P,j,D,T,S,L]);me(()=>{var Y;x&&k.send({type:tu.UpdateVirtualConfiguration,options:x.options,disabled:(Y=x.disabled)!=null?Y:null})},[x,x==null?void 0:x.options,x==null?void 0:x.disabled]),me(()=>{k.state.dataRef.current=W},[W]);let[$,O,F,H]=Ee(k,Y=>[Y.comboboxState,Y.buttonElement,Y.inputElement,Y.optionsElement]),M=to.get(null),E=Ee(M,g.useCallback(Y=>M.selectors.isTop(Y,n),[M,n]));tc(E,[O,F,H],()=>k.actions.closeCombobox());let V=Ee(k,k.selectors.activeOptionIndex),z=Ee(k,k.selectors.activeOption),A=Ke({open:$===se.Open,disabled:h,invalid:u,activeIndex:V,activeOption:z,value:v}),[U,J]=Ar(),ne=t===null?{}:{ref:t},Q=g.useCallback(()=>{if(y!==void 0)return j==null?void 0:j(y)},[j,y]),R=we();return g.createElement(J,{value:U,props:{htmlFor:F==null?void 0:F.id},slot:{open:$===se.Open,disabled:h}},g.createElement(Qx,null,g.createElement(Gs.Provider,{value:W},g.createElement(nu.Provider,{value:k},g.createElement(Uc,{value:Ge($,{[se.Open]:Qe.Open,[se.Closed]:Qe.Closed})},d!=null&&g.createElement(yd,{disabled:h,data:v!=null?{[d]:v}:{},form:a,onReset:Q}),R({ourProps:ne,theirProps:_,slot:A,defaultTag:ww,name:"Combobox"}))))))}let yw="input";function vw(e,t){var n,s;let i=Ks("Combobox.Input"),o=ls("Combobox.Input"),r=g.useId(),a=Xi(),{id:d=a||`headlessui-combobox-input-${r}`,onChange:c,displayValue:u,disabled:h=o.disabled||!1,autoFocus:f=!1,type:m="text",...p}=e,b=g.useRef(null),x=We(b,t,Kx(),i.actions.setInputElement),[w,_]=Ee(i,A=>[A.comboboxState,A.isTyping]),y=Ft(),v=K(()=>{i.actions.onChange(null),i.state.optionsElement&&(i.state.optionsElement.scrollTop=0),i.actions.goToOption({focus:Le.Nothing})}),j=g.useMemo(()=>{var A;return typeof u=="function"&&o.value!==void 0?(A=u(o.value))!=null?A:"":typeof o.value=="string"?o.value:""},[o.value,u]);Bs(([A,U],[J,ne])=>{if(i.state.isTyping)return;let Q=b.current;Q&&((ne===se.Open&&U===se.Closed||A!==J)&&(Q.value=A),requestAnimationFrame(()=>{if(i.state.isTyping||!Q||Tr(Q))return;let{selectionStart:R,selectionEnd:Y}=Q;Math.abs((Y??0)-(R??0))===0&&R===0&&Q.setSelectionRange(Q.value.length,Q.value.length)}))},[j,w,_]),Bs(([A],[U])=>{if(A===se.Open&&U===se.Closed){if(i.state.isTyping)return;let J=b.current;if(!J)return;let ne=J.value,{selectionStart:Q,selectionEnd:R,selectionDirection:Y}=J;J.value="",J.value=ne,Y!==null?J.setSelectionRange(Q,R,Y):J.setSelectionRange(Q,R)}},[w]);let k=g.useRef(!1),C=K(()=>{k.current=!0}),S=K(()=>{y.nextFrame(()=>{k.current=!1})}),T=K(A=>{switch(i.actions.setIsTyping(!0),A.key){case Ie.Enter:if(i.state.comboboxState!==se.Open||k.current)return;if(A.preventDefault(),A.stopPropagation(),i.selectors.activeOptionIndex(i.state)===null){i.actions.closeCombobox();return}i.actions.selectActiveOption(),o.mode===it.Single&&i.actions.closeCombobox();break;case Ie.ArrowDown:return A.preventDefault(),A.stopPropagation(),Ge(i.state.comboboxState,{[se.Open]:()=>i.actions.goToOption({focus:Le.Next}),[se.Closed]:()=>i.actions.openCombobox()});case Ie.ArrowUp:return A.preventDefault(),A.stopPropagation(),Ge(i.state.comboboxState,{[se.Open]:()=>i.actions.goToOption({focus:Le.Previous}),[se.Closed]:()=>{Ae.flushSync(()=>i.actions.openCombobox()),o.value||i.actions.goToOption({focus:Le.Last})}});case Ie.Home:if(i.state.comboboxState===se.Closed||A.shiftKey)break;return A.preventDefault(),A.stopPropagation(),i.actions.goToOption({focus:Le.First});case Ie.PageUp:return A.preventDefault(),A.stopPropagation(),i.actions.goToOption({focus:Le.First});case Ie.End:if(i.state.comboboxState===se.Closed||A.shiftKey)break;return A.preventDefault(),A.stopPropagation(),i.actions.goToOption({focus:Le.Last});case Ie.PageDown:return A.preventDefault(),A.stopPropagation(),i.actions.goToOption({focus:Le.Last});case Ie.Escape:return i.state.comboboxState!==se.Open?void 0:(A.preventDefault(),i.state.optionsElement&&!o.optionsPropsRef.current.static&&A.stopPropagation(),o.mode===it.Single&&o.value===null&&v(),i.actions.closeCombobox());case Ie.Tab:if(i.actions.setIsTyping(!1),i.state.comboboxState!==se.Open)return;o.mode===it.Single&&i.state.activationTrigger!==Tt.Focus&&i.actions.selectActiveOption(),i.actions.closeCombobox();break}}),D=K(A=>{c==null||c(A),o.mode===it.Single&&A.target.value===""&&v(),i.actions.openCombobox()}),P=K(A=>{var U,J,ne;let Q=(U=A.relatedTarget)!=null?U:Mt.find(R=>R!==A.currentTarget);if(!((J=i.state.optionsElement)!=null&&J.contains(Q))&&!((ne=i.state.buttonElement)!=null&&ne.contains(Q))&&i.state.comboboxState===se.Open)return A.preventDefault(),o.mode===it.Single&&o.value===null&&v(),i.actions.closeCombobox()}),L=K(A=>{var U,J,ne;let Q=(U=A.relatedTarget)!=null?U:Mt.find(R=>R!==A.currentTarget);(J=i.state.buttonElement)!=null&&J.contains(Q)||(ne=i.state.optionsElement)!=null&&ne.contains(Q)||o.disabled||o.immediate&&i.state.comboboxState!==se.Open&&y.microTask(()=>{Ae.flushSync(()=>i.actions.openCombobox()),i.actions.setActivationTrigger(Tt.Focus)})}),W=ts(),$=Ir(),{isFocused:O,focusProps:F}=Ps({autoFocus:f}),{isHovered:H,hoverProps:M}=Ts({isDisabled:h}),E=Ee(i,A=>A.optionsElement),V=Ke({open:w===se.Open,disabled:h,invalid:o.invalid,hover:H,focus:O,autofocus:f}),z=Jn({ref:x,id:d,role:"combobox",type:m,"aria-controls":E==null?void 0:E.id,"aria-expanded":w===se.Open,"aria-activedescendant":Ee(i,i.selectors.activeDescendantId),"aria-labelledby":W,"aria-describedby":$,"aria-autocomplete":"list",defaultValue:(s=(n=e.defaultValue)!=null?n:o.defaultValue!==void 0?u==null?void 0:u(o.defaultValue):null)!=null?s:o.defaultValue,disabled:h||void 0,autoFocus:f,onCompositionStart:C,onCompositionEnd:S,onKeyDown:T,onChange:D,onFocus:L,onBlur:P},F,M);return we()({ourProps:z,theirProps:p,slot:V,defaultTag:yw,name:"Combobox.Input"})}let kw="button";function jw(e,t){let n=Ks("Combobox.Button"),s=ls("Combobox.Button"),[i,o]=g.useState(null),r=We(t,o,n.actions.setButtonElement),a=g.useId(),{id:d=`headlessui-combobox-button-${a}`,disabled:c=s.disabled||!1,autoFocus:u=!1,...h}=e,[f,m,p]=Ee(n,L=>[L.comboboxState,L.inputElement,L.optionsElement]),b=sc(m),x=f===se.Open;p0(x,{trigger:i,action:g.useCallback(L=>{if(i!=null&&i.contains(L.target)||m!=null&&m.contains(L.target))return Ws.Ignore;let W=L.target.closest('[role="option"]:not([data-disabled])');return lt(W)?Ws.Select(W):p!=null&&p.contains(L.target)?Ws.Ignore:Ws.Close},[i,m,p]),close:n.actions.closeCombobox,select:n.actions.selectActiveOption});let w=K(L=>{switch(L.key){case Ie.Space:case Ie.Enter:L.preventDefault(),L.stopPropagation(),n.state.comboboxState===se.Closed&&Ae.flushSync(()=>n.actions.openCombobox()),b();return;case Ie.ArrowDown:L.preventDefault(),L.stopPropagation(),n.state.comboboxState===se.Closed&&(Ae.flushSync(()=>n.actions.openCombobox()),n.state.dataRef.current.value||n.actions.goToOption({focus:Le.First})),b();return;case Ie.ArrowUp:L.preventDefault(),L.stopPropagation(),n.state.comboboxState===se.Closed&&(Ae.flushSync(()=>n.actions.openCombobox()),n.state.dataRef.current.value||n.actions.goToOption({focus:Le.Last})),b();return;case Ie.Escape:if(n.state.comboboxState!==se.Open)return;L.preventDefault(),n.state.optionsElement&&!s.optionsPropsRef.current.static&&L.stopPropagation(),Ae.flushSync(()=>n.actions.closeCombobox()),b();return;default:return}}),_=Hb(()=>{n.state.comboboxState===se.Open?n.actions.closeCombobox():n.actions.openCombobox(),b()}),y=ts([d]),{isFocusVisible:v,focusProps:j}=Ps({autoFocus:u}),{isHovered:k,hoverProps:C}=Ts({isDisabled:c}),{pressed:S,pressProps:T}=Ki({disabled:c}),D=Ke({open:f===se.Open,active:S||f===se.Open,disabled:c,invalid:s.invalid,value:s.value,hover:k,focus:v}),P=Jn({ref:r,id:d,type:ic(e,i),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":p==null?void 0:p.id,"aria-expanded":f===se.Open,"aria-labelledby":y,disabled:c||void 0,autoFocus:u,onKeyDown:w},_,j,C,T);return we()({ourProps:P,theirProps:h,slot:D,defaultTag:kw,name:"Combobox.Button"})}let Nw="div",Sw=Zn.RenderStrategy|Zn.Static;function Cw(e,t){var n,s,i;let o=g.useId(),{id:r=`headlessui-combobox-options-${o}`,hold:a=!1,anchor:d,portal:c=!1,modal:u=!0,transition:h=!1,...f}=e,m=Ks("Combobox.Options"),p=ls("Combobox.Options"),b=Yx(d);b&&(c=!0);let[x,w]=Xx(b),[_,y]=g.useState(null),v=Gx(),j=We(t,b?x:null,m.actions.setOptionsElement,y),[k,C,S,T,D]=Ee(m,Pe=>[Pe.comboboxState,Pe.inputElement,Pe.buttonElement,Pe.optionsElement,Pe.activationTrigger]),P=zs(C||S),L=zs(T),W=qs(),[$,O]=uc(h,_,W!==null?(W&Qe.Open)===Qe.Open:k===se.Open);Gd($,C,m.actions.closeCombobox);let F=p.__demoMode?!1:u&&k===se.Open;rc(F,L);let H=p.__demoMode?!1:u&&k===se.Open;Kd(H,{allowed:g.useCallback(()=>[C,S,T],[C,S,T])});let M=Ee(m,m.selectors.didInputMove)?!1:$;me(()=>{var Pe;p.optionsPropsRef.current.static=(Pe=e.static)!=null?Pe:!1},[p.optionsPropsRef,e.static]),me(()=>{p.optionsPropsRef.current.hold=a},[p.optionsPropsRef,a]),T0(k===se.Open,{container:T,accept(Pe){return Pe.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:Pe.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(Pe){Pe.setAttribute("role","none")}});let E=ts([S==null?void 0:S.id]),V=Ke({open:k===se.Open,option:void 0}),z=K(()=>{m.actions.setActivationTrigger(Tt.Pointer)}),A=K(Pe=>{Pe.preventDefault(),m.actions.setActivationTrigger(Tt.Pointer)}),U=Jn(b?v():{},{"aria-labelledby":E,role:"listbox","aria-multiselectable":p.mode===it.Multi?!0:void 0,id:r,ref:j,style:{...f.style,...w,"--input-width":Ld($,C,!0).width,"--button-width":Ld($,S,!0).width},onWheel:D===Tt.Pointer?void 0:z,onMouseDown:A,...cc(O)}),J=$&&k===se.Closed&&!e.static,ne=sa(J,(n=p.virtual)==null?void 0:n.options),Q=sa(J,p.value),R=g.useCallback(Pe=>p.compare(Q,Pe),[p.compare,Q]),Y=g.useMemo(()=>{if(!p.virtual)return p;if(ne===void 0)throw new Error("Missing `options` in virtual mode");return ne!==p.virtual.options?{...p,virtual:{...p.virtual,options:ne}}:p},[p,ne,(s=p.virtual)==null?void 0:s.options]);p.virtual&&Object.assign(f,{children:g.createElement(Gs.Provider,{value:Y},g.createElement(xw,{slot:V},f.children))});let ee=we(),Oe=g.useMemo(()=>p.mode===it.Multi?p:{...p,isSelected:R},[p,R]);return g.createElement(Zc,{enabled:c?e.static||$:!1,ownerDocument:P},g.createElement(Gs.Provider,{value:Oe},ee({ourProps:U,theirProps:{...f,children:g.createElement(tw,{freeze:J},typeof f.children=="function"?(i=f.children)==null?void 0:i.call(f,V):f.children)},slot:V,defaultTag:Nw,features:Sw,visible:M,name:"Combobox.Options"})))}let Mw="div";function Tw(e,t){var n,s,i;let o=ls("Combobox.Option"),r=Ks("Combobox.Option"),a=g.useId(),{id:d=`headlessui-combobox-option-${a}`,value:c,disabled:u=(i=(s=(n=o.virtual)==null?void 0:n.disabled)==null?void 0:s.call(n,c))!=null?i:!1,order:h=null,...f}=e,[m]=Ee(r,O=>[O.inputElement]),p=sc(m),b=Ee(r,g.useCallback(O=>r.selectors.isActive(O,c,d),[c,d])),x=o.isSelected(c),w=g.useRef(null),_=Zt({disabled:u,value:c,domRef:w,order:h}),y=g.useContext(iu),v=We(t,w,y?y.measureElement:null),j=K(()=>{r.actions.setIsTyping(!1),r.actions.onChange(c)});me(()=>r.actions.registerOption(d,_),[_,d]);let k=Ee(r,g.useCallback(O=>r.selectors.shouldScrollIntoView(O,c,d),[c,d]));me(()=>{if(k)return at().requestAnimationFrame(()=>{var O,F;(F=(O=w.current)==null?void 0:O.scrollIntoView)==null||F.call(O,{block:"nearest"})})},[k,w]);let C=K(O=>{O.preventDefault(),O.button===zr.Left&&(u||(j(),Rr()||requestAnimationFrame(()=>p()),o.mode===it.Single&&r.actions.closeCombobox()))}),S=K(()=>{if(u)return r.actions.goToOption({focus:Le.Nothing});let O=o.calculateIndex(c);r.actions.goToOption({focus:Le.Specific,idx:O})}),T=v0(),D=K(O=>T.update(O)),P=K(O=>{if(!T.wasMoved(O)||u||b&&r.state.activationTrigger===Tt.Pointer)return;let F=o.calculateIndex(c);r.actions.goToOption({focus:Le.Specific,idx:F},Tt.Pointer)}),L=K(O=>{T.wasMoved(O)&&(u||b&&(o.optionsPropsRef.current.hold||r.state.activationTrigger===Tt.Pointer&&r.actions.goToOption({focus:Le.Nothing})))}),W=Ke({active:b,focus:b,selected:x,disabled:u}),$={id:d,ref:v,role:"option",tabIndex:u===!0?void 0:-1,"aria-disabled":u===!0?!0:void 0,"aria-selected":x,disabled:void 0,onMouseDown:C,onFocus:S,onPointerEnter:D,onMouseEnter:D,onPointerMove:P,onMouseMove:P,onPointerLeave:L,onMouseLeave:L};return we()({ourProps:$,theirProps:f,slot:W,defaultTag:Mw,name:"Combobox.Option"})}let Pw=xe(_w),ou=xe(jw),ru=xe(vw),Ew=Fr,au=xe(Cw),lu=xe(Tw),Dw=Object.assign(Pw,{Input:ru,Button:ou,Label:Ew,Options:au,Option:lu}),Ow=g.Fragment;function Iw(e,t){let{...n}=e,s=!1,{isFocusVisible:i,focusProps:o}=Ps(),{isHovered:r,hoverProps:a}=Ts({isDisabled:s}),{pressed:d,pressProps:c}=Ki({disabled:s}),u=Jn({ref:t},o,a,c),h=Ke({hover:r,focus:i,active:d});return we()({ourProps:u,theirProps:n,slot:h,defaultTag:Ow,name:"DataInteractive"})}let Lw=xe(Iw);function Aw(e,t=typeof document<"u"?document.defaultView:null,n){let s=Ls(e,"escape");$r(t,"keydown",i=>{s&&(i.defaultPrevented||i.key===Ie.Escape&&n(i))})}function Fw(){var e;let[t]=g.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null),[n,s]=g.useState((e=t==null?void 0:t.matches)!=null?e:!1);return me(()=>{if(!t)return;function i(o){s(o.matches)}return t.addEventListener("change",i),()=>t.removeEventListener("change",i)},[t]),n}function zw({defaultContainers:e=[],portals:t,mainTreeNode:n}={}){let s=K(()=>{var i,o;let r=vn(n),a=[];for(let d of e)d!==null&&(zt(d)?a.push(d):"current"in d&&zt(d.current)&&a.push(d.current));if(t!=null&&t.current)for(let d of t.current)a.push(d);for(let d of(i=r==null?void 0:r.querySelectorAll("html > *, body > *"))!=null?i:[])d!==document.body&&d!==document.head&&zt(d)&&d.id!=="headlessui-portal-root"&&(n&&(d.contains(n)||d.contains((o=n==null?void 0:n.getRootNode())==null?void 0:o.host))||a.some(c=>d.contains(c))||a.push(d));return a});return{resolveContainers:s,contains:K(i=>s().some(o=>o.contains(i)))}}let du=g.createContext(null);function cu({children:e,node:t}){let[n,s]=g.useState(null),i=uu(t??n);return g.createElement(du.Provider,{value:i},e,i===null&&g.createElement(es,{features:kn.Hidden,ref:o=>{var r,a;if(o){for(let d of(a=(r=vn(o))==null?void 0:r.querySelectorAll("html > *, body > *"))!=null?a:[])if(d!==document.body&&d!==document.head&&zt(d)&&d!=null&&d.contains(o)){s(d);break}}}}))}function uu(e=null){var t;return(t=g.useContext(du))!=null?t:e}function Ww(){let e=typeof document>"u";return"useSyncExternalStore"in q?(t=>t.useSyncExternalStore)(q)(()=>()=>{},()=>!1,()=>!e):!1}function mo(){let e=Ww(),[t,n]=q.useState(kt.isHandoffComplete);return t&&kt.isHandoffComplete===!1&&n(!1),q.useEffect(()=>{t!==!0&&n(!0)},[t]),q.useEffect(()=>kt.handoff(),[]),e?!1:t}function aa(){let e=g.useRef(!1);return me(()=>(e.current=!0,()=>{e.current=!1}),[]),e}var Xs=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(Xs||{});function Bw(){let e=g.useRef(0);return Jd(!0,"keydown",t=>{t.key==="Tab"&&(e.current=t.shiftKey?1:0)},!0),e}function hu(e){if(!e)return new Set;if(typeof e=="function")return new Set(e());let t=new Set;for(let n of e.current)zt(n.current)&&t.add(n.current);return t}let Hw="div";var Cn=(e=>(e[e.None=0]="None",e[e.InitialFocus=1]="InitialFocus",e[e.TabLock=2]="TabLock",e[e.FocusLock=4]="FocusLock",e[e.RestoreFocus=8]="RestoreFocus",e[e.AutoFocus=16]="AutoFocus",e))(Cn||{});function Vw(e,t){let n=g.useRef(null),s=We(n,t),{initialFocus:i,initialFocusFallback:o,containers:r,features:a=15,...d}=e;mo()||(a=0);let c=zs(n.current);qw(a,{ownerDocument:c});let u=Yw(a,{ownerDocument:c,container:n,initialFocus:i,initialFocusFallback:o});Kw(a,{ownerDocument:c,container:n,containers:r,previousActiveElement:u});let h=Bw(),f=K(_=>{if(!lt(n.current))return;let y=n.current;(v=>v())(()=>{Ge(h.current,{[Xs.Forwards]:()=>{Fs(y,Bt.First,{skipElements:[_.relatedTarget,o]})},[Xs.Backwards]:()=>{Fs(y,Bt.Last,{skipElements:[_.relatedTarget,o]})}})})}),m=Ls(!!(a&2),"focus-trap#tab-lock"),p=Ft(),b=g.useRef(!1),x={ref:s,onKeyDown(_){_.key=="Tab"&&(b.current=!0,p.requestAnimationFrame(()=>{b.current=!1}))},onBlur(_){if(!(a&4))return;let y=hu(r);lt(n.current)&&y.add(n.current);let v=_.relatedTarget;Wt(v)&&v.dataset.headlessuiFocusGuard!=="true"&&(fu(y,v)||(b.current?Fs(n.current,Ge(h.current,{[Xs.Forwards]:()=>Bt.Next,[Xs.Backwards]:()=>Bt.Previous})|Bt.WrapAround,{relativeTo:_.target}):Wt(_.target)&&Ht(_.target)))}},w=we();return g.createElement(g.Fragment,null,m&&g.createElement(es,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:f,features:kn.Focusable}),w({ourProps:x,theirProps:d,defaultTag:Hw,name:"FocusTrap"}),m&&g.createElement(es,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:f,features:kn.Focusable}))}let Rw=xe(Vw),$w=Object.assign(Rw,{features:Cn});function Uw(e=!0){let t=g.useRef(Mt.slice());return Bs(([n],[s])=>{s===!0&&n===!1&&Yi(()=>{t.current.splice(0)}),s===!1&&n===!0&&(t.current=Mt.slice())},[e,Mt,t]),K(()=>{var n;return(n=t.current.find(s=>s!=null&&s.isConnected))!=null?n:null})}function qw(e,{ownerDocument:t}){let n=!!(e&8),s=Uw(n);Bs(()=>{n||Tr(t==null?void 0:t.body)&&Ht(s())},[n]),ia(()=>{n&&Ht(s())})}function Yw(e,{ownerDocument:t,container:n,initialFocus:s,initialFocusFallback:i}){let o=g.useRef(null),r=Ls(!!(e&1),"focus-trap#initial-focus"),a=aa();return Bs(()=>{if(e===0)return;if(!r){i!=null&&i.current&&Ht(i.current);return}let d=n.current;d&&Yi(()=>{if(!a.current)return;let c=t==null?void 0:t.activeElement;if(s!=null&&s.current){if((s==null?void 0:s.current)===c){o.current=c;return}}else if(d.contains(c)){o.current=c;return}if(s!=null&&s.current)Ht(s.current);else{if(e&16){if(Fs(d,Bt.First|Bt.AutoFocus)!==Vr.Error)return}else if(Fs(d,Bt.First)!==Vr.Error)return;if(i!=null&&i.current&&(Ht(i.current),(t==null?void 0:t.activeElement)===i.current))return;console.warn("There are no focusable elements inside the <FocusTrap />")}o.current=t==null?void 0:t.activeElement})},[i,r,e]),o}function Kw(e,{ownerDocument:t,container:n,containers:s,previousActiveElement:i}){let o=aa(),r=!!(e&4);$r(t==null?void 0:t.defaultView,"focus",a=>{if(!r||!o.current)return;let d=hu(s);lt(n.current)&&d.add(n.current);let c=i.current;if(!c)return;let u=a.target;lt(u)?fu(d,u)?(i.current=u,Ht(u)):(a.preventDefault(),a.stopPropagation(),Ht(c)):Ht(i.current)},!0)}function fu(e,t){for(let n of e)if(n.contains(t))return!0;return!1}function mu(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||!Es((t=e.as)!=null?t:gu)||g.Children.count(e.children)===1}let po=g.createContext(null);po.displayName="TransitionContext";var Gw=(e=>(e.Visible="visible",e.Hidden="hidden",e))(Gw||{});function Xw(){let e=g.useContext(po);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function Qw(){let e=g.useContext(go);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let go=g.createContext(null);go.displayName="NestingContext";function bo(e){return"children"in e?bo(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function pu(e,t){let n=Zt(e),s=g.useRef([]),i=aa(),o=Ft(),r=K((m,p=Jt.Hidden)=>{let b=s.current.findIndex(({el:x})=>x===m);b!==-1&&(Ge(p,{[Jt.Unmount](){s.current.splice(b,1)},[Jt.Hidden](){s.current[b].state="hidden"}}),o.microTask(()=>{var x;!bo(s)&&i.current&&((x=n.current)==null||x.call(n))}))}),a=K(m=>{let p=s.current.find(({el:b})=>b===m);return p?p.state!=="visible"&&(p.state="visible"):s.current.push({el:m,state:"visible"}),()=>r(m,Jt.Unmount)}),d=g.useRef([]),c=g.useRef(Promise.resolve()),u=g.useRef({enter:[],leave:[]}),h=K((m,p,b)=>{d.current.splice(0),t&&(t.chains.current[p]=t.chains.current[p].filter(([x])=>x!==m)),t==null||t.chains.current[p].push([m,new Promise(x=>{d.current.push(x)})]),t==null||t.chains.current[p].push([m,new Promise(x=>{Promise.all(u.current[p].map(([w,_])=>_)).then(()=>x())})]),p==="enter"?c.current=c.current.then(()=>t==null?void 0:t.wait.current).then(()=>b(p)):b(p)}),f=K((m,p,b)=>{Promise.all(u.current[p].splice(0).map(([x,w])=>w)).then(()=>{var x;(x=d.current.shift())==null||x()}).then(()=>b(p))});return g.useMemo(()=>({children:s,register:a,unregister:r,onStart:h,onStop:f,wait:c,chains:u}),[a,r,s,h,f,u,c])}let gu=g.Fragment,bu=Zn.RenderStrategy;function Zw(e,t){var n,s;let{transition:i=!0,beforeEnter:o,afterEnter:r,beforeLeave:a,afterLeave:d,enter:c,enterFrom:u,enterTo:h,entered:f,leave:m,leaveFrom:p,leaveTo:b,...x}=e,[w,_]=g.useState(null),y=g.useRef(null),v=mu(e),j=We(...v?[y,t,_]:t===null?[]:[t]),k=(n=x.unmount)==null||n?Jt.Unmount:Jt.Hidden,{show:C,appear:S,initial:T}=Xw(),[D,P]=g.useState(C?"visible":"hidden"),L=Qw(),{register:W,unregister:$}=L;me(()=>W(y),[W,y]),me(()=>{if(k===Jt.Hidden&&y.current){if(C&&D!=="visible"){P("visible");return}return Ge(D,{hidden:()=>$(y),visible:()=>W(y)})}},[D,y,W,$,C,k]);let O=mo();me(()=>{if(v&&O&&D==="visible"&&y.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[y,D,O,v]);let F=T&&!S,H=S&&C&&T,M=g.useRef(!1),E=pu(()=>{M.current||(P("hidden"),$(y))},L),V=K(R=>{M.current=!0;let Y=R?"enter":"leave";E.onStart(y,Y,ee=>{ee==="enter"?o==null||o():ee==="leave"&&(a==null||a())})}),z=K(R=>{let Y=R?"enter":"leave";M.current=!1,E.onStop(y,Y,ee=>{ee==="enter"?r==null||r():ee==="leave"&&(d==null||d())}),Y==="leave"&&!bo(E)&&(P("hidden"),$(y))});g.useEffect(()=>{v&&i||(V(C),z(C))},[C,v,i]);let A=(()=>!(!i||!v||!O||F))(),[,U]=uc(A,w,C,{start:V,end:z}),J=en({ref:j,className:((s=Pr(x.className,H&&c,H&&u,U.enter&&c,U.enter&&U.closed&&u,U.enter&&!U.closed&&h,U.leave&&m,U.leave&&!U.closed&&p,U.leave&&U.closed&&b,!U.transition&&C&&f))==null?void 0:s.trim())||void 0,...cc(U)}),ne=0;D==="visible"&&(ne|=Qe.Open),D==="hidden"&&(ne|=Qe.Closed),C&&D==="hidden"&&(ne|=Qe.Opening),!C&&D==="visible"&&(ne|=Qe.Closing);let Q=we();return g.createElement(go.Provider,{value:E},g.createElement(Uc,{value:ne},Q({ourProps:J,theirProps:x,defaultTag:gu,features:bu,visible:D==="visible",name:"Transition.Child"})))}function Jw(e,t){let{show:n,appear:s=!1,unmount:i=!0,...o}=e,r=g.useRef(null),a=mu(e),d=We(...a?[r,t]:t===null?[]:[t]);mo();let c=qs();if(n===void 0&&c!==null&&(n=(c&Qe.Open)===Qe.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[u,h]=g.useState(n?"visible":"hidden"),f=pu(()=>{n||h("hidden")}),[m,p]=g.useState(!0),b=g.useRef([n]);me(()=>{m!==!1&&b.current[b.current.length-1]!==n&&(b.current.push(n),p(!1))},[b,n]);let x=g.useMemo(()=>({show:n,appear:s,initial:m}),[n,s,m]);me(()=>{n?h("visible"):!bo(f)&&r.current!==null&&h("hidden")},[n,f]);let w={unmount:i},_=K(()=>{var j;m&&p(!1),(j=e.beforeEnter)==null||j.call(e)}),y=K(()=>{var j;m&&p(!1),(j=e.beforeLeave)==null||j.call(e)}),v=we();return g.createElement(go.Provider,{value:f},g.createElement(po.Provider,{value:x},v({ourProps:{...w,as:g.Fragment,children:g.createElement(xu,{ref:d,...w,...o,beforeEnter:_,beforeLeave:y})},theirProps:{},defaultTag:g.Fragment,features:bu,visible:u==="visible",name:"Transition"})))}function e_(e,t){let n=g.useContext(po)!==null,s=qs()!==null;return g.createElement(g.Fragment,null,!n&&s?g.createElement(la,{ref:t,...e}):g.createElement(xu,{ref:t,...e}))}let la=xe(Jw),xu=xe(Zw),da=xe(e_),t_=Object.assign(la,{Child:da,Root:la});var n_=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(n_||{}),s_=(e=>(e[e.SetTitleId=0]="SetTitleId",e))(s_||{});let i_={0(e,t){return e.titleId===t.id?e:{...e,titleId:t.id}}},ca=g.createContext(null);ca.displayName="DialogContext";function xo(e){let t=g.useContext(ca);if(t===null){let n=new Error(`<${e} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,xo),n}return t}function o_(e,t){return Ge(t.type,i_,e,t)}let wu=xe(function(e,t){let n=g.useId(),{id:s=`headlessui-dialog-${n}`,open:i,onClose:o,initialFocus:r,role:a="dialog",autoFocus:d=!0,__demoMode:c=!1,unmount:u=!1,...h}=e,f=g.useRef(!1);a=function(){return a==="dialog"||a==="alertdialog"?a:(f.current||(f.current=!0,console.warn(`Invalid role [${a}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog")}();let m=qs();i===void 0&&m!==null&&(i=(m&Qe.Open)===Qe.Open);let p=g.useRef(null),b=We(p,t),x=zs(p.current),w=i?0:1,[_,y]=g.useReducer(o_,{titleId:null,descriptionId:null,panelRef:g.createRef()}),v=K(()=>o(!1)),j=K(U=>y({type:0,id:U})),k=mo()?w===0:!1,[C,S]=uw(),T={get current(){var U;return(U=_.panelRef.current)!=null?U:p.current}},D=uu(),{resolveContainers:P}=zw({mainTreeNode:D,portals:C,defaultContainers:[T]}),L=m!==null?(m&Qe.Closing)===Qe.Closing:!1;Kd(c||L?!1:k,{allowed:K(()=>{var U,J;return[(J=(U=p.current)==null?void 0:U.closest("[data-headlessui-portal]"))!=null?J:null]}),disallowed:K(()=>{var U;return[(U=D==null?void 0:D.closest("body > *:not(#headlessui-portal-root)"))!=null?U:null]})});let W=to.get(null);me(()=>{if(k)return W.actions.push(s),()=>W.actions.pop(s)},[W,s,k]);let $=Ee(W,g.useCallback(U=>W.selectors.isTop(U,s),[W,s]));tc($,P,U=>{U.preventDefault(),v()}),Aw($,x==null?void 0:x.defaultView,U=>{U.preventDefault(),U.stopPropagation(),document.activeElement&&"blur"in document.activeElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),v()}),rc(c||L?!1:k,x,P),Gd(k,p,v);let[O,F]=Lr(),H=g.useMemo(()=>[{dialogState:w,close:v,setTitleId:j,unmount:u},_],[w,v,j,u,_]),M=Ke({open:w===0}),E={ref:b,id:s,role:a,tabIndex:-1,"aria-modal":c?void 0:w===0?!0:void 0,"aria-labelledby":_.titleId,"aria-describedby":O,unmount:u},V=!Fw(),z=Cn.None;k&&!c&&(z|=Cn.RestoreFocus,z|=Cn.TabLock,d&&(z|=Cn.AutoFocus),V&&(z|=Cn.InitialFocus));let A=we();return g.createElement(nw,null,g.createElement(Kc,{force:!0},g.createElement(Zc,null,g.createElement(ca.Provider,{value:H},g.createElement(Qc,{target:p},g.createElement(Kc,{force:!1},g.createElement(F,{slot:M},g.createElement(S,null,g.createElement($w,{initialFocus:r,initialFocusFallback:p,containers:P,features:z},g.createElement(Sb,{value:v},A({ourProps:E,theirProps:h,slot:M,defaultTag:r_,features:a_,visible:w===0,name:"Dialog"})))))))))))}),r_="div",a_=Zn.RenderStrategy|Zn.Static;function l_(e,t){let{transition:n=!1,open:s,...i}=e,o=qs(),r=e.hasOwnProperty("open")||o!==null,a=e.hasOwnProperty("onClose");if(!r&&!a)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!r)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!a)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(!o&&typeof e.open!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${e.open}`);if(typeof e.onClose!="function")throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${e.onClose}`);return(s!==void 0||n)&&!i.static?g.createElement(cu,null,g.createElement(t_,{show:s,transition:n,unmount:i.unmount},g.createElement(wu,{ref:t,...i}))):g.createElement(cu,null,g.createElement(wu,{ref:t,open:s,...i}))}let d_="div";function c_(e,t){let n=g.useId(),{id:s=`headlessui-dialog-panel-${n}`,transition:i=!1,...o}=e,[{dialogState:r,unmount:a},d]=xo("Dialog.Panel"),c=We(t,d.panelRef),u=Ke({open:r===0}),h=K(x=>{x.stopPropagation()}),f={ref:c,id:s,onClick:h},m=i?da:g.Fragment,p=i?{unmount:a}:{},b=we();return g.createElement(m,{...p},b({ourProps:f,theirProps:o,slot:u,defaultTag:d_,name:"Dialog.Panel"}))}let u_="div";function h_(e,t){let{transition:n=!1,...s}=e,[{dialogState:i,unmount:o}]=xo("Dialog.Backdrop"),r=Ke({open:i===0}),a={ref:t,"aria-hidden":!0},d=n?da:g.Fragment,c=n?{unmount:o}:{},u=we();return g.createElement(d,{...c},u({ourProps:a,theirProps:s,slot:r,defaultTag:u_,name:"Dialog.Backdrop"}))}let f_="h2";function m_(e,t){let n=g.useId(),{id:s=`headlessui-dialog-title-${n}`,...i}=e,[{dialogState:o,setTitleId:r}]=xo("Dialog.Title"),a=We(t);g.useEffect(()=>(r(s),()=>r(null)),[s,r]);let d=Ke({open:o===0}),c={ref:a,id:s};return we()({ourProps:c,theirProps:i,slot:d,defaultTag:f_,name:"Dialog.Title"})}let p_=xe(l_),ua=xe(c_),_u=xe(h_),ha=xe(m_),wo=Object.assign(p_,{Panel:ua,Title:ha,Description:Ji}),g_="div";function b_(e,t){let n=`headlessui-control-${g.useId()}`,[s,i]=Ar(),[o,r]=Lr(),a=Qn(),{disabled:d=a||!1,...c}=e,u=Ke({disabled:d}),h={ref:t,disabled:d||void 0,"aria-disabled":d||void 0},f=we();return g.createElement(Jg,{value:d},g.createElement(i,{value:s},g.createElement(r,{value:o},g.createElement(hb,{id:n},f({ourProps:h,theirProps:{...c,children:g.createElement(db,null,typeof c.children=="function"?c.children(u):c.children)},slot:u,defaultTag:g_,name:"Field"})))))}let x_=xe(b_),w_="select";function __(e,t){let n=g.useId(),s=Xi(),i=Qn(),{id:o=s||`headlessui-select-${n}`,disabled:r=i||!1,invalid:a=!1,autoFocus:d=!1,...c}=e,u=ts(),h=Ir(),{isFocusVisible:f,focusProps:m}=Ps({autoFocus:d}),{isHovered:p,hoverProps:b}=Ts({isDisabled:r}),{pressed:x,pressProps:w}=Ki({disabled:r}),_=Jn({ref:t,id:o,"aria-labelledby":u,"aria-describedby":h,"aria-invalid":a?"true":void 0,disabled:r||void 0,autoFocus:d},m,b,w),y=Ke({disabled:r,invalid:a,hover:p,focus:f,active:x,autofocus:d});return we()({ourProps:_,theirProps:c,slot:y,defaultTag:w_,name:"Select"})}let y_=xe(__),fa=g.createContext(null);fa.displayName="GroupContext";let v_=g.Fragment;function k_(e){var t;let[n,s]=g.useState(null),[i,o]=Ar(),[r,a]=Lr(),d=g.useMemo(()=>({switch:n,setSwitch:s}),[n,s]),c={},u=e,h=we();return g.createElement(a,{name:"Switch.Description",value:r},g.createElement(o,{name:"Switch.Label",value:i,props:{htmlFor:(t=d.switch)==null?void 0:t.id,onClick(f){n&&(Dr(f.currentTarget)&&f.preventDefault(),n.click(),n.focus({preventScroll:!0}))}}},g.createElement(fa.Provider,{value:d},h({ourProps:c,theirProps:u,slot:{},defaultTag:v_,name:"Switch.Group"}))))}let j_="button";function N_(e,t){var n;let s=g.useId(),i=Xi(),o=Qn(),{id:r=i||`headlessui-switch-${s}`,disabled:a=o||!1,checked:d,defaultChecked:c,onChange:u,name:h,value:f,form:m,autoFocus:p=!1,...b}=e,x=g.useContext(fa),[w,_]=g.useState(null),y=g.useRef(null),v=We(y,t,x===null?null:x.setSwitch,_),j=gd(c),[k,C]=pd(d,u,j??!1),S=Ft(),[T,D]=g.useState(!1),P=K(()=>{D(!0),C==null||C(!k),S.nextFrame(()=>{D(!1)})}),L=K(R=>{if(Or(R.currentTarget))return R.preventDefault();R.preventDefault(),P()}),W=K(R=>{R.key===Ie.Space?(R.preventDefault(),P()):R.key===Ie.Enter&&ob(R.currentTarget)}),$=K(R=>R.preventDefault()),O=ts(),F=Ir(),{isFocusVisible:H,focusProps:M}=Ps({autoFocus:p}),{isHovered:E,hoverProps:V}=Ts({isDisabled:a}),{pressed:z,pressProps:A}=Ki({disabled:a}),U=Ke({checked:k,disabled:a,hover:E,focus:H,active:z,autofocus:p,changing:T}),J=Jn({id:r,ref:v,role:"switch",type:ic(e,w),tabIndex:e.tabIndex===-1?0:(n=e.tabIndex)!=null?n:0,"aria-checked":k,"aria-labelledby":O,"aria-describedby":F,disabled:a||void 0,autoFocus:p,onClick:L,onKeyUp:W,onKeyPress:$},M,V,A),ne=g.useCallback(()=>{if(j!==void 0)return C==null?void 0:C(j)},[C,j]),Q=we();return g.createElement(g.Fragment,null,h!=null&&g.createElement(yd,{disabled:a,data:{[h]:f||"on"},overrides:{type:"checkbox",checked:k},form:m,onReset:ne}),Q({ourProps:J,theirProps:b,slot:U,defaultTag:j_,name:"Switch"}))}let S_=xe(N_),C_=k_,M_=Fr,T_=Ji,P_=Object.assign(S_,{Group:C_,Label:M_,Description:T_});function sn({className:e,...t}){return l.jsx(x_,{...t,className:ue(e,"[&>[data-slot=label]+[data-slot=control]]:mt-3","[&>[data-slot=label]+[data-slot=description]]:mt-1","[&>[data-slot=description]+[data-slot=control]]:mt-3","[&>[data-slot=control]+[data-slot=description]]:mt-3","[&>[data-slot=control]+[data-slot=error]]:mt-3","*:data-[slot=label]:font-medium")})}function on({className:e,...t}){return l.jsx(Fr,{"data-slot":"label",...t,className:ue(e,"relative text-base/10 font-bold text-neutral-950 select-none data-disabled:opacity-50 sm:text-sm/8 dark:text-white")})}function rn({className:e,...t}){return l.jsx(Ji,{"data-slot":"description",...t,className:ue(e,"pb-2 text-base/6 text-neutral-500 data-disabled:opacity-50 sm:text-sm/6 dark:text-neutral-400")})}function E_({checked:e,onChange:t,className:n="",iconOn:s=l.jsx("svg",{fill:"currentColor",viewBox:"0 0 12 12",className:"size-3 text-indigo-600",children:l.jsx("path",{d:"M3.707 5.293a1 1 0 00-1.414 1.414l1.414-1.414zM5 8l-.707.707a1 1 0 001.414 0L5 8zm4.707-3.293a1 1 0 00-1.414-1.414l1.414 1.414zm-7.414 2l2 2 1.414-1.414-2-2-1.414 1.414zm3.414 2l4-4-1.414-1.414-4 4 1.414 1.414z"})}),iconOff:i=l.jsx("svg",{fill:"none",viewBox:"0 0 12 12",className:"size-3 text-gray-400",children:l.jsx("path",{d:"M4 8l2-2m0 0l2-2M6 6L4 4m2 2l2 2",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}),...o}){return l.jsxs(P_,{checked:e,onChange:t,className:ue("group relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent bg-gray-200 transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-indigo-600 focus:ring-offset-2 data-[checked]:bg-indigo-600",n),...o,children:[l.jsx("span",{className:"sr-only",children:"Toggle setting"}),l.jsxs("span",{className:"pointer-events-none relative inline-block size-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out group-data-[checked]:translate-x-5",children:[l.jsx("span",{"aria-hidden":"true",className:"absolute inset-0 flex size-full items-center justify-center transition-opacity duration-200 ease-in group-data-[checked]:opacity-0 group-data-[checked]:duration-100 group-data-[checked]:ease-out",children:i}),l.jsx("span",{"aria-hidden":"true",className:"absolute inset-0 flex size-full items-center justify-center opacity-0 transition-opacity duration-100 ease-out group-data-[checked]:opacity-100 group-data-[checked]:duration-200 group-data-[checked]:ease-in",children:s})]})]})}function an({label:e,help:t,iconClassName:n="size-4",buttonClassName:s="",...i}){const[o,r]=g.useState(!1);return t?l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button","aria-label":"Show help",onClick:()=>r(!0),className:`absolute top-[5px] right-[-25px] inline-flex items-center justify-center rounded-full p-1 text-gray-400 hover:text-indigo-600 focus:outline-none focus:ring-2 focus:ring-indigo-500 ${s}`,tabIndex:0,children:l.jsx(Yl,{className:n})}),l.jsxs(wo,{open:o,onClose:r,className:"relative z-999",children:[l.jsx(_u,{transition:!0,className:"fixed inset-0 bg-gray-500/75 transition-opacity data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in"}),l.jsx("div",{className:"fixed inset-0 z-999 w-screen overflow-y-auto",children:l.jsx("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:l.jsxs(ua,{transition:!0,className:"relative transform overflow-hidden rounded-lg bg-white px-4 pb-4 pt-5 text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in sm:my-8 sm:w-full sm:max-w-lg sm:p-6 data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95",children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{className:"flex-shrink-0 flex items-center justify-center rounded-full bg-indigo-100 size-10",children:l.jsx(Yl,{className:"size-6 text-indigo-600"})}),l.jsxs("div",{children:[l.jsx(ha,{as:"h3",className:"text-base font-semibold text-gray-900",children:e}),l.jsx("div",{className:"mt-2",children:l.jsx("div",{className:"text-sm text-gray-500",dangerouslySetInnerHTML:{__html:t}})})]})]}),l.jsx("div",{className:"mt-5 flex justify-end",children:l.jsx("button",{type:"button",onClick:()=>r(!1),className:"inline-flex justify-center rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500",children:"Close"})})]})})})]})]}):null}const ma=(e,t)=>!t||!t.includes(".")?e==null?void 0:e[t]:t.split(".").reduce((n,s)=>n==null?void 0:n[s],e);function ce(e){const{values:t}=Je(),n=g.useMemo(()=>Array.from(Qs(e)),[e]),s=JSON.stringify(n.map(i=>ma(t,i)));return g.useMemo(()=>Zs(e,t),[e,s])}function Qs(e,t=new Set){return!e||typeof e=="function"?t:Array.isArray(e)?(e.forEach(n=>Qs(n,t)),t):typeof e=="object"?e.all||e.any||e.not?(e.all&&e.all.forEach(n=>Qs(n,t)),e.any&&e.any.forEach(n=>Qs(n,t)),e.not&&Qs(e.not,t),t):e.field?(t.add(e.field),t):(Object.keys(e).forEach(n=>t.add(n)),t):t}function Zs(e,t){if(!e)return!0;if(typeof e=="function")return!!e(t);if(Array.isArray(e))return e.every(n=>Zs(n,t));if(typeof e=="object"){if(e.all)return e.all.every(n=>Zs(n,t));if(e.any)return e.any.some(n=>Zs(n,t));if(e.not)return!Zs(e.not,t);if(e.field){const n=ma(t,e.field);return"eq"in e?n===e.eq:"ne"in e?n!==e.ne:"gt"in e?n>e.gt:"gte"in e?n>=e.gte:"lt"in e?n<e.lt:"lte"in e?n<=e.lte:"in"in e?(e.in??[]).includes(n):e.truthy?!!n:e.falsy?!n:"contains"in e?Array.isArray(n)?n.includes(e.contains):typeof n=="string"?n.includes(String(e.contains)):!1:!!n}return Object.entries(e).every(([n,s])=>{const i=ma(t,n);return Array.isArray(s)?s.includes(i):s===!0?i===!0||i==="on"||i===1||i==="1":s===!1?i===!1||i===""||i===0||i==="0"||i===null||i===void 0:i===s})}return!!e}function X({label:e,id:t,description:n,value:s,onChange:i,help:o,showIf:r,mountWhenHidden:a=!0}){const{values:d,setValue:c}=Je(),u=ce(r);if(!a&&r&&!u)return null;const h=s??(d==null?void 0:d[t])??!1,f=h===!0||h==="on"||h===1||h==="1",m=t||(e?e.replace(/\s+/g,"-").toLowerCase():"toggle");return l.jsxs(sn,{hidden:r&&!u,"aria-hidden":r&&!u,children:[l.jsx("div",{className:"flex items-center gap-2",children:e&&l.jsxs(on,{children:[e,l.jsx(an,{label:e,help:o})]})}),n&&l.jsx(rn,{children:n}),l.jsx("div",{className:"mt-2",children:l.jsx(E_,{id:m,checked:f,disabled:r&&!u,onChange:p=>{const b=!!p;t&&c(t,b),i==null||i(b)},className:`
            bg-gray-200 data-[checked]:bg-indigo-600
            dark:bg-neutral-800 dark:data-[checked]:bg-indigo-500
            border-2 border-transparent
            focus:outline-none focus:ring-2 focus:ring-indigo-600 focus:ring-offset-2
            transition-colors
          `,iconOn:l.jsx("svg",{fill:"currentColor",viewBox:"0 0 12 12",className:"size-3 text-indigo-600 dark:text-indigo-300",children:l.jsx("path",{d:"M3.707 5.293a1 1 0 00-1.414 1.414l1.414-1.414zM5 8l-.707.707a1 1 0 001.414 0L5 8zm4.707-3.293a1 1 0 00-1.414-1.414l1.414 1.414zm-7.414 2l2 2 1.414-1.414-2-2-1.414 1.414zm3.414 2l4-4-1.414-1.414-4 4 1.414 1.414z"})}),iconOff:l.jsx("svg",{fill:"none",viewBox:"0 0 12 12",className:"size-3 text-gray-400 dark:text-neutral-400",children:l.jsx("path",{d:"M4 8l2-2m0 0l2-2M6 6L4 4m2 2l2 2",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})})})]})}function G({id:e,name:t,label:n,description:s,help:i,value:o,onChange:r,type:a="text",placeholder:d,prefix:c,suffix:u,optional:h,showIf:f,resetOnHide:m,mountWhenHidden:p=!0,className:b,step:x,min:w,max:_,...y}){const{values:v,setValue:j}=Je(),k=ce(f),C=g.useRef(k);let S=a,T=c,D=u;const P={step:x,min:w,max:_};a==="price"?(S="number",T=T??"$",D=D??"USD",P.step===void 0&&(P.step="any"),P.min===void 0&&(P.min="0")):a==="url"?(S="text",T=T??"https://"):a==="email"?S="email":a==="number"&&(S="number");const L=e?v==null?void 0:v[e]:void 0,W=o!==void 0,$=g.useMemo(()=>(W?o:L)??"",[W,o,L]);if(g.useEffect(()=>{C.current&&!k&&m!==void 0&&e&&j(e,m===!0?void 0:m),C.current=k},[k,m,e,j]),!p&&f&&!k)return null;const O=!k&&p,F=H=>{const M=S==="number"?H.target.value===""?"":Number(H.target.value):H.target.value;!W&&e&&j(e,M),r==null||r(M)};return l.jsxs(sn,{hidden:f&&!k,"aria-hidden":f&&!k,className:b,...y,children:[l.jsxs("div",{className:"flex justify-between items-center",children:[n&&l.jsxs(on,{htmlFor:e,children:[n,l.jsx(an,{label:n,help:i})]}),h&&l.jsx("span",{id:`${e}-optional`,className:"text-sm/6 text-gray-500 dark:text-neutral-400",children:"Optional"})]}),s&&l.jsx(rn,{children:s}),l.jsx("div",{className:"mt-2 max-w-lg",children:T||D?l.jsxs("div",{className:"flex items-center rounded-md bg-white px-3 outline outline-1 -outline-offset-1 outline-gray-300 focus-within:outline focus-within:outline-2 focus-within:-outline-offset-2 focus-within:outline-indigo-600 dark:bg-neutral-900 dark:outline-neutral-700",children:[T&&l.jsx("div",{className:"shrink-0 select-none text-base text-gray-500 dark:text-neutral-400 sm:text-sm/6",children:T}),l.jsx("input",{id:e,name:t||e,type:S,value:$,onChange:F,placeholder:d,"aria-describedby":h?`${e}-optional`:void 0,disabled:O,className:`block min-w-0 grow py-1.5 !pl-1 pr-3 text-base text-gray-900 placeholder:text-gray-400 focus:outline focus:outline-0 sm:text-sm/6 bg-transparent dark:text-white dark:placeholder:text-neutral-500 ${a==="url"?"!border-0 !outline-none !shadow-none !focus:ring-0 !focus:border-0 dark:!bg-neutral-900":""}`,...P}),D&&l.jsx("div",{id:a==="price"?`${e}-currency`:void 0,className:"shrink-0 select-none text-base text-gray-500 dark:text-neutral-400 sm:text-sm/6",children:D})]}):l.jsx("input",{id:e,name:t||e,type:S,value:$,onChange:F,placeholder:d,"aria-describedby":h?`${e}-optional`:void 0,disabled:O,className:"block w-full rounded-md bg-white px-3 py-1.5 text-base text-gray-900 outline outline-1 -outline-offset-1 outline-gray-300 placeholder:text-gray-400 focus:outline focus:outline-2 focus:-outline-offset-2 focus:outline-indigo-600 sm:text-sm/6 dark:bg-neutral-900 dark:text-white dark:placeholder:text-neutral-500 dark:outline-neutral-700",...P})})]})}function bt({id:e,name:t,label:n,description:s,help:i,value:o,onChange:r,rows:a=4,placeholder:d,optional:c,showIf:u,resetOnHide:h,mountWhenHidden:f=!0,className:m,...p}){const{values:b,setValue:x}=Je(),w=ce(u),_=g.useRef(w),y=e?b==null?void 0:b[e]:void 0,v=o!==void 0,j=g.useMemo(()=>(v?o:y)??"",[v,o,y]);if(g.useEffect(()=>{_.current&&!w&&h!==void 0&&e&&x(e,h===!0?void 0:h),_.current=w},[w,h,e,x]),!f&&u&&!w)return null;const k=!w&&f,C=S=>{const T=S.target.value;!v&&e&&x(e,T),r==null||r(T)};return l.jsxs(sn,{hidden:u&&!w,"aria-hidden":u&&!w,className:m,...p,children:[l.jsxs("div",{className:"flex justify-between items-center",children:[n&&l.jsxs(on,{htmlFor:e,children:[n,l.jsx(an,{label:n,help:i})]}),c&&l.jsx("span",{id:`${e}-optional`,className:"text-sm/6 text-gray-500 dark:text-neutral-400",children:"Optional"})]}),s&&l.jsx(rn,{children:s}),l.jsx("div",{className:"mt-2 max-w-lg",children:l.jsx("textarea",{id:e,name:t||e,rows:a,value:j,onChange:C,placeholder:d,"aria-describedby":c?`${e}-optional`:void 0,disabled:k,className:"block w-full rounded-md bg-white px-3 py-1.5 text-base text-gray-900 outline outline-1 -outline-offset-1 outline-gray-300 placeholder:text-gray-400 focus:outline focus:outline-2 focus:-outline-offset-2 focus:outline-indigo-600 sm:text-sm/6 dark:bg-neutral-900 dark:text-white dark:placeholder:text-neutral-500 dark:outline-neutral-700"})})]})}const D_=g.forwardRef(function({className:t,multiple:n,...s},i){return l.jsxs("span",{"data-slot":"control",className:ue([t,"group relative block w-full max-w-lg","before:absolute before:inset-px before:rounded-[calc(var(--radius-lg)-1px)] before:bg-white before:shadow-sm","dark:before:hidden","after:pointer-events-none after:absolute after:inset-0 after:rounded-lg after:ring-transparent after:ring-inset has-data-focus:after:ring-2 has-data-focus:after:ring-blue-500","has-data-disabled:opacity-50 has-data-disabled:before:bg-stone-950/5 has-data-disabled:before:shadow-none"]),children:[l.jsx(y_,{ref:i,multiple:n,...s,className:ue(["relative block w-full max-w-lg appearance-none rounded-lg py-[calc(--spacing(2.5)-1px)] sm:py-[calc(--spacing(1.5)-1px)]",n?"px-[calc(--spacing(3.5)-1px)] sm:px-[calc(--spacing(3)-1px)]":"pr-[calc(--spacing(10)-1px)] pl-[calc(--spacing(3.5)-1px)] sm:pr-[calc(--spacing(9)-1px)] sm:pl-[calc(--spacing(3)-1px)]","[&_optgroup]:font-semibold","text-base/6 text-stone-950 placeholder:text-stone-500 sm:text-sm/6 dark:text-white dark:*:text-white","!hover:text-stone-950/80 !sm:hover:text-stone-950/90 !dark:hover:text-white/80 !dark:*:hover:text-white/90","border border-stone-950/10 data-hover:border-stone-950/20 dark:border-white/10 dark:data-hover:border-white/20","bg-transparent dark:bg-white/5 dark:*:bg-stone-800","focus:outline-hidden","data-invalid:border-red-500 data-invalid:data-hover:border-red-500 dark:data-invalid:border-red-600 dark:data-invalid:data-hover:border-red-600","data-disabled:border-stone-950/20 data-disabled:opacity-100 dark:data-disabled:border-white/15 dark:data-disabled:bg-white/2.5 dark:data-hover:data-disabled:border-white/15"])}),!n&&l.jsx("span",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2",children:l.jsxs("svg",{className:"size-5 stroke-stone-500 group-has-data-disabled:stroke-stone-600 sm:size-4 dark:stroke-stone-400 forced-colors:stroke-[CanvasText]",viewBox:"0 0 16 16","aria-hidden":"true",fill:"none",children:[l.jsx("path",{d:"M5.75 10.75L8 13L10.25 10.75",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M10.25 5.25L8 3L5.75 5.25",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]})})]})});function ot({label:e,description:t,options:n,value:s,onChange:i,help:o,name:r,id:a,showIf:d,resetOnHide:c,mountWhenHidden:u=!0,className:h,...f}){const m=g.useId(),p=a||`${r||(e?e.replace(/\s+/g,"-").toLowerCase():"select")}-select-${m}`,b=ce(d),x=g.useRef(b),{values:w,setValue:_}=Je(),y=a?w==null?void 0:w[a]:void 0,v=s!==void 0,j=v?s:y??"";if(g.useEffect(()=>{x.current&&!b&&c!==void 0&&a&&_(a,c===!0?void 0:c),x.current=b},[b,c,a,_]),!u&&!b)return null;const k=C=>{const S=C.target.value;!v&&a&&_(a,S),i==null||i(S)};return l.jsxs(sn,{hidden:!b,"aria-hidden":!b,children:[l.jsx("div",{className:"flex items-center gap-2",children:e&&l.jsxs(on,{htmlFor:p,children:[e,l.jsx(an,{label:e,help:o})]})}),t&&l.jsx(rn,{children:t}),l.jsx(D_,{id:p,name:r,value:j,onChange:k,disabled:!b&&u,className:h,...f,children:n==null?void 0:n.map(C=>l.jsx("option",{value:C.value??C.label,disabled:C.disabled,children:C.label},(C.value??C.label).toString()))})]})}function B({title:e,description:t,upgradeUrl:n}){const s=n||"https://wpenhanced.com/products/free-downloads-woocommerce";return l.jsxs("div",{className:"inline-flex flex-col rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-right dark:border-amber-800 dark:bg-amber-900/20",children:[l.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-amber-700 dark:text-amber-300",children:"Pro"}),e&&l.jsx("span",{className:"text-sm font-medium text-neutral-800 dark:text-neutral-200",children:e}),t&&l.jsx("span",{className:"mt-0.5 max-w-[200px] text-xs text-neutral-600 dark:text-neutral-400",children:t}),l.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"mt-1.5 text-xs font-medium text-amber-600 hover:text-amber-700 dark:text-amber-400 dark:hover:text-amber-300",children:"Upgrade"})]})}function O_(...e){return e.filter(Boolean).join(" ")}function yu({tabs:e,onTabChange:t,value:n,setValue:s}){const i=g.useMemo(()=>n?e.find(a=>a.value===n||a.name===n)||e[0]:e.find(a=>a.current)||e[0],[e,n]);function o(a){const d=a.target.value,c=e.find(u=>u.name===d||u.value===d);s&&s((c==null?void 0:c.value)||(c==null?void 0:c.name)),t?t(d,c):c&&c.href&&(window.location.href=c.href)}function r(a){s&&s(a.value||a.name),t?t(a.name,a):a.href&&(window.location.href=a.href)}return l.jsxs("div",{children:[l.jsxs("div",{className:"grid grid-cols-1 sm:hidden",children:[l.jsx("select",{value:i.value||i.name,"aria-label":"Select a tab",className:"col-start-1 row-start-1 w-full appearance-none rounded-md bg-white py-2 pl-3 pr-8 text-base text-gray-900 outline outline-1 -outline-offset-1 outline-gray-300 focus:outline focus:outline-2 focus:-outline-offset-2 focus:outline-indigo-600",onChange:o,children:e.map(a=>l.jsx("option",{value:a.value||a.name,children:a.name},a.value||a.name))}),l.jsx(cg,{"aria-hidden":"true",className:"pointer-events-none col-start-1 row-start-1 mr-2 size-5 self-center justify-self-end fill-gray-500"})]}),l.jsx("div",{className:"hidden sm:block",children:l.jsx("nav",{"aria-label":"Tabs",className:"flex space-x-8 border-b border-neutral-200 dark:border-neutral-700",children:e.map(a=>{const d=n?(a.value||a.name)===(i.value||i.name):a.current,c=a.icon;return l.jsxs("button",{type:"button","aria-current":d?"page":void 0,className:O_(d?"border-indigo-500 text-indigo-600 dark:border-indigo-400 dark:text-indigo-400":"border-transparent text-neutral-500 hover:border-neutral-300 hover:text-neutral-700 dark:text-neutral-400 dark:hover:border-neutral-600 dark:hover:text-neutral-200","-mb-px border-b-2 px-1 py-4 text-sm font-medium transition-colors inline-flex items-center gap-2"),onClick:()=>r(a),children:[c&&l.jsx(c,{className:"size-4 shrink-0","aria-hidden":"true"}),a.name]},a.value||a.name)})})})]})}const Js=()=>typeof window<"u"?(window.__wpeSettingsFiltersRegistry||(window.__wpeSettingsFiltersRegistry={}),window.__wpeSettingsFiltersRegistry):{};function I_(e,t,n,s=10){const i=Js();i[e]||(i[e]=[]),i[e].push({namespace:t,callback:n,priority:s}),i[e].sort((o,r)=>o.priority-r.priority)}function L_(e,t){const n=Js();n[e]&&(n[e]=n[e].filter(s=>s.namespace!==t))}function N(e,t,...n){const s=Js();if(!s[e]||s[e].length===0)return t;let i=t;for(const o of s[e])i=o.callback(i,...n);return i}function A_(e){const t=Js();return t[e]&&t[e].length>0}function F_(e){var n;return((n=Js()[e])==null?void 0:n.length)||0}typeof window<"u"&&(window.wpeSettingsFilters={addFilter:I_,removeFilter:L_,applyFilters:N,hasFilter:A_,getFilterCount:F_});function ct({settingId:e,children:t,className:n=""}){const s=d=>{var m;const c=typeof window<"u"&&((m=window.diviEngineSettingsObject)==null?void 0:m.organization)||"divi-engine",f=getRegistry(c).getAllSettingsIndexes().find(p=>p.fieldId===d);return f&&f.sectionKey?f.sectionKey:null},i=()=>{const d=window.location.hash;let c="free-downloads-woocommerce";if(d.includes("/")){const u=d.split("/");u[0].startsWith("#")&&(c=u[0].substring(1))}else d.startsWith("#")&&(c=d.substring(1));return c},o=()=>{const d=window.location.hash;if(d.includes("/")){const c=d.split("/");if(c.length>1)return c[1]}return null},r=d=>{d.preventDefault();const c=s(e),u=o();if(c&&c!==u){const m=`#${i()}/${c}`;window.location.hash=m,setTimeout(()=>{const p=document.getElementById(e);p&&a(p)},350);return}const h=document.getElementById(e);if(h){const f=h.closest("[data-tab]");if(f&&f.classList.contains("hidden")){const m=f.getAttribute("data-tab");document.querySelectorAll('button[type="button"][aria-current]');const p=document.querySelectorAll('nav[aria-label="Tabs"] button');for(const b of p)if(b.textContent.toLowerCase()===m.toLowerCase()){b.click();break}setTimeout(()=>{a(h)},50)}else a(h)}else{const f=document.querySelector(`section#${e}`);if(f)f.scrollIntoView({behavior:"smooth",block:"start"});else if(["general","single-files","multiple-files","owned-products","pdf-settings","quick-view","debug","reports","download-limits","tracking","download-delivery","advanced-restrictions","newsletter","emails"].includes(e)){const b=`#${i()}/${e}`;window.location.hash=b,setTimeout(()=>{const x=document.querySelector(`section#${e}`);x&&x.scrollIntoView({behavior:"smooth",block:"start"})},300)}}},a=d=>{let c=d,u=d.parentElement;for(;u&&!(u.tagName==="SECTION"||u.hasAttribute("data-tab"));)u.children.length>=2&&(c=u),u=u.parentElement;c.scrollIntoView({behavior:"smooth",block:"center"}),c.classList.add("ring-2","ring-blue-500","ring-offset-4","rounded-lg"),c.style.transition="box-shadow 0.3s ease-in-out",setTimeout(()=>{c.classList.remove("ring-2","ring-blue-500","ring-offset-4","rounded-lg")},2500)};return l.jsx("button",{type:"button",onClick:r,className:`text-neutral-600 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-neutral-200 underline underline-offset-2 cursor-pointer ${n}`,children:t})}const ye="free-downloads-woocommerce",vu={somdn_pro_disable_ecommerce:!1,somdn_shop_download_logged_in_text:"",somdn_shop_download_logged_out_text:"",somdn_shop_disabled_logged_in_text:"",somdn_shop_disabled_logged_out_text:"",somdn_require_login:!1,somdn_require_login_message:"",somdn_require_login_grouped_message:"",somdn_download_in_new_window:!1,somdn_include_archive_items:!1,somdn_hide_readmore_button_archive:!1,somdn_include_sale_items:!1,somdn_indy_items:!1,somdn_indy_exclude_items:!1,somdn_disable_security_key_check:!1,somdn_enable_download_sorting:!1,somdn_download_counts_output:0,somdn_download_counts_output_text:"",somdn_button_class:"",somdn_button_css:"",somdn_link_class:"",somdn_link_css:""};function ku(){const[e,t]=g.useState("access"),n=ce({somdn_require_login:!0}),s=[{name:"Access",value:"access"},{name:"Shop Pages",value:"shop"},{name:"Display",value:"display"},{name:"Styling",value:"styling"}];return l.jsxs("section",{className:"space-y-6",id:"general",children:[l.jsx("h2",{className:"text-lg font-semibold dark:text-white",children:"General Settings"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Configure how free downloads work across your site."}),l.jsx(yu,{tabs:s,value:e,setValue:t}),l.jsxs("div",{className:"mt-6",children:[l.jsxs("div",{className:e==="access"?"space-y-6":"hidden","data-tab":"access",children:[l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_disable_ecommerce",l.jsx(B,{title:"Disable All eCommerce Functionality",description:"Disable all eCommerce functionality on your site. Useful for sites that only have free downloads available.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_disable_ecommerce",l.jsx(X,{id:"somdn_pro_disable_ecommerce",label:"Disable All eCommerce Functionality",description:"Prevent any product, paid or otherwise, from being purchased. All cart/checkout functionality is removed. Free products still need to be free and set up correctly for free download to work.",disabled:!0}))]}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-4"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Login Requirements"}),l.jsx(X,{id:"somdn_require_login",label:"Only Show Button to Logged In Users",description:"Require users to be logged in to see the download button."}),l.jsx(bt,{id:"somdn_require_login_message",label:"Require Login Message",description:"Message to display on product pages if not logged in.",help:"<p><strong>Default:</strong> Only registered users can download this free product.</p>",placeholder:"Only registered users can download this free product.",rows:3,showIf:{somdn_require_login:!0}}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute -top-1 right-0 z-10",children:N("somdn_pro_badge_grouped_message",l.jsx(B,{title:"Grouped Product Login Message",description:"Customize the message shown on grouped product pages when users need to log in to download.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_grouped_message",l.jsx(bt,{id:"somdn_require_login_grouped_message",label:"Grouped Product Login Message",description:"Message to display on grouped product page if not logged in.",help:"<p><strong>Default:</strong> Only registered users can download the free product part of this group.</p>",placeholder:"Only registered users can download the free product part of this group.",rows:3,disabled:!0}))]}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-4"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Download Behavior"}),l.jsx(X,{id:"somdn_download_in_new_window",label:"Always Open Download Links in New Window",description:"Download links will open in a new browser tab/window."}),l.jsx(X,{id:"somdn_include_archive_items",label:"Allow Download on Shop/Archive Pages",description:"Replace the View/Read More button with a download button on shop and archive pages."}),l.jsx(X,{id:"somdn_hide_readmore_button_archive",label:"Hide View/Read More Button",description:"Hide the View/Read More button on shop pages if the user can't download the free product. For example, if site registration is required to purchase, but would be free otherwise.",showIf:{somdn_include_archive_items:!0}}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-4"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Product Selection"}),l.jsx(X,{id:"somdn_include_sale_items",label:"Include Paid Items on Sale for Free",description:"Include paid items that are currently on sale for free. Not recommended if you use the 'redirect' download method."}),l.jsx(X,{id:"somdn_indy_items",label:"Include Selected Products Only",description:"Only allow free downloads on products that have been individually selected. When enabled, a checkbox labeled 'Allow free download' will appear on each product's edit page. Check this box on the products you want to include for free downloads.",help:"<p><strong>How to select products:</strong></p><ol><li>Enable this setting by toggling it on</li><li>Go to <strong>Products</strong> → <strong>All Products</strong> in your WordPress admin</li><li>Edit each product you want to allow free downloads for</li><li>Look for the <strong>'Allow free download'</strong> checkbox in the product meta box</li><li>Check the box and save the product</li></ol><p><strong>Note:</strong> Only products with the checkbox checked will allow free downloads. All other products will not show the download button, even if they are free digital products.</p>"}),l.jsx(X,{id:"somdn_indy_exclude_items",label:"Exclude Selected Products Only",description:"Prevent free downloads on products that have been individually selected. When enabled, a checkbox labeled 'Disallow free download' will appear on each product's edit page. Check this box on the products you want to exclude from free downloads.",help:"<p><strong>How to exclude products:</strong></p><ol><li>Enable this setting by toggling it on</li><li>Go to <strong>Products</strong> → <strong>All Products</strong> in your WordPress admin</li><li>Edit each product you want to prevent free downloads for</li><li>Look for the <strong>'Disallow free download'</strong> checkbox in the product meta box</li><li>Check the box and save the product</li></ol><p><strong>Note:</strong> Products with the checkbox checked will NOT allow free downloads, even if they are free digital products. All other products will work normally.</p>"}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-4"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Security"}),l.jsx(X,{id:"somdn_disable_security_key_check",label:"Disable Checking Download Security Keys",description:"Not recommended. Disable checking security keys during downloads. This might help improve compatibility with cache plugins."})]}),l.jsxs("div",{className:e==="shop"?"space-y-6":"hidden","data-tab":"shop",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"When Downloads Are Enabled on Shop Pages"}),l.jsxs("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:["These settings apply when ",l.jsx(ct,{settingId:"somdn_include_archive_items",children:"Allow Download on Shop/Archive Pages"})," is enabled."]}),l.jsx(G,{id:"somdn_shop_download_logged_in_text",label:"Logged In Text",description:"Text to show on shop/archive pages if the user can download the file.",help:"<p><strong>Note:</strong> PDF Viewer text will still show for PDF files, if enabled.</p><p><strong>Default:</strong> Download</p>",placeholder:"Download"}),l.jsx(G,{id:"somdn_shop_download_logged_out_text",label:"Logged Out Text",description:"Text to show on shop/archive pages if the user is logged out but could download otherwise.",help:"<p><strong>Note:</strong> Only applies if the user only needs to log in to download.</p><p><strong>Default:</strong> View</p>",placeholder:"View"}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-4"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"When Downloads Are Disabled on Shop Pages"}),l.jsxs("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:["These settings apply when ",l.jsx(ct,{settingId:"somdn_include_archive_items",children:"Allow Download on Shop/Archive Pages"})," is disabled."]}),l.jsx(G,{id:"somdn_shop_disabled_logged_in_text",label:"Logged In Text",description:"Text to show on shop/archive pages if the user can download the file.",help:"<p><strong>Default:</strong> Download</p>",placeholder:"Download"}),l.jsx(G,{id:"somdn_shop_disabled_logged_out_text",label:"Logged Out Text",description:"Text to show on shop/archive pages if the user is logged out but could download otherwise.",help:"<p><strong>Default:</strong> View</p>",placeholder:"View"})]}),l.jsxs("div",{className:e==="display"?"space-y-6":"hidden","data-tab":"display",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Download Counts"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Show download statistics on product pages."}),l.jsx(ot,{id:"somdn_download_counts_output",label:"Display Position",description:"Choose where to display the download count on product pages.",options:[{label:"Don't show",value:0},{label:"Above download button",value:1},{label:"Below download button",value:2}]}),l.jsx(G,{id:"somdn_download_counts_output_text",label:"Download Count Text",description:"Customize the text. Use {count} to show the number.",help:"<p><strong>Default:</strong> (Downloads - {count})</p>",placeholder:"(Downloads - {count})",showIf:{somdn_download_counts_output:[1,2]}}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-4"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Product Sorting"}),l.jsx(X,{id:"somdn_enable_download_sorting",label:"Enable Sorting by Free Download Count",description:l.jsxs(l.Fragment,{children:['Adds "Sort by free downloads" option to the product sorting dropdown on shop pages. Only applies to products with ',l.jsx(ct,{settingId:"tracking",children:"download tracking"})," enabled."]})})]}),l.jsxs("div",{className:e==="styling"?"space-y-6":"hidden","data-tab":"styling",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Button Styling"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Add custom CSS classes and inline styles to download buttons."}),l.jsx(G,{id:"somdn_button_class",label:"Button Custom Classes",description:"Add custom classes to the download button, separated by spaces."}),l.jsx(G,{id:"somdn_button_css",label:"Button CSS",description:"Add inline CSS styles to the download button.",help:"<p>For theme styling the button uses the following CSS classes:</p><p><code>somdn-download-button</code></p>"}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-4"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Link Styling"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Add custom CSS classes and inline styles to download links."}),l.jsx(G,{id:"somdn_link_class",label:"Link Custom Classes",description:"Add custom classes to the download link, separated by spaces."}),l.jsx(G,{id:"somdn_link_css",label:"Link CSS",description:"Add inline CSS styles to the download link.",help:"<p>For theme styling the links use the following CSS class:</p><p><code>somdn-download-link</code></p>"})]})]})]})}const ju=[{fieldId:"somdn_pro_disable_ecommerce",label:"Disable All eCommerce Functionality",help:"Prevent any product from being purchased. All cart/checkout functionality is removed.",sectionKey:"general",pluginSlug:ye,keywords:["ecommerce","disable","cart","checkout","purchase","pro"]},{fieldId:"somdn_shop_download_logged_in_text",label:"Shop Button Text (Logged In)",help:"Text shown when the user can download the file on shop/archive pages.",sectionKey:"general",pluginSlug:ye,keywords:["shop","button","text","logged in","archive","download"]},{fieldId:"somdn_shop_download_logged_out_text",label:"Shop Button Text (Logged Out)",help:"Text shown when the user is logged out on shop/archive pages.",sectionKey:"general",pluginSlug:ye,keywords:["shop","button","text","logged out","archive","view"]},{fieldId:"somdn_shop_disabled_logged_in_text",label:"Disabled Shop Button Text (Logged In)",help:"Text shown when archive download is disabled and user is logged in.",sectionKey:"general",pluginSlug:ye,keywords:["shop","button","text","disabled","logged in"]},{fieldId:"somdn_shop_disabled_logged_out_text",label:"Disabled Shop Button Text (Logged Out)",help:"Text shown when archive download is disabled and user is logged out.",sectionKey:"general",pluginSlug:ye,keywords:["shop","button","text","disabled","logged out"]},{fieldId:"somdn_require_login",label:"Require Login",help:"Only show the download button to logged in users.",sectionKey:"general",pluginSlug:ye,keywords:["require","login","logged in","user","authentication"]},{fieldId:"somdn_require_login_message",label:"Require Login Message",help:"Message to display on product pages if the user is not logged in.",sectionKey:"general",pluginSlug:ye,keywords:["require","login","message","logged out"]},{fieldId:"somdn_require_login_grouped_message",label:"Grouped Product Login Message",help:"Message to display on grouped product page if not logged in.",sectionKey:"general",pluginSlug:ye,keywords:["require","login","message","grouped","product","pro"]},{fieldId:"somdn_download_in_new_window",label:"Open in New Window",help:"Always open download links in a new window.",sectionKey:"general",pluginSlug:ye,keywords:["new","window","tab","open","target","blank"]},{fieldId:"somdn_include_archive_items",label:"Allow Download on Shop/Archive Pages",help:"Allow downloads directly from shop/archive pages.",sectionKey:"general",pluginSlug:ye,keywords:["archive","shop","download","pages","allow"]},{fieldId:"somdn_hide_readmore_button_archive",label:"Hide Read More Button",help:"Hide the View/Read More button if user cannot download.",sectionKey:"general",pluginSlug:ye,keywords:["hide","read more","button","view","archive"]},{fieldId:"somdn_include_sale_items",label:"Include Sale Items",help:"Include paid items that are currently on sale for free.",sectionKey:"general",pluginSlug:ye,keywords:["sale","items","free","include","paid"]},{fieldId:"somdn_indy_items",label:"Include Selected Products Only",help:"Only include products that have been individually selected.",sectionKey:"general",pluginSlug:ye,keywords:["include","selected","products","individual"]},{fieldId:"somdn_indy_exclude_items",label:"Exclude Selected Products Only",help:"Exclude products that have been individually selected.",sectionKey:"general",pluginSlug:ye,keywords:["exclude","selected","products","individual"]},{fieldId:"somdn_disable_security_key_check",label:"Disable Security Key Check",help:"Disable checking download security keys.",sectionKey:"general",pluginSlug:ye,keywords:["security","key","check","disable","cache"]},{fieldId:"somdn_enable_download_sorting",label:"Enable Download Sorting",help:"Add sort by free downloads option to product sorting.",sectionKey:"general",pluginSlug:ye,keywords:["sort","sorting","downloads","order","products"]},{fieldId:"somdn_download_counts_output",label:"Download Count Display Position",help:"Choose where to display the download count on product pages.",sectionKey:"general",pluginSlug:ye,keywords:["download","count","display","position","above","below"]},{fieldId:"somdn_download_counts_output_text",label:"Download Count Text",help:"Customize the download count text.",sectionKey:"general",pluginSlug:ye,keywords:["download","count","text","customize"]},{fieldId:"somdn_button_class",label:"Button Custom Classes",help:"Add custom CSS classes to the download button.",sectionKey:"general",pluginSlug:ye,keywords:["button","class","css","style","custom"]},{fieldId:"somdn_button_css",label:"Button Inline CSS",help:"Add inline CSS styles to the download button.",sectionKey:"general",pluginSlug:ye,keywords:["button","css","style","inline","custom"]},{fieldId:"somdn_link_class",label:"Link Custom Classes",help:"Add custom CSS classes to the download link.",sectionKey:"general",pluginSlug:ye,keywords:["link","class","css","style","custom"]},{fieldId:"somdn_link_css",label:"Link Inline CSS",help:"Add inline CSS styles to the download link.",sectionKey:"general",pluginSlug:ye,keywords:["link","css","style","inline","custom"]}],z_=Object.freeze(Object.defineProperty({__proto__:null,GeneralSettings:ku,generalDefaults:vu,generalSettingsIndex:ju},Symbol.toStringTag,{value:"Module"}));function He({children:e,showIf:t,as:n="div"}){if(!ce(t))return null;if(n==="fragment")return l.jsx(l.Fragment,{children:e});const i=n;return l.jsx(i,{children:e})}function Ve({showIf:e}){return ce(e)?l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-8"}):null}const Mn="free-downloads-woocommerce",Nu={somdn_single_type:1,somdn_single_button_text:"",somdn_single_again_button_text:"",somdn_single_button_filename:!1,somdn_single_force_zip:!1,somdn_single_zip_rename:!1,somdn_single_zip_rename_attributes:!1};function Su(){return l.jsxs("section",{className:"space-y-6",id:"single-files",children:[l.jsx("h2",{className:"text-lg font-semibold dark:text-white",children:"Single File Settings"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Customize how products with a single file are handled."}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Display Options"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Configure how single file downloads appear on product pages."}),l.jsx(ot,{id:"somdn_single_type",label:"Download Type",description:"Choose how to display the download option on product pages.",options:[{label:"Button",value:1},{label:"Link",value:2}]}),l.jsx(G,{id:"somdn_single_button_text",label:"Button/Link Text",description:"Customize the text displayed on the download button or link.",help:"<p><strong>Default:</strong> Download Now</p>",placeholder:"Download Now"}),l.jsx(G,{id:"somdn_single_again_button_text",label:"Download Again Text",description:l.jsxs(l.Fragment,{children:["Text to show when a user has already downloaded the file (requires ",l.jsx(ct,{settingId:"tracking",children:"tracking"})," enabled)."]}),help:"<p>If you want the button to change text when someone has downloaded the product before, specify it here.</p><p><strong>Note:</strong> Make sure tracking is enabled for this to work.</p><p><strong>Default:</strong> Uses the normal button text if left blank.</p>",placeholder:""}),l.jsx(X,{id:"somdn_single_button_filename",label:"Show Filename Instead of Text",description:"Display the filename instead of the button/link text on product pages. This will override the Button Text option above."}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-8"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"ZIP Options"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Configure ZIP file creation for single file downloads."}),l.jsx(X,{id:"somdn_single_force_zip",label:"Force ZIP Creation",description:"Always create a ZIP file for downloads with single files, even when only one file is attached."}),l.jsx(X,{id:"somdn_single_zip_rename",label:"Rename File in ZIP to Product Name",description:"The file inside the ZIP will be renamed to match the product name.",showIf:{somdn_single_force_zip:!0}}),l.jsx(X,{id:"somdn_single_zip_rename_attributes",label:"Append Attributes to Renamed File",description:"When renaming the file in the ZIP, append the product attributes (e.g., variations) to the file name.",showIf:{somdn_single_force_zip:!0}})]})}const Cu=[{fieldId:"somdn_single_type",label:"Download Type (Single File)",help:"Choose how to display single file downloads - button or link.",sectionKey:"single-files",pluginSlug:Mn,keywords:["single","file","download","type","button","link"]},{fieldId:"somdn_single_button_text",label:"Single File Button Text",help:"Customize the text on the download button for single files.",sectionKey:"single-files",pluginSlug:Mn,keywords:["single","file","button","text","download now"]},{fieldId:"somdn_single_again_button_text",label:"Download Again Text",help:"Text shown when user has already downloaded the file.",sectionKey:"single-files",pluginSlug:Mn,keywords:["single","file","again","repeat","text","tracking"]},{fieldId:"somdn_single_button_filename",label:"Show Filename Instead",help:"Display the filename instead of button text.",sectionKey:"single-files",pluginSlug:Mn,keywords:["single","file","filename","display","text"]},{fieldId:"somdn_single_force_zip",label:"Force ZIP Creation",help:"Always create a ZIP for single file downloads.",sectionKey:"single-files",pluginSlug:Mn,keywords:["single","file","zip","force","create","archive"]},{fieldId:"somdn_single_zip_rename",label:"Rename File in ZIP",help:"Rename the file in ZIP to product name.",sectionKey:"single-files",pluginSlug:Mn,keywords:["single","file","zip","rename","product","name"]},{fieldId:"somdn_single_zip_rename_attributes",label:"Append Attributes to ZIP Filename",help:"Append product attributes to the renamed file in ZIP.",sectionKey:"single-files",pluginSlug:Mn,keywords:["single","file","zip","attributes","variations","append"]}],W_=Object.freeze(Object.defineProperty({__proto__:null,SingleFilesSettings:Su,singleFilesDefaults:Nu,singleFilesSettingsIndex:Cu},Symbol.toStringTag,{value:"Module"})),ds="free-downloads-woocommerce",Mu={somdn_display_type:"1",somdn_multi_button_text:"",somdn_available_downloads_text:"",somdn_checkbox_error_text:"",somdn_select_all:!1,somdn_show_numbers:!1};function Tu(){return l.jsxs("section",{className:"space-y-6",id:"multiple-files",children:[l.jsx("h2",{className:"text-lg font-semibold dark:text-white",children:"Multiple Files Settings"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Customise how products with multiple files are handled."}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:'Allowing the downloading of multiple files at once means those files will be zipped, which might be an issue for files hosted externally. If you use external files and have any errors, select "Links Only" for the display method. Otherwise, you can select any others.'}),l.jsx("div",{className:"rounded-md bg-amber-50 p-4 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800",children:l.jsxs("div",{className:"flex",children:[l.jsx("div",{className:"flex-shrink-0",children:l.jsx("svg",{className:"h-5 w-5 text-amber-400",viewBox:"0 0 20 20",fill:"currentColor",children:l.jsx("path",{fillRule:"evenodd",d:"M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})})}),l.jsxs("div",{className:"ml-3",children:[l.jsx("h3",{className:"text-sm font-medium text-amber-800 dark:text-amber-200",children:"ZipArchive Requirement"}),l.jsx("p",{className:"mt-1 text-sm text-amber-700 dark:text-amber-300",children:"Multiple file downloads require the PHP ZipArchive extension to be installed on your server. If zipping isn't working, please contact your host to ensure ZipArchive is enabled."})]})]})}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-8"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Display Options"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Configure how multiple file downloads appear on product pages."}),l.jsx(ot,{id:"somdn_display_type",label:"Display Type",description:"Choose how to display products with multiple downloadable files.",options:[{label:"Links Only (default)",value:"1"},{label:"Button Only (download all)",value:"2"},{label:"Button + Checkboxes",value:"3"},{label:"Button + Links",value:"4"},{label:"Button + Filenames",value:"5"}]}),l.jsx(G,{id:"somdn_multi_button_text",label:"Download Button Text",description:"Customize the text on the download all button.",help:"<p><strong>Default:</strong> Download All (.zip)</p>",placeholder:"Download All (.zip)",showIf:{somdn_display_type:["2","3","4","5"]}}),l.jsx(G,{id:"somdn_available_downloads_text",label:"Available Downloads Heading",description:"The heading text shown above the list of available downloads.",help:"<p><strong>Default:</strong> <em>Available Downloads:</em></p>",placeholder:"Available Downloads:",showIf:{somdn_display_type:["1","3","4","5"]}}),l.jsx(Ve,{showIf:{somdn_display_type:"3"}}),l.jsxs(He,{showIf:{somdn_display_type:"3"},as:"fragment",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Checkbox Options"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:'These options only apply when using the "Button + Checkboxes" display type.'})]}),l.jsx(G,{id:"somdn_checkbox_error_text",label:"Checkbox Error Text",description:"Error message shown when the user tries to download without selecting any files.",help:"<p><strong>Default:</strong> Please select at least 1 checkbox</p>",placeholder:"Please select at least 1 checkbox",showIf:{somdn_display_type:"3"}}),l.jsx(X,{id:"somdn_select_all",label:"Show Select All Checkbox",description:"Display a 'Select All' checkbox that allows users to quickly select all files at once.",showIf:{somdn_display_type:"3"}}),l.jsx(Ve,{showIf:{somdn_display_type:["1","4","5"]}}),l.jsx(He,{showIf:{somdn_display_type:["1","4","5"]},as:"fragment",children:l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Additional Options"})}),l.jsx(X,{id:"somdn_show_numbers",label:"Show Number Next to Filename",description:"Display a number prefix (1, 2, 3...) next to each filename in the download list.",help:"<p>Only used when links or filenames are shown.</p>",showIf:{somdn_display_type:["1","4","5"]}})]})}const Pu=[{fieldId:"somdn_display_type",label:"Multiple Files Display Type",help:"Choose how to display products with multiple downloadable files.",sectionKey:"multiple-files",pluginSlug:ds,keywords:["multiple","files","display","type","links","button","checkboxes"]},{fieldId:"somdn_multi_button_text",label:"Download Button Text",help:"Customize the text on the download all button.",sectionKey:"multiple-files",pluginSlug:ds,keywords:["multiple","files","button","text","download all","zip"]},{fieldId:"somdn_available_downloads_text",label:"Available Downloads Heading",help:"The heading text shown above the list of available downloads.",sectionKey:"multiple-files",pluginSlug:ds,keywords:["multiple","files","heading","available","downloads","text"]},{fieldId:"somdn_checkbox_error_text",label:"Checkbox Error Text",help:"Error message shown when no files are selected.",sectionKey:"multiple-files",pluginSlug:ds,keywords:["multiple","files","checkbox","error","validation","message"]},{fieldId:"somdn_select_all",label:"Show Select All Checkbox",help:"Display a Select All checkbox for quick selection.",sectionKey:"multiple-files",pluginSlug:ds,keywords:["multiple","files","select","all","checkbox"]},{fieldId:"somdn_show_numbers",label:"Show Number Next to Filename",help:"Display number prefix next to each filename.",sectionKey:"multiple-files",pluginSlug:ds,keywords:["multiple","files","number","filename","prefix","list"]}],B_=Object.freeze(Object.defineProperty({__proto__:null,MultipleFilesSettings:Tu,multipleFilesDefaults:Mu,multipleFilesSettingsIndex:Pu},Symbol.toStringTag,{value:"Module"})),_o="free-downloads-woocommerce",Eu={somdn_owned_enable:!1,somdn_owned_button_text:"",somdn_owned_badge_text:"",somdn_owned_badge_hide:!1};function Du(){return l.jsxs("section",{className:"space-y-6",id:"owned-products",children:[l.jsx("h2",{className:"text-lg font-semibold dark:text-white",children:"Owned Products"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Allow users to re-download products they have already purchased directly from the product page."}),l.jsx(X,{id:"somdn_owned_enable",label:"Enable Free Downloads for Owned Products",description:"Show a download button on product pages for paid products already owned by the user.",help:"<p><strong>Note:</strong> Products will be set to a 100% discount.</p><p><strong>Note:</strong> This function takes into account the user's ability to download the file from their account page.</p>"}),l.jsx(Ve,{showIf:{somdn_owned_enable:!0}}),l.jsxs(He,{showIf:{somdn_owned_enable:!0},as:"fragment",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Button & Badge Customization"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Customize the download button text and product badge for owned items."})]}),l.jsx(G,{id:"somdn_owned_button_text",label:"Download Button Text",description:"Customise the download button text for owned items. Also applies to multiple files and PDFs.",help:"<p><strong>Default:</strong> Download Again</p>",placeholder:"Download Again",showIf:{somdn_owned_enable:!0}}),l.jsx(G,{id:"somdn_owned_badge_text",label:"Owned Badge Text",description:"Customise the text in the product badge that appears on owned products.",help:"<p><strong>Default:</strong> OWNED!</p>",placeholder:"OWNED!",showIf:{somdn_owned_enable:!0}}),l.jsx(X,{id:"somdn_owned_badge_hide",label:"Hide the Badge",description:"Hide the owned badge from product pages.",showIf:{somdn_owned_enable:!0}})]})}const Ou=[{fieldId:"somdn_owned_enable",label:"Enable Free Downloads for Owned Products",help:"Enable free downloads on product pages for paid products already owned by the user.",sectionKey:"owned-products",pluginSlug:_o,keywords:["owned","purchased","products","enable","download","again","bought"]},{fieldId:"somdn_owned_button_text",label:"Owned Products Download Button Text",help:"Customise the download button text for owned items.",sectionKey:"owned-products",pluginSlug:_o,keywords:["owned","button","text","download","again","customize"]},{fieldId:"somdn_owned_badge_text",label:"Owned Badge Text",help:"Customise the text in the product badge for owned products.",sectionKey:"owned-products",pluginSlug:_o,keywords:["owned","badge","text","customize","label"]},{fieldId:"somdn_owned_badge_hide",label:"Hide Owned Badge",help:"Hide the owned badge from product pages.",sectionKey:"owned-products",pluginSlug:_o,keywords:["owned","badge","hide","remove","invisible"]}],H_=Object.freeze(Object.defineProperty({__proto__:null,OwnedProductsSettings:Du,ownedProductsDefaults:Eu,ownedProductsSettingsIndex:Ou},Symbol.toStringTag,{value:"Module"})),pa="free-downloads-woocommerce",Iu={somdn_docviewer_enable:!1,somdn_docviewer_single_display:"1",somdn_docviewer_single_link_text:""};function Lu(){return l.jsxs("section",{className:"space-y-6",id:"pdf-settings",children:[l.jsx("h2",{className:"text-lg font-semibold dark:text-white",children:"PDF Viewer"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Open a preview of PDF files attached to products instead of downloading directly. Users can print or download from the viewer."}),l.jsx(X,{id:"somdn_docviewer_enable",label:"Enable PDF Viewer",description:"Enable the PDF Viewer feature for PDF file downloads."}),l.jsx(Ve,{showIf:{somdn_docviewer_enable:!0}}),l.jsxs(He,{showIf:{somdn_docviewer_enable:!0},as:"fragment",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Display Options"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Configure how the PDF viewer link is displayed on product pages."})]}),l.jsx(ot,{id:"somdn_docviewer_single_display",label:"Display Type",description:"Choose how the PDF viewer link is displayed on single product pages.",options:[{label:"Button",value:"1"},{label:"Link",value:"2"}],showIf:{somdn_docviewer_enable:!0}}),l.jsx(G,{id:"somdn_docviewer_single_link_text",label:"Link/Button Text",description:"Customize the text for the PDF viewer link or button.",help:"<p><strong>Default:</strong> Download PDF</p>",placeholder:"Download PDF",showIf:{somdn_docviewer_enable:!0}})]})}const Au=[{fieldId:"somdn_docviewer_enable",label:"Enable PDF Viewer",help:"Enable the PDF Viewer feature for PDF file downloads.",sectionKey:"pdf-settings",pluginSlug:pa,keywords:["pdf","viewer","enable","document","preview","docviewer"]},{fieldId:"somdn_docviewer_single_display",label:"PDF Viewer Display Type",help:"Choose how the PDF viewer link is displayed (Button or Link).",sectionKey:"pdf-settings",pluginSlug:pa,keywords:["pdf","display","button","link","type","style"]},{fieldId:"somdn_docviewer_single_link_text",label:"PDF Viewer Link Text",help:"Customize the text for the PDF viewer link or button.",sectionKey:"pdf-settings",pluginSlug:pa,keywords:["pdf","text","link","button","customize","download"]}],V_=Object.freeze(Object.defineProperty({__proto__:null,PdfSettings:Lu,pdfDefaults:Iu,pdfSettingsIndex:Au},Symbol.toStringTag,{value:"Module"}));function yo(){return(yo=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e}).apply(this,arguments)}function Fu(e,t){if(e==null)return{};var n,s,i={},o=Object.keys(e);for(s=0;s<o.length;s++)t.indexOf(n=o[s])>=0||(i[n]=e[n]);return i}function ga(e){var t=g.useRef(e),n=g.useRef(function(s){t.current&&t.current(s)});return t.current=e,n.current}var cs=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e<t?t:e},ei=function(e){return"touches"in e},ba=function(e){return e&&e.ownerDocument.defaultView||self},zu=function(e,t,n){var s=e.getBoundingClientRect(),i=ei(t)?function(o,r){for(var a=0;a<o.length;a++)if(o[a].identifier===r)return o[a];return o[0]}(t.touches,n):t;return{left:cs((i.pageX-(s.left+ba(e).pageXOffset))/s.width),top:cs((i.pageY-(s.top+ba(e).pageYOffset))/s.height)}},Wu=function(e){!ei(e)&&e.preventDefault()},xa=g.memo(function(e){var t=e.onMove,n=e.onKey,s=Fu(e,["onMove","onKey"]),i=g.useRef(null),o=ga(t),r=ga(n),a=g.useRef(null),d=g.useRef(!1),c=g.useMemo(function(){var m=function(x){Wu(x),(ei(x)?x.touches.length>0:x.buttons>0)&&i.current?o(zu(i.current,x,a.current)):b(!1)},p=function(){return b(!1)};function b(x){var w=d.current,_=ba(i.current),y=x?_.addEventListener:_.removeEventListener;y(w?"touchmove":"mousemove",m),y(w?"touchend":"mouseup",p)}return[function(x){var w=x.nativeEvent,_=i.current;if(_&&(Wu(w),!function(v,j){return j&&!ei(v)}(w,d.current)&&_)){if(ei(w)){d.current=!0;var y=w.changedTouches||[];y.length&&(a.current=y[0].identifier)}_.focus(),o(zu(_,w,a.current)),b(!0)}},function(x){var w=x.which||x.keyCode;w<37||w>40||(x.preventDefault(),r({left:w===39?.05:w===37?-.05:0,top:w===40?.05:w===38?-.05:0}))},b]},[r,o]),u=c[0],h=c[1],f=c[2];return g.useEffect(function(){return f},[f]),g.createElement("div",yo({},s,{onTouchStart:u,onMouseDown:u,className:"react-colorful__interactive",ref:i,onKeyDown:h,tabIndex:0,role:"slider"}))}),vo=function(e){return e.filter(Boolean).join(" ")},wa=function(e){var t=e.color,n=e.left,s=e.top,i=s===void 0?.5:s,o=vo(["react-colorful__pointer",e.className]);return g.createElement("div",{className:o,style:{top:100*i+"%",left:100*n+"%"}},g.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},Ze=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},Bu=function(e){var t=e.s,n=e.v,s=e.a,i=(200-t)*n/100;return{h:Ze(e.h),s:Ze(i>0&&i<200?t*n/100/(i<=100?i:200-i)*100:0),l:Ze(i/2),a:Ze(s,2)}},_a=function(e){var t=Bu(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},ya=function(e){var t=Bu(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},R_=function(e){var t=e.h,n=e.s,s=e.v,i=e.a;t=t/360*6,n/=100,s/=100;var o=Math.floor(t),r=s*(1-n),a=s*(1-(t-o)*n),d=s*(1-(1-t+o)*n),c=o%6;return{r:Ze(255*[s,a,r,r,d,s][c]),g:Ze(255*[d,s,s,a,r,r][c]),b:Ze(255*[r,r,d,s,s,a][c]),a:Ze(i,2)}},$_=function(e){var t=e.r,n=e.g,s=e.b,i=e.a,o=Math.max(t,n,s),r=o-Math.min(t,n,s),a=r?o===t?(n-s)/r:o===n?2+(s-t)/r:4+(t-n)/r:0;return{h:Ze(60*(a<0?a+6:a)),s:Ze(o?r/o*100:0),v:Ze(o/255*100),a:i}},U_=g.memo(function(e){var t=e.hue,n=e.onChange,s=vo(["react-colorful__hue",e.className]);return g.createElement("div",{className:s},g.createElement(xa,{onMove:function(i){n({h:360*i.left})},onKey:function(i){n({h:cs(t+360*i.left,0,360)})},"aria-label":"Hue","aria-valuenow":Ze(t),"aria-valuemax":"360","aria-valuemin":"0"},g.createElement(wa,{className:"react-colorful__hue-pointer",left:t/360,color:_a({h:t,s:100,v:100,a:1})})))}),q_=g.memo(function(e){var t=e.hsva,n=e.onChange,s={backgroundColor:_a({h:t.h,s:100,v:100,a:1})};return g.createElement("div",{className:"react-colorful__saturation",style:s},g.createElement(xa,{onMove:function(i){n({s:100*i.left,v:100-100*i.top})},onKey:function(i){n({s:cs(t.s+100*i.left,0,100),v:cs(t.v-100*i.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+Ze(t.s)+"%, Brightness "+Ze(t.v)+"%"},g.createElement(wa,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:_a(t)})))}),Hu=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0};function Y_(e,t,n){var s=ga(n),i=g.useState(function(){return e.toHsva(t)}),o=i[0],r=i[1],a=g.useRef({color:t,hsva:o});g.useEffect(function(){if(!e.equal(t,a.current.color)){var c=e.toHsva(t);a.current={hsva:c,color:t},r(c)}},[t,e]),g.useEffect(function(){var c;Hu(o,a.current.hsva)||e.equal(c=e.fromHsva(o),a.current.color)||(a.current={hsva:o,color:c},s(c))},[o,e,s]);var d=g.useCallback(function(c){r(function(u){return Object.assign({},u,c)})},[]);return[o,d]}var K_=typeof window<"u"?g.useLayoutEffect:g.useEffect,G_=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},Vu=new Map,X_=function(e){K_(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!Vu.has(t)){var n=t.createElement("style");n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,Vu.set(t,n);var s=G_();s&&n.setAttribute("nonce",s),t.head.appendChild(n)}},[])},Q_=function(e){var t=e.className,n=e.hsva,s=e.onChange,i={backgroundImage:"linear-gradient(90deg, "+ya(Object.assign({},n,{a:0}))+", "+ya(Object.assign({},n,{a:1}))+")"},o=vo(["react-colorful__alpha",t]),r=Ze(100*n.a);return g.createElement("div",{className:o},g.createElement("div",{className:"react-colorful__alpha-gradient",style:i}),g.createElement(xa,{onMove:function(a){s({a:a.left})},onKey:function(a){s({a:cs(n.a+a.left)})},"aria-label":"Alpha","aria-valuetext":r+"%","aria-valuenow":r,"aria-valuemin":"0","aria-valuemax":"100"},g.createElement(wa,{className:"react-colorful__alpha-pointer",left:n.a,color:ya(n)})))},Z_=function(e){var t=e.className,n=e.colorModel,s=e.color,i=s===void 0?n.defaultColor:s,o=e.onChange,r=Fu(e,["className","colorModel","color","onChange"]),a=g.useRef(null);X_(a);var d=Y_(n,i,o),c=d[0],u=d[1],h=vo(["react-colorful",t]);return g.createElement("div",yo({},r,{ref:a,className:h}),g.createElement(q_,{hsva:c,onChange:u}),g.createElement(U_,{hue:c.h,onChange:u}),g.createElement(Q_,{hsva:c,onChange:u,className:"react-colorful__last-control"}))},J_={defaultColor:{r:0,g:0,b:0,a:1},toHsva:$_,fromHsva:R_,equal:Hu},ey=function(e){return g.createElement(Z_,yo({},e,{colorModel:J_}))};function ko({id:e,label:t,description:n,help:s,value:i,onChange:o,optional:r,showIf:a,resetOnHide:d,mountWhenHidden:c=!0,defaultColor:u={r:255,g:0,b:0,a:1},allowClear:h=!1,...f}){const{values:m,setValue:p}=Je(),b=ce(a),x=g.useRef(b),w=e?m==null?void 0:m[e]:void 0,_=i!==void 0,y=_?i:w,v=g.useMemo(()=>$u(y,u),[y,u]),[j,k]=g.useState(!1),[C,S]=g.useState(v);g.useEffect(()=>{ny(C,v)||S(v)},[v]),g.useEffect(()=>{if(x.current&&!b&&d!==void 0&&e){const L=d===!0?void 0:$u(d,u);p(e,L)}x.current=b},[b,d,e,p,u]);const T=g.useCallback(L=>{S(L),_?o==null||o(L):e&&p(e,L)},[e,_,o,p]);if(!c&&a&&!b)return null;const D=!b&&c,P=ka(C);return l.jsxs(sn,{hidden:a&&!b,"aria-hidden":a&&!b,...f,children:[l.jsxs("div",{className:"flex justify-between items-center mb-2",children:[t&&l.jsxs(on,{htmlFor:e,children:[t,l.jsx(an,{label:t,help:s})]}),l.jsxs("div",{className:"flex items-center gap-3",children:[r&&l.jsx("span",{id:`${e}-optional`,className:"text-sm/6 text-gray-500 dark:text-neutral-400",children:"Optional"}),h&&l.jsx("button",{type:"button",className:"text-xs px-2 py-1 rounded border border-gray-300 hover:bg-gray-50 dark:border-neutral-700 dark:hover:bg-neutral-800",onClick:()=>{_?o==null||o(void 0):e&&p(e,void 0)},disabled:D,children:"Clear"})]})]}),n&&l.jsx(rn,{children:n}),l.jsxs("button",{type:"button",className:"inline-flex items-center gap-2 mt-2",onClick:()=>k(!0),disabled:D,style:{outline:"none"},children:[l.jsx("span",{className:"inline-block w-8 h-8 rounded-full border border-gray-300 shadow dark:border-neutral-700",style:{background:P}}),l.jsx("span",{className:"text-sm dark:text-white",children:P})]}),l.jsxs(wo,{open:j,onClose:()=>k(!1),className:"relative z-50",children:[l.jsx("div",{className:"fixed inset-0 bg-black/30","aria-hidden":"true",onClick:()=>k(!1)}),l.jsx("div",{className:"fixed inset-0 flex items-center justify-center",children:l.jsxs(wo.Panel,{className:"bg-white dark:bg-neutral-900 rounded-lg p-6 shadow-xl max-w-xs w-full",children:[l.jsx(ey,{color:C,onChange:T}),l.jsxs("div",{className:"mt-4 flex items-center gap-2",children:[l.jsx("span",{className:"inline-block w-8 h-8 rounded-full border border-gray-300 dark:border-neutral-700",style:{background:ka(C)}}),l.jsx("span",{className:"text-sm dark:text-white",children:ka(C)})]}),l.jsxs("div",{className:"mt-4 grid grid-cols-2 gap-2",children:[h&&l.jsx("button",{className:"px-4 py-1.5 rounded border border-neutral-300 dark:border-neutral-700",onClick:()=>{_?o==null||o(void 0):e&&p(e,void 0),k(!1)},children:"Clear"}),l.jsx("button",{className:"col-span-2 px-4 py-1.5 rounded bg-indigo-600 text-white font-semibold text-sm w-full",onClick:()=>k(!1),children:"Done"})]})]})})]})]})}function xt(e,t,n){return Math.max(t,Math.min(n,e))}function Ru(e){return e&&typeof e=="object"}function ty(e){return`#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}`}function va(e){if(typeof e!="string")return null;const t=e.trim(),n=/^#([0-9a-fA-F]{3})$/.exec(t);if(n){const o=ty(n[0]);return va(o)}const s=/^#([0-9a-fA-F]{6})$/.exec(t);if(s){const o=s[1],r=parseInt(o.slice(0,2),16),a=parseInt(o.slice(2,4),16),d=parseInt(o.slice(4,6),16);return{r,g:a,b:d,a:1}}const i=/^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*(?:,\s*([\d.]+)\s*)?\)$/.exec(t);if(i){const o=xt(Number(i[1])||0,0,255),r=xt(Number(i[2])||0,0,255),a=xt(Number(i[3])||0,0,255),d=xt(i[4]!==void 0?Number(i[4]):1,0,1);return{r:o,g:r,b:a,a:d}}return null}function $u(e,t){if(Ru(e)&&"r"in e&&"g"in e&&"b"in e){const i=xt(Number(e.r)||0,0,255),o=xt(Number(e.g)||0,0,255),r=xt(Number(e.b)||0,0,255),a=xt(e.a!==void 0?Number(e.a):1,0,1);return{r:i,g:o,b:r,a}}const n=va(e);if(n)return n;const s=va(t)||(Ru(t)?t:{r:255,g:0,b:0,a:1});return{r:s.r,g:s.g,b:s.b,a:s.a??1}}function ka({r:e,g:t,b:n,a:s}){const i=s===void 0?1:s;return`rgba(${xt(e,0,255)}, ${xt(t,0,255)}, ${xt(n,0,255)}, ${Number(i).toFixed(2)})`}function ny(e,t){return!e||!t?e===t:e.r===t.r&&e.g===t.g&&e.b===t.b&&Number(e.a??1)===Number(t.a??1)}const ti="free-downloads-woocommerce",Uu={somdn_woo_quickview_enable:!1,somdn_woo_quickview_variations:!1,somdn_woo_quickview_button_text:"",somdn_woo_quickview_button_colour:"#2679ce",somdn_woo_quickview_button_text_colour:"#ffffff"};function qu(){return l.jsxs("section",{className:"space-y-6",id:"quick-view",children:[l.jsx("h2",{className:"text-lg font-semibold dark:text-white",children:"Quick View"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Display a modal popup with product details directly on shop pages."}),l.jsx(X,{id:"somdn_woo_quickview_enable",label:"Enable Quick View",description:"Enable the WooCommerce Quick View feature. When enabled, a Quick View button will appear on product archive pages."}),l.jsx(Ve,{showIf:{somdn_woo_quickview_enable:!0}}),l.jsxs(He,{showIf:{somdn_woo_quickview_enable:!0},as:"fragment",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Variable Products"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Configure how variable products are handled in Quick View."})]}),l.jsx(X,{id:"somdn_woo_quickview_variations",label:"Show Variation Options",description:"Display variation selection options directly in the Quick View modal. If disabled, users will see a 'Select Options' button that redirects to the product page.",showIf:{somdn_woo_quickview_enable:!0}}),l.jsx(Ve,{showIf:{somdn_woo_quickview_enable:!0}}),l.jsxs(He,{showIf:{somdn_woo_quickview_enable:!0},as:"fragment",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Button Settings"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Customize the appearance of the Quick View button."})]}),l.jsx(G,{id:"somdn_woo_quickview_button_text",label:"Button Text",description:"Customize the Quick View button text.",help:"<p><strong>Default:</strong> Quick View</p>",placeholder:"Quick View",showIf:{somdn_woo_quickview_enable:!0}}),l.jsx(ko,{id:"somdn_woo_quickview_button_colour",label:"Button Background Colour",description:"Set the background color for the Quick View button.",showIf:{somdn_woo_quickview_enable:!0}}),l.jsx(ko,{id:"somdn_woo_quickview_button_text_colour",label:"Button Text Colour",description:"Set the text color for the Quick View button.",showIf:{somdn_woo_quickview_enable:!0}})]})}const Yu=[{fieldId:"somdn_woo_quickview_enable",label:"Enable Quick View",help:"Enable the WooCommerce Quick View feature for product archive pages.",sectionKey:"quick-view",pluginSlug:ti,keywords:["quick","view","modal","popup","enable","woocommerce"]},{fieldId:"somdn_woo_quickview_variations",label:"Show Variation Options",help:"Display variation selection options in the Quick View modal.",sectionKey:"quick-view",pluginSlug:ti,keywords:["quick","view","variations","variable","products","options"]},{fieldId:"somdn_woo_quickview_button_text",label:"Quick View Button Text",help:"Customize the text displayed on the Quick View button.",sectionKey:"quick-view",pluginSlug:ti,keywords:["quick","view","button","text","customize","label"]},{fieldId:"somdn_woo_quickview_button_colour",label:"Quick View Button Background Colour",help:"Set the background color for the Quick View button.",sectionKey:"quick-view",pluginSlug:ti,keywords:["quick","view","button","color","background","style"]},{fieldId:"somdn_woo_quickview_button_text_colour",label:"Quick View Button Text Colour",help:"Set the text color for the Quick View button.",sectionKey:"quick-view",pluginSlug:ti,keywords:["quick","view","button","font","text","color","style"]}],sy=Object.freeze(Object.defineProperty({__proto__:null,QuickViewSettings:qu,quickViewDefaults:Uu,quickViewSettingsIndex:Yu},Symbol.toStringTag,{value:"Module"}));g.forwardRef(function(t,n){return l.jsx(Lw,{children:l.jsx("a",{...t,ref:n})})});function ja({className:e,...t}){return l.jsx("p",{"data-slot":"text",...t,className:ue(e,"text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400")})}const iy={xs:"sm:max-w-xs",sm:"sm:max-w-sm",md:"sm:max-w-md",lg:"sm:max-w-lg",xl:"sm:max-w-xl","2xl":"sm:max-w-2xl","3xl":"sm:max-w-3xl","4xl":"sm:max-w-4xl","5xl":"sm:max-w-5xl"};function oy({size:e="lg",className:t,children:n,...s}){return l.jsxs(wo,{...s,children:[l.jsx(_u,{transition:!0,className:"fixed inset-0 flex w-screen justify-center overflow-y-auto bg-neutral-950/25 px-2 py-2 transition duration-100 focus:outline-0 data-closed:opacity-0 data-enter:ease-out data-leave:ease-in sm:px-6 sm:py-8 lg:px-8 lg:py-16 dark:bg-neutral-950/50"}),l.jsx("div",{className:"fixed inset-0 w-screen overflow-y-auto pt-6 sm:pt-0",children:l.jsx("div",{className:"grid min-h-full grid-rows-[1fr_auto] justify-items-center sm:grid-rows-[1fr_auto_3fr] sm:p-4",children:l.jsx(ua,{transition:!0,className:ue(t,iy[e],"row-start-2 w-full min-w-0 rounded-t-3xl bg-white p-(--gutter) shadow-lg ring-1 ring-neutral-950/10 [--gutter:--spacing(8)] sm:mb-auto sm:rounded-2xl dark:bg-neutral-900 dark:ring-white/10 forced-colors:outline","transition duration-100 will-change-transform data-closed:translate-y-12 data-closed:opacity-0 data-enter:ease-out data-leave:ease-in sm:data-closed:translate-y-0 sm:data-closed:data-enter:scale-95"),children:n})})})]})}function ry({className:e,...t}){return l.jsx(ha,{...t,className:ue(e,"text-lg/6 font-semibold text-balance text-neutral-950 sm:text-base/6 dark:text-white")})}function ay({className:e,...t}){return l.jsx(Ji,{as:ja,...t,className:ue(e,"mt-2 text-pretty")})}function ly({className:e,...t}){return l.jsx("div",{...t,className:ue(e,"mt-6")})}const dy=typeof window<"u"&&((zp=window.diviEngineApiSettings)!=null&&zp.restUrl)?window.diviEngineApiSettings.restUrl.replace(/\/?$/,"/"):"/wp-json/",cy=typeof window<"u"&&((Wp=window.diviEngineApiSettings)==null?void 0:Wp.nonce)||"",Ku=()=>l.jsx("svg",{className:"h-5 w-5 text-green-500",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),Gu=()=>l.jsx("svg",{className:"h-5 w-5 text-red-500",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),Xu=()=>l.jsx("svg",{className:"h-5 w-5 text-amber-500",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"})}),Qu=()=>l.jsxs("svg",{className:"h-5 w-5 animate-spin text-blue-500",fill:"none",viewBox:"0 0 24 24",children:[l.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),l.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]});function uy({status:e}){return e==="pass"?l.jsx(Ku,{}):e==="fail"?l.jsx(Gu,{}):e==="warning"?l.jsx(Xu,{}):l.jsx(Qu,{})}function hy({check:e}){return l.jsxs("div",{className:"flex items-start gap-3 py-3 border-b border-neutral-200 dark:border-neutral-700 last:border-b-0",children:[l.jsx("div",{className:"flex-shrink-0 mt-0.5",children:l.jsx(uy,{status:e.status})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("p",{className:"text-sm font-medium text-neutral-900 dark:text-white",children:e.title}),l.jsx("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:e.message}),e.action&&l.jsxs("a",{href:e.action.href,className:"mt-1 inline-block text-sm text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",children:[e.action.label," →"]})]})]})}function fy(){var f;const[e,t]=g.useState(!1),[n,s]=g.useState(!1),[i,o]=g.useState(null),{values:r}=Je(),a=((f=window.somdn_settings)==null?void 0:f.is_pro)||!1,d=g.useCallback(()=>{const m=[];m.push({id:"woocommerce_active",title:"WooCommerce",status:"pass",message:"Checking if WooCommerce is active...",serverCheck:!0});const p=r.somdn_single_button_text||r.somdn_shop_download_logged_in_text||r.somdn_shop_download_logged_out_text;if(m.push({id:"button_text_set",title:"Download Button Text",status:p?"pass":"warning",message:p?"Download button text is configured.":"No custom button text set. Default text will be used."}),a){const b=r.somdn_download_type_option,x=r.somdn_download_type_redirect_page,w=r.somdn_download_type_email_page;if((b==="1"||b==="2")&&(x?m.push({id:"redirect_page_set",title:"Redirect Page",status:"pass",message:"Redirect page is configured."}):m.push({id:"redirect_page_missing",title:"Redirect Page Not Set",status:"fail",message:"You have enabled redirect delivery but no redirect page is selected. Please set a page with the [download_redirect] shortcode.",action:{label:"Configure Download Delivery",href:"#free-downloads-woocommerce/download-delivery"}})),b==="2"){w?m.push({id:"email_page_set",title:"Email Confirmation Page",status:"pass",message:"Email confirmation page is configured."}):m.push({id:"email_page_missing",title:"Email Confirmation Page Not Set",status:"fail",message:"You have enabled email link delivery but no confirmation page is selected.",action:{label:"Configure Download Delivery",href:"#free-downloads-woocommerce/download-delivery"}});const C=r.somdn_capture_email_enable,S=r.somdn_require_login;!C&&!S&&m.push({id:"email_delivery_requires_capture",title:"Email Capture Required",status:"warning",message:`Email link delivery is enabled but email capture is disabled. Guest users won't be able to receive download links. Enable "Require Login" or "Email Capture" in Tracking settings.`,action:{label:"Configure Tracking",href:"#free-downloads-woocommerce/tracking"}})}const _=r.somdn_capture_email_subscribe,y=r.somdn_newsletter_mailchimp_api_key,v=r.somdn_newsletter_mailchimp_list_id;_==="mailchimp"&&(y?m.push({id:"mailchimp_api_set",title:"MailChimp API Key",status:"pass",message:"MailChimp API key is configured.",serverCheck:!0}):m.push({id:"mailchimp_api_missing",title:"MailChimp API Key Missing",status:"fail",message:"Newsletter is set to MailChimp but no API key is configured.",action:{label:"Configure Newsletter",href:"#free-downloads-woocommerce/newsletter"}}),v?m.push({id:"mailchimp_list_set",title:"MailChimp List ID",status:"pass",message:"MailChimp list ID is configured."}):m.push({id:"mailchimp_list_missing",title:"MailChimp List ID Missing",status:"warning",message:"No MailChimp list/audience ID is set. Subscribers won't be added to any list.",action:{label:"Configure Newsletter",href:"#free-downloads-woocommerce/newsletter"}}));const j=r.somdn_limits_enable,k=r.somdn_pro_track_enable;j&&!k&&m.push({id:"limits_require_tracking",title:"Tracking Required for Limits",status:"warning",message:"Download limits are enabled but tracking is disabled. Tracking will be automatically enabled."})}return m},[r,a]),c=g.useCallback(async()=>{s(!0);let m=d();o(m);try{const p=await fetch(`${dy}wpe/v1/somdn-config-check`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":cy},body:JSON.stringify({settings:r})});if(!p.ok)throw new Error(`Server check failed: ${p.status}`);const b=await p.json();b&&b.checks&&(m=m.map(x=>{const w=b.checks.find(_=>_.id===x.id);return w?{...x,...w}:x}),b.checks.forEach(x=>{m.find(w=>w.id===x.id)||m.push(x)})),o(m)}catch{}finally{s(!1)}},[d,r]),u=g.useCallback(()=>{t(!0),o(null),c()},[c]),h=i?{pass:i.filter(m=>m.status==="pass").length,warning:i.filter(m=>m.status==="warning").length,fail:i.filter(m=>m.status==="fail").length}:null;return l.jsxs(l.Fragment,{children:[l.jsxs("button",{onClick:u,className:"inline-flex items-center gap-2 px-4 py-2 text-sm font-semibold text-white rounded-lg shadow-sm transition-colors",style:{backgroundColor:"rgb(79, 70, 228)"},children:[l.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Check Configuration"]}),l.jsx(oy,{open:e,onClose:()=>t(!1),size:"lg",children:l.jsxs("div",{className:"p-6",children:[l.jsx(ry,{children:"Configuration Check"}),l.jsx(ay,{children:"Validating your plugin settings to ensure everything is configured correctly."}),l.jsxs(ly,{className:"mt-6",children:[n&&!i&&l.jsxs("div",{className:"flex items-center justify-center py-8",children:[l.jsx(Qu,{}),l.jsx("span",{className:"ml-3 text-neutral-500 dark:text-neutral-400",children:"Running checks..."})]}),i&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex gap-4 mb-6 p-4 bg-neutral-50 dark:bg-neutral-800 rounded-lg",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Ku,{}),l.jsxs("span",{className:"text-sm font-medium text-neutral-700 dark:text-neutral-300",children:[h.pass," Passed"]})]}),h.warning>0&&l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Xu,{}),l.jsxs("span",{className:"text-sm font-medium text-neutral-700 dark:text-neutral-300",children:[h.warning," Warnings"]})]}),h.fail>0&&l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Gu,{}),l.jsxs("span",{className:"text-sm font-medium text-neutral-700 dark:text-neutral-300",children:[h.fail," Failed"]})]})]}),l.jsx("div",{className:"max-h-96 overflow-y-auto pr-2",children:i.sort((m,p)=>{const b={fail:0,warning:1,pass:2};return(b[m.status]??3)-(b[p.status]??3)}).map(m=>l.jsx(hy,{check:m},m.id))})]})]}),l.jsxs("div",{className:"mt-8 flex flex-col-reverse items-center justify-end gap-3 sm:flex-row",children:[l.jsx("button",{onClick:()=>t(!1),className:"w-full sm:w-auto px-4 py-2 text-sm font-medium text-neutral-700 dark:text-neutral-300 hover:bg-neutral-100 dark:hover:bg-neutral-800 rounded-lg transition-colors cursor-pointer",children:"Close"}),l.jsx("button",{onClick:c,disabled:n,className:"w-full sm:w-auto px-4 py-2 text-sm font-semibold text-white rounded-lg shadow-sm transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",style:{backgroundColor:"rgb(79, 70, 228)"},children:n?"Checking...":"Re-run Checks"})]})]})})]})}const my=typeof window<"u"&&((Bp=window.diviEngineApiSettings)!=null&&Bp.restUrl)?window.diviEngineApiSettings.restUrl.replace(/\/?$/,"/"):"/wp-json/",py=typeof window<"u"&&((Hp=window.diviEngineApiSettings)==null?void 0:Hp.nonce)||"";function gy({status:e}){const t={pass:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",fail:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400",warning:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400"},n={pass:"Pass",fail:"Fail",warning:"Warning"};return l.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded text-xs font-medium ${t[e]||t.warning}`,children:n[e]||e})}function by({name:e,tests:t,defaultOpen:n=!1}){const[s,i]=g.useState(n);if(!t||t.length===0)return null;const o=t.filter(d=>d.status==="pass").length,r=t.filter(d=>d.status==="fail").length,a=t.filter(d=>d.status==="warning").length;return l.jsxs("div",{className:"border border-neutral-200 dark:border-neutral-700 rounded-lg overflow-hidden",children:[l.jsxs("button",{type:"button",onClick:()=>i(!s),className:"w-full px-4 py-3 flex items-center justify-between bg-neutral-50 dark:bg-neutral-800/50 hover:bg-neutral-100 dark:hover:bg-neutral-800 transition-colors",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("svg",{className:`w-4 h-4 transform transition-transform ${s?"rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),l.jsxs("span",{className:"font-medium text-neutral-900 dark:text-white capitalize",children:[e.replace("_"," ")," Tests"]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[o>0&&l.jsxs("span",{className:"text-xs text-green-600 dark:text-green-400",children:[o," passed"]}),a>0&&l.jsxs("span",{className:"text-xs text-yellow-600 dark:text-yellow-400",children:[a," warnings"]}),r>0&&l.jsxs("span",{className:"text-xs text-red-600 dark:text-red-400",children:[r," failed"]})]})]}),s&&l.jsx("div",{className:"divide-y divide-neutral-200 dark:divide-neutral-700",children:t.map((d,c)=>l.jsxs("div",{className:"px-4 py-3 flex items-start justify-between gap-4",children:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"font-medium text-sm text-neutral-900 dark:text-white",children:d.name}),l.jsx("div",{className:"text-xs text-neutral-500 dark:text-neutral-400 mt-0.5",children:d.message})]}),l.jsx(gy,{status:d.status})]},d.id||c))})]})}function xy({summary:e}){if(!e)return null;const{total:t,passed:n,failed:s,warning:i}=e,o=s===0;return l.jsxs("div",{className:`p-4 rounded-lg border ${o?"bg-green-50 border-green-200 dark:bg-green-900/20 dark:border-green-800":"bg-red-50 border-red-200 dark:bg-red-900/20 dark:border-red-800"}`,children:[l.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[o?l.jsx("svg",{className:"w-6 h-6 text-green-600 dark:text-green-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}):l.jsx("svg",{className:"w-6 h-6 text-red-600 dark:text-red-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),l.jsx("span",{className:`font-semibold ${o?"text-green-800 dark:text-green-300":"text-red-800 dark:text-red-300"}`,children:o?"All Tests Passed":"Some Tests Failed"})]}),l.jsxs("div",{className:"grid grid-cols-4 gap-4 mt-3",children:[l.jsxs("div",{className:"text-center",children:[l.jsx("div",{className:"text-2xl font-bold text-neutral-900 dark:text-white",children:t}),l.jsx("div",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:"Total"})]}),l.jsxs("div",{className:"text-center",children:[l.jsx("div",{className:"text-2xl font-bold text-green-600 dark:text-green-400",children:n}),l.jsx("div",{className:"text-xs text-green-600 dark:text-green-400",children:"Passed"})]}),l.jsxs("div",{className:"text-center",children:[l.jsx("div",{className:"text-2xl font-bold text-yellow-600 dark:text-yellow-400",children:i}),l.jsx("div",{className:"text-xs text-yellow-600 dark:text-yellow-400",children:"Warnings"})]}),l.jsxs("div",{className:"text-center",children:[l.jsx("div",{className:"text-2xl font-bold text-red-600 dark:text-red-400",children:s}),l.jsx("div",{className:"text-xs text-red-600 dark:text-red-400",children:"Failed"})]})]})]})}function wy(){const[e,t]=g.useState(!1),[n,s]=g.useState(null),[i,o]=g.useState(null),r=g.useCallback(async(a="all")=>{t(!0),o(null);try{const d=await fetch(`${my}wpe/v1/somdn-integration-test`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":py},body:JSON.stringify({test_type:a})});if(!d.ok)throw new Error(`HTTP error: ${d.status}`);const c=await d.json();s(c)}catch(d){o(d.message||"Failed to run integration tests"),s(null)}finally{t(!1)}},[]);return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("button",{type:"button",onClick:()=>r("all"),disabled:e,className:"inline-flex items-center gap-2 px-4 py-2 bg-indigo-600 hover:bg-indigo-700 disabled:bg-indigo-400 text-white text-sm font-medium rounded-lg transition-colors",children:e?l.jsxs(l.Fragment,{children:[l.jsxs("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[l.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),l.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Running Tests..."]}):l.jsxs(l.Fragment,{children:[l.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})}),"Run Integration Tests"]})}),(n==null?void 0:n.is_pro)&&l.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded text-xs font-medium bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-400",children:"Pro Active"})]}),i&&l.jsxs("div",{className:"p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg",children:[l.jsxs("div",{className:"flex items-center gap-2 text-red-800 dark:text-red-300",children:[l.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),l.jsx("span",{className:"font-medium",children:"Error running tests"})]}),l.jsx("p",{className:"mt-1 text-sm text-red-700 dark:text-red-400",children:i})]}),n&&l.jsxs("div",{className:"space-y-4",children:[l.jsx(xy,{summary:n.summary}),l.jsx("div",{className:"space-y-3",children:Object.entries(n.results).map(([a,d])=>l.jsx(by,{name:a,tests:d,defaultOpen:a==="loading"||d.some(c=>c.status==="fail")},a))}),l.jsx("div",{className:"text-xs text-neutral-500 dark:text-neutral-400 pt-2",children:"Tests verify: option name mappings, save/retrieve operations, edge cases (special chars, long text, toggles), and compatibility with existing settings."})]}),!n&&!i&&!e&&l.jsx("div",{className:"p-4 bg-neutral-50 dark:bg-neutral-800/50 rounded-lg border border-neutral-200 dark:border-neutral-700",children:l.jsx("p",{className:"text-sm text-neutral-600 dark:text-neutral-400",children:'Click "Run Integration Tests" to verify the settings framework is working correctly. This tests option name mappings, save/retrieve operations, edge cases, and compatibility.'})})]})}const Na=typeof window<"u"&&((Vp=window.diviEngineApiSettings)!=null&&Vp.restUrl)?window.diviEngineApiSettings.restUrl.replace(/\/?$/,"/"):"/wp-json/",Sa=typeof window<"u"&&((Rp=window.diviEngineApiSettings)==null?void 0:Rp.nonce)||"",_y=()=>{var t;return(typeof window<"u"&&((t=window.diviEngineSettingsObject)==null?void 0:t.organization)||"divi-engine")==="wp-enhanced"?"wpe/v1":"de/v1"};function yy({logPath:e,title:t="Error Logs",description:n="Notable errors and warnings are stored on the server and displayed here for convenience.",emptyMessage:s="No errors logged yet.",restNamespace:i=null}){const[o,r]=g.useState(""),[a,d]=g.useState(!0),[c,u]=g.useState(null),[h,f]=g.useState(!1),[m,p]=g.useState(!1),[b,x]=g.useState(!1),[w,_]=g.useState(!1),y=i||_y(),v=g.useCallback(async()=>{d(!0),u(null);try{const P=await fetch(`${Na}${y}/error-logs?log_path=${encodeURIComponent(e)}`,{credentials:"same-origin",headers:{"X-WP-Nonce":Sa}});if(!P.ok)throw new Error(`Failed to fetch logs: ${P.status}`);const L=await P.json();r(L.content||""),f(L.exists)}catch(P){u(P.message||"Failed to fetch logs")}finally{d(!1)}},[e,y]);g.useEffect(()=>{v()},[v]);const j=async()=>{try{await navigator.clipboard.writeText(o),p(!0),setTimeout(()=>p(!1),2e3)}catch{}},k=()=>{const P=new Blob([o],{type:"text/plain"}),L=URL.createObjectURL(P),W=document.createElement("a");W.href=L,W.download=`error-logs-${new Date().toISOString().split("T")[0]}.txt`,document.body.appendChild(W),W.click(),document.body.removeChild(W),URL.revokeObjectURL(L)},C=async()=>{if(confirm("Are you sure you want to delete the error logs? This cannot be undone.")){x(!0);try{const P=await fetch(`${Na}${y}/error-logs?log_path=${encodeURIComponent(e)}`,{method:"DELETE",credentials:"same-origin",headers:{"X-WP-Nonce":Sa}});if(!P.ok)throw new Error(`Failed to delete logs: ${P.status}`);r(""),f(!1)}catch(P){u(P.message||"Failed to delete logs")}finally{x(!1)}}},S=async()=>{_(!0);try{const P=await fetch(`${Na}${y}/error-logs/test?log_path=${encodeURIComponent(e)}`,{method:"POST",credentials:"same-origin",headers:{"X-WP-Nonce":Sa,"Content-Type":"application/json"},body:JSON.stringify({message:"Test log entry from settings page"})});if(!P.ok)throw new Error(`Failed to write test log: ${P.status}`);await v()}catch(P){u(P.message||"Failed to write test log")}finally{_(!1)}};if(a)return l.jsxs("div",{className:"space-y-4",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:t}),l.jsx("div",{className:"animate-pulse rounded-md bg-gray-200/70 dark:bg-neutral-800/70 h-48"})]});if(c)return l.jsxs("div",{className:"space-y-4",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:t}),l.jsx("div",{className:"rounded-md bg-red-50 p-4 dark:bg-red-900/20",children:l.jsxs("p",{className:"text-sm text-red-700 dark:text-red-300",children:["Error: ",c]})})]});const T=h?o:s,D=h&&o.trim().length>0;return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:t}),l.jsx("p",{className:"text-sm text-neutral-500 dark:text-neutral-400 mt-1",children:n})]}),l.jsx("div",{className:"relative",children:l.jsx("pre",{className:"bg-neutral-100 dark:bg-neutral-800 rounded-lg p-4 text-sm font-mono text-neutral-700 dark:text-neutral-300 overflow-auto max-h-96 whitespace-pre-wrap break-words border border-neutral-200 dark:border-neutral-700",children:T})}),l.jsxs("div",{className:"flex flex-wrap gap-2",children:[l.jsx("button",{type:"button",onClick:j,disabled:!D,className:"inline-flex items-center gap-1.5 rounded-md bg-white dark:bg-neutral-800 px-3 py-2 text-sm font-medium text-neutral-700 dark:text-neutral-300 shadow-sm ring-1 ring-inset ring-neutral-300 dark:ring-neutral-600 hover:bg-neutral-50 dark:hover:bg-neutral-700 disabled:opacity-50 disabled:cursor-not-allowed",children:m?l.jsxs(l.Fragment,{children:[l.jsx("svg",{className:"h-4 w-4 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Copied!"]}):l.jsxs(l.Fragment,{children:[l.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),"Copy"]})}),l.jsxs("button",{type:"button",onClick:k,disabled:!D,className:"inline-flex items-center gap-1.5 rounded-md bg-white dark:bg-neutral-800 px-3 py-2 text-sm font-medium text-neutral-700 dark:text-neutral-300 shadow-sm ring-1 ring-inset ring-neutral-300 dark:ring-neutral-600 hover:bg-neutral-50 dark:hover:bg-neutral-700 disabled:opacity-50 disabled:cursor-not-allowed",children:[l.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"Export"]}),l.jsxs("button",{type:"button",onClick:C,disabled:!D||b,className:"inline-flex items-center gap-1.5 rounded-md bg-white dark:bg-neutral-800 px-3 py-2 text-sm font-medium text-red-600 dark:text-red-400 shadow-sm ring-1 ring-inset ring-neutral-300 dark:ring-neutral-600 hover:bg-red-50 dark:hover:bg-red-900/20 disabled:opacity-50 disabled:cursor-not-allowed",children:[l.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),b?"Deleting...":"Delete"]}),l.jsxs("button",{type:"button",onClick:v,className:"inline-flex items-center gap-1.5 rounded-md bg-white dark:bg-neutral-800 px-3 py-2 text-sm font-medium text-neutral-700 dark:text-neutral-300 shadow-sm ring-1 ring-inset ring-neutral-300 dark:ring-neutral-600 hover:bg-neutral-50 dark:hover:bg-neutral-700",children:[l.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),l.jsxs("button",{type:"button",onClick:S,disabled:w,className:"inline-flex items-center gap-1.5 rounded-md bg-white dark:bg-neutral-800 px-3 py-2 text-sm font-medium text-blue-600 dark:text-blue-400 shadow-sm ring-1 ring-inset ring-neutral-300 dark:ring-neutral-600 hover:bg-blue-50 dark:hover:bg-blue-900/20 disabled:opacity-50 disabled:cursor-not-allowed",children:[l.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})}),w?"Writing...":"Write Test Log"]})]})]})}const jo="free-downloads-woocommerce",Zu={somdn_debug_logging_enable:!1};function Ju(){return l.jsxs("section",{className:"space-y-6",id:"debug",children:[l.jsx("h2",{className:"text-lg font-semibold dark:text-white",children:"Debug Settings"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Settings related to plugin debugging and troubleshooting."}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Configuration Checker"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Validate your plugin configuration to ensure everything is set up correctly."}),l.jsx("div",{className:"flex items-start gap-4 p-4 bg-neutral-50 dark:bg-neutral-800/50 rounded-lg border border-neutral-200 dark:border-neutral-700",children:l.jsxs("div",{className:"flex-1",children:[l.jsx("p",{className:"text-sm text-neutral-600 dark:text-neutral-400 mb-3",children:"Run a configuration check to verify your settings, WooCommerce compatibility, and ensure all required options are properly configured."}),l.jsx(fy,{})]})}),l.jsx("h3",{className:"text-base font-medium dark:text-white mt-8",children:"Integration Tests"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Run comprehensive tests to verify the settings framework is functioning correctly."}),l.jsx("div",{className:"p-4 bg-neutral-50 dark:bg-neutral-800/50 rounded-lg border border-neutral-200 dark:border-neutral-700",children:l.jsx(wy,{})}),l.jsx("h3",{className:"text-base font-medium dark:text-white mt-8",children:"Error Logging"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Enable debug logging to help troubleshoot issues with the plugin."}),l.jsx(X,{id:"somdn_debug_logging_enable",label:"Enable Debug Logging",description:"Show debug messages in error logs. Enable this when troubleshooting issues with the plugin. It's recommended to disable this in production environments."}),l.jsx("div",{className:"mt-8",children:l.jsx(yy,{logPath:"free-downloads-files/free_downloads_log.txt",title:"Free Download Error Logs",description:"Notable free download errors and warnings are stored on the server and displayed here for convenience."})})]})}const eh=[{fieldId:"somdn_debug_logging_enable",label:"Enable Debug Logging",help:"Show debug messages in error logs for troubleshooting.",sectionKey:"debug",pluginSlug:jo,keywords:["debug","logging","logs","error","troubleshoot","enable"]},{fieldId:"configuration_checker",label:"Configuration Checker",help:"Validate your plugin settings and check for issues.",sectionKey:"debug",pluginSlug:jo,keywords:["check","validate","configuration","settings","test","verify","diagnostic"]},{fieldId:"integration_tester",label:"Integration Tests",help:"Run comprehensive tests to verify the settings framework is functioning correctly.",sectionKey:"debug",pluginSlug:jo,keywords:["integration","test","verify","save","load","compatibility","migration"]},{fieldId:"error_logs_viewer",label:"Error Logs Viewer",help:"View, copy, export, and delete error logs from the server.",sectionKey:"debug",pluginSlug:jo,keywords:["error","logs","viewer","copy","export","delete","troubleshoot","debug"]}],vy=Object.freeze(Object.defineProperty({__proto__:null,DebugSettings:Ju,debugDefaults:Zu,debugSettingsIndex:eh},Symbol.toStringTag,{value:"Module"}));function th({options:e,displayValue:t,filter:n,anchor:s="bottom",className:i,placeholder:o,autoFocus:r,"aria-label":a,children:d,...c}){const[u,h]=g.useState(""),f=u===""?e:e.filter(m=>{var p;return n?n(m,u):(p=t(m))==null?void 0:p.toLowerCase().includes(u.toLowerCase())});return l.jsxs(Dw,{...c,multiple:!1,virtual:{options:f},onClose:()=>h(""),children:[l.jsxs("span",{"data-slot":"control",className:ue([i,"relative block w-full max-w-lg","before:absolute before:inset-px before:rounded-[calc(var(--radius-lg)-1px)] before:bg-white before:shadow-sm","dark:before:hidden","after:pointer-events-none after:absolute after:inset-0 after:rounded-lg after:ring-transparent after:ring-inset sm:focus-within:after:ring-2 sm:focus-within:after:ring-blue-500","has-data-disabled:opacity-50 has-data-disabled:before:bg-neutral-950/5 has-data-disabled:before:shadow-none","has-data-invalid:before:shadow-red-500/10"]),children:[l.jsx(ru,{autoFocus:r,"data-slot":"control","aria-label":a,displayValue:m=>t(m)??"",onChange:m=>h(m.target.value),placeholder:o,className:ue([i,"relative block w-full max-w-lg appearance-none rounded-lg py-[calc(--spacing(2.5)-1px)] sm:py-[calc(--spacing(1.5)-1px)]","pr-[calc(--spacing(10)-1px)] pl-[calc(--spacing(3.5)-1px)] sm:pr-[calc(--spacing(9)-1px)] sm:pl-[calc(--spacing(3)-1px)]","text-base/6 text-neutral-950 placeholder:text-neutral-500 sm:text-sm/6 dark:text-white","border border-neutral-950/10 data-hover:border-neutral-950/20 dark:border-white/10 dark:data-hover:border-white/20","bg-transparent dark:bg-white/5","focus:outline-hidden","data-invalid:border-red-500 data-invalid:data-hover:border-red-500 dark:data-invalid:border-red-500 dark:data-invalid:data-hover:border-red-500","data-disabled:border-neutral-950/20 dark:data-disabled:border-white/15 dark:data-disabled:bg-white/2.5 dark:data-hover:data-disabled:border-white/15","dark:scheme-dark"])}),l.jsx(ou,{className:"group absolute inset-y-0 right-0 flex items-center px-2",children:l.jsxs("svg",{className:"size-5 stroke-neutral-500 group-data-disabled:stroke-neutral-600 group-data-hover:stroke-neutral-700 sm:size-4 dark:stroke-neutral-400 dark:group-data-hover:stroke-neutral-300 forced-colors:stroke-[CanvasText]",viewBox:"0 0 16 16","aria-hidden":"true",fill:"none",children:[l.jsx("path",{d:"M5.75 10.75L8 13L10.25 10.75",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M10.25 5.25L8 3L5.75 5.25",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]})})]}),l.jsx(au,{transition:!0,anchor:s,className:ue("[--anchor-gap:--spacing(2)] [--anchor-padding:--spacing(4)] sm:data-[anchor~=start]:[--anchor-offset:-4px]","isolate min-w-[calc(var(--input-width)+8px)] scroll-py-1 rounded-xl p-1 select-none empty:invisible","outline outline-transparent focus:outline-hidden","overflow-y-scroll overscroll-contain","bg-white/75 backdrop-blur-xl dark:bg-neutral-800/75","shadow-lg ring-1 ring-neutral-950/10 dark:ring-white/10 dark:ring-inset","transition-opacity duration-100 ease-in data-closed:data-leave:opacity-0 data-transition:pointer-events-none"),children:({option:m})=>d(m)})]})}function nh({children:e,className:t,...n}){let s=ue("flex min-w-0 items-center","*:data-[slot=icon]:size-5 *:data-[slot=icon]:shrink-0 sm:*:data-[slot=icon]:size-4","*:data-[slot=icon]:text-neutral-500 group-data-focus/option:*:data-[slot=icon]:text-white dark:*:data-[slot=icon]:text-neutral-400","forced-colors:*:data-[slot=icon]:text-[CanvasText] forced-colors:group-data-focus/option:*:data-[slot=icon]:text-[Canvas]","*:data-[slot=avatar]:-mx-0.5 *:data-[slot=avatar]:size-6 sm:*:data-[slot=avatar]:size-5");return l.jsxs(lu,{...n,className:ue("group/option grid w-full cursor-default grid-cols-[1fr_--spacing(5)] items-baseline gap-x-2 rounded-lg py-2.5 pr-2 pl-3.5 sm:grid-cols-[1fr_--spacing(4)] sm:py-1.5 sm:pr-2 sm:pl-3","text-base/6 text-neutral-950 sm:text-sm/6 dark:text-white forced-colors:text-[CanvasText]","outline-hidden data-focus:bg-blue-500 data-focus:text-white","forced-color-adjust-none forced-colors:data-focus:bg-[Highlight] forced-colors:data-focus:text-[HighlightText]","data-disabled:opacity-50"),children:[l.jsx("span",{className:ue(t,s),children:e}),l.jsx("svg",{className:"relative col-start-2 hidden size-5 self-center stroke-current group-data-selected/option:inline sm:size-4",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:l.jsx("path",{d:"M4 8.5l3 3L12 4",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})]})}function sh({className:e,...t}){return l.jsx("span",{...t,className:ue(e,"ml-2.5 truncate first:ml-0 sm:ml-2 sm:first:ml-0")})}const ky=100,ih=new Map;function Ca({id:e,label:t,description:n,taxonomy:s,terms:i,value:o,onChange:r,help:a,showIf:d,resetOnHide:c,mountWhenHidden:u=!0,className:h,...f}){const{values:m,setValue:p}=Je(),b=ce(d),x=g.useRef(b),w=!!e,_=w?m==null?void 0:m[e]:void 0,y=o!==void 0,v=y?o:_,[j,k]=g.useState([]),[C,S]=g.useState(!1),[T,D]=g.useState(null),P=g.useMemo(()=>Array.isArray(i)?i:j,[i,j]),L=e||`${s||"taxonomy"}-select`,W=()=>typeof window>"u"?"":window.location.origin+window.location.pathname.replace(/\/wp-admin.*/,"");g.useEffect(()=>{let M=new AbortController;async function E(){if(Array.isArray(i)){k(i);return}if(!s)return;D(null);const V=ih.get(s);if(V){k(V);return}S(!0);try{const z=W(),A=s==="category"?"categories":encodeURIComponent(s),U=`${z}/wp-json/wp/v2/${A}?per_page=${ky}&hide_empty=false`;let J=[],ne=1,Q=1;for(;;){const ee=`${U}&page=${ne}`,Oe=await fetch(ee,{signal:M.signal});if(!Oe.ok)throw new Error(`Failed to fetch taxonomy terms from ${ee}`);const Pe=parseInt(Oe.headers.get("X-WP-TotalPages")||"1",10);Q=Number.isFinite(Pe)?Pe:1;const QC=await Oe.json();if(J=J.concat(QC),ne>=Q)break;ne+=1}const R=new Set,Y=[];for(const ee of J)R.has(ee.id)||(R.add(ee.id),Y.push(ee));Y.sort((ee,Oe)=>((ee==null?void 0:ee.name)||"").localeCompare((Oe==null?void 0:Oe.name)||"",void 0,{sensitivity:"base"})),ih.set(s,Y),k(Y)}catch(z){z.name!=="AbortError"&&(D(z.message||"Failed to load terms"),k([]))}finally{S(!1)}}return E(),()=>M.abort()},[s,i]);const $=g.useMemo(()=>v&&P.find(M=>{var E,V;return(M==null?void 0:M.id)===v||(M==null?void 0:M.slug)===v||((E=M==null?void 0:M.id)==null?void 0:E.toString())===String(v)||((V=M==null?void 0:M.slug)==null?void 0:V.toString())===String(v)})||null,[P,v]),O=g.useMemo(()=>!$||!s?null:`${W()}/wp-admin/term.php?taxonomy=${encodeURIComponent(s)}&tag_ID=${$.id}`,[$,s]);if(g.useEffect(()=>{if(x.current&&!b&&c!==void 0){const M=c===!0?void 0:c;w?p(e,M):y||r==null||r(M)}x.current=b},[b,c,w,e,p,y,r]),!u&&d&&!b)return null;const F=!b&&u,H=M=>{!y&&w&&p(e,M),r==null||r(M)};return l.jsxs(sn,{hidden:d&&!b,"aria-hidden":d&&!b,className:h,...f,children:[l.jsx("div",{className:"flex items-center gap-2 mb-2",children:t&&l.jsxs(on,{htmlFor:L,children:[t,l.jsx(an,{label:t,help:a})]})}),n&&l.jsx(rn,{children:n}),l.jsxs("div",{className:"flex gap-2 items-center",children:[l.jsx("div",{className:"flex-1",children:l.jsx(th,{as:"div",id:L,name:s,options:P,displayValue:M=>(M==null?void 0:M.name)||"",value:$,onChange:M=>H((M==null?void 0:M.id)??(M==null?void 0:M.slug)??""),placeholder:C?"Loading…":"Search…",disabled:F||C||P.length===0,children:M=>l.jsx(nh,{value:M,children:l.jsx(sh,{children:(M==null?void 0:M.name)||"(no name)"})},M.id||M.slug)})}),$&&O&&l.jsx("a",{href:O,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center px-3 py-1.5 rounded bg-neutral-200 text-neutral-900 text-xs font-semibold hover:bg-indigo-600 hover:text-white transition dark:bg-neutral-800 dark:text-white dark:hover:bg-indigo-700",title:"Edit term",style:{whiteSpace:"nowrap"},children:"Edit"})]}),C&&l.jsx("div",{className:"text-xs text-gray-500 mt-2",children:"Loading…"}),T&&l.jsx("div",{className:"text-xs text-red-500 mt-2",children:T}),!C&&!T&&l.jsxs("div",{className:"text-xs text-gray-400 mt-2",children:[P.length," terms loaded."]})]})}const Re="free-downloads-woocommerce",jy=()=>{var e;return((e=window.somdn_settings)==null?void 0:e.is_pro)||!1},Ny=()=>{var e;return((e=window.somdn_settings)==null?void 0:e.has_memberships)||!1},oh={somdn_pro_basic_limit_enable:!1,somdn_pro_basic_limit_type:"0",somdn_pro_basic_login_req:"login-required",somdn_pro_basic_limit_freq:"",somdn_pro_basic_limit_amount:"",somdn_pro_basic_limit_products:"",somdn_pro_basic_limit_product_name:"",somdn_pro_exclude_months:"",somdn_pro_exclude_cat_list:[],somdn_pro_basic_limit_error:"",somdn_pro_limit_acc_page:!1,somdn_pro_limit_acc_page_title_enable:!1,somdn_pro_limit_acc_page_title:"",somdn_pro_limit_acc_page_message:""},rh={somdn_pro_limit_member_exclude:!1,somdn_pro_limit_refresh_on_subscribe_date:!1};function ah(){const e=jy(),t=Ny(),n=ce({somdn_pro_basic_limit_enable:!0}),s=ce({somdn_pro_basic_limit_enable:!0,somdn_pro_limit_acc_page:!0});return l.jsxs("section",{className:"space-y-6",id:"download-limits",children:[l.jsx("h2",{className:"text-lg font-semibold dark:text-white",children:"Download Limits"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Limit the number of times users can download free products. Track downloads by user or IP address."}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_limit_enable",l.jsx(B,{title:"Download Limitations",description:"Limit the number of times users can download free products. Track downloads by User ID or IP Address.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_limit_enable",l.jsx(X,{id:"somdn_pro_basic_limit_enable",label:"Enable Download Limitations",description:"When enabled, you can customize download limits for your site.",disabled:!e}))]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_limit_type",l.jsx(B,{title:"Limit Downloads By",description:"Choose how to track download limits - by User ID (requires login) or IP Address.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_limit_type",l.jsx(ot,{id:"somdn_pro_basic_limit_type",label:"Limit Downloads By",description:l.jsxs(l.Fragment,{children:["Limiting by User ID only works if ",l.jsx(ct,{settingId:"somdn_require_login",children:"Only Show Button to Logged In Users"})," is enabled."]}),help:"<p>Any limits selected will mean downloads will be tracked in the database.</p><p>If no option selected, no limits apply.</p>",options:[{label:"Please choose...",value:"0"},{label:"User ID",value:"1"},{label:"IP Address",value:"2"}],disabled:!e}))]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_login_req",l.jsx(B,{title:"Login Required",description:"Configure whether users must be logged in for download limits to apply.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_login_req",l.jsx(ot,{id:"somdn_pro_basic_login_req",label:"Login Required",description:"For download limits to work by user ID, you need to require login. Choose 'Not Required' if you have memberships with paid downloads but also free downloads for guests.",options:[{label:"Login Required for all",value:"login-required"},{label:"Not Required (useful with the mix of memberships and free downloads)",value:"not-required"}],disabled:!e}))]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_limit_freq",l.jsx(B,{title:"Download Limit Period",description:"Set the time period for download limits (daily, weekly, monthly, or yearly).",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_limit_freq",l.jsx(ot,{id:"somdn_pro_basic_limit_freq",label:"Download Limit Period",description:"Set download limits for each day/week/month/year. If no option selected, no limits apply.",options:[{label:"Please choose...",value:""},{label:"Day",value:"1"},{label:"Week",value:"2"},{label:"Month",value:"3"},{label:"Year",value:"4"}],disabled:!e}))]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_limit_amount",l.jsx(B,{title:"Number of Downloads",description:"Limit the number of times a download can be requested.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_limit_amount",l.jsx(G,{id:"somdn_pro_basic_limit_amount",label:"Number of Downloads",description:"Limit the number of times a download can be requested. Leave blank for unlimited.",type:"number",min:0,max:1e3,placeholder:"0 - 1000",disabled:!e}))]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_limit_products",l.jsx(B,{title:"Number of Products",description:"Limit the number of different products that can be downloaded.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_limit_products",l.jsx(G,{id:"somdn_pro_basic_limit_products",label:"Number of Products",description:"Limit the number of different products that can be downloaded. Leave blank for unlimited. If a product limit is set, the number of downloads will apply per product.",type:"number",min:0,max:1e3,placeholder:"0 - 1000",disabled:!e}))]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_limit_product_name",l.jsx(B,{title:"Products Text",description:"Customize the text that shows 'Products' in the download limits display.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_limit_product_name",l.jsx(G,{id:"somdn_pro_basic_limit_product_name",label:"Download Limits 'Products' Text",description:"Change the text that says 'Products'. Example: Change 'Downloads 20, Products 0' to 'Downloads 20, Files 0'.",disabled:!e}))]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_exclude_months",l.jsx(B,{title:"Exclude Months",description:"Set the number of months that downloads from My Account don't count towards limits.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_exclude_months",l.jsx(G,{id:"somdn_pro_exclude_months",label:"Months to Exclude from Counting",description:"The number of months that downloads from My Account (for owned products) won't count towards limits. Leave blank for no exclusion.",type:"number",min:0,max:36,disabled:!e}))]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_exclude_cat_list",l.jsx(B,{title:"Exclude Categories",description:"Products in selected categories will not be counted when downloaded.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_exclude_cat_list",l.jsx(Ca,{id:"somdn_pro_exclude_cat_list",label:"Exclude Categories",description:"Products in selected categories will not be counted when downloaded.",taxonomy:"product_cat",disabled:!e}))]}),l.jsx(Ve,{showIf:{somdn_pro_basic_limit_enable:!0}}),l.jsxs(He,{showIf:{somdn_pro_basic_limit_enable:!0},as:"div",className:"rounded-md bg-neutral-50 p-4 dark:bg-neutral-800/50",children:[l.jsx("h4",{className:"text-sm font-medium dark:text-white mb-3",children:"Examples"}),l.jsxs("ol",{className:"list-decimal list-inside space-y-2 text-sm text-neutral-600 dark:text-neutral-400",children:[l.jsxs("li",{children:[l.jsx("strong",{children:"Downloads 20, Products 0"})," - 20 total downloads."]}),l.jsxs("li",{children:[l.jsx("strong",{children:"Downloads 5, Products 5"})," - 5 downloads of up to 5 different products."]}),l.jsxs("li",{children:[l.jsx("strong",{children:"Downloads 0, Products 5"})," - Unlimited downloads of up to 5 different products."]})]})]}),l.jsx(Ve,{showIf:{somdn_pro_basic_limit_enable:!0}}),l.jsxs(He,{showIf:{somdn_pro_basic_limit_enable:!0},as:"fragment",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Error Message"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Customize the message shown when download limits are reached."})]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_limit_error",l.jsx(B,{title:"Error Message",description:"Customize the download limit reached error message.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_limit_error",l.jsx(bt,{id:"somdn_pro_basic_limit_error",label:"Custom Error Message",description:"Customize the download limit reached error message.",help:"<p><strong>Default for limited downloads, unlimited products:</strong><br/>Your free download limit is (Number of downloads) downloads per (Download limit period).</p><br/><p><strong>Default for limited downloads, limited products:</strong><br/>Your free download limit is (Number of downloads) downloads for (Number of products) products per (Download limit period).</p><br/><p><strong>Default for unlimited downloads, limited products:</strong><br/>Your free download limit is (Number of products) products per (Download limit period).</p>",rows:4,disabled:!e}))]}),l.jsx(Ve,{showIf:{somdn_pro_basic_limit_enable:!0}}),l.jsxs(He,{showIf:{somdn_pro_basic_limit_enable:!0},as:"fragment",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Account Page"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Show download limit information on the customer's account page."})]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_limit_acc_page",l.jsx(B,{title:"Account Page Display",description:"Show customer download limits on their WooCommerce account page.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_limit_acc_page",l.jsx(X,{id:"somdn_pro_limit_acc_page",label:"Show Limits on Account Page",description:"Display download limits in the downloads section of the [woocommerce_my_account] shortcode.",disabled:!e}))]}),s&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_limit_acc_page_title_enable",l.jsx(B,{title:"Section Title",description:"Display a heading above the download limit section on the account page.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_limit_acc_page_title_enable",l.jsx(X,{id:"somdn_pro_limit_acc_page_title_enable",label:"Show Section Title Heading",description:"Displays a heading above the download limit section.",disabled:!e}))]}),s&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_limit_acc_page_title",l.jsx(B,{title:"Section Title Text",description:"Customize the section title heading text.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_limit_acc_page_title",l.jsx(G,{id:"somdn_pro_limit_acc_page_title",label:"Section Title",description:"Customize the section title heading.",help:"<p><strong>Default:</strong> Free Download Limits</p>",placeholder:"Free Download Limits",disabled:!e}))]}),s&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_limit_acc_page_message",l.jsx(B,{title:"Section Message",description:"Include a short section of text below the free download limits section title.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_limit_acc_page_message",l.jsx(bt,{id:"somdn_pro_limit_acc_page_message",label:"Section Message",description:"Include a short section of text below the free download limits section title.",rows:3,disabled:!e}))]}),t&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-8"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Membership Limit Settings"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Additional settings for download limitations of your site memberships."}),n?l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_limit_member_exclude",l.jsx(B,{title:"Exclude Memberships",description:"Exclude memberships from download limitations.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_limit_member_exclude",l.jsx(X,{id:"somdn_pro_limit_member_exclude",label:"Exclude Memberships from Limitations",description:"When enabled, you can select which memberships are excluded from limitations in the Membership Plans page.",disabled:!e}))]},"exclude-memberships"):null,n?l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_limit_refresh_on_subscribe",l.jsx(B,{title:"Refresh on Subscribe Date",description:"Refresh download limits on the customer's subscription date.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_limit_refresh_on_subscribe",l.jsx(X,{id:"somdn_pro_limit_refresh_on_subscribe_date",label:"Refresh on Subscribed Date",description:"If enabled, the download limits will refresh on the customer's subscription date.",disabled:!e}))]},"refresh-on-subscribe"):null]}),l.jsxs("div",{className:"rounded-md bg-blue-50 p-4 dark:bg-blue-900/20 mt-6",children:[l.jsx("h4",{className:"text-sm font-medium text-blue-800 dark:text-blue-300 mb-3",children:"Notes on Priority"}),l.jsx("p",{className:"text-sm text-blue-700 dark:text-blue-400 mb-2",children:"Download limit priority is as follows:"}),l.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-blue-700 dark:text-blue-400 mb-3",children:[l.jsx("li",{children:"User Account"}),l.jsx("li",{children:"Membership Plan"}),l.jsx("li",{children:"User Role"}),l.jsx("li",{children:"Global Setting"})]}),l.jsx("p",{className:"text-sm text-blue-700 dark:text-blue-400",children:"Any rule that excludes a specific user from any download limits will always take priority. For example: If the user has specific download limits tied to their profile, but they have a user role that has excluded download limits, then the user will have no download limits."})]})]})}const lh=[{fieldId:"somdn_pro_basic_limit_enable",label:"Enable Download Limitations",help:"Enable or disable download limits for your site.",sectionKey:"download-limits",pluginSlug:Re,keywords:["limit","enable","disable","download","pro"]},{fieldId:"somdn_pro_basic_limit_type",label:"Limit Downloads By",help:"Choose to limit downloads by User ID or IP Address.",sectionKey:"download-limits",pluginSlug:Re,keywords:["limit","type","user","id","ip","address","pro"]},{fieldId:"somdn_pro_basic_login_req",label:"Login Required",help:"Configure login requirements for download limits.",sectionKey:"download-limits",pluginSlug:Re,keywords:["login","required","limit","user","pro"]},{fieldId:"somdn_pro_basic_limit_freq",label:"Download Limit Period",help:"Set the time period for download limits.",sectionKey:"download-limits",pluginSlug:Re,keywords:["limit","period","frequency","day","week","month","year","pro"]},{fieldId:"somdn_pro_basic_limit_amount",label:"Number of Downloads",help:"Limit the number of times a download can be requested.",sectionKey:"download-limits",pluginSlug:Re,keywords:["limit","number","downloads","amount","pro"]},{fieldId:"somdn_pro_basic_limit_products",label:"Number of Products",help:"Limit the number of different products that can be downloaded.",sectionKey:"download-limits",pluginSlug:Re,keywords:["limit","number","products","pro"]},{fieldId:"somdn_pro_basic_limit_product_name",label:"Products Text",help:'Customize the "Products" text in download limits display.',sectionKey:"download-limits",pluginSlug:Re,keywords:["limit","product","name","text","pro"]},{fieldId:"somdn_pro_exclude_months",label:"Exclude Months",help:"Number of months to exclude from counting for owned products.",sectionKey:"download-limits",pluginSlug:Re,keywords:["exclude","months","owned","products","pro"]},{fieldId:"somdn_pro_exclude_cat_list",label:"Exclude Categories",help:"Products in selected categories will not be counted when downloaded.",sectionKey:"download-limits",pluginSlug:Re,keywords:["exclude","categories","category","product","pro"]},{fieldId:"somdn_pro_basic_limit_error",label:"Error Message",help:"Customize the download limit reached error message.",sectionKey:"download-limits",pluginSlug:Re,keywords:["error","message","limit","reached","pro"]},{fieldId:"somdn_pro_limit_acc_page",label:"Account Page Display",help:"Show customer download limits on their account page.",sectionKey:"download-limits",pluginSlug:Re,keywords:["account","page","display","limits","pro"]},{fieldId:"somdn_pro_limit_acc_page_title_enable",label:"Show Section Title",help:"Display a heading above the download limit section.",sectionKey:"download-limits",pluginSlug:Re,keywords:["account","title","heading","section","pro"]},{fieldId:"somdn_pro_limit_acc_page_title",label:"Section Title",help:"Customize the section title heading.",sectionKey:"download-limits",pluginSlug:Re,keywords:["account","title","text","heading","pro"]},{fieldId:"somdn_pro_limit_acc_page_message",label:"Section Message",help:"Add text below the free download limits section title.",sectionKey:"download-limits",pluginSlug:Re,keywords:["account","message","text","section","pro"]},{fieldId:"somdn_pro_limit_member_exclude",label:"Exclude Memberships",help:"Exclude memberships from download limitations.",sectionKey:"download-limits",pluginSlug:Re,keywords:["membership","exclude","limit","pro"]},{fieldId:"somdn_pro_limit_refresh_on_subscribe_date",label:"Refresh on Subscribe Date",help:"Refresh download limits on subscription date.",sectionKey:"download-limits",pluginSlug:Re,keywords:["membership","refresh","subscribe","date","limit","pro"]}],Sy=Object.freeze(Object.defineProperty({__proto__:null,DownloadLimitsSettings:ah,downloadLimitsDefaults:oh,downloadLimitsSettingsIndex:lh,membershipLimitsDefaults:rh},Symbol.toStringTag,{value:"Module"})),Se="free-downloads-woocommerce",Cy=()=>{var e;return((e=window.somdn_settings)==null?void 0:e.is_pro)||!1},dh={somdn_pro_track_enable:!1,somdn_capture_email_enable:!1,somdn_capture_email_remember:!1,somdn_capture_email_remember_time:"30",somdn_capture_email_users_enable:!1,somdn_capture_email_subscribe:"0",somdn_capture_email_title:"",somdn_capture_email_placeholder:"",somdn_capture_email_error_none:"",somdn_capture_email_error_invalid:"",somdn_capture_email_title_bg:"#2679ce",somdn_capture_email_title_colour:"#ffffff",somdn_capture_email_body:"",somdn_capture_email_button:"",somdn_download_history_enable:!1,somdn_download_history_hide_purchase:!1,somdn_download_history_title_enable:!1,somdn_download_history_title:"",somdn_download_history_message:"",somdn_download_no_results_text:"",somdn_download_history_button:""};function ch(){var r;const e=Cy(),t=ce({somdn_pro_track_enable:!0}),n=ce({somdn_pro_track_enable:!0,somdn_capture_email_enable:!0}),s=ce({somdn_pro_track_enable:!0}),i=ce({somdn_pro_track_enable:!0,somdn_capture_email_enable:!0,somdn_capture_email_remember:!0}),o=ce({somdn_pro_track_enable:!0,somdn_download_history_enable:!0});return l.jsxs("section",{className:"space-y-6",id:"tracking",children:[l.jsx("h2",{className:"text-lg font-semibold dark:text-white",children:"Tracking & Email Capture"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Create a detailed record each time a free download is made, capture guest emails, and display download history on user accounts."}),l.jsx("p",{className:"pb-2 text-sm text-neutral-500 dark:text-neutral-400",children:l.jsxs("em",{children:["Note: Tracking is automatically enabled when ",l.jsx(ct,{settingId:"somdn_pro_basic_limit_enable",children:"download limitations"})," are active."]})}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_track_enable",l.jsx(B,{title:"Track Free Downloads",description:"Enable detailed free download tracking to monitor and analyze downloads.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_track_enable",l.jsx(X,{id:"somdn_pro_track_enable",label:"Enable Detailed Free Download Tracking",description:"When enabled, a detailed record is created each time a free download is made.",help:"<p><strong>Tip:</strong> Click 'View download records' link to see all tracked downloads after enabling.</p>",disabled:!e}))]}),l.jsx(Ve,{showIf:{somdn_pro_track_enable:!0}}),l.jsxs(He,{showIf:{somdn_pro_track_enable:!0},as:"fragment",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Email Capture"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Capture email addresses from guest users before allowing downloads."})]}),s&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_capture_email_enable",l.jsx(B,{title:"Capture Emails",description:"Ask guest users for their email address before downloading.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_capture_email_enable",l.jsx(X,{id:"somdn_capture_email_enable",label:"Capture Emails",description:"Ask guest users for their email address before downloading.",disabled:!e}))]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_capture_email_remember",l.jsx(B,{title:"Remember Guest Email",description:"Remember the email address of guests for a set period of time using cookies.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_capture_email_remember",l.jsx(X,{id:"somdn_capture_email_remember",label:"Remember Guest Email Address",description:"Remember the email address of guests for a set period of time. It will set a cookie in the browser and check this, if set it will allow the download without having to add the email again.",disabled:!e}))]}),i&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_capture_email_remember_time",l.jsx(B,{title:"Remember Duration",description:"Set the number of days to remember the email address (cookie expiry time).",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_capture_email_remember_time",l.jsx(G,{id:"somdn_capture_email_remember_time",label:"Days to Remember",description:"Set the number of days to remember the email address (cookie expiry time).",type:"number",min:1,max:365,placeholder:"30",disabled:!e}))]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_capture_email_users_enable",l.jsx(B,{title:"Show for Registered Users",description:"Show the email capture window for registered users as well as guests.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_capture_email_users_enable",l.jsx(X,{id:"somdn_capture_email_users_enable",label:"Show for Registered Users",description:"Show the email capture window for registered users. The email address field will be pre-filled for registered users.",disabled:!e}))]}),l.jsx(Ve,{showIf:{somdn_pro_track_enable:!0,somdn_capture_email_enable:!0}}),l.jsxs(He,{showIf:{somdn_pro_track_enable:!0,somdn_capture_email_enable:!0},as:"fragment",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Newsletter Subscription"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Optionally subscribe users to your newsletter when capturing emails."})]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_capture_email_subscribe",l.jsx(B,{title:"Newsletter Subscription",description:"Choose if you want to subscribe users to your newsletter when they download.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_capture_email_subscribe",l.jsx(ot,{id:"somdn_capture_email_subscribe",label:"Newsletter Subscription Option",description:l.jsxs(l.Fragment,{children:["Choose if you want to subscribe users to your newsletter. Configure newsletter settings on the ",l.jsx(ct,{settingId:"newsletter",children:"Newsletter page"}),"."]}),help:"<p><strong>Manual:</strong> If you just want to take extra information like first name etc without a 3rd party newsletter service. Then you can customise the fields on the Newsletter page.</p>",options:Array.isArray((r=window.somdn_settings)==null?void 0:r.newsletter_subscribe_options)&&window.somdn_settings.newsletter_subscribe_options.length>0?window.somdn_settings.newsletter_subscribe_options:[{label:"— None —",value:"0"},{label:"Manual",value:"manual"},{label:"MailChimp",value:"mailchimp"}],disabled:!e}))]}),l.jsx(Ve,{showIf:{somdn_pro_track_enable:!0,somdn_capture_email_enable:!0}}),l.jsxs(He,{showIf:{somdn_pro_track_enable:!0,somdn_capture_email_enable:!0},as:"fragment",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Email Capture Box Customization"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Customize the appearance of the email capture popup box."})]}),n&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_capture_email_title",l.jsx(B,{title:"Box Title",description:"Customize the title text shown in the email capture popup.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_capture_email_title",l.jsx(G,{id:"somdn_capture_email_title",label:"Box Title",description:"Customize the capture email box title.",help:"<p><strong>Default:</strong> Download FREE!</p>",placeholder:"Download FREE!",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_capture_email_placeholder",l.jsx(B,{title:"Email Placeholder",description:"Customize the email input field placeholder text.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_capture_email_placeholder",l.jsx(G,{id:"somdn_capture_email_placeholder",label:"Email Placeholder",description:"Customize the email address input field placeholder.",help:"<p><strong>Default:</strong> Email address...</p>",placeholder:"Email address...",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_capture_email_error_none",l.jsx(B,{title:"No Email Error",description:"Customize the error message when no email is entered.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_capture_email_error_none",l.jsx(G,{id:"somdn_capture_email_error_none",label:"Error Message - No Email",description:"Customize the error message if no email address is entered.",help:"<p><strong>Default:</strong> Please enter your email address</p>",placeholder:"Please enter your email address",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_capture_email_error_invalid",l.jsx(B,{title:"Invalid Email Error",description:"Customize the error message when an invalid email is entered.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_capture_email_error_invalid",l.jsx(G,{id:"somdn_capture_email_error_invalid",label:"Error Message - Invalid Email",description:"Customize the error message if an invalid email address is entered.",help:"<p><strong>Default:</strong> Please enter a valid email address</p>",placeholder:"Please enter a valid email address",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_capture_email_title_bg",l.jsx(B,{title:"Title Background Color",description:"Customize the background color of the popup title bar.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_capture_email_title_bg",l.jsx(ko,{id:"somdn_capture_email_title_bg",label:"Title Background Color",description:"Customize the background color of the popup title bar.",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_capture_email_title_colour",l.jsx(B,{title:"Title Font Color",description:"Customize the font color of the popup title.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_capture_email_title_colour",l.jsx(ko,{id:"somdn_capture_email_title_colour",label:"Title Font Color",description:"Customize the font color of the popup title.",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_capture_email_body",l.jsx(B,{title:"Box Text",description:"Customize the capture email message text.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_capture_email_body",l.jsx(bt,{id:"somdn_capture_email_body",label:"Box Text",description:"Customize the capture email message. Use {product} to include the product name.",help:"<p><strong>Default:</strong> To download (product title) today just enter your email address!</p>",rows:3,disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_capture_email_button",l.jsx(B,{title:"Button Text",description:"Customize the download button text in the email capture popup.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_capture_email_button",l.jsx(G,{id:"somdn_capture_email_button",label:"Button Text",description:"Customize the download button text.",help:"<p><strong>Default:</strong> Submit & Download</p>",placeholder:"Submit & Download",disabled:!e}))]})]}),l.jsx(Ve,{showIf:{somdn_pro_track_enable:!0}}),l.jsxs(He,{showIf:{somdn_pro_track_enable:!0},as:"fragment",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Download History"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Show free download history on customer account pages."})]}),t&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_download_history_enable",l.jsx(B,{title:"Download History",description:"Show free download history on user account page.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_download_history_enable",l.jsx(X,{id:"somdn_download_history_enable",label:"Show Free Download History",description:"Show free download history on user account page. Displays in the downloads section of the [woocommerce_my_account] shortcode.",help:"<p>Only includes products the user has already downloaded for free and is still eligible to download.</p>",disabled:!e}))]}),o&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_download_history_hide_purchase",l.jsx(B,{title:"Hide Purchased Downloads",description:"Hide purchased downloads section from account page when user has no purchased downloads.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_download_history_hide_purchase",l.jsx(X,{id:"somdn_download_history_hide_purchase",label:"Hide Purchased Downloads Section",description:"Hide purchased downloads section from account page if the user has no purchased downloads.",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_download_history_title_enable",l.jsx(B,{title:"Section Title",description:"Display a heading above the download history section.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_download_history_title_enable",l.jsx(X,{id:"somdn_download_history_title_enable",label:"Show Section Title Heading",description:"Displays a heading above the download history list.",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_download_history_title",l.jsx(B,{title:"Section Title Text",description:"Customize the section title heading text.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_download_history_title",l.jsx(G,{id:"somdn_download_history_title",label:"Section Title",description:"Customize the section title heading.",help:"<p><strong>Default:</strong> Free Downloads</p>",placeholder:"Free Downloads",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_download_history_message",l.jsx(B,{title:"Section Message",description:"Include a short section of text below the free downloads section title.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_download_history_message",l.jsx(bt,{id:"somdn_download_history_message",label:"Section Message",description:"Include a short section of text below the free downloads section title.",rows:3,disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_download_no_results_text",l.jsx(B,{title:"No Downloads Text",description:"Add text that appears when the user has no free downloads.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_download_no_results_text",l.jsx(bt,{id:"somdn_download_no_results_text",label:"No Downloads Text",description:"Add some text that will appear when they have no free downloads.",rows:3,disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_download_history_button",l.jsx(B,{title:"Download Button Text",description:"Customize the download button text in the history list.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_download_history_button",l.jsx(G,{id:"somdn_download_history_button",label:"Button Text",description:"Customize the download button text.",help:"<p><strong>Default:</strong> Download</p>",placeholder:"Download",disabled:!e}))]})]})]})}const uh=[{fieldId:"somdn_pro_track_enable",label:"Enable Download Tracking",help:"Enable detailed free download tracking.",sectionKey:"tracking",pluginSlug:Se,keywords:["track","tracking","downloads","enable","pro"]},{fieldId:"somdn_capture_email_enable",label:"Capture Emails",help:"Ask guest users for their email address before downloading.",sectionKey:"tracking",pluginSlug:Se,keywords:["email","capture","guest","pro"]},{fieldId:"somdn_capture_email_remember",label:"Remember Guest Email",help:"Remember the email address of guests using cookies.",sectionKey:"tracking",pluginSlug:Se,keywords:["email","remember","guest","cookie","pro"]},{fieldId:"somdn_capture_email_remember_time",label:"Remember Duration",help:"Number of days to remember the guest email address.",sectionKey:"tracking",pluginSlug:Se,keywords:["email","remember","days","duration","pro"]},{fieldId:"somdn_capture_email_users_enable",label:"Show for Registered Users",help:"Show email capture for registered users.",sectionKey:"tracking",pluginSlug:Se,keywords:["email","capture","registered","users","pro"]},{fieldId:"somdn_capture_email_subscribe",label:"Newsletter Subscription",help:"Subscribe users to newsletter when capturing email.",sectionKey:"tracking",pluginSlug:Se,keywords:["newsletter","subscribe","mailchimp","email","pro"]},{fieldId:"somdn_capture_email_title",label:"Box Title",help:"Customize the email capture box title.",sectionKey:"tracking",pluginSlug:Se,keywords:["email","capture","title","box","pro"]},{fieldId:"somdn_capture_email_placeholder",label:"Email Placeholder",help:"Customize the email input placeholder text.",sectionKey:"tracking",pluginSlug:Se,keywords:["email","placeholder","input","pro"]},{fieldId:"somdn_capture_email_error_none",label:"No Email Error Message",help:"Error message when no email is entered.",sectionKey:"tracking",pluginSlug:Se,keywords:["email","error","message","validation","pro"]},{fieldId:"somdn_capture_email_error_invalid",label:"Invalid Email Error Message",help:"Error message when invalid email is entered.",sectionKey:"tracking",pluginSlug:Se,keywords:["email","error","message","invalid","validation","pro"]},{fieldId:"somdn_capture_email_title_bg",label:"Title Background Color",help:"Background color for the popup title bar.",sectionKey:"tracking",pluginSlug:Se,keywords:["email","capture","color","background","title","pro"]},{fieldId:"somdn_capture_email_title_colour",label:"Title Font Color",help:"Font color for the popup title.",sectionKey:"tracking",pluginSlug:Se,keywords:["email","capture","color","font","title","pro"]},{fieldId:"somdn_capture_email_body",label:"Box Text",help:"Customize the email capture popup message.",sectionKey:"tracking",pluginSlug:Se,keywords:["email","capture","body","text","message","pro"]},{fieldId:"somdn_capture_email_button",label:"Submit Button Text",help:"Customize the submit button text.",sectionKey:"tracking",pluginSlug:Se,keywords:["email","capture","button","submit","pro"]},{fieldId:"somdn_download_history_enable",label:"Download History",help:"Show free download history on account page.",sectionKey:"tracking",pluginSlug:Se,keywords:["download","history","account","pro"]},{fieldId:"somdn_download_history_hide_purchase",label:"Hide Purchased Downloads",help:"Hide purchased downloads section when empty.",sectionKey:"tracking",pluginSlug:Se,keywords:["download","history","hide","purchased","pro"]},{fieldId:"somdn_download_history_title_enable",label:"History Section Title",help:"Show section title heading.",sectionKey:"tracking",pluginSlug:Se,keywords:["download","history","title","heading","pro"]},{fieldId:"somdn_download_history_title",label:"Section Title Text",help:"Customize the section title text.",sectionKey:"tracking",pluginSlug:Se,keywords:["download","history","title","text","pro"]},{fieldId:"somdn_download_history_message",label:"Section Message",help:"Text below the section title.",sectionKey:"tracking",pluginSlug:Se,keywords:["download","history","message","text","pro"]},{fieldId:"somdn_download_no_results_text",label:"No Downloads Text",help:"Text shown when user has no free downloads.",sectionKey:"tracking",pluginSlug:Se,keywords:["download","history","no","results","empty","pro"]},{fieldId:"somdn_download_history_button",label:"Download Button Text",help:"Customize the download button text.",sectionKey:"tracking",pluginSlug:Se,keywords:["download","history","button","text","pro"]}],My=Object.freeze(Object.defineProperty({__proto__:null,TrackingSettings:ch,trackingDefaults:dh,trackingSettingsIndex:uh},Symbol.toStringTag,{value:"Module"}));function Ma({id:e,label:t,description:n,options:s=[],value:i,onChange:o,help:r,type:a="normal",name:d,cols:c,showIf:u,resetOnHide:h,mountWhenHidden:f=!0,className:m,...p}){const{values:b,setValue:x}=Je(),w=ce(u),_=g.useRef(w),y=!!e,v=y?b==null?void 0:b[e]:void 0,j=i!==void 0,k=g.useMemo(()=>{var M,E;return i??v??((M=s==null?void 0:s[0])==null?void 0:M.value)??((E=s==null?void 0:s[0])==null?void 0:E.label)??""},[]),[C,S]=g.useState(k),T=j?i:y?v??"":C,D=g.useMemo(()=>d||(t?t.replace(/\s+/g,"-").toLowerCase():"radio-group"),[d,t]),P=M=>M.value??M.label,L=M=>{!j&&y&&x(e,M),!y&&!j&&S(M),o==null||o(M)};if(g.useEffect(()=>{if(_.current&&!w&&h!==void 0){const M=h===!0?void 0:h;y?x(e,M):j||S(M??"")}_.current=w},[w,h,y,e,x,j]),!f&&u&&!w)return null;const W=!w&&f,$=()=>{const M=c||3;return l.jsx("div",{className:"gap-4",style:{display:"grid",gridTemplateColumns:`repeat(${M}, minmax(0, 1fr))`},children:s.map(E=>{const V=P(E),z=`${D}-image-${V}`,A=T===V;return l.jsxs("label",{htmlFor:z,"aria-label":E.label||"image",title:E.label||"image",className:`group flex flex-col items-center justify-center border rounded-md p-2 cursor-pointer transition
                ${A?"border-indigo-600 bg-indigo-50 dark:border-indigo-500 dark:bg-neutral-900":"border-gray-200 dark:border-neutral-700 dark:bg-neutral-900"}
                hover:border-indigo-400 dark:hover:border-indigo-400`,onClick:U=>{W||E.disabled||U.target.tagName!=="INPUT"&&(U.preventDefault(),L(V))},children:[l.jsx("input",{id:z,type:"radio",name:D,value:V,checked:A,onChange:()=>L(V),disabled:W||E.disabled,className:"de-hide-input"}),E.image&&l.jsx("img",{src:E.image,alt:E.label||"image",className:`rounded border ${A?"border-indigo-600 dark:border-indigo-500":"border-gray-200 dark:border-neutral-700"}`,style:{width:48,height:48,objectFit:"cover"}}),E.label&&l.jsx("span",{className:`text-sm mt-2 font-medium ${A?"text-indigo-700 dark:text-indigo-400":"text-gray-900 dark:text-white"}`,children:E.label}),E.description&&l.jsx("span",{className:"block text-xs text-gray-500 dark:text-neutral-400 text-center mt-1",children:E.description})]},z)})})},O=()=>l.jsx("div",{className:"space-y-5",children:s.map(M=>{const E=P(M),V=`${D}-normal-${E}`,z=T===E;return l.jsxs("div",{className:"relative flex items-start",children:[l.jsx("div",{className:"flex h-6 items-center",children:l.jsx("input",{id:V,name:D,type:"radio",value:E,checked:z,onChange:()=>L(E),disabled:W||M.disabled,"aria-describedby":M.description?`${V}-desc`:void 0,className:"relative size-4 appearance-none rounded-full border border-gray-300 bg-white before:absolute before:inset-1 before:rounded-full before:bg-white checked:border-indigo-600 checked:bg-indigo-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 disabled:border-gray-300 disabled:bg-gray-100 disabled:before:bg-gray-400 dark:border-neutral-700 dark:bg-neutral-900 dark:checked:border-indigo-500 dark:checked:bg-indigo-500 dark:disabled:border-neutral-700 dark:disabled:bg-neutral-800 forced-colors:appearance-auto forced-colors:before:hidden [&:not(:checked)]:before:hidden"})}),l.jsxs("div",{className:"ml-3 text-sm/6",children:[l.jsx("label",{htmlFor:V,className:"font-medium text-gray-900 dark:text-white cursor-pointer",children:M.label}),M.description&&l.jsx("p",{id:`${V}-desc`,className:"text-gray-500 dark:text-neutral-400",children:M.description})]})]},V)})}),F=()=>{const M=c||6;return l.jsx("div",{className:"mt-2 gap-3",style:{display:"grid",gridTemplateColumns:`repeat(${M}, minmax(0, 1fr))`},children:s.map(E=>{const V=P(E),z=`${D}-button-${V}`,A=T===V;return l.jsxs("label",{htmlFor:z,"aria-label":E.label,title:E.label,className:"group relative flex items-center justify-center rounded-md border border-gray-300 bg-white px-3 py-2.5 has-[:checked]:border-indigo-600 has-[:checked]:bg-indigo-600 has-[:disabled]:opacity-25 has-[:focus-visible]:outline has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-indigo-600 cursor-pointer dark:border-neutral-700 dark:bg-neutral-900 dark:has-[:checked]:border-indigo-500 dark:has-[:checked]:bg-indigo-500",onClick:U=>{W||E.disabled||U.target.tagName!=="INPUT"&&(U.preventDefault(),L(V))},children:[l.jsx("input",{id:z,type:"radio",name:D,value:V,checked:A,onChange:()=>L(V),disabled:W||E.disabled,className:"de-hide-input absolute inset-0 appearance-none focus:outline focus:outline-0 disabled:cursor-not-allowed"}),l.jsx("span",{className:"text-sm font-semibold uppercase group-has-[:checked]:text-white dark:group-has-[:checked]:text-white",children:E.label})]},z)})})},H=()=>{const M=c||1;return l.jsx("div",{className:"gap-3",style:{display:"grid",gridTemplateColumns:`repeat(${M}, minmax(0, 1fr))`},children:s.map(E=>{const V=P(E),z=`${D}-list-${V}`,A=T===V;return l.jsxs("label",{htmlFor:z,"aria-label":E.label,"aria-description":E.description,title:E.label,className:"group flex border border-gray-200 p-4 first:rounded-tl-md first:rounded-tr-md last:rounded-bl-md last:rounded-br-md focus:outline-none has-[:checked]:relative has-[:checked]:border-indigo-200 has-[:checked]:bg-indigo-50 cursor-pointer dark:border-neutral-700 dark:bg-neutral-900 dark:has-[:checked]:border-indigo-500 dark:has-[:checked]:bg-indigo-950",onClick:U=>{W||E.disabled||U.target.tagName!=="INPUT"&&(U.preventDefault(),L(V))},children:[l.jsx("input",{id:z,type:"radio",name:D,value:V,checked:A,onChange:()=>L(V),disabled:W||E.disabled,className:"de-hide-input relative mt-0.5 size-4 shrink-0 appearance-none rounded-full border border-gray-300 bg-white before:absolute before:inset-1 before:rounded-full before:bg-white checked:border-indigo-600 checked:bg-indigo-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 disabled:border-gray-300 disabled:bg-gray-100 disabled:before:bg-gray-400 dark:border-neutral-700 dark:bg-neutral-900 dark:checked:border-indigo-500 dark:checked:bg-indigo-500 dark:disabled:border-neutral-700 dark:disabled:bg-neutral-800 forced-colors:appearance-auto forced-colors:before:hidden [&:not(:checked)]:before:hidden"}),l.jsxs("span",{className:"ml-3 flex flex-col",children:[l.jsx("span",{className:"block text-sm font-medium text-gray-900 group-has-[:checked]:text-indigo-900 dark:text-white dark:group-has-[:checked]:text-indigo-300",children:E.label}),E.description&&l.jsx("span",{className:"block text-sm text-gray-500 group-has-[:checked]:text-indigo-700 dark:text-neutral-400 dark:group-has-[:checked]:text-indigo-400",children:E.description})]})]},z)})})};return l.jsxs(sn,{hidden:u&&!w,"aria-hidden":u&&!w,className:m,...p,children:[l.jsx("div",{className:"flex items-center gap-2 mb-2",children:t&&l.jsxs(on,{children:[t,l.jsx(an,{label:t,help:r})]})}),n&&l.jsx(rn,{children:n}),a==="image"?$():a==="button"?F():a==="list"?H():O()]})}const Ty=100,hh=new Map,No=new Map;function Ta({label:e,description:t,postType:n="post",value:s,onChange:i,help:o,id:r,showIf:a,resetOnHide:d,mountWhenHidden:c=!0,className:u,...h}){const{values:f,setValue:m}=Je(),p=ce(a),b=g.useRef(p),[x,w]=g.useState([]),[_,y]=g.useState(!1),[v,j]=g.useState(null),k=r?f==null?void 0:f[r]:void 0,C=s!==void 0,S=C?s:k,T=r||`${n}-select`,D=()=>typeof window>"u"?"":window.location.origin+window.location.pathname.replace(/\/wp-admin.*/,"");g.useEffect(()=>{let O=!1;if(!n)return;j(null);const F=typeof window<"u"?window.wpeSettingsPostListFallback:null;if(!F||!F.url||!F.action||!F.nonce){j("Post list not configured"),w([]);return}const H=hh.get(n);if(H){w(H);return}async function M(){let V=[],z=1,A=1;const U=new URLSearchParams({action:F.action,nonce:F.nonce,post_type:n,per_page:String(Ty)});do{U.set("page",String(z));const Q=await fetch(`${F.url}?${U}`,{credentials:"same-origin"}),R=await Q.text();let Y={};try{Y=R?JSON.parse(R):{}}catch{}const ee=Array.isArray(Y)?Y:Y.data||[];A=parseInt(Q.headers.get("X-WP-TotalPages")||"1",10)||1,V=V.concat(ee),z+=1}while(z<=A);const J=new Set,ne=[];for(const Q of V)J.has(Q.id)||(ne.push(Q),J.add(Q.id));return ne.sort((Q,R)=>{var Y,ee;return(((Y=Q==null?void 0:Q.title)==null?void 0:Y.rendered)||"").localeCompare(((ee=R==null?void 0:R.title)==null?void 0:ee.rendered)||"",void 0,{sensitivity:"base"})}),ne}let E=No.get(n);return E||(E=M(),No.set(n,E)),y(!0),E.then(V=>{O||(hh.set(n,V),No.delete(n),w(V))}).catch(V=>{O||(No.delete(n),j(V.message||"Failed to load posts"),w([]))}).finally(()=>{O||y(!1)}),()=>{O=!0}},[n]);const P=g.useMemo(()=>S&&x.find(O=>{var F,H;return(O==null?void 0:O.id)===S||(O==null?void 0:O.slug)===S||((F=O==null?void 0:O.id)==null?void 0:F.toString())===String(S)||((H=O==null?void 0:O.slug)==null?void 0:H.toString())===String(S)})||null,[x,S]);if(g.useEffect(()=>{b.current&&!p&&d!==void 0&&r&&m(r,d===!0?void 0:d),b.current=p},[p,d,r,m]),!c&&a&&!p)return null;const L=!p&&c,W=g.useMemo(()=>P?`${D()}/wp-admin/post.php?post=${P.id}&action=edit`:null,[P]),$=O=>{!C&&r&&m(r,O),i==null||i(O)};return l.jsxs(sn,{hidden:a&&!p,"aria-hidden":a&&!p,className:u,...h,children:[l.jsx("div",{className:"flex items-center gap-2 mb-2",children:e&&l.jsxs(on,{htmlFor:T,children:[e,l.jsx(an,{label:e,help:o})]})}),t&&l.jsx(rn,{children:t}),l.jsxs("div",{className:"flex gap-2 items-center",children:[l.jsx("div",{className:"flex-1",children:l.jsx(th,{as:"div",id:T,name:n,options:x,displayValue:O=>{var F;return((F=O==null?void 0:O.title)==null?void 0:F.rendered)||""},value:P,onChange:O=>$((O==null?void 0:O.id)??(O==null?void 0:O.slug)??""),placeholder:_?"Loading…":"Search…",disabled:L||_||x.length===0,children:O=>{var F;return l.jsx(nh,{value:O,children:l.jsx(sh,{children:((F=O==null?void 0:O.title)==null?void 0:F.rendered)||"(no title)"})},O.id||O.slug)}})}),P&&W&&l.jsx("a",{href:W,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center px-3 py-1.5 rounded bg-neutral-200 text-neutral-900 text-xs font-semibold hover:bg-indigo-600 hover:text-white transition dark:bg-neutral-800 dark:text-white dark:hover:bg-indigo-700",title:"Edit post",style:{whiteSpace:"nowrap"},children:"Edit"})]}),_&&l.jsx("div",{className:"text-xs text-gray-500 mt-2",children:"Loading…"}),v&&l.jsx("div",{className:"text-xs text-red-500 mt-2",children:v}),!_&&!v&&l.jsxs("div",{className:"text-xs text-gray-400 mt-2",children:[x.length," posts loaded."]})]})}const wt="free-downloads-woocommerce",Py=()=>{var e;return((e=window.somdn_settings)==null?void 0:e.is_pro)||!1},fh={somdn_download_type_option:"0",somdn_download_type_redirect_page:"",somdn_download_type_redirect_time:"5",somdn_download_type_redirect_message:"",somdn_download_type_redirect_text:"",somdn_download_type_email_page:"",somdn_download_type_email_page_message:"",somdn_download_type_email_expire_time:"24",somdn_download_type_email_expire_used:!1,somdn_download_type_email_expire_message:"",somdn_download_type_email_used_message:""};function mh(){const e=Py(),t=ce({somdn_download_type_option:["1","2"]}),n=ce({somdn_download_type_option:"2"}),s=ce({somdn_download_type_option:"2",somdn_download_type_email_expire_used:!0});return l.jsxs("section",{className:"space-y-6",id:"download-delivery",children:[l.jsx("h2",{className:"text-lg font-semibold dark:text-white",children:"Download Delivery"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Choose how free downloads are delivered: instant download, redirect to a confirmation page, or email a download link."}),l.jsx("p",{className:"pb-2 text-sm text-neutral-500 dark:text-neutral-400",children:l.jsx("em",{children:"Note: This is separate from your WooCommerce File Download Method setting."})}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_download_type_option",l.jsx(B,{title:"Delivery Type",description:"Choose how downloads are delivered to users - instant download, redirect to confirmation page, or email link.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_download_type_option",l.jsx(Ma,{id:"somdn_download_type_option",label:"Download Delivery Method",description:"Select how files should be delivered when users request a free download.",type:"list",cols:1,options:[{label:"Instant download (Default)",value:"0",description:"Files will be downloaded as soon as the download button is clicked, or when the email capture form is submitted.",disabled:!e},{label:"Redirect to confirmation page",value:"1",description:"Users will be redirected to a page of your choice and their download will start a few seconds later. A link to start the download will also show just in case.",disabled:!e},{label:"Email link then redirect to confirmation page",value:"2",description:"Users will be redirected to a page of your choice, and their download URL will be emailed to them.",disabled:!e}]})),l.jsxs("p",{className:"text-sm text-neutral-500 dark:text-neutral-400 mt-3 pr-20",children:[l.jsx("strong",{children:"Note:"}),' The "Email link" option requires ',l.jsx(ct,{settingId:"somdn_capture_email_enable",children:"Email Capture"})," to be enabled for guest downloads."]})]}),l.jsx(Ve,{showIf:{somdn_download_type_option:["1","2"]}}),l.jsxs(He,{showIf:{somdn_download_type_option:["1","2"]},as:"fragment",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Redirect Page Settings"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Configure the redirect behavior when users download files."})]}),t&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_download_type_redirect_page",l.jsx(B,{title:"Redirect Page",description:"Select which page to redirect users to after they request a download.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_download_type_redirect_page",l.jsx(Ta,{id:"somdn_download_type_redirect_page",label:"Redirect Page",description:"This is the page users will be redirected to after submitting a download form. Select which page your [download_redirect] shortcode is on.",postType:"pages",disabled:!e}))]}),t&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_download_type_redirect_time",l.jsx(B,{title:"Redirect Time",description:"Set the number of seconds before the download starts automatically on the redirect page.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_download_type_redirect_time",l.jsx(G,{id:"somdn_download_type_redirect_time",label:"Redirect Time (seconds)",description:"The time in seconds before the download starts automatically on the redirect page.",help:"<p><strong>Default:</strong> 5 seconds</p><p><strong>Max:</strong> 60 seconds</p>",type:"number",min:1,max:60,placeholder:"5",disabled:!e}))]}),t&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_download_type_redirect_message",l.jsx(B,{title:"Page Text",description:"Customize the message displayed on the confirmation page.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_download_type_redirect_message",l.jsx(bt,{id:"somdn_download_type_redirect_message",label:"Page Text",description:"Customize the message displayed on the confirmation page. Use {click_here} to show the download link. Use {time} to show the redirect time in seconds.",help:"<p><strong>Default:</strong> Your download should start automatically in {time} seconds. If it doesn't please {click_here}. Do not refresh this page.</p>",rows:4,disabled:!e}))]}),t&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_download_type_redirect_text",l.jsx(B,{title:"Click Here Text",description:"Customize the download link text that replaces {click_here} in the page message.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_download_type_redirect_text",l.jsx(G,{id:"somdn_download_type_redirect_text",label:"'Click Here' Text",description:"Customize the download link text.",help:"<p><strong>Default:</strong> click here</p>",placeholder:"click here",disabled:!e}))]}),l.jsx(Ve,{showIf:{somdn_download_type_option:"2"}}),l.jsxs(He,{showIf:{somdn_download_type_option:"2"},as:"fragment",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Confirmation Page Settings"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Configure the confirmation page when using email link delivery."})]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_download_type_email_page",l.jsx(B,{title:"Email Confirmation Page",description:"Select the page users will be redirected to after submitting the download form when using email delivery.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_download_type_email_page",l.jsx(Ta,{id:"somdn_download_type_email_page",label:"Email Confirmation Page",description:"This is the page users will be redirected to after submitting a download form. Select which page your [download_redirect] shortcode is on.",postType:"pages",disabled:!e}))]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_download_type_email_page_message",l.jsx(B,{title:"Page Text",description:"Customize the message displayed on the confirmation page for email delivery.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_download_type_email_page_message",l.jsx(bt,{id:"somdn_download_type_email_page_message",label:"Page Text",description:"Customize the message displayed on the confirmation page. Use {email} if you want to show the email address they used.",help:"<p><strong>Default:</strong> A link to download the file has been emailed to you, please check your inbox.</p>",rows:4,disabled:!e}))]}),l.jsx(Ve,{showIf:{somdn_download_type_option:"2"}}),l.jsxs(He,{showIf:{somdn_download_type_option:"2"},as:"fragment",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Email Link Settings"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Configure email link expiry and usage settings."})]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_download_type_email_expire_time",l.jsx(B,{title:"Link Expiry Time",description:"Set how long the download URL remains valid.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_download_type_email_expire_time",l.jsx(G,{id:"somdn_download_type_email_expire_time",label:"Link Expiry Time (hours)",description:"Set how long (hours) the download URL remains valid. Values between 1 and 168 (168 hours = 7 days).",help:"<p><strong>Note:</strong> This is just the URL link expiry itself. Normal download checks are always made regardless.</p><p><strong>Default:</strong> 24 hours</p>",type:"number",min:1,max:168,placeholder:"24",disabled:!e}))]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_download_type_email_expire_used",l.jsx(B,{title:"Expire When Used",description:"Choose whether email links should be expired once used.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_download_type_email_expire_used",l.jsx(X,{id:"somdn_download_type_email_expire_used",label:"Expire When Used",description:"Whether or not email links should be expired once used.",disabled:!e}))]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_download_type_email_expire_message",l.jsx(B,{title:"Expired Link Message",description:"Customize the message displayed when a download link has expired.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_download_type_email_expire_message",l.jsx(G,{id:"somdn_download_type_email_expire_message",label:"Expired Link Message",description:"Customize the message displayed on a product page when a download link has expired.",help:"<p><strong>Default:</strong> Your download key has now expired, please try again.</p>",placeholder:"Your download key has now expired, please try again.",disabled:!e}))]}),s&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_download_type_email_used_message",l.jsx(B,{title:"Used Link Message",description:"Customize the message displayed when a download link has already been used.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_download_type_email_used_message",l.jsx(G,{id:"somdn_download_type_email_used_message",label:"Used Link Message",description:"Customize the message displayed on a product page when a download link has been used.",help:"<p><strong>Default:</strong> Your download key has already been used, please try again.</p>",placeholder:"Your download key has already been used, please try again.",disabled:!e}))]})]})}const ph=[{fieldId:"somdn_download_type_option",label:"Download Delivery Method",help:"Choose how downloads are delivered - instant, redirect, or email link.",sectionKey:"download-delivery",pluginSlug:wt,keywords:["download","delivery","type","instant","redirect","email","pro"]},{fieldId:"somdn_download_type_redirect_page",label:"Redirect Page",help:"Select the page users are redirected to after requesting download.",sectionKey:"download-delivery",pluginSlug:wt,keywords:["redirect","page","confirmation","pro"]},{fieldId:"somdn_download_type_redirect_time",label:"Redirect Time",help:"Seconds before download starts automatically on redirect page.",sectionKey:"download-delivery",pluginSlug:wt,keywords:["redirect","time","seconds","delay","pro"]},{fieldId:"somdn_download_type_redirect_message",label:"Redirect Page Text",help:"Customize the message on the confirmation page.",sectionKey:"download-delivery",pluginSlug:wt,keywords:["redirect","message","text","confirmation","pro"]},{fieldId:"somdn_download_type_redirect_text",label:"Click Here Text",help:"Customize the download link text.",sectionKey:"download-delivery",pluginSlug:wt,keywords:["redirect","click","link","text","pro"]},{fieldId:"somdn_download_type_email_page",label:"Email Confirmation Page",help:"Select the page for email link delivery confirmation.",sectionKey:"download-delivery",pluginSlug:wt,keywords:["email","page","confirmation","pro"]},{fieldId:"somdn_download_type_email_page_message",label:"Email Page Text",help:"Customize the email confirmation page message.",sectionKey:"download-delivery",pluginSlug:wt,keywords:["email","message","text","confirmation","pro"]},{fieldId:"somdn_download_type_email_expire_time",label:"Link Expiry Time",help:"How long email download links remain valid.",sectionKey:"download-delivery",pluginSlug:wt,keywords:["email","expire","expiry","time","hours","pro"]},{fieldId:"somdn_download_type_email_expire_used",label:"Expire When Used",help:"Whether links expire after being used once.",sectionKey:"download-delivery",pluginSlug:wt,keywords:["email","expire","used","single","use","pro"]},{fieldId:"somdn_download_type_email_expire_message",label:"Expired Link Message",help:"Message shown when download link has expired.",sectionKey:"download-delivery",pluginSlug:wt,keywords:["email","expire","expired","message","pro"]},{fieldId:"somdn_download_type_email_used_message",label:"Used Link Message",help:"Message shown when download link has already been used.",sectionKey:"download-delivery",pluginSlug:wt,keywords:["email","used","message","pro"]}],Ey=Object.freeze(Object.defineProperty({__proto__:null,DownloadDeliverySettings:mh,downloadDeliveryDefaults:fh,downloadDeliverySettingsIndex:ph},Symbol.toStringTag,{value:"Module"})),us="free-downloads-woocommerce",Dy=()=>{var e;return((e=window.somdn_settings)==null?void 0:e.is_pro)||!1},gh={somdn_pro_include_product_setting:"",somdn_pro_include_product_list:[]},bh={somdn_pro_include_cat_setting:"",somdn_pro_include_cat_list:[]},xh={somdn_pro_include_tag_setting:"",somdn_pro_include_tag_list:[]},Pa=[{label:"— None —",value:""},{label:"Included",value:"included"},{label:"Excluded",value:"excluded"}];function wh(){const e=Dy(),t=ce({somdn_pro_include_product_setting:["included","excluded"]}),n=ce({somdn_pro_include_cat_setting:["included","excluded"]}),s=ce({somdn_pro_include_tag_setting:["included","excluded"]});return l.jsxs("section",{className:"space-y-6",id:"advanced-restrictions",children:[l.jsx("h2",{className:"text-lg font-semibold dark:text-white",children:"Advanced Product Restrictions"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Create lists of products, categories, or tags that are either included or excluded from free downloads. These restrictions work together - a product must pass all restriction checks to be available for free download."}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Product Restrictions"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Create a list of products that are either excluded from any free download, or a list of only the products that free downloading applies to."}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_include_product_setting",l.jsx(B,{title:"Product Restrictions",description:"Include or exclude specific products from free downloads.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_include_product_setting",l.jsx(ot,{id:"somdn_pro_include_product_setting",label:"Product Restriction Type",description:"Only the selected products are included or excluded for free downloads.",options:Pa,disabled:!e}))]}),t&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_include_product_list",l.jsx(B,{title:"Product Selection",description:"Select which products to include or exclude from free downloads.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_include_product_list",l.jsx(Ta,{id:"somdn_pro_include_product_list",label:"Select Products",description:"Search and select products to apply the restriction to.",postType:"product",multiple:!0,disabled:!e}))]}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-8"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Category Restrictions"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Create a list of product categories that are either excluded from any free download, or a list of only the product categories that free downloading applies to."}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_include_cat_setting",l.jsx(B,{title:"Category Restrictions",description:"Include or exclude products in specific categories from free downloads.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_include_cat_setting",l.jsx(ot,{id:"somdn_pro_include_cat_setting",label:"Category Restriction Type",description:"Only the products in selected categories are included or excluded for free downloads.",options:Pa,disabled:!e}))]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_include_cat_list",l.jsx(B,{title:"Category Selection",description:"Select which product categories to include or exclude from free downloads.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_include_cat_list",l.jsx(Ca,{id:"somdn_pro_include_cat_list",label:"Select Categories",description:"Select product categories to apply the restriction to.",taxonomy:"product_cat",multiple:!0,disabled:!e}))]}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-8"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Tag Restrictions"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Create a list of product tags that are either excluded from any free download, or a list of only the product tags that free downloading applies to."}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_include_tag_setting",l.jsx(B,{title:"Tag Restrictions",description:"Include or exclude products with specific tags from free downloads.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_include_tag_setting",l.jsx(ot,{id:"somdn_pro_include_tag_setting",label:"Tag Restriction Type",description:"Only the products with selected tags are included or excluded for free downloads.",options:Pa,disabled:!e}))]}),s&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_include_tag_list",l.jsx(B,{title:"Tag Selection",description:"Select which product tags to include or exclude from free downloads.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_include_tag_list",l.jsx(Ca,{id:"somdn_pro_include_tag_list",label:"Select Tags",description:"Select product tags to apply the restriction to.",taxonomy:"product_tag",multiple:!0,disabled:!e}))]}),l.jsxs("div",{className:"rounded-md bg-blue-50 p-4 dark:bg-blue-900/20 mt-8",children:[l.jsx("h4",{className:"text-sm font-medium text-blue-800 dark:text-blue-300 mb-3",children:"How Restrictions Work"}),l.jsx("p",{className:"text-sm text-blue-700 dark:text-blue-400 mb-3",children:"All restriction checks must pass for a product to be available for free download. The restrictions work together as follows:"}),l.jsxs("ul",{className:"list-disc list-inside space-y-1 text-sm text-blue-700 dark:text-blue-400",children:[l.jsxs("li",{children:[l.jsx("strong",{children:"Included:"})," Only selected items are available for free downloads."]}),l.jsxs("li",{children:[l.jsx("strong",{children:"Excluded:"})," Selected items are NOT available for free downloads."]}),l.jsxs("li",{children:[l.jsx("strong",{children:"None:"})," No restriction applied for that type."]})]}),l.jsxs("p",{className:"text-sm text-blue-700 dark:text-blue-400 mt-3",children:[l.jsx("strong",{children:"Example:"}),' If you set categories to "Included" and select "Music", and tags to "Excluded" with "Premium" selected, only products in the Music category that do NOT have the Premium tag will be available for free download.']})]}),l.jsxs("div",{className:"rounded-md bg-amber-50 p-4 dark:bg-amber-900/20 mt-4",children:[l.jsx("h4",{className:"text-sm font-medium text-amber-800 dark:text-amber-300 mb-2",children:"Note"}),l.jsxs("p",{className:"text-sm text-amber-700 dark:text-amber-400",children:["Product restrictions here will override the"," ",l.jsx(ct,{settingId:"somdn_indy_items",children:"Include Selected Products Only"})," and"," ",l.jsx(ct,{settingId:"somdn_indy_exclude_items",children:"Exclude Selected Products Only"})," ","options in General Settings. If you use product restrictions here, the general include/exclude settings will be disabled."]})]})]})}const _h=[{fieldId:"somdn_pro_include_product_setting",label:"Product Restriction Type",help:"Include or exclude specific products from free downloads.",sectionKey:"advanced-restrictions",pluginSlug:us,keywords:["product","restriction","include","exclude","advanced","pro"]},{fieldId:"somdn_pro_include_product_list",label:"Select Products",help:"Search and select products to apply the restriction to.",sectionKey:"advanced-restrictions",pluginSlug:us,keywords:["product","list","select","restriction","pro"]},{fieldId:"somdn_pro_include_cat_setting",label:"Category Restriction Type",help:"Include or exclude products in specific categories from free downloads.",sectionKey:"advanced-restrictions",pluginSlug:us,keywords:["category","restriction","include","exclude","advanced","pro"]},{fieldId:"somdn_pro_include_cat_list",label:"Select Categories",help:"Select product categories to apply the restriction to.",sectionKey:"advanced-restrictions",pluginSlug:us,keywords:["category","list","select","restriction","pro"]},{fieldId:"somdn_pro_include_tag_setting",label:"Tag Restriction Type",help:"Include or exclude products with specific tags from free downloads.",sectionKey:"advanced-restrictions",pluginSlug:us,keywords:["tag","restriction","include","exclude","advanced","pro"]},{fieldId:"somdn_pro_include_tag_list",label:"Select Tags",help:"Select product tags to apply the restriction to.",sectionKey:"advanced-restrictions",pluginSlug:us,keywords:["tag","list","select","restriction","pro"]}],Oy=Object.freeze(Object.defineProperty({__proto__:null,AdvancedRestrictionsSettings:wh,advancedRestrictionsDefaults:gh,advancedRestrictionsSettingsIndex:_h,categoryRestrictionsDefaults:bh,tagRestrictionsDefaults:xh},Symbol.toStringTag,{value:"Module"})),ae="free-downloads-woocommerce",Iy=()=>{var e;return((e=window.somdn_settings)==null?void 0:e.is_pro)||!1},yh={somdn_newsletter_display_type:"0",somdn_newsletter_checkbox_error:"",somdn_newsletter_text:"",somdn_newsletter_fname_placeholder:"",somdn_newsletter_fname_error:"",somdn_newsletter_fname_email:!1,somdn_newsletter_lname:!1,somdn_newsletter_lname_placeholder:"",somdn_newsletter_lname_required:!1,somdn_newsletter_lname_error:"",somdn_newsletter_lname_email:!1,somdn_newsletter_tel:!1,somdn_newsletter_tel_placeholder:"",somdn_newsletter_tel_required:!1,somdn_newsletter_tel_error:"",somdn_newsletter_tel_email:!1,somdn_newsletter_company:!1,somdn_newsletter_company_placeholder:"",somdn_newsletter_company_required:!1,somdn_newsletter_company_error:"",somdn_newsletter_company_email:!1,somdn_newsletter_website:!1,somdn_newsletter_website_placeholder:"",somdn_newsletter_website_required:!1,somdn_newsletter_website_error:"",somdn_newsletter_website_email:!1,somdn_newsletter_confirmations:!1,somdn_newsletter_confirmations_errors:!1},vh={somdn_newsletter_mailchimp_api_key:"",somdn_newsletter_mailchimp_list_id:"",somdn_newsletter_mailchimp_doubleoptin:!1,somdn_newsletter_tags:""};function kh(){const e=Iy(),{values:t}=Je(),n=ce({somdn_newsletter_display_type:"3"}),s=ce({somdn_newsletter_lname:!0}),i=ce({somdn_newsletter_tel:!0}),o=ce({somdn_newsletter_company:!0}),r=ce({somdn_newsletter_website:!0}),a=t.somdn_capture_email_enable,d=t.somdn_capture_email_subscribe,c=a&&d&&d!=="0",u=d==="mailchimp";return c?l.jsxs("section",{className:"space-y-6",id:"newsletter",children:[l.jsx("h2",{className:"text-lg font-semibold dark:text-white",children:"Newsletter Settings"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"General settings for subscribing users to your newsletter."}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Display Settings"}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_newsletter_display_type",l.jsx(B,{title:"Display Type",description:"Choose how to let your users subscribe to your newsletter.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_newsletter_display_type",l.jsx(ot,{id:"somdn_newsletter_display_type",label:"Display Type",description:"Choose how to let your users subscribe to your newsletter.",help:`<p><strong>Checkbox with Text:</strong> Default. The user has to tick a box to subscribe and you can display some text.</p>
                   <p><strong>Required Checkbox with Text:</strong> The user is required to tick a box to subscribe/download and you can display some text.</p>
                   <p><strong>Text Only:</strong> Add a short line of text above the download button in the email capture window.</p>
                   <p><strong>None:</strong> When the user clicks download they will be subscribed. You might want to change your email capture window text to let them know.</p>
                   <p><em>Essentially only "Checkbox with Text" allows the user the option to subscribe. The others are forced.</em></p>`,options:[{label:"Checkbox with Text",value:"0"},{label:"Required Checkbox with Text",value:"3"},{label:"Text Only",value:"1"},{label:"None",value:"2"}],disabled:!e}))]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_newsletter_checkbox_error",l.jsx(B,{title:"Checkbox Error Message",description:"Customize the error message if the checkbox isn't selected.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_newsletter_checkbox_error",l.jsx(G,{id:"somdn_newsletter_checkbox_error",label:"Checkbox Error Message",description:"Customize the error message if the checkbox isn't selected.",help:"<p><strong>Default:</strong> You must select the checkbox to download</p><p><strong>Note:</strong> Only applies if Display Type is 'Required Checkbox with Text'.</p>",placeholder:"You must select the checkbox to download",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_newsletter_text",l.jsx(B,{title:"Newsletter Text",description:"Customize the 'Subscribe to our newsletter' text.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_newsletter_text",l.jsx(G,{id:"somdn_newsletter_text",label:"Newsletter Text",description:"Customize the 'Subscribe to our newsletter' text.",help:"<p><strong>Default:</strong> Subscribe to our newsletter</p><p><strong>Note:</strong> Only applies to 'Checkbox with Text' and 'Text Only' display options.</p>",placeholder:"Subscribe to our newsletter",disabled:!e}))]}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-8"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"First Name Field"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"First name is always required."}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_newsletter_fname_placeholder",l.jsx(B,{title:"First Name Placeholder",description:"Customize the first name input field placeholder.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_newsletter_fname_placeholder",l.jsx(G,{id:"somdn_newsletter_fname_placeholder",label:"First Name Placeholder",description:"Customize the first name input field placeholder.",help:"<p><strong>Default:</strong> Your first name...</p>",placeholder:"Your first name...",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_newsletter_fname_error",l.jsx(B,{title:"First Name Error",description:"Customize the error message if no first name entered.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_newsletter_fname_error",l.jsx(G,{id:"somdn_newsletter_fname_error",label:"First Name Error Message",description:"Customize the error message if no first name entered.",help:"<p><strong>Default:</strong> Please enter your first name</p>",placeholder:"Please enter your first name",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_newsletter_fname_email",l.jsx(B,{title:"Add to Email Notification",description:"Add first name to admin email notification.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_newsletter_fname_email",l.jsx(X,{id:"somdn_newsletter_fname_email",label:"Add to Admin Email Notification",description:"Add first name to admin email notification.",disabled:!e}))]}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-8"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Last Name Field"}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_newsletter_lname",l.jsx(B,{title:"Last Name Field",description:"Ask for the user's last name.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_newsletter_lname",l.jsx(X,{id:"somdn_newsletter_lname",label:"Ask for Last Name",description:"Ask for the user's last name. Once enabled you can customise the last name field settings.",disabled:!e}))]}),s&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_newsletter_lname_placeholder",l.jsx(B,{title:"Last Name Placeholder",description:"Customize the last name input field placeholder.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_newsletter_lname_placeholder",l.jsx(G,{id:"somdn_newsletter_lname_placeholder",label:"Last Name Placeholder",description:"Customize the last name input field placeholder.",help:"<p><strong>Default:</strong> Your last name...</p>",placeholder:"Your last name...",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_newsletter_lname_required",l.jsx(B,{title:"Make Last Name Required",description:"Make last name a required field.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_newsletter_lname_required",l.jsx(X,{id:"somdn_newsletter_lname_required",label:"Make Last Name Required",description:"Make last name a required field.",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_newsletter_lname_error",l.jsx(B,{title:"Last Name Error",description:"Customize the error message if no last name entered.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_newsletter_lname_error",l.jsx(G,{id:"somdn_newsletter_lname_error",label:"Last Name Error Message",description:"Customize the error message if no last name entered.",help:"<p><strong>Default:</strong> Please enter your last name</p><p><strong>Note:</strong> Only applies if last name is required.</p>",placeholder:"Please enter your last name",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_newsletter_lname_email",l.jsx(B,{title:"Add to Email Notification",description:"Add last name to admin email notification.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_newsletter_lname_email",l.jsx(X,{id:"somdn_newsletter_lname_email",label:"Add to Admin Email Notification",description:"Add last name to admin email notification.",disabled:!e}))]})]}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-8"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Telephone Field"}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_newsletter_tel",l.jsx(B,{title:"Telephone Field",description:"Ask for the user's telephone number.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_newsletter_tel",l.jsx(X,{id:"somdn_newsletter_tel",label:"Ask for Telephone Number",description:"Ask for the user's telephone number. Once enabled you can customise the telephone field settings.",disabled:!e}))]}),i&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_newsletter_tel_placeholder",l.jsx(B,{title:"Telephone Placeholder",description:"Customize the telephone input field placeholder.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_newsletter_tel_placeholder",l.jsx(G,{id:"somdn_newsletter_tel_placeholder",label:"Telephone Placeholder",description:"Customize the telephone input field placeholder.",help:"<p><strong>Default:</strong> Your telephone number...</p>",placeholder:"Your telephone number...",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_newsletter_tel_required",l.jsx(B,{title:"Make Telephone Required",description:"Make telephone number a required field.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_newsletter_tel_required",l.jsx(X,{id:"somdn_newsletter_tel_required",label:"Make Telephone Required",description:"Make telephone number a required field.",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_newsletter_tel_error",l.jsx(B,{title:"Telephone Error",description:"Customize the error message if no telephone number entered.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_newsletter_tel_error",l.jsx(G,{id:"somdn_newsletter_tel_error",label:"Telephone Error Message",description:"Customize the error message if no telephone number entered.",help:"<p><strong>Default:</strong> Please enter your telephone number</p><p><strong>Note:</strong> Only applies if telephone is required.</p>",placeholder:"Please enter your telephone number",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_newsletter_tel_email",l.jsx(B,{title:"Add to Email Notification",description:"Add telephone to admin email notification.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_newsletter_tel_email",l.jsx(X,{id:"somdn_newsletter_tel_email",label:"Add to Admin Email Notification",description:"Add telephone to admin email notification.",disabled:!e}))]})]}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-8"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Company Field"}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_newsletter_company",l.jsx(B,{title:"Company Field",description:"Ask for the user's company name.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_newsletter_company",l.jsx(X,{id:"somdn_newsletter_company",label:"Ask for Company Name",description:"Ask for the user's company name. Once enabled you can customise the company name field settings.",disabled:!e}))]}),o&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_newsletter_company_placeholder",l.jsx(B,{title:"Company Placeholder",description:"Customize the company name input field placeholder.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_newsletter_company_placeholder",l.jsx(G,{id:"somdn_newsletter_company_placeholder",label:"Company Placeholder",description:"Customize the company name input field placeholder.",help:"<p><strong>Default:</strong> Your company name...</p>",placeholder:"Your company name...",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_newsletter_company_required",l.jsx(B,{title:"Make Company Required",description:"Make company name a required field.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_newsletter_company_required",l.jsx(X,{id:"somdn_newsletter_company_required",label:"Make Company Name Required",description:"Make company name a required field.",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_newsletter_company_error",l.jsx(B,{title:"Company Error",description:"Customize the error message if no company name entered.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_newsletter_company_error",l.jsx(G,{id:"somdn_newsletter_company_error",label:"Company Error Message",description:"Customize the error message if no company name entered.",help:"<p><strong>Default:</strong> Please enter your company name</p><p><strong>Note:</strong> Only applies if company name is required.</p>",placeholder:"Please enter your company name",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_newsletter_company_email",l.jsx(B,{title:"Add to Email Notification",description:"Add company to admin email notification.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_newsletter_company_email",l.jsx(X,{id:"somdn_newsletter_company_email",label:"Add to Admin Email Notification",description:"Add company to admin email notification.",disabled:!e}))]})]}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-8"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Website Field"}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_newsletter_website",l.jsx(B,{title:"Website Field",description:"Ask for the user's website.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_newsletter_website",l.jsx(X,{id:"somdn_newsletter_website",label:"Ask for Website",description:"Ask for the user's website. Once enabled you can customise the website field settings.",disabled:!e}))]}),r&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_newsletter_website_placeholder",l.jsx(B,{title:"Website Placeholder",description:"Customize the website input field placeholder.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_newsletter_website_placeholder",l.jsx(G,{id:"somdn_newsletter_website_placeholder",label:"Website Placeholder",description:"Customize the website input field placeholder.",help:"<p><strong>Default:</strong> Your website...</p>",placeholder:"Your website...",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_newsletter_website_required",l.jsx(B,{title:"Make Website Required",description:"Make website a required field.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_newsletter_website_required",l.jsx(X,{id:"somdn_newsletter_website_required",label:"Make Website Required",description:"Make website a required field.",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_newsletter_website_error",l.jsx(B,{title:"Website Error",description:"Customize the error message if no website entered.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_newsletter_website_error",l.jsx(G,{id:"somdn_newsletter_website_error",label:"Website Error Message",description:"Customize the error message if no website entered.",help:"<p><strong>Default:</strong> Please enter your website</p><p><strong>Note:</strong> Only applies if website is required.</p>",placeholder:"Please enter your website",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_newsletter_website_email",l.jsx(B,{title:"Add to Email Notification",description:"Add website to admin email notification.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_newsletter_website_email",l.jsx(X,{id:"somdn_newsletter_website_email",label:"Add to Admin Email Notification",description:"Add website to admin email notification.",disabled:!e}))]})]}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-8"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Confirmations"}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_newsletter_confirmations",l.jsx(B,{title:"Subscription Confirmations",description:"Receive a confirmation email when a user downloads and subscribes.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_newsletter_confirmations",l.jsx(X,{id:"somdn_newsletter_confirmations",label:"Receive Confirmation Emails",description:"Receive a confirmation email when a user downloads and subscribes.",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_newsletter_confirmations_errors",l.jsx(B,{title:"Error Notifications",description:"Receive an email if a subscription generated an error.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_newsletter_confirmations_errors",l.jsx(X,{id:"somdn_newsletter_confirmations_errors",label:"Receive Error Notifications",description:"Receive an email if a subscription generated an error.",help:"<p><strong>Note:</strong> These kinds of errors are not displayed to the user.</p>",disabled:!e}))]}),u&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-8"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"MailChimp Settings"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Your MailChimp account and list settings."}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_mailchimp_api_key",l.jsx(B,{title:"MailChimp API Key",description:"Connect to your MailChimp account with your API key.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_mailchimp_api_key",l.jsx(G,{id:"somdn_newsletter_mailchimp_api_key",label:"API Key",description:"This connects to your MailChimp account.",help:`<p><strong>This connects to your MailChimp account.</strong></p>
                       <p><a href="https://kb.mailchimp.com/integrations/api-integrations/about-api-keys" target="_blank" rel="noopener noreferrer" class="text-blue-600 hover:underline dark:text-blue-400">Click here</a> to see how to obtain your MailChimp API key.</p>`,placeholder:"Enter your MailChimp API Key",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_mailchimp_list_id",l.jsx(B,{title:"MailChimp List ID",description:"The specific list you want people to be subscribed to.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_mailchimp_list_id",l.jsx(G,{id:"somdn_newsletter_mailchimp_list_id",label:"List ID",description:"This is the specific list you want people to be subscribed to.",help:`<p><strong>This is the specific list you want people to be subscribed to.</strong></p>
                       <p><a href="https://kb.mailchimp.com/lists/manage-contacts/find-your-list-id" target="_blank" rel="noopener noreferrer" class="text-blue-600 hover:underline dark:text-blue-400">Click here</a> to see how to obtain your MailChimp List ID.</p>`,placeholder:"Enter your MailChimp List ID",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_mailchimp_doubleoptin",l.jsx(B,{title:"Double Opt-In",description:"Enable if you use the 'double opt-in' subscriber setting in your list.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_mailchimp_doubleoptin",l.jsx(X,{id:"somdn_newsletter_mailchimp_doubleoptin",label:"Double Opt-In",description:"Tick if you use the 'double opt-in' subscriber setting in your list.",help:'<p>More info on double opt-in <a href="https://kb.mailchimp.com/lists/signup-forms/about-double-opt-in" target="_blank" rel="noopener noreferrer" class="text-blue-600 hover:underline dark:text-blue-400">here</a>.</p>',disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_mailchimp_tags",l.jsx(B,{title:"MailChimp Tags",description:"A list of tags to send to MailChimp, separated by a comma.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_mailchimp_tags",l.jsx(G,{id:"somdn_newsletter_tags",label:"Tags",description:"A list of tags to send to your selected subscription service, separated by a comma.",help:`<p><strong>Use the following to replace certain elements:</strong></p>
                       <p><code>{product_id}</code> - The product ID</p>
                       <p><code>{product_name}</code> - The product name</p>
                       <p><code>{variation_id}</code> - The variation ID (Will not be used if the download wasn't a variation)</p>
                       <p><code>{variation_name}</code> - The variation name (Will not be used if the download wasn't a variation)</p>
                       <p><strong>Example:</strong> Free Download, Product {product_id}, No Checkout</p>`,placeholder:"Free Download, Product {product_id}",disabled:!e}))]})]})]}):l.jsxs("section",{className:"space-y-6",id:"newsletter",children:[l.jsx("h2",{className:"text-lg font-semibold dark:text-white",children:"Newsletter Settings"}),l.jsx("div",{className:"rounded-md bg-amber-50 p-4 dark:bg-amber-900/20",children:l.jsxs("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:[l.jsx("strong",{children:"Note:"})," Newsletter settings are only available when"," ",l.jsx(ct,{settingId:"somdn_capture_email_enable",children:"Email Capture"})," and"," ",l.jsx(ct,{settingId:"somdn_capture_email_subscribe",children:"Newsletter Subscription"})," ","are enabled in Tracking settings."]})})]})}const jh=[{fieldId:"somdn_newsletter_display_type",label:"Newsletter Display Type",help:"Choose how to let your users subscribe to your newsletter.",sectionKey:"newsletter",pluginSlug:ae,keywords:["newsletter","display","type","checkbox","subscribe","pro"]},{fieldId:"somdn_newsletter_checkbox_error",label:"Checkbox Error Message",help:"Customize the error message if the checkbox is not selected.",sectionKey:"newsletter",pluginSlug:ae,keywords:["newsletter","checkbox","error","message","pro"]},{fieldId:"somdn_newsletter_text",label:"Newsletter Text",help:"Customize the subscribe to newsletter text.",sectionKey:"newsletter",pluginSlug:ae,keywords:["newsletter","text","subscribe","pro"]},{fieldId:"somdn_newsletter_fname_placeholder",label:"First Name Placeholder",help:"Customize the first name input field placeholder.",sectionKey:"newsletter",pluginSlug:ae,keywords:["newsletter","first","name","placeholder","pro"]},{fieldId:"somdn_newsletter_fname_error",label:"First Name Error",help:"Customize the error message if no first name entered.",sectionKey:"newsletter",pluginSlug:ae,keywords:["newsletter","first","name","error","pro"]},{fieldId:"somdn_newsletter_fname_email",label:"First Name in Email",help:"Add first name to admin email notification.",sectionKey:"newsletter",pluginSlug:ae,keywords:["newsletter","first","name","email","notification","pro"]},{fieldId:"somdn_newsletter_lname",label:"Ask for Last Name",help:"Ask for the users last name.",sectionKey:"newsletter",pluginSlug:ae,keywords:["newsletter","last","name","enable","pro"]},{fieldId:"somdn_newsletter_lname_placeholder",label:"Last Name Placeholder",help:"Customize the last name input field placeholder.",sectionKey:"newsletter",pluginSlug:ae,keywords:["newsletter","last","name","placeholder","pro"]},{fieldId:"somdn_newsletter_lname_required",label:"Last Name Required",help:"Make last name a required field.",sectionKey:"newsletter",pluginSlug:ae,keywords:["newsletter","last","name","required","pro"]},{fieldId:"somdn_newsletter_lname_error",label:"Last Name Error",help:"Customize the error message if no last name entered.",sectionKey:"newsletter",pluginSlug:ae,keywords:["newsletter","last","name","error","pro"]},{fieldId:"somdn_newsletter_lname_email",label:"Last Name in Email",help:"Add last name to admin email notification.",sectionKey:"newsletter",pluginSlug:ae,keywords:["newsletter","last","name","email","notification","pro"]},{fieldId:"somdn_newsletter_tel",label:"Ask for Telephone",help:"Ask for the users telephone number.",sectionKey:"newsletter",pluginSlug:ae,keywords:["newsletter","telephone","phone","enable","pro"]},{fieldId:"somdn_newsletter_tel_placeholder",label:"Telephone Placeholder",help:"Customize the telephone input field placeholder.",sectionKey:"newsletter",pluginSlug:ae,keywords:["newsletter","telephone","phone","placeholder","pro"]},{fieldId:"somdn_newsletter_tel_required",label:"Telephone Required",help:"Make telephone a required field.",sectionKey:"newsletter",pluginSlug:ae,keywords:["newsletter","telephone","phone","required","pro"]},{fieldId:"somdn_newsletter_tel_error",label:"Telephone Error",help:"Customize the error message if no telephone entered.",sectionKey:"newsletter",pluginSlug:ae,keywords:["newsletter","telephone","phone","error","pro"]},{fieldId:"somdn_newsletter_tel_email",label:"Telephone in Email",help:"Add telephone to admin email notification.",sectionKey:"newsletter",pluginSlug:ae,keywords:["newsletter","telephone","phone","email","notification","pro"]},{fieldId:"somdn_newsletter_company",label:"Ask for Company",help:"Ask for the users company name.",sectionKey:"newsletter",pluginSlug:ae,keywords:["newsletter","company","enable","pro"]},{fieldId:"somdn_newsletter_company_placeholder",label:"Company Placeholder",help:"Customize the company input field placeholder.",sectionKey:"newsletter",pluginSlug:ae,keywords:["newsletter","company","placeholder","pro"]},{fieldId:"somdn_newsletter_company_required",label:"Company Required",help:"Make company name a required field.",sectionKey:"newsletter",pluginSlug:ae,keywords:["newsletter","company","required","pro"]},{fieldId:"somdn_newsletter_company_error",label:"Company Error",help:"Customize the error message if no company entered.",sectionKey:"newsletter",pluginSlug:ae,keywords:["newsletter","company","error","pro"]},{fieldId:"somdn_newsletter_company_email",label:"Company in Email",help:"Add company to admin email notification.",sectionKey:"newsletter",pluginSlug:ae,keywords:["newsletter","company","email","notification","pro"]},{fieldId:"somdn_newsletter_website",label:"Ask for Website",help:"Ask for the users website.",sectionKey:"newsletter",pluginSlug:ae,keywords:["newsletter","website","enable","pro"]},{fieldId:"somdn_newsletter_website_placeholder",label:"Website Placeholder",help:"Customize the website input field placeholder.",sectionKey:"newsletter",pluginSlug:ae,keywords:["newsletter","website","placeholder","pro"]},{fieldId:"somdn_newsletter_website_required",label:"Website Required",help:"Make website a required field.",sectionKey:"newsletter",pluginSlug:ae,keywords:["newsletter","website","required","pro"]},{fieldId:"somdn_newsletter_website_error",label:"Website Error",help:"Customize the error message if no website entered.",sectionKey:"newsletter",pluginSlug:ae,keywords:["newsletter","website","error","pro"]},{fieldId:"somdn_newsletter_website_email",label:"Website in Email",help:"Add website to admin email notification.",sectionKey:"newsletter",pluginSlug:ae,keywords:["newsletter","website","email","notification","pro"]},{fieldId:"somdn_newsletter_confirmations",label:"Subscription Confirmations",help:"Receive a confirmation email when a user downloads and subscribes.",sectionKey:"newsletter",pluginSlug:ae,keywords:["newsletter","confirmation","email","subscribe","pro"]},{fieldId:"somdn_newsletter_confirmations_errors",label:"Error Notifications",help:"Receive an email if a subscription generated an error.",sectionKey:"newsletter",pluginSlug:ae,keywords:["newsletter","error","notification","subscribe","pro"]},{fieldId:"somdn_newsletter_mailchimp_api_key",label:"MailChimp API Key",help:"Your MailChimp API key to connect to your account.",sectionKey:"newsletter",pluginSlug:ae,keywords:["newsletter","mailchimp","api","key","pro"]},{fieldId:"somdn_newsletter_mailchimp_list_id",label:"MailChimp List ID",help:"The MailChimp list ID to subscribe users to.",sectionKey:"newsletter",pluginSlug:ae,keywords:["newsletter","mailchimp","list","id","pro"]},{fieldId:"somdn_newsletter_mailchimp_doubleoptin",label:"MailChimp Double Opt-In",help:"Enable double opt-in for MailChimp subscriptions.",sectionKey:"newsletter",pluginSlug:ae,keywords:["newsletter","mailchimp","double","optin","pro"]},{fieldId:"somdn_newsletter_tags",label:"Newsletter Tags",help:"Tags to send to your newsletter service.",sectionKey:"newsletter",pluginSlug:ae,keywords:["newsletter","mailchimp","tags","pro"]}],Ly=Object.freeze(Object.defineProperty({__proto__:null,NewsletterSettings:kh,mailchimpDefaults:vh,newsletterDefaults:yh,newsletterSettingsIndex:jh},Symbol.toStringTag,{value:"Module"})),_t="free-downloads-woocommerce",Ay=()=>{var e;return((e=window.somdn_settings)==null?void 0:e.is_pro)||!1},Nh={somdn_email_settings_sender_name:"",somdn_email_settings_sender_address:"",somdn_email_settings_content_type:"0",somdn_email_download_url_subject:"",somdn_email_download_url_heading:"",somdn_email_download_url_message:"",somdn_email_new_download_enable:!1,somdn_email_new_download_sendto:"",somdn_email_new_download_subject:"",somdn_email_new_download_heading:"",somdn_email_new_download_message:""};function Sh(){const e=Ay(),t=ce({somdn_email_new_download_enable:!0});return l.jsxs("section",{className:"space-y-6",id:"emails",children:[l.jsx("h2",{className:"text-lg font-semibold dark:text-white",children:"Email Settings"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Customise how this plugin sends emails to your customers."}),l.jsx("div",{className:"rounded-md bg-blue-50 p-4 dark:bg-blue-900/20 mb-6",children:l.jsxs("p",{className:"text-sm text-blue-700 dark:text-blue-300",children:[l.jsx("strong",{children:"Note:"})," Some default settings are taken from your WooCommerce email settings, and these can be overridden below."]})}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Global Email Settings"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Configure global sender details for all emails sent by this plugin."}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_email_sender_name",l.jsx(B,{title:"From Name",description:"Customize the name shown as the email sender.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_email_sender_name",l.jsx(G,{id:"somdn_email_settings_sender_name",label:"From Name",description:"Customize the name to be shown as the email sender.",help:"<p>Leave blank to use the default WooCommerce sender name.</p>",placeholder:"Your Store Name",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_email_sender_address",l.jsx(B,{title:"From Address",description:"Customize the email address to send from.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_email_sender_address",l.jsx(G,{id:"somdn_email_settings_sender_address",label:"From Address",description:"Customize the email address to send from.",help:"<p>Leave blank to use the default WooCommerce sender address.</p>",type:"email",placeholder:"store@example.com",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_email_content_type",l.jsx(B,{title:"Content Type",description:"Choose whether to send HTML or Plain Text emails.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_email_content_type",l.jsx(ot,{id:"somdn_email_settings_content_type",label:"Content Type",description:"By default emails are sent as HTML.",options:[{label:"HTML",value:"0"},{label:"Plain Text",value:"1"}],disabled:!e}))]}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-8"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Download Links Email"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"The email sent to users with their file download URL when this option is selected in your Download Delivery settings."}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_email_download_url_subject",l.jsx(B,{title:"Email Subject",description:"Customize the email subject line for download link emails.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_email_download_url_subject",l.jsx(G,{id:"somdn_email_download_url_subject",label:"Email Subject",description:"Customize the email subject line.",help:`<p><strong>Available placeholders:</strong></p>
                   <p><code>{site_name}</code> - The site name</p>
                   <p><code>{product}</code> - The product name</p>`,placeholder:"Your download from {site_name}",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_email_download_url_heading",l.jsx(B,{title:"Email Heading",description:"Customize the email heading text for download link emails.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_email_download_url_heading",l.jsx(G,{id:"somdn_email_download_url_heading",label:"Email Heading",description:"Customize the email heading text.",help:`<p><strong>Available placeholders:</strong></p>
                   <p><code>{site_name}</code> - The site name</p>
                   <p><code>{product}</code> - The product name</p>`,placeholder:"Your Download Link",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_email_download_url_message",l.jsx(B,{title:"Email Body",description:"Customize the email body content for download link emails.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_email_download_url_message",l.jsx(bt,{id:"somdn_email_download_url_message",label:"Email Body",description:"Customize the email body content.",help:`<p><strong>Available placeholders:</strong></p>
                   <p><code>{link}</code> - The download URL</p>
                   <p><code>{product}</code> - The product name</p>
                   <p><code>{username}</code> - The user's login username. Default is "Customer" if none found</p>
                   <p><code>{first_name}</code> - The user's first name. Default is "Customer" if none found</p>
                   <p><code>{site_name}</code> - The site name</p>
                   <p><code>{hours}</code> - Number of hours until link expires (number)</p>`,placeholder:"Hi {first_name}, here is your download link for {product}...",rows:6,disabled:!e}))]}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-8"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"New Free Downloads Email"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"The email sent to site admins when a new free download has been actioned. Disabled by default."}),l.jsx("div",{className:"rounded-md bg-amber-50 p-4 dark:bg-amber-900/20 mb-4",children:l.jsxs("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:[l.jsx("strong",{children:"Note:"})," This feature also requires"," ",l.jsx("a",{href:"#free-downloads-woocommerce/tracking",className:"underline hover:no-underline",children:"Download Tracking"})," ","to be enabled."]})}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_email_new_download_enable",l.jsx(B,{title:"Enable Email Notifications",description:"Receive an email every time a user downloads a free product.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_email_new_download_enable",l.jsx(X,{id:"somdn_email_new_download_enable",label:"Enable Email Notifications",description:"Receive an email every time a user downloads a free product.",disabled:!e}))]}),t&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_email_new_download_sendto",l.jsx(B,{title:"Email Recipients",description:"Customize who should receive the admin notification email.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_email_new_download_sendto",l.jsx(G,{id:"somdn_email_new_download_sendto",label:"Email Recipients",description:"Customize who should receive this email.",help:"<p>For multiple email addresses, separate each one by a comma and space. For example: a@b.com, c@d.com</p><p>Leave blank to use the default admin email.</p>",placeholder:"admin@example.com, manager@example.com",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_email_new_download_subject",l.jsx(B,{title:"Email Subject",description:"Customize the email subject line for admin notification emails.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_email_new_download_subject",l.jsx(G,{id:"somdn_email_new_download_subject",label:"Email Subject",description:"Customize the email subject line.",help:`<p><strong>Available placeholders:</strong></p>
                       <p><code>{site_name}</code> - The site name</p>
                       <p><code>{product}</code> - The product name</p>`,placeholder:"New Free Download on {site_name}",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_email_new_download_heading",l.jsx(B,{title:"Email Heading",description:"Customize the email heading text for admin notification emails.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_email_new_download_heading",l.jsx(G,{id:"somdn_email_new_download_heading",label:"Email Heading",description:"Customize the email heading text.",placeholder:"New Free Download",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:N("somdn_pro_badge_email_new_download_message",l.jsx(B,{title:"Email Body",description:"Customize the email body content for admin notification emails.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),N("somdn_pro_control_email_new_download_message",l.jsx(bt,{id:"somdn_email_new_download_message",label:"Email Body",description:"Customize the email body content.",help:`<p><strong>Available placeholders:</strong></p>
                       <p><code>{id}</code> - The download ID</p>
                       <p><code>{link}</code> - Link to the download log</p>
                       <p><code>{product}</code> - The product name</p>
                       <p><code>{username}</code> - The user's login username. Default is "Customer" if none found</p>
                       <p><code>{email}</code> - The user's email address. Default is blank if none found</p>
                       <p><code>{date}</code> - Date & time of the download</p>
                       <p><code>{site_name}</code> - The site name</p>`,placeholder:"A new free download has been recorded...",rows:6,disabled:!e}))]})]})]})}const Ch=[{fieldId:"somdn_email_settings_sender_name",label:"Email From Name",help:"Customize the name shown as the email sender.",sectionKey:"emails",pluginSlug:_t,keywords:["email","sender","from","name","pro"]},{fieldId:"somdn_email_settings_sender_address",label:"Email From Address",help:"Customize the email address to send from.",sectionKey:"emails",pluginSlug:_t,keywords:["email","sender","from","address","pro"]},{fieldId:"somdn_email_settings_content_type",label:"Email Content Type",help:"Choose whether to send HTML or Plain Text emails.",sectionKey:"emails",pluginSlug:_t,keywords:["email","content","type","html","plain","text","pro"]},{fieldId:"somdn_email_download_url_subject",label:"Download Email Subject",help:"Customize the email subject line for download link emails.",sectionKey:"emails",pluginSlug:_t,keywords:["email","download","link","subject","pro"]},{fieldId:"somdn_email_download_url_heading",label:"Download Email Heading",help:"Customize the email heading text for download link emails.",sectionKey:"emails",pluginSlug:_t,keywords:["email","download","link","heading","pro"]},{fieldId:"somdn_email_download_url_message",label:"Download Email Body",help:"Customize the email body content for download link emails.",sectionKey:"emails",pluginSlug:_t,keywords:["email","download","link","message","body","content","pro"]},{fieldId:"somdn_email_new_download_enable",label:"Enable New Download Notifications",help:"Receive an email every time a user downloads a free product.",sectionKey:"emails",pluginSlug:_t,keywords:["email","new","download","notification","enable","admin","pro"]},{fieldId:"somdn_email_new_download_sendto",label:"New Download Recipients",help:"Customize who should receive the admin notification email.",sectionKey:"emails",pluginSlug:_t,keywords:["email","new","download","recipient","sendto","admin","pro"]},{fieldId:"somdn_email_new_download_subject",label:"New Download Email Subject",help:"Customize the email subject line for admin notification emails.",sectionKey:"emails",pluginSlug:_t,keywords:["email","new","download","subject","admin","pro"]},{fieldId:"somdn_email_new_download_heading",label:"New Download Email Heading",help:"Customize the email heading text for admin notification emails.",sectionKey:"emails",pluginSlug:_t,keywords:["email","new","download","heading","admin","pro"]},{fieldId:"somdn_email_new_download_message",label:"New Download Email Body",help:"Customize the email body content for admin notification emails.",sectionKey:"emails",pluginSlug:_t,keywords:["email","new","download","message","body","content","admin","pro"]}],Fy=Object.freeze(Object.defineProperty({__proto__:null,EmailsSettings:Sh,emailsDefaults:Nh,emailsSettingsIndex:Ch},Symbol.toStringTag,{value:"Module"}));function Mh({className:e,level:t=1,...n}){let s=`h${t}`;return l.jsx(s,{...n,className:ue(e,"text-2xl/8 font-semibold text-neutral-950 sm:text-xl/8 dark:text-white")})}/*!
 * @kurkle/color v0.3.4
 * https://github.com/kurkle/color#readme
 * (c) 2024 Jukka Kurkela
 * Released under the MIT License
 */function ni(e){return e+.5|0}const ln=(e,t,n)=>Math.max(Math.min(e,n),t);function si(e){return ln(ni(e*2.55),0,255)}function dn(e){return ln(ni(e*255),0,255)}function Rt(e){return ln(ni(e/2.55)/100,0,1)}function Th(e){return ln(ni(e*100),0,100)}const ut={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Ea=[..."0123456789ABCDEF"],zy=e=>Ea[e&15],Wy=e=>Ea[(e&240)>>4]+Ea[e&15],So=e=>(e&240)>>4===(e&15),By=e=>So(e.r)&&So(e.g)&&So(e.b)&&So(e.a);function Hy(e){var t=e.length,n;return e[0]==="#"&&(t===4||t===5?n={r:255&ut[e[1]]*17,g:255&ut[e[2]]*17,b:255&ut[e[3]]*17,a:t===5?ut[e[4]]*17:255}:(t===7||t===9)&&(n={r:ut[e[1]]<<4|ut[e[2]],g:ut[e[3]]<<4|ut[e[4]],b:ut[e[5]]<<4|ut[e[6]],a:t===9?ut[e[7]]<<4|ut[e[8]]:255})),n}const Vy=(e,t)=>e<255?t(e):"";function Ry(e){var t=By(e)?zy:Wy;return e?"#"+t(e.r)+t(e.g)+t(e.b)+Vy(e.a,t):void 0}const $y=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Ph(e,t,n){const s=t*Math.min(n,1-n),i=(o,r=(o+e/30)%12)=>n-s*Math.max(Math.min(r-3,9-r,1),-1);return[i(0),i(8),i(4)]}function Uy(e,t,n){const s=(i,o=(i+e/60)%6)=>n-n*t*Math.max(Math.min(o,4-o,1),0);return[s(5),s(3),s(1)]}function qy(e,t,n){const s=Ph(e,1,.5);let i;for(t+n>1&&(i=1/(t+n),t*=i,n*=i),i=0;i<3;i++)s[i]*=1-t-n,s[i]+=t;return s}function Yy(e,t,n,s,i){return e===i?(t-n)/s+(t<n?6:0):t===i?(n-e)/s+2:(e-t)/s+4}function Da(e){const n=e.r/255,s=e.g/255,i=e.b/255,o=Math.max(n,s,i),r=Math.min(n,s,i),a=(o+r)/2;let d,c,u;return o!==r&&(u=o-r,c=a>.5?u/(2-o-r):u/(o+r),d=Yy(n,s,i,u,o),d=d*60+.5),[d|0,c||0,a]}function Oa(e,t,n,s){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,n,s)).map(dn)}function Ia(e,t,n){return Oa(Ph,e,t,n)}function Ky(e,t,n){return Oa(qy,e,t,n)}function Gy(e,t,n){return Oa(Uy,e,t,n)}function Eh(e){return(e%360+360)%360}function Xy(e){const t=$y.exec(e);let n=255,s;if(!t)return;t[5]!==s&&(n=t[6]?si(+t[5]):dn(+t[5]));const i=Eh(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?s=Ky(i,o,r):t[1]==="hsv"?s=Gy(i,o,r):s=Ia(i,o,r),{r:s[0],g:s[1],b:s[2],a:n}}function Qy(e,t){var n=Da(e);n[0]=Eh(n[0]+t),n=Ia(n),e.r=n[0],e.g=n[1],e.b=n[2]}function Zy(e){if(!e)return;const t=Da(e),n=t[0],s=Th(t[1]),i=Th(t[2]);return e.a<255?`hsla(${n}, ${s}%, ${i}%, ${Rt(e.a)})`:`hsl(${n}, ${s}%, ${i}%)`}const Dh={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Oh={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function Jy(){const e={},t=Object.keys(Oh),n=Object.keys(Dh);let s,i,o,r,a;for(s=0;s<t.length;s++){for(r=a=t[s],i=0;i<n.length;i++)o=n[i],a=a.replace(o,Dh[o]);o=parseInt(Oh[r],16),e[a]=[o>>16&255,o>>8&255,o&255]}return e}let Co;function ev(e){Co||(Co=Jy(),Co.transparent=[0,0,0,0]);const t=Co[e.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const tv=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function nv(e){const t=tv.exec(e);let n=255,s,i,o;if(t){if(t[7]!==s){const r=+t[7];n=t[8]?si(r):ln(r*255,0,255)}return s=+t[1],i=+t[3],o=+t[5],s=255&(t[2]?si(s):ln(s,0,255)),i=255&(t[4]?si(i):ln(i,0,255)),o=255&(t[6]?si(o):ln(o,0,255)),{r:s,g:i,b:o,a:n}}}function sv(e){return e&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${Rt(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`)}const La=e=>e<=.0031308?e*12.92:Math.pow(e,1/2.4)*1.055-.055,hs=e=>e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4);function iv(e,t,n){const s=hs(Rt(e.r)),i=hs(Rt(e.g)),o=hs(Rt(e.b));return{r:dn(La(s+n*(hs(Rt(t.r))-s))),g:dn(La(i+n*(hs(Rt(t.g))-i))),b:dn(La(o+n*(hs(Rt(t.b))-o))),a:e.a+n*(t.a-e.a)}}function Mo(e,t,n){if(e){let s=Da(e);s[t]=Math.max(0,Math.min(s[t]+s[t]*n,t===0?360:1)),s=Ia(s),e.r=s[0],e.g=s[1],e.b=s[2]}}function Ih(e,t){return e&&Object.assign(t||{},e)}function Lh(e){var t={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(t={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(t.a=dn(e[3]))):(t=Ih(e,{r:0,g:0,b:0,a:1}),t.a=dn(t.a)),t}function ov(e){return e.charAt(0)==="r"?nv(e):Xy(e)}class ii{constructor(t){if(t instanceof ii)return t;const n=typeof t;let s;n==="object"?s=Lh(t):n==="string"&&(s=Hy(t)||ev(t)||ov(t)),this._rgb=s,this._valid=!!s}get valid(){return this._valid}get rgb(){var t=Ih(this._rgb);return t&&(t.a=Rt(t.a)),t}set rgb(t){this._rgb=Lh(t)}rgbString(){return this._valid?sv(this._rgb):void 0}hexString(){return this._valid?Ry(this._rgb):void 0}hslString(){return this._valid?Zy(this._rgb):void 0}mix(t,n){if(t){const s=this.rgb,i=t.rgb;let o;const r=n===o?.5:n,a=2*r-1,d=s.a-i.a,c=((a*d===-1?a:(a+d)/(1+a*d))+1)/2;o=1-c,s.r=255&c*s.r+o*i.r+.5,s.g=255&c*s.g+o*i.g+.5,s.b=255&c*s.b+o*i.b+.5,s.a=r*s.a+(1-r)*i.a,this.rgb=s}return this}interpolate(t,n){return t&&(this._rgb=iv(this._rgb,t._rgb,n)),this}clone(){return new ii(this.rgb)}alpha(t){return this._rgb.a=dn(t),this}clearer(t){const n=this._rgb;return n.a*=1-t,this}greyscale(){const t=this._rgb,n=ni(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=n,this}opaquer(t){const n=this._rgb;return n.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return Mo(this._rgb,2,t),this}darken(t){return Mo(this._rgb,2,-t),this}saturate(t){return Mo(this._rgb,1,t),this}desaturate(t){return Mo(this._rgb,1,-t),this}rotate(t){return Qy(this._rgb,t),this}}/*!
 * Chart.js v4.5.1
 * https://www.chartjs.org
 * (c) 2025 Chart.js Contributors
 * Released under the MIT License
 */function $t(){}const rv=(()=>{let e=0;return()=>e++})();function oe(e){return e==null}function ge(e){if(Array.isArray&&Array.isArray(e))return!0;const t=Object.prototype.toString.call(e);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function ie(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function ve(e){return(typeof e=="number"||e instanceof Number)&&isFinite(+e)}function rt(e,t){return ve(e)?e:t}function te(e,t){return typeof e>"u"?t:e}const av=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100:+e/t,Ah=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100*t:+e;function pe(e,t,n){if(e&&typeof e.call=="function")return e.apply(n,t)}function he(e,t,n,s){let i,o,r;if(ge(e))if(o=e.length,s)for(i=o-1;i>=0;i--)t.call(n,e[i],i);else for(i=0;i<o;i++)t.call(n,e[i],i);else if(ie(e))for(r=Object.keys(e),o=r.length,i=0;i<o;i++)t.call(n,e[r[i]],r[i])}function To(e,t){let n,s,i,o;if(!e||!t||e.length!==t.length)return!1;for(n=0,s=e.length;n<s;++n)if(i=e[n],o=t[n],i.datasetIndex!==o.datasetIndex||i.index!==o.index)return!1;return!0}function Po(e){if(ge(e))return e.map(Po);if(ie(e)){const t=Object.create(null),n=Object.keys(e),s=n.length;let i=0;for(;i<s;++i)t[n[i]]=Po(e[n[i]]);return t}return e}function Fh(e){return["__proto__","prototype","constructor"].indexOf(e)===-1}function lv(e,t,n,s){if(!Fh(e))return;const i=t[e],o=n[e];ie(i)&&ie(o)?oi(i,o,s):t[e]=Po(o)}function oi(e,t,n){const s=ge(t)?t:[t],i=s.length;if(!ie(e))return e;n=n||{};const o=n.merger||lv;let r;for(let a=0;a<i;++a){if(r=s[a],!ie(r))continue;const d=Object.keys(r);for(let c=0,u=d.length;c<u;++c)o(d[c],e,r,n)}return e}function ri(e,t){return oi(e,t,{merger:dv})}function dv(e,t,n){if(!Fh(e))return;const s=t[e],i=n[e];ie(s)&&ie(i)?ri(s,i):Object.prototype.hasOwnProperty.call(t,e)||(t[e]=Po(i))}const zh={"":e=>e,x:e=>e.x,y:e=>e.y};function cv(e){const t=e.split("."),n=[];let s="";for(const i of t)s+=i,s.endsWith("\\")?s=s.slice(0,-1)+".":(n.push(s),s="");return n}function uv(e){const t=cv(e);return n=>{for(const s of t){if(s==="")break;n=n&&n[s]}return n}}function Tn(e,t){return(zh[t]||(zh[t]=uv(t)))(e)}function Aa(e){return e.charAt(0).toUpperCase()+e.slice(1)}const ai=e=>typeof e<"u",cn=e=>typeof e=="function",Wh=(e,t)=>{if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0};function hv(e){return e.type==="mouseup"||e.type==="click"||e.type==="contextmenu"}const le=Math.PI,be=2*le,fv=be+le,Eo=Number.POSITIVE_INFINITY,mv=le/180,Ce=le/2,Pn=le/4,Bh=le*2/3,un=Math.log10,Pt=Math.sign;function li(e,t,n){return Math.abs(e-t)<n}function Hh(e){const t=Math.round(e);e=li(e,t,e/1e3)?t:e;const n=Math.pow(10,Math.floor(un(e))),s=e/n;return(s<=1?1:s<=2?2:s<=5?5:10)*n}function pv(e){const t=[],n=Math.sqrt(e);let s;for(s=1;s<n;s++)e%s===0&&(t.push(s),t.push(e/s));return n===(n|0)&&t.push(n),t.sort((i,o)=>i-o).pop(),t}function gv(e){return typeof e=="symbol"||typeof e=="object"&&e!==null&&!(Symbol.toPrimitive in e||"toString"in e||"valueOf"in e)}function di(e){return!gv(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function bv(e,t){const n=Math.round(e);return n-t<=e&&n+t>=e}function Vh(e,t,n){let s,i,o;for(s=0,i=e.length;s<i;s++)o=e[s][n],isNaN(o)||(t.min=Math.min(t.min,o),t.max=Math.max(t.max,o))}function Et(e){return e*(le/180)}function Fa(e){return e*(180/le)}function Rh(e){if(!ve(e))return;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n++;return n}function $h(e,t){const n=t.x-e.x,s=t.y-e.y,i=Math.sqrt(n*n+s*s);let o=Math.atan2(s,n);return o<-.5*le&&(o+=be),{angle:o,distance:i}}function za(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function xv(e,t){return(e-t+fv)%be-le}function $e(e){return(e%be+be)%be}function ci(e,t,n,s){const i=$e(e),o=$e(t),r=$e(n),a=$e(o-i),d=$e(r-i),c=$e(i-o),u=$e(i-r);return i===o||i===r||s&&o===r||a>d&&c<u}function Ue(e,t,n){return Math.max(t,Math.min(n,e))}function wv(e){return Ue(e,-32768,32767)}function Ut(e,t,n,s=1e-6){return e>=Math.min(t,n)-s&&e<=Math.max(t,n)+s}function Wa(e,t,n){n=n||(r=>e[r]<t);let s=e.length-1,i=0,o;for(;s-i>1;)o=i+s>>1,n(o)?i=o:s=o;return{lo:i,hi:s}}const En=(e,t,n,s)=>Wa(e,n,s?i=>{const o=e[i][t];return o<n||o===n&&e[i+1][t]===n}:i=>e[i][t]<n),_v=(e,t,n)=>Wa(e,n,s=>e[s][t]>=n);function yv(e,t,n){let s=0,i=e.length;for(;s<i&&e[s]<t;)s++;for(;i>s&&e[i-1]>n;)i--;return s>0||i<e.length?e.slice(s,i):e}const Uh=["push","pop","shift","splice","unshift"];function vv(e,t){if(e._chartjs){e._chartjs.listeners.push(t);return}Object.defineProperty(e,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),Uh.forEach(n=>{const s="_onData"+Aa(n),i=e[n];Object.defineProperty(e,n,{configurable:!0,enumerable:!1,value(...o){const r=i.apply(this,o);return e._chartjs.listeners.forEach(a=>{typeof a[s]=="function"&&a[s](...o)}),r}})})}function qh(e,t){const n=e._chartjs;if(!n)return;const s=n.listeners,i=s.indexOf(t);i!==-1&&s.splice(i,1),!(s.length>0)&&(Uh.forEach(o=>{delete e[o]}),delete e._chartjs)}function Yh(e){const t=new Set(e);return t.size===e.length?e:Array.from(t)}const Kh=function(){return typeof window>"u"?function(e){return e()}:window.requestAnimationFrame}();function Gh(e,t){let n=[],s=!1;return function(...i){n=i,s||(s=!0,Kh.call(window,()=>{s=!1,e.apply(t,n)}))}}function kv(e,t){let n;return function(...s){return t?(clearTimeout(n),n=setTimeout(e,t,s)):e.apply(this,s),t}}const Ba=e=>e==="start"?"left":e==="end"?"right":"center",qe=(e,t,n)=>e==="start"?t:e==="end"?n:(t+n)/2,jv=(e,t,n,s)=>e===(s?"left":"right")?n:e==="center"?(t+n)/2:t;function Nv(e,t,n){const s=t.length;let i=0,o=s;if(e._sorted){const{iScale:r,vScale:a,_parsed:d}=e,c=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null,u=r.axis,{min:h,max:f,minDefined:m,maxDefined:p}=r.getUserBounds();if(m){if(i=Math.min(En(d,u,h).lo,n?s:En(t,u,r.getPixelForValue(h)).lo),c){const b=d.slice(0,i+1).reverse().findIndex(x=>!oe(x[a.axis]));i-=Math.max(0,b)}i=Ue(i,0,s-1)}if(p){let b=Math.max(En(d,r.axis,f,!0).hi+1,n?0:En(t,u,r.getPixelForValue(f),!0).hi+1);if(c){const x=d.slice(b-1).findIndex(w=>!oe(w[a.axis]));b+=Math.max(0,x)}o=Ue(b,i,s)-i}else o=s-i}return{start:i,count:o}}function Sv(e){const{xScale:t,yScale:n,_scaleRanges:s}=e,i={xmin:t.min,xmax:t.max,ymin:n.min,ymax:n.max};if(!s)return e._scaleRanges=i,!0;const o=s.xmin!==t.min||s.xmax!==t.max||s.ymin!==n.min||s.ymax!==n.max;return Object.assign(s,i),o}const Do=e=>e===0||e===1,Xh=(e,t,n)=>-(Math.pow(2,10*(e-=1))*Math.sin((e-t)*be/n)),Qh=(e,t,n)=>Math.pow(2,-10*e)*Math.sin((e-t)*be/n)+1,ui={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>(e-=1)*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-((e-=1)*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>(e-=1)*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*Ce)+1,easeOutSine:e=>Math.sin(e*Ce),easeInOutSine:e=>-.5*(Math.cos(le*e)-1),easeInExpo:e=>e===0?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>e===1?1:-Math.pow(2,-10*e)+1,easeInOutExpo:e=>Do(e)?e:e<.5?.5*Math.pow(2,10*(e*2-1)):.5*(-Math.pow(2,-10*(e*2-1))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-(e-=1)*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>Do(e)?e:Xh(e,.075,.3),easeOutElastic:e=>Do(e)?e:Qh(e,.075,.3),easeInOutElastic(e){return Do(e)?e:e<.5?.5*Xh(e*2,.1125,.45):.5+.5*Qh(e*2-1,.1125,.45)},easeInBack(e){return e*e*((1.70158+1)*e-1.70158)},easeOutBack(e){return(e-=1)*e*((1.70158+1)*e+1.70158)+1},easeInOutBack(e){let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},easeInBounce:e=>1-ui.easeOutBounce(1-e),easeOutBounce(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},easeInOutBounce:e=>e<.5?ui.easeInBounce(e*2)*.5:ui.easeOutBounce(e*2-1)*.5+.5};function Ha(e){if(e&&typeof e=="object"){const t=e.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function Zh(e){return Ha(e)?e:new ii(e)}function Va(e){return Ha(e)?e:new ii(e).saturate(.5).darken(.1).hexString()}const Cv=["x","y","borderWidth","radius","tension"],Mv=["color","borderColor","backgroundColor"];function Tv(e){e.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),e.set("animations",{colors:{type:"color",properties:Mv},numbers:{type:"number",properties:Cv}}),e.describe("animations",{_fallback:"animation"}),e.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function Pv(e){e.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const Jh=new Map;function Ev(e,t){t=t||{};const n=e+JSON.stringify(t);let s=Jh.get(n);return s||(s=new Intl.NumberFormat(e,t),Jh.set(n,s)),s}function Oo(e,t,n){return Ev(t,n).format(e)}const ef={values(e){return ge(e)?e:""+e},numeric(e,t,n){if(e===0)return"0";const s=this.chart.options.locale;let i,o=e;if(n.length>1){const c=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(c<1e-4||c>1e15)&&(i="scientific"),o=Dv(e,n)}const r=un(Math.abs(o)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),d={notation:i,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(d,this.options.ticks.format),Oo(e,s,d)},logarithmic(e,t,n){if(e===0)return"0";const s=n[t].significand||e/Math.pow(10,Math.floor(un(e)));return[1,2,3,5,10,15].includes(s)||t>.8*n.length?ef.numeric.call(this,e,t,n):""}};function Dv(e,t){let n=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(n)>=1&&e!==Math.floor(e)&&(n=e-Math.floor(e)),n}var Io={formatters:ef};function Ov(e){e.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,n)=>n.lineWidth,tickColor:(t,n)=>n.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Io.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),e.route("scale.ticks","color","","color"),e.route("scale.grid","color","","borderColor"),e.route("scale.border","color","","borderColor"),e.route("scale.title","color","","color"),e.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),e.describe("scales",{_fallback:"scale"}),e.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const Dn=Object.create(null),Ra=Object.create(null);function hi(e,t){if(!t)return e;const n=t.split(".");for(let s=0,i=n.length;s<i;++s){const o=n[s];e=e[o]||(e[o]=Object.create(null))}return e}function $a(e,t,n){return typeof t=="string"?oi(hi(e,t),n):oi(hi(e,""),t)}class Iv{constructor(t,n){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=s=>s.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(s,i)=>Va(i.backgroundColor),this.hoverBorderColor=(s,i)=>Va(i.borderColor),this.hoverColor=(s,i)=>Va(i.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(n)}set(t,n){return $a(this,t,n)}get(t){return hi(this,t)}describe(t,n){return $a(Ra,t,n)}override(t,n){return $a(Dn,t,n)}route(t,n,s,i){const o=hi(this,t),r=hi(this,s),a="_"+n;Object.defineProperties(o,{[a]:{value:o[n],writable:!0},[n]:{enumerable:!0,get(){const d=this[a],c=r[i];return ie(d)?Object.assign({},c,d):te(d,c)},set(d){this[a]=d}}})}apply(t){t.forEach(n=>n(this))}}var ke=new Iv({_scriptable:e=>!e.startsWith("on"),_indexable:e=>e!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Tv,Pv,Ov]);function Lv(e){return!e||oe(e.size)||oe(e.family)?null:(e.style?e.style+" ":"")+(e.weight?e.weight+" ":"")+e.size+"px "+e.family}function Lo(e,t,n,s,i){let o=t[i];return o||(o=t[i]=e.measureText(i).width,n.push(i)),o>s&&(s=o),s}function Av(e,t,n,s){s=s||{};let i=s.data=s.data||{},o=s.garbageCollect=s.garbageCollect||[];s.font!==t&&(i=s.data={},o=s.garbageCollect=[],s.font=t),e.save(),e.font=t;let r=0;const a=n.length;let d,c,u,h,f;for(d=0;d<a;d++)if(h=n[d],h!=null&&!ge(h))r=Lo(e,i,o,r,h);else if(ge(h))for(c=0,u=h.length;c<u;c++)f=h[c],f!=null&&!ge(f)&&(r=Lo(e,i,o,r,f));e.restore();const m=o.length/2;if(m>n.length){for(d=0;d<m;d++)delete i[o[d]];o.splice(0,m)}return r}function On(e,t,n){const s=e.currentDevicePixelRatio,i=n!==0?Math.max(n/2,.5):0;return Math.round((t-i)*s)/s+i}function tf(e,t){!t&&!e||(t=t||e.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,e.width,e.height),t.restore())}function Ua(e,t,n,s){nf(e,t,n,s,null)}function nf(e,t,n,s,i){let o,r,a,d,c,u,h,f;const m=t.pointStyle,p=t.rotation,b=t.radius;let x=(p||0)*mv;if(m&&typeof m=="object"&&(o=m.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){e.save(),e.translate(n,s),e.rotate(x),e.drawImage(m,-m.width/2,-m.height/2,m.width,m.height),e.restore();return}if(!(isNaN(b)||b<=0)){switch(e.beginPath(),m){default:i?e.ellipse(n,s,i/2,b,0,0,be):e.arc(n,s,b,0,be),e.closePath();break;case"triangle":u=i?i/2:b,e.moveTo(n+Math.sin(x)*u,s-Math.cos(x)*b),x+=Bh,e.lineTo(n+Math.sin(x)*u,s-Math.cos(x)*b),x+=Bh,e.lineTo(n+Math.sin(x)*u,s-Math.cos(x)*b),e.closePath();break;case"rectRounded":c=b*.516,d=b-c,r=Math.cos(x+Pn)*d,h=Math.cos(x+Pn)*(i?i/2-c:d),a=Math.sin(x+Pn)*d,f=Math.sin(x+Pn)*(i?i/2-c:d),e.arc(n-h,s-a,c,x-le,x-Ce),e.arc(n+f,s-r,c,x-Ce,x),e.arc(n+h,s+a,c,x,x+Ce),e.arc(n-f,s+r,c,x+Ce,x+le),e.closePath();break;case"rect":if(!p){d=Math.SQRT1_2*b,u=i?i/2:d,e.rect(n-u,s-d,2*u,2*d);break}x+=Pn;case"rectRot":h=Math.cos(x)*(i?i/2:b),r=Math.cos(x)*b,a=Math.sin(x)*b,f=Math.sin(x)*(i?i/2:b),e.moveTo(n-h,s-a),e.lineTo(n+f,s-r),e.lineTo(n+h,s+a),e.lineTo(n-f,s+r),e.closePath();break;case"crossRot":x+=Pn;case"cross":h=Math.cos(x)*(i?i/2:b),r=Math.cos(x)*b,a=Math.sin(x)*b,f=Math.sin(x)*(i?i/2:b),e.moveTo(n-h,s-a),e.lineTo(n+h,s+a),e.moveTo(n+f,s-r),e.lineTo(n-f,s+r);break;case"star":h=Math.cos(x)*(i?i/2:b),r=Math.cos(x)*b,a=Math.sin(x)*b,f=Math.sin(x)*(i?i/2:b),e.moveTo(n-h,s-a),e.lineTo(n+h,s+a),e.moveTo(n+f,s-r),e.lineTo(n-f,s+r),x+=Pn,h=Math.cos(x)*(i?i/2:b),r=Math.cos(x)*b,a=Math.sin(x)*b,f=Math.sin(x)*(i?i/2:b),e.moveTo(n-h,s-a),e.lineTo(n+h,s+a),e.moveTo(n+f,s-r),e.lineTo(n-f,s+r);break;case"line":r=i?i/2:Math.cos(x)*b,a=Math.sin(x)*b,e.moveTo(n-r,s-a),e.lineTo(n+r,s+a);break;case"dash":e.moveTo(n,s),e.lineTo(n+Math.cos(x)*(i?i/2:b),s+Math.sin(x)*b);break;case!1:e.closePath();break}e.fill(),t.borderWidth>0&&e.stroke()}}function qt(e,t,n){return n=n||.5,!t||e&&e.x>t.left-n&&e.x<t.right+n&&e.y>t.top-n&&e.y<t.bottom+n}function Ao(e,t){e.save(),e.beginPath(),e.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),e.clip()}function Fo(e){e.restore()}function Fv(e,t,n,s,i){if(!t)return e.lineTo(n.x,n.y);if(i==="middle"){const o=(t.x+n.x)/2;e.lineTo(o,t.y),e.lineTo(o,n.y)}else i==="after"!=!!s?e.lineTo(t.x,n.y):e.lineTo(n.x,t.y);e.lineTo(n.x,n.y)}function zv(e,t,n,s){if(!t)return e.lineTo(n.x,n.y);e.bezierCurveTo(s?t.cp1x:t.cp2x,s?t.cp1y:t.cp2y,s?n.cp2x:n.cp1x,s?n.cp2y:n.cp1y,n.x,n.y)}function Wv(e,t){t.translation&&e.translate(t.translation[0],t.translation[1]),oe(t.rotation)||e.rotate(t.rotation),t.color&&(e.fillStyle=t.color),t.textAlign&&(e.textAlign=t.textAlign),t.textBaseline&&(e.textBaseline=t.textBaseline)}function Bv(e,t,n,s,i){if(i.strikethrough||i.underline){const o=e.measureText(s),r=t-o.actualBoundingBoxLeft,a=t+o.actualBoundingBoxRight,d=n-o.actualBoundingBoxAscent,c=n+o.actualBoundingBoxDescent,u=i.strikethrough?(d+c)/2:c;e.strokeStyle=e.fillStyle,e.beginPath(),e.lineWidth=i.decorationWidth||2,e.moveTo(r,u),e.lineTo(a,u),e.stroke()}}function Hv(e,t){const n=e.fillStyle;e.fillStyle=t.color,e.fillRect(t.left,t.top,t.width,t.height),e.fillStyle=n}function In(e,t,n,s,i,o={}){const r=ge(t)?t:[t],a=o.strokeWidth>0&&o.strokeColor!=="";let d,c;for(e.save(),e.font=i.string,Wv(e,o),d=0;d<r.length;++d)c=r[d],o.backdrop&&Hv(e,o.backdrop),a&&(o.strokeColor&&(e.strokeStyle=o.strokeColor),oe(o.strokeWidth)||(e.lineWidth=o.strokeWidth),e.strokeText(c,n,s,o.maxWidth)),e.fillText(c,n,s,o.maxWidth),Bv(e,n,s,c,o),s+=Number(i.lineHeight);e.restore()}function fi(e,t){const{x:n,y:s,w:i,h:o,radius:r}=t;e.arc(n+r.topLeft,s+r.topLeft,r.topLeft,1.5*le,le,!0),e.lineTo(n,s+o-r.bottomLeft),e.arc(n+r.bottomLeft,s+o-r.bottomLeft,r.bottomLeft,le,Ce,!0),e.lineTo(n+i-r.bottomRight,s+o),e.arc(n+i-r.bottomRight,s+o-r.bottomRight,r.bottomRight,Ce,0,!0),e.lineTo(n+i,s+r.topRight),e.arc(n+i-r.topRight,s+r.topRight,r.topRight,0,-Ce,!0),e.lineTo(n+r.topLeft,s)}const Vv=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Rv=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function $v(e,t){const n=(""+e).match(Vv);if(!n||n[1]==="normal")return t*1.2;switch(e=+n[2],n[3]){case"px":return e;case"%":e/=100;break}return t*e}const Uv=e=>+e||0;function qa(e,t){const n={},s=ie(t),i=s?Object.keys(t):t,o=ie(e)?s?r=>te(e[r],e[t[r]]):r=>e[r]:()=>e;for(const r of i)n[r]=Uv(o(r));return n}function sf(e){return qa(e,{top:"y",right:"x",bottom:"y",left:"x"})}function Ln(e){return qa(e,["topLeft","topRight","bottomLeft","bottomRight"])}function Ye(e){const t=sf(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function De(e,t){e=e||{},t=t||ke.font;let n=te(e.size,t.size);typeof n=="string"&&(n=parseInt(n,10));let s=te(e.style,t.style);s&&!(""+s).match(Rv)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);const i={family:te(e.family,t.family),lineHeight:$v(te(e.lineHeight,t.lineHeight),n),size:n,style:s,weight:te(e.weight,t.weight),string:""};return i.string=Lv(i),i}function zo(e,t,n,s){let i=!0,o,r,a;for(o=0,r=e.length;o<r;++o)if(a=e[o],a!==void 0&&(t!==void 0&&typeof a=="function"&&(a=a(t),i=!1),n!==void 0&&ge(a)&&(a=a[n%a.length],i=!1),a!==void 0))return s&&!i&&(s.cacheable=!1),a}function qv(e,t,n){const{min:s,max:i}=e,o=Ah(t,(i-s)/2),r=(a,d)=>n&&a===0?0:a+d;return{min:r(s,-Math.abs(o)),max:r(i,o)}}function hn(e,t){return Object.assign(Object.create(e),t)}function Ya(e,t=[""],n,s,i=()=>e[0]){const o=n||e;typeof s>"u"&&(s=df("_fallback",e));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:e,_rootScopes:o,_fallback:s,_getTarget:i,override:a=>Ya([a,...e],t,o,s)};return new Proxy(r,{deleteProperty(a,d){return delete a[d],delete a._keys,delete e[0][d],!0},get(a,d){return rf(a,d,()=>ek(d,t,e,a))},getOwnPropertyDescriptor(a,d){return Reflect.getOwnPropertyDescriptor(a._scopes[0],d)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(a,d){return cf(a).includes(d)},ownKeys(a){return cf(a)},set(a,d,c){const u=a._storage||(a._storage=i());return a[d]=u[d]=c,delete a._keys,!0}})}function fs(e,t,n,s){const i={_cacheable:!1,_proxy:e,_context:t,_subProxy:n,_stack:new Set,_descriptors:of(e,s),setContext:o=>fs(e,o,n,s),override:o=>fs(e.override(o),t,n,s)};return new Proxy(i,{deleteProperty(o,r){return delete o[r],delete e[r],!0},get(o,r,a){return rf(o,r,()=>Kv(o,r,a))},getOwnPropertyDescriptor(o,r){return o._descriptors.allKeys?Reflect.has(e,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,r)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(o,r){return Reflect.has(e,r)},ownKeys(){return Reflect.ownKeys(e)},set(o,r,a){return e[r]=a,delete o[r],!0}})}function of(e,t={scriptable:!0,indexable:!0}){const{_scriptable:n=t.scriptable,_indexable:s=t.indexable,_allKeys:i=t.allKeys}=e;return{allKeys:i,scriptable:n,indexable:s,isScriptable:cn(n)?n:()=>n,isIndexable:cn(s)?s:()=>s}}const Yv=(e,t)=>e?e+Aa(t):t,Ka=(e,t)=>ie(t)&&e!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function rf(e,t,n){if(Object.prototype.hasOwnProperty.call(e,t)||t==="constructor")return e[t];const s=n();return e[t]=s,s}function Kv(e,t,n){const{_proxy:s,_context:i,_subProxy:o,_descriptors:r}=e;let a=s[t];return cn(a)&&r.isScriptable(t)&&(a=Gv(t,a,e,n)),ge(a)&&a.length&&(a=Xv(t,a,e,r.isIndexable)),Ka(t,a)&&(a=fs(a,i,o&&o[t],r)),a}function Gv(e,t,n,s){const{_proxy:i,_context:o,_subProxy:r,_stack:a}=n;if(a.has(e))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+e);a.add(e);let d=t(o,r||s);return a.delete(e),Ka(e,d)&&(d=Ga(i._scopes,i,e,d)),d}function Xv(e,t,n,s){const{_proxy:i,_context:o,_subProxy:r,_descriptors:a}=n;if(typeof o.index<"u"&&s(e))return t[o.index%t.length];if(ie(t[0])){const d=t,c=i._scopes.filter(u=>u!==d);t=[];for(const u of d){const h=Ga(c,i,e,u);t.push(fs(h,o,r&&r[e],a))}}return t}function af(e,t,n){return cn(e)?e(t,n):e}const Qv=(e,t)=>e===!0?t:typeof e=="string"?Tn(t,e):void 0;function Zv(e,t,n,s,i){for(const o of t){const r=Qv(n,o);if(r){e.add(r);const a=af(r._fallback,n,i);if(typeof a<"u"&&a!==n&&a!==s)return a}else if(r===!1&&typeof s<"u"&&n!==s)return null}return!1}function Ga(e,t,n,s){const i=t._rootScopes,o=af(t._fallback,n,s),r=[...e,...i],a=new Set;a.add(s);let d=lf(a,r,n,o||n,s);return d===null||typeof o<"u"&&o!==n&&(d=lf(a,r,o,d,s),d===null)?!1:Ya(Array.from(a),[""],i,o,()=>Jv(t,n,s))}function lf(e,t,n,s,i){for(;n;)n=Zv(e,t,n,s,i);return n}function Jv(e,t,n){const s=e._getTarget();t in s||(s[t]={});const i=s[t];return ge(i)&&ie(n)?n:i||{}}function ek(e,t,n,s){let i;for(const o of t)if(i=df(Yv(o,e),n),typeof i<"u")return Ka(e,i)?Ga(n,s,e,i):i}function df(e,t){for(const n of t){if(!n)continue;const s=n[e];if(typeof s<"u")return s}}function cf(e){let t=e._keys;return t||(t=e._keys=tk(e._scopes)),t}function tk(e){const t=new Set;for(const n of e)for(const s of Object.keys(n).filter(i=>!i.startsWith("_")))t.add(s);return Array.from(t)}const nk=Number.EPSILON||1e-14,ms=(e,t)=>t<e.length&&!e[t].skip&&e[t],uf=e=>e==="x"?"y":"x";function sk(e,t,n,s){const i=e.skip?t:e,o=t,r=n.skip?t:n,a=za(o,i),d=za(r,o);let c=a/(a+d),u=d/(a+d);c=isNaN(c)?0:c,u=isNaN(u)?0:u;const h=s*c,f=s*u;return{previous:{x:o.x-h*(r.x-i.x),y:o.y-h*(r.y-i.y)},next:{x:o.x+f*(r.x-i.x),y:o.y+f*(r.y-i.y)}}}function ik(e,t,n){const s=e.length;let i,o,r,a,d,c=ms(e,0);for(let u=0;u<s-1;++u)if(d=c,c=ms(e,u+1),!(!d||!c)){if(li(t[u],0,nk)){n[u]=n[u+1]=0;continue}i=n[u]/t[u],o=n[u+1]/t[u],a=Math.pow(i,2)+Math.pow(o,2),!(a<=9)&&(r=3/Math.sqrt(a),n[u]=i*r*t[u],n[u+1]=o*r*t[u])}}function ok(e,t,n="x"){const s=uf(n),i=e.length;let o,r,a,d=ms(e,0);for(let c=0;c<i;++c){if(r=a,a=d,d=ms(e,c+1),!a)continue;const u=a[n],h=a[s];r&&(o=(u-r[n])/3,a[`cp1${n}`]=u-o,a[`cp1${s}`]=h-o*t[c]),d&&(o=(d[n]-u)/3,a[`cp2${n}`]=u+o,a[`cp2${s}`]=h+o*t[c])}}function rk(e,t="x"){const n=uf(t),s=e.length,i=Array(s).fill(0),o=Array(s);let r,a,d,c=ms(e,0);for(r=0;r<s;++r)if(a=d,d=c,c=ms(e,r+1),!!d){if(c){const u=c[t]-d[t];i[r]=u!==0?(c[n]-d[n])/u:0}o[r]=a?c?Pt(i[r-1])!==Pt(i[r])?0:(i[r-1]+i[r])/2:i[r-1]:i[r]}ik(e,i,o),ok(e,o,t)}function Wo(e,t,n){return Math.max(Math.min(e,n),t)}function ak(e,t){let n,s,i,o,r,a=qt(e[0],t);for(n=0,s=e.length;n<s;++n)r=o,o=a,a=n<s-1&&qt(e[n+1],t),o&&(i=e[n],r&&(i.cp1x=Wo(i.cp1x,t.left,t.right),i.cp1y=Wo(i.cp1y,t.top,t.bottom)),a&&(i.cp2x=Wo(i.cp2x,t.left,t.right),i.cp2y=Wo(i.cp2y,t.top,t.bottom)))}function lk(e,t,n,s,i){let o,r,a,d;if(t.spanGaps&&(e=e.filter(c=>!c.skip)),t.cubicInterpolationMode==="monotone")rk(e,i);else{let c=s?e[e.length-1]:e[0];for(o=0,r=e.length;o<r;++o)a=e[o],d=sk(c,a,e[Math.min(o+1,r-(s?0:1))%r],t.tension),a.cp1x=d.previous.x,a.cp1y=d.previous.y,a.cp2x=d.next.x,a.cp2y=d.next.y,c=a}t.capBezierPoints&&ak(e,n)}function Xa(){return typeof window<"u"&&typeof document<"u"}function Qa(e){let t=e.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function Bo(e,t,n){let s;return typeof e=="string"?(s=parseInt(e,10),e.indexOf("%")!==-1&&(s=s/100*t.parentNode[n])):s=e,s}const Ho=e=>e.ownerDocument.defaultView.getComputedStyle(e,null);function dk(e,t){return Ho(e).getPropertyValue(t)}const ck=["top","right","bottom","left"];function An(e,t,n){const s={};n=n?"-"+n:"";for(let i=0;i<4;i++){const o=ck[i];s[o]=parseFloat(e[t+"-"+o+n])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}const uk=(e,t,n)=>(e>0||t>0)&&(!n||!n.shadowRoot);function hk(e,t){const n=e.touches,s=n&&n.length?n[0]:e,{offsetX:i,offsetY:o}=s;let r=!1,a,d;if(uk(i,o,e.target))a=i,d=o;else{const c=t.getBoundingClientRect();a=s.clientX-c.left,d=s.clientY-c.top,r=!0}return{x:a,y:d,box:r}}function Fn(e,t){if("native"in e)return e;const{canvas:n,currentDevicePixelRatio:s}=t,i=Ho(n),o=i.boxSizing==="border-box",r=An(i,"padding"),a=An(i,"border","width"),{x:d,y:c,box:u}=hk(e,n),h=r.left+(u&&a.left),f=r.top+(u&&a.top);let{width:m,height:p}=t;return o&&(m-=r.width+a.width,p-=r.height+a.height),{x:Math.round((d-h)/m*n.width/s),y:Math.round((c-f)/p*n.height/s)}}function fk(e,t,n){let s,i;if(t===void 0||n===void 0){const o=e&&Qa(e);if(!o)t=e.clientWidth,n=e.clientHeight;else{const r=o.getBoundingClientRect(),a=Ho(o),d=An(a,"border","width"),c=An(a,"padding");t=r.width-c.width-d.width,n=r.height-c.height-d.height,s=Bo(a.maxWidth,o,"clientWidth"),i=Bo(a.maxHeight,o,"clientHeight")}}return{width:t,height:n,maxWidth:s||Eo,maxHeight:i||Eo}}const fn=e=>Math.round(e*10)/10;function mk(e,t,n,s){const i=Ho(e),o=An(i,"margin"),r=Bo(i.maxWidth,e,"clientWidth")||Eo,a=Bo(i.maxHeight,e,"clientHeight")||Eo,d=fk(e,t,n);let{width:c,height:u}=d;if(i.boxSizing==="content-box"){const f=An(i,"border","width"),m=An(i,"padding");c-=m.width+f.width,u-=m.height+f.height}return c=Math.max(0,c-o.width),u=Math.max(0,s?c/s:u-o.height),c=fn(Math.min(c,r,d.maxWidth)),u=fn(Math.min(u,a,d.maxHeight)),c&&!u&&(u=fn(c/2)),(t!==void 0||n!==void 0)&&s&&d.height&&u>d.height&&(u=d.height,c=fn(Math.floor(u*s))),{width:c,height:u}}function hf(e,t,n){const s=t||1,i=fn(e.height*s),o=fn(e.width*s);e.height=fn(e.height),e.width=fn(e.width);const r=e.canvas;return r.style&&(n||!r.style.height&&!r.style.width)&&(r.style.height=`${e.height}px`,r.style.width=`${e.width}px`),e.currentDevicePixelRatio!==s||r.height!==i||r.width!==o?(e.currentDevicePixelRatio=s,r.height=i,r.width=o,e.ctx.setTransform(s,0,0,s,0,0),!0):!1}const pk=function(){let e=!1;try{const t={get passive(){return e=!0,!1}};Xa()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return e}();function ff(e,t){const n=dk(e,t),s=n&&n.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function zn(e,t,n,s){return{x:e.x+n*(t.x-e.x),y:e.y+n*(t.y-e.y)}}function gk(e,t,n,s){return{x:e.x+n*(t.x-e.x),y:s==="middle"?n<.5?e.y:t.y:s==="after"?n<1?e.y:t.y:n>0?t.y:e.y}}function bk(e,t,n,s){const i={x:e.cp2x,y:e.cp2y},o={x:t.cp1x,y:t.cp1y},r=zn(e,i,n),a=zn(i,o,n),d=zn(o,t,n),c=zn(r,a,n),u=zn(a,d,n);return zn(c,u,n)}const xk=function(e,t){return{x(n){return e+e+t-n},setWidth(n){t=n},textAlign(n){return n==="center"?n:n==="right"?"left":"right"},xPlus(n,s){return n-s},leftForLtr(n,s){return n-s}}},wk=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,t){return e+t},leftForLtr(e,t){return e}}};function ps(e,t,n){return e?xk(t,n):wk()}function mf(e,t){let n,s;(t==="ltr"||t==="rtl")&&(n=e.canvas.style,s=[n.getPropertyValue("direction"),n.getPropertyPriority("direction")],n.setProperty("direction",t,"important"),e.prevTextDirection=s)}function pf(e,t){t!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty("direction",t[0],t[1]))}function gf(e){return e==="angle"?{between:ci,compare:xv,normalize:$e}:{between:Ut,compare:(t,n)=>t-n,normalize:t=>t}}function bf({start:e,end:t,count:n,loop:s,style:i}){return{start:e%n,end:t%n,loop:s&&(t-e+1)%n===0,style:i}}function _k(e,t,n){const{property:s,start:i,end:o}=n,{between:r,normalize:a}=gf(s),d=t.length;let{start:c,end:u,loop:h}=e,f,m;if(h){for(c+=d,u+=d,f=0,m=d;f<m&&r(a(t[c%d][s]),i,o);++f)c--,u--;c%=d,u%=d}return u<c&&(u+=d),{start:c,end:u,loop:h,style:e.style}}function xf(e,t,n){if(!n)return[e];const{property:s,start:i,end:o}=n,r=t.length,{compare:a,between:d,normalize:c}=gf(s),{start:u,end:h,loop:f,style:m}=_k(e,t,n),p=[];let b=!1,x=null,w,_,y;const v=()=>d(i,y,w)&&a(i,y)!==0,j=()=>a(o,w)===0||d(o,y,w),k=()=>b||v(),C=()=>!b||j();for(let S=u,T=u;S<=h;++S)_=t[S%r],!_.skip&&(w=c(_[s]),w!==y&&(b=d(w,i,o),x===null&&k()&&(x=a(w,i)===0?S:T),x!==null&&C()&&(p.push(bf({start:x,end:S,loop:f,count:r,style:m})),x=null),T=S,y=w));return x!==null&&p.push(bf({start:x,end:h,loop:f,count:r,style:m})),p}function wf(e,t){const n=[],s=e.segments;for(let i=0;i<s.length;i++){const o=xf(s[i],e.points,t);o.length&&n.push(...o)}return n}function yk(e,t,n,s){let i=0,o=t-1;if(n&&!s)for(;i<t&&!e[i].skip;)i++;for(;i<t&&e[i].skip;)i++;for(i%=t,n&&(o+=i);o>i&&e[o%t].skip;)o--;return o%=t,{start:i,end:o}}function vk(e,t,n,s){const i=e.length,o=[];let r=t,a=e[t],d;for(d=t+1;d<=n;++d){const c=e[d%i];c.skip||c.stop?a.skip||(s=!1,o.push({start:t%i,end:(d-1)%i,loop:s}),t=r=c.stop?d:null):(r=d,a.skip&&(t=d)),a=c}return r!==null&&o.push({start:t%i,end:r%i,loop:s}),o}function kk(e,t){const n=e.points,s=e.options.spanGaps,i=n.length;if(!i)return[];const o=!!e._loop,{start:r,end:a}=yk(n,i,o,s);if(s===!0)return _f(e,[{start:r,end:a,loop:o}],n,t);const d=a<r?a+i:a,c=!!e._fullLoop&&r===0&&a===i-1;return _f(e,vk(n,r,d,c),n,t)}function _f(e,t,n,s){return!s||!s.setContext||!n?t:jk(e,t,n,s)}function jk(e,t,n,s){const i=e._chart.getContext(),o=yf(e.options),{_datasetIndex:r,options:{spanGaps:a}}=e,d=n.length,c=[];let u=o,h=t[0].start,f=h;function m(p,b,x,w){const _=a?-1:1;if(p!==b){for(p+=d;n[p%d].skip;)p-=_;for(;n[b%d].skip;)b+=_;p%d!==b%d&&(c.push({start:p%d,end:b%d,loop:x,style:w}),u=w,h=b%d)}}for(const p of t){h=a?h:p.start;let b=n[h%d],x;for(f=h+1;f<=p.end;f++){const w=n[f%d];x=yf(s.setContext(hn(i,{type:"segment",p0:b,p1:w,p0DataIndex:(f-1)%d,p1DataIndex:f%d,datasetIndex:r}))),Nk(x,u)&&m(h,f-1,p.loop,u),b=w,u=x}h<f-1&&m(h,f-1,p.loop,u)}return c}function yf(e){return{backgroundColor:e.backgroundColor,borderCapStyle:e.borderCapStyle,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderJoinStyle:e.borderJoinStyle,borderWidth:e.borderWidth,borderColor:e.borderColor}}function Nk(e,t){if(!t)return!1;const n=[],s=function(i,o){return Ha(o)?(n.includes(o)||n.push(o),n.indexOf(o)):o};return JSON.stringify(e,s)!==JSON.stringify(t,s)}function Vo(e,t,n){return e.options.clip?e[n]:t[n]}function Sk(e,t){const{xScale:n,yScale:s}=e;return n&&s?{left:Vo(n,t,"left"),right:Vo(n,t,"right"),top:Vo(s,t,"top"),bottom:Vo(s,t,"bottom")}:t}function vf(e,t){const n=t._clip;if(n.disabled)return!1;const s=Sk(t,e.chartArea);return{left:n.left===!1?0:s.left-(n.left===!0?0:n.left),right:n.right===!1?e.width:s.right+(n.right===!0?0:n.right),top:n.top===!1?0:s.top-(n.top===!0?0:n.top),bottom:n.bottom===!1?e.height:s.bottom+(n.bottom===!0?0:n.bottom)}}/*!
 * Chart.js v4.5.1
 * https://www.chartjs.org
 * (c) 2025 Chart.js Contributors
 * Released under the MIT License
 */class Ck{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,n,s,i){const o=n.listeners[i],r=n.duration;o.forEach(a=>a({chart:t,initial:n.initial,numSteps:r,currentStep:Math.min(s-n.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=Kh.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let n=0;this._charts.forEach((s,i)=>{if(!s.running||!s.items.length)return;const o=s.items;let r=o.length-1,a=!1,d;for(;r>=0;--r)d=o[r],d._active?(d._total>s.duration&&(s.duration=d._total),d.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(i.draw(),this._notify(i,s,t,"progress")),o.length||(s.running=!1,this._notify(i,s,t,"complete"),s.initial=!1),n+=o.length}),this._lastDate=t,n===0&&(this._running=!1)}_getAnims(t){const n=this._charts;let s=n.get(t);return s||(s={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(t,s)),s}listen(t,n,s){this._getAnims(t).listeners[n].push(s)}add(t,n){!n||!n.length||this._getAnims(t).items.push(...n)}has(t){return this._getAnims(t).items.length>0}start(t){const n=this._charts.get(t);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((s,i)=>Math.max(s,i._duration),0),this._refresh())}running(t){if(!this._running)return!1;const n=this._charts.get(t);return!(!n||!n.running||!n.items.length)}stop(t){const n=this._charts.get(t);if(!n||!n.items.length)return;const s=n.items;let i=s.length-1;for(;i>=0;--i)s[i].cancel();n.items=[],this._notify(t,n,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var Yt=new Ck;const kf="transparent",Mk={boolean(e,t,n){return n>.5?t:e},color(e,t,n){const s=Zh(e||kf),i=s.valid&&Zh(t||kf);return i&&i.valid?i.mix(s,n).hexString():t},number(e,t,n){return e+(t-e)*n}};class Tk{constructor(t,n,s,i){const o=n[s];i=zo([t.to,i,o,t.from]);const r=zo([t.from,o,i]);this._active=!0,this._fn=t.fn||Mk[t.type||typeof r],this._easing=ui[t.easing]||ui.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=n,this._prop=s,this._from=r,this._to=i,this._promises=void 0}active(){return this._active}update(t,n,s){if(this._active){this._notify(!1);const i=this._target[this._prop],o=s-this._start,r=this._duration-o;this._start=s,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=zo([t.to,n,i,t.from]),this._from=zo([t.from,i,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const n=t-this._start,s=this._duration,i=this._prop,o=this._from,r=this._loop,a=this._to;let d;if(this._active=o!==a&&(r||n<s),!this._active){this._target[i]=a,this._notify(!0);return}if(n<0){this._target[i]=o;return}d=n/s%2,d=r&&d>1?2-d:d,d=this._easing(Math.min(1,Math.max(0,d))),this._target[i]=this._fn(o,a,d)}wait(){const t=this._promises||(this._promises=[]);return new Promise((n,s)=>{t.push({res:n,rej:s})})}_notify(t){const n=t?"res":"rej",s=this._promises||[];for(let i=0;i<s.length;i++)s[i][n]()}}class jf{constructor(t,n){this._chart=t,this._properties=new Map,this.configure(n)}configure(t){if(!ie(t))return;const n=Object.keys(ke.animation),s=this._properties;Object.getOwnPropertyNames(t).forEach(i=>{const o=t[i];if(!ie(o))return;const r={};for(const a of n)r[a]=o[a];(ge(o.properties)&&o.properties||[i]).forEach(a=>{(a===i||!s.has(a))&&s.set(a,r)})})}_animateOptions(t,n){const s=n.options,i=Ek(t,s);if(!i)return[];const o=this._createAnimations(i,s);return s.$shared&&Pk(t.options.$animations,s).then(()=>{t.options=s},()=>{}),o}_createAnimations(t,n){const s=this._properties,i=[],o=t.$animations||(t.$animations={}),r=Object.keys(n),a=Date.now();let d;for(d=r.length-1;d>=0;--d){const c=r[d];if(c.charAt(0)==="$")continue;if(c==="options"){i.push(...this._animateOptions(t,n));continue}const u=n[c];let h=o[c];const f=s.get(c);if(h)if(f&&h.active()){h.update(f,u,a);continue}else h.cancel();if(!f||!f.duration){t[c]=u;continue}o[c]=h=new Tk(f,t,c,u),i.push(h)}return i}update(t,n){if(this._properties.size===0){Object.assign(t,n);return}const s=this._createAnimations(t,n);if(s.length)return Yt.add(this._chart,s),!0}}function Pk(e,t){const n=[],s=Object.keys(t);for(let i=0;i<s.length;i++){const o=e[s[i]];o&&o.active()&&n.push(o.wait())}return Promise.all(n)}function Ek(e,t){if(!t)return;let n=e.options;if(!n){e.options=t;return}return n.$shared&&(e.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n}function Nf(e,t){const n=e&&e.options||{},s=n.reverse,i=n.min===void 0?t:0,o=n.max===void 0?t:0;return{start:s?o:i,end:s?i:o}}function Dk(e,t,n){if(n===!1)return!1;const s=Nf(e,n),i=Nf(t,n);return{top:i.end,right:s.end,bottom:i.start,left:s.start}}function Ok(e){let t,n,s,i;return ie(e)?(t=e.top,n=e.right,s=e.bottom,i=e.left):t=n=s=i=e,{top:t,right:n,bottom:s,left:i,disabled:e===!1}}function Sf(e,t){const n=[],s=e._getSortedDatasetMetas(t);let i,o;for(i=0,o=s.length;i<o;++i)n.push(s[i].index);return n}function Cf(e,t,n,s={}){const i=e.keys,o=s.mode==="single";let r,a,d,c;if(t===null)return;let u=!1;for(r=0,a=i.length;r<a;++r){if(d=+i[r],d===n){if(u=!0,s.all)continue;break}c=e.values[d],ve(c)&&(o||t===0||Pt(t)===Pt(c))&&(t+=c)}return!u&&!s.all?0:t}function Ik(e,t){const{iScale:n,vScale:s}=t,i=n.axis==="x"?"x":"y",o=s.axis==="x"?"x":"y",r=Object.keys(e),a=new Array(r.length);let d,c,u;for(d=0,c=r.length;d<c;++d)u=r[d],a[d]={[i]:u,[o]:e[u]};return a}function Za(e,t){const n=e&&e.options.stacked;return n||n===void 0&&t.stack!==void 0}function Lk(e,t,n){return`${e.id}.${t.id}.${n.stack||n.type}`}function Ak(e){const{min:t,max:n,minDefined:s,maxDefined:i}=e.getUserBounds();return{min:s?t:Number.NEGATIVE_INFINITY,max:i?n:Number.POSITIVE_INFINITY}}function Fk(e,t,n){const s=e[t]||(e[t]={});return s[n]||(s[n]={})}function Mf(e,t,n,s){for(const i of t.getMatchingVisibleMetas(s).reverse()){const o=e[i.index];if(n&&o>0||!n&&o<0)return i.index}return null}function Tf(e,t){const{chart:n,_cachedMeta:s}=e,i=n._stacks||(n._stacks={}),{iScale:o,vScale:r,index:a}=s,d=o.axis,c=r.axis,u=Lk(o,r,s),h=t.length;let f;for(let m=0;m<h;++m){const p=t[m],{[d]:b,[c]:x}=p,w=p._stacks||(p._stacks={});f=w[c]=Fk(i,u,b),f[a]=x,f._top=Mf(f,r,!0,s.type),f._bottom=Mf(f,r,!1,s.type);const _=f._visualValues||(f._visualValues={});_[a]=x}}function Ja(e,t){const n=e.scales;return Object.keys(n).filter(s=>n[s].axis===t).shift()}function zk(e,t){return hn(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function Wk(e,t,n){return hn(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function mi(e,t){const n=e.controller.index,s=e.vScale&&e.vScale.axis;if(s){t=t||e._parsed;for(const i of t){const o=i._stacks;if(!o||o[s]===void 0||o[s][n]===void 0)return;delete o[s][n],o[s]._visualValues!==void 0&&o[s]._visualValues[n]!==void 0&&delete o[s]._visualValues[n]}}}const el=e=>e==="reset"||e==="none",Pf=(e,t)=>t?e:Object.assign({},e),Bk=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:Sf(n,!0),values:null};class Wn{constructor(t,n){this.chart=t,this._ctx=t.ctx,this.index=n,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Za(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&mi(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,n=this._cachedMeta,s=this.getDataset(),i=(h,f,m,p)=>h==="x"?f:h==="r"?p:m,o=n.xAxisID=te(s.xAxisID,Ja(t,"x")),r=n.yAxisID=te(s.yAxisID,Ja(t,"y")),a=n.rAxisID=te(s.rAxisID,Ja(t,"r")),d=n.indexAxis,c=n.iAxisID=i(d,o,r,a),u=n.vAxisID=i(d,r,o,a);n.xScale=this.getScaleForId(o),n.yScale=this.getScaleForId(r),n.rScale=this.getScaleForId(a),n.iScale=this.getScaleForId(c),n.vScale=this.getScaleForId(u)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const n=this._cachedMeta;return t===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&qh(this._data,this),t._stacked&&mi(t)}_dataCheck(){const t=this.getDataset(),n=t.data||(t.data=[]),s=this._data;if(ie(n)){const i=this._cachedMeta;this._data=Ik(n,i)}else if(s!==n){if(s){qh(s,this);const i=this._cachedMeta;mi(i),i._parsed=[]}n&&Object.isExtensible(n)&&vv(n,this),this._syncList=[],this._data=n}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const n=this._cachedMeta,s=this.getDataset();let i=!1;this._dataCheck();const o=n._stacked;n._stacked=Za(n.vScale,n),n.stack!==s.stack&&(i=!0,mi(n),n.stack=s.stack),this._resyncElements(t),(i||o!==n._stacked)&&(Tf(this,n._parsed),n._stacked=Za(n.vScale,n))}configure(){const t=this.chart.config,n=t.datasetScopeKeys(this._type),s=t.getOptionScopes(this.getDataset(),n,!0);this.options=t.createResolver(s,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,n){const{_cachedMeta:s,_data:i}=this,{iScale:o,_stacked:r}=s,a=o.axis;let d=t===0&&n===i.length?!0:s._sorted,c=t>0&&s._parsed[t-1],u,h,f;if(this._parsing===!1)s._parsed=i,s._sorted=!0,f=i;else{ge(i[t])?f=this.parseArrayData(s,i,t,n):ie(i[t])?f=this.parseObjectData(s,i,t,n):f=this.parsePrimitiveData(s,i,t,n);const m=()=>h[a]===null||c&&h[a]<c[a];for(u=0;u<n;++u)s._parsed[u+t]=h=f[u],d&&(m()&&(d=!1),c=h);s._sorted=d}r&&Tf(this,f)}parsePrimitiveData(t,n,s,i){const{iScale:o,vScale:r}=t,a=o.axis,d=r.axis,c=o.getLabels(),u=o===r,h=new Array(i);let f,m,p;for(f=0,m=i;f<m;++f)p=f+s,h[f]={[a]:u||o.parse(c[p],p),[d]:r.parse(n[p],p)};return h}parseArrayData(t,n,s,i){const{xScale:o,yScale:r}=t,a=new Array(i);let d,c,u,h;for(d=0,c=i;d<c;++d)u=d+s,h=n[u],a[d]={x:o.parse(h[0],u),y:r.parse(h[1],u)};return a}parseObjectData(t,n,s,i){const{xScale:o,yScale:r}=t,{xAxisKey:a="x",yAxisKey:d="y"}=this._parsing,c=new Array(i);let u,h,f,m;for(u=0,h=i;u<h;++u)f=u+s,m=n[f],c[u]={x:o.parse(Tn(m,a),f),y:r.parse(Tn(m,d),f)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,n,s){const i=this.chart,o=this._cachedMeta,r=n[t.axis],a={keys:Sf(i,!0),values:n._stacks[t.axis]._visualValues};return Cf(a,r,o.index,{mode:s})}updateRangeFromParsed(t,n,s,i){const o=s[n.axis];let r=o===null?NaN:o;const a=i&&s._stacks[n.axis];i&&a&&(i.values=a,r=Cf(i,o,this._cachedMeta.index)),t.min=Math.min(t.min,r),t.max=Math.max(t.max,r)}getMinMax(t,n){const s=this._cachedMeta,i=s._parsed,o=s._sorted&&t===s.iScale,r=i.length,a=this._getOtherScale(t),d=Bk(n,s,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:h}=Ak(a);let f,m;function p(){m=i[f];const b=m[a.axis];return!ve(m[t.axis])||u>b||h<b}for(f=0;f<r&&!(!p()&&(this.updateRangeFromParsed(c,t,m,d),o));++f);if(o){for(f=r-1;f>=0;--f)if(!p()){this.updateRangeFromParsed(c,t,m,d);break}}return c}getAllParsedValues(t){const n=this._cachedMeta._parsed,s=[];let i,o,r;for(i=0,o=n.length;i<o;++i)r=n[i][t.axis],ve(r)&&s.push(r);return s}getMaxOverflow(){return!1}getLabelAndValue(t){const n=this._cachedMeta,s=n.iScale,i=n.vScale,o=this.getParsed(t);return{label:s?""+s.getLabelForValue(o[s.axis]):"",value:i?""+i.getLabelForValue(o[i.axis]):""}}_update(t){const n=this._cachedMeta;this.update(t||"default"),n._clip=Ok(te(this.options.clip,Dk(n.xScale,n.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,n=this.chart,s=this._cachedMeta,i=s.data||[],o=n.chartArea,r=[],a=this._drawStart||0,d=this._drawCount||i.length-a,c=this.options.drawActiveElementsOnTop;let u;for(s.dataset&&s.dataset.draw(t,o,a,d),u=a;u<a+d;++u){const h=i[u];h.hidden||(h.active&&c?r.push(h):h.draw(t,o))}for(u=0;u<r.length;++u)r[u].draw(t,o)}getStyle(t,n){const s=n?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(s):this.resolveDataElementOptions(t||0,s)}getContext(t,n,s){const i=this.getDataset();let o;if(t>=0&&t<this._cachedMeta.data.length){const r=this._cachedMeta.data[t];o=r.$context||(r.$context=Wk(this.getContext(),t,r)),o.parsed=this.getParsed(t),o.raw=i.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=zk(this.chart.getContext(),this.index)),o.dataset=i,o.index=o.datasetIndex=this.index;return o.active=!!n,o.mode=s,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,n){return this._resolveElementOptions(this.dataElementType.id,n,t)}_resolveElementOptions(t,n="default",s){const i=n==="active",o=this._cachedDataOpts,r=t+"-"+n,a=o[r],d=this.enableOptionSharing&&ai(s);if(a)return Pf(a,d);const c=this.chart.config,u=c.datasetElementScopeKeys(this._type,t),h=i?[`${t}Hover`,"hover",t,""]:[t,""],f=c.getOptionScopes(this.getDataset(),u),m=Object.keys(ke.elements[t]),p=()=>this.getContext(s,i,n),b=c.resolveNamedOptions(f,m,p,h);return b.$shared&&(b.$shared=d,o[r]=Object.freeze(Pf(b,d))),b}_resolveAnimations(t,n,s){const i=this.chart,o=this._cachedDataOpts,r=`animation-${n}`,a=o[r];if(a)return a;let d;if(i.options.animation!==!1){const u=this.chart.config,h=u.datasetAnimationScopeKeys(this._type,n),f=u.getOptionScopes(this.getDataset(),h);d=u.createResolver(f,this.getContext(t,s,n))}const c=new jf(i,d&&d.animations);return d&&d._cacheable&&(o[r]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,n){return!n||el(t)||this.chart._animationsDisabled}_getSharedOptions(t,n){const s=this.resolveDataElementOptions(t,n),i=this._sharedOptions,o=this.getSharedOptions(s),r=this.includeOptions(n,o)||o!==i;return this.updateSharedOptions(o,n,s),{sharedOptions:o,includeOptions:r}}updateElement(t,n,s,i){el(i)?Object.assign(t,s):this._resolveAnimations(n,i).update(t,s)}updateSharedOptions(t,n,s){t&&!el(n)&&this._resolveAnimations(void 0,n).update(t,s)}_setStyle(t,n,s,i){t.active=i;const o=this.getStyle(n,i);this._resolveAnimations(n,s,i).update(t,{options:!i&&this.getSharedOptions(o)||o})}removeHoverStyle(t,n,s){this._setStyle(t,s,"active",!1)}setHoverStyle(t,n,s){this._setStyle(t,s,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const n=this._data,s=this._cachedMeta.data;for(const[a,d,c]of this._syncList)this[a](d,c);this._syncList=[];const i=s.length,o=n.length,r=Math.min(o,i);r&&this.parse(0,r),o>i?this._insertElements(i,o-i,t):o<i&&this._removeElements(o,i-o)}_insertElements(t,n,s=!0){const i=this._cachedMeta,o=i.data,r=t+n;let a;const d=c=>{for(c.length+=n,a=c.length-1;a>=r;a--)c[a]=c[a-n]};for(d(o),a=t;a<r;++a)o[a]=new this.dataElementType;this._parsing&&d(i._parsed),this.parse(t,n),s&&this.updateElements(o,t,n,"reset")}updateElements(t,n,s,i){}_removeElements(t,n){const s=this._cachedMeta;if(this._parsing){const i=s._parsed.splice(t,n);s._stacked&&mi(s,i)}s.data.splice(t,n)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[n,s,i]=t;this[n](s,i)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,n){n&&this._sync(["_removeElements",t,n]);const s=arguments.length-2;s&&this._sync(["_insertElements",t,s])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}I(Wn,"defaults",{}),I(Wn,"datasetElementType",null),I(Wn,"dataElementType",null);function Hk(e,t){if(!e._cache.$bar){const n=e.getMatchingVisibleMetas(t);let s=[];for(let i=0,o=n.length;i<o;i++)s=s.concat(n[i].controller.getAllParsedValues(e));e._cache.$bar=Yh(s.sort((i,o)=>i-o))}return e._cache.$bar}function Vk(e){const t=e.iScale,n=Hk(t,e.type);let s=t._length,i,o,r,a;const d=()=>{r===32767||r===-32768||(ai(a)&&(s=Math.min(s,Math.abs(r-a)||s)),a=r)};for(i=0,o=n.length;i<o;++i)r=t.getPixelForValue(n[i]),d();for(a=void 0,i=0,o=t.ticks.length;i<o;++i)r=t.getPixelForTick(i),d();return s}function Rk(e,t,n,s){const i=n.barThickness;let o,r;return oe(i)?(o=t.min*n.categoryPercentage,r=n.barPercentage):(o=i*s,r=1),{chunk:o/s,ratio:r,start:t.pixels[e]-o/2}}function $k(e,t,n,s){const i=t.pixels,o=i[e];let r=e>0?i[e-1]:null,a=e<i.length-1?i[e+1]:null;const d=n.categoryPercentage;r===null&&(r=o-(a===null?t.end-t.start:a-o)),a===null&&(a=o+o-r);const c=o-(o-Math.min(r,a))/2*d;return{chunk:Math.abs(a-r)/2*d/s,ratio:n.barPercentage,start:c}}function Uk(e,t,n,s){const i=n.parse(e[0],s),o=n.parse(e[1],s),r=Math.min(i,o),a=Math.max(i,o);let d=r,c=a;Math.abs(r)>Math.abs(a)&&(d=a,c=r),t[n.axis]=c,t._custom={barStart:d,barEnd:c,start:i,end:o,min:r,max:a}}function Ef(e,t,n,s){return ge(e)?Uk(e,t,n,s):t[n.axis]=n.parse(e,s),t}function Df(e,t,n,s){const i=e.iScale,o=e.vScale,r=i.getLabels(),a=i===o,d=[];let c,u,h,f;for(c=n,u=n+s;c<u;++c)f=t[c],h={},h[i.axis]=a||i.parse(r[c],c),d.push(Ef(f,h,o,c));return d}function tl(e){return e&&e.barStart!==void 0&&e.barEnd!==void 0}function qk(e,t,n){return e!==0?Pt(e):(t.isHorizontal()?1:-1)*(t.min>=n?1:-1)}function Yk(e){let t,n,s,i,o;return e.horizontal?(t=e.base>e.x,n="left",s="right"):(t=e.base<e.y,n="bottom",s="top"),t?(i="end",o="start"):(i="start",o="end"),{start:n,end:s,reverse:t,top:i,bottom:o}}function Kk(e,t,n,s){let i=t.borderSkipped;const o={};if(!i){e.borderSkipped=o;return}if(i===!0){e.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:r,end:a,reverse:d,top:c,bottom:u}=Yk(e);i==="middle"&&n&&(e.enableBorderRadius=!0,(n._top||0)===s?i=c:(n._bottom||0)===s?i=u:(o[Of(u,r,a,d)]=!0,i=c)),o[Of(i,r,a,d)]=!0,e.borderSkipped=o}function Of(e,t,n,s){return s?(e=Gk(e,t,n),e=If(e,n,t)):e=If(e,t,n),e}function Gk(e,t,n){return e===t?n:e===n?t:e}function If(e,t,n){return e==="start"?t:e==="end"?n:e}function Xk(e,{inflateAmount:t},n){e.inflateAmount=t==="auto"?n===1?.33:0:t}class Ro extends Wn{parsePrimitiveData(t,n,s,i){return Df(t,n,s,i)}parseArrayData(t,n,s,i){return Df(t,n,s,i)}parseObjectData(t,n,s,i){const{iScale:o,vScale:r}=t,{xAxisKey:a="x",yAxisKey:d="y"}=this._parsing,c=o.axis==="x"?a:d,u=r.axis==="x"?a:d,h=[];let f,m,p,b;for(f=s,m=s+i;f<m;++f)b=n[f],p={},p[o.axis]=o.parse(Tn(b,c),f),h.push(Ef(Tn(b,u),p,r,f));return h}updateRangeFromParsed(t,n,s,i){super.updateRangeFromParsed(t,n,s,i);const o=s._custom;o&&n===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const n=this._cachedMeta,{iScale:s,vScale:i}=n,o=this.getParsed(t),r=o._custom,a=tl(r)?"["+r.start+", "+r.end+"]":""+i.getLabelForValue(o[i.axis]);return{label:""+s.getLabelForValue(o[s.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize();const t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){const n=this._cachedMeta;this.updateElements(n.data,0,n.data.length,t)}updateElements(t,n,s,i){const o=i==="reset",{index:r,_cachedMeta:{vScale:a}}=this,d=a.getBasePixel(),c=a.isHorizontal(),u=this._getRuler(),{sharedOptions:h,includeOptions:f}=this._getSharedOptions(n,i);for(let m=n;m<n+s;m++){const p=this.getParsed(m),b=o||oe(p[a.axis])?{base:d,head:d}:this._calculateBarValuePixels(m),x=this._calculateBarIndexPixels(m,u),w=(p._stacks||{})[a.axis],_={horizontal:c,base:b.base,enableBorderRadius:!w||tl(p._custom)||r===w._top||r===w._bottom,x:c?b.head:x.center,y:c?x.center:b.head,height:c?x.size:Math.abs(b.size),width:c?Math.abs(b.size):x.size};f&&(_.options=h||this.resolveDataElementOptions(m,t[m].active?"active":i));const y=_.options||t[m].options;Kk(_,y,w,r),Xk(_,y,u.ratio),this.updateElement(t[m],m,_,i)}}_getStacks(t,n){const{iScale:s}=this._cachedMeta,i=s.getMatchingVisibleMetas(this._type).filter(u=>u.controller.options.grouped),o=s.options.stacked,r=[],a=this._cachedMeta.controller.getParsed(n),d=a&&a[s.axis],c=u=>{const h=u._parsed.find(m=>m[s.axis]===d),f=h&&h[u.vScale.axis];if(oe(f)||isNaN(f))return!0};for(const u of i)if(!(n!==void 0&&c(u))&&((o===!1||r.indexOf(u.stack)===-1||o===void 0&&u.stack===void 0)&&r.push(u.stack),u.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const t=this.chart.scales,n=this.chart.options.indexAxis;return Object.keys(t).filter(s=>t[s].axis===n).shift()}_getAxis(){const t={},n=this.getFirstScaleIdForIndexAxis();for(const s of this.chart.data.datasets)t[te(this.chart.options.indexAxis==="x"?s.xAxisID:s.yAxisID,n)]=!0;return Object.keys(t)}_getStackIndex(t,n,s){const i=this._getStacks(t,s),o=n!==void 0?i.indexOf(n):-1;return o===-1?i.length-1:o}_getRuler(){const t=this.options,n=this._cachedMeta,s=n.iScale,i=[];let o,r;for(o=0,r=n.data.length;o<r;++o)i.push(s.getPixelForValue(this.getParsed(o)[s.axis],o));const a=t.barThickness;return{min:a||Vk(n),pixels:i,start:s._startPixel,end:s._endPixel,stackCount:this._getStackCount(),scale:s,grouped:t.grouped,ratio:a?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:n,_stacked:s,index:i},options:{base:o,minBarLength:r}}=this,a=o||0,d=this.getParsed(t),c=d._custom,u=tl(c);let h=d[n.axis],f=0,m=s?this.applyStack(n,d,s):h,p,b;m!==h&&(f=m-h,m=h),u&&(h=c.barStart,m=c.barEnd-c.barStart,h!==0&&Pt(h)!==Pt(c.barEnd)&&(f=0),f+=h);const x=!oe(o)&&!u?o:f;let w=n.getPixelForValue(x);if(this.chart.getDataVisibility(t)?p=n.getPixelForValue(f+m):p=w,b=p-w,Math.abs(b)<r){b=qk(b,n,a)*r,h===a&&(w-=b/2);const _=n.getPixelForDecimal(0),y=n.getPixelForDecimal(1),v=Math.min(_,y),j=Math.max(_,y);w=Math.max(Math.min(w,j),v),p=w+b,s&&!u&&(d._stacks[n.axis]._visualValues[i]=n.getValueForPixel(p)-n.getValueForPixel(w))}if(w===n.getPixelForValue(a)){const _=Pt(b)*n.getLineWidthForValue(a)/2;w+=_,b-=_}return{size:b,base:w,head:p,center:p+b/2}}_calculateBarIndexPixels(t,n){const s=n.scale,i=this.options,o=i.skipNull,r=te(i.maxBarThickness,1/0);let a,d;const c=this._getAxisCount();if(n.grouped){const u=o?this._getStackCount(t):n.stackCount,h=i.barThickness==="flex"?$k(t,n,i,u*c):Rk(t,n,i,u*c),f=this.chart.options.indexAxis==="x"?this.getDataset().xAxisID:this.getDataset().yAxisID,m=this._getAxis().indexOf(te(f,this.getFirstScaleIdForIndexAxis())),p=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0)+m;a=h.start+h.chunk*p+h.chunk/2,d=Math.min(r,h.chunk*h.ratio)}else a=s.getPixelForValue(this.getParsed(t)[s.axis],t),d=Math.min(r,n.min*n.ratio);return{base:a-d/2,head:a+d/2,center:a,size:d}}draw(){const t=this._cachedMeta,n=t.vScale,s=t.data,i=s.length;let o=0;for(;o<i;++o)this.getParsed(o)[n.axis]!==null&&!s[o].hidden&&s[o].draw(this._ctx)}}I(Ro,"id","bar"),I(Ro,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),I(Ro,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});function Qk(e,t,n){let s=1,i=1,o=0,r=0;if(t<be){const a=e,d=a+t,c=Math.cos(a),u=Math.sin(a),h=Math.cos(d),f=Math.sin(d),m=(y,v,j)=>ci(y,a,d,!0)?1:Math.max(v,v*n,j,j*n),p=(y,v,j)=>ci(y,a,d,!0)?-1:Math.min(v,v*n,j,j*n),b=m(0,c,h),x=m(Ce,u,f),w=p(le,c,h),_=p(le+Ce,u,f);s=(b-w)/2,i=(x-_)/2,o=-(b+w)/2,r=-(x+_)/2}return{ratioX:s,ratioY:i,offsetX:o,offsetY:r}}class gs extends Wn{constructor(t,n){super(t,n),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,n){const s=this.getDataset().data,i=this._cachedMeta;if(this._parsing===!1)i._parsed=s;else{let o=d=>+s[d];if(ie(s[t])){const{key:d="value"}=this._parsing;o=c=>+Tn(s[c],d)}let r,a;for(r=t,a=t+n;r<a;++r)i._parsed[r]=o(r)}}_getRotation(){return Et(this.options.rotation-90)}_getCircumference(){return Et(this.options.circumference)}_getRotationExtents(){let t=be,n=-be;for(let s=0;s<this.chart.data.datasets.length;++s)if(this.chart.isDatasetVisible(s)&&this.chart.getDatasetMeta(s).type===this._type){const i=this.chart.getDatasetMeta(s).controller,o=i._getRotation(),r=i._getCircumference();t=Math.min(t,o),n=Math.max(n,o+r)}return{rotation:t,circumference:n-t}}update(t){const n=this.chart,{chartArea:s}=n,i=this._cachedMeta,o=i.data,r=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,a=Math.max((Math.min(s.width,s.height)-r)/2,0),d=Math.min(av(this.options.cutout,a),1),c=this._getRingWeight(this.index),{circumference:u,rotation:h}=this._getRotationExtents(),{ratioX:f,ratioY:m,offsetX:p,offsetY:b}=Qk(h,u,d),x=(s.width-r)/f,w=(s.height-r)/m,_=Math.max(Math.min(x,w)/2,0),y=Ah(this.options.radius,_),v=Math.max(y*d,0),j=(y-v)/this._getVisibleDatasetWeightTotal();this.offsetX=p*y,this.offsetY=b*y,i.total=this.calculateTotal(),this.outerRadius=y-j*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-j*c,0),this.updateElements(o,0,o.length,t)}_circumference(t,n){const s=this.options,i=this._cachedMeta,o=this._getCircumference();return n&&s.animation.animateRotate||!this.chart.getDataVisibility(t)||i._parsed[t]===null||i.data[t].hidden?0:this.calculateCircumference(i._parsed[t]*o/be)}updateElements(t,n,s,i){const o=i==="reset",r=this.chart,a=r.chartArea,c=r.options.animation,u=(a.left+a.right)/2,h=(a.top+a.bottom)/2,f=o&&c.animateScale,m=f?0:this.innerRadius,p=f?0:this.outerRadius,{sharedOptions:b,includeOptions:x}=this._getSharedOptions(n,i);let w=this._getRotation(),_;for(_=0;_<n;++_)w+=this._circumference(_,o);for(_=n;_<n+s;++_){const y=this._circumference(_,o),v=t[_],j={x:u+this.offsetX,y:h+this.offsetY,startAngle:w,endAngle:w+y,circumference:y,outerRadius:p,innerRadius:m};x&&(j.options=b||this.resolveDataElementOptions(_,v.active?"active":i)),w+=y,this.updateElement(v,_,j,i)}}calculateTotal(){const t=this._cachedMeta,n=t.data;let s=0,i;for(i=0;i<n.length;i++){const o=t._parsed[i];o!==null&&!isNaN(o)&&this.chart.getDataVisibility(i)&&!n[i].hidden&&(s+=Math.abs(o))}return s}calculateCircumference(t){const n=this._cachedMeta.total;return n>0&&!isNaN(t)?be*(Math.abs(t)/n):0}getLabelAndValue(t){const n=this._cachedMeta,s=this.chart,i=s.data.labels||[],o=Oo(n._parsed[t],s.options.locale);return{label:i[t]||"",value:o}}getMaxBorderWidth(t){let n=0;const s=this.chart;let i,o,r,a,d;if(!t){for(i=0,o=s.data.datasets.length;i<o;++i)if(s.isDatasetVisible(i)){r=s.getDatasetMeta(i),t=r.data,a=r.controller;break}}if(!t)return 0;for(i=0,o=t.length;i<o;++i)d=a.resolveDataElementOptions(i),d.borderAlign!=="inner"&&(n=Math.max(n,d.borderWidth||0,d.hoverBorderWidth||0));return n}getMaxOffset(t){let n=0;for(let s=0,i=t.length;s<i;++s){const o=this.resolveDataElementOptions(s);n=Math.max(n,o.offset||0,o.hoverOffset||0)}return n}_getRingWeightOffset(t){let n=0;for(let s=0;s<t;++s)this.chart.isDatasetVisible(s)&&(n+=this._getRingWeight(s));return n}_getRingWeight(t){return Math.max(te(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}I(gs,"id","doughnut"),I(gs,"defaults",{datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"}),I(gs,"descriptors",{_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),I(gs,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const n=t.data,{labels:{pointStyle:s,textAlign:i,color:o,useBorderRadius:r,borderRadius:a}}=t.legend.options;return n.labels.length&&n.datasets.length?n.labels.map((d,c)=>{const h=t.getDatasetMeta(0).controller.getStyle(c);return{text:d,fillStyle:h.backgroundColor,fontColor:o,hidden:!t.getDataVisibility(c),lineDash:h.borderDash,lineDashOffset:h.borderDashOffset,lineJoin:h.borderJoinStyle,lineWidth:h.borderWidth,strokeStyle:h.borderColor,textAlign:i,pointStyle:s,borderRadius:r&&(a||h.borderRadius),index:c}}):[]}},onClick(t,n,s){s.chart.toggleDataVisibility(n.index),s.chart.update()}}}});class $o extends Wn{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const n=this._cachedMeta,{dataset:s,data:i=[],_dataset:o}=n,r=this.chart._animationsDisabled;let{start:a,count:d}=Nv(n,i,r);this._drawStart=a,this._drawCount=d,Sv(n)&&(a=0,d=i.length),s._chart=this.chart,s._datasetIndex=this.index,s._decimated=!!o._decimated,s.points=i;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(s,void 0,{animated:!r,options:c},t),this.updateElements(i,a,d,t)}updateElements(t,n,s,i){const o=i==="reset",{iScale:r,vScale:a,_stacked:d,_dataset:c}=this._cachedMeta,{sharedOptions:u,includeOptions:h}=this._getSharedOptions(n,i),f=r.axis,m=a.axis,{spanGaps:p,segment:b}=this.options,x=di(p)?p:Number.POSITIVE_INFINITY,w=this.chart._animationsDisabled||o||i==="none",_=n+s,y=t.length;let v=n>0&&this.getParsed(n-1);for(let j=0;j<y;++j){const k=t[j],C=w?k:{};if(j<n||j>=_){C.skip=!0;continue}const S=this.getParsed(j),T=oe(S[m]),D=C[f]=r.getPixelForValue(S[f],j),P=C[m]=o||T?a.getBasePixel():a.getPixelForValue(d?this.applyStack(a,S,d):S[m],j);C.skip=isNaN(D)||isNaN(P)||T,C.stop=j>0&&Math.abs(S[f]-v[f])>x,b&&(C.parsed=S,C.raw=c.data[j]),h&&(C.options=u||this.resolveDataElementOptions(j,k.active?"active":i)),w||this.updateElement(k,j,C,i),v=S}}getMaxOverflow(){const t=this._cachedMeta,n=t.dataset,s=n.options&&n.options.borderWidth||0,i=t.data||[];if(!i.length)return s;const o=i[0].size(this.resolveDataElementOptions(0)),r=i[i.length-1].size(this.resolveDataElementOptions(i.length-1));return Math.max(s,o,r)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}I($o,"id","line"),I($o,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),I($o,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class nl extends gs{}I(nl,"id","pie"),I(nl,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});function Bn(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class sl{constructor(t){I(this,"options");this.options=t||{}}static override(t){Object.assign(sl.prototype,t)}init(){}formats(){return Bn()}parse(){return Bn()}format(){return Bn()}add(){return Bn()}diff(){return Bn()}startOf(){return Bn()}endOf(){return Bn()}}var Lf={_date:sl};function Zk(e,t,n,s){const{controller:i,data:o,_sorted:r}=e,a=i._cachedMeta.iScale,d=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(a&&t===a.axis&&t!=="r"&&r&&o.length){const c=a._reversePixels?_v:En;if(s){if(i._sharedOptions){const u=o[0],h=typeof u.getRange=="function"&&u.getRange(t);if(h){const f=c(o,t,n-h),m=c(o,t,n+h);return{lo:f.lo,hi:m.hi}}}}else{const u=c(o,t,n);if(d){const{vScale:h}=i._cachedMeta,{_parsed:f}=e,m=f.slice(0,u.lo+1).reverse().findIndex(b=>!oe(b[h.axis]));u.lo-=Math.max(0,m);const p=f.slice(u.hi).findIndex(b=>!oe(b[h.axis]));u.hi+=Math.max(0,p)}return u}}return{lo:0,hi:o.length-1}}function pi(e,t,n,s,i){const o=e.getSortedVisibleDatasetMetas(),r=n[t];for(let a=0,d=o.length;a<d;++a){const{index:c,data:u}=o[a],{lo:h,hi:f}=Zk(o[a],t,r,i);for(let m=h;m<=f;++m){const p=u[m];p.skip||s(p,c,m)}}}function Jk(e){const t=e.indexOf("x")!==-1,n=e.indexOf("y")!==-1;return function(s,i){const o=t?Math.abs(s.x-i.x):0,r=n?Math.abs(s.y-i.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(r,2))}}function il(e,t,n,s,i){const o=[];return!i&&!e.isPointInArea(t)||pi(e,n,t,function(a,d,c){!i&&!qt(a,e.chartArea,0)||a.inRange(t.x,t.y,s)&&o.push({element:a,datasetIndex:d,index:c})},!0),o}function e1(e,t,n,s){let i=[];function o(r,a,d){const{startAngle:c,endAngle:u}=r.getProps(["startAngle","endAngle"],s),{angle:h}=$h(r,{x:t.x,y:t.y});ci(h,c,u)&&i.push({element:r,datasetIndex:a,index:d})}return pi(e,n,t,o),i}function t1(e,t,n,s,i,o){let r=[];const a=Jk(n);let d=Number.POSITIVE_INFINITY;function c(u,h,f){const m=u.inRange(t.x,t.y,i);if(s&&!m)return;const p=u.getCenterPoint(i);if(!(!!o||e.isPointInArea(p))&&!m)return;const x=a(t,p);x<d?(r=[{element:u,datasetIndex:h,index:f}],d=x):x===d&&r.push({element:u,datasetIndex:h,index:f})}return pi(e,n,t,c),r}function ol(e,t,n,s,i,o){return!o&&!e.isPointInArea(t)?[]:n==="r"&&!s?e1(e,t,n,i):t1(e,t,n,s,i,o)}function Af(e,t,n,s,i){const o=[],r=n==="x"?"inXRange":"inYRange";let a=!1;return pi(e,n,t,(d,c,u)=>{d[r]&&d[r](t[n],i)&&(o.push({element:d,datasetIndex:c,index:u}),a=a||d.inRange(t.x,t.y,i))}),s&&!a?[]:o}var n1={evaluateInteractionItems:pi,modes:{index(e,t,n,s){const i=Fn(t,e),o=n.axis||"x",r=n.includeInvisible||!1,a=n.intersect?il(e,i,o,s,r):ol(e,i,o,!1,s,r),d=[];return a.length?(e.getSortedVisibleDatasetMetas().forEach(c=>{const u=a[0].index,h=c.data[u];h&&!h.skip&&d.push({element:h,datasetIndex:c.index,index:u})}),d):[]},dataset(e,t,n,s){const i=Fn(t,e),o=n.axis||"xy",r=n.includeInvisible||!1;let a=n.intersect?il(e,i,o,s,r):ol(e,i,o,!1,s,r);if(a.length>0){const d=a[0].datasetIndex,c=e.getDatasetMeta(d).data;a=[];for(let u=0;u<c.length;++u)a.push({element:c[u],datasetIndex:d,index:u})}return a},point(e,t,n,s){const i=Fn(t,e),o=n.axis||"xy",r=n.includeInvisible||!1;return il(e,i,o,s,r)},nearest(e,t,n,s){const i=Fn(t,e),o=n.axis||"xy",r=n.includeInvisible||!1;return ol(e,i,o,n.intersect,s,r)},x(e,t,n,s){const i=Fn(t,e);return Af(e,i,"x",n.intersect,s)},y(e,t,n,s){const i=Fn(t,e);return Af(e,i,"y",n.intersect,s)}}};const Ff=["left","top","right","bottom"];function gi(e,t){return e.filter(n=>n.pos===t)}function zf(e,t){return e.filter(n=>Ff.indexOf(n.pos)===-1&&n.box.axis===t)}function bi(e,t){return e.sort((n,s)=>{const i=t?s:n,o=t?n:s;return i.weight===o.weight?i.index-o.index:i.weight-o.weight})}function s1(e){const t=[];let n,s,i,o,r,a;for(n=0,s=(e||[]).length;n<s;++n)i=e[n],{position:o,options:{stack:r,stackWeight:a=1}}=i,t.push({index:n,box:i,pos:o,horizontal:i.isHorizontal(),weight:i.weight,stack:r&&o+r,stackWeight:a});return t}function i1(e){const t={};for(const n of e){const{stack:s,pos:i,stackWeight:o}=n;if(!s||!Ff.includes(i))continue;const r=t[s]||(t[s]={count:0,placed:0,weight:0,size:0});r.count++,r.weight+=o}return t}function o1(e,t){const n=i1(e),{vBoxMaxWidth:s,hBoxMaxHeight:i}=t;let o,r,a;for(o=0,r=e.length;o<r;++o){a=e[o];const{fullSize:d}=a.box,c=n[a.stack],u=c&&a.stackWeight/c.weight;a.horizontal?(a.width=u?u*s:d&&t.availableWidth,a.height=i):(a.width=s,a.height=u?u*i:d&&t.availableHeight)}return n}function r1(e){const t=s1(e),n=bi(t.filter(c=>c.box.fullSize),!0),s=bi(gi(t,"left"),!0),i=bi(gi(t,"right")),o=bi(gi(t,"top"),!0),r=bi(gi(t,"bottom")),a=zf(t,"x"),d=zf(t,"y");return{fullSize:n,leftAndTop:s.concat(o),rightAndBottom:i.concat(d).concat(r).concat(a),chartArea:gi(t,"chartArea"),vertical:s.concat(i).concat(d),horizontal:o.concat(r).concat(a)}}function Wf(e,t,n,s){return Math.max(e[n],t[n])+Math.max(e[s],t[s])}function Bf(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function a1(e,t,n,s){const{pos:i,box:o}=n,r=e.maxPadding;if(!ie(i)){n.size&&(e[i]-=n.size);const h=s[n.stack]||{size:0,count:1};h.size=Math.max(h.size,n.horizontal?o.height:o.width),n.size=h.size/h.count,e[i]+=n.size}o.getPadding&&Bf(r,o.getPadding());const a=Math.max(0,t.outerWidth-Wf(r,e,"left","right")),d=Math.max(0,t.outerHeight-Wf(r,e,"top","bottom")),c=a!==e.w,u=d!==e.h;return e.w=a,e.h=d,n.horizontal?{same:c,other:u}:{same:u,other:c}}function l1(e){const t=e.maxPadding;function n(s){const i=Math.max(t[s]-e[s],0);return e[s]+=i,i}e.y+=n("top"),e.x+=n("left"),n("right"),n("bottom")}function d1(e,t){const n=t.maxPadding;function s(i){const o={left:0,top:0,right:0,bottom:0};return i.forEach(r=>{o[r]=Math.max(t[r],n[r])}),o}return s(e?["left","right"]:["top","bottom"])}function xi(e,t,n,s){const i=[];let o,r,a,d,c,u;for(o=0,r=e.length,c=0;o<r;++o){a=e[o],d=a.box,d.update(a.width||t.w,a.height||t.h,d1(a.horizontal,t));const{same:h,other:f}=a1(t,n,a,s);c|=h&&i.length,u=u||f,d.fullSize||i.push(a)}return c&&xi(i,t,n,s)||u}function Uo(e,t,n,s,i){e.top=n,e.left=t,e.right=t+s,e.bottom=n+i,e.width=s,e.height=i}function Hf(e,t,n,s){const i=n.padding;let{x:o,y:r}=t;for(const a of e){const d=a.box,c=s[a.stack]||{count:1,placed:0,weight:1},u=a.stackWeight/c.weight||1;if(a.horizontal){const h=t.w*u,f=c.size||d.height;ai(c.start)&&(r=c.start),d.fullSize?Uo(d,i.left,r,n.outerWidth-i.right-i.left,f):Uo(d,t.left+c.placed,r,h,f),c.start=r,c.placed+=h,r=d.bottom}else{const h=t.h*u,f=c.size||d.width;ai(c.start)&&(o=c.start),d.fullSize?Uo(d,o,i.top,f,n.outerHeight-i.bottom-i.top):Uo(d,o,t.top+c.placed,f,h),c.start=o,c.placed+=h,o=d.right}}t.x=o,t.y=r}var ht={addBox(e,t){e.boxes||(e.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(n){t.draw(n)}}]},e.boxes.push(t)},removeBox(e,t){const n=e.boxes?e.boxes.indexOf(t):-1;n!==-1&&e.boxes.splice(n,1)},configure(e,t,n){t.fullSize=n.fullSize,t.position=n.position,t.weight=n.weight},update(e,t,n,s){if(!e)return;const i=Ye(e.options.layout.padding),o=Math.max(t-i.width,0),r=Math.max(n-i.height,0),a=r1(e.boxes),d=a.vertical,c=a.horizontal;he(e.boxes,b=>{typeof b.beforeLayout=="function"&&b.beforeLayout()});const u=d.reduce((b,x)=>x.box.options&&x.box.options.display===!1?b:b+1,0)||1,h=Object.freeze({outerWidth:t,outerHeight:n,padding:i,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/u,hBoxMaxHeight:r/2}),f=Object.assign({},i);Bf(f,Ye(s));const m=Object.assign({maxPadding:f,w:o,h:r,x:i.left,y:i.top},i),p=o1(d.concat(c),h);xi(a.fullSize,m,h,p),xi(d,m,h,p),xi(c,m,h,p)&&xi(d,m,h,p),l1(m),Hf(a.leftAndTop,m,h,p),m.x+=m.w,m.y+=m.h,Hf(a.rightAndBottom,m,h,p),e.chartArea={left:m.left,top:m.top,right:m.left+m.w,bottom:m.top+m.h,height:m.h,width:m.w},he(a.chartArea,b=>{const x=b.box;Object.assign(x,e.chartArea),x.update(m.w,m.h,{left:0,top:0,right:0,bottom:0})})}};class Vf{acquireContext(t,n){}releaseContext(t){return!1}addEventListener(t,n,s){}removeEventListener(t,n,s){}getDevicePixelRatio(){return 1}getMaximumSize(t,n,s,i){return n=Math.max(0,n||t.width),s=s||t.height,{width:n,height:Math.max(0,i?Math.floor(n/i):s)}}isAttached(t){return!0}updateConfig(t){}}class c1 extends Vf{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const qo="$chartjs",u1={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Rf=e=>e===null||e==="";function h1(e,t){const n=e.style,s=e.getAttribute("height"),i=e.getAttribute("width");if(e[qo]={initial:{height:s,width:i,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",Rf(i)){const o=ff(e,"width");o!==void 0&&(e.width=o)}if(Rf(s))if(e.style.height==="")e.height=e.width/(t||2);else{const o=ff(e,"height");o!==void 0&&(e.height=o)}return e}const $f=pk?{passive:!0}:!1;function f1(e,t,n){e&&e.addEventListener(t,n,$f)}function m1(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,$f)}function p1(e,t){const n=u1[e.type]||e.type,{x:s,y:i}=Fn(e,t);return{type:n,chart:t,native:e,x:s!==void 0?s:null,y:i!==void 0?i:null}}function Yo(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function g1(e,t,n){const s=e.canvas,i=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||Yo(a.addedNodes,s),r=r&&!Yo(a.removedNodes,s);r&&n()});return i.observe(document,{childList:!0,subtree:!0}),i}function b1(e,t,n){const s=e.canvas,i=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||Yo(a.removedNodes,s),r=r&&!Yo(a.addedNodes,s);r&&n()});return i.observe(document,{childList:!0,subtree:!0}),i}const wi=new Map;let Uf=0;function qf(){const e=window.devicePixelRatio;e!==Uf&&(Uf=e,wi.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function x1(e,t){wi.size||window.addEventListener("resize",qf),wi.set(e,t)}function w1(e){wi.delete(e),wi.size||window.removeEventListener("resize",qf)}function _1(e,t,n){const s=e.canvas,i=s&&Qa(s);if(!i)return;const o=Gh((a,d)=>{const c=i.clientWidth;n(a,d),c<i.clientWidth&&n()},window),r=new ResizeObserver(a=>{const d=a[0],c=d.contentRect.width,u=d.contentRect.height;c===0&&u===0||o(c,u)});return r.observe(i),x1(e,o),r}function rl(e,t,n){n&&n.disconnect(),t==="resize"&&w1(e)}function y1(e,t,n){const s=e.canvas,i=Gh(o=>{e.ctx!==null&&n(p1(o,e))},e);return f1(s,t,i),i}class v1 extends Vf{acquireContext(t,n){const s=t&&t.getContext&&t.getContext("2d");return s&&s.canvas===t?(h1(t,n),s):null}releaseContext(t){const n=t.canvas;if(!n[qo])return!1;const s=n[qo].initial;["height","width"].forEach(o=>{const r=s[o];oe(r)?n.removeAttribute(o):n.setAttribute(o,r)});const i=s.style||{};return Object.keys(i).forEach(o=>{n.style[o]=i[o]}),n.width=n.width,delete n[qo],!0}addEventListener(t,n,s){this.removeEventListener(t,n);const i=t.$proxies||(t.$proxies={}),r={attach:g1,detach:b1,resize:_1}[n]||y1;i[n]=r(t,n,s)}removeEventListener(t,n){const s=t.$proxies||(t.$proxies={}),i=s[n];if(!i)return;({attach:rl,detach:rl,resize:rl}[n]||m1)(t,n,i),s[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,s,i){return mk(t,n,s,i)}isAttached(t){const n=t&&Qa(t);return!!(n&&n.isConnected)}}function k1(e){return!Xa()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?c1:v1}let Kt=(gr=class{constructor(){I(this,"x");I(this,"y");I(this,"active",!1);I(this,"options");I(this,"$animations")}tooltipPosition(t){const{x:n,y:s}=this.getProps(["x","y"],t);return{x:n,y:s}}hasValue(){return di(this.x)&&di(this.y)}getProps(t,n){const s=this.$animations;if(!n||!s)return this;const i={};return t.forEach(o=>{i[o]=s[o]&&s[o].active()?s[o]._to:this[o]}),i}},I(gr,"defaults",{}),I(gr,"defaultRoutes"),gr);function j1(e,t){const n=e.options.ticks,s=N1(e),i=Math.min(n.maxTicksLimit||s,s),o=n.major.enabled?C1(t):[],r=o.length,a=o[0],d=o[r-1],c=[];if(r>i)return M1(t,c,o,r/i),c;const u=S1(o,t,i);if(r>0){let h,f;const m=r>1?Math.round((d-a)/(r-1)):null;for(Ko(t,c,u,oe(m)?0:a-m,a),h=0,f=r-1;h<f;h++)Ko(t,c,u,o[h],o[h+1]);return Ko(t,c,u,d,oe(m)?t.length:d+m),c}return Ko(t,c,u),c}function N1(e){const t=e.options.offset,n=e._tickSize(),s=e._length/n+(t?0:1),i=e._maxLength/n;return Math.floor(Math.min(s,i))}function S1(e,t,n){const s=T1(e),i=t.length/n;if(!s)return Math.max(i,1);const o=pv(s);for(let r=0,a=o.length-1;r<a;r++){const d=o[r];if(d>i)return d}return Math.max(i,1)}function C1(e){const t=[];let n,s;for(n=0,s=e.length;n<s;n++)e[n].major&&t.push(n);return t}function M1(e,t,n,s){let i=0,o=n[0],r;for(s=Math.ceil(s),r=0;r<e.length;r++)r===o&&(t.push(e[r]),i++,o=n[i*s])}function Ko(e,t,n,s,i){const o=te(s,0),r=Math.min(te(i,e.length),e.length);let a=0,d,c,u;for(n=Math.ceil(n),i&&(d=i-s,n=d/Math.floor(d/n)),u=o;u<0;)a++,u=Math.round(o+a*n);for(c=Math.max(o,0);c<r;c++)c===u&&(t.push(e[c]),a++,u=Math.round(o+a*n))}function T1(e){const t=e.length;let n,s;if(t<2)return!1;for(s=e[0],n=1;n<t;++n)if(e[n]-e[n-1]!==s)return!1;return s}const P1=e=>e==="left"?"right":e==="right"?"left":e,Yf=(e,t,n)=>t==="top"||t==="left"?e[t]+n:e[t]-n,Kf=(e,t)=>Math.min(t||e,e);function Gf(e,t){const n=[],s=e.length/t,i=e.length;let o=0;for(;o<i;o+=s)n.push(e[Math.floor(o)]);return n}function E1(e,t,n){const s=e.ticks.length,i=Math.min(t,s-1),o=e._startPixel,r=e._endPixel,a=1e-6;let d=e.getPixelForTick(i),c;if(!(n&&(s===1?c=Math.max(d-o,r-d):t===0?c=(e.getPixelForTick(1)-d)/2:c=(d-e.getPixelForTick(i-1))/2,d+=i<t?c:-c,d<o-a||d>r+a)))return d}function D1(e,t){he(e,n=>{const s=n.gc,i=s.length/2;let o;if(i>t){for(o=0;o<i;++o)delete n.data[s[o]];s.splice(0,i)}})}function _i(e){return e.drawTicks?e.tickLength:0}function Xf(e,t){if(!e.display)return 0;const n=De(e.font,t),s=Ye(e.padding);return(ge(e.text)?e.text.length:1)*n.lineHeight+s.height}function O1(e,t){return hn(e,{scale:t,type:"scale"})}function I1(e,t,n){return hn(e,{tick:n,index:t,type:"tick"})}function L1(e,t,n){let s=Ba(e);return(n&&t!=="right"||!n&&t==="right")&&(s=P1(s)),s}function A1(e,t,n,s){const{top:i,left:o,bottom:r,right:a,chart:d}=e,{chartArea:c,scales:u}=d;let h=0,f,m,p;const b=r-i,x=a-o;if(e.isHorizontal()){if(m=qe(s,o,a),ie(n)){const w=Object.keys(n)[0],_=n[w];p=u[w].getPixelForValue(_)+b-t}else n==="center"?p=(c.bottom+c.top)/2+b-t:p=Yf(e,n,t);f=a-o}else{if(ie(n)){const w=Object.keys(n)[0],_=n[w];m=u[w].getPixelForValue(_)-x+t}else n==="center"?m=(c.left+c.right)/2-x+t:m=Yf(e,n,t);p=qe(s,r,i),h=n==="left"?-Ce:Ce}return{titleX:m,titleY:p,maxWidth:f,rotation:h}}class Hn extends Kt{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,n){return t}getUserBounds(){let{_userMin:t,_userMax:n,_suggestedMin:s,_suggestedMax:i}=this;return t=rt(t,Number.POSITIVE_INFINITY),n=rt(n,Number.NEGATIVE_INFINITY),s=rt(s,Number.POSITIVE_INFINITY),i=rt(i,Number.NEGATIVE_INFINITY),{min:rt(t,s),max:rt(n,i),minDefined:ve(t),maxDefined:ve(n)}}getMinMax(t){let{min:n,max:s,minDefined:i,maxDefined:o}=this.getUserBounds(),r;if(i&&o)return{min:n,max:s};const a=this.getMatchingVisibleMetas();for(let d=0,c=a.length;d<c;++d)r=a[d].controller.getMinMax(this,t),i||(n=Math.min(n,r.min)),o||(s=Math.max(s,r.max));return n=o&&n>s?s:n,s=i&&n>s?n:s,{min:rt(n,rt(s,n)),max:rt(s,rt(n,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){pe(this.options.beforeUpdate,[this])}update(t,n,s){const{beginAtZero:i,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=n,this._margins=s=Object.assign({left:0,right:0,top:0,bottom:0},s),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+s.left+s.right:this.height+s.top+s.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=qv(this,o,i),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const d=a<this.ticks.length;this._convertTicksToLabels(d?Gf(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),r.display&&(r.autoSkip||r.source==="auto")&&(this.ticks=j1(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),d&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,n,s;this.isHorizontal()?(n=this.left,s=this.right):(n=this.top,s=this.bottom,t=!t),this._startPixel=n,this._endPixel=s,this._reversePixels=t,this._length=s-n,this._alignToPixels=this.options.alignToPixels}afterUpdate(){pe(this.options.afterUpdate,[this])}beforeSetDimensions(){pe(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){pe(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),pe(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){pe(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const n=this.options.ticks;let s,i,o;for(s=0,i=t.length;s<i;s++)o=t[s],o.label=pe(n.callback,[o.value,s,t],this)}afterTickToLabelConversion(){pe(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){pe(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,n=t.ticks,s=Kf(this.ticks.length,t.ticks.maxTicksLimit),i=n.minRotation||0,o=n.maxRotation;let r=i,a,d,c;if(!this._isVisible()||!n.display||i>=o||s<=1||!this.isHorizontal()){this.labelRotation=i;return}const u=this._getLabelSizes(),h=u.widest.width,f=u.highest.height,m=Ue(this.chart.width-h,0,this.maxWidth);a=t.offset?this.maxWidth/s:m/(s-1),h+6>a&&(a=m/(s-(t.offset?.5:1)),d=this.maxHeight-_i(t.grid)-n.padding-Xf(t.title,this.chart.options.font),c=Math.sqrt(h*h+f*f),r=Fa(Math.min(Math.asin(Ue((u.highest.height+6)/a,-1,1)),Math.asin(Ue(d/c,-1,1))-Math.asin(Ue(f/c,-1,1)))),r=Math.max(i,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){pe(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){pe(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:n,options:{ticks:s,title:i,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){const d=Xf(i,n.options.font);if(a?(t.width=this.maxWidth,t.height=_i(o)+d):(t.height=this.maxHeight,t.width=_i(o)+d),s.display&&this.ticks.length){const{first:c,last:u,widest:h,highest:f}=this._getLabelSizes(),m=s.padding*2,p=Et(this.labelRotation),b=Math.cos(p),x=Math.sin(p);if(a){const w=s.mirror?0:x*h.width+b*f.height;t.height=Math.min(this.maxHeight,t.height+w+m)}else{const w=s.mirror?0:b*h.width+x*f.height;t.width=Math.min(this.maxWidth,t.width+w+m)}this._calculatePadding(c,u,x,b)}}this._handleMargins(),a?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,n,s,i){const{ticks:{align:o,padding:r},position:a}=this.options,d=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const u=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1);let f=0,m=0;d?c?(f=i*t.width,m=s*n.height):(f=s*t.height,m=i*n.width):o==="start"?m=n.width:o==="end"?f=t.width:o!=="inner"&&(f=t.width/2,m=n.width/2),this.paddingLeft=Math.max((f-u+r)*this.width/(this.width-u),0),this.paddingRight=Math.max((m-h+r)*this.width/(this.width-h),0)}else{let u=n.height/2,h=t.height/2;o==="start"?(u=0,h=t.height):o==="end"&&(u=n.height,h=0),this.paddingTop=u+r,this.paddingBottom=h+r}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){pe(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:n}=this.options;return n==="top"||n==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let n,s;for(n=0,s=t.length;n<s;n++)oe(t[n].label)&&(t.splice(n,1),s--,n--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const n=this.options.ticks.sampleSize;let s=this.ticks;n<s.length&&(s=Gf(s,n)),this._labelSizes=t=this._computeLabelSizes(s,s.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,n,s){const{ctx:i,_longestTextCache:o}=this,r=[],a=[],d=Math.floor(n/Kf(n,s));let c=0,u=0,h,f,m,p,b,x,w,_,y,v,j;for(h=0;h<n;h+=d){if(p=t[h].label,b=this._resolveTickFontOptions(h),i.font=x=b.string,w=o[x]=o[x]||{data:{},gc:[]},_=b.lineHeight,y=v=0,!oe(p)&&!ge(p))y=Lo(i,w.data,w.gc,y,p),v=_;else if(ge(p))for(f=0,m=p.length;f<m;++f)j=p[f],!oe(j)&&!ge(j)&&(y=Lo(i,w.data,w.gc,y,j),v+=_);r.push(y),a.push(v),c=Math.max(y,c),u=Math.max(v,u)}D1(o,n);const k=r.indexOf(c),C=a.indexOf(u),S=T=>({width:r[T]||0,height:a[T]||0});return{first:S(0),last:S(n-1),widest:S(k),highest:S(C),widths:r,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,n){return NaN}getValueForPixel(t){}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const n=this._startPixel+t*this._length;return wv(this._alignToPixels?On(this.chart,n,0):n)}getDecimalForPixel(t){const n=(t-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:n}=this;return t<0&&n<0?n:t>0&&n>0?t:0}getContext(t){const n=this.ticks||[];if(t>=0&&t<n.length){const s=n[t];return s.$context||(s.$context=I1(this.getContext(),t,s))}return this.$context||(this.$context=O1(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,n=Et(this.labelRotation),s=Math.abs(Math.cos(n)),i=Math.abs(Math.sin(n)),o=this._getLabelSizes(),r=t.autoSkipPadding||0,a=o?o.widest.width+r:0,d=o?o.highest.height+r:0;return this.isHorizontal()?d*s>a*i?a/s:d/i:d*i<a*s?d/s:a/i}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const n=this.axis,s=this.chart,i=this.options,{grid:o,position:r,border:a}=i,d=o.offset,c=this.isHorizontal(),h=this.ticks.length+(d?1:0),f=_i(o),m=[],p=a.setContext(this.getContext()),b=p.display?p.width:0,x=b/2,w=function(F){return On(s,F,b)};let _,y,v,j,k,C,S,T,D,P,L,W;if(r==="top")_=w(this.bottom),C=this.bottom-f,T=_-x,P=w(t.top)+x,W=t.bottom;else if(r==="bottom")_=w(this.top),P=t.top,W=w(t.bottom)-x,C=_+x,T=this.top+f;else if(r==="left")_=w(this.right),k=this.right-f,S=_-x,D=w(t.left)+x,L=t.right;else if(r==="right")_=w(this.left),D=t.left,L=w(t.right)-x,k=_+x,S=this.left+f;else if(n==="x"){if(r==="center")_=w((t.top+t.bottom)/2+.5);else if(ie(r)){const F=Object.keys(r)[0],H=r[F];_=w(this.chart.scales[F].getPixelForValue(H))}P=t.top,W=t.bottom,C=_+x,T=C+f}else if(n==="y"){if(r==="center")_=w((t.left+t.right)/2);else if(ie(r)){const F=Object.keys(r)[0],H=r[F];_=w(this.chart.scales[F].getPixelForValue(H))}k=_-x,S=k-f,D=t.left,L=t.right}const $=te(i.ticks.maxTicksLimit,h),O=Math.max(1,Math.ceil(h/$));for(y=0;y<h;y+=O){const F=this.getContext(y),H=o.setContext(F),M=a.setContext(F),E=H.lineWidth,V=H.color,z=M.dash||[],A=M.dashOffset,U=H.tickWidth,J=H.tickColor,ne=H.tickBorderDash||[],Q=H.tickBorderDashOffset;v=E1(this,y,d),v!==void 0&&(j=On(s,v,E),c?k=S=D=L=j:C=T=P=W=j,m.push({tx1:k,ty1:C,tx2:S,ty2:T,x1:D,y1:P,x2:L,y2:W,width:E,color:V,borderDash:z,borderDashOffset:A,tickWidth:U,tickColor:J,tickBorderDash:ne,tickBorderDashOffset:Q}))}return this._ticksLength=h,this._borderValue=_,m}_computeLabelItems(t){const n=this.axis,s=this.options,{position:i,ticks:o}=s,r=this.isHorizontal(),a=this.ticks,{align:d,crossAlign:c,padding:u,mirror:h}=o,f=_i(s.grid),m=f+u,p=h?-u:m,b=-Et(this.labelRotation),x=[];let w,_,y,v,j,k,C,S,T,D,P,L,W="middle";if(i==="top")k=this.bottom-p,C=this._getXAxisLabelAlignment();else if(i==="bottom")k=this.top+p,C=this._getXAxisLabelAlignment();else if(i==="left"){const O=this._getYAxisLabelAlignment(f);C=O.textAlign,j=O.x}else if(i==="right"){const O=this._getYAxisLabelAlignment(f);C=O.textAlign,j=O.x}else if(n==="x"){if(i==="center")k=(t.top+t.bottom)/2+m;else if(ie(i)){const O=Object.keys(i)[0],F=i[O];k=this.chart.scales[O].getPixelForValue(F)+m}C=this._getXAxisLabelAlignment()}else if(n==="y"){if(i==="center")j=(t.left+t.right)/2-m;else if(ie(i)){const O=Object.keys(i)[0],F=i[O];j=this.chart.scales[O].getPixelForValue(F)}C=this._getYAxisLabelAlignment(f).textAlign}n==="y"&&(d==="start"?W="top":d==="end"&&(W="bottom"));const $=this._getLabelSizes();for(w=0,_=a.length;w<_;++w){y=a[w],v=y.label;const O=o.setContext(this.getContext(w));S=this.getPixelForTick(w)+o.labelOffset,T=this._resolveTickFontOptions(w),D=T.lineHeight,P=ge(v)?v.length:1;const F=P/2,H=O.color,M=O.textStrokeColor,E=O.textStrokeWidth;let V=C;r?(j=S,C==="inner"&&(w===_-1?V=this.options.reverse?"left":"right":w===0?V=this.options.reverse?"right":"left":V="center"),i==="top"?c==="near"||b!==0?L=-P*D+D/2:c==="center"?L=-$.highest.height/2-F*D+D:L=-$.highest.height+D/2:c==="near"||b!==0?L=D/2:c==="center"?L=$.highest.height/2-F*D:L=$.highest.height-P*D,h&&(L*=-1),b!==0&&!O.showLabelBackdrop&&(j+=D/2*Math.sin(b))):(k=S,L=(1-P)*D/2);let z;if(O.showLabelBackdrop){const A=Ye(O.backdropPadding),U=$.heights[w],J=$.widths[w];let ne=L-A.top,Q=0-A.left;switch(W){case"middle":ne-=U/2;break;case"bottom":ne-=U;break}switch(C){case"center":Q-=J/2;break;case"right":Q-=J;break;case"inner":w===_-1?Q-=J:w>0&&(Q-=J/2);break}z={left:Q,top:ne,width:J+A.width,height:U+A.height,color:O.backdropColor}}x.push({label:v,font:T,textOffset:L,options:{rotation:b,color:H,strokeColor:M,strokeWidth:E,textAlign:V,textBaseline:W,translation:[j,k],backdrop:z}})}return x}_getXAxisLabelAlignment(){const{position:t,ticks:n}=this.options;if(-Et(this.labelRotation))return t==="top"?"left":"right";let i="center";return n.align==="start"?i="left":n.align==="end"?i="right":n.align==="inner"&&(i="inner"),i}_getYAxisLabelAlignment(t){const{position:n,ticks:{crossAlign:s,mirror:i,padding:o}}=this.options,r=this._getLabelSizes(),a=t+o,d=r.widest.width;let c,u;return n==="left"?i?(u=this.right+o,s==="near"?c="left":s==="center"?(c="center",u+=d/2):(c="right",u+=d)):(u=this.right-a,s==="near"?c="right":s==="center"?(c="center",u-=d/2):(c="left",u=this.left)):n==="right"?i?(u=this.left+o,s==="near"?c="right":s==="center"?(c="center",u-=d/2):(c="left",u-=d)):(u=this.left+a,s==="near"?c="left":s==="center"?(c="center",u+=d/2):(c="right",u=this.right)):c="right",{textAlign:c,x:u}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:n},left:s,top:i,width:o,height:r}=this;n&&(t.save(),t.fillStyle=n,t.fillRect(s,i,o,r),t.restore())}getLineWidthForValue(t){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const i=this.ticks.findIndex(o=>o.value===t);return i>=0?n.setContext(this.getContext(i)).lineWidth:0}drawGrid(t){const n=this.options.grid,s=this.ctx,i=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,r;const a=(d,c,u)=>{!u.width||!u.color||(s.save(),s.lineWidth=u.width,s.strokeStyle=u.color,s.setLineDash(u.borderDash||[]),s.lineDashOffset=u.borderDashOffset,s.beginPath(),s.moveTo(d.x,d.y),s.lineTo(c.x,c.y),s.stroke(),s.restore())};if(n.display)for(o=0,r=i.length;o<r;++o){const d=i[o];n.drawOnChartArea&&a({x:d.x1,y:d.y1},{x:d.x2,y:d.y2},d),n.drawTicks&&a({x:d.tx1,y:d.ty1},{x:d.tx2,y:d.ty2},{color:d.tickColor,width:d.tickWidth,borderDash:d.tickBorderDash,borderDashOffset:d.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:n,options:{border:s,grid:i}}=this,o=s.setContext(this.getContext()),r=s.display?o.width:0;if(!r)return;const a=i.setContext(this.getContext(0)).lineWidth,d=this._borderValue;let c,u,h,f;this.isHorizontal()?(c=On(t,this.left,r)-r/2,u=On(t,this.right,a)+a/2,h=f=d):(h=On(t,this.top,r)-r/2,f=On(t,this.bottom,a)+a/2,c=u=d),n.save(),n.lineWidth=o.width,n.strokeStyle=o.color,n.beginPath(),n.moveTo(c,h),n.lineTo(u,f),n.stroke(),n.restore()}drawLabels(t){if(!this.options.ticks.display)return;const s=this.ctx,i=this._computeLabelArea();i&&Ao(s,i);const o=this.getLabelItems(t);for(const r of o){const a=r.options,d=r.font,c=r.label,u=r.textOffset;In(s,c,0,u,d,a)}i&&Fo(s)}drawTitle(){const{ctx:t,options:{position:n,title:s,reverse:i}}=this;if(!s.display)return;const o=De(s.font),r=Ye(s.padding),a=s.align;let d=o.lineHeight/2;n==="bottom"||n==="center"||ie(n)?(d+=r.bottom,ge(s.text)&&(d+=o.lineHeight*(s.text.length-1))):d+=r.top;const{titleX:c,titleY:u,maxWidth:h,rotation:f}=A1(this,d,n,a);In(t,s.text,0,0,o,{color:s.color,maxWidth:h,rotation:f,textAlign:L1(a,n,i),textBaseline:"middle",translation:[c,u]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,n=t.ticks&&t.ticks.z||0,s=te(t.grid&&t.grid.z,-1),i=te(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==Hn.prototype.draw?[{z:n,draw:o=>{this.draw(o)}}]:[{z:s,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:i,draw:()=>{this.drawBorder()}},{z:n,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const n=this.chart.getSortedVisibleDatasetMetas(),s=this.axis+"AxisID",i=[];let o,r;for(o=0,r=n.length;o<r;++o){const a=n[o];a[s]===this.id&&(!t||a.type===t)&&i.push(a)}return i}_resolveTickFontOptions(t){const n=this.options.ticks.setContext(this.getContext(t));return De(n.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class Go{constructor(t,n,s){this.type=t,this.scope=n,this.override=s,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const n=Object.getPrototypeOf(t);let s;W1(n)&&(s=this.register(n));const i=this.items,o=t.id,r=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in i||(i[o]=t,F1(t,r,s),this.override&&ke.override(t.id,t.overrides)),r}get(t){return this.items[t]}unregister(t){const n=this.items,s=t.id,i=this.scope;s in n&&delete n[s],i&&s in ke[i]&&(delete ke[i][s],this.override&&delete Dn[s])}}function F1(e,t,n){const s=oi(Object.create(null),[n?ke.get(n):{},ke.get(t),e.defaults]);ke.set(t,s),e.defaultRoutes&&z1(t,e.defaultRoutes),e.descriptors&&ke.describe(t,e.descriptors)}function z1(e,t){Object.keys(t).forEach(n=>{const s=n.split("."),i=s.pop(),o=[e].concat(s).join("."),r=t[n].split("."),a=r.pop(),d=r.join(".");ke.route(o,i,d,a)})}function W1(e){return"id"in e&&"defaults"in e}class B1{constructor(){this.controllers=new Go(Wn,"datasets",!0),this.elements=new Go(Kt,"elements"),this.plugins=new Go(Object,"plugins"),this.scales=new Go(Hn,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,n,s){[...n].forEach(i=>{const o=s||this._getRegistryForType(i);s||o.isForType(i)||o===this.plugins&&i.id?this._exec(t,o,i):he(i,r=>{const a=s||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,n,s){const i=Aa(t);pe(s["before"+i],[],s),n[t](s),pe(s["after"+i],[],s)}_getRegistryForType(t){for(let n=0;n<this._typedRegistries.length;n++){const s=this._typedRegistries[n];if(s.isForType(t))return s}return this.plugins}_get(t,n,s){const i=n.get(t);if(i===void 0)throw new Error('"'+t+'" is not a registered '+s+".");return i}}var Dt=new B1;class H1{constructor(){this._init=void 0}notify(t,n,s,i){if(n==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install")),this._init===void 0)return;const o=i?this._descriptors(t).filter(i):this._descriptors(t),r=this._notify(o,t,n,s);return n==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall"),this._init=void 0),r}_notify(t,n,s,i){i=i||{};for(const o of t){const r=o.plugin,a=r[s],d=[n,i,o.options];if(pe(a,d,r)===!1&&i.cancelable)return!1}return!0}invalidate(){oe(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const n=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),n}_createDescriptors(t,n){const s=t&&t.config,i=te(s.options&&s.options.plugins,{}),o=V1(s);return i===!1&&!n?[]:$1(t,o,i,n)}_notifyStateChanges(t){const n=this._oldCache||[],s=this._cache,i=(o,r)=>o.filter(a=>!r.some(d=>a.plugin.id===d.plugin.id));this._notify(i(n,s),t,"stop"),this._notify(i(s,n),t,"start")}}function V1(e){const t={},n=[],s=Object.keys(Dt.plugins.items);for(let o=0;o<s.length;o++)n.push(Dt.getPlugin(s[o]));const i=e.plugins||[];for(let o=0;o<i.length;o++){const r=i[o];n.indexOf(r)===-1&&(n.push(r),t[r.id]=!0)}return{plugins:n,localIds:t}}function R1(e,t){return!t&&e===!1?null:e===!0?{}:e}function $1(e,{plugins:t,localIds:n},s,i){const o=[],r=e.getContext();for(const a of t){const d=a.id,c=R1(s[d],i);c!==null&&o.push({plugin:a,options:U1(e.config,{plugin:a,local:n[d]},c,r)})}return o}function U1(e,{plugin:t,local:n},s,i){const o=e.pluginScopeKeys(t),r=e.getOptionScopes(s,o);return n&&t.defaults&&r.push(t.defaults),e.createResolver(r,i,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function al(e,t){const n=ke.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||n.indexAxis||"x"}function q1(e,t){let n=e;return e==="_index_"?n=t:e==="_value_"&&(n=t==="x"?"y":"x"),n}function Y1(e,t){return e===t?"_index_":"_value_"}function Qf(e){if(e==="x"||e==="y"||e==="r")return e}function K1(e){if(e==="top"||e==="bottom")return"x";if(e==="left"||e==="right")return"y"}function ll(e,...t){if(Qf(e))return e;for(const n of t){const s=n.axis||K1(n.position)||e.length>1&&Qf(e[0].toLowerCase());if(s)return s}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function Zf(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function G1(e,t){if(t.data&&t.data.datasets){const n=t.data.datasets.filter(s=>s.xAxisID===e||s.yAxisID===e);if(n.length)return Zf(e,"x",n[0])||Zf(e,"y",n[0])}return{}}function X1(e,t){const n=Dn[e.type]||{scales:{}},s=t.scales||{},i=al(e.type,t),o=Object.create(null);return Object.keys(s).forEach(r=>{const a=s[r];if(!ie(a))return console.error(`Invalid scale configuration for scale: ${r}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);const d=ll(r,a,G1(r,e),ke.scales[a.type]),c=Y1(d,i),u=n.scales||{};o[r]=ri(Object.create(null),[{axis:d},a,u[d],u[c]])}),e.data.datasets.forEach(r=>{const a=r.type||e.type,d=r.indexAxis||al(a,t),u=(Dn[a]||{}).scales||{};Object.keys(u).forEach(h=>{const f=q1(h,d),m=r[f+"AxisID"]||f;o[m]=o[m]||Object.create(null),ri(o[m],[{axis:f},s[m],u[h]])})}),Object.keys(o).forEach(r=>{const a=o[r];ri(a,[ke.scales[a.type],ke.scale])}),o}function Jf(e){const t=e.options||(e.options={});t.plugins=te(t.plugins,{}),t.scales=X1(e,t)}function em(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function Q1(e){return e=e||{},e.data=em(e.data),Jf(e),e}const tm=new Map,nm=new Set;function Xo(e,t){let n=tm.get(e);return n||(n=t(),tm.set(e,n),nm.add(n)),n}const yi=(e,t,n)=>{const s=Tn(t,n);s!==void 0&&e.add(s)};class Z1{constructor(t){this._config=Q1(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=em(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),Jf(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Xo(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,n){return Xo(`${t}.transition.${n}`,()=>[[`datasets.${t}.transitions.${n}`,`transitions.${n}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,n){return Xo(`${t}-${n}`,()=>[[`datasets.${t}.elements.${n}`,`datasets.${t}`,`elements.${n}`,""]])}pluginScopeKeys(t){const n=t.id,s=this.type;return Xo(`${s}-plugin-${n}`,()=>[[`plugins.${n}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,n){const s=this._scopeCache;let i=s.get(t);return(!i||n)&&(i=new Map,s.set(t,i)),i}getOptionScopes(t,n,s){const{options:i,type:o}=this,r=this._cachedScopes(t,s),a=r.get(n);if(a)return a;const d=new Set;n.forEach(u=>{t&&(d.add(t),u.forEach(h=>yi(d,t,h))),u.forEach(h=>yi(d,i,h)),u.forEach(h=>yi(d,Dn[o]||{},h)),u.forEach(h=>yi(d,ke,h)),u.forEach(h=>yi(d,Ra,h))});const c=Array.from(d);return c.length===0&&c.push(Object.create(null)),nm.has(n)&&r.set(n,c),c}chartOptionScopes(){const{options:t,type:n}=this;return[t,Dn[n]||{},ke.datasets[n]||{},{type:n},ke,Ra]}resolveNamedOptions(t,n,s,i=[""]){const o={$shared:!0},{resolver:r,subPrefixes:a}=sm(this._resolverCache,t,i);let d=r;if(ej(r,n)){o.$shared=!1,s=cn(s)?s():s;const c=this.createResolver(t,s,a);d=fs(r,s,c)}for(const c of n)o[c]=d[c];return o}createResolver(t,n,s=[""],i){const{resolver:o}=sm(this._resolverCache,t,s);return ie(n)?fs(o,n,void 0,i):o}}function sm(e,t,n){let s=e.get(t);s||(s=new Map,e.set(t,s));const i=n.join();let o=s.get(i);return o||(o={resolver:Ya(t,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},s.set(i,o)),o}const J1=e=>ie(e)&&Object.getOwnPropertyNames(e).some(t=>cn(e[t]));function ej(e,t){const{isScriptable:n,isIndexable:s}=of(e);for(const i of t){const o=n(i),r=s(i),a=(r||o)&&e[i];if(o&&(cn(a)||J1(a))||r&&ge(a))return!0}return!1}var tj="4.5.1";const nj=["top","bottom","left","right","chartArea"];function im(e,t){return e==="top"||e==="bottom"||nj.indexOf(e)===-1&&t==="x"}function om(e,t){return function(n,s){return n[e]===s[e]?n[t]-s[t]:n[e]-s[e]}}function rm(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),pe(n&&n.onComplete,[e],t)}function sj(e){const t=e.chart,n=t.options.animation;pe(n&&n.onProgress,[e],t)}function am(e){return Xa()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const Qo={},lm=e=>{const t=am(e);return Object.values(Qo).filter(n=>n.canvas===t).pop()};function ij(e,t,n){const s=Object.keys(e);for(const i of s){const o=+i;if(o>=t){const r=e[i];delete e[i],(n>0||o>t)&&(e[o+n]=r)}}}function oj(e,t,n,s){return!n||e.type==="mouseout"?null:s?t:e}let Zo=(xn=class{static register(...t){Dt.add(...t),dm()}static unregister(...t){Dt.remove(...t),dm()}constructor(t,n){const s=this.config=new Z1(n),i=am(t),o=lm(i);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const r=s.createResolver(s.chartOptionScopes(),this.getContext());this.platform=new(s.platform||k1(i)),this.platform.updateConfig(s);const a=this.platform.acquireContext(i,r.aspectRatio),d=a&&a.canvas,c=d&&d.height,u=d&&d.width;if(this.id=rv(),this.ctx=a,this.canvas=d,this.width=u,this.height=c,this._options=r,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new H1,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=kv(h=>this.update(h),r.resizeDelay||0),this._dataChanges=[],Qo[this.id]=this,!a||!d){console.error("Failed to create chart: can't acquire context from the given item");return}Yt.listen(this,"complete",rm),Yt.listen(this,"progress",sj),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:n},width:s,height:i,_aspectRatio:o}=this;return oe(t)?n&&o?o:i?s/i:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return Dt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():hf(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return tf(this.canvas,this.ctx),this}stop(){return Yt.stop(this),this}resize(t,n){Yt.running(this)?this._resizeBeforeDraw={width:t,height:n}:this._resize(t,n)}_resize(t,n){const s=this.options,i=this.canvas,o=s.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(i,t,n,o),a=s.devicePixelRatio||this.platform.getDevicePixelRatio(),d=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,hf(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),pe(s.onResize,[this,r],this),this.attached&&this._doResize(d)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};he(n,(s,i)=>{s.id=i})}buildOrUpdateScales(){const t=this.options,n=t.scales,s=this.scales,i=Object.keys(s).reduce((r,a)=>(r[a]=!1,r),{});let o=[];n&&(o=o.concat(Object.keys(n).map(r=>{const a=n[r],d=ll(r,a),c=d==="r",u=d==="x";return{options:a,dposition:c?"chartArea":u?"bottom":"left",dtype:c?"radialLinear":u?"category":"linear"}}))),he(o,r=>{const a=r.options,d=a.id,c=ll(d,a),u=te(a.type,r.dtype);(a.position===void 0||im(a.position,c)!==im(r.dposition))&&(a.position=r.dposition),i[d]=!0;let h=null;if(d in s&&s[d].type===u)h=s[d];else{const f=Dt.getScale(u);h=new f({id:d,type:u,ctx:this.ctx,chart:this}),s[h.id]=h}h.init(a,t)}),he(i,(r,a)=>{r||delete s[a]}),he(s,r=>{ht.configure(this,r,r.options),ht.addBox(this,r)})}_updateMetasets(){const t=this._metasets,n=this.data.datasets.length,s=t.length;if(t.sort((i,o)=>i.index-o.index),s>n){for(let i=n;i<s;++i)this._destroyDatasetMeta(i);t.splice(n,s-n)}this._sortedMetasets=t.slice(0).sort(om("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:n}}=this;t.length>n.length&&delete this._stacks,t.forEach((s,i)=>{n.filter(o=>o===s._dataset).length===0&&this._destroyDatasetMeta(i)})}buildOrUpdateControllers(){const t=[],n=this.data.datasets;let s,i;for(this._removeUnreferencedMetasets(),s=0,i=n.length;s<i;s++){const o=n[s];let r=this.getDatasetMeta(s);const a=o.type||this.config.type;if(r.type&&r.type!==a&&(this._destroyDatasetMeta(s),r=this.getDatasetMeta(s)),r.type=a,r.indexAxis=o.indexAxis||al(a,this.options),r.order=o.order||0,r.index=s,r.label=""+o.label,r.visible=this.isDatasetVisible(s),r.controller)r.controller.updateIndex(s),r.controller.linkScales();else{const d=Dt.getController(a),{datasetElementType:c,dataElementType:u}=ke.datasets[a];Object.assign(d,{dataElementType:Dt.getElement(u),datasetElementType:c&&Dt.getElement(c)}),r.controller=new d(this,s),t.push(r.controller)}}return this._updateMetasets(),t}_resetElements(){he(this.data.datasets,(t,n)=>{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const n=this.config;n.update();const s=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),i=this._animationsDisabled=!s.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let c=0,u=this.data.datasets.length;c<u;c++){const{controller:h}=this.getDatasetMeta(c),f=!i&&o.indexOf(h)===-1;h.buildOrUpdateElements(f),r=Math.max(+h.getMaxOverflow(),r)}r=this._minPadding=s.layout.autoPadding?r:0,this._updateLayout(r),i||he(o,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(om("z","_idx"));const{_active:a,_lastEvent:d}=this;d?this._eventHandler(d,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){he(this.scales,t=>{ht.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,n=new Set(Object.keys(this._listeners)),s=new Set(t.events);(!Wh(n,s)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,n=this._getUniformDataChanges()||[];for(const{method:s,start:i,count:o}of n){const r=s==="_removeElements"?-o:o;ij(t,i,r)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const n=this.data.datasets.length,s=o=>new Set(t.filter(r=>r[0]===o).map((r,a)=>a+","+r.splice(1).join(","))),i=s(0);for(let o=1;o<n;o++)if(!Wh(i,s(o)))return;return Array.from(i).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;ht.update(this,this.width,this.height,t);const n=this.chartArea,s=n.width<=0||n.height<=0;this._layers=[],he(this.boxes,i=>{s&&i.position==="chartArea"||(i.configure&&i.configure(),this._layers.push(...i._layers()))},this),this._layers.forEach((i,o)=>{i._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let n=0,s=this.data.datasets.length;n<s;++n)this.getDatasetMeta(n).controller.configure();for(let n=0,s=this.data.datasets.length;n<s;++n)this._updateDataset(n,cn(t)?t({datasetIndex:n}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,n){const s=this.getDatasetMeta(t),i={meta:s,index:t,mode:n,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",i)!==!1&&(s.controller._update(n),i.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",i))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(Yt.has(this)?this.attached&&!Yt.running(this)&&Yt.start(this):(this.draw(),rm({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:s,height:i}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(s,i)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const n=this._layers;for(t=0;t<n.length&&n[t].z<=0;++t)n[t].draw(this.chartArea);for(this._drawDatasets();t<n.length;++t)n[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const n=this._sortedMetasets,s=[];let i,o;for(i=0,o=n.length;i<o;++i){const r=n[i];(!t||r.visible)&&s.push(r)}return s}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let n=t.length-1;n>=0;--n)this._drawDataset(t[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const n=this.ctx,s={meta:t,index:t.index,cancelable:!0},i=vf(this,t);this.notifyPlugins("beforeDatasetDraw",s)!==!1&&(i&&Ao(n,i),t.controller.draw(),i&&Fo(n),s.cancelable=!1,this.notifyPlugins("afterDatasetDraw",s))}isPointInArea(t){return qt(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,s,i){const o=n1.modes[n];return typeof o=="function"?o(this,t,s,i):[]}getDatasetMeta(t){const n=this.data.datasets[t],s=this._metasets;let i=s.filter(o=>o&&o._dataset===n).pop();return i||(i={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:t,_dataset:n,_parsed:[],_sorted:!1},s.push(i)),i}getContext(){return this.$context||(this.$context=hn(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const n=this.data.datasets[t];if(!n)return!1;const s=this.getDatasetMeta(t);return typeof s.hidden=="boolean"?!s.hidden:!n.hidden}setDatasetVisibility(t,n){const s=this.getDatasetMeta(t);s.hidden=!n}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,n,s){const i=s?"show":"hide",o=this.getDatasetMeta(t),r=o.controller._resolveAnimations(void 0,i);ai(n)?(o.data[n].hidden=!s,this.update()):(this.setDatasetVisibility(t,s),r.update(o,{visible:s}),this.update(a=>a.datasetIndex===t?i:void 0))}hide(t,n){this._updateVisibility(t,n,!1)}show(t,n){this._updateVisibility(t,n,!0)}_destroyDatasetMeta(t){const n=this._metasets[t];n&&n.controller&&n.controller._destroy(),delete this._metasets[t]}_stop(){let t,n;for(this.stop(),Yt.remove(this),t=0,n=this.data.datasets.length;t<n;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:n}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),tf(t,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete Qo[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,n=this.platform,s=(o,r)=>{n.addEventListener(this,o,r),t[o]=r},i=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};he(this.options.events,o=>s(o,i))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,n=this.platform,s=(d,c)=>{n.addEventListener(this,d,c),t[d]=c},i=(d,c)=>{t[d]&&(n.removeEventListener(this,d,c),delete t[d])},o=(d,c)=>{this.canvas&&this.resize(d,c)};let r;const a=()=>{i("attach",a),this.attached=!0,this.resize(),s("resize",o),s("detach",r)};r=()=>{this.attached=!1,i("resize",o),this._stop(),this._resize(0,0),s("attach",a)},n.isAttached(this.canvas)?a():r()}unbindEvents(){he(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},he(this._responsiveListeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,n,s){const i=s?"set":"remove";let o,r,a,d;for(n==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+i+"DatasetHoverStyle"]()),a=0,d=t.length;a<d;++a){r=t[a];const c=r&&this.getDatasetMeta(r.datasetIndex).controller;c&&c[i+"HoverStyle"](r.element,r.datasetIndex,r.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const n=this._active||[],s=t.map(({datasetIndex:o,index:r})=>{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[r],index:r}});!To(s,n)&&(this._active=s,this._lastEvent=null,this._updateHoverStyles(s,n))}notifyPlugins(t,n,s){return this._plugins.notify(this,t,n,s)}isPluginEnabled(t){return this._plugins._cache.filter(n=>n.plugin.id===t).length===1}_updateHoverStyles(t,n,s){const i=this.options.hover,o=(d,c)=>d.filter(u=>!c.some(h=>u.datasetIndex===h.datasetIndex&&u.index===h.index)),r=o(n,t),a=s?t:o(t,n);r.length&&this.updateHoverStyle(r,i.mode,!1),a.length&&i.mode&&this.updateHoverStyle(a,i.mode,!0)}_eventHandler(t,n){const s={event:t,replay:n,cancelable:!0,inChartArea:this.isPointInArea(t)},i=r=>(r.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",s,i)===!1)return;const o=this._handleEvent(t,n,s.inChartArea);return s.cancelable=!1,this.notifyPlugins("afterEvent",s,i),(o||s.changed)&&this.render(),this}_handleEvent(t,n,s){const{_active:i=[],options:o}=this,r=n,a=this._getActiveElements(t,i,s,r),d=hv(t),c=oj(t,this._lastEvent,s,d);s&&(this._lastEvent=null,pe(o.onHover,[t,a,this],this),d&&pe(o.onClick,[t,a,this],this));const u=!To(a,i);return(u||n)&&(this._active=a,this._updateHoverStyles(a,i,n)),this._lastEvent=c,u}_getActiveElements(t,n,s,i){if(t.type==="mouseout")return[];if(!s)return n;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,i)}},I(xn,"defaults",ke),I(xn,"instances",Qo),I(xn,"overrides",Dn),I(xn,"registry",Dt),I(xn,"version",tj),I(xn,"getChart",lm),xn);function dm(){return he(Zo.instances,e=>e._plugins.invalidate())}function rj(e,t,n){const{startAngle:s,x:i,y:o,outerRadius:r,innerRadius:a,options:d}=t,{borderWidth:c,borderJoinStyle:u}=d,h=Math.min(c/r,$e(s-n));if(e.beginPath(),e.arc(i,o,r-c/2,s+h/2,n-h/2),a>0){const f=Math.min(c/a,$e(s-n));e.arc(i,o,a+c/2,n-f/2,s+f/2,!0)}else{const f=Math.min(c/2,r*$e(s-n));if(u==="round")e.arc(i,o,f,n-le/2,s+le/2,!0);else if(u==="bevel"){const m=2*f*f,p=-m*Math.cos(n+le/2)+i,b=-m*Math.sin(n+le/2)+o,x=m*Math.cos(s+le/2)+i,w=m*Math.sin(s+le/2)+o;e.lineTo(p,b),e.lineTo(x,w)}}e.closePath(),e.moveTo(0,0),e.rect(0,0,e.canvas.width,e.canvas.height),e.clip("evenodd")}function aj(e,t,n){const{startAngle:s,pixelMargin:i,x:o,y:r,outerRadius:a,innerRadius:d}=t;let c=i/a;e.beginPath(),e.arc(o,r,a,s-c,n+c),d>i?(c=i/d,e.arc(o,r,d,n+c,s-c,!0)):e.arc(o,r,i,n+Ce,s-Ce),e.closePath(),e.clip()}function lj(e){return qa(e,["outerStart","outerEnd","innerStart","innerEnd"])}function dj(e,t,n,s){const i=lj(e.options.borderRadius),o=(n-t)/2,r=Math.min(o,s*t/2),a=d=>{const c=(n-Math.min(o,d))*s/2;return Ue(d,0,Math.min(o,c))};return{outerStart:a(i.outerStart),outerEnd:a(i.outerEnd),innerStart:Ue(i.innerStart,0,r),innerEnd:Ue(i.innerEnd,0,r)}}function bs(e,t,n,s){return{x:n+e*Math.cos(t),y:s+e*Math.sin(t)}}function Jo(e,t,n,s,i,o){const{x:r,y:a,startAngle:d,pixelMargin:c,innerRadius:u}=t,h=Math.max(t.outerRadius+s+n-c,0),f=u>0?u+s+n+c:0;let m=0;const p=i-d;if(s){const O=u>0?u-s:0,F=h>0?h-s:0,H=(O+F)/2,M=H!==0?p*H/(H+s):p;m=(p-M)/2}const b=Math.max(.001,p*h-n/le)/h,x=(p-b)/2,w=d+x+m,_=i-x-m,{outerStart:y,outerEnd:v,innerStart:j,innerEnd:k}=dj(t,f,h,_-w),C=h-y,S=h-v,T=w+y/C,D=_-v/S,P=f+j,L=f+k,W=w+j/P,$=_-k/L;if(e.beginPath(),o){const O=(T+D)/2;if(e.arc(r,a,h,T,O),e.arc(r,a,h,O,D),v>0){const E=bs(S,D,r,a);e.arc(E.x,E.y,v,D,_+Ce)}const F=bs(L,_,r,a);if(e.lineTo(F.x,F.y),k>0){const E=bs(L,$,r,a);e.arc(E.x,E.y,k,_+Ce,$+Math.PI)}const H=(_-k/f+(w+j/f))/2;if(e.arc(r,a,f,_-k/f,H,!0),e.arc(r,a,f,H,w+j/f,!0),j>0){const E=bs(P,W,r,a);e.arc(E.x,E.y,j,W+Math.PI,w-Ce)}const M=bs(C,w,r,a);if(e.lineTo(M.x,M.y),y>0){const E=bs(C,T,r,a);e.arc(E.x,E.y,y,w-Ce,T)}}else{e.moveTo(r,a);const O=Math.cos(T)*h+r,F=Math.sin(T)*h+a;e.lineTo(O,F);const H=Math.cos(D)*h+r,M=Math.sin(D)*h+a;e.lineTo(H,M)}e.closePath()}function cj(e,t,n,s,i){const{fullCircles:o,startAngle:r,circumference:a}=t;let d=t.endAngle;if(o){Jo(e,t,n,s,d,i);for(let c=0;c<o;++c)e.fill();isNaN(a)||(d=r+(a%be||be))}return Jo(e,t,n,s,d,i),e.fill(),d}function uj(e,t,n,s,i){const{fullCircles:o,startAngle:r,circumference:a,options:d}=t,{borderWidth:c,borderJoinStyle:u,borderDash:h,borderDashOffset:f,borderRadius:m}=d,p=d.borderAlign==="inner";if(!c)return;e.setLineDash(h||[]),e.lineDashOffset=f,p?(e.lineWidth=c*2,e.lineJoin=u||"round"):(e.lineWidth=c,e.lineJoin=u||"bevel");let b=t.endAngle;if(o){Jo(e,t,n,s,b,i);for(let x=0;x<o;++x)e.stroke();isNaN(a)||(b=r+(a%be||be))}p&&aj(e,t,b),d.selfJoin&&b-r>=le&&m===0&&u!=="miter"&&rj(e,t,b),o||(Jo(e,t,n,s,b,i),e.stroke())}class vi extends Kt{constructor(n){super();I(this,"circumference");I(this,"endAngle");I(this,"fullCircles");I(this,"innerRadius");I(this,"outerRadius");I(this,"pixelMargin");I(this,"startAngle");this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,n&&Object.assign(this,n)}inRange(n,s,i){const o=this.getProps(["x","y"],i),{angle:r,distance:a}=$h(o,{x:n,y:s}),{startAngle:d,endAngle:c,innerRadius:u,outerRadius:h,circumference:f}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),m=(this.options.spacing+this.options.borderWidth)/2,p=te(f,c-d),b=ci(r,d,c)&&d!==c,x=p>=be||b,w=Ut(a,u+m,h+m);return x&&w}getCenterPoint(n){const{x:s,y:i,startAngle:o,endAngle:r,innerRadius:a,outerRadius:d}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],n),{offset:c,spacing:u}=this.options,h=(o+r)/2,f=(a+d+u+c)/2;return{x:s+Math.cos(h)*f,y:i+Math.sin(h)*f}}tooltipPosition(n){return this.getCenterPoint(n)}draw(n){const{options:s,circumference:i}=this,o=(s.offset||0)/4,r=(s.spacing||0)/2,a=s.circular;if(this.pixelMargin=s.borderAlign==="inner"?.33:0,this.fullCircles=i>be?Math.floor(i/be):0,i===0||this.innerRadius<0||this.outerRadius<0)return;n.save();const d=(this.startAngle+this.endAngle)/2;n.translate(Math.cos(d)*o,Math.sin(d)*o);const c=1-Math.sin(Math.min(le,i||0)),u=o*c;n.fillStyle=s.backgroundColor,n.strokeStyle=s.borderColor,cj(n,this,u,r,a),uj(n,this,u,r,a),n.restore()}}I(vi,"id","arc"),I(vi,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1}),I(vi,"defaultRoutes",{backgroundColor:"backgroundColor"}),I(vi,"descriptors",{_scriptable:!0,_indexable:n=>n!=="borderDash"});function cm(e,t,n=t){e.lineCap=te(n.borderCapStyle,t.borderCapStyle),e.setLineDash(te(n.borderDash,t.borderDash)),e.lineDashOffset=te(n.borderDashOffset,t.borderDashOffset),e.lineJoin=te(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=te(n.borderWidth,t.borderWidth),e.strokeStyle=te(n.borderColor,t.borderColor)}function hj(e,t,n){e.lineTo(n.x,n.y)}function fj(e){return e.stepped?Fv:e.tension||e.cubicInterpolationMode==="monotone"?zv:hj}function um(e,t,n={}){const s=e.length,{start:i=0,end:o=s-1}=n,{start:r,end:a}=t,d=Math.max(i,r),c=Math.min(o,a),u=i<r&&o<r||i>a&&o>a;return{count:s,start:d,loop:t.loop,ilen:c<d&&!u?s+c-d:c-d}}function mj(e,t,n,s){const{points:i,options:o}=t,{count:r,start:a,loop:d,ilen:c}=um(i,n,s),u=fj(o);let{move:h=!0,reverse:f}=s||{},m,p,b;for(m=0;m<=c;++m)p=i[(a+(f?c-m:m))%r],!p.skip&&(h?(e.moveTo(p.x,p.y),h=!1):u(e,b,p,f,o.stepped),b=p);return d&&(p=i[(a+(f?c:0))%r],u(e,b,p,f,o.stepped)),!!d}function pj(e,t,n,s){const i=t.points,{count:o,start:r,ilen:a}=um(i,n,s),{move:d=!0,reverse:c}=s||{};let u=0,h=0,f,m,p,b,x,w;const _=v=>(r+(c?a-v:v))%o,y=()=>{b!==x&&(e.lineTo(u,x),e.lineTo(u,b),e.lineTo(u,w))};for(d&&(m=i[_(0)],e.moveTo(m.x,m.y)),f=0;f<=a;++f){if(m=i[_(f)],m.skip)continue;const v=m.x,j=m.y,k=v|0;k===p?(j<b?b=j:j>x&&(x=j),u=(h*u+v)/++h):(y(),e.lineTo(v,j),p=k,h=0,b=x=j),w=j}y()}function dl(e){const t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!n?pj:mj}function gj(e){return e.stepped?gk:e.tension||e.cubicInterpolationMode==="monotone"?bk:zn}function bj(e,t,n,s){let i=t._path;i||(i=t._path=new Path2D,t.path(i,n,s)&&i.closePath()),cm(e,t.options),e.stroke(i)}function xj(e,t,n,s){const{segments:i,options:o}=t,r=dl(t);for(const a of i)cm(e,o,a.style),e.beginPath(),r(e,t,a,{start:n,end:n+s-1})&&e.closePath(),e.stroke()}const wj=typeof Path2D=="function";function _j(e,t,n,s){wj&&!t.options.segment?bj(e,t,n,s):xj(e,t,n,s)}class mn extends Kt{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,n){const s=this.options;if((s.tension||s.cubicInterpolationMode==="monotone")&&!s.stepped&&!this._pointsUpdated){const i=s.spanGaps?this._loop:this._fullLoop;lk(this._points,s,t,i,n),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=kk(this,this.options.segment))}first(){const t=this.segments,n=this.points;return t.length&&n[t[0].start]}last(){const t=this.segments,n=this.points,s=t.length;return s&&n[t[s-1].end]}interpolate(t,n){const s=this.options,i=t[n],o=this.points,r=wf(this,{property:n,start:i,end:i});if(!r.length)return;const a=[],d=gj(s);let c,u;for(c=0,u=r.length;c<u;++c){const{start:h,end:f}=r[c],m=o[h],p=o[f];if(m===p){a.push(m);continue}const b=Math.abs((i-m[n])/(p[n]-m[n])),x=d(m,p,b,s.stepped);x[n]=t[n],a.push(x)}return a.length===1?a[0]:a}pathSegment(t,n,s){return dl(this)(t,this,n,s)}path(t,n,s){const i=this.segments,o=dl(this);let r=this._loop;n=n||0,s=s||this.points.length-n;for(const a of i)r&=o(t,this,a,{start:n,end:n+s-1});return!!r}draw(t,n,s,i){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),_j(t,this,s,i),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}I(mn,"id","line"),I(mn,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),I(mn,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),I(mn,"descriptors",{_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"});function hm(e,t,n,s){const i=e.options,{[n]:o}=e.getProps([n],s);return Math.abs(t-o)<i.radius+i.hitRadius}class er extends Kt{constructor(n){super();I(this,"parsed");I(this,"skip");I(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,n&&Object.assign(this,n)}inRange(n,s,i){const o=this.options,{x:r,y:a}=this.getProps(["x","y"],i);return Math.pow(n-r,2)+Math.pow(s-a,2)<Math.pow(o.hitRadius+o.radius,2)}inXRange(n,s){return hm(this,n,"x",s)}inYRange(n,s){return hm(this,n,"y",s)}getCenterPoint(n){const{x:s,y:i}=this.getProps(["x","y"],n);return{x:s,y:i}}size(n){n=n||this.options||{};let s=n.radius||0;s=Math.max(s,s&&n.hoverRadius||0);const i=s&&n.borderWidth||0;return(s+i)*2}draw(n,s){const i=this.options;this.skip||i.radius<.1||!qt(this,s,this.size(i)/2)||(n.strokeStyle=i.borderColor,n.lineWidth=i.borderWidth,n.fillStyle=i.backgroundColor,Ua(n,i,this.x,this.y))}getRange(){const n=this.options||{};return n.radius+n.hitRadius}}I(er,"id","point"),I(er,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),I(er,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function fm(e,t){const{x:n,y:s,base:i,width:o,height:r}=e.getProps(["x","y","base","width","height"],t);let a,d,c,u,h;return e.horizontal?(h=r/2,a=Math.min(n,i),d=Math.max(n,i),c=s-h,u=s+h):(h=o/2,a=n-h,d=n+h,c=Math.min(s,i),u=Math.max(s,i)),{left:a,top:c,right:d,bottom:u}}function pn(e,t,n,s){return e?0:Ue(t,n,s)}function yj(e,t,n){const s=e.options.borderWidth,i=e.borderSkipped,o=sf(s);return{t:pn(i.top,o.top,0,n),r:pn(i.right,o.right,0,t),b:pn(i.bottom,o.bottom,0,n),l:pn(i.left,o.left,0,t)}}function vj(e,t,n){const{enableBorderRadius:s}=e.getProps(["enableBorderRadius"]),i=e.options.borderRadius,o=Ln(i),r=Math.min(t,n),a=e.borderSkipped,d=s||ie(i);return{topLeft:pn(!d||a.top||a.left,o.topLeft,0,r),topRight:pn(!d||a.top||a.right,o.topRight,0,r),bottomLeft:pn(!d||a.bottom||a.left,o.bottomLeft,0,r),bottomRight:pn(!d||a.bottom||a.right,o.bottomRight,0,r)}}function kj(e){const t=fm(e),n=t.right-t.left,s=t.bottom-t.top,i=yj(e,n/2,s/2),o=vj(e,n/2,s/2);return{outer:{x:t.left,y:t.top,w:n,h:s,radius:o},inner:{x:t.left+i.l,y:t.top+i.t,w:n-i.l-i.r,h:s-i.t-i.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(i.t,i.l)),topRight:Math.max(0,o.topRight-Math.max(i.t,i.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(i.b,i.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(i.b,i.r))}}}}function cl(e,t,n,s){const i=t===null,o=n===null,a=e&&!(i&&o)&&fm(e,s);return a&&(i||Ut(t,a.left,a.right))&&(o||Ut(n,a.top,a.bottom))}function jj(e){return e.topLeft||e.topRight||e.bottomLeft||e.bottomRight}function Nj(e,t){e.rect(t.x,t.y,t.w,t.h)}function ul(e,t,n={}){const s=e.x!==n.x?-t:0,i=e.y!==n.y?-t:0,o=(e.x+e.w!==n.x+n.w?t:0)-s,r=(e.y+e.h!==n.y+n.h?t:0)-i;return{x:e.x+s,y:e.y+i,w:e.w+o,h:e.h+r,radius:e.radius}}class tr extends Kt{constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:n,options:{borderColor:s,backgroundColor:i}}=this,{inner:o,outer:r}=kj(this),a=jj(r.radius)?fi:Nj;t.save(),(r.w!==o.w||r.h!==o.h)&&(t.beginPath(),a(t,ul(r,n,o)),t.clip(),a(t,ul(o,-n,r)),t.fillStyle=s,t.fill("evenodd")),t.beginPath(),a(t,ul(o,n)),t.fillStyle=i,t.fill(),t.restore()}inRange(t,n,s){return cl(this,t,n,s)}inXRange(t,n){return cl(this,t,null,n)}inYRange(t,n){return cl(this,null,t,n)}getCenterPoint(t){const{x:n,y:s,base:i,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(n+i)/2:n,y:o?s:(s+i)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}}I(tr,"id","bar"),I(tr,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),I(tr,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function Sj(e,t,n){const s=e.segments,i=e.points,o=t.points,r=[];for(const a of s){let{start:d,end:c}=a;c=nr(d,c,i);const u=hl(n,i[d],i[c],a.loop);if(!t.segments){r.push({source:a,target:u,start:i[d],end:i[c]});continue}const h=wf(t,u);for(const f of h){const m=hl(n,o[f.start],o[f.end],f.loop),p=xf(a,i,m);for(const b of p)r.push({source:b,target:f,start:{[n]:mm(u,m,"start",Math.max)},end:{[n]:mm(u,m,"end",Math.min)}})}}return r}function hl(e,t,n,s){if(s)return;let i=t[e],o=n[e];return e==="angle"&&(i=$e(i),o=$e(o)),{property:e,start:i,end:o}}function Cj(e,t){const{x:n=null,y:s=null}=e||{},i=t.points,o=[];return t.segments.forEach(({start:r,end:a})=>{a=nr(r,a,i);const d=i[r],c=i[a];s!==null?(o.push({x:d.x,y:s}),o.push({x:c.x,y:s})):n!==null&&(o.push({x:n,y:d.y}),o.push({x:n,y:c.y}))}),o}function nr(e,t,n){for(;t>e;t--){const s=n[t];if(!isNaN(s.x)&&!isNaN(s.y))break}return t}function mm(e,t,n,s){return e&&t?s(e[n],t[n]):e?e[n]:t?t[n]:0}function pm(e,t){let n=[],s=!1;return ge(e)?(s=!0,n=e):n=Cj(e,t),n.length?new mn({points:n,options:{tension:0},_loop:s,_fullLoop:s}):null}function gm(e){return e&&e.fill!==!1}function Mj(e,t,n){let i=e[t].fill;const o=[t];let r;if(!n)return i;for(;i!==!1&&o.indexOf(i)===-1;){if(!ve(i))return i;if(r=e[i],!r)return!1;if(r.visible)return i;o.push(i),i=r.fill}return!1}function Tj(e,t,n){const s=Oj(e);if(ie(s))return isNaN(s.value)?!1:s;let i=parseFloat(s);return ve(i)&&Math.floor(i)===i?Pj(s[0],t,i,n):["origin","start","end","stack","shape"].indexOf(s)>=0&&s}function Pj(e,t,n,s){return(e==="-"||e==="+")&&(n=t+n),n===t||n<0||n>=s?!1:n}function Ej(e,t){let n=null;return e==="start"?n=t.bottom:e==="end"?n=t.top:ie(e)?n=t.getPixelForValue(e.value):t.getBasePixel&&(n=t.getBasePixel()),n}function Dj(e,t,n){let s;return e==="start"?s=n:e==="end"?s=t.options.reverse?t.min:t.max:ie(e)?s=e.value:s=t.getBaseValue(),s}function Oj(e){const t=e.options,n=t.fill;let s=te(n&&n.target,n);return s===void 0&&(s=!!t.backgroundColor),s===!1||s===null?!1:s===!0?"origin":s}function Ij(e){const{scale:t,index:n,line:s}=e,i=[],o=s.segments,r=s.points,a=Lj(t,n);a.push(pm({x:null,y:t.bottom},s));for(let d=0;d<o.length;d++){const c=o[d];for(let u=c.start;u<=c.end;u++)Aj(i,r[u],a)}return new mn({points:i,options:{}})}function Lj(e,t){const n=[],s=e.getMatchingVisibleMetas("line");for(let i=0;i<s.length;i++){const o=s[i];if(o.index===t)break;o.hidden||n.unshift(o.dataset)}return n}function Aj(e,t,n){const s=[];for(let i=0;i<n.length;i++){const o=n[i],{first:r,last:a,point:d}=Fj(o,t,"x");if(!(!d||r&&a)){if(r)s.unshift(d);else if(e.push(d),!a)break}}e.push(...s)}function Fj(e,t,n){const s=e.interpolate(t,n);if(!s)return{};const i=s[n],o=e.segments,r=e.points;let a=!1,d=!1;for(let c=0;c<o.length;c++){const u=o[c],h=r[u.start][n],f=r[u.end][n];if(Ut(i,h,f)){a=i===h,d=i===f;break}}return{first:a,last:d,point:s}}class bm{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,n,s){const{x:i,y:o,radius:r}=this;return n=n||{start:0,end:be},t.arc(i,o,r,n.end,n.start,!0),!s.bounds}interpolate(t){const{x:n,y:s,radius:i}=this,o=t.angle;return{x:n+Math.cos(o)*i,y:s+Math.sin(o)*i,angle:o}}}function zj(e){const{chart:t,fill:n,line:s}=e;if(ve(n))return Wj(t,n);if(n==="stack")return Ij(e);if(n==="shape")return!0;const i=Bj(e);return i instanceof bm?i:pm(i,s)}function Wj(e,t){const n=e.getDatasetMeta(t);return n&&e.isDatasetVisible(t)?n.dataset:null}function Bj(e){return(e.scale||{}).getPointPositionForValue?Vj(e):Hj(e)}function Hj(e){const{scale:t={},fill:n}=e,s=Ej(n,t);if(ve(s)){const i=t.isHorizontal();return{x:i?s:null,y:i?null:s}}return null}function Vj(e){const{scale:t,fill:n}=e,s=t.options,i=t.getLabels().length,o=s.reverse?t.max:t.min,r=Dj(n,t,o),a=[];if(s.grid.circular){const d=t.getPointPositionForValue(0,o);return new bm({x:d.x,y:d.y,radius:t.getDistanceFromCenterForValue(r)})}for(let d=0;d<i;++d)a.push(t.getPointPositionForValue(d,r));return a}function fl(e,t,n){const s=zj(t),{chart:i,index:o,line:r,scale:a,axis:d}=t,c=r.options,u=c.fill,h=c.backgroundColor,{above:f=h,below:m=h}=u||{},p=i.getDatasetMeta(o),b=vf(i,p);s&&r.points.length&&(Ao(e,n),Rj(e,{line:r,target:s,above:f,below:m,area:n,scale:a,axis:d,clip:b}),Fo(e))}function Rj(e,t){const{line:n,target:s,above:i,below:o,area:r,scale:a,clip:d}=t,c=n._loop?"angle":t.axis;e.save();let u=o;o!==i&&(c==="x"?(xm(e,s,r.top),ml(e,{line:n,target:s,color:i,scale:a,property:c,clip:d}),e.restore(),e.save(),xm(e,s,r.bottom)):c==="y"&&(wm(e,s,r.left),ml(e,{line:n,target:s,color:o,scale:a,property:c,clip:d}),e.restore(),e.save(),wm(e,s,r.right),u=i)),ml(e,{line:n,target:s,color:u,scale:a,property:c,clip:d}),e.restore()}function xm(e,t,n){const{segments:s,points:i}=t;let o=!0,r=!1;e.beginPath();for(const a of s){const{start:d,end:c}=a,u=i[d],h=i[nr(d,c,i)];o?(e.moveTo(u.x,u.y),o=!1):(e.lineTo(u.x,n),e.lineTo(u.x,u.y)),r=!!t.pathSegment(e,a,{move:r}),r?e.closePath():e.lineTo(h.x,n)}e.lineTo(t.first().x,n),e.closePath(),e.clip()}function wm(e,t,n){const{segments:s,points:i}=t;let o=!0,r=!1;e.beginPath();for(const a of s){const{start:d,end:c}=a,u=i[d],h=i[nr(d,c,i)];o?(e.moveTo(u.x,u.y),o=!1):(e.lineTo(n,u.y),e.lineTo(u.x,u.y)),r=!!t.pathSegment(e,a,{move:r}),r?e.closePath():e.lineTo(n,h.y)}e.lineTo(n,t.first().y),e.closePath(),e.clip()}function ml(e,t){const{line:n,target:s,property:i,color:o,scale:r,clip:a}=t,d=Sj(n,s,i);for(const{source:c,target:u,start:h,end:f}of d){const{style:{backgroundColor:m=o}={}}=c,p=s!==!0;e.save(),e.fillStyle=m,$j(e,r,a,p&&hl(i,h,f)),e.beginPath();const b=!!n.pathSegment(e,c);let x;if(p){b?e.closePath():_m(e,s,f,i);const w=!!s.pathSegment(e,u,{move:b,reverse:!0});x=b&&w,x||_m(e,s,h,i)}e.closePath(),e.fill(x?"evenodd":"nonzero"),e.restore()}}function $j(e,t,n,s){const i=t.chart.chartArea,{property:o,start:r,end:a}=s||{};if(o==="x"||o==="y"){let d,c,u,h;o==="x"?(d=r,c=i.top,u=a,h=i.bottom):(d=i.left,c=r,u=i.right,h=a),e.beginPath(),n&&(d=Math.max(d,n.left),u=Math.min(u,n.right),c=Math.max(c,n.top),h=Math.min(h,n.bottom)),e.rect(d,c,u-d,h-c),e.clip()}}function _m(e,t,n,s){const i=t.interpolate(n,s);i&&e.lineTo(i.x,i.y)}var Uj={id:"filler",afterDatasetsUpdate(e,t,n){const s=(e.data.datasets||[]).length,i=[];let o,r,a,d;for(r=0;r<s;++r)o=e.getDatasetMeta(r),a=o.dataset,d=null,a&&a.options&&a instanceof mn&&(d={visible:e.isDatasetVisible(r),index:r,fill:Tj(a,r,s),chart:e,axis:o.controller.options.indexAxis,scale:o.vScale,line:a}),o.$filler=d,i.push(d);for(r=0;r<s;++r)d=i[r],!(!d||d.fill===!1)&&(d.fill=Mj(i,r,n.propagate))},beforeDraw(e,t,n){const s=n.drawTime==="beforeDraw",i=e.getSortedVisibleDatasetMetas(),o=e.chartArea;for(let r=i.length-1;r>=0;--r){const a=i[r].$filler;a&&(a.line.updateControlPoints(o,a.axis),s&&a.fill&&fl(e.ctx,a,o))}},beforeDatasetsDraw(e,t,n){if(n.drawTime!=="beforeDatasetsDraw")return;const s=e.getSortedVisibleDatasetMetas();for(let i=s.length-1;i>=0;--i){const o=s[i].$filler;gm(o)&&fl(e.ctx,o,e.chartArea)}},beforeDatasetDraw(e,t,n){const s=t.meta.$filler;!gm(s)||n.drawTime!=="beforeDatasetDraw"||fl(e.ctx,s,e.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const ym=(e,t)=>{let{boxHeight:n=t,boxWidth:s=t}=e;return e.usePointStyle&&(n=Math.min(n,t),s=e.pointStyleWidth||Math.min(s,t)),{boxWidth:s,boxHeight:n,itemHeight:Math.max(t,n)}},qj=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index;class vm extends Kt{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n,s){this.maxWidth=t,this.maxHeight=n,this._margins=s,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let n=pe(t.generateLabels,[this.chart],this)||[];t.filter&&(n=n.filter(s=>t.filter(s,this.chart.data))),t.sort&&(n=n.sort((s,i)=>t.sort(s,i,this.chart.data))),this.options.reverse&&n.reverse(),this.legendItems=n}fit(){const{options:t,ctx:n}=this;if(!t.display){this.width=this.height=0;return}const s=t.labels,i=De(s.font),o=i.size,r=this._computeTitleHeight(),{boxWidth:a,itemHeight:d}=ym(s,o);let c,u;n.font=i.string,this.isHorizontal()?(c=this.maxWidth,u=this._fitRows(r,o,a,d)+10):(u=this.maxHeight,c=this._fitCols(r,i,a,d)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(u,t.maxHeight||this.maxHeight)}_fitRows(t,n,s,i){const{ctx:o,maxWidth:r,options:{labels:{padding:a}}}=this,d=this.legendHitBoxes=[],c=this.lineWidths=[0],u=i+a;let h=t;o.textAlign="left",o.textBaseline="middle";let f=-1,m=-u;return this.legendItems.forEach((p,b)=>{const x=s+n/2+o.measureText(p.text).width;(b===0||c[c.length-1]+x+2*a>r)&&(h+=u,c[c.length-(b>0?0:1)]=0,m+=u,f++),d[b]={left:0,top:m,row:f,width:x,height:i},c[c.length-1]+=x+a}),h}_fitCols(t,n,s,i){const{ctx:o,maxHeight:r,options:{labels:{padding:a}}}=this,d=this.legendHitBoxes=[],c=this.columnSizes=[],u=r-t;let h=a,f=0,m=0,p=0,b=0;return this.legendItems.forEach((x,w)=>{const{itemWidth:_,itemHeight:y}=Yj(s,n,o,x,i);w>0&&m+y+2*a>u&&(h+=f+a,c.push({width:f,height:m}),p+=f+a,b++,f=m=0),d[w]={left:p,top:m,col:b,width:_,height:y},f=Math.max(f,_),m+=y+a}),h+=f,c.push({width:f,height:m}),h}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:s,labels:{padding:i},rtl:o}}=this,r=ps(o,this.left,this.width);if(this.isHorizontal()){let a=0,d=qe(s,this.left+i,this.right-this.lineWidths[a]);for(const c of n)a!==c.row&&(a=c.row,d=qe(s,this.left+i,this.right-this.lineWidths[a])),c.top+=this.top+t+i,c.left=r.leftForLtr(r.x(d),c.width),d+=c.width+i}else{let a=0,d=qe(s,this.top+t+i,this.bottom-this.columnSizes[a].height);for(const c of n)c.col!==a&&(a=c.col,d=qe(s,this.top+t+i,this.bottom-this.columnSizes[a].height)),c.top=d,c.left+=this.left+i,c.left=r.leftForLtr(r.x(c.left),c.width),d+=c.height+i}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;Ao(t,this),this._draw(),Fo(t)}}_draw(){const{options:t,columnSizes:n,lineWidths:s,ctx:i}=this,{align:o,labels:r}=t,a=ke.color,d=ps(t.rtl,this.left,this.width),c=De(r.font),{padding:u}=r,h=c.size,f=h/2;let m;this.drawTitle(),i.textAlign=d.textAlign("left"),i.textBaseline="middle",i.lineWidth=.5,i.font=c.string;const{boxWidth:p,boxHeight:b,itemHeight:x}=ym(r,h),w=function(k,C,S){if(isNaN(p)||p<=0||isNaN(b)||b<0)return;i.save();const T=te(S.lineWidth,1);if(i.fillStyle=te(S.fillStyle,a),i.lineCap=te(S.lineCap,"butt"),i.lineDashOffset=te(S.lineDashOffset,0),i.lineJoin=te(S.lineJoin,"miter"),i.lineWidth=T,i.strokeStyle=te(S.strokeStyle,a),i.setLineDash(te(S.lineDash,[])),r.usePointStyle){const D={radius:b*Math.SQRT2/2,pointStyle:S.pointStyle,rotation:S.rotation,borderWidth:T},P=d.xPlus(k,p/2),L=C+f;nf(i,D,P,L,r.pointStyleWidth&&p)}else{const D=C+Math.max((h-b)/2,0),P=d.leftForLtr(k,p),L=Ln(S.borderRadius);i.beginPath(),Object.values(L).some(W=>W!==0)?fi(i,{x:P,y:D,w:p,h:b,radius:L}):i.rect(P,D,p,b),i.fill(),T!==0&&i.stroke()}i.restore()},_=function(k,C,S){In(i,S.text,k,C+x/2,c,{strikethrough:S.hidden,textAlign:d.textAlign(S.textAlign)})},y=this.isHorizontal(),v=this._computeTitleHeight();y?m={x:qe(o,this.left+u,this.right-s[0]),y:this.top+u+v,line:0}:m={x:this.left+u,y:qe(o,this.top+v+u,this.bottom-n[0].height),line:0},mf(this.ctx,t.textDirection);const j=x+u;this.legendItems.forEach((k,C)=>{i.strokeStyle=k.fontColor,i.fillStyle=k.fontColor;const S=i.measureText(k.text).width,T=d.textAlign(k.textAlign||(k.textAlign=r.textAlign)),D=p+f+S;let P=m.x,L=m.y;d.setWidth(this.width),y?C>0&&P+D+u>this.right&&(L=m.y+=j,m.line++,P=m.x=qe(o,this.left+u,this.right-s[m.line])):C>0&&L+j>this.bottom&&(P=m.x=P+n[m.line].width+u,m.line++,L=m.y=qe(o,this.top+v+u,this.bottom-n[m.line].height));const W=d.x(P);if(w(W,L,k),P=jv(T,P+p+f,y?P+D:this.right,t.rtl),_(d.x(P),L,k),y)m.x+=D+u;else if(typeof k.text!="string"){const $=c.lineHeight;m.y+=km(k,$)+u}else m.y+=j}),pf(this.ctx,t.textDirection)}drawTitle(){const t=this.options,n=t.title,s=De(n.font),i=Ye(n.padding);if(!n.display)return;const o=ps(t.rtl,this.left,this.width),r=this.ctx,a=n.position,d=s.size/2,c=i.top+d;let u,h=this.left,f=this.width;if(this.isHorizontal())f=Math.max(...this.lineWidths),u=this.top+c,h=qe(t.align,h,this.right-f);else{const p=this.columnSizes.reduce((b,x)=>Math.max(b,x.height),0);u=c+qe(t.align,this.top,this.bottom-p-t.labels.padding-this._computeTitleHeight())}const m=qe(a,h,h+f);r.textAlign=o.textAlign(Ba(a)),r.textBaseline="middle",r.strokeStyle=n.color,r.fillStyle=n.color,r.font=s.string,In(r,n.text,m,u,s)}_computeTitleHeight(){const t=this.options.title,n=De(t.font),s=Ye(t.padding);return t.display?n.lineHeight+s.height:0}_getLegendItemAt(t,n){let s,i,o;if(Ut(t,this.left,this.right)&&Ut(n,this.top,this.bottom)){for(o=this.legendHitBoxes,s=0;s<o.length;++s)if(i=o[s],Ut(t,i.left,i.left+i.width)&&Ut(n,i.top,i.top+i.height))return this.legendItems[s]}return null}handleEvent(t){const n=this.options;if(!Xj(t.type,n))return;const s=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const i=this._hoveredItem,o=qj(i,s);i&&!o&&pe(n.onLeave,[t,i,this],this),this._hoveredItem=s,s&&!o&&pe(n.onHover,[t,s,this],this)}else s&&pe(n.onClick,[t,s,this],this)}}function Yj(e,t,n,s,i){const o=Kj(s,e,t,n),r=Gj(i,s,t.lineHeight);return{itemWidth:o,itemHeight:r}}function Kj(e,t,n,s){let i=e.text;return i&&typeof i!="string"&&(i=i.reduce((o,r)=>o.length>r.length?o:r)),t+n.size/2+s.measureText(i).width}function Gj(e,t,n){let s=e;return typeof t.text!="string"&&(s=km(t,n)),s}function km(e,t){const n=e.text?e.text.length:0;return t*n}function Xj(e,t){return!!((e==="mousemove"||e==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(e==="click"||e==="mouseup"))}var Qj={id:"legend",_element:vm,start(e,t,n){const s=e.legend=new vm({ctx:e.ctx,options:n,chart:e});ht.configure(e,s,n),ht.addBox(e,s)},stop(e){ht.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){const s=e.legend;ht.configure(e,s,n),s.options=n},afterUpdate(e){const t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){const s=t.datasetIndex,i=n.chart;i.isDatasetVisible(s)?(i.hide(s),t.hidden=!0):(i.show(s),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){const t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:s,textAlign:i,color:o,useBorderRadius:r,borderRadius:a}}=e.legend.options;return e._getSortedDatasetMetas().map(d=>{const c=d.controller.getStyle(n?0:void 0),u=Ye(c.borderWidth);return{text:t[d.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!d.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(u.width+u.height)/4,strokeStyle:c.borderColor,pointStyle:s||c.pointStyle,rotation:c.rotation,textAlign:i||c.textAlign,borderRadius:r&&(a||c.borderRadius),datasetIndex:d.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}};class jm extends Kt{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n){const s=this.options;if(this.left=0,this.top=0,!s.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=n;const i=ge(s.text)?s.text.length:1;this._padding=Ye(s.padding);const o=i*De(s.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:n,left:s,bottom:i,right:o,options:r}=this,a=r.align;let d=0,c,u,h;return this.isHorizontal()?(u=qe(a,s,o),h=n+t,c=o-s):(r.position==="left"?(u=s+t,h=qe(a,i,n),d=le*-.5):(u=o-t,h=qe(a,n,i),d=le*.5),c=i-n),{titleX:u,titleY:h,maxWidth:c,rotation:d}}draw(){const t=this.ctx,n=this.options;if(!n.display)return;const s=De(n.font),o=s.lineHeight/2+this._padding.top,{titleX:r,titleY:a,maxWidth:d,rotation:c}=this._drawArgs(o);In(t,n.text,0,0,s,{color:n.color,maxWidth:d,rotation:c,textAlign:Ba(n.align),textBaseline:"middle",translation:[r,a]})}}function Zj(e,t){const n=new jm({ctx:e.ctx,options:t,chart:e});ht.configure(e,n,t),ht.addBox(e,n),e.titleBlock=n}var Jj={id:"title",_element:jm,start(e,t,n){Zj(e,n)},stop(e){const t=e.titleBlock;ht.removeBox(e,t),delete e.titleBlock},beforeUpdate(e,t,n){const s=e.titleBlock;ht.configure(e,s,n),s.options=n},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const ki={average(e){if(!e.length)return!1;let t,n,s=new Set,i=0,o=0;for(t=0,n=e.length;t<n;++t){const a=e[t].element;if(a&&a.hasValue()){const d=a.tooltipPosition();s.add(d.x),i+=d.y,++o}}return o===0||s.size===0?!1:{x:[...s].reduce((a,d)=>a+d)/s.size,y:i/o}},nearest(e,t){if(!e.length)return!1;let n=t.x,s=t.y,i=Number.POSITIVE_INFINITY,o,r,a;for(o=0,r=e.length;o<r;++o){const d=e[o].element;if(d&&d.hasValue()){const c=d.getCenterPoint(),u=za(t,c);u<i&&(i=u,a=d)}}if(a){const d=a.tooltipPosition();n=d.x,s=d.y}return{x:n,y:s}}};function Ot(e,t){return t&&(ge(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function Gt(e){return(typeof e=="string"||e instanceof String)&&e.indexOf(`
`)>-1?e.split(`
`):e}function e2(e,t){const{element:n,datasetIndex:s,index:i}=t,o=e.getDatasetMeta(s).controller,{label:r,value:a}=o.getLabelAndValue(i);return{chart:e,label:r,parsed:o.getParsed(i),raw:e.data.datasets[s].data[i],formattedValue:a,dataset:o.getDataset(),dataIndex:i,datasetIndex:s,element:n}}function Nm(e,t){const n=e.chart.ctx,{body:s,footer:i,title:o}=e,{boxWidth:r,boxHeight:a}=t,d=De(t.bodyFont),c=De(t.titleFont),u=De(t.footerFont),h=o.length,f=i.length,m=s.length,p=Ye(t.padding);let b=p.height,x=0,w=s.reduce((v,j)=>v+j.before.length+j.lines.length+j.after.length,0);if(w+=e.beforeBody.length+e.afterBody.length,h&&(b+=h*c.lineHeight+(h-1)*t.titleSpacing+t.titleMarginBottom),w){const v=t.displayColors?Math.max(a,d.lineHeight):d.lineHeight;b+=m*v+(w-m)*d.lineHeight+(w-1)*t.bodySpacing}f&&(b+=t.footerMarginTop+f*u.lineHeight+(f-1)*t.footerSpacing);let _=0;const y=function(v){x=Math.max(x,n.measureText(v).width+_)};return n.save(),n.font=c.string,he(e.title,y),n.font=d.string,he(e.beforeBody.concat(e.afterBody),y),_=t.displayColors?r+2+t.boxPadding:0,he(s,v=>{he(v.before,y),he(v.lines,y),he(v.after,y)}),_=0,n.font=u.string,he(e.footer,y),n.restore(),x+=p.width,{width:x,height:b}}function t2(e,t){const{y:n,height:s}=t;return n<s/2?"top":n>e.height-s/2?"bottom":"center"}function n2(e,t,n,s){const{x:i,width:o}=s,r=n.caretSize+n.caretPadding;if(e==="left"&&i+o+r>t.width||e==="right"&&i-o-r<0)return!0}function s2(e,t,n,s){const{x:i,width:o}=n,{width:r,chartArea:{left:a,right:d}}=e;let c="center";return s==="center"?c=i<=(a+d)/2?"left":"right":i<=o/2?c="left":i>=r-o/2&&(c="right"),n2(c,e,t,n)&&(c="center"),c}function Sm(e,t,n){const s=n.yAlign||t.yAlign||t2(e,n);return{xAlign:n.xAlign||t.xAlign||s2(e,t,n,s),yAlign:s}}function i2(e,t){let{x:n,width:s}=e;return t==="right"?n-=s:t==="center"&&(n-=s/2),n}function o2(e,t,n){let{y:s,height:i}=e;return t==="top"?s+=n:t==="bottom"?s-=i+n:s-=i/2,s}function Cm(e,t,n,s){const{caretSize:i,caretPadding:o,cornerRadius:r}=e,{xAlign:a,yAlign:d}=n,c=i+o,{topLeft:u,topRight:h,bottomLeft:f,bottomRight:m}=Ln(r);let p=i2(t,a);const b=o2(t,d,c);return d==="center"?a==="left"?p+=c:a==="right"&&(p-=c):a==="left"?p-=Math.max(u,f)+i:a==="right"&&(p+=Math.max(h,m)+i),{x:Ue(p,0,s.width-t.width),y:Ue(b,0,s.height-t.height)}}function sr(e,t,n){const s=Ye(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-s.right:e.x+s.left}function Mm(e){return Ot([],Gt(e))}function r2(e,t,n){return hn(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function Tm(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const Pm={beforeTitle:$t,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,s=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(s>0&&t.dataIndex<s)return n[t.dataIndex]}return""},afterTitle:$t,beforeBody:$t,beforeLabel:$t,label(e){if(this&&this.options&&this.options.mode==="dataset")return e.label+": "+e.formattedValue||e.formattedValue;let t=e.dataset.label||"";t&&(t+=": ");const n=e.formattedValue;return oe(n)||(t+=n),t},labelColor(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:n.borderColor,backgroundColor:n.backgroundColor,borderWidth:n.borderWidth,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:$t,afterBody:$t,beforeFooter:$t,footer:$t,afterFooter:$t};function et(e,t,n,s){const i=e[t].call(n,s);return typeof i>"u"?Pm[t].call(n,s):i}class pl extends Kt{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const n=this.chart,s=this.options.setContext(this.getContext()),i=s.enabled&&n.options.animation&&s.animations,o=new jf(this.chart,i);return i._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=r2(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:s}=n,i=et(s,"beforeTitle",this,t),o=et(s,"title",this,t),r=et(s,"afterTitle",this,t);let a=[];return a=Ot(a,Gt(i)),a=Ot(a,Gt(o)),a=Ot(a,Gt(r)),a}getBeforeBody(t,n){return Mm(et(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:s}=n,i=[];return he(t,o=>{const r={before:[],lines:[],after:[]},a=Tm(s,o);Ot(r.before,Gt(et(a,"beforeLabel",this,o))),Ot(r.lines,et(a,"label",this,o)),Ot(r.after,Gt(et(a,"afterLabel",this,o))),i.push(r)}),i}getAfterBody(t,n){return Mm(et(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:s}=n,i=et(s,"beforeFooter",this,t),o=et(s,"footer",this,t),r=et(s,"afterFooter",this,t);let a=[];return a=Ot(a,Gt(i)),a=Ot(a,Gt(o)),a=Ot(a,Gt(r)),a}_createItems(t){const n=this._active,s=this.chart.data,i=[],o=[],r=[];let a=[],d,c;for(d=0,c=n.length;d<c;++d)a.push(e2(this.chart,n[d]));return t.filter&&(a=a.filter((u,h,f)=>t.filter(u,h,f,s))),t.itemSort&&(a=a.sort((u,h)=>t.itemSort(u,h,s))),he(a,u=>{const h=Tm(t.callbacks,u);i.push(et(h,"labelColor",this,u)),o.push(et(h,"labelPointStyle",this,u)),r.push(et(h,"labelTextColor",this,u))}),this.labelColors=i,this.labelPointStyles=o,this.labelTextColors=r,this.dataPoints=a,a}update(t,n){const s=this.options.setContext(this.getContext()),i=this._active;let o,r=[];if(!i.length)this.opacity!==0&&(o={opacity:0});else{const a=ki[s.position].call(this,i,this._eventPosition);r=this._createItems(s),this.title=this.getTitle(r,s),this.beforeBody=this.getBeforeBody(r,s),this.body=this.getBody(r,s),this.afterBody=this.getAfterBody(r,s),this.footer=this.getFooter(r,s);const d=this._size=Nm(this,s),c=Object.assign({},a,d),u=Sm(this.chart,s,c),h=Cm(s,c,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,o={opacity:1,x:h.x,y:h.y,width:d.width,height:d.height,caretX:a.x,caretY:a.y}}this._tooltipItems=r,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&s.external&&s.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,s,i){const o=this.getCaretPosition(t,s,i);n.lineTo(o.x1,o.y1),n.lineTo(o.x2,o.y2),n.lineTo(o.x3,o.y3)}getCaretPosition(t,n,s){const{xAlign:i,yAlign:o}=this,{caretSize:r,cornerRadius:a}=s,{topLeft:d,topRight:c,bottomLeft:u,bottomRight:h}=Ln(a),{x:f,y:m}=t,{width:p,height:b}=n;let x,w,_,y,v,j;return o==="center"?(v=m+b/2,i==="left"?(x=f,w=x-r,y=v+r,j=v-r):(x=f+p,w=x+r,y=v-r,j=v+r),_=x):(i==="left"?w=f+Math.max(d,u)+r:i==="right"?w=f+p-Math.max(c,h)-r:w=this.caretX,o==="top"?(y=m,v=y-r,x=w-r,_=w+r):(y=m+b,v=y+r,x=w+r,_=w-r),j=y),{x1:x,x2:w,x3:_,y1:y,y2:v,y3:j}}drawTitle(t,n,s){const i=this.title,o=i.length;let r,a,d;if(o){const c=ps(s.rtl,this.x,this.width);for(t.x=sr(this,s.titleAlign,s),n.textAlign=c.textAlign(s.titleAlign),n.textBaseline="middle",r=De(s.titleFont),a=s.titleSpacing,n.fillStyle=s.titleColor,n.font=r.string,d=0;d<o;++d)n.fillText(i[d],c.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+a,d+1===o&&(t.y+=s.titleMarginBottom-a)}}_drawColorBox(t,n,s,i,o){const r=this.labelColors[s],a=this.labelPointStyles[s],{boxHeight:d,boxWidth:c}=o,u=De(o.bodyFont),h=sr(this,"left",o),f=i.x(h),m=d<u.lineHeight?(u.lineHeight-d)/2:0,p=n.y+m;if(o.usePointStyle){const b={radius:Math.min(c,d)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},x=i.leftForLtr(f,c)+c/2,w=p+d/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,Ua(t,b,x,w),t.strokeStyle=r.borderColor,t.fillStyle=r.backgroundColor,Ua(t,b,x,w)}else{t.lineWidth=ie(r.borderWidth)?Math.max(...Object.values(r.borderWidth)):r.borderWidth||1,t.strokeStyle=r.borderColor,t.setLineDash(r.borderDash||[]),t.lineDashOffset=r.borderDashOffset||0;const b=i.leftForLtr(f,c),x=i.leftForLtr(i.xPlus(f,1),c-2),w=Ln(r.borderRadius);Object.values(w).some(_=>_!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,fi(t,{x:b,y:p,w:c,h:d,radius:w}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),fi(t,{x,y:p+1,w:c-2,h:d-2,radius:w}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(b,p,c,d),t.strokeRect(b,p,c,d),t.fillStyle=r.backgroundColor,t.fillRect(x,p+1,c-2,d-2))}t.fillStyle=this.labelTextColors[s]}drawBody(t,n,s){const{body:i}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:d,boxWidth:c,boxPadding:u}=s,h=De(s.bodyFont);let f=h.lineHeight,m=0;const p=ps(s.rtl,this.x,this.width),b=function(S){n.fillText(S,p.x(t.x+m),t.y+f/2),t.y+=f+o},x=p.textAlign(r);let w,_,y,v,j,k,C;for(n.textAlign=r,n.textBaseline="middle",n.font=h.string,t.x=sr(this,x,s),n.fillStyle=s.bodyColor,he(this.beforeBody,b),m=a&&x!=="right"?r==="center"?c/2+u:c+2+u:0,v=0,k=i.length;v<k;++v){for(w=i[v],_=this.labelTextColors[v],n.fillStyle=_,he(w.before,b),y=w.lines,a&&y.length&&(this._drawColorBox(n,t,v,p,s),f=Math.max(h.lineHeight,d)),j=0,C=y.length;j<C;++j)b(y[j]),f=h.lineHeight;he(w.after,b)}m=0,f=h.lineHeight,he(this.afterBody,b),t.y-=o}drawFooter(t,n,s){const i=this.footer,o=i.length;let r,a;if(o){const d=ps(s.rtl,this.x,this.width);for(t.x=sr(this,s.footerAlign,s),t.y+=s.footerMarginTop,n.textAlign=d.textAlign(s.footerAlign),n.textBaseline="middle",r=De(s.footerFont),n.fillStyle=s.footerColor,n.font=r.string,a=0;a<o;++a)n.fillText(i[a],d.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+s.footerSpacing}}drawBackground(t,n,s,i){const{xAlign:o,yAlign:r}=this,{x:a,y:d}=t,{width:c,height:u}=s,{topLeft:h,topRight:f,bottomLeft:m,bottomRight:p}=Ln(i.cornerRadius);n.fillStyle=i.backgroundColor,n.strokeStyle=i.borderColor,n.lineWidth=i.borderWidth,n.beginPath(),n.moveTo(a+h,d),r==="top"&&this.drawCaret(t,n,s,i),n.lineTo(a+c-f,d),n.quadraticCurveTo(a+c,d,a+c,d+f),r==="center"&&o==="right"&&this.drawCaret(t,n,s,i),n.lineTo(a+c,d+u-p),n.quadraticCurveTo(a+c,d+u,a+c-p,d+u),r==="bottom"&&this.drawCaret(t,n,s,i),n.lineTo(a+m,d+u),n.quadraticCurveTo(a,d+u,a,d+u-m),r==="center"&&o==="left"&&this.drawCaret(t,n,s,i),n.lineTo(a,d+h),n.quadraticCurveTo(a,d,a+h,d),n.closePath(),n.fill(),i.borderWidth>0&&n.stroke()}_updateAnimationTarget(t){const n=this.chart,s=this.$animations,i=s&&s.x,o=s&&s.y;if(i||o){const r=ki[t.position].call(this,this._active,this._eventPosition);if(!r)return;const a=this._size=Nm(this,t),d=Object.assign({},r,this._size),c=Sm(n,t,d),u=Cm(t,d,c,n);(i._to!==u.x||o._to!==u.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(t){const n=this.options.setContext(this.getContext());let s=this.opacity;if(!s)return;this._updateAnimationTarget(n);const i={width:this.width,height:this.height},o={x:this.x,y:this.y};s=Math.abs(s)<.001?0:s;const r=Ye(n.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&a&&(t.save(),t.globalAlpha=s,this.drawBackground(o,t,i,n),mf(t,n.textDirection),o.y+=r.top,this.drawTitle(o,t,n),this.drawBody(o,t,n),this.drawFooter(o,t,n),pf(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const s=this._active,i=t.map(({datasetIndex:a,index:d})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[d],index:d}}),o=!To(s,i),r=this._positionChanged(i,n);(o||r)&&(this._active=i,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,s=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const i=this.options,o=this._active||[],r=this._getActiveElements(t,o,n,s),a=this._positionChanged(r,t),d=n||!To(r,o)||a;return d&&(this._active=r,(i.enabled||i.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),d}_getActiveElements(t,n,s,i){const o=this.options;if(t.type==="mouseout")return[];if(!i)return n.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const r=this.chart.getElementsAtEventForMode(t,o.mode,o,s);return o.reverse&&r.reverse(),r}_positionChanged(t,n){const{caretX:s,caretY:i,options:o}=this,r=ki[o.position].call(this,t,n);return r!==!1&&(s!==r.x||i!==r.y)}}I(pl,"positioners",ki);var a2={id:"tooltip",_element:pl,positioners:ki,afterInit(e,t,n){n&&(e.tooltip=new pl({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Pm},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const l2=(e,t,n,s)=>(typeof t=="string"?(n=e.push(t)-1,s.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function d2(e,t,n,s){const i=e.indexOf(t);if(i===-1)return l2(e,t,n,s);const o=e.lastIndexOf(t);return i!==o?n:i}const c2=(e,t)=>e===null?null:Ue(Math.round(e),0,t);function Em(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class gl extends Hn{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const n=this._addedLabels;if(n.length){const s=this.getLabels();for(const{index:i,label:o}of n)s[i]===o&&s.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,n){if(oe(t))return null;const s=this.getLabels();return n=isFinite(n)&&s[n]===t?n:d2(s,t,te(n,t),this._addedLabels),c2(n,s.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let{min:s,max:i}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(s=0),n||(i=this.getLabels().length-1)),this.min=s,this.max=i}buildTicks(){const t=this.min,n=this.max,s=this.options.offset,i=[];let o=this.getLabels();o=t===0&&n===o.length-1?o:o.slice(t,n+1),this._valueRange=Math.max(o.length-(s?0:1),1),this._startValue=this.min-(s?.5:0);for(let r=t;r<=n;r++)i.push({value:r});return i}getLabelForValue(t){return Em.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}I(gl,"id","category"),I(gl,"defaults",{ticks:{callback:Em}});function u2(e,t){const n=[],{bounds:i,step:o,min:r,max:a,precision:d,count:c,maxTicks:u,maxDigits:h,includeBounds:f}=e,m=o||1,p=u-1,{min:b,max:x}=t,w=!oe(r),_=!oe(a),y=!oe(c),v=(x-b)/(h+1);let j=Hh((x-b)/p/m)*m,k,C,S,T;if(j<1e-14&&!w&&!_)return[{value:b},{value:x}];T=Math.ceil(x/j)-Math.floor(b/j),T>p&&(j=Hh(T*j/p/m)*m),oe(d)||(k=Math.pow(10,d),j=Math.ceil(j*k)/k),i==="ticks"?(C=Math.floor(b/j)*j,S=Math.ceil(x/j)*j):(C=b,S=x),w&&_&&o&&bv((a-r)/o,j/1e3)?(T=Math.round(Math.min((a-r)/j,u)),j=(a-r)/T,C=r,S=a):y?(C=w?r:C,S=_?a:S,T=c-1,j=(S-C)/T):(T=(S-C)/j,li(T,Math.round(T),j/1e3)?T=Math.round(T):T=Math.ceil(T));const D=Math.max(Rh(j),Rh(C));k=Math.pow(10,oe(d)?D:d),C=Math.round(C*k)/k,S=Math.round(S*k)/k;let P=0;for(w&&(f&&C!==r?(n.push({value:r}),C<r&&P++,li(Math.round((C+P*j)*k)/k,r,Dm(r,v,e))&&P++):C<r&&P++);P<T;++P){const L=Math.round((C+P*j)*k)/k;if(_&&L>a)break;n.push({value:L})}return _&&f&&S!==a?n.length&&li(n[n.length-1].value,a,Dm(a,v,e))?n[n.length-1].value=a:n.push({value:a}):(!_||S===a)&&n.push({value:S}),n}function Dm(e,t,{horizontal:n,minRotation:s}){const i=Et(s),o=(n?Math.sin(i):Math.cos(i))||.001,r=.75*t*(""+e).length;return Math.min(t/o,r)}class ir extends Hn{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,n){return oe(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:s}=this.getUserBounds();let{min:i,max:o}=this;const r=d=>i=n?i:d,a=d=>o=s?o:d;if(t){const d=Pt(i),c=Pt(o);d<0&&c<0?a(0):d>0&&c>0&&r(0)}if(i===o){let d=o===0?1:Math.abs(o*.05);a(o+d),t||r(i-d)}this.min=i,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:s}=t,i;return s?(i=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,i>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${i} ticks. Limiting to 1000.`),i=1e3)):(i=this.computeTickLimit(),n=n||11),n&&(i=Math.min(n,i)),i}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,n=t.ticks;let s=this.getTickLimit();s=Math.max(2,s);const i={maxTicks:s,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},o=this._range||this,r=u2(i,o);return t.bounds==="ticks"&&Vh(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const t=this.ticks;let n=this.min,s=this.max;if(super.configure(),this.options.offset&&t.length){const i=(s-n)/Math.max(t.length-1,1)/2;n-=i,s+=i}this._startValue=n,this._endValue=s,this._valueRange=s-n}getLabelForValue(t){return Oo(t,this.chart.options.locale,this.options.ticks.format)}}class bl extends ir{determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=ve(t)?t:0,this.max=ve(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,s=Et(this.options.ticks.minRotation),i=(t?Math.sin(s):Math.cos(s))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,o.lineHeight/i))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}I(bl,"id","linear"),I(bl,"defaults",{ticks:{callback:Io.formatters.numeric}});const ji=e=>Math.floor(un(e)),Vn=(e,t)=>Math.pow(10,ji(e)+t);function Om(e){return e/Math.pow(10,ji(e))===1}function Im(e,t,n){const s=Math.pow(10,n),i=Math.floor(e/s);return Math.ceil(t/s)-i}function h2(e,t){const n=t-e;let s=ji(n);for(;Im(e,t,s)>10;)s++;for(;Im(e,t,s)<10;)s--;return Math.min(s,ji(e))}function f2(e,{min:t,max:n}){t=rt(e.min,t);const s=[],i=ji(t);let o=h2(t,n),r=o<0?Math.pow(10,Math.abs(o)):1;const a=Math.pow(10,o),d=i>o?Math.pow(10,i):0,c=Math.round((t-d)*r)/r,u=Math.floor((t-d)/a/10)*a*10;let h=Math.floor((c-u)/Math.pow(10,o)),f=rt(e.min,Math.round((d+u+h*Math.pow(10,o))*r)/r);for(;f<n;)s.push({value:f,major:Om(f),significand:h}),h>=10?h=h<15?15:20:h++,h>=20&&(o++,h=2,r=o>=0?1:r),f=Math.round((d+u+h*Math.pow(10,o))*r)/r;const m=rt(e.max,f);return s.push({value:m,major:Om(m),significand:h}),s}class Lm extends Hn{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,n){const s=ir.prototype.parse.apply(this,[t,n]);if(s===0){this._zero=!0;return}return ve(s)&&s>0?s:null}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=ve(t)?Math.max(0,t):null,this.max=ve(n)?Math.max(0,n):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!ve(this._userMin)&&(this.min=t===Vn(this.min,0)?Vn(this.min,-1):Vn(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let s=this.min,i=this.max;const o=a=>s=t?s:a,r=a=>i=n?i:a;s===i&&(s<=0?(o(1),r(10)):(o(Vn(s,-1)),r(Vn(i,1)))),s<=0&&o(Vn(i,-1)),i<=0&&r(Vn(s,1)),this.min=s,this.max=i}buildTicks(){const t=this.options,n={min:this._userMin,max:this._userMax},s=f2(n,this);return t.bounds==="ticks"&&Vh(s,this,"value"),t.reverse?(s.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),s}getLabelForValue(t){return t===void 0?"0":Oo(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=un(t),this._valueRange=un(this.max)-un(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(un(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const n=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+n*this._valueRange)}}I(Lm,"id","logarithmic"),I(Lm,"defaults",{ticks:{callback:Io.formatters.logarithmic,major:{enabled:!0}}});function xl(e){const t=e.ticks;if(t.display&&e.display){const n=Ye(t.backdropPadding);return te(t.font&&t.font.size,ke.font.size)+n.height}return 0}function m2(e,t,n){return n=ge(n)?n:[n],{w:Av(e,t.string,n),h:n.length*t.lineHeight}}function Am(e,t,n,s,i){return e===s||e===i?{start:t-n/2,end:t+n/2}:e<s||e>i?{start:t-n,end:t}:{start:t,end:t+n}}function p2(e){const t={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},n=Object.assign({},t),s=[],i=[],o=e._pointLabels.length,r=e.options.pointLabels,a=r.centerPointLabels?le/o:0;for(let d=0;d<o;d++){const c=r.setContext(e.getPointLabelContext(d));i[d]=c.padding;const u=e.getPointPosition(d,e.drawingArea+i[d],a),h=De(c.font),f=m2(e.ctx,h,e._pointLabels[d]);s[d]=f;const m=$e(e.getIndexAngle(d)+a),p=Math.round(Fa(m)),b=Am(p,u.x,f.w,0,180),x=Am(p,u.y,f.h,90,270);g2(n,t,m,b,x)}e.setCenterPoint(t.l-n.l,n.r-t.r,t.t-n.t,n.b-t.b),e._pointLabelItems=w2(e,s,i)}function g2(e,t,n,s,i){const o=Math.abs(Math.sin(n)),r=Math.abs(Math.cos(n));let a=0,d=0;s.start<t.l?(a=(t.l-s.start)/o,e.l=Math.min(e.l,t.l-a)):s.end>t.r&&(a=(s.end-t.r)/o,e.r=Math.max(e.r,t.r+a)),i.start<t.t?(d=(t.t-i.start)/r,e.t=Math.min(e.t,t.t-d)):i.end>t.b&&(d=(i.end-t.b)/r,e.b=Math.max(e.b,t.b+d))}function b2(e,t,n){const s=e.drawingArea,{extra:i,additionalAngle:o,padding:r,size:a}=n,d=e.getPointPosition(t,s+i+r,o),c=Math.round(Fa($e(d.angle+Ce))),u=v2(d.y,a.h,c),h=_2(c),f=y2(d.x,a.w,h);return{visible:!0,x:d.x,y:u,textAlign:h,left:f,top:u,right:f+a.w,bottom:u+a.h}}function x2(e,t){if(!t)return!0;const{left:n,top:s,right:i,bottom:o}=e;return!(qt({x:n,y:s},t)||qt({x:n,y:o},t)||qt({x:i,y:s},t)||qt({x:i,y:o},t))}function w2(e,t,n){const s=[],i=e._pointLabels.length,o=e.options,{centerPointLabels:r,display:a}=o.pointLabels,d={extra:xl(o)/2,additionalAngle:r?le/i:0};let c;for(let u=0;u<i;u++){d.padding=n[u],d.size=t[u];const h=b2(e,u,d);s.push(h),a==="auto"&&(h.visible=x2(h,c),h.visible&&(c=h))}return s}function _2(e){return e===0||e===180?"center":e<180?"left":"right"}function y2(e,t,n){return n==="right"?e-=t:n==="center"&&(e-=t/2),e}function v2(e,t,n){return n===90||n===270?e-=t/2:(n>270||n<90)&&(e-=t),e}function k2(e,t,n){const{left:s,top:i,right:o,bottom:r}=n,{backdropColor:a}=t;if(!oe(a)){const d=Ln(t.borderRadius),c=Ye(t.backdropPadding);e.fillStyle=a;const u=s-c.left,h=i-c.top,f=o-s+c.width,m=r-i+c.height;Object.values(d).some(p=>p!==0)?(e.beginPath(),fi(e,{x:u,y:h,w:f,h:m,radius:d}),e.fill()):e.fillRect(u,h,f,m)}}function j2(e,t){const{ctx:n,options:{pointLabels:s}}=e;for(let i=t-1;i>=0;i--){const o=e._pointLabelItems[i];if(!o.visible)continue;const r=s.setContext(e.getPointLabelContext(i));k2(n,r,o);const a=De(r.font),{x:d,y:c,textAlign:u}=o;In(n,e._pointLabels[i],d,c+a.lineHeight/2,a,{color:r.color,textAlign:u,textBaseline:"middle"})}}function Fm(e,t,n,s){const{ctx:i}=e;if(n)i.arc(e.xCenter,e.yCenter,t,0,be);else{let o=e.getPointPosition(0,t);i.moveTo(o.x,o.y);for(let r=1;r<s;r++)o=e.getPointPosition(r,t),i.lineTo(o.x,o.y)}}function N2(e,t,n,s,i){const o=e.ctx,r=t.circular,{color:a,lineWidth:d}=t;!r&&!s||!a||!d||n<0||(o.save(),o.strokeStyle=a,o.lineWidth=d,o.setLineDash(i.dash||[]),o.lineDashOffset=i.dashOffset,o.beginPath(),Fm(e,n,r,s),o.closePath(),o.stroke(),o.restore())}function S2(e,t,n){return hn(e,{label:n,index:t,type:"pointLabel"})}class or extends ir{constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=Ye(xl(this.options)/2),n=this.width=this.maxWidth-t.width,s=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+n/2+t.left),this.yCenter=Math.floor(this.top+s/2+t.top),this.drawingArea=Math.floor(Math.min(n,s)/2)}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!1);this.min=ve(t)&&!isNaN(t)?t:0,this.max=ve(n)&&!isNaN(n)?n:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/xl(this.options))}generateTickLabels(t){ir.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((n,s)=>{const i=pe(this.options.pointLabels.callback,[n,s],this);return i||i===0?i:""}).filter((n,s)=>this.chart.getDataVisibility(s))}fit(){const t=this.options;t.display&&t.pointLabels.display?p2(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,n,s,i){this.xCenter+=Math.floor((t-n)/2),this.yCenter+=Math.floor((s-i)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,n,s,i))}getIndexAngle(t){const n=be/(this._pointLabels.length||1),s=this.options.startAngle||0;return $e(t*n+Et(s))}getDistanceFromCenterForValue(t){if(oe(t))return NaN;const n=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*n:(t-this.min)*n}getValueForDistanceFromCenter(t){if(oe(t))return NaN;const n=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-n:this.min+n}getPointLabelContext(t){const n=this._pointLabels||[];if(t>=0&&t<n.length){const s=n[t];return S2(this.getContext(),t,s)}}getPointPosition(t,n,s=0){const i=this.getIndexAngle(t)-Ce+s;return{x:Math.cos(i)*n+this.xCenter,y:Math.sin(i)*n+this.yCenter,angle:i}}getPointPositionForValue(t,n){return this.getPointPosition(t,this.getDistanceFromCenterForValue(n))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:n,top:s,right:i,bottom:o}=this._pointLabelItems[t];return{left:n,top:s,right:i,bottom:o}}drawBackground(){const{backgroundColor:t,grid:{circular:n}}=this.options;if(t){const s=this.ctx;s.save(),s.beginPath(),Fm(this,this.getDistanceFromCenterForValue(this._endValue),n,this._pointLabels.length),s.closePath(),s.fillStyle=t,s.fill(),s.restore()}}drawGrid(){const t=this.ctx,n=this.options,{angleLines:s,grid:i,border:o}=n,r=this._pointLabels.length;let a,d,c;if(n.pointLabels.display&&j2(this,r),i.display&&this.ticks.forEach((u,h)=>{if(h!==0||h===0&&this.min<0){d=this.getDistanceFromCenterForValue(u.value);const f=this.getContext(h),m=i.setContext(f),p=o.setContext(f);N2(this,m,d,r,p)}}),s.display){for(t.save(),a=r-1;a>=0;a--){const u=s.setContext(this.getPointLabelContext(a)),{color:h,lineWidth:f}=u;!f||!h||(t.lineWidth=f,t.strokeStyle=h,t.setLineDash(u.borderDash),t.lineDashOffset=u.borderDashOffset,d=this.getDistanceFromCenterForValue(n.reverse?this.min:this.max),c=this.getPointPosition(a,d),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,n=this.options,s=n.ticks;if(!s.display)return;const i=this.getIndexAngle(0);let o,r;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(i),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,d)=>{if(d===0&&this.min>=0&&!n.reverse)return;const c=s.setContext(this.getContext(d)),u=De(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[d].value),c.showLabelBackdrop){t.font=u.string,r=t.measureText(a.label).width,t.fillStyle=c.backdropColor;const h=Ye(c.backdropPadding);t.fillRect(-r/2-h.left,-o-u.size/2-h.top,r+h.width,u.size+h.height)}In(t,a.label,0,-o,u,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}}I(or,"id","radialLinear"),I(or,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Io.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),I(or,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),I(or,"descriptors",{angleLines:{_fallback:"grid"}});const rr={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},tt=Object.keys(rr);function zm(e,t){return e-t}function Wm(e,t){if(oe(t))return null;const n=e._adapter,{parser:s,round:i,isoWeekday:o}=e._parseOpts;let r=t;return typeof s=="function"&&(r=s(r)),ve(r)||(r=typeof s=="string"?n.parse(r,s):n.parse(r)),r===null?null:(i&&(r=i==="week"&&(di(o)||o===!0)?n.startOf(r,"isoWeek",o):n.startOf(r,i)),+r)}function Bm(e,t,n,s){const i=tt.length;for(let o=tt.indexOf(e);o<i-1;++o){const r=rr[tt[o]],a=r.steps?r.steps:Number.MAX_SAFE_INTEGER;if(r.common&&Math.ceil((n-t)/(a*r.size))<=s)return tt[o]}return tt[i-1]}function C2(e,t,n,s,i){for(let o=tt.length-1;o>=tt.indexOf(n);o--){const r=tt[o];if(rr[r].common&&e._adapter.diff(i,s,r)>=t-1)return r}return tt[n?tt.indexOf(n):0]}function M2(e){for(let t=tt.indexOf(e)+1,n=tt.length;t<n;++t)if(rr[tt[t]].common)return tt[t]}function Hm(e,t,n){if(!n)e[t]=!0;else if(n.length){const{lo:s,hi:i}=Wa(n,t),o=n[s]>=t?n[s]:n[i];e[o]=!0}}function T2(e,t,n,s){const i=e._adapter,o=+i.startOf(t[0].value,s),r=t[t.length-1].value;let a,d;for(a=o;a<=r;a=+i.add(a,1,s))d=n[a],d>=0&&(t[d].major=!0);return t}function Vm(e,t,n){const s=[],i={},o=t.length;let r,a;for(r=0;r<o;++r)a=t[r],i[a]=r,s.push({value:a,major:!1});return o===0||!n?s:T2(e,s,i,n)}class Ni extends Hn{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,n={}){const s=t.time||(t.time={}),i=this._adapter=new Lf._date(t.adapters.date);i.init(n),ri(s.displayFormats,i.formats()),this._parseOpts={parser:s.parser,round:s.round,isoWeekday:s.isoWeekday},super.init(t),this._normalized=n.normalized}parse(t,n){return t===void 0?null:Wm(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,n=this._adapter,s=t.time.unit||"day";let{min:i,max:o,minDefined:r,maxDefined:a}=this.getUserBounds();function d(c){!r&&!isNaN(c.min)&&(i=Math.min(i,c.min)),!a&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!r||!a)&&(d(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&d(this.getMinMax(!1))),i=ve(i)&&!isNaN(i)?i:+n.startOf(Date.now(),s),o=ve(o)&&!isNaN(o)?o:+n.endOf(Date.now(),s)+1,this.min=Math.min(i,o-1),this.max=Math.max(i+1,o)}_getLabelBounds(){const t=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;return t.length&&(n=t[0],s=t[t.length-1]),{min:n,max:s}}buildTicks(){const t=this.options,n=t.time,s=t.ticks,i=s.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&i.length&&(this.min=this._userMin||i[0],this.max=this._userMax||i[i.length-1]);const o=this.min,r=this.max,a=yv(i,o,r);return this._unit=n.unit||(s.autoSkip?Bm(n.minUnit,this.min,this.max,this._getLabelCapacity(o)):C2(this,a.length,n.minUnit,this.min,this.max)),this._majorUnit=!s.major.enabled||this._unit==="year"?void 0:M2(this._unit),this.initOffsets(i),t.reverse&&a.reverse(),Vm(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let n=0,s=0,i,o;this.options.offset&&t.length&&(i=this.getDecimalForValue(t[0]),t.length===1?n=1-i:n=(this.getDecimalForValue(t[1])-i)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?s=o:s=(o-this.getDecimalForValue(t[t.length-2]))/2);const r=t.length<3?.5:.25;n=Ue(n,0,r),s=Ue(s,0,r),this._offsets={start:n,end:s,factor:1/(n+1+s)}}_generate(){const t=this._adapter,n=this.min,s=this.max,i=this.options,o=i.time,r=o.unit||Bm(o.minUnit,n,s,this._getLabelCapacity(n)),a=te(i.ticks.stepSize,1),d=r==="week"?o.isoWeekday:!1,c=di(d)||d===!0,u={};let h=n,f,m;if(c&&(h=+t.startOf(h,"isoWeek",d)),h=+t.startOf(h,c?"day":r),t.diff(s,n,r)>1e5*a)throw new Error(n+" and "+s+" are too far apart with stepSize of "+a+" "+r);const p=i.ticks.source==="data"&&this.getDataTimestamps();for(f=h,m=0;f<s;f=+t.add(f,a,r),m++)Hm(u,f,p);return(f===s||i.bounds==="ticks"||m===1)&&Hm(u,f,p),Object.keys(u).sort(zm).map(b=>+b)}getLabelForValue(t){const n=this._adapter,s=this.options.time;return s.tooltipFormat?n.format(t,s.tooltipFormat):n.format(t,s.displayFormats.datetime)}format(t,n){const i=this.options.time.displayFormats,o=this._unit,r=n||i[o];return this._adapter.format(t,r)}_tickFormatFunction(t,n,s,i){const o=this.options,r=o.ticks.callback;if(r)return pe(r,[t,n,s],this);const a=o.time.displayFormats,d=this._unit,c=this._majorUnit,u=d&&a[d],h=c&&a[c],f=s[n],m=c&&h&&f&&f.major;return this._adapter.format(t,i||(m?h:u))}generateTickLabels(t){let n,s,i;for(n=0,s=t.length;n<s;++n)i=t[n],i.label=this._tickFormatFunction(i.value,n,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const n=this._offsets,s=this.getDecimalForValue(t);return this.getPixelForDecimal((n.start+s)*n.factor)}getValueForPixel(t){const n=this._offsets,s=this.getDecimalForPixel(t)/n.factor-n.end;return this.min+s*(this.max-this.min)}_getLabelSize(t){const n=this.options.ticks,s=this.ctx.measureText(t).width,i=Et(this.isHorizontal()?n.maxRotation:n.minRotation),o=Math.cos(i),r=Math.sin(i),a=this._resolveTickFontOptions(0).size;return{w:s*o+a*r,h:s*r+a*o}}_getLabelCapacity(t){const n=this.options.time,s=n.displayFormats,i=s[n.unit]||s.millisecond,o=this._tickFormatFunction(t,0,Vm(this,[t],this._majorUnit),i),r=this._getLabelSize(o),a=Math.floor(this.isHorizontal()?this.width/r.w:this.height/r.h)-1;return a>0?a:1}getDataTimestamps(){let t=this._cache.data||[],n,s;if(t.length)return t;const i=this.getMatchingVisibleMetas();if(this._normalized&&i.length)return this._cache.data=i[0].controller.getAllParsedValues(this);for(n=0,s=i.length;n<s;++n)t=t.concat(i[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let n,s;if(t.length)return t;const i=this.getLabels();for(n=0,s=i.length;n<s;++n)t.push(Wm(this,i[n]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return Yh(t.sort(zm))}}I(Ni,"id","time"),I(Ni,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function ar(e,t,n){let s=0,i=e.length-1,o,r,a,d;n?(t>=e[s].pos&&t<=e[i].pos&&({lo:s,hi:i}=En(e,"pos",t)),{pos:o,time:a}=e[s],{pos:r,time:d}=e[i]):(t>=e[s].time&&t<=e[i].time&&({lo:s,hi:i}=En(e,"time",t)),{time:o,pos:a}=e[s],{time:r,pos:d}=e[i]);const c=r-o;return c?a+(d-a)*(t-o)/c:a}class Rm extends Ni{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=ar(n,this.min),this._tableRange=ar(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:s}=this,i=[],o=[];let r,a,d,c,u;for(r=0,a=t.length;r<a;++r)c=t[r],c>=n&&c<=s&&i.push(c);if(i.length<2)return[{time:n,pos:0},{time:s,pos:1}];for(r=0,a=i.length;r<a;++r)u=i[r+1],d=i[r-1],c=i[r],Math.round((u+d)/2)!==c&&o.push({time:c,pos:r/(a-1)});return o}_generate(){const t=this.min,n=this.max;let s=super.getDataTimestamps();return(!s.includes(t)||!s.length)&&s.splice(0,0,t),(!s.includes(n)||s.length===1)&&s.push(n),s.sort((i,o)=>i-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),s=this.getLabelTimestamps();return n.length&&s.length?t=this.normalize(n.concat(s)):t=n.length?n:s,t=this._cache.all=t,t}getDecimalForValue(t){return(ar(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,s=this.getDecimalForPixel(t)/n.factor-n.end;return ar(this._table,s*this._tableRange+this._minPos,!0)}}I(Rm,"id","timeseries"),I(Rm,"defaults",Ni.defaults);const $m=6048e5,P2=864e5,Si=6e4,Ci=36e5,E2=1e3,Um=Symbol.for("constructDateFrom");function je(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&Um in e?e[Um](t):e instanceof Date?new e.constructor(t):new Date(t)}function Z(e,t){return je(t||e,e)}function Mi(e,t,n){const s=Z(e,n==null?void 0:n.in);return isNaN(t)?je((n==null?void 0:n.in)||e,NaN):(t&&s.setDate(s.getDate()+t),s)}function lr(e,t,n){const s=Z(e,n==null?void 0:n.in);if(isNaN(t))return je((n==null?void 0:n.in)||e,NaN);if(!t)return s;const i=s.getDate(),o=je((n==null?void 0:n.in)||e,s.getTime());o.setMonth(s.getMonth()+t+1,0);const r=o.getDate();return i>=r?o:(s.setFullYear(o.getFullYear(),o.getMonth(),i),s)}function wl(e,t,n){return je((n==null?void 0:n.in)||e,+Z(e)+t)}function D2(e,t,n){return wl(e,t*Ci,n)}let O2={};function Rn(){return O2}function yt(e,t){var a,d,c,u;const n=Rn(),s=(t==null?void 0:t.weekStartsOn)??((d=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:d.weekStartsOn)??n.weekStartsOn??((u=(c=n.locale)==null?void 0:c.options)==null?void 0:u.weekStartsOn)??0,i=Z(e,t==null?void 0:t.in),o=i.getDay(),r=(o<s?7:0)+o-s;return i.setDate(i.getDate()-r),i.setHours(0,0,0,0),i}function xs(e,t){return yt(e,{...t,weekStartsOn:1})}function qm(e,t){const n=Z(e,t==null?void 0:t.in),s=n.getFullYear(),i=je(n,0);i.setFullYear(s+1,0,4),i.setHours(0,0,0,0);const o=xs(i),r=je(n,0);r.setFullYear(s,0,4),r.setHours(0,0,0,0);const a=xs(r);return n.getTime()>=o.getTime()?s+1:n.getTime()>=a.getTime()?s:s-1}function dr(e){const t=Z(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function $n(e,...t){const n=je.bind(null,e||t.find(s=>typeof s=="object"));return t.map(n)}function Un(e,t){const n=Z(e,t==null?void 0:t.in);return n.setHours(0,0,0,0),n}function Ym(e,t,n){const[s,i]=$n(n==null?void 0:n.in,e,t),o=Un(s),r=Un(i),a=+o-dr(o),d=+r-dr(r);return Math.round((a-d)/P2)}function I2(e,t){const n=qm(e,t),s=je((t==null?void 0:t.in)||e,0);return s.setFullYear(n,0,4),s.setHours(0,0,0,0),xs(s)}function L2(e,t,n){const s=Z(e,n==null?void 0:n.in);return s.setTime(s.getTime()+t*Si),s}function A2(e,t,n){return lr(e,t*3,n)}function F2(e,t,n){return wl(e,t*1e3,n)}function z2(e,t,n){return Mi(e,t*7,n)}function Km(e,t,n){return lr(e,t*12,n)}function Ti(e,t){const n=+Z(e)-+Z(t);return n<0?-1:n>0?1:n}function W2(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Gm(e){return!(!W2(e)&&typeof e!="number"||isNaN(+Z(e)))}function B2(e,t,n){const[s,i]=$n(n==null?void 0:n.in,e,t),o=s.getFullYear()-i.getFullYear(),r=s.getMonth()-i.getMonth();return o*12+r}function H2(e,t,n){const[s,i]=$n(n==null?void 0:n.in,e,t);return s.getFullYear()-i.getFullYear()}function Xm(e,t,n){const[s,i]=$n(n==null?void 0:n.in,e,t),o=Qm(s,i),r=Math.abs(Ym(s,i));s.setDate(s.getDate()-o*r);const a=+(Qm(s,i)===-o),d=o*(r-a);return d===0?0:d}function Qm(e,t){const n=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return n<0?-1:n>0?1:n}function Pi(e){return t=>{const s=(e?Math[e]:Math.trunc)(t);return s===0?0:s}}function V2(e,t,n){const[s,i]=$n(n==null?void 0:n.in,e,t),o=(+s-+i)/Ci;return Pi(n==null?void 0:n.roundingMethod)(o)}function _l(e,t){return+Z(e)-+Z(t)}function R2(e,t,n){const s=_l(e,t)/Si;return Pi(n==null?void 0:n.roundingMethod)(s)}function ft(e,t){const n=Z(e,t==null?void 0:t.in);return n.setHours(23,59,59,999),n}function Zm(e,t){const n=Z(e,t==null?void 0:t.in),s=n.getMonth();return n.setFullYear(n.getFullYear(),s+1,0),n.setHours(23,59,59,999),n}function $2(e,t){const n=Z(e,t==null?void 0:t.in);return+ft(n,t)==+Zm(n,t)}function Jm(e,t,n){const[s,i,o]=$n(n==null?void 0:n.in,e,e,t),r=Ti(i,o),a=Math.abs(B2(i,o));if(a<1)return 0;i.getMonth()===1&&i.getDate()>27&&i.setDate(30),i.setMonth(i.getMonth()-r*a);let d=Ti(i,o)===-r;$2(s)&&a===1&&Ti(s,o)===1&&(d=!1);const c=r*(a-+d);return c===0?0:c}function U2(e,t,n){const s=Jm(e,t,n)/3;return Pi(n==null?void 0:n.roundingMethod)(s)}function q2(e,t,n){const s=_l(e,t)/1e3;return Pi(n==null?void 0:n.roundingMethod)(s)}function Y2(e,t,n){const s=Xm(e,t,n)/7;return Pi(n==null?void 0:n.roundingMethod)(s)}function K2(e,t,n){const[s,i]=$n(n==null?void 0:n.in,e,t),o=Ti(s,i),r=Math.abs(H2(s,i));s.setFullYear(1584),i.setFullYear(1584);const a=Ti(s,i)===-o,d=o*(r-+a);return d===0?0:d}function G2(e,t){const n=Z(e,t==null?void 0:t.in),s=n.getMonth(),i=s-s%3;return n.setMonth(i,1),n.setHours(0,0,0,0),n}function cr(e,t){const n=Z(e,t==null?void 0:t.in);return n.setDate(1),n.setHours(0,0,0,0),n}function X2(e,t){const n=Z(e,t==null?void 0:t.in),s=n.getFullYear();return n.setFullYear(s+1,0,0),n.setHours(23,59,59,999),n}function Ei(e,t){const n=Z(e,t==null?void 0:t.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function Q2(e,t){const n=Z(e,t==null?void 0:t.in);return n.setMinutes(59,59,999),n}function Z2(e,t){var a,d,c,u;const n=Rn(),s=(t==null?void 0:t.weekStartsOn)??((d=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:d.weekStartsOn)??n.weekStartsOn??((u=(c=n.locale)==null?void 0:c.options)==null?void 0:u.weekStartsOn)??0,i=Z(e,t==null?void 0:t.in),o=i.getDay(),r=(o<s?-7:0)+6-(o-s);return i.setDate(i.getDate()+r),i.setHours(23,59,59,999),i}function J2(e,t){const n=Z(e,t==null?void 0:t.in);return n.setSeconds(59,999),n}function eN(e,t){const n=Z(e,t==null?void 0:t.in),s=n.getMonth(),i=s-s%3+3;return n.setMonth(i,0),n.setHours(23,59,59,999),n}function tN(e,t){const n=Z(e,t==null?void 0:t.in);return n.setMilliseconds(999),n}const nN={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},sN=(e,t,n)=>{let s;const i=nN[e];return typeof i=="string"?s=i:t===1?s=i.one:s=i.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+s:s+" ago":s};function yl(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const iN={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},oN={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},rN={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},aN={date:yl({formats:iN,defaultWidth:"full"}),time:yl({formats:oN,defaultWidth:"full"}),dateTime:yl({formats:rN,defaultWidth:"full"})},lN={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},dN=(e,t,n,s)=>lN[e];function Di(e){return(t,n)=>{const s=n!=null&&n.context?String(n.context):"standalone";let i;if(s==="formatting"&&e.formattingValues){const r=e.defaultFormattingWidth||e.defaultWidth,a=n!=null&&n.width?String(n.width):r;i=e.formattingValues[a]||e.formattingValues[r]}else{const r=e.defaultWidth,a=n!=null&&n.width?String(n.width):e.defaultWidth;i=e.values[a]||e.values[r]}const o=e.argumentCallback?e.argumentCallback(t):t;return i[o]}}const cN={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},uN={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},hN={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},fN={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},mN={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},pN={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},gN={ordinalNumber:(e,t)=>{const n=Number(e),s=n%100;if(s>20||s<10)switch(s%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:Di({values:cN,defaultWidth:"wide"}),quarter:Di({values:uN,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Di({values:hN,defaultWidth:"wide"}),day:Di({values:fN,defaultWidth:"wide"}),dayPeriod:Di({values:mN,defaultWidth:"wide",formattingValues:pN,defaultFormattingWidth:"wide"})};function Oi(e){return(t,n={})=>{const s=n.width,i=s&&e.matchPatterns[s]||e.matchPatterns[e.defaultMatchWidth],o=t.match(i);if(!o)return null;const r=o[0],a=s&&e.parsePatterns[s]||e.parsePatterns[e.defaultParseWidth],d=Array.isArray(a)?xN(a,h=>h.test(r)):bN(a,h=>h.test(r));let c;c=e.valueCallback?e.valueCallback(d):d,c=n.valueCallback?n.valueCallback(c):c;const u=t.slice(r.length);return{value:c,rest:u}}}function bN(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function xN(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function wN(e){return(t,n={})=>{const s=t.match(e.matchPattern);if(!s)return null;const i=s[0],o=t.match(e.parsePattern);if(!o)return null;let r=e.valueCallback?e.valueCallback(o[0]):o[0];r=n.valueCallback?n.valueCallback(r):r;const a=t.slice(i.length);return{value:r,rest:a}}}const _N=/^(\d+)(th|st|nd|rd)?/i,yN=/\d+/i,vN={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},kN={any:[/^b/i,/^(a|c)/i]},jN={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},NN={any:[/1/i,/2/i,/3/i,/4/i]},SN={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},CN={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},MN={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},TN={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},PN={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},EN={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},DN={ordinalNumber:wN({matchPattern:_N,parsePattern:yN,valueCallback:e=>parseInt(e,10)}),era:Oi({matchPatterns:vN,defaultMatchWidth:"wide",parsePatterns:kN,defaultParseWidth:"any"}),quarter:Oi({matchPatterns:jN,defaultMatchWidth:"wide",parsePatterns:NN,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Oi({matchPatterns:SN,defaultMatchWidth:"wide",parsePatterns:CN,defaultParseWidth:"any"}),day:Oi({matchPatterns:MN,defaultMatchWidth:"wide",parsePatterns:TN,defaultParseWidth:"any"}),dayPeriod:Oi({matchPatterns:PN,defaultMatchWidth:"any",parsePatterns:EN,defaultParseWidth:"any"})},ep={code:"en-US",formatDistance:sN,formatLong:aN,formatRelative:dN,localize:gN,match:DN,options:{weekStartsOn:0,firstWeekContainsDate:1}};function ON(e,t){const n=Z(e,t==null?void 0:t.in);return Ym(n,Ei(n))+1}function tp(e,t){const n=Z(e,t==null?void 0:t.in),s=+xs(n)-+I2(n);return Math.round(s/$m)+1}function vl(e,t){var u,h,f,m;const n=Z(e,t==null?void 0:t.in),s=n.getFullYear(),i=Rn(),o=(t==null?void 0:t.firstWeekContainsDate)??((h=(u=t==null?void 0:t.locale)==null?void 0:u.options)==null?void 0:h.firstWeekContainsDate)??i.firstWeekContainsDate??((m=(f=i.locale)==null?void 0:f.options)==null?void 0:m.firstWeekContainsDate)??1,r=je((t==null?void 0:t.in)||e,0);r.setFullYear(s+1,0,o),r.setHours(0,0,0,0);const a=yt(r,t),d=je((t==null?void 0:t.in)||e,0);d.setFullYear(s,0,o),d.setHours(0,0,0,0);const c=yt(d,t);return+n>=+a?s+1:+n>=+c?s:s-1}function IN(e,t){var a,d,c,u;const n=Rn(),s=(t==null?void 0:t.firstWeekContainsDate)??((d=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:d.firstWeekContainsDate)??n.firstWeekContainsDate??((u=(c=n.locale)==null?void 0:c.options)==null?void 0:u.firstWeekContainsDate)??1,i=vl(e,t),o=je((t==null?void 0:t.in)||e,0);return o.setFullYear(i,0,s),o.setHours(0,0,0,0),yt(o,t)}function np(e,t){const n=Z(e,t==null?void 0:t.in),s=+yt(n,t)-+IN(n,t);return Math.round(s/$m)+1}function fe(e,t){const n=e<0?"-":"",s=Math.abs(e).toString().padStart(t,"0");return n+s}const gn={y(e,t){const n=e.getFullYear(),s=n>0?n:1-n;return fe(t==="yy"?s%100:s,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):fe(n+1,2)},d(e,t){return fe(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return fe(e.getHours()%12||12,t.length)},H(e,t){return fe(e.getHours(),t.length)},m(e,t){return fe(e.getMinutes(),t.length)},s(e,t){return fe(e.getSeconds(),t.length)},S(e,t){const n=t.length,s=e.getMilliseconds(),i=Math.trunc(s*Math.pow(10,n-3));return fe(i,t.length)}},ws={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},sp={G:function(e,t,n){const s=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(s,{width:"abbreviated"});case"GGGGG":return n.era(s,{width:"narrow"});case"GGGG":default:return n.era(s,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const s=e.getFullYear(),i=s>0?s:1-s;return n.ordinalNumber(i,{unit:"year"})}return gn.y(e,t)},Y:function(e,t,n,s){const i=vl(e,s),o=i>0?i:1-i;if(t==="YY"){const r=o%100;return fe(r,2)}return t==="Yo"?n.ordinalNumber(o,{unit:"year"}):fe(o,t.length)},R:function(e,t){const n=qm(e);return fe(n,t.length)},u:function(e,t){const n=e.getFullYear();return fe(n,t.length)},Q:function(e,t,n){const s=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(s);case"QQ":return fe(s,2);case"Qo":return n.ordinalNumber(s,{unit:"quarter"});case"QQQ":return n.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(s,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(s,{width:"wide",context:"formatting"})}},q:function(e,t,n){const s=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(s);case"qq":return fe(s,2);case"qo":return n.ordinalNumber(s,{unit:"quarter"});case"qqq":return n.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(s,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(s,{width:"wide",context:"standalone"})}},M:function(e,t,n){const s=e.getMonth();switch(t){case"M":case"MM":return gn.M(e,t);case"Mo":return n.ordinalNumber(s+1,{unit:"month"});case"MMM":return n.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(s,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(s,{width:"wide",context:"formatting"})}},L:function(e,t,n){const s=e.getMonth();switch(t){case"L":return String(s+1);case"LL":return fe(s+1,2);case"Lo":return n.ordinalNumber(s+1,{unit:"month"});case"LLL":return n.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(s,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(s,{width:"wide",context:"standalone"})}},w:function(e,t,n,s){const i=np(e,s);return t==="wo"?n.ordinalNumber(i,{unit:"week"}):fe(i,t.length)},I:function(e,t,n){const s=tp(e);return t==="Io"?n.ordinalNumber(s,{unit:"week"}):fe(s,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):gn.d(e,t)},D:function(e,t,n){const s=ON(e);return t==="Do"?n.ordinalNumber(s,{unit:"dayOfYear"}):fe(s,t.length)},E:function(e,t,n){const s=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(s,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(s,{width:"short",context:"formatting"});case"EEEE":default:return n.day(s,{width:"wide",context:"formatting"})}},e:function(e,t,n,s){const i=e.getDay(),o=(i-s.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return fe(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});case"eeee":default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,t,n,s){const i=e.getDay(),o=(i-s.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return fe(o,t.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});case"cccc":default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,t,n){const s=e.getDay(),i=s===0?7:s;switch(t){case"i":return String(i);case"ii":return fe(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(s,{width:"short",context:"formatting"});case"iiii":default:return n.day(s,{width:"wide",context:"formatting"})}},a:function(e,t,n){const i=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(e,t,n){const s=e.getHours();let i;switch(s===12?i=ws.noon:s===0?i=ws.midnight:i=s/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(e,t,n){const s=e.getHours();let i;switch(s>=17?i=ws.evening:s>=12?i=ws.afternoon:s>=4?i=ws.morning:i=ws.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let s=e.getHours()%12;return s===0&&(s=12),n.ordinalNumber(s,{unit:"hour"})}return gn.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):gn.H(e,t)},K:function(e,t,n){const s=e.getHours()%12;return t==="Ko"?n.ordinalNumber(s,{unit:"hour"}):fe(s,t.length)},k:function(e,t,n){let s=e.getHours();return s===0&&(s=24),t==="ko"?n.ordinalNumber(s,{unit:"hour"}):fe(s,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):gn.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):gn.s(e,t)},S:function(e,t){return gn.S(e,t)},X:function(e,t,n){const s=e.getTimezoneOffset();if(s===0)return"Z";switch(t){case"X":return op(s);case"XXXX":case"XX":return qn(s);case"XXXXX":case"XXX":default:return qn(s,":")}},x:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"x":return op(s);case"xxxx":case"xx":return qn(s);case"xxxxx":case"xxx":default:return qn(s,":")}},O:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+ip(s,":");case"OOOO":default:return"GMT"+qn(s,":")}},z:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+ip(s,":");case"zzzz":default:return"GMT"+qn(s,":")}},t:function(e,t,n){const s=Math.trunc(+e/1e3);return fe(s,t.length)},T:function(e,t,n){return fe(+e,t.length)}};function ip(e,t=""){const n=e>0?"-":"+",s=Math.abs(e),i=Math.trunc(s/60),o=s%60;return o===0?n+String(i):n+String(i)+t+fe(o,2)}function op(e,t){return e%60===0?(e>0?"-":"+")+fe(Math.abs(e)/60,2):qn(e,t)}function qn(e,t=""){const n=e>0?"-":"+",s=Math.abs(e),i=fe(Math.trunc(s/60),2),o=fe(s%60,2);return n+i+t+o}const rp=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},ap=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},kl={p:ap,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],s=n[1],i=n[2];if(!i)return rp(e,t);let o;switch(s){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;case"PPPP":default:o=t.dateTime({width:"full"});break}return o.replace("{{date}}",rp(s,t)).replace("{{time}}",ap(i,t))}},LN=/^D+$/,AN=/^Y+$/,FN=["D","DD","YY","YYYY"];function lp(e){return LN.test(e)}function dp(e){return AN.test(e)}function jl(e,t,n){const s=zN(e,t,n);if(console.warn(s),FN.includes(e))throw new RangeError(s)}function zN(e,t,n){const s=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${s} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const WN=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,BN=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,HN=/^'([^]*?)'?$/,VN=/''/g,RN=/[a-zA-Z]/;function Ii(e,t,n){var u,h,f,m,p,b,x,w;const s=Rn(),i=(n==null?void 0:n.locale)??s.locale??ep,o=(n==null?void 0:n.firstWeekContainsDate)??((h=(u=n==null?void 0:n.locale)==null?void 0:u.options)==null?void 0:h.firstWeekContainsDate)??s.firstWeekContainsDate??((m=(f=s.locale)==null?void 0:f.options)==null?void 0:m.firstWeekContainsDate)??1,r=(n==null?void 0:n.weekStartsOn)??((b=(p=n==null?void 0:n.locale)==null?void 0:p.options)==null?void 0:b.weekStartsOn)??s.weekStartsOn??((w=(x=s.locale)==null?void 0:x.options)==null?void 0:w.weekStartsOn)??0,a=Z(e,n==null?void 0:n.in);if(!Gm(a))throw new RangeError("Invalid time value");let d=t.match(BN).map(_=>{const y=_[0];if(y==="p"||y==="P"){const v=kl[y];return v(_,i.formatLong)}return _}).join("").match(WN).map(_=>{if(_==="''")return{isToken:!1,value:"'"};const y=_[0];if(y==="'")return{isToken:!1,value:$N(_)};if(sp[y])return{isToken:!0,value:_};if(y.match(RN))throw new RangeError("Format string contains an unescaped latin alphabet character `"+y+"`");return{isToken:!1,value:_}});i.localize.preprocessor&&(d=i.localize.preprocessor(a,d));const c={firstWeekContainsDate:o,weekStartsOn:r,locale:i};return d.map(_=>{if(!_.isToken)return _.value;const y=_.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&dp(y)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&lp(y))&&jl(y,t,String(e));const v=sp[y[0]];return v(a,y,i.localize,c)}).join("")}function $N(e){const t=e.match(HN);return t?t[1].replace(VN,"'"):e}function UN(){return Object.assign({},Rn())}function qN(e,t){const n=Z(e,t==null?void 0:t.in).getDay();return n===0?7:n}function YN(e,t){const n=KN(t)?new t(0):je(t,0);return n.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),n.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n}function KN(e){var t;return typeof e=="function"&&((t=e.prototype)==null?void 0:t.constructor)===e}const GN=10;class cp{constructor(){I(this,"subPriority",0)}validate(t,n){return!0}}class XN extends cp{constructor(t,n,s,i,o){super(),this.value=t,this.validateValue=n,this.setValue=s,this.priority=i,o&&(this.subPriority=o)}validate(t,n){return this.validateValue(t,this.value,n)}set(t,n,s){return this.setValue(t,n,this.value,s)}}class QN extends cp{constructor(n,s){super();I(this,"priority",GN);I(this,"subPriority",-1);this.context=n||(i=>je(s,i))}set(n,s){return s.timestampIsSet?n:je(n,YN(n,this.context))}}class de{run(t,n,s,i){const o=this.parse(t,n,s,i);return o?{setter:new XN(o.value,this.validate,this.set,this.priority,this.subPriority),rest:o.rest}:null}validate(t,n,s){return!0}}class ZN extends de{constructor(){super(...arguments);I(this,"priority",140);I(this,"incompatibleTokens",["R","u","t","T"])}parse(n,s,i){switch(s){case"G":case"GG":case"GGG":return i.era(n,{width:"abbreviated"})||i.era(n,{width:"narrow"});case"GGGGG":return i.era(n,{width:"narrow"});case"GGGG":default:return i.era(n,{width:"wide"})||i.era(n,{width:"abbreviated"})||i.era(n,{width:"narrow"})}}set(n,s,i){return s.era=i,n.setFullYear(i,0,1),n.setHours(0,0,0,0),n}}const Me={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},It={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function Te(e,t){return e&&{value:t(e.value),rest:e.rest}}function _e(e,t){const n=t.match(e);return n?{value:parseInt(n[0],10),rest:t.slice(n[0].length)}:null}function Lt(e,t){const n=t.match(e);if(!n)return null;if(n[0]==="Z")return{value:0,rest:t.slice(1)};const s=n[1]==="+"?1:-1,i=n[2]?parseInt(n[2],10):0,o=n[3]?parseInt(n[3],10):0,r=n[5]?parseInt(n[5],10):0;return{value:s*(i*Ci+o*Si+r*E2),rest:t.slice(n[0].length)}}function up(e){return _e(Me.anyDigitsSigned,e)}function Ne(e,t){switch(e){case 1:return _e(Me.singleDigit,t);case 2:return _e(Me.twoDigits,t);case 3:return _e(Me.threeDigits,t);case 4:return _e(Me.fourDigits,t);default:return _e(new RegExp("^\\d{1,"+e+"}"),t)}}function ur(e,t){switch(e){case 1:return _e(Me.singleDigitSigned,t);case 2:return _e(Me.twoDigitsSigned,t);case 3:return _e(Me.threeDigitsSigned,t);case 4:return _e(Me.fourDigitsSigned,t);default:return _e(new RegExp("^-?\\d{1,"+e+"}"),t)}}function Nl(e){switch(e){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function hp(e,t){const n=t>0,s=n?t:1-t;let i;if(s<=50)i=e||100;else{const o=s+50,r=Math.trunc(o/100)*100,a=e>=o%100;i=e+r-(a?100:0)}return n?i:1-i}function fp(e){return e%400===0||e%4===0&&e%100!==0}class JN extends de{constructor(){super(...arguments);I(this,"priority",130);I(this,"incompatibleTokens",["Y","R","u","w","I","i","e","c","t","T"])}parse(n,s,i){const o=r=>({year:r,isTwoDigitYear:s==="yy"});switch(s){case"y":return Te(Ne(4,n),o);case"yo":return Te(i.ordinalNumber(n,{unit:"year"}),o);default:return Te(Ne(s.length,n),o)}}validate(n,s){return s.isTwoDigitYear||s.year>0}set(n,s,i){const o=n.getFullYear();if(i.isTwoDigitYear){const a=hp(i.year,o);return n.setFullYear(a,0,1),n.setHours(0,0,0,0),n}const r=!("era"in s)||s.era===1?i.year:1-i.year;return n.setFullYear(r,0,1),n.setHours(0,0,0,0),n}}class eS extends de{constructor(){super(...arguments);I(this,"priority",130);I(this,"incompatibleTokens",["y","R","u","Q","q","M","L","I","d","D","i","t","T"])}parse(n,s,i){const o=r=>({year:r,isTwoDigitYear:s==="YY"});switch(s){case"Y":return Te(Ne(4,n),o);case"Yo":return Te(i.ordinalNumber(n,{unit:"year"}),o);default:return Te(Ne(s.length,n),o)}}validate(n,s){return s.isTwoDigitYear||s.year>0}set(n,s,i,o){const r=vl(n,o);if(i.isTwoDigitYear){const d=hp(i.year,r);return n.setFullYear(d,0,o.firstWeekContainsDate),n.setHours(0,0,0,0),yt(n,o)}const a=!("era"in s)||s.era===1?i.year:1-i.year;return n.setFullYear(a,0,o.firstWeekContainsDate),n.setHours(0,0,0,0),yt(n,o)}}class tS extends de{constructor(){super(...arguments);I(this,"priority",130);I(this,"incompatibleTokens",["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"])}parse(n,s){return ur(s==="R"?4:s.length,n)}set(n,s,i){const o=je(n,0);return o.setFullYear(i,0,4),o.setHours(0,0,0,0),xs(o)}}class nS extends de{constructor(){super(...arguments);I(this,"priority",130);I(this,"incompatibleTokens",["G","y","Y","R","w","I","i","e","c","t","T"])}parse(n,s){return ur(s==="u"?4:s.length,n)}set(n,s,i){return n.setFullYear(i,0,1),n.setHours(0,0,0,0),n}}class sS extends de{constructor(){super(...arguments);I(this,"priority",120);I(this,"incompatibleTokens",["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"])}parse(n,s,i){switch(s){case"Q":case"QQ":return Ne(s.length,n);case"Qo":return i.ordinalNumber(n,{unit:"quarter"});case"QQQ":return i.quarter(n,{width:"abbreviated",context:"formatting"})||i.quarter(n,{width:"narrow",context:"formatting"});case"QQQQQ":return i.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return i.quarter(n,{width:"wide",context:"formatting"})||i.quarter(n,{width:"abbreviated",context:"formatting"})||i.quarter(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=1&&s<=4}set(n,s,i){return n.setMonth((i-1)*3,1),n.setHours(0,0,0,0),n}}class iS extends de{constructor(){super(...arguments);I(this,"priority",120);I(this,"incompatibleTokens",["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"])}parse(n,s,i){switch(s){case"q":case"qq":return Ne(s.length,n);case"qo":return i.ordinalNumber(n,{unit:"quarter"});case"qqq":return i.quarter(n,{width:"abbreviated",context:"standalone"})||i.quarter(n,{width:"narrow",context:"standalone"});case"qqqqq":return i.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return i.quarter(n,{width:"wide",context:"standalone"})||i.quarter(n,{width:"abbreviated",context:"standalone"})||i.quarter(n,{width:"narrow",context:"standalone"})}}validate(n,s){return s>=1&&s<=4}set(n,s,i){return n.setMonth((i-1)*3,1),n.setHours(0,0,0,0),n}}class oS extends de{constructor(){super(...arguments);I(this,"incompatibleTokens",["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]);I(this,"priority",110)}parse(n,s,i){const o=r=>r-1;switch(s){case"M":return Te(_e(Me.month,n),o);case"MM":return Te(Ne(2,n),o);case"Mo":return Te(i.ordinalNumber(n,{unit:"month"}),o);case"MMM":return i.month(n,{width:"abbreviated",context:"formatting"})||i.month(n,{width:"narrow",context:"formatting"});case"MMMMM":return i.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return i.month(n,{width:"wide",context:"formatting"})||i.month(n,{width:"abbreviated",context:"formatting"})||i.month(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=0&&s<=11}set(n,s,i){return n.setMonth(i,1),n.setHours(0,0,0,0),n}}class rS extends de{constructor(){super(...arguments);I(this,"priority",110);I(this,"incompatibleTokens",["Y","R","q","Q","M","w","I","D","i","e","c","t","T"])}parse(n,s,i){const o=r=>r-1;switch(s){case"L":return Te(_e(Me.month,n),o);case"LL":return Te(Ne(2,n),o);case"Lo":return Te(i.ordinalNumber(n,{unit:"month"}),o);case"LLL":return i.month(n,{width:"abbreviated",context:"standalone"})||i.month(n,{width:"narrow",context:"standalone"});case"LLLLL":return i.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return i.month(n,{width:"wide",context:"standalone"})||i.month(n,{width:"abbreviated",context:"standalone"})||i.month(n,{width:"narrow",context:"standalone"})}}validate(n,s){return s>=0&&s<=11}set(n,s,i){return n.setMonth(i,1),n.setHours(0,0,0,0),n}}function aS(e,t,n){const s=Z(e,n==null?void 0:n.in),i=np(s,n)-t;return s.setDate(s.getDate()-i*7),Z(s,n==null?void 0:n.in)}class lS extends de{constructor(){super(...arguments);I(this,"priority",100);I(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","i","t","T"])}parse(n,s,i){switch(s){case"w":return _e(Me.week,n);case"wo":return i.ordinalNumber(n,{unit:"week"});default:return Ne(s.length,n)}}validate(n,s){return s>=1&&s<=53}set(n,s,i,o){return yt(aS(n,i,o),o)}}function dS(e,t,n){const s=Z(e,n==null?void 0:n.in),i=tp(s,n)-t;return s.setDate(s.getDate()-i*7),s}class cS extends de{constructor(){super(...arguments);I(this,"priority",100);I(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"])}parse(n,s,i){switch(s){case"I":return _e(Me.week,n);case"Io":return i.ordinalNumber(n,{unit:"week"});default:return Ne(s.length,n)}}validate(n,s){return s>=1&&s<=53}set(n,s,i){return xs(dS(n,i))}}const uS=[31,28,31,30,31,30,31,31,30,31,30,31],hS=[31,29,31,30,31,30,31,31,30,31,30,31];class fS extends de{constructor(){super(...arguments);I(this,"priority",90);I(this,"subPriority",1);I(this,"incompatibleTokens",["Y","R","q","Q","w","I","D","i","e","c","t","T"])}parse(n,s,i){switch(s){case"d":return _e(Me.date,n);case"do":return i.ordinalNumber(n,{unit:"date"});default:return Ne(s.length,n)}}validate(n,s){const i=n.getFullYear(),o=fp(i),r=n.getMonth();return o?s>=1&&s<=hS[r]:s>=1&&s<=uS[r]}set(n,s,i){return n.setDate(i),n.setHours(0,0,0,0),n}}class mS extends de{constructor(){super(...arguments);I(this,"priority",90);I(this,"subpriority",1);I(this,"incompatibleTokens",["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"])}parse(n,s,i){switch(s){case"D":case"DD":return _e(Me.dayOfYear,n);case"Do":return i.ordinalNumber(n,{unit:"date"});default:return Ne(s.length,n)}}validate(n,s){const i=n.getFullYear();return fp(i)?s>=1&&s<=366:s>=1&&s<=365}set(n,s,i){return n.setMonth(0,i),n.setHours(0,0,0,0),n}}function Sl(e,t,n){var h,f,m,p;const s=Rn(),i=(n==null?void 0:n.weekStartsOn)??((f=(h=n==null?void 0:n.locale)==null?void 0:h.options)==null?void 0:f.weekStartsOn)??s.weekStartsOn??((p=(m=s.locale)==null?void 0:m.options)==null?void 0:p.weekStartsOn)??0,o=Z(e,n==null?void 0:n.in),r=o.getDay(),d=(t%7+7)%7,c=7-i,u=t<0||t>6?t-(r+c)%7:(d+c)%7-(r+c)%7;return Mi(o,u,n)}class pS extends de{constructor(){super(...arguments);I(this,"priority",90);I(this,"incompatibleTokens",["D","i","e","c","t","T"])}parse(n,s,i){switch(s){case"E":case"EE":case"EEE":return i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"});case"EEEEE":return i.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"});case"EEEE":default:return i.day(n,{width:"wide",context:"formatting"})||i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=0&&s<=6}set(n,s,i,o){return n=Sl(n,i,o),n.setHours(0,0,0,0),n}}class gS extends de{constructor(){super(...arguments);I(this,"priority",90);I(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"])}parse(n,s,i,o){const r=a=>{const d=Math.floor((a-1)/7)*7;return(a+o.weekStartsOn+6)%7+d};switch(s){case"e":case"ee":return Te(Ne(s.length,n),r);case"eo":return Te(i.ordinalNumber(n,{unit:"day"}),r);case"eee":return i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"});case"eeeee":return i.day(n,{width:"narrow",context:"formatting"});case"eeeeee":return i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"});case"eeee":default:return i.day(n,{width:"wide",context:"formatting"})||i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=0&&s<=6}set(n,s,i,o){return n=Sl(n,i,o),n.setHours(0,0,0,0),n}}class bS extends de{constructor(){super(...arguments);I(this,"priority",90);I(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"])}parse(n,s,i,o){const r=a=>{const d=Math.floor((a-1)/7)*7;return(a+o.weekStartsOn+6)%7+d};switch(s){case"c":case"cc":return Te(Ne(s.length,n),r);case"co":return Te(i.ordinalNumber(n,{unit:"day"}),r);case"ccc":return i.day(n,{width:"abbreviated",context:"standalone"})||i.day(n,{width:"short",context:"standalone"})||i.day(n,{width:"narrow",context:"standalone"});case"ccccc":return i.day(n,{width:"narrow",context:"standalone"});case"cccccc":return i.day(n,{width:"short",context:"standalone"})||i.day(n,{width:"narrow",context:"standalone"});case"cccc":default:return i.day(n,{width:"wide",context:"standalone"})||i.day(n,{width:"abbreviated",context:"standalone"})||i.day(n,{width:"short",context:"standalone"})||i.day(n,{width:"narrow",context:"standalone"})}}validate(n,s){return s>=0&&s<=6}set(n,s,i,o){return n=Sl(n,i,o),n.setHours(0,0,0,0),n}}function xS(e,t,n){const s=Z(e,n==null?void 0:n.in),i=qN(s,n),o=t-i;return Mi(s,o,n)}class wS extends de{constructor(){super(...arguments);I(this,"priority",90);I(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"])}parse(n,s,i){const o=r=>r===0?7:r;switch(s){case"i":case"ii":return Ne(s.length,n);case"io":return i.ordinalNumber(n,{unit:"day"});case"iii":return Te(i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"}),o);case"iiiii":return Te(i.day(n,{width:"narrow",context:"formatting"}),o);case"iiiiii":return Te(i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"}),o);case"iiii":default:return Te(i.day(n,{width:"wide",context:"formatting"})||i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"}),o)}}validate(n,s){return s>=1&&s<=7}set(n,s,i){return n=xS(n,i),n.setHours(0,0,0,0),n}}class _S extends de{constructor(){super(...arguments);I(this,"priority",80);I(this,"incompatibleTokens",["b","B","H","k","t","T"])}parse(n,s,i){switch(s){case"a":case"aa":case"aaa":return i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaaa":return i.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaa":default:return i.dayPeriod(n,{width:"wide",context:"formatting"})||i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,s,i){return n.setHours(Nl(i),0,0,0),n}}class yS extends de{constructor(){super(...arguments);I(this,"priority",80);I(this,"incompatibleTokens",["a","B","H","k","t","T"])}parse(n,s,i){switch(s){case"b":case"bb":case"bbb":return i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbbb":return i.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbb":default:return i.dayPeriod(n,{width:"wide",context:"formatting"})||i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,s,i){return n.setHours(Nl(i),0,0,0),n}}class vS extends de{constructor(){super(...arguments);I(this,"priority",80);I(this,"incompatibleTokens",["a","b","t","T"])}parse(n,s,i){switch(s){case"B":case"BB":case"BBB":return i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBBB":return i.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBB":default:return i.dayPeriod(n,{width:"wide",context:"formatting"})||i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,s,i){return n.setHours(Nl(i),0,0,0),n}}class kS extends de{constructor(){super(...arguments);I(this,"priority",70);I(this,"incompatibleTokens",["H","K","k","t","T"])}parse(n,s,i){switch(s){case"h":return _e(Me.hour12h,n);case"ho":return i.ordinalNumber(n,{unit:"hour"});default:return Ne(s.length,n)}}validate(n,s){return s>=1&&s<=12}set(n,s,i){const o=n.getHours()>=12;return o&&i<12?n.setHours(i+12,0,0,0):!o&&i===12?n.setHours(0,0,0,0):n.setHours(i,0,0,0),n}}class jS extends de{constructor(){super(...arguments);I(this,"priority",70);I(this,"incompatibleTokens",["a","b","h","K","k","t","T"])}parse(n,s,i){switch(s){case"H":return _e(Me.hour23h,n);case"Ho":return i.ordinalNumber(n,{unit:"hour"});default:return Ne(s.length,n)}}validate(n,s){return s>=0&&s<=23}set(n,s,i){return n.setHours(i,0,0,0),n}}class NS extends de{constructor(){super(...arguments);I(this,"priority",70);I(this,"incompatibleTokens",["h","H","k","t","T"])}parse(n,s,i){switch(s){case"K":return _e(Me.hour11h,n);case"Ko":return i.ordinalNumber(n,{unit:"hour"});default:return Ne(s.length,n)}}validate(n,s){return s>=0&&s<=11}set(n,s,i){return n.getHours()>=12&&i<12?n.setHours(i+12,0,0,0):n.setHours(i,0,0,0),n}}class SS extends de{constructor(){super(...arguments);I(this,"priority",70);I(this,"incompatibleTokens",["a","b","h","H","K","t","T"])}parse(n,s,i){switch(s){case"k":return _e(Me.hour24h,n);case"ko":return i.ordinalNumber(n,{unit:"hour"});default:return Ne(s.length,n)}}validate(n,s){return s>=1&&s<=24}set(n,s,i){const o=i<=24?i%24:i;return n.setHours(o,0,0,0),n}}class CS extends de{constructor(){super(...arguments);I(this,"priority",60);I(this,"incompatibleTokens",["t","T"])}parse(n,s,i){switch(s){case"m":return _e(Me.minute,n);case"mo":return i.ordinalNumber(n,{unit:"minute"});default:return Ne(s.length,n)}}validate(n,s){return s>=0&&s<=59}set(n,s,i){return n.setMinutes(i,0,0),n}}class MS extends de{constructor(){super(...arguments);I(this,"priority",50);I(this,"incompatibleTokens",["t","T"])}parse(n,s,i){switch(s){case"s":return _e(Me.second,n);case"so":return i.ordinalNumber(n,{unit:"second"});default:return Ne(s.length,n)}}validate(n,s){return s>=0&&s<=59}set(n,s,i){return n.setSeconds(i,0),n}}class TS extends de{constructor(){super(...arguments);I(this,"priority",30);I(this,"incompatibleTokens",["t","T"])}parse(n,s){const i=o=>Math.trunc(o*Math.pow(10,-s.length+3));return Te(Ne(s.length,n),i)}set(n,s,i){return n.setMilliseconds(i),n}}class PS extends de{constructor(){super(...arguments);I(this,"priority",10);I(this,"incompatibleTokens",["t","T","x"])}parse(n,s){switch(s){case"X":return Lt(It.basicOptionalMinutes,n);case"XX":return Lt(It.basic,n);case"XXXX":return Lt(It.basicOptionalSeconds,n);case"XXXXX":return Lt(It.extendedOptionalSeconds,n);case"XXX":default:return Lt(It.extended,n)}}set(n,s,i){return s.timestampIsSet?n:je(n,n.getTime()-dr(n)-i)}}class ES extends de{constructor(){super(...arguments);I(this,"priority",10);I(this,"incompatibleTokens",["t","T","X"])}parse(n,s){switch(s){case"x":return Lt(It.basicOptionalMinutes,n);case"xx":return Lt(It.basic,n);case"xxxx":return Lt(It.basicOptionalSeconds,n);case"xxxxx":return Lt(It.extendedOptionalSeconds,n);case"xxx":default:return Lt(It.extended,n)}}set(n,s,i){return s.timestampIsSet?n:je(n,n.getTime()-dr(n)-i)}}class DS extends de{constructor(){super(...arguments);I(this,"priority",40);I(this,"incompatibleTokens","*")}parse(n){return up(n)}set(n,s,i){return[je(n,i*1e3),{timestampIsSet:!0}]}}class OS extends de{constructor(){super(...arguments);I(this,"priority",20);I(this,"incompatibleTokens","*")}parse(n){return up(n)}set(n,s,i){return[je(n,i),{timestampIsSet:!0}]}}const IS={G:new ZN,y:new JN,Y:new eS,R:new tS,u:new nS,Q:new sS,q:new iS,M:new oS,L:new rS,w:new lS,I:new cS,d:new fS,D:new mS,E:new pS,e:new gS,c:new bS,i:new wS,a:new _S,b:new yS,B:new vS,h:new kS,H:new jS,K:new NS,k:new SS,m:new CS,s:new MS,S:new TS,X:new PS,x:new ES,t:new DS,T:new OS},LS=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,AS=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,FS=/^'([^]*?)'?$/,zS=/''/g,WS=/\S/,BS=/[a-zA-Z]/;function HS(e,t,n,s){var x,w,_,y,v,j,k,C;const i=()=>je((s==null?void 0:s.in)||n,NaN),o=UN(),r=(s==null?void 0:s.locale)??o.locale??ep,a=(s==null?void 0:s.firstWeekContainsDate)??((w=(x=s==null?void 0:s.locale)==null?void 0:x.options)==null?void 0:w.firstWeekContainsDate)??o.firstWeekContainsDate??((y=(_=o.locale)==null?void 0:_.options)==null?void 0:y.firstWeekContainsDate)??1,d=(s==null?void 0:s.weekStartsOn)??((j=(v=s==null?void 0:s.locale)==null?void 0:v.options)==null?void 0:j.weekStartsOn)??o.weekStartsOn??((C=(k=o.locale)==null?void 0:k.options)==null?void 0:C.weekStartsOn)??0;if(!t)return e?i():Z(n,s==null?void 0:s.in);const c={firstWeekContainsDate:a,weekStartsOn:d,locale:r},u=[new QN(s==null?void 0:s.in,n)],h=t.match(AS).map(S=>{const T=S[0];if(T in kl){const D=kl[T];return D(S,r.formatLong)}return S}).join("").match(LS),f=[];for(let S of h){!(s!=null&&s.useAdditionalWeekYearTokens)&&dp(S)&&jl(S,t,e),!(s!=null&&s.useAdditionalDayOfYearTokens)&&lp(S)&&jl(S,t,e);const T=S[0],D=IS[T];if(D){const{incompatibleTokens:P}=D;if(Array.isArray(P)){const W=f.find($=>P.includes($.token)||$.token===T);if(W)throw new RangeError(`The format string mustn't contain \`${W.fullToken}\` and \`${S}\` at the same time`)}else if(D.incompatibleTokens==="*"&&f.length>0)throw new RangeError(`The format string mustn't contain \`${S}\` and any other token at the same time`);f.push({token:T,fullToken:S});const L=D.run(e,S,r.match,c);if(!L)return i();u.push(L.setter),e=L.rest}else{if(T.match(BS))throw new RangeError("Format string contains an unescaped latin alphabet character `"+T+"`");if(S==="''"?S="'":T==="'"&&(S=VS(S)),e.indexOf(S)===0)e=e.slice(S.length);else return i()}}if(e.length>0&&WS.test(e))return i();const m=u.map(S=>S.priority).sort((S,T)=>T-S).filter((S,T,D)=>D.indexOf(S)===T).map(S=>u.filter(T=>T.priority===S).sort((T,D)=>D.subPriority-T.subPriority)).map(S=>S[0]);let p=Z(n,s==null?void 0:s.in);if(isNaN(+p))return i();const b={};for(const S of m){if(!S.validate(p,c))return i();const T=S.set(p,b,c);Array.isArray(T)?(p=T[0],Object.assign(b,T[1])):p=T}return p}function VS(e){return e.match(FS)[1].replace(zS,"'")}function RS(e,t){const n=Z(e,t==null?void 0:t.in);return n.setMinutes(0,0,0),n}function $S(e,t){const n=Z(e,t==null?void 0:t.in);return n.setSeconds(0,0),n}function US(e,t){const n=Z(e,t==null?void 0:t.in);return n.setMilliseconds(0),n}function Li(e,t,n){return Mi(e,-t,n)}function qS(e,t){const n=()=>je(t==null?void 0:t.in,NaN),s=(t==null?void 0:t.additionalDigits)??2,i=XS(e);let o;if(i.date){const c=QS(i.date,s);o=ZS(c.restDateString,c.year)}if(!o||isNaN(+o))return n();const r=+o;let a=0,d;if(i.time&&(a=JS(i.time),isNaN(a)))return n();if(i.timezone){if(d=eC(i.timezone),isNaN(d))return n()}else{const c=new Date(r+a),u=Z(0,t==null?void 0:t.in);return u.setFullYear(c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate()),u.setHours(c.getUTCHours(),c.getUTCMinutes(),c.getUTCSeconds(),c.getUTCMilliseconds()),u}return Z(r+a+d,t==null?void 0:t.in)}const hr={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},YS=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,KS=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,GS=/^([+-])(\d{2})(?::?(\d{2}))?$/;function XS(e){const t={},n=e.split(hr.dateTimeDelimiter);let s;if(n.length>2)return t;if(/:/.test(n[0])?s=n[0]:(t.date=n[0],s=n[1],hr.timeZoneDelimiter.test(t.date)&&(t.date=e.split(hr.timeZoneDelimiter)[0],s=e.substr(t.date.length,e.length))),s){const i=hr.timezone.exec(s);i?(t.time=s.replace(i[1],""),t.timezone=i[1]):t.time=s}return t}function QS(e,t){const n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),s=e.match(n);if(!s)return{year:NaN,restDateString:""};const i=s[1]?parseInt(s[1]):null,o=s[2]?parseInt(s[2]):null;return{year:o===null?i:o*100,restDateString:e.slice((s[1]||s[2]).length)}}function ZS(e,t){if(t===null)return new Date(NaN);const n=e.match(YS);if(!n)return new Date(NaN);const s=!!n[4],i=Ai(n[1]),o=Ai(n[2])-1,r=Ai(n[3]),a=Ai(n[4]),d=Ai(n[5])-1;if(s)return oC(t,a,d)?tC(t,a,d):new Date(NaN);{const c=new Date(0);return!sC(t,o,r)||!iC(t,i)?new Date(NaN):(c.setUTCFullYear(t,o,Math.max(i,r)),c)}}function Ai(e){return e?parseInt(e):1}function JS(e){const t=e.match(KS);if(!t)return NaN;const n=Cl(t[1]),s=Cl(t[2]),i=Cl(t[3]);return rC(n,s,i)?n*Ci+s*Si+i*1e3:NaN}function Cl(e){return e&&parseFloat(e.replace(",","."))||0}function eC(e){if(e==="Z")return 0;const t=e.match(GS);if(!t)return 0;const n=t[1]==="+"?-1:1,s=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return aC(s,i)?n*(s*Ci+i*Si):NaN}function tC(e,t,n){const s=new Date(0);s.setUTCFullYear(e,0,4);const i=s.getUTCDay()||7,o=(t-1)*7+n+1-i;return s.setUTCDate(s.getUTCDate()+o),s}const nC=[31,null,31,30,31,30,31,31,30,31,30,31];function mp(e){return e%400===0||e%4===0&&e%100!==0}function sC(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(nC[t]||(mp(e)?29:28))}function iC(e,t){return t>=1&&t<=(mp(e)?366:365)}function oC(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function rC(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function aC(e,t){return t>=0&&t<=59}function lC(e,t,n){return lr(e,-t,n)}function dC(e,t,n){return Km(e,-t,n)}/*!
 * chartjs-adapter-date-fns v3.0.0
 * https://www.chartjs.org
 * (c) 2022 chartjs-adapter-date-fns Contributors
 * Released under the MIT license
 */const cC={datetime:"MMM d, yyyy, h:mm:ss aaaa",millisecond:"h:mm:ss.SSS aaaa",second:"h:mm:ss aaaa",minute:"h:mm aaaa",hour:"ha",day:"MMM d",week:"PP",month:"MMM yyyy",quarter:"qqq - yyyy",year:"yyyy"};Lf._date.override({_id:"date-fns",formats:function(){return cC},parse:function(e,t){if(e===null||typeof e>"u")return null;const n=typeof e;return n==="number"||e instanceof Date?e=Z(e):n==="string"&&(typeof t=="string"?e=HS(e,t,new Date,this.options):e=qS(e,this.options)),Gm(e)?e.getTime():null},format:function(e,t){return Ii(e,t,this.options)},add:function(e,t,n){switch(n){case"millisecond":return wl(e,t);case"second":return F2(e,t);case"minute":return L2(e,t);case"hour":return D2(e,t);case"day":return Mi(e,t);case"week":return z2(e,t);case"month":return lr(e,t);case"quarter":return A2(e,t);case"year":return Km(e,t);default:return e}},diff:function(e,t,n){switch(n){case"millisecond":return _l(e,t);case"second":return q2(e,t);case"minute":return R2(e,t);case"hour":return V2(e,t);case"day":return Xm(e,t);case"week":return Y2(e,t);case"month":return Jm(e,t);case"quarter":return U2(e,t);case"year":return K2(e,t);default:return 0}},startOf:function(e,t,n){switch(t){case"second":return US(e);case"minute":return $S(e);case"hour":return RS(e);case"day":return Un(e);case"week":return yt(e);case"isoWeek":return yt(e,{weekStartsOn:+n});case"month":return cr(e);case"quarter":return G2(e);case"year":return Ei(e);default:return e}},endOf:function(e,t){switch(t){case"second":return tN(e);case"minute":return J2(e);case"hour":return Q2(e);case"day":return ft(e);case"week":return Z2(e);case"month":return Zm(e);case"quarter":return eN(e);case"year":return X2(e);default:return e}}}),Zo.register(gl,bl,er,mn,tr,vi,Jj,a2,Qj,Uj,Ni);const nt={primary:{light:"rgb(99, 102, 241)",dark:"rgb(129, 140, 248)"},secondary:{light:"rgb(34, 197, 94)",dark:"rgb(74, 222, 128)"},tertiary:{light:"rgb(249, 115, 22)",dark:"rgb(251, 146, 60)"},palette:[{light:"rgb(99, 102, 241)",dark:"rgb(209, 213, 219)"},{light:"rgb(34, 197, 94)",dark:"rgb(134, 239, 172)"},{light:"rgb(249, 115, 22)",dark:"rgb(253, 224, 71)"},{light:"rgb(236, 72, 153)",dark:"rgb(249, 168, 212)"},{light:"rgb(14, 165, 233)",dark:"rgb(125, 211, 252)"},{light:"rgb(168, 85, 247)",dark:"rgb(196, 181, 253)"},{light:"rgb(234, 179, 8)",dark:"rgb(253, 230, 138)"},{light:"rgb(239, 68, 68)",dark:"rgb(252, 165, 165)"}],grid:{light:"rgb(229, 231, 235)",dark:"rgb(55, 65, 81)"},text:{light:"rgb(107, 114, 128)",dark:"rgb(156, 163, 175)"},background:{light:"rgb(255, 255, 255)",dark:"rgb(31, 41, 55)"}};function mt(e,t=!1){return t?e.dark:e.light}function pp(e,t=!1){const n=nt.palette[e%nt.palette.length];return t?n.dark:n.light}function gp(e,t=!1){return pp(e,t)}function uC(e,t=!1){return Array.from({length:e},(n,s)=>pp(s,t))}function bp(e,t){if(e.startsWith("rgb("))return e.replace("rgb(","rgba(").replace(")",`, ${t})`);if(e.startsWith("rgba("))return e.replace(/,\s*[\d.]+\)$/,`, ${t})`);if(e.startsWith("#")){const n=parseInt(e.slice(1,3),16),s=parseInt(e.slice(3,5),16),i=parseInt(e.slice(5,7),16);return`rgba(${n}, ${s}, ${i}, ${t})`}return e}function Fi(){return typeof window>"u"?!1:document.documentElement.classList.contains("dark")}function Ml(e,t={}){const{decimals:n=0,locale:s="en-US"}=t;return new Intl.NumberFormat(s,{minimumFractionDigits:n,maximumFractionDigits:n}).format(e)}function hC(e,t={}){const{decimals:n=1,locale:s="en-US"}=t;return new Intl.NumberFormat(s,{style:"percent",minimumFractionDigits:n,maximumFractionDigits:n}).format(e/100)}function xp(e=!1){return{responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{backgroundColor:e?"rgb(31, 41, 55)":"rgb(255, 255, 255)",titleColor:e?"rgb(229, 231, 235)":"rgb(17, 24, 39)",bodyColor:e?"rgb(156, 163, 175)":"rgb(107, 114, 128)",borderColor:e?"rgb(55, 65, 81)":"rgb(229, 231, 235)",borderWidth:1,padding:12,cornerRadius:8}},scales:{x:{grid:{color:mt(nt.grid,e),drawBorder:!1},ticks:{color:mt(nt.text,e)}},y:{grid:{color:mt(nt.grid,e),drawBorder:!1},ticks:{color:mt(nt.text,e)}}}}}function fr({title:e,description:t,loading:n=!1,empty:s=!1,emptyMessage:i="No data available",emptyIcon:o,height:r=300,className:a,toolbar:d,children:c}){return l.jsxs("div",{className:ue("rounded-lg border border-neutral-200 bg-white p-4 dark:border-neutral-700 dark:bg-neutral-900",a),children:[(e||d)&&l.jsxs("div",{className:"mb-4 flex items-start justify-between",children:[l.jsxs("div",{children:[e&&l.jsx("h3",{className:"text-base font-semibold text-neutral-900 dark:text-white",children:e}),t&&l.jsx("p",{className:"mt-1 text-sm text-neutral-500 dark:text-neutral-400",children:t})]}),d&&l.jsx("div",{className:"flex items-center gap-2",children:d})]}),l.jsx("div",{style:{height:r},className:"relative overflow-hidden",children:n?l.jsx(fC,{}):s?l.jsx(mC,{message:i,icon:o}):c})]})}function fC(){return l.jsx("div",{className:"flex h-full w-full items-end justify-around gap-2 p-4",children:[40,65,45,80,55,70,35,60].map((e,t)=>l.jsx("div",{className:"w-full animate-pulse rounded-t bg-neutral-200 dark:bg-neutral-700",style:{height:`${e}%`}},t))})}function mC({message:e,icon:t}){return l.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[t!=null&&l.jsx("div",{className:"mb-2 text-neutral-400 dark:text-neutral-500",children:typeof t=="function"?g.createElement(t,{className:"h-8 w-8"}):t}),l.jsx("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:e})]})}function _s({children:e}){return l.jsx("div",{className:"flex items-center gap-2",children:e})}function ze({icon:e,label:t,onClick:n,active:s=!1,disabled:i=!1,className:o,...r}){return l.jsxs("button",{type:"button",onClick:n,disabled:i,className:ue("inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-sm font-medium transition-colors",s?"bg-blue-600 text-white dark:bg-blue-500 dark:text-white":"bg-neutral-100 text-neutral-700 hover:bg-neutral-200 dark:bg-neutral-800 dark:text-neutral-300 dark:hover:bg-neutral-700",i&&"cursor-not-allowed opacity-50",o),title:t,...r,children:[e!=null&&(typeof e=="function"?g.createElement(e,{className:"h-4 w-4"}):e),t&&l.jsx("span",{className:"hidden sm:inline",children:t})]})}const wp="label";function _p(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function pC(e,t){const n=e.options;n&&t&&Object.assign(n,t)}function yp(e,t){e.labels=t}function vp(e,t,n=wp){const s=[];e.datasets=t.map(i=>{const o=e.datasets.find(r=>r[n]===i[n]);return!o||!i.data||s.includes(o)?{...i}:(s.push(o),Object.assign(o,i),o)})}function gC(e,t=wp){const n={labels:[],datasets:[]};return yp(n,e.labels),vp(n,e.datasets,t),n}function bC(e,t){const{height:n=150,width:s=300,redraw:i=!1,datasetIdKey:o,type:r,data:a,options:d,plugins:c=[],fallbackContent:u,updateMode:h,...f}=e,m=g.useRef(null),p=g.useRef(null),b=()=>{m.current&&(p.current=new Zo(m.current,{type:r,data:gC(a,o),options:d&&{...d},plugins:c}),_p(t,p.current))},x=()=>{_p(t,null),p.current&&(p.current.destroy(),p.current=null)};return g.useEffect(()=>{!i&&p.current&&d&&pC(p.current,d)},[i,d]),g.useEffect(()=>{!i&&p.current&&yp(p.current.config.data,a.labels)},[i,a.labels]),g.useEffect(()=>{!i&&p.current&&a.datasets&&vp(p.current.config.data,a.datasets,o)},[i,a.datasets]),g.useEffect(()=>{p.current&&(i?(x(),setTimeout(b)):p.current.update(h))},[i,d,a.labels,a.datasets,h]),g.useEffect(()=>{p.current&&(x(),setTimeout(b))},[r]),g.useEffect(()=>(b(),()=>x()),[]),l.jsx("canvas",{ref:m,role:"img",height:n,width:s,...f,children:u})}const xC=g.forwardRef(bC);function mr(e,t){return Zo.register(t),g.forwardRef((n,s)=>l.jsx(xC,{...n,ref:s,type:e}))}const wC=mr("line",$o),_C=mr("bar",Ro),yC=mr("doughnut",gs),vC=mr("pie",nl);function zi({labels:e=[],datasets:t=[],horizontal:n=!1,stacked:s=!1,showLegend:i=!1,showGrid:o=!0,formatValue:r=u=>Ml(u),yAxisLabel:a,xAxisLabel:d,options:c={}}){const[u,h]=g.useState(Fi());g.useEffect(()=>{const p=new MutationObserver(()=>{h(Fi())});return p.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>p.disconnect()},[]);const f=g.useMemo(()=>t&&t.length>0?{labels:e,datasets:t.map((p,b)=>{const x=p.color||p.backgroundColor||gp(b,u);return{label:p.label||`Dataset ${b+1}`,data:p.data,backgroundColor:p.backgroundColor||(u?x:bp(x,.8)),borderColor:p.borderColor||x,borderWidth:p.borderWidth??(u?0:1),borderRadius:p.borderRadius??4,barThickness:p.barThickness,maxBarThickness:p.maxBarThickness||50}})}:{labels:e||[],datasets:[]},[e,t,u]),m=g.useMemo(()=>{const p=xp(u);return{...p,indexAxis:n?"y":"x",plugins:{...p.plugins,legend:{display:i,position:"top",labels:{color:mt(nt.text,u),usePointStyle:!0,padding:16}},tooltip:{...p.plugins.tooltip,callbacks:{label:b=>{const x=b.dataset.label||"",w=r(b.parsed[n?"x":"y"]);return x?`${x}: ${w}`:w}}}},scales:{x:{...p.scales.x,stacked:s,grid:{...p.scales.x.grid,display:o&&!n},title:{display:!!d,text:d,color:mt(nt.text,u)}},y:{...p.scales.y,stacked:s,grid:{...p.scales.y.grid,display:o&&n},title:{display:!!a,text:a,color:mt(nt.text,u)},ticks:{...p.scales.y.ticks,callback:n?void 0:b=>r(b)}}},...c}},[u,n,s,i,o,r,a,d,c]);return l.jsx(_C,{data:f,options:m})}function kC({labels:e=[],datasets:t=[],showLegend:n=!1,showGrid:s=!0,fill:i=!1,smooth:o=!0,showPoints:r=!0,timeUnit:a,formatValue:d=f=>Ml(f),yAxisLabel:c,xAxisLabel:u,options:h={}}){const[f,m]=g.useState(Fi());g.useEffect(()=>{const x=new MutationObserver(()=>{m(Fi())});return x.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>x.disconnect()},[]);const p=g.useMemo(()=>({labels:e,datasets:t.map((x,w)=>{const _=x.color||x.borderColor||gp(w,f),y=x.fill??i;return{label:x.label||`Dataset ${w+1}`,data:x.data,borderColor:x.borderColor||_,backgroundColor:y?bp(_,.1):"transparent",fill:y,tension:o?.4:0,pointRadius:r?x.pointRadius??4:0,pointHoverRadius:r?x.pointHoverRadius??6:0,pointBackgroundColor:_,pointBorderColor:f?"rgb(31, 41, 55)":"rgb(255, 255, 255)",pointBorderWidth:2,borderWidth:x.borderWidth??2}})}),[e,t,f,i,o,r]),b=g.useMemo(()=>{const x=xp(f),w=a?{type:"time",time:{unit:a,displayFormats:{day:"MMM d",week:"MMM d",month:"MMM yyyy",year:"yyyy"}},...x.scales.x,grid:{...x.scales.x.grid,display:s},title:{display:!!u,text:u,color:mt(nt.text,f)}}:{...x.scales.x,grid:{...x.scales.x.grid,display:s},title:{display:!!u,text:u,color:mt(nt.text,f)}};return{...x,plugins:{...x.plugins,legend:{display:n,position:"top",labels:{color:mt(nt.text,f),usePointStyle:!0,padding:16}},tooltip:{...x.plugins.tooltip,callbacks:{label:_=>{const y=_.dataset.label||"",v=d(_.parsed.y);return y?`${y}: ${v}`:v}}}},scales:{x:w,y:{...x.scales.y,grid:{...x.scales.y.grid,display:s},title:{display:!!c,text:c,color:mt(nt.text,f)},ticks:{...x.scales.y.ticks,callback:_=>d(_)}}},interaction:{intersect:!1,mode:"index"},...h}},[f,n,s,a,d,c,u,h]);return l.jsx(wC,{data:p,options:b})}function Tl({labels:e=[],data:t=[],colors:n,showLegend:s=!0,legendPosition:i="right",pie:o=!1,cutout:r=70,formatValue:a=h=>Ml(h),showPercentage:d=!0,centerText:c,options:u={}}){const h=Fi(),f=o?vC:yC,m=g.useMemo(()=>{const b=n||uC(t.length,h);return{labels:e,datasets:[{data:t,backgroundColor:b,borderColor:h?"rgb(31, 41, 55)":"rgb(255, 255, 255)",borderWidth:2,hoverOffset:8}]}},[e,t,n,h]),p=g.useMemo(()=>{const b=t.reduce((x,w)=>x+w,0);return{responsive:!0,maintainAspectRatio:!1,cutout:o?0:`${r}%`,plugins:{legend:{display:s,position:i,labels:{color:mt(nt.text,h),usePointStyle:!0,padding:16,font:{size:12}}},tooltip:{backgroundColor:h?"rgb(31, 41, 55)":"rgb(255, 255, 255)",titleColor:h?"rgb(229, 231, 235)":"rgb(17, 24, 39)",bodyColor:h?"rgb(156, 163, 175)":"rgb(107, 114, 128)",borderColor:h?"rgb(55, 65, 81)":"rgb(229, 231, 235)",borderWidth:1,padding:12,cornerRadius:8,callbacks:{label:x=>{const w=x.parsed,_=x.label||"",y=a(w);if(d&&b>0){const v=hC(w/b*100);return`${_}: ${y} (${v})`}return`${_}: ${y}`}}}},...u}},[t,h,o,r,s,i,a,d,u]);return l.jsxs("div",{className:"relative h-full w-full overflow-hidden",children:[l.jsx(f,{data:m,options:p}),!o&&c&&l.jsxs("div",{className:"pointer-events-none absolute inset-0 flex flex-col items-center justify-center",children:[c.title&&l.jsx("span",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:c.title}),c.value&&l.jsx("span",{className:"text-2xl font-bold text-neutral-900 dark:text-white",children:c.value})]})]})}function ys({title:e,value:t,icon:n,iconColor:s="bg-indigo-500",trend:i,trendLabel:o="vs last period",trendInverted:r=!1,description:a,loading:d=!1,className:c}){const u=r?i<0:i>0,h=r?i>0:i<0;return d?l.jsx("div",{className:ue("rounded-lg border border-neutral-200 bg-white p-4 dark:border-neutral-700 dark:bg-neutral-900",c),children:l.jsxs("div",{className:"animate-pulse",children:[l.jsx("div",{className:"mb-2 h-4 w-24 rounded bg-neutral-200 dark:bg-neutral-700"}),l.jsx("div",{className:"h-8 w-32 rounded bg-neutral-200 dark:bg-neutral-700"})]})}):l.jsx("div",{className:ue("rounded-lg border border-neutral-200 bg-white p-4 dark:border-neutral-700 dark:bg-neutral-900",c),children:l.jsxs("div",{className:"flex items-start justify-between",children:[l.jsxs("div",{className:"flex-1",children:[l.jsx("p",{className:"text-sm font-medium text-neutral-500 dark:text-neutral-400",children:e}),l.jsx("p",{className:"mt-1 text-2xl font-bold text-neutral-900 dark:text-white",children:t}),typeof i=="number"&&l.jsxs("div",{className:"mt-2 flex items-center gap-1",children:[l.jsxs("span",{className:ue("inline-flex items-center text-sm font-medium",u&&"text-green-600 dark:text-green-400",h&&"text-red-600 dark:text-red-400",!u&&!h&&"text-neutral-500 dark:text-neutral-400"),children:[i>0?l.jsx(jC,{className:"mr-0.5 h-4 w-4"}):i<0?l.jsx(NC,{className:"mr-0.5 h-4 w-4"}):null,Math.abs(i),"%"]}),l.jsx("span",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:o})]}),a&&l.jsx("p",{className:"mt-1 text-sm text-neutral-500 dark:text-neutral-400",children:a})]}),n!=null&&l.jsx("div",{className:ue("flex h-10 w-10 shrink-0 items-center justify-center rounded-lg text-white",s),children:typeof n=="function"?g.createElement(n,{className:"h-5 w-5"}):n})]})})}function Pl({children:e,columns:t=4,className:n}){return l.jsx("div",{className:ue("grid gap-4",t===2&&"grid-cols-1 sm:grid-cols-2",t===3&&"grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",t===4&&"grid-cols-1 sm:grid-cols-2 lg:grid-cols-4",n),children:e})}function jC({className:e}){return l.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 7h8m0 0v8m0-8l-8 8-4-4-6 6"})})}function NC({className:e}){return l.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 17h8m0 0V9m0 8l-8-8-4 4-6-6"})})}function kp({value:e={start:Li(new Date,30),end:new Date},onChange:t,presets:n,showCustom:s=!0,className:i}){const[o,r]=g.useState(!1),[a,d]=g.useState(Ii(e.start,"yyyy-MM-dd")),[c,u]=g.useState(Ii(e.end,"yyyy-MM-dd")),h=g.useMemo(()=>[{label:"Today",getValue:()=>({start:Un(new Date),end:ft(new Date)})},{label:"Last 7 days",getValue:()=>({start:Un(Li(new Date,6)),end:ft(new Date)})},{label:"Last 30 days",getValue:()=>({start:Un(Li(new Date,29)),end:ft(new Date)})},{label:"This week",getValue:()=>({start:yt(new Date,{weekStartsOn:1}),end:ft(new Date)})},{label:"This month",getValue:()=>({start:cr(new Date),end:ft(new Date)})},{label:"Last month",getValue:()=>({start:cr(lC(new Date,1)),end:ft(Li(cr(new Date),1))})},{label:"This year",getValue:()=>({start:Ei(new Date),end:ft(new Date)})},{label:"Last year",getValue:()=>({start:Ei(dC(new Date,1)),end:ft(Li(Ei(new Date),1))})},{label:"All time",getValue:()=>({start:new Date(2e3,0,1),end:ft(new Date)})}],[]),f=n||h,m=x=>{r(!1);const w=x.getValue();t==null||t(w)},p=()=>{const x=new Date(a),w=new Date(c);x<=w&&(t==null||t({start:Un(x),end:ft(w)}))},b=g.useMemo(()=>!e.start||!e.end?"Select range":`${Ii(e.start,"MMM d, yyyy")} - ${Ii(e.end,"MMM d, yyyy")}`,[e]);return l.jsxs("div",{className:ue("flex flex-wrap items-center gap-2",i),children:[l.jsx("div",{className:"flex flex-wrap gap-1",children:f.map((x,w)=>l.jsx("button",{type:"button",onClick:()=>m(x),className:ue("rounded-md px-3 py-1.5 text-sm font-medium transition-colors","bg-neutral-100 text-neutral-700 hover:bg-neutral-200","dark:bg-neutral-800 dark:text-neutral-300 dark:hover:bg-neutral-700"),children:x.label},w))}),s&&l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:"or"}),l.jsx("input",{type:"date",value:a,onChange:x=>{d(x.target.value),r(!0)},className:"rounded-md border border-neutral-300 bg-white px-2 py-1 text-sm text-neutral-900 dark:border-neutral-600 dark:bg-neutral-800 dark:text-white"}),l.jsx("span",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:"to"}),l.jsx("input",{type:"date",value:c,onChange:x=>{u(x.target.value),r(!0)},className:"rounded-md border border-neutral-300 bg-white px-2 py-1 text-sm text-neutral-900 dark:border-neutral-600 dark:bg-neutral-800 dark:text-white"}),o&&l.jsx("button",{type:"button",onClick:p,className:"rounded-md bg-indigo-600 px-3 py-1 text-sm font-medium text-white hover:bg-indigo-700",children:"Apply"})]}),l.jsx("div",{className:"ml-auto text-sm text-neutral-500 dark:text-neutral-400",children:b})]})}const pr="free-downloads-woocommerce",SC=()=>{var e;return((e=window.somdn_settings)==null?void 0:e.is_pro)||!1},CC=()=>{var e;return((e=window.somdn_settings)==null?void 0:e.rest_url)||""},MC=()=>{var e;return((e=window.somdn_settings)==null?void 0:e.rest_path)||""},El=()=>{var e;return((e=window.somdn_settings)==null?void 0:e.nonce)||""};function Dl(){const e=(MC()||"").trim();if(e){const s=e.startsWith("/")?e:`/${e}`;return`${window.location.origin}${s}`.replace(/\/+$/,"")+"/"}let t=(CC()||"").trim();if(!t)return`${window.location.origin}/wp-json/`;if(t.startsWith("http//")&&(t="http:"+t.slice(5)),t.startsWith("https//")&&(t="https:"+t.slice(6)),/^https?:\/\//i.test(t))try{const s=new URL(t);return(s.origin+s.pathname).replace(/\/+$/,"")+"/"}catch{return t.replace(/\/?$/,"/")}const n=t.startsWith("/")?t:`/${t}`;return`${window.location.origin}${n}`.replace(/\/?$/,"/")}const vt=["#6366f1","#8b5cf6","#a855f7","#d946ef","#ec4899","#f43f5e","#f97316","#eab308","#22c55e","#14b8a6","#06b6d4","#3b82f6"];function vs(e){return{indigo:"bg-indigo-500",emerald:"bg-emerald-500",amber:"bg-amber-500",blue:"bg-blue-500"}[e]||"bg-indigo-500"}function Ol(e,t){return t==null||t===0?e>0?100:0:Math.round((Number(e)-Number(t))/Number(t)*100)}async function At(e,t={}){const n=Dl(),s=El(),i=new URL(`${n}somdn/v1/${e}`);Object.entries(t).forEach(([r,a])=>{a!=null&&i.searchParams.append(r,a)});const o=await fetch(i.toString(),{credentials:"same-origin",headers:{"X-WP-Nonce":s}});if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.json()}function TC({dateRange:e,onDateRangeChange:t}){const[n,s]=g.useState(null),[i,o]=g.useState(!0),[r,a]=g.useState(null),d=g.useCallback(async()=>{var b,x;o(!0),a(null);try{const w=await At("stats/overview",{start_date:(b=e==null?void 0:e.start)==null?void 0:b.toISOString().split("T")[0],end_date:(x=e==null?void 0:e.end)==null?void 0:x.toISOString().split("T")[0]});s(w)}catch(w){a(w.message),s({total_downloads:0,unique_products:0,unique_users:0,downloads_today:0,downloads_yesterday:0,downloads_this_week:0,downloads_last_week:0,downloads_this_month:0,downloads_last_month:0})}finally{o(!1)}},[e]);g.useEffect(()=>{d()},[d]);const c=g.useMemo(()=>{if(!(e!=null&&e.start)||!(e!=null&&e.end))return{days:0,includesToday:!1,comparisonLabel:""};const b=new Date(e.start),x=new Date(e.end),w=new Date;w.setHours(0,0,0,0);const _=new Date(x);_.setHours(0,0,0,0);const y=Math.ceil((x-b)/(1e3*60*60*24))+1,v=_.getTime()===w.getTime();let j="";return y===1?j="vs yesterday":y===7?j="vs previous 7 days":y===30?j="vs previous 30 days":y===90?j="vs previous 90 days":y===365?j="vs previous year":j=`vs previous ${y} days`,{days:y,includesToday:v,comparisonLabel:j}},[e]),u=g.useMemo(()=>{if(!n)return null;const b=c.days;return b<=7?n.downloads_last_week:(b<=30,n.downloads_last_month)},[n,c.days]),h=g.useMemo(()=>!(n!=null&&n.total_downloads)||c.days===0?0:Math.round(n.total_downloads/c.days*10)/10,[n==null?void 0:n.total_downloads,c.days]),f=g.useMemo(()=>!u||c.days===0?null:Math.round(u/c.days*10)/10,[u,c.days]),m=g.useMemo(()=>{const{days:b,includesToday:x,comparisonLabel:w}=c;if(x&&b<=7){const _=(n==null?void 0:n.downloads_today)||0,y=n==null?void 0:n.downloads_yesterday;return l.jsx(ys,{title:"Today",value:_,trend:Ol(_,y),trendLabel:"vs yesterday",icon:l.jsx(Hi,{className:"h-5 w-5"}),iconColor:vs("blue")},"today")}return l.jsx(ys,{title:"Average per Day",value:h,trend:Ol(h,f),trendLabel:w,icon:l.jsx(Hi,{className:"h-5 w-5"}),iconColor:vs("blue")},"average")},[c.days,c.includesToday,c.comparisonLabel,n==null?void 0:n.downloads_today,n==null?void 0:n.downloads_yesterday,h,f]);if(i)return l.jsx(Pl,{columns:4,children:[1,2,3,4].map(b=>l.jsxs("div",{className:"animate-pulse rounded-lg border border-neutral-200 bg-white p-4 dark:border-neutral-700 dark:bg-neutral-900",children:[l.jsx("div",{className:"h-4 w-24 bg-neutral-200 dark:bg-neutral-700 rounded mb-2"}),l.jsx("div",{className:"h-8 w-16 bg-neutral-200 dark:bg-neutral-700 rounded"})]},b))});const p=(n==null?void 0:n.total_downloads)||0;return l.jsxs(Pl,{columns:4,children:[l.jsx(ys,{title:"Total Downloads",value:p,trend:Ol(p,u),trendLabel:c.comparisonLabel,icon:l.jsx(br,{className:"h-5 w-5"}),iconColor:vs("indigo")},"total"),l.jsx(ys,{title:"Unique Products",value:(n==null?void 0:n.unique_products)||0,icon:l.jsx(xr,{className:"h-5 w-5"}),iconColor:vs("emerald")},"products"),l.jsx(ys,{title:"Unique Users",value:(n==null?void 0:n.unique_users)||0,icon:l.jsx(ed,{className:"h-5 w-5"}),iconColor:vs("amber")},"users"),m]})}function PC({dateRange:e}){var h,f;const[t,n]=g.useState(null),[s,i]=g.useState(!0),[o,r]=g.useState("bar"),a=g.useCallback(async()=>{var m,p;i(!0);try{const b=await At("stats/downloads-by-date",{start_date:(m=e==null?void 0:e.start)==null?void 0:m.toISOString().split("T")[0],end_date:(p=e==null?void 0:e.end)==null?void 0:p.toISOString().split("T")[0]});n(b)}catch{n({labels:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],values:[12,19,15,25,22,8,5]})}finally{i(!1)}},[e]);g.useEffect(()=>{a()},[a]);const d=g.useMemo(()=>t?{labels:t.labels||[],datasets:[{label:"Downloads",data:t.values||[],backgroundColor:o==="bar"?vt[0]:void 0,borderColor:o==="line"?vt[0]:void 0,fill:o==="line"}]}:null,[t,o]),c=o==="line"?kC:zi,u=!((h=d==null?void 0:d.labels)!=null&&h.length)||!((f=d==null?void 0:d.datasets)!=null&&f.some(m=>{var p;return(p=m.data)==null?void 0:p.length}));return l.jsx(fr,{title:"Downloads Over Time",description:"Number of downloads per day",loading:s,empty:u,emptyMessage:"No download data for this period",height:350,toolbar:l.jsxs(_s,{children:[l.jsx(ze,{label:"Bar",icon:l.jsx(Xt,{className:"h-4 w-4"}),active:o==="bar",onClick:()=>r("bar")}),l.jsx(ze,{label:"Line",icon:l.jsx(Hi,{className:"h-4 w-4"}),active:o==="line",onClick:()=>r("line")})]}),children:l.jsx(c,{labels:(d==null?void 0:d.labels)||[],datasets:(d==null?void 0:d.datasets)||[],fill:o==="line",showLegend:!1})})}function EC({dateRange:e}){var u,h;const[t,n]=g.useState(null),[s,i]=g.useState(!0),[o,r]=g.useState("horizontal"),a=g.useCallback(async()=>{var f,m;i(!0);try{const p=await At("stats/top-products",{start_date:(f=e==null?void 0:e.start)==null?void 0:f.toISOString().split("T")[0],end_date:(m=e==null?void 0:e.end)==null?void 0:m.toISOString().split("T")[0],limit:10});n(p)}catch{n({labels:["Product A","Product B","Product C","Product D","Product E"],values:[156,98,76,54,32]})}finally{i(!1)}},[e]);g.useEffect(()=>{a()},[a]);const d=g.useMemo(()=>t?o==="donut"?{labels:t.labels||[],data:t.values||[]}:{labels:t.labels||[],datasets:[{label:"Downloads",data:t.values||[],backgroundColor:vt.slice(0,(t.labels||[]).length)}]}:null,[t,o]);if(!d)return l.jsx("div",{className:"rounded-lg border border-neutral-200 bg-white p-4 dark:border-neutral-700 dark:bg-neutral-900",children:l.jsx("div",{className:"flex h-[350px] items-center justify-center",children:s?l.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-neutral-300 border-t-indigo-600"}):l.jsx("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:"No data available"})})});if(o==="donut"){const f=d.labels||[],m=d.data||[],p=m.reduce((b,x)=>b+x,0);return f.length===0||m.length===0?l.jsx(fr,{title:"Top Downloaded Products",description:"Most popular free downloads",loading:s,empty:!0,emptyMessage:"No data available",height:350,toolbar:l.jsxs(_s,{children:[l.jsx(ze,{label:"Donut",icon:l.jsx(Ns,{className:"h-4 w-4"}),active:!0,onClick:()=>r("donut")}),l.jsx(ze,{label:"Bar",icon:l.jsx(Xt,{className:"h-4 w-4"}),onClick:()=>r("bar")}),l.jsx(ze,{label:"Horizontal",icon:l.jsx(js,{className:"h-4 w-4"}),onClick:()=>r("horizontal")})]}),children:null}):l.jsxs("div",{className:"rounded-lg border border-neutral-200 bg-white p-4 dark:border-neutral-700 dark:bg-neutral-900",children:[l.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-base font-semibold text-neutral-900 dark:text-white",children:"Top Downloaded Products"}),l.jsx("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:"Most popular free downloads"})]}),l.jsxs(_s,{children:[l.jsx(ze,{label:"Donut",icon:l.jsx(Ns,{className:"h-4 w-4"}),active:o==="donut",onClick:()=>r("donut")}),l.jsx(ze,{label:"Bar",icon:l.jsx(Xt,{className:"h-4 w-4"}),active:o==="bar",onClick:()=>r("bar")}),l.jsx(ze,{label:"Horizontal",icon:l.jsx(js,{className:"h-4 w-4"}),active:o==="horizontal",onClick:()=>r("horizontal")})]})]}),l.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-start lg:gap-6",children:[l.jsx("div",{className:"w-full lg:w-1/2 overflow-hidden",style:{height:300},children:l.jsx(Tl,{labels:f,data:m,colors:vt.slice(0,f.length),showLegend:!1,cutout:60,centerText:{title:"Total",value:p.toLocaleString()}})}),l.jsxs("div",{className:"mt-4 lg:mt-0 lg:w-1/2",children:[l.jsx("div",{className:"space-y-2",children:f.map((b,x)=>{const w=m[x]||0,_=p>0?(w/p*100).toFixed(1):0,y=vt[x%vt.length];return l.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[l.jsx("span",{className:"h-3 w-3 flex-shrink-0 rounded-full",style:{backgroundColor:y}}),l.jsx("span",{className:"max-w-28 truncate text-neutral-700 dark:text-neutral-300",title:b,children:b}),l.jsxs("span",{className:"text-neutral-500 dark:text-neutral-400",children:["(",_,"%)"]}),l.jsx("span",{className:"ml-auto font-medium text-neutral-900 dark:text-white",children:w.toLocaleString()})]},x)})}),l.jsx("div",{className:"mt-3 border-t border-neutral-200 pt-2 dark:border-neutral-700",children:l.jsxs("div",{className:"flex items-center justify-between text-sm",children:[l.jsx("span",{className:"font-medium text-neutral-700 dark:text-neutral-300",children:"Total Downloads"}),l.jsx("span",{className:"font-semibold text-neutral-900 dark:text-white",children:p.toLocaleString()})]})})]})]})]})}const c=!((u=d==null?void 0:d.labels)!=null&&u.length)||!((h=d==null?void 0:d.datasets)!=null&&h.length);return l.jsx(fr,{title:"Top Downloaded Products",description:"Most popular free downloads",loading:s,empty:c,emptyMessage:"No data available",height:350,toolbar:l.jsxs(_s,{children:[l.jsx(ze,{label:"Donut",icon:l.jsx(Ns,{className:"h-4 w-4"}),active:o==="donut",onClick:()=>r("donut")}),l.jsx(ze,{label:"Bar",icon:l.jsx(Xt,{className:"h-4 w-4"}),active:o==="bar",onClick:()=>r("bar")}),l.jsx(ze,{label:"Horizontal",icon:l.jsx(js,{className:"h-4 w-4"}),active:o==="horizontal",onClick:()=>r("horizontal")})]}),children:l.jsx(zi,{labels:(d==null?void 0:d.labels)||[],datasets:(d==null?void 0:d.datasets)||[],horizontal:o==="horizontal",showLegend:!1})})}function DC({dateRange:e}){const[t,n]=g.useState(null),[s,i]=g.useState(!0),[o,r]=g.useState("donut"),a=g.useCallback(async()=>{var p,b;i(!0);try{const x=await At("stats/by-file-type",{start_date:(p=e==null?void 0:e.start)==null?void 0:p.toISOString().split("T")[0],end_date:(b=e==null?void 0:e.end)==null?void 0:b.toISOString().split("T")[0]});n(x)}catch{n({labels:["PDF","ZIP","MP3","DOCX","Other"],values:[45,25,15,10,5]})}finally{i(!1)}},[e]);if(g.useEffect(()=>{a()},[a]),!t||!t.labels||!t.values)return l.jsx("div",{className:"rounded-lg border border-neutral-200 bg-white p-4 dark:border-neutral-700 dark:bg-neutral-900",children:l.jsx("div",{className:"flex h-[300px] items-center justify-center",children:s?l.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-neutral-300 border-t-indigo-600"}):l.jsx("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:"No data available"})})});const d=t.labels||[],c=t.values||[],u=c.reduce((p,b)=>p+(b||0),0),h=vt.slice(0,d.length);if(d.length===0||c.length===0)return l.jsx("div",{className:"rounded-lg border border-neutral-200 bg-white p-4 dark:border-neutral-700 dark:bg-neutral-900",children:l.jsx("div",{className:"flex h-[300px] items-center justify-center",children:l.jsx("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:"No data available"})})});const f=d.map((p,b)=>({label:p||"",percentage:u>0?((c[b]||0)/u*100).toFixed(1):"0",value:c[b]||0,color:h[b%vt.length]}));if(o==="donut")return l.jsxs("div",{className:"rounded-lg border border-neutral-200 bg-white p-4 dark:border-neutral-700 dark:bg-neutral-900",children:[l.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[l.jsx("div",{children:l.jsx("h3",{className:"text-base font-semibold text-neutral-900 dark:text-white",children:"Downloads by File Type"})}),l.jsxs(_s,{children:[l.jsx(ze,{icon:l.jsx(Ns,{className:"h-4 w-4"}),active:o==="donut",onClick:()=>r("donut")}),l.jsx(ze,{icon:l.jsx(Xt,{className:"h-4 w-4"}),active:o==="bar",onClick:()=>r("bar")}),l.jsx(ze,{icon:l.jsx(js,{className:"h-4 w-4"}),active:o==="horizontal",onClick:()=>r("horizontal")})]})]}),l.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-start lg:gap-6",children:[l.jsx("div",{className:"w-full lg:w-1/2 overflow-hidden",style:{height:300},children:l.jsx(Tl,{labels:d,data:c,colors:h,showLegend:!1,cutout:60,centerText:{title:"Total",value:u.toLocaleString()}})}),l.jsxs("div",{className:"mt-4 lg:mt-0 lg:w-1/2",children:[l.jsx("div",{className:"space-y-2",children:f.map((p,b)=>l.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[l.jsx("span",{className:"h-3 w-3 flex-shrink-0 rounded-full",style:{backgroundColor:p.color}}),l.jsx("span",{className:"max-w-28 truncate text-neutral-700 dark:text-neutral-300",title:p.label,children:p.label}),l.jsxs("span",{className:"text-neutral-500 dark:text-neutral-400",children:["(",p.percentage,"%)"]}),l.jsx("span",{className:"ml-auto font-medium text-neutral-900 dark:text-white",children:p.value.toLocaleString()})]},b))}),l.jsx("div",{className:"mt-3 border-t border-neutral-200 pt-2 dark:border-neutral-700",children:l.jsxs("div",{className:"flex items-center justify-between text-sm",children:[l.jsx("span",{className:"font-medium text-neutral-700 dark:text-neutral-300",children:"Total Downloads"}),l.jsx("span",{className:"font-semibold text-neutral-900 dark:text-white",children:u.toLocaleString()})]})})]})]})]});const m={labels:d,datasets:[{label:"Downloads",data:c,backgroundColor:h}]};return l.jsx(fr,{title:"Downloads by File Type",loading:s,empty:!1,height:300,toolbar:l.jsxs(_s,{children:[l.jsx(ze,{label:"Donut",icon:l.jsx(Ns,{className:"h-4 w-4"}),active:o==="donut",onClick:()=>r("donut")}),l.jsx(ze,{label:"Bar",icon:l.jsx(Xt,{className:"h-4 w-4"}),active:o==="bar",onClick:()=>r("bar")}),l.jsx(ze,{label:"Horizontal",icon:l.jsx(js,{className:"h-4 w-4"}),active:o==="horizontal",onClick:()=>r("horizontal")})]}),children:l.jsx(zi,{labels:m.labels,datasets:m.datasets,horizontal:o==="horizontal",showLegend:!1})})}function jp({dateRange:e,fromDownloadLog:t=!1,showDateInHeader:n=!1,onDateRangeChange:s}){const[i,o]=g.useState([]),[r,a]=g.useState(!0),[d,c]=g.useState(1),[u,h]=g.useState(1),[f,m]=g.useState(0),[p,b]=g.useState(""),[x,w]=g.useState(""),[_,y]=g.useState(""),[v,j]=g.useState(""),[k,C]=g.useState(10),[S,T]=g.useState([]),[D,P]=g.useState(!1),L=g.useCallback(async()=>{var E,V;a(!0);try{const z={start_date:(E=e==null?void 0:e.start)==null?void 0:E.toISOString().split("T")[0],end_date:(V=e==null?void 0:e.end)==null?void 0:V.toISOString().split("T")[0],page:d,per_page:k};t&&(z.from_download_log=1),x.trim()&&(z.search=x.trim()),_&&(z.product_id=parseInt(_,10)),v&&(z.user_type=v);const A=await At("stats/recent-downloads",z);o(A.items||[]),h(A.total_pages||1),m(A.total??0)}catch{o([]),m(0)}finally{a(!1)}},[e,d,k,x,_,v,t]);g.useEffect(()=>{L()},[L]),g.useEffect(()=>{P(!0),At("stats/products-list").then(E=>T(E||[])).catch(()=>T([])).finally(()=>P(!1))},[]);const W=()=>{w(p.trim()),c(1)},$=()=>{b(""),w(""),c(1)},O=E=>{y(E.target.value),c(1)},F=E=>{j(E.target.value),c(1)},H=E=>{C(Number(E.target.value)),c(1)},M=x.trim()||_||v;return l.jsxs("div",{className:"rounded-lg border border-neutral-200 bg-white dark:border-neutral-700 dark:bg-neutral-900",children:[l.jsxs("div",{className:"border-b border-neutral-200 px-4 py-3 dark:border-neutral-700",children:[l.jsx("h3",{className:"text-base font-semibold text-neutral-900 dark:text-white",children:"Recent Downloads"}),n&&(e==null?void 0:e.start)&&(e==null?void 0:e.end)&&l.jsxs("p",{className:"mt-1 text-sm text-neutral-500 dark:text-neutral-400",children:[e.start.toLocaleDateString()," – ",e.end.toLocaleDateString()]})]}),l.jsxs("div",{className:"border-b border-neutral-200 px-4 py-3 dark:border-neutral-700 space-y-3",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s&&(e==null?void 0:e.start)&&(e==null?void 0:e.end)&&l.jsx(kp,{startDate:e.start,endDate:e.end,onChange:s}),l.jsxs("div",{className:"flex flex-1 min-w-[200px] max-w-sm items-center gap-2",children:[l.jsx("input",{type:"text",value:p,onChange:E=>b(E.target.value),onKeyDown:E=>E.key==="Enter"&&W(),placeholder:"Search by customer email...",className:"block w-full rounded-md border border-neutral-300 bg-white px-3 py-1.5 text-sm text-neutral-900 shadow-sm placeholder:text-neutral-400 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 dark:border-neutral-600 dark:bg-neutral-800 dark:text-white dark:placeholder:text-neutral-500"}),l.jsxs("button",{type:"button",onClick:W,className:"inline-flex items-center gap-1.5 rounded-md bg-indigo-600 px-3 py-1.5 text-sm font-medium text-white shadow-sm hover:bg-indigo-700",children:[l.jsx(xg,{className:"h-4 w-4"}),"Search"]}),(p||x)&&l.jsx("button",{type:"button",onClick:$,className:"inline-flex items-center rounded-md px-2 py-1.5 text-sm text-neutral-600 hover:bg-neutral-100 dark:text-neutral-400 dark:hover:bg-neutral-800",title:"Clear search",children:l.jsx(td,{className:"h-4 w-4"})})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("label",{htmlFor:"somdn-filter-product",className:"text-sm text-neutral-600 dark:text-neutral-400 whitespace-nowrap",children:"Product:"}),l.jsxs("select",{id:"somdn-filter-product",value:_,onChange:O,disabled:D,className:"rounded-md border border-neutral-300 bg-white px-2 py-1.5 text-sm text-neutral-900 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 dark:border-neutral-600 dark:bg-neutral-800 dark:text-white",children:[l.jsx("option",{value:"",children:"All products"}),S.map(E=>l.jsx("option",{value:E.id,children:E.name},E.id))]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("label",{htmlFor:"somdn-filter-user-type",className:"text-sm text-neutral-600 dark:text-neutral-400 whitespace-nowrap",children:"User:"}),l.jsxs("select",{id:"somdn-filter-user-type",value:v,onChange:F,className:"rounded-md border border-neutral-300 bg-white px-2 py-1.5 text-sm text-neutral-900 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 dark:border-neutral-600 dark:bg-neutral-800 dark:text-white",children:[l.jsx("option",{value:"",children:"All"}),l.jsx("option",{value:"guest",children:"Guest only"}),l.jsx("option",{value:"registered",children:"Registered only"})]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("label",{htmlFor:"somdn-per-page",className:"text-sm text-neutral-600 dark:text-neutral-400 whitespace-nowrap",children:"Rows:"}),l.jsxs("select",{id:"somdn-per-page",value:k,onChange:H,className:"rounded-md border border-neutral-300 bg-white px-2 py-1.5 text-sm text-neutral-900 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 dark:border-neutral-600 dark:bg-neutral-800 dark:text-white",children:[l.jsx("option",{value:10,children:"10"}),l.jsx("option",{value:25,children:"25"}),l.jsx("option",{value:50,children:"50"})]})]})]}),M&&l.jsxs("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:["Showing ",f.toLocaleString()," result",f!==1?"s":""," for the selected filters."]})]}),l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"min-w-full divide-y divide-neutral-200 dark:divide-neutral-700",children:[l.jsx("thead",{className:"bg-neutral-50 dark:bg-neutral-800",children:l.jsxs("tr",{children:[l.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-neutral-500 dark:text-neutral-400",children:"Product"}),l.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-neutral-500 dark:text-neutral-400",children:"File"}),l.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-neutral-500 dark:text-neutral-400",children:"User"}),l.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-neutral-500 dark:text-neutral-400",children:"Date"})]})}),l.jsx("tbody",{className:"divide-y divide-neutral-200 bg-white dark:divide-neutral-700 dark:bg-neutral-900",children:r?[...Array(5)].map((E,V)=>l.jsxs("tr",{children:[l.jsx("td",{className:"px-4 py-3",children:l.jsx("div",{className:"h-4 w-32 animate-pulse rounded bg-neutral-200 dark:bg-neutral-700"})}),l.jsx("td",{className:"px-4 py-3",children:l.jsx("div",{className:"h-4 w-24 animate-pulse rounded bg-neutral-200 dark:bg-neutral-700"})}),l.jsx("td",{className:"px-4 py-3",children:l.jsx("div",{className:"h-4 w-28 animate-pulse rounded bg-neutral-200 dark:bg-neutral-700"})}),l.jsx("td",{className:"px-4 py-3",children:l.jsx("div",{className:"h-4 w-20 animate-pulse rounded bg-neutral-200 dark:bg-neutral-700"})})]},V)):i.length===0?l.jsx("tr",{children:l.jsx("td",{colSpan:4,className:"px-4 py-8 text-center text-neutral-500 dark:text-neutral-400",children:M?"No downloads found for the current search or filters. Try a different email or product.":"No downloads found for the selected period."})}):i.map((E,V)=>l.jsxs("tr",{children:[l.jsx("td",{className:"px-4 py-3 text-sm text-neutral-900 dark:text-white",children:E.product_name}),l.jsx("td",{className:"px-4 py-3 text-sm text-neutral-500 dark:text-neutral-400",children:E.file_name}),l.jsx("td",{className:"px-4 py-3 text-sm text-neutral-500 dark:text-neutral-400",children:E.user_email||"Guest"}),l.jsx("td",{className:"px-4 py-3 text-sm text-neutral-500 dark:text-neutral-400",children:new Date(E.download_date).toLocaleDateString()})]},V))})]})}),u>1&&l.jsxs("div",{className:"flex items-center justify-between border-t border-neutral-200 px-4 py-3 dark:border-neutral-700",children:[l.jsx("button",{onClick:()=>c(E=>Math.max(1,E-1)),disabled:d===1,className:"rounded-md px-3 py-1.5 text-sm font-medium text-neutral-700 hover:bg-neutral-100 disabled:opacity-50 dark:text-neutral-300 dark:hover:bg-neutral-800",children:"Previous"}),l.jsxs("span",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:["Page ",d," of ",u]}),l.jsx("button",{onClick:()=>c(E=>Math.min(u,E+1)),disabled:d===u,className:"rounded-md px-3 py-1.5 text-sm font-medium text-neutral-700 hover:bg-neutral-100 disabled:opacity-50 dark:text-neutral-300 dark:hover:bg-neutral-800",children:"Next"})]})]})}const Il=[{id:"ID",label:"Download ID"},{id:"Date",label:"Date"},{id:"Product ID",label:"Product ID"},{id:"Product Name",label:"Product Name"},{id:"Files",label:"Files"},{id:"Variation ID",label:"Variation ID"},{id:"User ID",label:"User ID"},{id:"Username",label:"Username"},{id:"Email Address",label:"Email Address"},{id:"IP Address",label:"IP Address"},{id:"Country based on IP",label:"Country"},{id:"Subscribed",label:"Subscribed"},{id:"First Name",label:"First Name"},{id:"Last Name",label:"Last Name"},{id:"Telephone",label:"Telephone"},{id:"Company",label:"Company"},{id:"Website",label:"Website"}];function OC({dateRange:e}){const[t,n]=g.useState(null),[s,i]=g.useState("all-downloads"),[o,r]=g.useState([]),[a,d]=g.useState(Il.map(k=>k.id)),[c,u]=g.useState([]),[h,f]=g.useState(!1),m=g.useRef({exportType:s,selectedProducts:o,selectedColumns:a});g.useEffect(()=>{m.current={exportType:s,selectedProducts:o,selectedColumns:a}},[s,o,a]);const p=g.useCallback(async()=>{const{exportType:k,selectedProducts:C,selectedColumns:S}=m.current,T={export_type:k,export_products:C,export_columns:S},D=await fetch(`${Dl()}somdn/v1/stats/export-settings`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":El()},body:JSON.stringify(T)});if(!D.ok)throw new Error(`Failed to save export settings: ${D.status}`);return D.json()},[]);Ip("export-settings",p),g.useEffect(()=>{s==="specific-products"&&c.length===0&&x()},[s]),g.useEffect(()=>{b()},[]);const b=async()=>{try{const k=await At("stats/export-settings");k&&(k.export_type&&i(k.export_type),k.export_products&&k.export_products.length>0&&r(k.export_products),k.export_columns&&k.export_columns.length>0&&d(k.export_columns))}catch{}},x=async()=>{f(!0);try{const k=await At("stats/products-list");u(k||[])}catch{u([])}finally{f(!1)}},w=()=>{d(Il.map(k=>k.id))},_=()=>{d([])},y=k=>{d(C=>C.includes(k)?C.filter(S=>S!==k):[...C,k])},v=k=>{r(C=>C.includes(k)?C.filter(S=>S!==k):[...C,k])},j=async k=>{var W,$;if(a.length===0){alert("Please select at least one column to export.");return}n(k);const C=window.somdn_settings||{},S=C.export_url,T=C.export_nonce,D=!!(S&&T),P=new FormData;if(P.append("format",k),P.append("start_date",((W=e==null?void 0:e.start)==null?void 0:W.toISOString().split("T")[0])||""),P.append("end_date",(($=e==null?void 0:e.end)==null?void 0:$.toISOString().split("T")[0])||""),P.append("export_type",s),P.append("export_products",JSON.stringify(o)),P.append("export_columns",JSON.stringify(a)),D&&P.append("_wpnonce",T),!D){n(null),alert("Export is not available in this context. Please refresh the page and try again.");return}const L=S;try{const O=await fetch(L,{method:"POST",credentials:"same-origin",body:P});if(!O.ok){const z=await O.text();let A=`Export failed (${O.status})`;try{const U=JSON.parse(z);U.message&&(A=U.message)}catch{const U=z.match(/class="wp-die-message"[^>]*>([^<]+)</);U&&U[1]?A=U[1].trim():z&&z.length<300&&!/<\s*!?DOCTYPE/i.test(z)&&(A=z)}throw new Error(A)}const F=await O.blob(),H=O.headers.get("Content-Disposition");let M=`free-downloads-export.${k}`;if(H){const z=H.match(/filename="?([^";]+)"?/);z&&z[1]&&(M=z[1].trim())}const E=URL.createObjectURL(F),V=document.createElement("a");V.href=E,V.download=M,V.click(),URL.revokeObjectURL(E)}catch(O){alert(O.message||"Export failed. Please try again.")}finally{n(null)}};return l.jsxs("div",{className:"rounded-lg border border-neutral-200 bg-white dark:border-neutral-700 dark:bg-neutral-900",children:[l.jsxs("div",{className:"border-b border-neutral-200 px-4 py-3 dark:border-neutral-700",children:[l.jsx("h3",{className:"text-base font-semibold text-neutral-900 dark:text-white",children:"Export Data"}),l.jsx("p",{className:"mt-1 text-sm text-neutral-500 dark:text-neutral-400",children:"The settings below only apply to the data that will be exported. We will use the date range above."})]}),l.jsxs("div",{className:"space-y-6 p-4",children:[l.jsx(Ma,{label:"What do you want to export?",options:[{value:"all-downloads",label:"All Downloads"},{value:"all-products",label:"All Products"},{value:"specific-products",label:"Specific Products"}],value:s,onChange:i,type:"button",cols:3}),s==="specific-products"&&l.jsxs("div",{className:"rounded-lg border border-neutral-200 bg-neutral-50 p-4 dark:border-neutral-700 dark:bg-neutral-800/50",children:[l.jsx("h4",{className:"mb-3 text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Select Products"}),h?l.jsxs("div",{className:"flex items-center gap-2 text-sm text-neutral-500",children:[l.jsx(Kn,{className:"h-4 w-4 animate-spin"}),"Loading products..."]}):c.length===0?l.jsx("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:"No products found."}):l.jsx("div",{className:"max-h-48 overflow-y-auto space-y-2",children:c.map(k=>l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:o.includes(k.id),onChange:()=>v(k.id),className:"h-4 w-4 rounded text-indigo-600 focus:ring-indigo-500 border-neutral-300 dark:border-neutral-600"}),l.jsx("span",{className:"text-sm text-neutral-700 dark:text-neutral-300",children:k.name})]},k.id))})]}),l.jsxs("div",{children:[l.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[l.jsx("h4",{className:"text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Customize Export Columns"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{type:"button",onClick:w,className:"text-xs font-medium text-indigo-600 hover:text-indigo-700 dark:text-indigo-400 dark:hover:text-indigo-300",children:"Select All"}),l.jsx("span",{className:"text-neutral-300 dark:text-neutral-600",children:"|"}),l.jsx("button",{type:"button",onClick:_,className:"text-xs font-medium text-indigo-600 hover:text-indigo-700 dark:text-indigo-400 dark:hover:text-indigo-300",children:"Clear All"})]})]}),l.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6",children:Il.map(k=>l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:a.includes(k.id),onChange:()=>y(k.id),className:"h-4 w-4 rounded text-indigo-600 focus:ring-indigo-500 border-neutral-300 dark:border-neutral-600"}),l.jsx("span",{className:"text-xs text-neutral-700 dark:text-neutral-300",children:k.label})]},k.id))})]}),a.includes("Country based on IP")&&l.jsx("div",{className:"rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 dark:border-amber-800 dark:bg-amber-900/30",children:l.jsxs("p",{className:"text-sm text-amber-800 dark:text-amber-200",children:[l.jsx("strong",{children:"Note:"})," Including ",l.jsx("strong",{children:"Country"})," looks up the country for each IP address and can make the export take several minutes for large datasets. You can leave it unchecked for a faster export."]})}),l.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-4 border-t border-neutral-200 dark:border-neutral-700",children:[l.jsxs("button",{onClick:()=>j("xlsx"),disabled:t,className:"inline-flex items-center gap-2 rounded-md bg-indigo-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 disabled:opacity-50",children:[l.jsx(Gl,{className:"h-4 w-4"}),t==="xlsx"?"Generating...":"Export XLSX"]}),l.jsxs("button",{onClick:()=>j("csv"),disabled:t,className:"inline-flex items-center gap-2 rounded-md bg-white px-4 py-2 text-sm font-medium text-neutral-700 shadow-sm ring-1 ring-inset ring-neutral-300 hover:bg-neutral-50 disabled:opacity-50 dark:bg-neutral-800 dark:text-neutral-300 dark:ring-neutral-600 dark:hover:bg-neutral-700",children:[l.jsx(Kl,{className:"h-4 w-4"}),t==="csv"?"Generating...":"Export CSV"]})]}),l.jsxs("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:[l.jsx("strong",{children:"Note:"})," Only the first 15,000 records starting from the start date will be exported, due to memory limitations."]})]}),t&&l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50",children:[l.jsx("style",{children:`
            @keyframes somdn-export-progress {
              0% { transform: translateX(-100%); }
              100% { transform: translateX(400%); }
            }
          `}),l.jsx("div",{className:"relative w-full max-w-sm rounded-lg bg-white p-6 shadow-xl dark:bg-neutral-800",children:l.jsxs("div",{className:"flex flex-col items-center gap-4",children:[l.jsx(Xl,{className:"h-12 w-12 text-indigo-600 dark:text-indigo-400 animate-spin"}),l.jsxs("div",{className:"text-center space-y-1",children:[l.jsx("p",{className:"text-base font-medium text-neutral-900 dark:text-white",children:"Preparing your export…"}),l.jsxs("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:[t==="xlsx"?"Building Excel file":"Building CSV file",".",a.includes("Country based on IP")?" This may take several minutes while we look up countries for each IP.":""]})]}),l.jsx("div",{className:"w-full h-2 bg-neutral-200 dark:bg-neutral-700 rounded-full overflow-hidden",children:l.jsx("div",{className:"h-full bg-indigo-600 dark:bg-indigo-400 rounded-full",style:{width:"25%",animation:"somdn-export-progress 1.5s ease-in-out infinite"}})})]})})]})]})}function IC(){var F;const[e,t]=g.useState("older-than"),[n,s]=g.useState(90),[i,o]=g.useState([]),[r,a]=g.useState(""),[d,c]=g.useState(""),[u,h]=g.useState([]),[f,m]=g.useState(!1),[p,b]=g.useState(null),[x,w]=g.useState(!1),[_,y]=g.useState(!1),[v,j]=g.useState(!1),[k,C]=g.useState(null),[S,T]=g.useState(null);g.useEffect(()=>{e==="by-product"&&u.length===0&&D()},[e]);const D=async()=>{m(!0);try{const H=await At("stats/products-list");h(H||[])}catch{h([])}finally{m(!1)}},P=H=>{o(M=>M.includes(H)?M.filter(E=>E!==H):[...M,H])},L=async()=>{w(!0),b(null);try{const H={delete_type:e,days:n,product_ids:JSON.stringify(i),start_date:r,end_date:d},M=await At("stats/logs-count",H);b(M)}catch{b({count:0,message:"Failed to get count."})}finally{w(!1)}},W=()=>{if(!p||p.count===0){L();return}y(!0)},$=async()=>{y(!1),j(!0),C({deleted:0,remaining:(p==null?void 0:p.count)||0,complete:!1}),T(null);let H=0,M=!1,E=0;const V=500;for(;!M&&E<V;){E++;try{const z=await fetch(`${Dl()}somdn/v1/stats/delete-logs-batch`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":El()},body:JSON.stringify({delete_type:e,days:n,product_ids:i,start_date:r,end_date:d,batch_size:500})});if(!z.ok)throw new Error(`HTTP ${z.status}`);const A=await z.json();H+=A.deleted_this_batch||0,M=A.complete||A.remaining===0,C({deleted:H,remaining:A.remaining||0,complete:M}),M||await new Promise(U=>setTimeout(U,100))}catch(z){T({success:!1,message:`Deletion stopped after ${H} entries. Error: ${z.message}`}),j(!1);return}}j(!1),T({success:!0,message:`Successfully deleted ${H.toLocaleString()} download log entries.`}),b(null)},O=()=>{switch(e){case"older-than":return`logs older than ${n} days`;case"date-range":return`logs from ${r||"beginning"} to ${d||"now"}`;case"by-product":return`logs for ${i.length} selected product(s)`;case"all":return"ALL download logs";default:return"logs"}};return l.jsxs("div",{className:"rounded-lg border border-red-200 bg-white dark:border-red-900 dark:bg-neutral-900",children:[l.jsxs("div",{className:"border-b border-red-200 px-4 py-3 dark:border-red-900",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Zl,{className:"h-5 w-5 text-red-600 dark:text-red-400"}),l.jsx("h3",{className:"text-base font-semibold text-neutral-900 dark:text-white",children:"Manage Download Logs"})]}),l.jsx("p",{className:"mt-1 text-sm text-neutral-500 dark:text-neutral-400",children:"Delete old download log entries to reduce database size. This only removes tracking data, not the actual files."})]}),l.jsxs("div",{className:"space-y-6 p-4",children:[l.jsx(Ma,{label:"What do you want to delete?",options:[{value:"older-than",label:"Logs older than X days"},{value:"date-range",label:"Logs in date range"},{value:"by-product",label:"Logs for specific products"},{value:"all",label:"All logs"}],value:e,onChange:H=>{t(H),b(null)},type:"button",cols:4}),e==="older-than"&&l.jsxs("div",{className:"rounded-lg border border-neutral-200 bg-neutral-50 p-4 dark:border-neutral-700 dark:bg-neutral-800/50",children:[l.jsx("label",{className:"block text-sm font-medium text-neutral-700 dark:text-neutral-300 mb-2",children:"Delete logs older than:"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"number",min:"1",max:"3650",value:n,onChange:H=>{s(Math.max(1,Math.min(3650,parseInt(H.target.value)||1))),b(null)},className:"w-24 rounded-md border-neutral-300 shadow-sm focus:border-red-500 focus:ring-red-500 dark:border-neutral-600 dark:bg-neutral-700 dark:text-white sm:text-sm"}),l.jsx("span",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:"days"})]}),l.jsx("p",{className:"mt-2 text-xs text-neutral-500 dark:text-neutral-400",children:"Common values: 30 (1 month), 90 (3 months), 180 (6 months), 365 (1 year)"})]}),e==="date-range"&&l.jsx("div",{className:"rounded-lg border border-neutral-200 bg-neutral-50 p-4 dark:border-neutral-700 dark:bg-neutral-800/50",children:l.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-neutral-700 dark:text-neutral-300 mb-2",children:"From date:"}),l.jsx("input",{type:"date",value:r,onChange:H=>{a(H.target.value),b(null)},className:"w-full rounded-md border-neutral-300 shadow-sm focus:border-red-500 focus:ring-red-500 dark:border-neutral-600 dark:bg-neutral-700 dark:text-white sm:text-sm"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-neutral-700 dark:text-neutral-300 mb-2",children:"To date:"}),l.jsx("input",{type:"date",value:d,onChange:H=>{c(H.target.value),b(null)},className:"w-full rounded-md border-neutral-300 shadow-sm focus:border-red-500 focus:ring-red-500 dark:border-neutral-600 dark:bg-neutral-700 dark:text-white sm:text-sm"})]})]})}),e==="by-product"&&l.jsxs("div",{className:"rounded-lg border border-neutral-200 bg-neutral-50 p-4 dark:border-neutral-700 dark:bg-neutral-800/50",children:[l.jsx("h4",{className:"mb-3 text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Select Products"}),f?l.jsxs("div",{className:"flex items-center gap-2 text-sm text-neutral-500",children:[l.jsx(Kn,{className:"h-4 w-4 animate-spin"}),"Loading products..."]}):u.length===0?l.jsx("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:"No products found."}):l.jsx("div",{className:"max-h-48 overflow-y-auto space-y-2",children:u.map(H=>l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:i.includes(H.id),onChange:()=>{P(H.id),b(null)},className:"h-4 w-4 rounded text-red-600 focus:ring-red-500 border-neutral-300 dark:border-neutral-600"}),l.jsx("span",{className:"text-sm text-neutral-700 dark:text-neutral-300",children:H.name})]},H.id))})]}),e==="all"&&l.jsx("div",{className:"rounded-lg border border-red-300 bg-red-50 p-4 dark:border-red-800 dark:bg-red-900/30",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(Jl,{className:"h-5 w-5 text-red-600 dark:text-red-400 flex-shrink-0 mt-0.5"}),l.jsxs("div",{children:[l.jsx("h4",{className:"font-medium text-red-800 dark:text-red-200",children:"Warning: This will delete ALL download logs"}),l.jsx("p",{className:"mt-1 text-sm text-red-700 dark:text-red-300",children:"This action cannot be undone. All download tracking history will be permanently deleted. Your export data and statistics will be lost."})]})]})}),p&&l.jsx("div",{className:`rounded-lg p-4 ${p.count>0?"border border-amber-200 bg-amber-50 dark:border-amber-800 dark:bg-amber-900/30":"border border-green-200 bg-green-50 dark:border-green-800 dark:bg-green-900/30"}`,children:l.jsx("p",{className:`text-sm font-medium ${p.count>0?"text-amber-800 dark:text-amber-200":"text-green-800 dark:text-green-200"}`,children:p.message})}),k&&!k.complete&&l.jsx("div",{className:"rounded-lg border border-blue-200 bg-blue-50 p-4 dark:border-blue-800 dark:bg-blue-900/30",children:l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(Xl,{className:"h-5 w-5 text-blue-600 dark:text-blue-400 animate-spin"}),l.jsxs("div",{className:"flex-1",children:[l.jsx("p",{className:"text-sm font-medium text-blue-800 dark:text-blue-200",children:"Deleting logs..."}),l.jsxs("p",{className:"text-sm text-blue-700 dark:text-blue-300",children:["Deleted ",k.deleted.toLocaleString()," entries. ",k.remaining.toLocaleString()," remaining."]}),l.jsx("div",{className:"mt-2 w-full bg-blue-200 dark:bg-blue-800 rounded-full h-2",children:l.jsx("div",{className:"bg-blue-600 dark:bg-blue-400 h-2 rounded-full transition-all duration-300",style:{width:`${Math.max(5,k.deleted/(k.deleted+k.remaining)*100)}%`}})})]})]})}),S&&l.jsx("div",{className:`rounded-lg p-4 ${S.success?"border border-green-200 bg-green-50 dark:border-green-800 dark:bg-green-900/30":"border border-red-200 bg-red-50 dark:border-red-800 dark:bg-red-900/30"}`,children:l.jsx("p",{className:`text-sm font-medium ${S.success?"text-green-800 dark:text-green-200":"text-red-800 dark:text-red-200"}`,children:S.message})}),l.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-4 border-t border-neutral-200 dark:border-neutral-700",children:[l.jsx("button",{onClick:L,disabled:x||v,className:"inline-flex items-center gap-2 rounded-md bg-white px-4 py-2 text-sm font-medium text-neutral-700 shadow-sm ring-1 ring-inset ring-neutral-300 hover:bg-neutral-50 disabled:opacity-50 dark:bg-neutral-800 dark:text-neutral-300 dark:ring-neutral-600 dark:hover:bg-neutral-700",children:x?l.jsxs(l.Fragment,{children:[l.jsx(Kn,{className:"h-4 w-4 animate-spin"}),"Counting..."]}):l.jsxs(l.Fragment,{children:[l.jsx(Kn,{className:"h-4 w-4"}),"Preview Count"]})}),l.jsxs("button",{onClick:W,disabled:v||x||e==="by-product"&&i.length===0,className:"inline-flex items-center gap-2 rounded-md bg-red-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-red-700 disabled:opacity-50",children:[l.jsx(Zl,{className:"h-4 w-4"}),"Delete Logs"]})]}),l.jsxs("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:[l.jsx("strong",{children:"Note:"})," Deleting logs will remove entries from the database permanently. This cannot be undone. We recommend exporting your data before deleting."]})]}),_&&l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50",children:l.jsxs("div",{className:"relative w-full max-w-md rounded-lg bg-white p-6 shadow-xl dark:bg-neutral-800",children:[l.jsx("button",{onClick:()=>y(!1),className:"absolute right-4 top-4 text-neutral-400 hover:text-neutral-600 dark:hover:text-neutral-200",children:l.jsx(td,{className:"h-5 w-5"})}),l.jsxs("div",{className:"flex items-start gap-4",children:[l.jsx("div",{className:"flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/50",children:l.jsx(Jl,{className:"h-6 w-6 text-red-600 dark:text-red-400"})}),l.jsxs("div",{className:"flex-1",children:[l.jsx("h3",{className:"text-lg font-semibold text-neutral-900 dark:text-white",children:"Confirm Deletion"}),l.jsxs("p",{className:"mt-2 text-sm text-neutral-600 dark:text-neutral-300",children:["You are about to permanently delete ",l.jsx("strong",{children:((F=p==null?void 0:p.count)==null?void 0:F.toLocaleString())||0})," ",O(),"."]}),l.jsx("p",{className:"mt-2 text-sm text-neutral-500 dark:text-neutral-400",children:"This action cannot be undone. Are you sure you want to continue?"})]})]}),l.jsxs("div",{className:"mt-6 flex justify-end gap-3",children:[l.jsx("button",{onClick:()=>y(!1),className:"rounded-md px-4 py-2 text-sm font-medium text-neutral-700 hover:bg-neutral-100 dark:text-neutral-300 dark:hover:bg-neutral-700",children:"Cancel"}),l.jsx("button",{onClick:$,className:"rounded-md bg-red-600 px-4 py-2 text-sm font-medium text-white hover:bg-red-700",children:"Yes, Delete Logs"})]})]})})]})}function LC(){const e=[{label:"Total Downloads",value:"1,247",icon:l.jsx(br,{className:"h-5 w-5"}),color:"indigo"},{label:"Unique Products",value:"34",icon:l.jsx(xr,{className:"h-5 w-5"}),color:"emerald"},{label:"Unique Users",value:"892",icon:l.jsx(ed,{className:"h-5 w-5"}),color:"amber"},{label:"Today",value:"23",icon:l.jsx(Hi,{className:"h-5 w-5"}),color:"blue"}],t=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],n=[45,62,48,85,73,31,28],s=["Product A","Product B","Product C","Product D","Product E"],i=[156,98,76,54,32],o=["PDF","ZIP","MP3","DOCX","Other"],r=[45,25,15,10,5];return l.jsxs("section",{className:"space-y-8",children:[l.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(Mh,{level:2,children:"Download Reports"}),l.jsx(B,{title:"Download Reports & Analytics",description:"Track every download, view detailed charts, analyze trends, and export reports. See which products are most popular and monitor user download activity.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"})]}),l.jsx(ja,{className:"mt-1",children:"View download reports, trends, and export data."})]}),l.jsxs("div",{className:"flex items-center gap-3 opacity-50 pointer-events-none",children:[l.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-neutral-200 bg-white px-3 py-1.5 text-sm text-neutral-500 dark:border-neutral-700 dark:bg-neutral-800",children:[l.jsx(dg,{className:"h-4 w-4"}),l.jsx("span",{children:"Last 30 days"})]}),l.jsx("div",{className:"rounded-md p-2 text-neutral-400",children:l.jsx(Kn,{className:"h-5 w-5"})})]})]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center",children:l.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-neutral-900/80 px-4 py-2 text-sm font-medium text-white dark:bg-neutral-800",children:[l.jsx(Yn,{className:"h-4 w-4"}),l.jsx("span",{children:"Upgrade to Pro to view reports"})]})}),l.jsx("div",{className:"pointer-events-none opacity-40 blur-[2px]",children:l.jsx(Pl,{columns:4,children:e.map((a,d)=>l.jsx(ys,{title:a.label,value:a.value,icon:a.icon,iconColor:vs(a.color)},d))})})]}),l.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center rounded-lg",children:l.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-neutral-900/80 px-4 py-2 text-sm font-medium text-white dark:bg-neutral-800",children:[l.jsx(Yn,{className:"h-4 w-4"}),l.jsx("span",{children:"Pro Feature"})]})}),l.jsx("div",{className:"pointer-events-none opacity-40 blur-[2px]",children:l.jsx(zi,{labels:t,datasets:[{label:"Downloads",data:n,backgroundColor:vt[0]}],showLegend:!1})})]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center rounded-lg",children:l.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-neutral-900/80 px-4 py-2 text-sm font-medium text-white dark:bg-neutral-800",children:[l.jsx(Yn,{className:"h-4 w-4"}),l.jsx("span",{children:"Pro Feature"})]})}),l.jsx("div",{className:"pointer-events-none opacity-40 blur-[2px]",children:l.jsx(zi,{labels:s,datasets:[{label:"Downloads",data:i,backgroundColor:vt.slice(0,s.length)}],horizontal:!0,showLegend:!1})})]})]}),l.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-3",children:[l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center rounded-lg",children:l.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-neutral-900/80 px-4 py-2 text-sm font-medium text-white dark:bg-neutral-800",children:[l.jsx(Yn,{className:"h-4 w-4"}),l.jsx("span",{children:"Pro Feature"})]})}),l.jsx("div",{className:"pointer-events-none opacity-40 blur-[2px]",children:l.jsx(Tl,{labels:o,data:r,colors:vt.slice(0,o.length),showLegend:!1,cutout:60,centerText:{title:"Total",value:r.reduce((a,d)=>a+d,0).toLocaleString()}})})]}),l.jsxs("div",{className:"lg:col-span-2 relative",children:[l.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center rounded-lg",children:l.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-neutral-900/80 px-4 py-2 text-sm font-medium text-white dark:bg-neutral-800",children:[l.jsx(Yn,{className:"h-4 w-4"}),l.jsx("span",{children:"Pro Feature"})]})}),l.jsx("div",{className:"pointer-events-none opacity-40 blur-[2px]",children:l.jsxs("div",{className:"rounded-lg border border-neutral-200 bg-white dark:border-neutral-700 dark:bg-neutral-900",children:[l.jsx("div",{className:"border-b border-neutral-200 px-4 py-3 dark:border-neutral-700",children:l.jsx("h3",{className:"text-base font-semibold text-neutral-900 dark:text-white",children:"Recent Downloads"})}),l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"min-w-full divide-y divide-neutral-200 dark:divide-neutral-700",children:[l.jsx("thead",{className:"bg-neutral-50 dark:bg-neutral-800",children:l.jsxs("tr",{children:[l.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-neutral-500",children:"Product"}),l.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-neutral-500",children:"File"}),l.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-neutral-500",children:"User"}),l.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-neutral-500",children:"Date"})]})}),l.jsx("tbody",{className:"divide-y divide-neutral-200 bg-white dark:divide-neutral-700 dark:bg-neutral-900",children:[1,2,3,4,5].map(a=>l.jsxs("tr",{children:[l.jsx("td",{className:"px-4 py-3",children:l.jsx("div",{className:"h-4 w-32 bg-neutral-200 dark:bg-neutral-700 rounded"})}),l.jsx("td",{className:"px-4 py-3",children:l.jsx("div",{className:"h-4 w-24 bg-neutral-200 dark:bg-neutral-700 rounded"})}),l.jsx("td",{className:"px-4 py-3",children:l.jsx("div",{className:"h-4 w-28 bg-neutral-200 dark:bg-neutral-700 rounded"})}),l.jsx("td",{className:"px-4 py-3",children:l.jsx("div",{className:"h-4 w-20 bg-neutral-200 dark:bg-neutral-700 rounded"})})]},a))})]})})]})})]})]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center rounded-lg",children:l.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-neutral-900/80 px-4 py-2 text-sm font-medium text-white dark:bg-neutral-800",children:[l.jsx(Yn,{className:"h-4 w-4"}),l.jsx("span",{children:"Export data with Pro"})]})}),l.jsx("div",{className:"pointer-events-none opacity-40 blur-[2px]",children:l.jsxs("div",{className:"rounded-lg border border-neutral-200 bg-white dark:border-neutral-700 dark:bg-neutral-900",children:[l.jsxs("div",{className:"border-b border-neutral-200 px-4 py-3 dark:border-neutral-700",children:[l.jsx("h3",{className:"text-base font-semibold text-neutral-900 dark:text-white",children:"Export Data"}),l.jsx("p",{className:"mt-1 text-sm text-neutral-500",children:"Export download reports to Excel or CSV."})]}),l.jsxs("div",{className:"p-4 flex gap-3",children:[l.jsxs("div",{className:"rounded-md bg-indigo-600 px-4 py-2 text-sm font-medium text-white flex items-center gap-2",children:[l.jsx(Gl,{className:"h-4 w-4"}),"Export XLSX"]}),l.jsxs("div",{className:"rounded-md bg-white border border-neutral-300 px-4 py-2 text-sm font-medium text-neutral-700 flex items-center gap-2",children:[l.jsx(Kl,{className:"h-4 w-4"}),"Export CSV"]})]})]})})]}),l.jsx("div",{className:"rounded-lg border border-indigo-200 bg-indigo-50 p-6 dark:border-indigo-900 dark:bg-indigo-950/30",children:l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(Xt,{className:"h-6 w-6 text-indigo-600 dark:text-indigo-400 flex-shrink-0 mt-0.5"}),l.jsxs("div",{children:[l.jsx("h3",{className:"font-semibold text-indigo-800 dark:text-indigo-200",children:"Unlock Download Reports"}),l.jsx("p",{className:"mt-1 text-sm text-indigo-700 dark:text-indigo-300",children:"Upgrade to Pro to track downloads, view detailed charts, analyze trends, and export comprehensive reports."})]})]}),l.jsx("a",{href:"https://wpenhanced.com/products/free-downloads-woocommerce",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center rounded-md bg-indigo-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 whitespace-nowrap",children:"Upgrade to Pro"})]})})]})}const Np="somdn_reports_date_range",Sp="somdn_download_log_date_range";function AC(){try{const n=new URLSearchParams(window.location.search),s=n.get("start_date"),i=n.get("end_date");if(s&&i){const r=new Date(s+"T00:00:00"),a=new Date(i+"T23:59:59");if(!Number.isNaN(r.getTime())&&!Number.isNaN(a.getTime())&&r<=a)return{start:r,end:a}}const o=typeof sessionStorage<"u"?sessionStorage.getItem(Np):null;if(o){const{start:r,end:a}=JSON.parse(o);if(r&&a){const d=new Date(r),c=new Date(a);if(!Number.isNaN(d.getTime())&&!Number.isNaN(c.getTime())&&d<=c)return{start:d,end:c}}}}catch{}const e=new Date,t=new Date;return t.setDate(t.getDate()-30),{start:t,end:e}}function FC(e){if(!(!(e!=null&&e.start)||!(e!=null&&e.end)))try{const t=e.start.toISOString().split("T")[0],n=e.end.toISOString().split("T")[0];sessionStorage.setItem(Np,JSON.stringify({start:t,end:n}));const s=new URL(window.location.href);s.searchParams.set("start_date",t),s.searchParams.set("end_date",n),window.history.replaceState({},"",s.toString())}catch{}}function zC(){try{const n=typeof sessionStorage<"u"?sessionStorage.getItem(Sp):null;if(n){const{start:s,end:i}=JSON.parse(n);if(s&&i){const o=new Date(s),r=new Date(i);if(!Number.isNaN(o.getTime())&&!Number.isNaN(r.getTime())&&o<=r)return{start:o,end:r}}}}catch{}const e=new Date,t=new Date;return t.setFullYear(t.getFullYear()-1),{start:t,end:e}}function WC(e){if(!(!(e!=null&&e.start)||!(e!=null&&e.end)))try{const t=e.start.toISOString().split("T")[0],n=e.end.toISOString().split("T")[0];sessionStorage.setItem(Sp,JSON.stringify({start:t,end:n}))}catch{}}function Cp(){const e=SC(),[t,n]=g.useState("overview"),[s,i]=g.useState(AC),o=d=>{i(d),FC(d)},r=()=>{i(d=>({...d}))};if(!e)return l.jsx(LC,{});const a=[{name:"Overview",value:"overview",current:t==="overview"},{name:"Export Data",value:"export",current:t==="export"},{name:"Delete Logs",value:"delete",current:t==="delete"}];return l.jsxs("section",{className:"space-y-8",children:[l.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[l.jsxs("div",{children:[l.jsx(Mh,{level:2,children:"Download Reports"}),l.jsx(ja,{className:"mt-1",children:"View download reports, trends, and export data."})]}),(t==="overview"||t==="export")&&l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(kp,{startDate:s.start,endDate:s.end,onChange:o}),t==="overview"&&l.jsx("button",{onClick:r,className:"rounded-md p-2 text-neutral-500 hover:bg-neutral-100 hover:text-neutral-700 dark:text-neutral-400 dark:hover:bg-neutral-800 dark:hover:text-neutral-200",title:"Refresh data",children:l.jsx(Kn,{className:"h-5 w-5"})})]})]}),l.jsx(yu,{tabs:a,value:t,setValue:n}),l.jsxs("div",{className:"mt-6",children:[t==="overview"&&l.jsxs("div",{"data-tab":"overview",className:"space-y-8",children:[l.jsx(TC,{dateRange:s,onDateRangeChange:o}),l.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[l.jsx(PC,{dateRange:s}),l.jsx(EC,{dateRange:s})]}),l.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-3",children:[l.jsx(DC,{dateRange:s}),l.jsx("div",{className:"lg:col-span-2",children:l.jsx(jp,{dateRange:s})})]})]}),t==="export"&&l.jsx("div",{"data-tab":"export",className:"space-y-6",children:l.jsx(OC,{dateRange:s})}),t==="delete"&&l.jsx("div",{"data-tab":"delete",className:"space-y-6",children:l.jsx(IC,{})})]})]})}function Mp(){const[e,t]=g.useState(zC),n=s=>{t(s),WC(s)};return l.jsxs("section",{className:"w-full max-w-none",children:[l.jsx("div",{className:"mb-6",children:l.jsx("h2",{className:"text-lg font-semibold text-neutral-900 dark:text-white",children:"Download log"})}),l.jsx(jp,{dateRange:e,fromDownloadLog:!0,onDateRangeChange:n})]})}const BC={},Tp=[{fieldId:"download-log",label:"Download Log",help:"View full download history with search and filters.",sectionKey:"download-log",pluginSlug:pr,keywords:["download","log","history","reports","pro"]}],HC={},Pp=[{fieldId:"reports-overview",label:"Download Reports",help:"View download reports, charts, and export data.",sectionKey:"reports",pluginSlug:pr,keywords:["reports","analytics","charts","downloads","statistics","pro"]},{fieldId:"reports-export",label:"Export Reports",help:"Export download data to Excel or CSV.",sectionKey:"reports",pluginSlug:pr,keywords:["export","excel","csv","xlsx","download","reports","pro"]},{fieldId:"reports-delete-logs",label:"Delete Download Logs",help:"Delete old download log entries to reduce database size.",sectionKey:"reports",pluginSlug:pr,keywords:["delete","logs","cleanup","database","pro"]}],VC=Object.freeze(Object.defineProperty({__proto__:null,DownloadLogSettings:Mp,ReportsSettings:Cp,downloadLogDefaults:BC,downloadLogSettingsIndex:Tp,reportsDefaults:HC,reportsSettingsIndex:Pp},Symbol.toStringTag,{value:"Module"}));function ks(...e){return e.filter(Boolean).join(" ")}const Ep="free-downloads-woocommerce",Dp=()=>{var e;return typeof window>"u"?!1:((e=window.somdn_settings)==null?void 0:e.is_pro)===!0};function RC(){const{setValue:e}=Je();return(t={})=>{Object.entries(t).forEach(([n,s])=>e(n,s))}}const Op=g.createContext({registerSaveAction:()=>{},unregisterSaveAction:()=>{}});function Ip(e,t){const{registerSaveAction:n,unregisterSaveAction:s}=g.useContext(Op);g.useEffect(()=>{if(t)return n(e,t),()=>s(e)},[e,t,n,s])}function $C({resources:e,additionalSaveActions:t}){var a;const{values:n}=Je(),s=RC(),i=g.useMemo(()=>e.reduce((d,c)=>({...d,...c.defaults}),{}),[e]),o=async()=>{const d={};e.forEach(u=>{d[u.slug]={},Object.keys(u.defaults).forEach(h=>{h in n&&(d[u.slug][h]=n[h])})});const c=await Promise.all(e.map(u=>u.saveWithState(d[u.slug]||{})));if(t&&Object.keys(t).length>0)try{await Promise.all(Object.values(t).map(u=>u()))}catch{}return c.every(u=>u==="success")?"success":"error"},r=(a=e.find(d=>d.saveState))==null?void 0:a.saveState;return l.jsx(tg,{onSave:o,onReset:()=>s(i),saveState:r})}function UC({currentSection:e}){var Q;const[t,n]=g.useState(()=>Dp());g.useEffect(()=>{const R=()=>{const Oe=Dp();Oe!==t&&n(Oe)};R();const Y=()=>{setTimeout(R,100)};window.addEventListener("license-activated",Y);const ee=setInterval(R,2e3);return()=>{window.removeEventListener("license-activated",Y),clearInterval(ee)}},[t]);const s=Fe({slug:"free-downloads-gen",restNamespace:"wpe/v1",defaults:vu}),i=Fe({slug:"free-downloads-single",restNamespace:"wpe/v1",defaults:Nu}),o=Fe({slug:"free-downloads-multi",restNamespace:"wpe/v1",defaults:Mu}),r=Fe({slug:"free-downloads-owned",restNamespace:"wpe/v1",defaults:Eu}),a=Fe({slug:"free-downloads-docviewer",restNamespace:"wpe/v1",defaults:Iu}),d=Fe({slug:"free-downloads-debug",restNamespace:"wpe/v1",defaults:Zu}),c=Fe({slug:"free-downloads-quickview",restNamespace:"wpe/v1",defaults:Uu}),u=Fe({slug:"free-downloads-limits",restNamespace:"wpe/v1",defaults:oh,skip:!t}),h=Fe({slug:"free-downloads-membership-limits",restNamespace:"wpe/v1",defaults:rh,skip:!t}),f=Fe({slug:"free-downloads-tracking",restNamespace:"wpe/v1",defaults:dh,skip:!t}),m=Fe({slug:"free-downloads-newsletter",restNamespace:"wpe/v1",defaults:yh,skip:!t}),p=Fe({slug:"free-downloads-mailchimp",restNamespace:"wpe/v1",defaults:vh,skip:!t}),b=Fe({slug:"free-downloads-download-type",restNamespace:"wpe/v1",defaults:fh,skip:!t}),x=Fe({slug:"free-downloads-include-products",restNamespace:"wpe/v1",defaults:gh,skip:!t}),w=Fe({slug:"free-downloads-include-cats",restNamespace:"wpe/v1",defaults:bh,skip:!t}),_=Fe({slug:"free-downloads-include-tags",restNamespace:"wpe/v1",defaults:xh,skip:!t}),y=Fe({slug:"free-downloads-emails",restNamespace:"wpe/v1",defaults:Nh,skip:!t}),v=[s,i,o,r,a,d,c],j=t?[u,h,f,m,p,b,x,w,_,y]:[],k=[...v,...j],[C,S]=g.useState({}),T=g.useCallback((R,Y)=>{S(ee=>({...ee,[R]:Y}))},[]),D=g.useCallback(R=>{S(Y=>{const ee={...Y};return delete ee[R],ee})},[]),P=g.useMemo(()=>({registerSaveAction:T,unregisterSaveAction:D}),[T,D]),L=[{name:"General",key:"general",icon:wg},{name:"Single Files",key:"single-files",icon:mg},{name:"Multiple Files",key:"multiple-files",icon:gg},{name:"Owned Products",key:"owned-products",icon:xr},{name:"PDF Settings",key:"pdf-settings",icon:pg},{name:"Quick View",key:"quick-view",icon:fg},{name:"Debug",key:"debug",icon:lg}],W=typeof window<"u"&&((Q=window.somdn_settings)==null?void 0:Q.addon_sections)||[],$=W.map(R=>({name:R.name||R.key,key:R.key,icon:Ql})),O=[{name:"Reports",key:"stats",icon:Xt},{name:"Download log",key:"download-log",icon:ql},{name:"Download Limits",key:"download-limits",icon:br},{name:"Tracking",key:"tracking",icon:ql},{name:"Download Delivery",key:"download-delivery",icon:yg},{name:"Advanced Restrictions",key:"advanced-restrictions",icon:_g},{name:"Newsletter",key:"newsletter",icon:bg},{name:"Emails",key:"emails",icon:Ql},...$],[F,H]=g.useState(()=>{if(typeof window<"u"){const R=localStorage.getItem("somdn-sidebar-collapsed");return R?JSON.parse(R):!1}return!1}),M=g.useCallback(()=>{H(R=>{const Y=!R;return typeof window<"u"&&(localStorage.setItem("somdn-sidebar-collapsed",JSON.stringify(Y)),document.body.setAttribute("data-sidebar-collapsed",String(Y))),Y})},[]);g.useEffect(()=>{typeof window<"u"&&document.body.setAttribute("data-sidebar-collapsed",String(F))},[F]);const V=g.useMemo(()=>[...L,...O],[]).map(R=>R.key),z=V.includes(e||"general")&&e||"general",A=({className:R=""})=>l.jsx("div",{className:`animate-pulse rounded-md bg-gray-200/70 dark:bg-neutral-800/70 ${R}`});function U(){return l.jsxs("div",{className:"flex gap-6",children:[l.jsx("aside",{className:"w-72 shrink-0 border-r border-neutral-200 dark:border-neutral-700 pr-4",children:l.jsxs("nav",{className:"py-2",children:[l.jsxs("div",{className:"mb-4",children:[l.jsx(A,{className:"h-4 w-16 mb-2"}),l.jsx(A,{className:"h-8 mb-2"}),l.jsx(A,{className:"h-8 mb-2"}),l.jsx(A,{className:"h-8 mb-2"}),l.jsx(A,{className:"h-8 mb-2"}),l.jsx(A,{className:"h-8 mb-2"}),l.jsx(A,{className:"h-8 mb-2"}),l.jsx(A,{className:"h-8 w-2/3"})]}),l.jsxs("div",{className:"mt-6 pt-4 border-t border-neutral-200 dark:border-neutral-700",children:[l.jsx(A,{className:"h-4 w-12 mb-2"}),l.jsx(A,{className:"h-8 mb-2"}),l.jsx(A,{className:"h-8 mb-2"}),l.jsx(A,{className:"h-8 mb-2"}),l.jsx(A,{className:"h-8 mb-2"}),l.jsx(A,{className:"h-8 mb-2"}),l.jsx(A,{className:"h-8 w-2/3"})]})]})}),l.jsxs("main",{className:"flex-1 py-6",children:[l.jsx(A,{className:"h-7 w-72 mb-3"}),l.jsxs("div",{className:"space-y-3 mb-8",children:[l.jsx(A,{className:"h-3 w-5/6"}),l.jsx(A,{className:"h-3 w-4/6"}),l.jsx(A,{className:"h-3 w-3/5"})]}),l.jsxs("div",{className:"space-y-6 max-w-2xl",children:[l.jsxs("div",{children:[l.jsx(A,{className:"h-4 w-40 mb-2"}),l.jsx(A,{className:"h-10 w-full"})]}),l.jsxs("div",{children:[l.jsx(A,{className:"h-4 w-32 mb-2"}),l.jsx(A,{className:"h-7 w-16 rounded-full"})]}),l.jsxs("div",{children:[l.jsx(A,{className:"h-4 w-48 mb-2"}),l.jsx(A,{className:"h-10 w-full"})]})]}),l.jsx("div",{className:"mt-10 pt-10 border-t border-neutral-200 dark:border-neutral-700",children:l.jsxs("div",{className:"flex justify-end gap-3",children:[l.jsx(A,{className:"h-9 w-24"}),l.jsx(A,{className:"h-9 w-24"})]})})]})]})}if(v.some(R=>R.loading)||t&&j.some(R=>R.loading))return l.jsx(U,{});const ne=k.reduce((R,Y)=>({...R,...Y.initialValues}),{});return l.jsx(Jp,{initialValues:ne,children:l.jsx(Op.Provider,{value:P,children:l.jsxs("div",{className:"flex gap-6",children:[l.jsx("aside",{className:ks(F?"w-16":"w-72","shrink-0 border-r border-neutral-200 dark:border-neutral-700 transition-all duration-200",F?"px-0 -ml-4 sm:-ml-5 lg:-ml-6":"pr-4"),children:l.jsxs("nav",{className:"relative flex flex-col",children:[l.jsx("div",{className:ks("mb-4 flex",F?"justify-center":"justify-end"),children:l.jsx("button",{onClick:M,className:"rounded-md p-1.5 text-neutral-500 hover:bg-neutral-100 hover:text-neutral-700 dark:text-neutral-400 dark:hover:bg-white/5 dark:hover:text-neutral-200 transition-colors","aria-label":F?"Expand sidebar":"Collapse sidebar",title:F?"Expand sidebar":"Collapse sidebar",children:F?l.jsx(hg,{className:"size-4"}):l.jsx(ug,{className:"size-4"})})}),!F&&l.jsx("div",{className:"mb-2",children:l.jsx("span",{className:"px-3 text-xs font-semibold uppercase tracking-wider text-neutral-500 dark:text-neutral-400",children:"Free"})}),l.jsx("ul",{role:"list",className:"flex flex-col gap-y-1",children:L.map(R=>{const Y=`#${Ep}/${R.key}`,ee=z===R.key,Oe=R.icon;return l.jsxs("li",{className:ks(F&&"relative group"),children:[l.jsxs("a",{href:Y,className:ks(ee?"bg-neutral-50 dark:bg-white/5":"hover:bg-neutral-50 dark:hover:bg-white/5","block rounded-md py-2 text-sm font-medium text-neutral-800 dark:text-neutral-300 inline-flex items-center gap-2 transition-colors",F?"justify-center px-0 w-full":"pl-3 pr-2"),"aria-current":ee?"page":void 0,children:[Oe&&l.jsx(Oe,{className:"size-4 shrink-0","aria-hidden":"true"}),!F&&l.jsx("span",{children:R.name})]}),F&&l.jsxs("div",{className:"absolute left-full ml-2 top-1/2 -translate-y-1/2 px-2 py-1.5 bg-neutral-900 dark:bg-neutral-800 text-white text-xs font-medium rounded-md whitespace-nowrap opacity-0 pointer-events-none group-hover:opacity-100 transition-opacity duration-200 z-50 shadow-lg",children:[R.name,l.jsx("div",{className:"absolute right-full top-1/2 -translate-y-1/2 border-4 border-transparent border-r-neutral-900 dark:border-r-neutral-800"})]})]},R.key)})}),!F&&l.jsx("div",{className:"mt-6 pt-4 border-t border-neutral-200 dark:border-neutral-700 mb-2",children:l.jsx("span",{className:"px-3 text-xs font-semibold uppercase tracking-wider text-amber-600 dark:text-amber-500",children:"Pro"})}),F&&l.jsx("div",{className:"mt-4 pt-4 border-t border-neutral-200 dark:border-neutral-700 mb-2"}),!t&&!F&&l.jsx("div",{className:"mb-3 px-3",children:l.jsx("div",{className:"p-2.5 rounded-md bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 shadow-sm",children:l.jsxs("p",{className:"text-xs leading-relaxed text-amber-800 dark:text-amber-200",children:[l.jsx("strong",{className:"block mb-1.5 font-semibold",children:"License Required"}),l.jsx("span",{className:"block mb-1.5",children:"Pro features require an active license."}),l.jsx("a",{href:"/wp-admin/admin.php?page=wp-enhanced#license",className:"inline-block underline hover:no-underline font-semibold text-amber-900 dark:text-amber-100 hover:text-amber-700 dark:hover:text-amber-300",onClick:R=>{R.preventDefault(),window.location.href="/wp-admin/admin.php?page=wp-enhanced#license"},children:"Activate license →"})]})})}),l.jsx("ul",{role:"list",className:"flex flex-col gap-y-1",children:O.map(R=>{const Y=`#${Ep}/${R.key}`,ee=z===R.key,Oe=R.icon;return l.jsxs("li",{className:ks(F&&"relative group"),children:[l.jsxs("a",{href:Y,className:ks(ee?"bg-neutral-50 dark:bg-white/5":"hover:bg-neutral-50 dark:hover:bg-white/5","block rounded-md py-2 text-sm font-medium text-neutral-800 dark:text-neutral-300 inline-flex items-center gap-2 transition-colors",F?"justify-center px-0 w-full":"pl-3 pr-2"),"aria-current":ee?"page":void 0,children:[Oe&&l.jsx(Oe,{className:"size-4 shrink-0","aria-hidden":"true"}),!F&&l.jsx("span",{children:R.name})]}),F&&l.jsxs("div",{className:"absolute left-full ml-2 top-1/2 -translate-y-1/2 px-2 py-1.5 bg-neutral-900 dark:bg-neutral-800 text-white text-xs font-medium rounded-md whitespace-nowrap opacity-0 pointer-events-none group-hover:opacity-100 transition-opacity duration-200 z-50 shadow-lg",children:[R.name,l.jsx("div",{className:"absolute right-full top-1/2 -translate-y-1/2 border-4 border-transparent border-r-neutral-900 dark:border-r-neutral-800"})]})]},R.key)})})]})}),l.jsxs("main",{className:"flex-1",children:[!t&&(z==="stats"||z==="download-log"||z==="download-limits"||z==="tracking"||z==="download-delivery"||z==="advanced-restrictions"||z==="newsletter"||z==="emails")&&l.jsx("div",{className:"mb-6 p-5 rounded-lg bg-gradient-to-r from-amber-50 to-amber-100 dark:from-amber-900/30 dark:to-amber-900/20 border border-amber-200 dark:border-amber-800 shadow-md",children:l.jsx("div",{className:"flex items-start gap-4",children:l.jsxs("div",{className:"flex-1",children:[l.jsx("h3",{className:"text-base font-bold text-amber-900 dark:text-amber-100 mb-2",children:"⚠️ Pro License Required"}),l.jsxs("p",{className:"text-sm text-amber-800 dark:text-amber-200 mb-4 leading-relaxed",children:["These Pro features require an active license key. Activate your license in ",l.jsx("strong",{children:"License Management"})," to unlock all Pro functionality including Reports, Download Limits, Tracking, and more."]}),l.jsx("a",{href:"/wp-admin/admin.php?page=wp-enhanced#license",className:"inline-flex items-center gap-2 px-5 py-2.5 text-sm font-semibold text-white bg-amber-600 hover:bg-amber-700 dark:bg-amber-700 dark:hover:bg-amber-600 rounded-md transition-colors shadow-sm",onClick:R=>{R.preventDefault(),window.location.href="/wp-admin/admin.php?page=wp-enhanced#license"},children:"Go to License Management →"})]})})}),z==="general"&&l.jsx(ku,{}),z==="single-files"&&l.jsx(Su,{}),z==="multiple-files"&&l.jsx(Tu,{}),z==="owned-products"&&l.jsx(Du,{}),z==="pdf-settings"&&l.jsx(Lu,{}),z==="quick-view"&&l.jsx(qu,{}),z==="debug"&&l.jsx(Ju,{}),z==="stats"&&l.jsx(Cp,{}),z==="download-log"&&l.jsx(Mp,{}),z==="download-limits"&&l.jsx(ah,{}),z==="tracking"&&l.jsx(ch,{}),z==="download-delivery"&&l.jsx(mh,{}),z==="advanced-restrictions"&&l.jsx(wh,{}),z==="newsletter"&&l.jsx(kh,{}),z==="emails"&&l.jsx(Sh,{}),W.some(R=>R.key===z)&&l.jsx("div",{id:`somdn-addon-root-${z}`,className:"somdn-addon-section","data-addon-key":z}),!V.includes(z)&&l.jsx(qC,{section:z}),l.jsx($C,{resources:k,additionalSaveActions:C})]})]})})})}function qC({section:e}){return l.jsxs("section",{className:"space-y-6",children:[l.jsx("h2",{className:"text-lg font-semibold dark:text-white",children:"Unknown Section"}),l.jsxs("p",{className:"text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:['The section "',e,'" does not exist.']})]})}const YC=[...ju,...Cu,...Pu,...Ou,...Au,...Yu,...eh,...Pp,...Tp,...lh,...uh,...ph,..._h,...jh,...Ch],KC=Object.freeze(Object.defineProperty({__proto__:null,default:UC,settingsIndex:YC,useRegisterSaveAction:Ip},Symbol.toStringTag,{value:"Module"})),bn={slug:"free-downloads-woocommerce",label:"Free Downloads WooCommerce",color:"#4f46e5",order:1},GC=Object.assign({"./pages/free-downloads-woocommerce.jsx":KC,"./pages/sections/debug-settings.jsx":vy,"./pages/sections/general-settings.jsx":z_,"./pages/sections/multiple-files-settings.jsx":B_,"./pages/sections/owned-products-settings.jsx":H_,"./pages/sections/pdf-settings.jsx":V_,"./pages/sections/pro/advanced-restrictions-settings.jsx":Oy,"./pages/sections/pro/download-delivery-settings.jsx":Ey,"./pages/sections/pro/download-limits-settings.jsx":Sy,"./pages/sections/pro/emails-settings.jsx":Fy,"./pages/sections/pro/newsletter-settings.jsx":Ly,"./pages/sections/pro/stats-settings.jsx":VC,"./pages/sections/pro/tracking-settings.jsx":My,"./pages/sections/quick-view-settings.jsx":sy,"./pages/sections/single-files-settings.jsx":W_});function XC(e){const t=e.split("/"),n=t.pop(),s=t.pop();return/^index\.(jsx|tsx)$/i.test(n)?s:n.replace(/\.(jsx|tsx)$/i,"")}const Ll={},Al=[];for(const[e,t]of Object.entries(GC)){const n=XC(e);t.default&&(Ll[n]=t.default),Array.isArray(t.settingsIndex)?Al.push(...t.settingsIndex):Array.isArray(t.SETTINGS_INDEX)&&Al.push(...t.SETTINGS_INDEX)}function Lp(){var n,s,i;if(!bn||!bn.slug)return;const e={slug:bn.slug,label:bn.label||bn.slug,color:bn.color,order:bn.order,pages:Ll,settingsIndex:Al};(typeof window<"u"&&((n=window.diviEngineSettingsObject)==null?void 0:n.organization)||"divi-engine")==="wp-enhanced"?typeof window<"u"&&((s=window.WPESettingsFramework)!=null&&s.registerPlugin)?window.WPESettingsFramework.registerPlugin(e):(window.__WPE_PENDING_PLUGINS__=window.__WPE_PENDING_PLUGINS__||[],window.__WPE_PENDING_PLUGINS__.push(e)):typeof window<"u"&&((i=window.DESettingsFramework)!=null&&i.registerPlugin)?window.DESettingsFramework.registerPlugin(e):(window.__DE_PENDING_PLUGINS__=window.__DE_PENDING_PLUGINS__||[],window.__DE_PENDING_PLUGINS__.push(e))}return typeof window<"u"&&Lp(),pt.pages=Ll,pt.pluginConfig=bn,pt.registerPlugin=Lp,Object.defineProperty(pt,Symbol.toStringTag,{value:"Module"}),pt}({},React,ReactDOM);
