create-opentray 0.19.1 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +136 -133
  2. package/assets/create-opentray-logo.png +0 -0
  3. package/dist/bin-Dl6P1QjJ.mjs +2213 -0
  4. package/dist/bin-Dl6P1QjJ.mjs.map +1 -0
  5. package/dist/bin.d.mts +15 -2
  6. package/dist/bin.d.mts.map +1 -0
  7. package/dist/bin.mjs +1 -1
  8. package/dist/index.d.mts +71 -351
  9. package/dist/index.d.mts.map +1 -1
  10. package/dist/index.mjs +2 -1
  11. package/dist/shell/assets/browse.js +1 -1
  12. package/dist/shell/assets/index.css +1 -1
  13. package/dist/shell/assets/index.js +7 -7
  14. package/dist/shell/assets/input.js +1 -1
  15. package/dist/shell/assets/main.js +24 -43
  16. package/dist/shell/assets/terminal-pane.js +1 -1
  17. package/dist/shell/browse.html +3 -0
  18. package/dist/shell/favicon-16.png +0 -0
  19. package/dist/shell/favicon-32.png +0 -0
  20. package/dist/shell/favicon-64.png +0 -0
  21. package/dist/shell/index.html +3 -0
  22. package/dist/shell/logo.png +0 -0
  23. package/dist/shell/terminal.html +3 -0
  24. package/dist/skill/SKILL.md +156 -0
  25. package/dist/skill/references/cli-reference.md +77 -0
  26. package/dist/skill/references/how-it-works.md +49 -0
  27. package/dist/webui/assets/browse.js +1 -1
  28. package/dist/webui/assets/index.css +1 -1
  29. package/dist/webui/assets/index.js +7 -7
  30. package/dist/webui/assets/input.js +1 -1
  31. package/dist/webui/assets/main.js +24 -43
  32. package/dist/webui/assets/terminal-pane.js +1 -1
  33. package/dist/webui/browse.html +3 -0
  34. package/dist/webui/favicon-16.png +0 -0
  35. package/dist/webui/favicon-32.png +0 -0
  36. package/dist/webui/favicon-64.png +0 -0
  37. package/dist/webui/index.html +3 -0
  38. package/dist/webui/logo.png +0 -0
  39. package/dist/webui/terminal.html +3 -0
  40. package/package.json +12 -6
  41. package/skill/SKILL.md +156 -0
  42. package/skill/references/cli-reference.md +77 -0
  43. package/skill/references/how-it-works.md +49 -0
  44. package/dist/bin-B9VeXatR.mjs +0 -3830
  45. package/dist/bin-B9VeXatR.mjs.map +0 -1
  46. package/dist/bin-CeFW1wxR.d.mts +0 -15
  47. package/dist/bin-CeFW1wxR.d.mts.map +0 -1
  48. package/dist/icon-codec-BQ3cGV1n.mjs +0 -13
  49. package/dist/icon-codec-BQ3cGV1n.mjs.map +0 -1
@@ -1,43 +1,24 @@
1
- var so=e=>{throw TypeError(e)};var io=(e,t,n)=>t.has(e)||so("Cannot "+n);var ce=(e,t,n)=>(io(e,t,"read from private field"),n?n.call(e):t.get(e)),ao=(e,t,n)=>t.has(e)?so("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),In=(e,t,n,r)=>(io(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);import{c as _e,b as ua,r as c,j as i,d as Q,e as At,R as da,a as fa}from"./index.js";import{c as tt,I as et,u as ne,B as de,G as co,A as pa,a as ma,R as ha}from"./input.js";import{T as nn,B as ar,p as va,c as ga}from"./terminal-pane.js";const xa=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ba=_e("check",xa);const ya=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],$o=_e("chevron-down",ya);const wa=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Ca=_e("circle-check",wa);const Sa=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Ra=_e("external-link",Sa);const Ea=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Pa=_e("play",Ea);const ja=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],Na=_e("settings-2",ja);const Ia=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Aa=_e("square",Ia);const Ta=[["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"}]],Oa=_e("triangle-alert",Ta);const _a=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Fo=_e("upload",_a);const Da=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Lo=_e("x",Da);var Tt=ua(),ka=Object.defineProperty,Ma=(e,t)=>ka(e,"name",{value:t,configurable:!0}),$a=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],H=$a.reduce((e,t)=>{const n=tt(`Primitive.${t}`),r=c.forwardRef((o,s)=>{const{asChild:a,...l}=o,u=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(u,{...l,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Bo(e,t){e&&Tt.flushSync(()=>e.dispatchEvent(t))}Ma(Bo,"dispatchDiscreteCustomEvent");var Fa=Object.defineProperty,La=(e,t)=>Fa(e,"name",{value:t,configurable:!0}),Ba=c.forwardRef(La(function(t,n){return i.jsx(H.label,{...t,ref:n,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(t.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}})},"Label")),zo=Ba;const fe=c.forwardRef(({className:e,...t},n)=>i.jsx(zo,{ref:n,className:Q("text-xs font-medium text-muted-foreground leading-none",e),...t}));fe.displayName=zo.displayName;const Vo=e=>`/api/icon-composed/${e}?token=${encodeURIComponent(new URLSearchParams(location.search).get("token")??"")}`,za={cwd:"",env:[],argsMode:"string"},cr=new URLSearchParams(location.search).get("token")??"",J=(e,t={})=>fetch(e,{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${cr}`},body:JSON.stringify(t)}),Va=()=>new EventSource(`/api/events?token=${encodeURIComponent(cr)}`),pt=(e,t)=>`/api/icon-data/${e}/${t}?token=${encodeURIComponent(cr)}`,Ha=e=>{try{return new URL(e).hostname}catch{return e}};function Ua({values:e,defaults:t,frozen:n,iconCandidates:r,iconCandidatesPort:o,uploadedIconUrl:s,selectedIconRef:a,iconAnalysis:l,iconComposition:u,iconComposeError:f,iconBackground:p,iconScale:d,onIconBackgroundChange:h,onIconScaleChange:x,onPickIconCandidate:g,onUploadIcon:v,onClearIcon:m,onPatch:C}){const b=n,y=c.useRef(null),[w,R]=c.useState(!1);return i.jsxs("div",{className:"grid grid-cols-1 gap-y-1",children:[i.jsxs("div",{children:[i.jsx(fe,{children:"应用图标"}),i.jsxs("div",{className:"mt-1.5 flex flex-wrap items-start gap-3",children:[i.jsx("button",{type:"button",disabled:b,"aria-label":"选择本地图片作为应用图标",onClick:()=>y.current?.click(),onDragOver:S=>{S.preventDefault(),b||R(!0)},onDragLeave:()=>R(!1),onDrop:S=>{if(S.preventDefault(),R(!1),b)return;const P=S.dataTransfer.files[0];P!==void 0&&v(P)},className:Q("flex size-20 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-dashed border-border bg-popover transition-colors",b?"opacity-50":"hover:border-primary",w&&"border-primary bg-primary/10"),children:s!==void 0?i.jsx("img",{src:s,alt:"已选图标",className:"icon-checker size-full rounded object-contain"}):i.jsxs("span",{className:"flex flex-col items-center gap-1 text-muted-foreground",children:[i.jsx(Fo,{className:"size-4"}),i.jsx("span",{className:"text-[10px] leading-tight",children:"点击或拖入图片"})]})}),i.jsx("input",{ref:y,type:"file",accept:"image/png,image/jpeg,image/svg+xml,image/webp,image/gif",className:"hidden",disabled:b,onChange:S=>{const P=S.target.files?.[0];P!==void 0&&v(P),S.target.value=""}}),i.jsx("div",{className:"flex flex-1 flex-wrap items-center gap-2",children:r.length===0?i.jsx("span",{className:"text-xs text-muted-foreground",children:"未抓取到候选图标;将使用首字母图标"}):r.map(S=>{const P=o===void 0?void 0:pt(o,S.index),I=a===`${o}:${S.index}`,N=a===void 0&&S.index===0;return i.jsx("button",{type:"button",disabled:b,title:`${S.width}×${S.height} ${S.format.toUpperCase()}`,onClick:()=>g(S),className:Q("icon-checker flex size-14 items-center justify-center overflow-hidden rounded-lg border p-1 transition-all",I||N?"border-primary ring-2 ring-primary/60":"border-border hover:border-primary/60",b&&"opacity-50"),children:P!==void 0?i.jsx("img",{src:P,alt:`候选图标 ${S.width}×${S.height}`,className:"size-full object-contain"}):null},S.index)})}),a!==void 0||s!==void 0?i.jsx("button",{type:"button",disabled:b,onClick:m,className:"text-[11px] text-muted-foreground underline-offset-2 hover:underline",children:"清除选择(回到默认)"}):null]}),i.jsx("div",{className:"mt-3 rounded-lg border border-border p-3",children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx("div",{role:"img",className:"icon-checker size-14 shrink-0 overflow-hidden rounded-[10px]","aria-label":"图标合成预览",children:u!==void 0?i.jsx("img",{src:Vo(u.key),alt:"图标合成预览",className:"size-full object-contain",onError:S=>{S.currentTarget.style.display="none"}}):i.jsx("span",{className:"flex size-full items-center justify-center text-[10px] text-muted-foreground",children:"预览"})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx(fe,{children:"图标背景"}),i.jsx("div",{className:"mt-1.5 flex gap-1.5",children:["black","white","transparent"].map(S=>i.jsxs("button",{type:"button",disabled:b,"aria-pressed":p===S,onClick:()=>h(S),className:Q("flex h-7 items-center gap-1.5 rounded-md border px-2.5 text-[11px] transition-colors",p===S?"border-foreground bg-secondary text-secondary-foreground":"border-border text-muted-foreground hover:border-foreground/40"),children:[S==="black"?"黑色":S==="white"?"白色":"透明",l!==void 0&&l.suggested===S?i.jsx("span",{className:"text-[10px] text-muted-foreground/70",children:"自动"}):null]},S))}),i.jsxs("div",{className:"mt-2.5",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(fe,{className:"text-[11px]",children:"前景缩放"}),i.jsxs("span",{className:"text-[11px] tabular-nums text-muted-foreground",children:[Math.round(d*100),"%"]})]}),i.jsx("input",{type:"range",min:50,max:95,step:5,value:Math.round(d*100),disabled:b,onChange:S=>x(Number(S.target.value)/100),className:"mt-1 w-full accent-foreground","aria-label":"前景图标缩放"})]}),f!==void 0?i.jsx("p",{role:"alert",className:"mt-1.5 text-[11px] font-medium text-red-400",children:f}):null,l!==void 0?i.jsx("p",{className:"mt-1.5 text-[11px] leading-relaxed text-muted-foreground",children:p==="transparent"?"透明背景:原始像素直接透出。":`已按明暗自动选择${l.suggested===p?"":"(已手动覆盖)"}:${l.luminance===void 0?"无法分析明暗":`前景明度 ${l.luminance.toFixed(2)}、覆盖率 ${(l.coverage*100).toFixed(0)}%`}。`}):null]})]})})]}),i.jsxs("div",{children:[i.jsx(fe,{htmlFor:"appId",children:"App ID"}),i.jsx(et,{id:"appId",className:"mt-1 font-mono",disabled:b,value:e.appId,placeholder:t.appId||"由命令推导(如 start.somecommand.npx)",onChange:S=>C({appId:S.target.value})})]}),i.jsxs("div",{children:[i.jsx(fe,{htmlFor:"appName",children:"应用名称"}),i.jsx(et,{id:"appName",className:"mt-1",disabled:b,value:e.appName,placeholder:t.appName||"从服务页面标题抓取",onChange:S=>C({appName:S.target.value})})]})]})}function Wa({candidates:e,port:t,disabled:n,selectedRef:r,uploadedUrl:o,includeVariants:s,defaultLabel:a,onPick:l,onUpload:u,onClear:f}){const p=c.useRef(null),[d,h]=c.useState(!1),x=s?e:e.filter(v=>v.variant==="original"),g=e.filter(v=>v.variant==="original");return i.jsxs("div",{className:"flex flex-wrap items-start gap-3",children:[i.jsx("button",{type:"button",disabled:n,"aria-label":"选择本地图片",onClick:()=>p.current?.click(),onDragOver:v=>{v.preventDefault(),n||h(!0)},onDragLeave:()=>h(!1),onDrop:v=>{if(v.preventDefault(),h(!1),n)return;const m=v.dataTransfer.files[0];m!==void 0&&u(m)},className:Q("flex size-16 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-dashed border-border bg-popover transition-colors",n?"opacity-50":"hover:border-primary",d&&"border-primary bg-primary/10"),children:o!==void 0?i.jsx("img",{src:o,alt:"已选图标",className:"icon-checker size-full rounded object-contain"}):i.jsxs("span",{className:"flex flex-col items-center gap-1 text-muted-foreground",children:[i.jsx(Fo,{className:"size-4"}),i.jsx("span",{className:"text-[10px] leading-tight",children:"上传"})]})}),i.jsx("input",{ref:p,type:"file",accept:"image/png,image/jpeg,image/svg+xml,image/webp,image/gif",className:"hidden",disabled:n,onChange:v=>{const m=v.target.files?.[0];m!==void 0&&u(m),v.target.value=""}}),i.jsxs("div",{className:"flex flex-1 flex-wrap items-center gap-2",children:[x.length===0?i.jsx("span",{className:"text-xs text-muted-foreground",children:"暂无候选图标"}):x.map(v=>{const m=t===void 0?void 0:pt(t,v.index),C=r===`${t}:${v.index}`,b=r===void 0&&v.variant==="original"&&v.index===(g[0]?.index??-1);return i.jsx("button",{type:"button",disabled:n,title:v.variant==="original"?`${v.width}×${v.height} ${v.format.toUpperCase()}`:`${v.variant==="solid-black"?"黑色":"白色"}纯色 ${v.format.toUpperCase()}`,onClick:()=>l(v),className:Q("icon-checker flex size-12 items-center justify-center overflow-hidden rounded-lg border p-1 transition-all",C||b?"border-primary ring-2 ring-primary/60":"border-border hover:border-primary/60",n&&"opacity-50"),children:m!==void 0?i.jsx("img",{src:m,alt:`候选 ${v.variant}`,className:"size-full object-contain"}):null},`${v.variant}:${v.index}`)}),a!==void 0&&r===void 0&&x.length>0?i.jsx("span",{className:"text-[11px] text-muted-foreground",children:a}):null]}),r!==void 0||o!==void 0?i.jsx("button",{type:"button",disabled:n,onClick:f,className:"text-[11px] text-muted-foreground underline-offset-2 hover:underline",children:"清除"}):null]})}var Ka=Object.defineProperty,Ce=(e,t)=>Ka(e,"name",{value:t,configurable:!0});function Ga(e,t){const n=c.createContext(t);n.displayName=e+"Context";const r=Ce(s=>{const{children:a,...l}=s,u=c.useMemo(()=>l,Object.values(l));return i.jsx(n.Provider,{value:u,children:a})},"Provider");r.displayName=e+"Provider";function o(s,a={}){const{optional:l=!1}=a,u=c.useContext(n);if(u)return u;if(t!==void 0)return t;if(!l)throw new Error(`\`${s}\` must be used within \`${e}\``)}return Ce(o,"useContext"),[r,o]}Ce(Ga,"createContext");function Pe(e,t=[]){let n=[];function r(s,a){const l=c.createContext(a);l.displayName=s+"Context";const u=n.length;n=[...n,a];const f=Ce(d=>{const{scope:h,children:x,...g}=d,v=h?.[e]?.[u]||l,m=c.useMemo(()=>g,Object.values(g));return i.jsx(v.Provider,{value:m,children:x})},"Provider");f.displayName=s+"Provider";function p(d,h,x={}){const{optional:g=!1}=x,v=h?.[e]?.[u]||l,m=c.useContext(v);if(m)return m;if(a!==void 0)return a;if(!g)throw new Error(`\`${d}\` must be used within \`${s}\``)}return Ce(p,"useContext"),[f,p]}Ce(r,"createContext");const o=Ce(()=>{const s=n.map(a=>c.createContext(a));return Ce(function(l){const u=l?.[e]||s;return c.useMemo(()=>({[`__scope${e}`]:{...l,[e]:u}}),[l,u])},"useScope")},"createScope");return o.scopeName=e,[r,Ho(o,...t)]}Ce(Pe,"createContextScope");function Ho(...e){const t=e[0];if(e.length===1)return t;const n=Ce(()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return Ce(function(s){const a=r.reduce((l,{useScope:u,scopeName:f})=>{const d=u(s)[`__scope${f}`];return{...l,...d}},{});return c.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}Ce(Ho,"composeContextScopes");var Ya=Object.defineProperty,ie=(e,t)=>Ya(e,"name",{value:t,configurable:!0});function cn(e){const t=e+"CollectionProvider",[n,r]=Pe(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=ie(v=>{const{scope:m,children:C}=v,b=c.useRef(null),y=c.useRef(new Map).current;return i.jsx(o,{scope:m,itemMap:y,collectionRef:b,children:C})},"CollectionProvider");a.displayName=t;const l=e+"CollectionSlot",u=tt(l),f=c.forwardRef((v,m)=>{const{scope:C,children:b}=v,y=s(l,C),w=ne(m,y.collectionRef);return i.jsx(u,{ref:w,children:b})});f.displayName=l;const p=e+"CollectionItemSlot",d="data-radix-collection-item",h=tt(p),x=c.forwardRef((v,m)=>{const{scope:C,children:b,...y}=v,w=c.useRef(null),R=ne(m,w),S=s(p,C);return c.useEffect(()=>(S.itemMap.set(w,{ref:w,...y}),()=>{S.itemMap.delete(w)})),i.jsx(h,{[d]:"",ref:R,children:b})});x.displayName=p;function g(v){const m=s(e+"CollectionConsumer",v);return c.useCallback(()=>{const b=m.collectionRef.current;if(!b)return[];const y=Array.from(b.querySelectorAll(`[${d}]`));return Array.from(m.itemMap.values()).sort((S,P)=>y.indexOf(S.ref.current)-y.indexOf(P.ref.current))},[m.collectionRef,m.itemMap])}return ie(g,"useCollection"),[{Provider:a,Slot:f,ItemSlot:x},g,r]}ie(cn,"createCollection");var lo=new WeakMap,re,be,An=(be=class extends Map{constructor(n){super(n);ao(this,re);In(this,re,[...super.keys()]),lo.set(this,!0)}set(n,r){return lo.get(this)&&(this.has(n)?ce(this,re)[ce(this,re).indexOf(n)]=n:ce(this,re).push(n)),super.set(n,r),this}insert(n,r,o){const s=this.has(r),a=ce(this,re).length,l=lr(n);let u=l>=0?l:a+l;const f=u<0||u>=a?-1:u;if(f===this.size||s&&f===this.size-1||f===-1)return this.set(r,o),this;const p=this.size+(s?0:1);l<0&&u++;const d=[...ce(this,re)];let h,x=!1;for(let g=u;g<p;g++)if(u===g){let v=d[g];d[g]===r&&(v=d[g+1]),s&&this.delete(r),h=this.get(v),this.set(r,o)}else{!x&&d[g-1]===r&&(x=!0);const v=d[x?g:g-1],m=h;h=this.get(v),this.delete(v),this.set(v,m)}return this}with(n,r,o){const s=new be(this);return s.insert(n,r,o),s}before(n){const r=ce(this,re).indexOf(n)-1;if(!(r<0))return this.entryAt(r)}setBefore(n,r,o){const s=ce(this,re).indexOf(n);return s===-1?this:this.insert(s,r,o)}after(n){let r=ce(this,re).indexOf(n);if(r=r===-1||r===this.size-1?-1:r+1,r!==-1)return this.entryAt(r)}setAfter(n,r,o){const s=ce(this,re).indexOf(n);return s===-1?this:this.insert(s+1,r,o)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return In(this,re,[]),super.clear()}delete(n){const r=super.delete(n);return r&&ce(this,re).splice(ce(this,re).indexOf(n),1),r}deleteAt(n){const r=this.keyAt(n);return r!==void 0?this.delete(r):!1}at(n){const r=Xt(ce(this,re),n);if(r!==void 0)return this.get(r)}entryAt(n){const r=Xt(ce(this,re),n);if(r!==void 0)return[r,this.get(r)]}indexOf(n){return ce(this,re).indexOf(n)}keyAt(n){return Xt(ce(this,re),n)}from(n,r){const o=this.indexOf(n);if(o===-1)return;let s=o+r;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.at(s)}keyFrom(n,r){const o=this.indexOf(n);if(o===-1)return;let s=o+r;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.keyAt(s)}find(n,r){let o=0;for(const s of this){if(Reflect.apply(n,r,[s,o,this]))return s;o++}}findIndex(n,r){let o=0;for(const s of this){if(Reflect.apply(n,r,[s,o,this]))return o;o++}return-1}filter(n,r){const o=[];let s=0;for(const a of this)Reflect.apply(n,r,[a,s,this])&&o.push(a),s++;return new be(o)}map(n,r){const o=[];let s=0;for(const a of this)o.push([a[0],Reflect.apply(n,r,[a,s,this])]),s++;return new be(o)}reduce(...n){const[r,o]=n;let s=0,a=o??this.at(0);for(const l of this)s===0&&n.length===1?a=l:a=Reflect.apply(r,this,[a,l,s,this]),s++;return a}reduceRight(...n){const[r,o]=n;let s=o??this.at(-1);for(let a=this.size-1;a>=0;a--){const l=this.at(a);a===this.size-1&&n.length===1?s=l:s=Reflect.apply(r,this,[s,l,a,this])}return s}toSorted(n){const r=[...this.entries()].sort(n);return new be(r)}toReversed(){const n=new be;for(let r=this.size-1;r>=0;r--){const o=this.keyAt(r),s=this.get(o);n.set(o,s)}return n}toSpliced(...n){const r=[...this.entries()];return r.splice(...n),new be(r)}slice(n,r){const o=new be;let s=this.size-1;if(n===void 0)return o;n<0&&(n=n+this.size),r!==void 0&&r>0&&(s=r-1);for(let a=n;a<=s;a++){const l=this.keyAt(a),u=this.get(l);o.set(l,u)}return o}every(n,r){let o=0;for(const s of this){if(!Reflect.apply(n,r,[s,o,this]))return!1;o++}return!0}some(n,r){let o=0;for(const s of this){if(Reflect.apply(n,r,[s,o,this]))return!0;o++}return!1}},re=new WeakMap,ie(be,"OrderedDict"),be);function Xt(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=Uo(e,t);return n===-1?void 0:e[n]}ie(Xt,"at");function Uo(e,t){const n=e.length,r=lr(t),o=r>=0?r:n+r;return o<0||o>=n?-1:o}ie(Uo,"toSafeIndex");function lr(e){return e!==e||e===0?0:Math.trunc(e)}ie(lr,"toSafeInteger");function qa(e){const t=e+"CollectionProvider",[n,r]=Pe(t),[o,s]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new An,setItemMap:ie(()=>{},"setItemMap")}),a=ie(({state:y,...w})=>y?i.jsx(u,{...w,state:y}):i.jsx(l,{...w}),"CollectionProvider");a.displayName=t;const l=ie(y=>{const w=m();return i.jsx(u,{...y,state:w})},"CollectionInit");l.displayName=t+"Init";const u=ie(y=>{const{scope:w,children:R,state:S}=y,P=c.useRef(null),[I,N]=c.useState(null),A=ne(P,N),[_,T]=S;return c.useEffect(()=>{if(!I)return;const D=Go(()=>{});return D.observe(I,{childList:!0,subtree:!0}),()=>{D.disconnect()}},[I]),i.jsx(o,{scope:w,itemMap:_,setItemMap:T,collectionRef:A,collectionRefObject:P,collectionElement:I,children:R})},"CollectionProviderImpl");u.displayName=t+"Impl";const f=e+"CollectionSlot",p=tt(f),d=c.forwardRef((y,w)=>{const{scope:R,children:S}=y,P=s(f,R),I=ne(w,P.collectionRef);return i.jsx(p,{ref:I,children:S})});d.displayName=f;const h=e+"CollectionItemSlot",x="data-radix-collection-item",g=tt(h),v=c.forwardRef((y,w)=>{const{scope:R,children:S,...P}=y,I=c.useRef(null),[N,A]=c.useState(null),_=ne(w,I,A),T=s(h,R),{setItemMap:D}=T,$=c.useRef(P);Wo($.current,P)||($.current=P);const K=$.current;return c.useEffect(()=>{const L=K;return D(k=>N?k.has(N)?k.set(N,{...L,element:N}).toSorted(Hn):(k.set(N,{...L,element:N}),k.toSorted(Hn)):k),()=>{D(k=>!N||!k.has(N)?k:(k.delete(N),new An(k)))}},[N,K,D]),i.jsx(g,{[x]:"",ref:_,children:S})});v.displayName=h;function m(){return c.useState(new An)}ie(m,"useInitCollection");function C(y){const{itemMap:w}=s(e+"CollectionConsumer",y);return w}return ie(C,"useCollection"),[{Provider:a,Slot:d,ItemSlot:v},{createCollectionScope:r,useCollection:C,useInitCollection:m}]}ie(qa,"createCollection");function Wo(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||e[o]!==t[o])return!1;return!0}ie(Wo,"shallowEqual");function Ko(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}ie(Ko,"isElementPreceding");function Hn(e,t){return!e[1].element||!t[1].element?0:Ko(e[1].element,t[1].element)?-1:1}ie(Hn,"sortByDocumentPosition");function Go(e){return new MutationObserver(n=>{for(const r of n)if(r.type==="childList"){e();return}})}ie(Go,"getChildListObserver");var Xa=Object.defineProperty,gt=(e,t)=>Xa(e,"name",{value:t,configurable:!0}),Yo=!!(typeof window<"u"&&window.document&&window.document.createElement);function z(e,t,{checkForDefaultPrevented:n=!0}={}){return gt(function(o){if(e?.(o),n===!1||!o||!o.defaultPrevented)return t?.(o)},"handleEvent")}gt(z,"composeEventHandlers");function Za(e){if(!Yo)throw new Error("Cannot access window outside of the DOM");return e?.ownerDocument?.defaultView??window}gt(Za,"getOwnerWindow");function Un(e){if(!Yo)throw new Error("Cannot access document outside of the DOM");return e?.ownerDocument??document}gt(Un,"getOwnerDocument");function qo(e,t=!1){const{activeElement:n}=Un(e);if(!n?.nodeName)return null;if(Xo(n)&&n.contentDocument)return qo(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const o=Un(n).getElementById(r);if(o)return o}}return n}gt(qo,"getActiveElement");function Xo(e){return e.tagName==="IFRAME"}gt(Xo,"isFrame");var oe=globalThis?.document?c.useLayoutEffect:()=>{},Ja=Object.defineProperty,Qa=(e,t)=>Ja(e,"name",{value:t,configurable:!0}),uo=At[" useEffectEvent ".trim().toString()],fo=At[" useInsertionEffect ".trim().toString()];function Zo(e){if(typeof uo=="function")return uo(e);const t=c.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof fo=="function"?fo(()=>{t.current=e}):oe(()=>{t.current=e}),c.useMemo(()=>((...n)=>t.current?.(...n)),[])}Qa(Zo,"useEffectEvent");var ec=Object.defineProperty,Ot=(e,t)=>ec(e,"name",{value:t,configurable:!0}),tc=At[" useInsertionEffect ".trim().toString()]||oe;function Ae({prop:e,defaultProp:t,onChange:n=Ot(()=>{},"onChange"),caller:r}){const[o,s,a]=Jo({defaultProp:t,onChange:n}),l=e!==void 0,u=l?e:o,f=c.useCallback(p=>{if(l){const d=Qo(p)?p(e):p;d!==e&&a.current?.(d)}else s(p)},[l,e,s,a]);return[u,f]}Ot(Ae,"useControllableState");function Jo({defaultProp:e,onChange:t}){const[n,r]=c.useState(e),o=c.useRef(n),s=c.useRef(t);return tc(()=>{s.current=t},[t]),c.useEffect(()=>{o.current!==n&&(s.current?.(n),o.current=n)},[n,o]),[n,r,s]}Ot(Jo,"useUncontrolledState");function Qo(e){return typeof e=="function"}Ot(Qo,"isFunction");var po=Symbol("RADIX:SYNC_STATE");function nc(e,t,n,r){const{prop:o,defaultProp:s,onChange:a,caller:l}=t,u=o!==void 0,f=Zo(a),p=[{...n,state:s}];r&&p.push(r);const[d,h]=c.useReducer((m,C)=>{if(C.type===po)return{...m,state:C.state};const b=e(m,C);return u&&!Object.is(b.state,m.state)&&f(b.state),b},...p),x=d.state,g=c.useRef(x);c.useEffect(()=>{g.current!==x&&(g.current=x,u||f(x))},[x,g,u]);const v=c.useMemo(()=>o!==void 0?{...d,state:o}:d,[d,o]);return c.useEffect(()=>{u&&!Object.is(o,d.state)&&h({type:po,state:o})},[o,d.state,u]),[v,h]}Ot(nc,"useControllableStateReducer");var rc=Object.defineProperty,Ve=(e,t)=>rc(e,"name",{value:t,configurable:!0});function es(e,t){return c.useReducer((n,r)=>t[n][r]??n,e)}Ve(es,"useStateMachine");var xt=Ve(e=>{const{present:t,children:n}=e,r=ts(t),o=typeof n=="function"?n({present:r.isPresent}):c.Children.only(n),s=ns(r.ref,rs(o));return typeof n=="function"||r.isPresent?c.cloneElement(o,{ref:s}):null},"Presence");function ts(e){const[t,n]=c.useState(),r=c.useRef(null),o=c.useRef(e),s=c.useRef("none"),a=c.useRef(void 0),l=e?"mounted":"unmounted",[u,f]=es(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return c.useEffect(()=>{u==="mounted"?(s.current=a.current??ft(r.current),a.current=void 0):s.current="none"},[u]),oe(()=>{const p=r.current,d=o.current;if(d!==e){const x=s.current,g=ft(p);e?(a.current=g,f("MOUNT")):g==="none"||p?.display==="none"?f("UNMOUNT"):f(d&&x!==g?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,f]),oe(()=>{if(t){let p;const d=t.ownerDocument.defaultView??window,h=Ve(g=>{const m=ft(r.current).includes(CSS.escape(g.animationName));if(g.target===t&&m&&(f("ANIMATION_END"),!o.current)){const C=t.style.animationFillMode;t.style.animationFillMode="forwards",p=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=C)})}},"handleAnimationEnd"),x=Ve(g=>{g.target===t&&(s.current=ft(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",x),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{d.clearTimeout(p),t.removeEventListener("animationstart",x),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else f("ANIMATION_END")},[t,f]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:c.useCallback(p=>{if(p){const d=getComputedStyle(p);r.current=d,a.current=ft(d)}else r.current=null;n(p)},[])}}Ve(ts,"usePresence");function Wn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Ve(Wn,"setRef");function ns(...e){const t=c.useRef(e);return t.current=e,c.useCallback(n=>{const r=t.current;let o=!1;const s=r.map(a=>{const l=Wn(a,n);return!o&&typeof l=="function"&&(o=!0),l});if(o)return()=>{for(let a=0;a<s.length;a++){const l=s[a];typeof l=="function"?l():Wn(r[a],null)}}},[])}Ve(ns,"useStableComposedRefs");function ft(e){return e?.animationName||"none"}Ve(ft,"getAnimationName");function rs(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Ve(rs,"getElementRef");var oc=Object.defineProperty,sc=(e,t)=>oc(e,"name",{value:t,configurable:!0}),ic=At[" useId ".trim().toString()]||(()=>{}),ac=0;function Ie(e){const[t,n]=c.useState(ic());return oe(()=>{e||n(r=>r??String(ac++))},[e]),e||(t?`radix-${t}`:"")}sc(Ie,"useId");var cc=Object.defineProperty,_t=(e,t)=>cc(e,"name",{value:t,configurable:!0}),ur="Collapsible",[lc,os]=Pe(ur),[uc,dr]=lc(ur),dc=c.forwardRef(_t(function(t,n){const{__scopeCollapsible:r,open:o,defaultOpen:s,disabled:a,onOpenChange:l,...u}=t,[f,p]=Ae({prop:o,defaultProp:s??!1,onChange:l,caller:ur});return i.jsx(uc,{scope:r,disabled:a,contentId:Ie(),open:f,onOpenToggle:c.useCallback(()=>p(d=>!d),[p]),children:i.jsx(H.div,{"data-state":ln(f),"data-disabled":a?"":void 0,...u,ref:n})})},"Collapsible")),fc="CollapsibleTrigger",pc=c.forwardRef(_t(function(t,n){const{__scopeCollapsible:r,...o}=t,s=dr(fc,r);return i.jsx(H.button,{type:"button","aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open||!1,"data-state":ln(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...o,ref:n,onClick:z(t.onClick,s.onOpenToggle)})},"CollapsibleTrigger")),ss="CollapsibleContent",mc=c.forwardRef(_t(function(t,n){const{forceMount:r,...o}=t,s=dr(ss,t.__scopeCollapsible);return i.jsx(xt,{present:r||s.open,children:({present:a})=>i.jsx(hc,{...o,ref:n,present:a})})},"CollapsibleContent")),hc=c.forwardRef(_t(function(t,n){const{__scopeCollapsible:r,present:o,children:s,...a}=t,l=dr(ss,r),[u,f]=c.useState(o),p=c.useRef(null),d=ne(n,p),h=c.useRef(0),x=h.current,g=c.useRef(0),v=g.current,m=l.open||u,C=c.useRef(m),b=c.useRef(void 0);return c.useEffect(()=>{const y=requestAnimationFrame(()=>C.current=!1);return()=>cancelAnimationFrame(y)},[]),oe(()=>{const y=p.current;if(y){b.current=b.current||{transitionDuration:y.style.transitionDuration,animationName:y.style.animationName},y.style.transitionDuration="0s",y.style.animationName="none";const w=y.getBoundingClientRect();h.current=w.height,g.current=w.width,C.current||(y.style.transitionDuration=b.current.transitionDuration,y.style.animationName=b.current.animationName),f(o)}},[l.open,o]),i.jsx(H.div,{"data-state":ln(l.open),"data-disabled":l.disabled?"":void 0,id:l.contentId,hidden:!m,...a,ref:d,style:{"--radix-collapsible-content-height":x?`${x}px`:void 0,"--radix-collapsible-content-width":v?`${v}px`:void 0,...t.style},children:m&&s})},"CollapsibleContentImpl"));function ln(e){return e?"open":"closed"}_t(ln,"getState");var vc=dc,gc=pc,xc=mc,bc=Object.defineProperty,yc=(e,t)=>bc(e,"name",{value:t,configurable:!0}),wc=c.createContext(void 0);function Dt(e){const t=c.useContext(wc);return e||t||"ltr"}yc(Dt,"useDirection");var Cc=Object.defineProperty,ye=(e,t)=>Cc(e,"name",{value:t,configurable:!0}),De="Accordion",Sc=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[fr,Rc,Ec]=cn(De),[un,Xf]=Pe(De,[Ec,os]),pr=os(),Pc=c.forwardRef(ye(function(t,n){const{type:r,...o}=t,s=o,a=o;return i.jsx(fr.Provider,{scope:t.__scopeAccordion,children:r==="multiple"?i.jsx(Ac,{...a,ref:n}):i.jsx(Ic,{...s,ref:n})})},"Accordion")),[is,jc]=un(De),[as,Nc]=un(De,{collapsible:!1}),Ic=c.forwardRef(ye(function(t,n){const{value:r,defaultValue:o,onValueChange:s=ye(()=>{},"onValueChange"),collapsible:a=!1,...l}=t,[u,f]=Ae({prop:r,defaultProp:o??"",onChange:s,caller:De});return i.jsx(is,{scope:t.__scopeAccordion,value:c.useMemo(()=>u?[u]:[],[u]),onItemOpen:f,onItemClose:c.useCallback(()=>a&&f(""),[a,f]),children:i.jsx(as,{scope:t.__scopeAccordion,collapsible:a,children:i.jsx(cs,{...l,ref:n})})})},"AccordionImplSingle")),Ac=c.forwardRef(ye(function(t,n){const{value:r,defaultValue:o,onValueChange:s=ye(()=>{},"onValueChange"),...a}=t,[l,u]=Ae({prop:r,defaultProp:o??[],onChange:s,caller:De}),f=c.useCallback(d=>u((h=[])=>[...h,d]),[u]),p=c.useCallback(d=>u((h=[])=>h.filter(x=>x!==d)),[u]);return i.jsx(is,{scope:t.__scopeAccordion,value:l,onItemOpen:f,onItemClose:p,children:i.jsx(as,{scope:t.__scopeAccordion,collapsible:!0,children:i.jsx(cs,{...a,ref:n})})})},"AccordionImplMultiple")),[Tc,dn]=un(De),cs=c.forwardRef(ye(function(t,n){const{__scopeAccordion:r,disabled:o,dir:s,orientation:a="vertical",...l}=t,u=c.useRef(null),f=ne(u,n),p=Rc(r),h=Dt(s)==="ltr",x=z(t.onKeyDown,g=>{if(!Sc.includes(g.key))return;const v=g.target,m=p().filter(N=>!N.ref.current?.disabled),C=m.findIndex(N=>N.ref.current===v),b=m.length;if(C===-1)return;g.preventDefault();let y=C;const w=0,R=b-1,S=ye(()=>{y=C+1,y>R&&(y=w)},"moveNext"),P=ye(()=>{y=C-1,y<w&&(y=R)},"movePrev");switch(g.key){case"Home":y=w;break;case"End":y=R;break;case"ArrowRight":a==="horizontal"&&(h?S():P());break;case"ArrowDown":a==="vertical"&&S();break;case"ArrowLeft":a==="horizontal"&&(h?P():S());break;case"ArrowUp":a==="vertical"&&P();break}const I=y%b;m[I].ref.current?.focus()});return i.jsx(Tc,{scope:r,disabled:o,direction:s,orientation:a,children:i.jsx(fr.Slot,{scope:r,children:i.jsx(H.div,{...l,"data-orientation":a,ref:f,onKeyDown:o?void 0:x})})})},"AccordionImpl")),Kn="AccordionItem",[Oc,mr]=un(Kn),_c=c.forwardRef(ye(function(t,n){const{__scopeAccordion:r,value:o,...s}=t,a=dn(Kn,r),l=jc(Kn,r),u=pr(r),f=Ie(),p=o&&l.value.includes(o)||!1,d=a.disabled||t.disabled;return i.jsx(Oc,{scope:r,open:p,disabled:d,triggerId:f,children:i.jsx(vc,{"data-orientation":a.orientation,"data-state":hr(p),...u,...s,ref:n,disabled:d,open:p,onOpenChange:h=>{h?l.onItemOpen(o):l.onItemClose(o)}})})},"AccordionItem")),Dc="AccordionHeader",kc=c.forwardRef(ye(function(t,n){const{__scopeAccordion:r,...o}=t,s=dn(De,r),a=mr(Dc,r);return i.jsx(H.h3,{"data-orientation":s.orientation,"data-state":hr(a.open),"data-disabled":a.disabled?"":void 0,...o,ref:n})},"AccordionHeader")),mo="AccordionTrigger",Mc=c.forwardRef(ye(function(t,n){const{__scopeAccordion:r,...o}=t,s=dn(De,r),a=mr(mo,r),l=Nc(mo,r),u=pr(r);return i.jsx(fr.ItemSlot,{scope:r,children:i.jsx(gc,{"aria-disabled":a.open&&!l.collapsible||void 0,"data-orientation":s.orientation,id:a.triggerId,...u,...o,ref:n})})},"AccordionTrigger")),$c="AccordionContent",Fc=c.forwardRef(ye(function(t,n){const{__scopeAccordion:r,...o}=t,s=dn(De,r),a=mr($c,r),l=pr(r);return i.jsx(xc,{role:"region","aria-labelledby":a.triggerId,"data-orientation":s.orientation,...l,...o,ref:n,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...t.style}})},"AccordionContent"));function hr(e){return e?"open":"closed"}ye(hr,"getState");var Lc=Pc,Bc=_c,zc=kc,ls=Mc,us=Fc;const ds=Lc,vr=c.forwardRef(({className:e,...t},n)=>i.jsx(Bc,{className:Q("border-b border-border",e),...t,ref:n}));vr.displayName="AccordionItem";const gr=c.forwardRef(({className:e,children:t,...n},r)=>i.jsx(zc,{className:"flex",children:i.jsxs(ls,{className:Q("flex flex-1 items-center justify-between gap-2 py-3 text-left text-sm font-semibold transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...n,ref:r,children:[t,i.jsx($o,{className:"size-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));gr.displayName=ls.displayName;const xr=c.forwardRef(({className:e,children:t,...n},r)=>i.jsx(us,{forceMount:!0,className:"grid overflow-hidden text-sm transition-[grid-template-rows] duration-300 ease-out data-[state=closed]:grid-rows-[0fr] data-[state=open]:grid-rows-[1fr]",...n,ref:r,children:i.jsx("div",{className:"min-h-0 overflow-hidden",children:i.jsx("div",{className:Q("pb-4 pt-0",e),children:t})})}));xr.displayName=us.displayName;var Vc=Object.defineProperty,Hc=(e,t)=>Vc(e,"name",{value:t,configurable:!0});function Gn(e,[t,n]){return Math.min(n,Math.max(t,e))}Hc(Gn,"clamp");var Uc=Object.defineProperty,Wc=(e,t)=>Uc(e,"name",{value:t,configurable:!0});function Ee(e){const t=c.useRef(e);return c.useEffect(()=>{t.current=e}),c.useMemo(()=>((...n)=>t.current?.(...n)),[])}Wc(Ee,"useCallbackRef");var Kc=Object.defineProperty,se=(e,t)=>Kc(e,"name",{value:t,configurable:!0}),Yn="dismissableLayer.update",Gc="dismissableLayer.pointerDownOutside",Yc="dismissableLayer.focusOutside",ho,fs=c.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),ps=c.forwardRef(se(function(t,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:o=!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:l,onInteractOutside:u,onDismiss:f,...p}=t,d=c.useContext(fs),[h,x]=c.useState(null),g=h?.ownerDocument??globalThis?.document,[,v]=c.useState({}),m=ne(n,x),C=Array.from(d.layers),[b]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),y=b?C.indexOf(b):-1,w=h?C.indexOf(h):-1,R=d.layersWithOutsidePointerEventsDisabled.size>0,S=w>=y,P=c.useRef(!1),I=hs(T=>{a?.(T),u?.(T),T.defaultPrevented||f?.()},{ownerDocument:g,deferPointerDownOutside:o,isDeferredPointerDownOutsideRef:P,dismissableSurfaces:d.dismissableSurfaces,shouldHandlePointerDownOutside:c.useCallback(T=>{if(!(T instanceof Node))return!1;const D=[...d.branches].some($=>$.contains(T));return S&&!D},[d.branches,S])}),N=vs(T=>{if(o&&P.current)return;const D=T.target;[...d.branches].some(K=>K.contains(D))||(l?.(T),u?.(T),T.defaultPrevented||f?.())},g),A=h?w===C.length-1:!1,_=Ee(T=>{T.key==="Escape"&&(s?.(T),!T.defaultPrevented&&f&&(T.preventDefault(),f()))});return c.useEffect(()=>{if(A)return g.addEventListener("keydown",_,{capture:!0}),()=>g.removeEventListener("keydown",_,{capture:!0})},[g,A,_]),c.useEffect(()=>{if(h)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(ho=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(h)),d.layers.add(h),qn(),()=>{r&&(d.layersWithOutsidePointerEventsDisabled.delete(h),d.layersWithOutsidePointerEventsDisabled.size===0&&(g.body.style.pointerEvents=ho))}},[h,g,r,d]),c.useEffect(()=>()=>{h&&(d.layers.delete(h),d.layersWithOutsidePointerEventsDisabled.delete(h),qn())},[h,d]),c.useEffect(()=>{const T=se(()=>v({}),"handleUpdate");return document.addEventListener(Yn,T),()=>document.removeEventListener(Yn,T)},[]),i.jsx(H.div,{...p,ref:m,style:{pointerEvents:R?S?"auto":"none":void 0,...t.style},onFocusCapture:z(t.onFocusCapture,N.onFocusCapture),onBlurCapture:z(t.onBlurCapture,N.onBlurCapture),onPointerDownCapture:z(t.onPointerDownCapture,I.onPointerDownCapture)})},"DismissableLayer"));function ms(){const e=c.useContext(fs),[t,n]=c.useState(null);return c.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}se(ms,"useDismissableLayerSurface");var qc=se(()=>!0,"IS_TRUE");function hs(e,t){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:o,dismissableSurfaces:s,shouldHandlePointerDownOutside:a=qc}=t,l=Ee(e),u=c.useRef(!1),f=c.useRef(!1),p=c.useRef(new Map),d=c.useRef(()=>{});return c.useEffect(()=>{function h(){f.current=!1,o.current=!1,p.current.clear()}se(h,"resetOutsideInteraction");function x(){return Array.from(p.current.values()).some(Boolean)}se(x,"isOutsideInteractionIntercepted");function g(y){if(!f.current)return;const w=y.target;w instanceof Node&&[...s].some(S=>S.contains(w))||p.current.set(y.type,!0),y.type==="click"&&window.setTimeout(()=>{f.current&&d.current()},0)}se(g,"handleInteractionCapture");function v(y){f.current&&p.current.set(y.type,!1)}se(v,"handleInteractionBubble");const m=se(y=>{if(y.target&&!u.current){let w=function(){n.removeEventListener("click",d.current);const S=x();h(),S||br(Gc,l,R,{discrete:!0})};if(se(w,"handleAndDispatchPointerDownOutsideEvent"),!a(y.target)){n.removeEventListener("click",d.current),h(),u.current=!1;return}const R={originalEvent:y};f.current=!0,o.current=r&&y.button===0,p.current.clear(),!r||y.button!==0?w():(n.removeEventListener("click",d.current),d.current=w,n.addEventListener("click",d.current,{once:!0}))}else n.removeEventListener("click",d.current),h();u.current=!1},"handlePointerDown"),C=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const y of C)n.addEventListener(y,g,!0),n.addEventListener(y,v);const b=window.setTimeout(()=>{n.addEventListener("pointerdown",m)},0);return()=>{window.clearTimeout(b),n.removeEventListener("pointerdown",m),n.removeEventListener("click",d.current);for(const y of C)n.removeEventListener(y,g,!0),n.removeEventListener(y,v)}},[n,l,r,o,s,a]),{onPointerDownCapture:se(()=>u.current=!0,"onPointerDownCapture")}}se(hs,"usePointerDownOutside");function vs(e,t=globalThis?.document){const n=Ee(e),r=c.useRef(!1);return c.useEffect(()=>{const o=se(s=>{s.target&&!r.current&&br(Yc,n,{originalEvent:s},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:se(()=>r.current=!0,"onFocusCapture"),onBlurCapture:se(()=>r.current=!1,"onBlurCapture")}}se(vs,"useFocusOutside");function qn(){const e=new CustomEvent(Yn);document.dispatchEvent(e)}se(qn,"dispatchUpdate");function br(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Bo(o,s):o.dispatchEvent(s)}se(br,"handleAndDispatchCustomEvent");var Xc=Object.defineProperty,yr=(e,t)=>Xc(e,"name",{value:t,configurable:!0}),Ht=0,ct=null;function Zc(e){return fn(),e.children}yr(Zc,"FocusGuards");function fn(){c.useEffect(()=>{ct||(ct={start:Xn(),end:Xn()});const{start:e,end:t}=ct;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Ht++,()=>{Ht===1&&(ct?.start.remove(),ct?.end.remove(),ct=null),Ht=Math.max(0,Ht-1)}},[])}yr(fn,"useFocusGuards");function Xn(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}yr(Xn,"createFocusGuard");var Jc=Object.defineProperty,pe=(e,t)=>Jc(e,"name",{value:t,configurable:!0}),Tn="focusScope.autoFocusOnMount",On="focusScope.autoFocusOnUnmount",vo={bubbles:!1,cancelable:!0},gs=c.forwardRef(pe(function(t,n){const{loop:r=!1,trapped:o=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...l}=t,[u,f]=c.useState(null),p=Ee(s),d=Ee(a),h=c.useRef(null),x=ne(n,f),g=c.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;c.useEffect(()=>{if(o){let m=function(w){if(g.paused||!u)return;const R=w.target;u.contains(R)?h.current=R:Le(h.current,{select:!0})},C=function(w){if(g.paused||!u)return;const R=w.relatedTarget;R!==null&&(u.contains(R)||Le(h.current,{select:!0}))},b=function(w){if(document.activeElement===document.body)for(const S of w)S.removedNodes.length>0&&Le(u)};pe(m,"handleFocusIn"),pe(C,"handleFocusOut"),pe(b,"handleMutations"),document.addEventListener("focusin",m),document.addEventListener("focusout",C);const y=new MutationObserver(b);return u&&y.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",C),y.disconnect()}}},[o,u,g.paused]),c.useEffect(()=>{if(u){go.add(g);const m=document.activeElement;if(!u.contains(m)){const b=new CustomEvent(Tn,vo);u.addEventListener(Tn,p),u.dispatchEvent(b),b.defaultPrevented||(xs(Ss(wr(u)),{select:!0}),document.activeElement===m&&Le(u))}return()=>{u.removeEventListener(Tn,p),setTimeout(()=>{const b=new CustomEvent(On,vo);u.addEventListener(On,d),u.dispatchEvent(b),b.defaultPrevented||Le(m??document.body,{select:!0}),u.removeEventListener(On,d),go.remove(g)},0)}}},[u,p,d,g]);const v=c.useCallback(m=>{if(!r&&!o||g.paused)return;const C=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,b=document.activeElement;if(C&&b){const y=m.currentTarget,[w,R]=bs(y);w&&R?!m.shiftKey&&b===R?(m.preventDefault(),r&&Le(w,{select:!0})):m.shiftKey&&b===w&&(m.preventDefault(),r&&Le(R,{select:!0})):b===y&&m.preventDefault()}},[r,o,g.paused]);return i.jsx(H.div,{tabIndex:-1,...l,ref:x,onKeyDown:v})},"FocusScope"));function xs(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Le(r,{select:t}),document.activeElement!==n)return}pe(xs,"focusFirst");function bs(e){const t=wr(e),n=Zn(t,e),r=Zn(t.reverse(),e);return[n,r]}pe(bs,"getTabbableEdges");function wr(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:pe(r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)t.push(n.currentNode);return t}pe(wr,"getTabbableCandidates");function Zn(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):ys(r,{upTo:t})))return r}pe(Zn,"findVisible");function ys(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}pe(ys,"isHidden");function ws(e){return e instanceof HTMLInputElement&&"select"in e}pe(ws,"isSelectableInput");function Le(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&ws(e)&&t&&e.select()}}pe(Le,"focus");var go=Cs();function Cs(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Jn(e,t),e.unshift(t)},remove(t){e=Jn(e,t),e[0]?.resume()}}}pe(Cs,"createFocusScopesStack");function Jn(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}pe(Jn,"arrayRemove");function Ss(e){return e.filter(t=>t.tagName!=="A")}pe(Ss,"removeLinks");const Qc=["top","right","bottom","left"],Ye=Math.min,Be=Math.max,rn=Math.round,Ut=Math.floor,ze=e=>({x:e,y:e}),el={left:"right",right:"left",bottom:"top",top:"bottom"};function Rs(e,t,n){return Be(e,Ye(t,n))}function He(e,t){return typeof e=="function"?e(t):e}function qe(e){return e.split("-")[0]}function bt(e){return e.split("-")[1]}function Cr(e){return e==="x"?"y":"x"}function Sr(e){return e==="y"?"height":"width"}function Ne(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Rr(e){return Cr(Ne(e))}function tl(e,t,n){n===void 0&&(n=!1);const r=bt(e),o=Rr(e),s=Sr(o);let a=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=on(a)),[a,on(a)]}function nl(e){const t=on(e);return[Qn(e),t,Qn(t)]}function Qn(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const xo=["left","right"],bo=["right","left"],rl=["top","bottom"],ol=["bottom","top"];function sl(e,t,n){switch(e){case"top":case"bottom":return n?t?bo:xo:t?xo:bo;case"left":case"right":return t?rl:ol;default:return[]}}function il(e,t,n,r){const o=bt(e);let s=sl(qe(e),n==="start",r);return o&&(s=s.map(a=>a+"-"+o),t&&(s=s.concat(s.map(Qn)))),s}function on(e){const t=qe(e);return el[t]+e.slice(t.length)}function al(e){var t,n,r,o;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(r=e.bottom)!=null?r:0,left:(o=e.left)!=null?o:0}}function Es(e){return typeof e!="number"?al(e):{top:e,right:e,bottom:e,left:e}}function sn(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function yo(e,t,n){let{reference:r,floating:o}=e;const s=Ne(t),a=Rr(t),l=Sr(a),u=qe(t),f=s==="y",p=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,h=r[l]/2-o[l]/2;let x;switch(u){case"top":x={x:p,y:r.y-o.height};break;case"bottom":x={x:p,y:r.y+r.height};break;case"right":x={x:r.x+r.width,y:d};break;case"left":x={x:r.x-o.width,y:d};break;default:x={x:r.x,y:r.y}}const g=bt(t);return g&&(x[a]+=h*(g==="end"?1:-1)*(n&&f?-1:1)),x}async function cl(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:a,elements:l,strategy:u}=e,{boundary:f="clippingAncestors",rootBoundary:p="viewport",elementContext:d="floating",altBoundary:h=!1,padding:x=0}=He(t,e),g=Es(x),m=l[h?d==="floating"?"reference":"floating":d],C=sn(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(m)))==null||n?m:m.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:f,rootBoundary:p,strategy:u})),b=d==="floating"?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,y=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),w=await(s.isElement==null?void 0:s.isElement(y))&&await(s.getScale==null?void 0:s.getScale(y))||{x:1,y:1},R=sn(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:b,offsetParent:y,strategy:u}):b);return{top:(C.top-R.top+g.top)/w.y,bottom:(R.bottom-C.bottom+g.bottom)/w.y,left:(C.left-R.left+g.left)/w.x,right:(R.right-C.right+g.right)/w.x}}const ll=50,ul=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:cl},u=await(a.isRTL==null?void 0:a.isRTL(t));let f=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:p,y:d}=yo(f,r,u),h=r,x=0;const g={};for(let v=0;v<s.length;v++){const m=s[v];if(!m)continue;const{name:C,fn:b}=m,{x:y,y:w,data:R,reset:S}=await b({x:p,y:d,initialPlacement:r,placement:h,strategy:o,middlewareData:g,rects:f,platform:l,elements:{reference:e,floating:t}});p=y??p,d=w??d,g[C]={...g[C],...R},S&&x<ll&&(x++,typeof S=="object"&&(S.placement&&(h=S.placement),S.rects&&(f=S.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:o}):S.rects),{x:p,y:d}=yo(f,h,u)),v=-1)}return{x:p,y:d,placement:h,strategy:o,middlewareData:g}},dl=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:a,elements:l,middlewareData:u}=t,{element:f,padding:p=0}=He(e,t)||{};if(f==null)return{};const d=Es(p),h={x:n,y:r},x=Rr(o),g=Sr(x),v=await a.getDimensions(f),m=x==="y",C=m?"top":"left",b=m?"bottom":"right",y=m?"clientHeight":"clientWidth",w=s.reference[g]+s.reference[x]-h[x]-s.floating[g],R=h[x]-s.reference[x],S=await(a.getOffsetParent==null?void 0:a.getOffsetParent(f));let P=S?S[y]:0;(!P||!await(a.isElement==null?void 0:a.isElement(S)))&&(P=l.floating[y]||s.floating[g]);const I=w/2-R/2,N=P/2-v[g]/2-1,A=Ye(d[C],N),_=Ye(d[b],N),T=P-v[g]-_,D=P/2-v[g]/2+I,$=Rs(A,D,T),K=!u.arrow&&bt(o)!=null&&D!==$&&s.reference[g]/2-(D<A?A:_)-v[g]/2<0,L=K?D<A?D-A:D-T:0;return{[x]:h[x]+L,data:{[x]:$,centerOffset:D-$-L,...K&&{alignmentOffset:L}},reset:K}}}),fl=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:a,initialPlacement:l,platform:u,elements:f}=t,{mainAxis:p=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:v=!0,...m}=He(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const C=qe(o),b=Ne(l),y=qe(l)===l,w=await(u.isRTL==null?void 0:u.isRTL(f.floating)),R=h||(y||!v?[on(l)]:nl(l)),S=g!=="none";!h&&S&&R.push(...il(l,v,g,w));const P=[l,...R],I=await u.detectOverflow(t,m),N=[];let A=((r=s.flip)==null?void 0:r.overflows)||[];if(p&&N.push(I[C]),d){const $=tl(o,a,w);N.push(I[$[0]],I[$[1]])}if(A=[...A,{placement:o,overflows:N}],!N.every($=>$<=0)){var _,T;const $=(((_=s.flip)==null?void 0:_.index)||0)+1,K=P[$];if(K&&(!(d==="alignment"?b!==Ne(K):!1)||A.every(F=>Ne(F.placement)===b?F.overflows[0]>0:!0)))return{data:{index:$,overflows:A},reset:{placement:K}};let L=(T=A.filter(k=>k.overflows[0]<=0).sort((k,F)=>k.overflows[1]-F.overflows[1])[0])==null?void 0:T.placement;if(!L)switch(x){case"bestFit":{var D;const k=(D=A.filter(F=>{if(S){const U=Ne(F.placement);return U===b||U==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(U=>U>0).reduce((U,V)=>U+V,0)]).sort((F,U)=>F[1]-U[1])[0])==null?void 0:D[0];k&&(L=k);break}case"initialPlacement":L=l;break}if(o!==L)return{reset:{placement:L}}}return{}}}};function wo(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Co(e){return Qc.some(t=>e[t]>=0)}const pl=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=He(e,t);switch(o){case"referenceHidden":{const a=await r.detectOverflow(t,{...s,elementContext:"reference"}),l=wo(a,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Co(l)}}}case"escaped":{const a=await r.detectOverflow(t,{...s,altBoundary:!0}),l=wo(a,n.floating);return{data:{escapedOffsets:l,escaped:Co(l)}}}default:return{}}}}},Ps=new Set(["left","top"]);async function ml(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),a=qe(n),l=bt(n),u=Ne(n)==="y",f=Ps.has(a)?-1:1,p=s&&u?-1:1,d=He(t,e);let{mainAxis:h,crossAxis:x,alignmentAxis:g}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&typeof g=="number"&&(x=l==="end"?g*-1:g),u?{x:x*p,y:h*f}:{x:h*f,y:x*p}}const hl=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:a,middlewareData:l}=t,u=await ml(t,e);return a===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+u.x,y:s+u.y,data:{...u,placement:a}}}}},vl=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:a=!0,crossAxis:l=!1,limiter:u={fn:b=>{let{x:y,y:w}=b;return{x:y,y:w}}},...f}=He(e,t),p={x:n,y:r},d=await s.detectOverflow(t,f),h=Ne(o),x=Cr(h);let g=p[x],v=p[h];const m=(b,y)=>Rs(y+d[b==="y"?"top":"left"],y,y-d[b==="y"?"bottom":"right"]);a&&(g=m(x,g)),l&&(v=m(h,v));const C=u.fn({...t,[x]:g,[h]:v});return{...C,data:{x:C.x-n,y:C.y-r,enabled:{[x]:a,[h]:l}}}}}},gl=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,r;const{x:o,y:s,placement:a,rects:l,middlewareData:u}=t,{offset:f=0,mainAxis:p=!0,crossAxis:d=!0}=He(e,t),h={x:o,y:s},x=Ne(a),g=Cr(x);let v=h[g],m=h[x];const C=He(f,t),b=typeof C=="number"?{mainAxis:C,crossAxis:0}:{mainAxis:(n=C.mainAxis)!=null?n:0,crossAxis:(r=C.crossAxis)!=null?r:0};if(p){const R=g==="y"?"height":"width",S=l.reference[g]-l.floating[R]+b.mainAxis,P=l.reference[g]+l.reference[R]-b.mainAxis;v<S?v=S:v>P&&(v=P)}if(d){var y,w;const R=g==="y"?"width":"height",S=Ps.has(qe(a)),P=l.reference[x]-l.floating[R]+(S&&((y=u.offset)==null?void 0:y[x])||0)+(S?0:b.crossAxis),I=l.reference[x]+l.reference[R]+(S?0:((w=u.offset)==null?void 0:w[x])||0)-(S?b.crossAxis:0);m<P?m=P:m>I&&(m=I)}return{[g]:v,[x]:m}}}},xl=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:s}=t,{apply:a=()=>{},...l}=He(e,t),u=await o.detectOverflow(t,l),f=qe(n),p=bt(n),d=Ne(n)==="y",{width:h,height:x}=r.floating;let g,v;f==="top"||f==="bottom"?(g=f,v=p===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(v=f,g=p==="end"?"top":"bottom");const m=x-u.top-u.bottom,C=h-u.left-u.right,b=Ye(x-u[g],m),y=Ye(h-u[v],C),w=t.middlewareData.shift,R=!w;let S=b,P=y;w!=null&&w.enabled.x&&(P=C),w!=null&&w.enabled.y&&(S=m),R&&!p&&(d?P=h-2*Be(u.left,u.right):S=x-2*Be(u.top,u.bottom)),await a({...t,availableWidth:P,availableHeight:S});const I=await o.getDimensions(s.floating);return h!==I.width||x!==I.height?{reset:{rects:!0}}:{}}}};function pn(){return typeof window<"u"}function yt(e){return js(e)?(e.nodeName||"").toLowerCase():"#document"}function ge(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ue(e){var t;return(t=(js(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function js(e){return pn()?e instanceof Node||e instanceof ge(e).Node:!1}function Te(e){return pn()?e instanceof Element||e instanceof ge(e).Element:!1}function Ze(e){return pn()?e instanceof HTMLElement||e instanceof ge(e).HTMLElement:!1}function So(e){return!pn()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ge(e).ShadowRoot}function mn(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Oe(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function bl(e){return/^(table|td|th)$/.test(yt(e))}function hn(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const yl=/transform|translate|scale|rotate|perspective|filter/,wl=/paint|layout|strict|content/,Qe=e=>!!e&&e!=="none";let _n;function Er(e){const t=Te(e)?Oe(e):e;return Qe(t.transform)||Qe(t.translate)||Qe(t.scale)||Qe(t.rotate)||Qe(t.perspective)||!Pr()&&(Qe(t.backdropFilter)||Qe(t.filter))||yl.test(t.willChange||"")||wl.test(t.contain||"")}function Cl(e){let t=nt(e);for(;Ze(t)&&!jt(t);){if(Er(t))return t;if(hn(t))return null;t=nt(t)}return null}function Pr(){return _n==null&&(_n=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),_n}function jt(e){return/^(html|body|#document)$/.test(yt(e))}function Oe(e){return ge(e).getComputedStyle(e)}function vn(e){return Te(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function nt(e){if(yt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||So(e)&&e.host||Ue(e);return So(t)?t.host:t}function Ns(e){const t=nt(e);return jt(t)?(e.ownerDocument||e).body:Ze(t)&&mn(t)?t:Ns(t)}function Nt(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Ns(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),a=ge(o);if(s){const l=er(a);return t.concat(a,a.visualViewport||[],mn(o)?o:[],l&&n?Nt(l):[])}else return t.concat(o,Nt(o,[],n))}function er(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Is(e){const t=Oe(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ze(e),s=o?e.offsetWidth:n,a=o?e.offsetHeight:r,l=rn(n)!==s||rn(r)!==a;return l&&(n=s,r=a),{width:n,height:r,$:l}}function jr(e){return Te(e)?e:e.contextElement}function mt(e){const t=jr(e);if(!Ze(t))return ze(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Is(t);let a=(s?rn(n.width):n.width)/r,l=(s?rn(n.height):n.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const Sl=ze(0);function As(e){const t=ge(e);return!Pr()||!t.visualViewport?Sl:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Rl(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===ge(e)}function rt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=jr(e);let a=ze(1);t&&(r?Te(r)&&(a=mt(r)):a=mt(e));const l=Rl(s,n,r)?As(s):ze(0);let u=(o.left+l.x)/a.x,f=(o.top+l.y)/a.y,p=o.width/a.x,d=o.height/a.y;if(s&&r){const h=ge(s),x=Te(r)?ge(r):r;let g=h,v=er(g);for(;v&&x!==g;){const m=mt(v),C=v.getBoundingClientRect(),b=Oe(v),y=C.left+(v.clientLeft+parseFloat(b.paddingLeft))*m.x,w=C.top+(v.clientTop+parseFloat(b.paddingTop))*m.y;u*=m.x,f*=m.y,p*=m.x,d*=m.y,u+=y,f+=w,g=ge(v),v=er(g)}}return sn({width:p,height:d,x:u,y:f})}function gn(e,t){const n=vn(e).scrollLeft;return t?t.left+n:rt(Ue(e)).left+n}function Ts(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-gn(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function El(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",a=Ue(r),l=t?hn(t.floating):!1;if(r===a||l&&s)return n;let u={scrollLeft:0,scrollTop:0},f=ze(1);const p=ze(0),d=Ze(r);if((d||!s)&&((yt(r)!=="body"||mn(a))&&(u=vn(r)),d)){const x=rt(r);f=mt(r),p.x=x.x+r.clientLeft,p.y=x.y+r.clientTop}const h=a&&!d&&!s?Ts(a,u):ze(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-u.scrollLeft*f.x+p.x+h.x,y:n.y*f.y-u.scrollTop*f.y+p.y+h.y}}function Pl(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function jl(e){const t=vn(e),n=e.ownerDocument.body,r=Be(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),o=Be(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let s=-t.scrollLeft+gn(e);const a=-t.scrollTop;return Oe(n).direction==="rtl"&&(s+=Be(e.clientWidth,n.clientWidth)-r),{width:r,height:o,x:s,y:a}}const Nl=25;function Il(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",o=ge(e),s=Ue(e),a=o.visualViewport;let l=s.clientWidth,u=s.clientHeight,f=0,p=0;if(a){const h=!Pr()||t==="fixed";r?h||(f=-a.offsetLeft,p=-a.offsetTop):(l=a.width,u=a.height,h&&(f=a.offsetLeft,p=a.offsetTop))}if(gn(s)<=0){const h=s.ownerDocument,x=h.body,g=getComputedStyle(x),v=h.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,m=Math.abs(s.clientWidth-x.clientWidth-v),C=getComputedStyle(s).scrollbarGutter==="stable both-edges"?m/2:m;C<=Nl&&(l-=C)}return{width:l,height:u,x:f,y:p}}function Al(e,t){const n=rt(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=mt(e),a=e.clientWidth*s.x,l=e.clientHeight*s.y,u=o*s.x,f=r*s.y;return{width:a,height:l,x:u,y:f}}function Ro(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=Il(e,n,t);else if(t==="document")r=jl(Ue(e));else if(Te(t))r=Al(t,n);else{const o=As(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return sn(r)}function Tl(e,t){const n=t.get(e);if(n)return n;let r=Nt(e,[],!1).filter(l=>Te(l)&&yt(l)!=="body"),o=null;const s=Oe(e).position==="fixed";let a=s?nt(e):e;for(;Te(a)&&!jt(a);){const l=Oe(a),u=Er(a),f=o?o.position:s?"fixed":"";!u&&(f==="fixed"||f==="absolute"&&l.position==="static")?r=r.filter(d=>d!==a):o=l,a=nt(a)}return t.set(e,r),r}function Ol(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const a=[...n==="clippingAncestors"?hn(t)?[]:Tl(t,this._c):[].concat(n),r],l=Ro(t,a[0],o);let u=l.top,f=l.right,p=l.bottom,d=l.left;for(let h=1;h<a.length;h++){const x=Ro(t,a[h],o);u=Be(x.top,u),f=Ye(x.right,f),p=Ye(x.bottom,p),d=Be(x.left,d)}return{width:f-d,height:p-u,x:d,y:u}}function _l(e){const{width:t,height:n}=Is(e);return{width:t,height:n}}function Dl(e,t,n){const r=Ze(t),o=Ue(t),s=n==="fixed",a=rt(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const u=ze(0);if((r||!s)&&((yt(t)!=="body"||mn(o))&&(l=vn(t)),r)){const h=rt(t,!0,s,t);u.x=h.x+t.clientLeft,u.y=h.y+t.clientTop}!r&&o&&(u.x=gn(o));const f=o&&!r&&!s?Ts(o,l):ze(0),p=a.left+l.scrollLeft-u.x-f.x,d=a.top+l.scrollTop-u.y-f.y;return{x:p,y:d,width:a.width,height:a.height}}function Dn(e){return Oe(e).position==="static"}function Eo(e,t){if(!Ze(e)||Oe(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ue(e)===n&&(n=n.ownerDocument.body),n}function Os(e,t){const n=ge(e);if(hn(e))return n;if(!Ze(e)){let o=nt(e);for(;o&&!jt(o);){if(Te(o)&&!Dn(o))return o;o=nt(o)}return n}let r=Eo(e,t);for(;r&&bl(r)&&Dn(r);)r=Eo(r,t);return r&&jt(r)&&Dn(r)&&!Er(r)?n:r||Cl(e)||n}const kl=async function(e){const t=this.getOffsetParent||Os,n=this.getDimensions,r=await n(e.floating);return{reference:Dl(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ml(e){return Oe(e).direction==="rtl"}const $l={convertOffsetParentRelativeRectToViewportRelativeRect:El,getDocumentElement:Ue,getClippingRect:Ol,getOffsetParent:Os,getElementRects:kl,getClientRects:Pl,getDimensions:_l,getScale:mt,isElement:Te,isRTL:Ml};function _s(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Fl(e,t,n){let r=null,o;const s=Ue(e);function a(){var p;clearTimeout(o),(p=r)==null||p.disconnect(),r=null}function l(p,d){p===void 0&&(p=!1),d===void 0&&(d=1),a();const h=e.getBoundingClientRect(),{left:x,top:g,width:v,height:m}=h;if(p||t(),!v||!m)return;const C=Ut(g),b=Ut(s.clientWidth-(x+v)),y=Ut(s.clientHeight-(g+m)),w=Ut(x),S={rootMargin:-C+"px "+-b+"px "+-y+"px "+-w+"px",threshold:Be(0,Ye(1,d))||1};let P=!0;function I(N){const A=N[0].intersectionRatio;if(!_s(h,e.getBoundingClientRect()))return l();if(A!==d){if(!P)return l();A?l(!1,A):o=setTimeout(()=>{l(!1,1e-7)},1e3)}P=!1}try{r=new IntersectionObserver(I,{...S,root:s.ownerDocument})}catch{r=new IntersectionObserver(I,S)}r.observe(e)}const u=ge(e),f=()=>l(n);return u.addEventListener("resize",f),l(!0),()=>{u.removeEventListener("resize",f),a()}}function Ll(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,f=jr(e),p=o||s?[...f?Nt(f):[],...t?Nt(t):[]]:[];p.forEach(C=>{o&&C.addEventListener("scroll",n),s&&C.addEventListener("resize",n)});const d=f&&l?Fl(f,n,s):null;let h=-1,x=null;a&&(x=new ResizeObserver(C=>{let[b]=C;b&&b.target===f&&x&&t&&(x.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var y;(y=x)==null||y.observe(t)})),n()}),f&&!u&&x.observe(f),t&&x.observe(t));let g,v=u?rt(e):null;u&&m();function m(){const C=rt(e);v&&!_s(v,C)&&n(),v=C,g=requestAnimationFrame(m)}return n(),()=>{var C;p.forEach(b=>{o&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),d?.(),(C=x)==null||C.disconnect(),x=null,u&&cancelAnimationFrame(g)}}const Bl=hl,zl=vl,Vl=fl,Hl=xl,Ul=pl,Po=dl,Wl=gl,Kl=(e,t,n)=>{const r=new Map,o=n??{},s={...$l,...o.platform,_c:r};return ul(e,t,{...o,platform:s})};var Gl=typeof document<"u",Yl=function(){},Zt=Gl?c.useLayoutEffect:Yl;function an(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,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!an(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!an(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Ds(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function jo(e,t){const n=Ds(e);return Math.round(t*n)/n}function kn(e){const t=c.useRef(e);return Zt(()=>{t.current=e}),t}function ql(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:a}={},transform:l=!0,whileElementsMounted:u,open:f}=e,[p,d]=c.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,x]=c.useState(r);an(h,r)||x(r);const[g,v]=c.useState(null),[m,C]=c.useState(null),b=c.useCallback(F=>{F!==S.current&&(S.current=F,v(F))},[]),y=c.useCallback(F=>{F!==P.current&&(P.current=F,C(F))},[]),w=s||g,R=a||m,S=c.useRef(null),P=c.useRef(null),I=c.useRef(p),N=u!=null,A=kn(u),_=kn(o),T=kn(f),D=c.useCallback(()=>{if(!S.current||!P.current)return;const F={placement:t,strategy:n,middleware:h};_.current&&(F.platform=_.current),Kl(S.current,P.current,F).then(U=>{const V={...U,isPositioned:T.current!==!1};$.current&&!an(I.current,V)&&(I.current=V,Tt.flushSync(()=>{d(V)}))})},[h,t,n,_,T]);Zt(()=>{f===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,d(F=>({...F,isPositioned:!1})))},[f]);const $=c.useRef(!1);Zt(()=>($.current=!0,()=>{$.current=!1}),[]),Zt(()=>{if(w&&(S.current=w),R&&(P.current=R),w&&R){if(A.current)return A.current(w,R,D);D()}},[w,R,D,A,N]);const K=c.useMemo(()=>({reference:S,floating:P,setReference:b,setFloating:y}),[b,y]),L=c.useMemo(()=>({reference:w,floating:R}),[w,R]),k=c.useMemo(()=>{const F={position:n,left:0,top:0};if(!L.floating)return F;const U=jo(L.floating,p.x),V=jo(L.floating,p.y);return l?{...F,transform:"translate("+U+"px, "+V+"px)",...Ds(L.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:U,top:V}},[n,l,L.floating,p.x,p.y]);return c.useMemo(()=>({...p,update:D,refs:K,elements:L,floatingStyles:k}),[p,D,K,L,k])}const Xl=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Po({element:r.current,padding:o}).fn(n):{}:r?Po({element:r,padding:o}).fn(n):{}}}},Zl=(e,t)=>{const n=Bl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Jl=(e,t)=>{const n=zl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ql=(e,t)=>({fn:Wl(e).fn,options:[e,t]}),eu=(e,t)=>{const n=Vl(e);return{name:n.name,fn:n.fn,options:[e,t]}},tu=(e,t)=>{const n=Hl(e);return{name:n.name,fn:n.fn,options:[e,t]}},nu=(e,t)=>{const n=Ul(e);return{name:n.name,fn:n.fn,options:[e,t]}},ru=(e,t)=>{const n=Xl(e);return{name:n.name,fn:n.fn,options:[e,t]}};var ou=Object.defineProperty,su=(e,t)=>ou(e,"name",{value:t,configurable:!0});function Nr(e){const[t,n]=c.useState(void 0);return oe(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let a,l;if("borderBoxSize"in s){const u=s.borderBoxSize,f=Array.isArray(u)?u[0]:u;a=f.inlineSize,l=f.blockSize}else a=e.offsetWidth,l=e.offsetHeight;n({width:a,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}su(Nr,"useSize");var iu=Object.defineProperty,Ge=(e,t)=>iu(e,"name",{value:t,configurable:!0}),ks="Popper",[Ms,$s]=Pe(ks),[au,Fs]=Ms(ks),cu=Ge(e=>{const{__scopePopper:t,children:n}=e,[r,o]=c.useState(null),[s,a]=c.useState(void 0);return i.jsx(au,{scope:t,anchor:r,onAnchorChange:o,placementState:s,setPlacementState:a,children:n})},"Popper"),lu="PopperAnchor",uu=c.forwardRef(Ge(function(t,n){const{__scopePopper:r,virtualRef:o,...s}=t,a=Fs(lu,r),l=c.useRef(null),u=a.onAnchorChange,f=c.useCallback(v=>{l.current=v,v&&u(v)},[u]),p=ne(n,f),d=c.useRef(null);c.useEffect(()=>{if(!o)return;const v=d.current;d.current=o.current,v!==d.current&&u(d.current)});const h=a.placementState&&xn(a.placementState),x=h?.[0],g=h?.[1];return o?null:i.jsx(H.div,{"data-radix-popper-side":x,"data-radix-popper-align":g,...s,ref:p})},"PopperAnchor")),Ls="PopperContent",[du,Zf]=Ms(Ls),fu=c.forwardRef(Ge(function(t,n){const{__scopePopper:r,side:o="bottom",sideOffset:s=0,align:a="center",alignOffset:l=0,arrowPadding:u=0,avoidCollisions:f=!0,collisionBoundary:p=[],collisionPadding:d=0,sticky:h="partial",hideWhenDetached:x=!1,updatePositionStrategy:g="optimized",onPlaced:v,...m}=t,C=Fs(Ls,r),[b,y]=c.useState(null),w=ne(n,y),[R,S]=c.useState(null),P=Nr(R),I=P?.width??0,N=P?.height??0,A=o+(a!=="center"?"-"+a:""),_=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},T=Array.isArray(p)?p:[p],D=T.length>0,$={padding:_,boundary:T.filter(Bs),altBoundary:D},{refs:K,floatingStyles:L,placement:k,isPositioned:F,middlewareData:U}=ql({strategy:"fixed",placement:A,whileElementsMounted:Ge((...q)=>Ll(...q,{animationFrame:g==="always"}),"whileElementsMounted"),elements:{reference:C.anchor},middleware:[Zl({mainAxis:s+N,alignmentAxis:l}),f&&Jl({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?Ql():void 0,...$}),f&&eu({...$}),tu({...$,apply:Ge(({elements:q,rects:ee,availableWidth:W,availableHeight:X})=>{const{width:te,height:xe}=ee.reference,le=q.floating.style;le.setProperty("--radix-popper-available-width",`${W}px`),le.setProperty("--radix-popper-available-height",`${X}px`),le.setProperty("--radix-popper-anchor-width",`${te}px`),le.setProperty("--radix-popper-anchor-height",`${xe}px`)},"apply")}),R&&ru({element:R,padding:u}),pu({arrowWidth:I,arrowHeight:N}),x&&nu({strategy:"referenceHidden",...$,boundary:D?$.boundary:void 0})]}),V=C.setPlacementState;oe(()=>(V(k),()=>{V(void 0)}),[k,V]);const[we,G]=xn(k),ae=Ee(v);oe(()=>{F&&ae?.()},[F,ae]);const me=U.arrow?.x,he=U.arrow?.y,We=U.arrow?.centerOffset!==0,[ve,M]=c.useState();return oe(()=>{b&&M(window.getComputedStyle(b).zIndex)},[b]),i.jsx("div",{ref:K.setFloating,"data-radix-popper-content-wrapper":"",style:{...L,transform:F?L.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ve,"--radix-popper-transform-origin":[U.transformOrigin?.x,U.transformOrigin?.y].join(" "),...U.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:i.jsx(du,{scope:r,placedSide:we,placedAlign:G,onArrowChange:S,arrowX:me,arrowY:he,shouldHideArrow:We,children:i.jsx(H.div,{"data-side":we,"data-align":G,...m,ref:w,style:{...m.style,animation:F?m.style?.animation:"none"}})})})},"PopperContent"));function Bs(e){return e!==null}Ge(Bs,"isNotNull");var pu=Ge(e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,a=o.arrow?.centerOffset!==0,l=a?0:e.arrowWidth,u=a?0:e.arrowHeight,[f,p]=xn(n),d={start:"0%",center:"50%",end:"100%"}[p],h=(o.arrow?.x??0)+l/2,x=(o.arrow?.y??0)+u/2;let g="",v="";return f==="bottom"?(g=a?d:`${h}px`,v=`${-u}px`):f==="top"?(g=a?d:`${h}px`,v=`${r.floating.height+u}px`):f==="right"?(g=`${-u}px`,v=a?d:`${x}px`):f==="left"&&(g=`${r.floating.width+u}px`,v=a?d:`${x}px`),{data:{x:g,y:v}}}}),"transformOrigin");function xn(e){const[t,n="center"]=e.split("-");return[t,n]}Ge(xn,"getSideAndAlignFromPlacement");var mu=cu,hu=uu,vu=fu,gu=Object.defineProperty,xu=(e,t)=>gu(e,"name",{value:t,configurable:!0}),zs=c.forwardRef(xu(function(t,n){const{container:r,...o}=t,[s,a]=c.useState(!1);oe(()=>a(!0),[]);const l=r||s&&globalThis?.document?.body;return l?Tt.createPortal(i.jsx(H.div,{...o,ref:n}),l):null},"Portal")),bu=Object.defineProperty,yu=(e,t)=>bu(e,"name",{value:t,configurable:!0});function Vs(e){const t=c.useRef({value:e,previous:e});return c.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}yu(Vs,"usePrevious");var wu=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Cu=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},lt=new WeakMap,Wt=new WeakMap,Kt={},Mn=0,Hs=function(e){return e&&(e.host||Hs(e.parentNode))},Su=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Hs(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Ru=function(e,t,n,r){var o=Su(t,Array.isArray(e)?e:[e]);Kt[n]||(Kt[n]=new WeakMap);var s=Kt[n],a=[],l=new Set,u=new Set(o),f=function(d){!d||l.has(d)||(l.add(d),f(d.parentNode))};o.forEach(f);var p=function(d){!d||u.has(d)||Array.prototype.forEach.call(d.children,function(h){if(l.has(h))p(h);else try{var x=h.getAttribute(r),g=x!==null&&x!=="false",v=(lt.get(h)||0)+1,m=(s.get(h)||0)+1;lt.set(h,v),s.set(h,m),a.push(h),v===1&&g&&Wt.set(h,!0),m===1&&h.setAttribute(n,"true"),g||h.setAttribute(r,"true")}catch(C){console.error("aria-hidden: cannot operate on ",h,C)}})};return p(t),l.clear(),Mn++,function(){a.forEach(function(d){var h=lt.get(d)-1,x=s.get(d)-1;lt.set(d,h),s.set(d,x),h||(Wt.has(d)||d.removeAttribute(r),Wt.delete(d)),x||d.removeAttribute(n)}),Mn--,Mn||(lt=new WeakMap,lt=new WeakMap,Wt=new WeakMap,Kt={})}},Us=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=Cu(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),Ru(r,o,n,"aria-hidden")):function(){return null}},je=function(){return je=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},je.apply(this,arguments)};function Ws(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function Eu(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r<o;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var Jt="right-scroll-bar-position",Qt="width-before-scroll-bar",Pu="with-scroll-bars-hidden",ju="--removed-body-scroll-bar-size";function $n(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Nu(e,t){var n=c.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var Iu=typeof window<"u"?c.useLayoutEffect:c.useEffect,No=new WeakMap;function Au(e,t){var n=Nu(null,function(r){return e.forEach(function(o){return $n(o,r)})});return Iu(function(){var r=No.get(n);if(r){var o=new Set(r),s=new Set(e),a=n.current;o.forEach(function(l){s.has(l)||$n(l,null)}),s.forEach(function(l){o.has(l)||$n(l,a)})}No.set(n,e)},[e]),n}function Tu(e){return e}function Ou(e,t){t===void 0&&(t=Tu);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var a=t(s,r);return n.push(a),function(){n=n.filter(function(l){return l!==a})}},assignSyncMedium:function(s){for(r=!0;n.length;){var a=n;n=[],a.forEach(s)}n={push:function(l){return s(l)},filter:function(){return n}}},assignMedium:function(s){r=!0;var a=[];if(n.length){var l=n;n=[],l.forEach(s),a=n}var u=function(){var p=a;a=[],p.forEach(s)},f=function(){return Promise.resolve().then(u)};f(),n={push:function(p){a.push(p),f()},filter:function(p){return a=a.filter(p),n}}}};return o}function _u(e){e===void 0&&(e={});var t=Ou(null);return t.options=je({async:!0,ssr:!1},e),t}var Ks=function(e){var t=e.sideCar,n=Ws(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return c.createElement(r,je({},n))};Ks.isSideCarExport=!0;function Du(e,t){return e.useMedium(t),Ks}var Gs=_u(),Fn=function(){},bn=c.forwardRef(function(e,t){var n=c.useRef(null),r=c.useState({onScrollCapture:Fn,onWheelCapture:Fn,onTouchMoveCapture:Fn}),o=r[0],s=r[1],a=e.forwardProps,l=e.children,u=e.className,f=e.removeScrollBar,p=e.enabled,d=e.shards,h=e.sideCar,x=e.noRelative,g=e.noIsolation,v=e.inert,m=e.allowPinchZoom,C=e.as,b=C===void 0?"div":C,y=e.gapMode,w=Ws(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),R=h,S=Au([n,t]),P=je(je({},w),o);return c.createElement(c.Fragment,null,p&&c.createElement(R,{sideCar:Gs,removeScrollBar:f,shards:d,noRelative:x,noIsolation:g,inert:v,setCallbacks:s,allowPinchZoom:!!m,lockRef:n,gapMode:y}),a?c.cloneElement(c.Children.only(l),je(je({},P),{ref:S})):c.createElement(b,je({},P,{className:u,ref:S}),l))});bn.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};bn.classNames={fullWidth:Qt,zeroRight:Jt};var ku=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Mu(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=ku();return t&&e.setAttribute("nonce",t),e}function $u(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Fu(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Lu=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Mu())&&($u(t,n),Fu(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Bu=function(){var e=Lu();return function(t,n){c.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Ys=function(){var e=Bu(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},zu={left:0,top:0,right:0,gap:0},Ln=function(e){return parseInt(e||"",10)||0},Vu=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Ln(n),Ln(r),Ln(o)]},Hu=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return zu;var t=Vu(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Uu=Ys(),ht="data-scroll-locked",Wu=function(e,t,n,r){var o=e.left,s=e.top,a=e.right,l=e.gap;return n===void 0&&(n="margin"),`
2
- .`.concat(Pu,` {
3
- overflow: hidden `).concat(r,`;
4
- padding-right: `).concat(l,"px ").concat(r,`;
5
- }
6
- body[`).concat(ht,`] {
7
- overflow: hidden `).concat(r,`;
8
- overscroll-behavior: contain;
9
- `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
10
- padding-left: `.concat(o,`px;
11
- padding-top: `).concat(s,`px;
12
- padding-right: `).concat(a,`px;
13
- margin-left:0;
14
- margin-top:0;
15
- margin-right: `).concat(l,"px ").concat(r,`;
16
- `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
17
- }
18
-
19
- .`).concat(Jt,` {
20
- right: `).concat(l,"px ").concat(r,`;
21
- }
22
-
23
- .`).concat(Qt,` {
24
- margin-right: `).concat(l,"px ").concat(r,`;
25
- }
26
-
27
- .`).concat(Jt," .").concat(Jt,` {
28
- right: 0 `).concat(r,`;
29
- }
30
-
31
- .`).concat(Qt," .").concat(Qt,` {
32
- margin-right: 0 `).concat(r,`;
33
- }
34
-
35
- body[`).concat(ht,`] {
36
- `).concat(ju,": ").concat(l,`px;
37
- }
38
- `)},Io=function(){var e=parseInt(document.body.getAttribute(ht)||"0",10);return isFinite(e)?e:0},Ku=function(){c.useEffect(function(){return document.body.setAttribute(ht,(Io()+1).toString()),function(){var e=Io()-1;e<=0?document.body.removeAttribute(ht):document.body.setAttribute(ht,e.toString())}},[])},Gu=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;Ku();var s=c.useMemo(function(){return Hu(o)},[o]);return c.createElement(Uu,{styles:Wu(s,!t,o,n?"":"!important")})},tr=!1;if(typeof window<"u")try{var Gt=Object.defineProperty({},"passive",{get:function(){return tr=!0,!0}});window.addEventListener("test",Gt,Gt),window.removeEventListener("test",Gt,Gt)}catch{tr=!1}var ut=tr?{passive:!1}:!1,Yu=function(e){return e.tagName==="TEXTAREA"},qs=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Yu(e)&&n[t]==="visible")},qu=function(e){return qs(e,"overflowY")},Xu=function(e){return qs(e,"overflowX")},Ao=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=Xs(e,r);if(o){var s=Zs(e,r),a=s[1],l=s[2];if(a>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Zu=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Ju=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Xs=function(e,t){return e==="v"?qu(t):Xu(t)},Zs=function(e,t){return e==="v"?Zu(t):Ju(t)},Qu=function(e,t){return e==="h"&&t==="rtl"?-1:1},ed=function(e,t,n,r,o){var s=Qu(e,window.getComputedStyle(t).direction),a=s*r,l=n.target,u=t.contains(l),f=!1,p=a>0,d=0,h=0;do{if(!l)break;var x=Zs(e,l),g=x[0],v=x[1],m=x[2],C=v-m-s*g;(g||C)&&Xs(e,l)&&(d+=C,h+=g);var b=l.parentNode;l=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!u&&l!==document.body||u&&(t.contains(l)||t===l));return(p&&Math.abs(d)<1||!p&&Math.abs(h)<1)&&(f=!0),f},Yt=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},To=function(e){return[e.deltaX,e.deltaY]},Oo=function(e){return e&&"current"in e?e.current:e},td=function(e,t){return e[0]===t[0]&&e[1]===t[1]},nd=function(e){return`
39
- .block-interactivity-`.concat(e,` {pointer-events: none;}
40
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
41
- `)},rd=0,dt=[];function od(e){var t=c.useRef([]),n=c.useRef([0,0]),r=c.useRef(),o=c.useState(rd++)[0],s=c.useState(Ys)[0],a=c.useRef(e);c.useEffect(function(){a.current=e},[e]),c.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var v=Eu([e.lockRef.current],(e.shards||[]).map(Oo),!0).filter(Boolean);return v.forEach(function(m){return m.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),v.forEach(function(m){return m.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=c.useCallback(function(v,m){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!a.current.allowPinchZoom;var C=Yt(v),b=n.current,y="deltaX"in v?v.deltaX:b[0]-C[0],w="deltaY"in v?v.deltaY:b[1]-C[1],R,S=v.target,P=Math.abs(y)>Math.abs(w)?"h":"v";if("touches"in v&&P==="h"&&S.type==="range")return!1;var I=window.getSelection(),N=I&&I.anchorNode,A=N?N===S||N.contains(S):!1;if(A)return!1;var _=Ao(P,S);if(!_)return!0;if(_?R=P:(R=P==="v"?"h":"v",_=Ao(P,S)),!_)return!1;if(!r.current&&"changedTouches"in v&&(y||w)&&(r.current=R),!R)return!0;var T=r.current||R;return ed(T,m,v,T==="h"?y:w)},[]),u=c.useCallback(function(v){var m=v;if(!(!dt.length||dt[dt.length-1]!==s)){var C="deltaY"in m?To(m):Yt(m),b=t.current.filter(function(R){return R.name===m.type&&(R.target===m.target||m.target===R.shadowParent)&&td(R.delta,C)})[0];if(b&&b.should){m.cancelable&&m.preventDefault();return}if(!b){var y=(a.current.shards||[]).map(Oo).filter(Boolean).filter(function(R){return R.contains(m.target)}),w=y.length>0?l(m,y[0]):!a.current.noIsolation;w&&m.cancelable&&m.preventDefault()}}},[]),f=c.useCallback(function(v,m,C,b){var y={name:v,delta:m,target:C,should:b,shadowParent:sd(C)};t.current.push(y),setTimeout(function(){t.current=t.current.filter(function(w){return w!==y})},1)},[]),p=c.useCallback(function(v){n.current=Yt(v),r.current=void 0},[]),d=c.useCallback(function(v){f(v.type,To(v),v.target,l(v,e.lockRef.current))},[]),h=c.useCallback(function(v){f(v.type,Yt(v),v.target,l(v,e.lockRef.current))},[]);c.useEffect(function(){return dt.push(s),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:h}),document.addEventListener("wheel",u,ut),document.addEventListener("touchmove",u,ut),document.addEventListener("touchstart",p,ut),function(){dt=dt.filter(function(v){return v!==s}),document.removeEventListener("wheel",u,ut),document.removeEventListener("touchmove",u,ut),document.removeEventListener("touchstart",p,ut)}},[]);var x=e.removeScrollBar,g=e.inert;return c.createElement(c.Fragment,null,g?c.createElement(s,{styles:nd(o)}):null,x?c.createElement(Gu,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function sd(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const id=Du(Gs,od);var Ir=c.forwardRef(function(e,t){return c.createElement(bn,je({},e,{ref:t,sideCar:id}))});Ir.classNames=bn.classNames;var ad=Object.defineProperty,Y=(e,t)=>ad(e,"name",{value:t,configurable:!0}),cd=[" ","Enter","ArrowUp","ArrowDown"],ld=[" ","Enter"],vt="Select",[yn,Ar,ud]=cn(vt),[st,Jf]=Pe(vt,[ud,$s]),Tr=$s(),[dd,Je]=st(vt),[fd,pd]=st(vt);function Js(e){const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:s,value:a,defaultValue:l,onValueChange:u,dir:f,name:p,autoComplete:d,disabled:h,required:x,form:g,internal_do_not_use_render:v}=e,m=Tr(t),[C,b]=c.useState(null),[y,w]=c.useState(null),[R,S]=c.useState(!1),P=Dt(f),[I,N]=Ae({prop:r,defaultProp:o??!1,onChange:s,caller:vt}),[A,_]=Ae({prop:a,defaultProp:l,onChange:u,caller:vt}),T=c.useRef(null),D=c.useRef(A);c.useEffect(()=>{const G=g?C?.ownerDocument.getElementById(g):C?.form;if(G instanceof HTMLFormElement){const ae=Y(()=>_(D.current),"reset");return G.addEventListener("reset",ae),()=>G.removeEventListener("reset",ae)}},[g,C,_]);const $=C?!!g||!!C.closest("form"):!0,[K,L]=c.useState(new Set),k=Ie(),F=Array.from(K).map(G=>G.props.value).join(";"),U=c.useCallback(G=>{L(ae=>new Set(ae).add(G))},[]),V=c.useCallback(G=>{L(ae=>{const me=new Set(ae);return me.delete(G),me})},[]),we={required:x,trigger:C,onTriggerChange:b,valueNode:y,onValueNodeChange:w,valueNodeHasChildren:R,onValueNodeHasChildrenChange:S,contentId:k,value:A,onValueChange:_,open:I,onOpenChange:N,dir:P,triggerPointerDownPosRef:T,disabled:h,name:p,autoComplete:d,form:g,nativeOptions:K,nativeSelectKey:F,isFormControl:$};return i.jsx(mu,{...m,children:i.jsx(dd,{scope:t,...we,children:i.jsx(yn.Provider,{scope:t,children:i.jsx(fd,{scope:t,onNativeOptionAdd:U,onNativeOptionRemove:V,children:oi(v)?v(we):n})})})})}Y(Js,"SelectProvider");var md=Y(e=>{const{__scopeSelect:t,children:n,...r}=e;return i.jsx(Js,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:o})=>i.jsxs(i.Fragment,{children:[n,o?i.jsx(Md,{__scopeSelect:t}):null]})})},"Select"),hd="SelectTrigger",Qs=c.forwardRef(Y(function(t,n){const{__scopeSelect:r,disabled:o=!1,...s}=t,a=Tr(r),l=Je(hd,r),u=l.disabled||o,f=ne(n,l.onTriggerChange),p=Ar(r),d=c.useRef("touch"),[h,x,g]=Or(m=>{const C=p().filter(w=>!w.disabled),b=C.find(w=>w.value===l.value),y=_r(C,m,b);y!==void 0&&l.onValueChange(y.value)}),v=Y(m=>{u||(l.onOpenChange(!0),g()),m&&(l.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})},"handleOpen");return i.jsx(hu,{asChild:!0,...a,children:i.jsx(H.button,{type:"button",role:"combobox","aria-controls":l.open?l.contentId:void 0,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:u,"data-disabled":u?"":void 0,"data-placeholder":kt(l.value)?"":void 0,...s,ref:f,onClick:z(s.onClick,m=>{m.currentTarget.focus(),d.current!=="mouse"&&v(m)}),onPointerDown:z(s.onPointerDown,m=>{d.current=m.pointerType;const C=m.target;C.hasPointerCapture(m.pointerId)&&C.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(v(m),m.preventDefault())}),onKeyDown:z(s.onKeyDown,m=>{const C=h.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&x(m.key),!(C&&m.key===" ")&&cd.includes(m.key)&&(v(),m.preventDefault())})})})},"SelectTrigger")),vd="SelectValue",gd=c.forwardRef(Y(function(t,n){const{__scopeSelect:r,className:o,style:s,children:a,placeholder:l="",...u}=t,f=Je(vd,r),{onValueNodeHasChildrenChange:p}=f,d=a!==void 0,h=ne(n,f.onValueNodeChange);oe(()=>{p(d)},[p,d]);const x=kt(f.value);return i.jsx(H.span,{...u,asChild:x?!1:u.asChild,ref:h,style:{pointerEvents:"none"},children:i.jsx(c.Fragment,{children:x?l:a},x?"placeholder":"value")})},"SelectValue")),xd=c.forwardRef(Y(function(t,n){const{__scopeSelect:r,children:o,...s}=t;return i.jsx(H.span,{"aria-hidden":!0,...s,ref:n,children:o||"▼"})},"SelectIcon")),bd="SelectPortal",[yd,wd]=st(bd,{forceMount:void 0}),Cd=Y(e=>{const{__scopeSelect:t,forceMount:n,...r}=e;return i.jsx(yd,{scope:e.__scopeSelect,forceMount:n,children:i.jsx(zs,{asChild:!0,...r})})},"SelectPortal"),ot="SelectContent",ei=c.forwardRef(Y(function(t,n){const r=wd(ot,t.__scopeSelect),{forceMount:o=r.forceMount,...s}=t,a=Je(ot,t.__scopeSelect),[l,u]=c.useState();return oe(()=>{u(new DocumentFragment)},[]),i.jsx(xt,{present:o||a.open,children:({present:f})=>f?i.jsx(Ed,{...s,ref:n}):i.jsx(Sd,{...s,fragment:l})})},"SelectContent")),Sd=c.forwardRef(Y(function(t,n){const{__scopeSelect:r,children:o,fragment:s}=t;return s?Tt.createPortal(i.jsx(ti,{scope:r,children:i.jsx(yn.Slot,{scope:r,children:i.jsx("div",{ref:n,children:o})})}),s):null},"SelectContentFragment")),Re=10,[ti,wn]=st(ot),Rd=tt("SelectContent.RemoveScroll"),Ed=c.forwardRef(Y(function(t,n){const{__scopeSelect:r}=t,{position:o="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:a,onPointerDownOutside:l,side:u,sideOffset:f,align:p,alignOffset:d,arrowPadding:h,collisionBoundary:x,collisionPadding:g,sticky:v,hideWhenDetached:m,avoidCollisions:C,...b}=t,y=Je(ot,r),[w,R]=c.useState(null),[S,P]=c.useState(null),I=ne(n,R),[N,A]=c.useState(null),[_,T]=c.useState(null),D=Ar(r),[$,K]=c.useState(!1),L=c.useRef(!1);c.useEffect(()=>{if(w)return Us(w)},[w]),fn();const k=c.useCallback(M=>{const[q,...ee]=D().map(te=>te.ref.current),[W]=ee.slice(-1),X=document.activeElement;for(const te of M)if(te===X||(te?.scrollIntoView({block:"nearest"}),te===q&&S&&(S.scrollTop=0),te===W&&S&&(S.scrollTop=S.scrollHeight),te?.focus(),document.activeElement!==X))return},[D,S]),F=c.useCallback(()=>k([N,w]),[k,N,w]);c.useEffect(()=>{$&&F()},[$,F]);const{onOpenChange:U,triggerPointerDownPosRef:V}=y;c.useEffect(()=>{if(w){let M={x:0,y:0};const q=Y(W=>{M={x:Math.abs(Math.round(W.pageX)-(V.current?.x??0)),y:Math.abs(Math.round(W.pageY)-(V.current?.y??0))}},"handlePointerMove"),ee=Y(W=>{M.x<=10&&M.y<=10?W.preventDefault():W.composedPath().includes(w)||U(!1),document.removeEventListener("pointermove",q),V.current=null},"handlePointerUp");return V.current!==null&&(document.addEventListener("pointermove",q),document.addEventListener("pointerup",ee,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",q),document.removeEventListener("pointerup",ee,{capture:!0})}}},[w,U,V]),c.useEffect(()=>{const M=Y(()=>U(!1),"close");return window.addEventListener("blur",M),window.addEventListener("resize",M),()=>{window.removeEventListener("blur",M),window.removeEventListener("resize",M)}},[U]);const[we,G]=Or(M=>{const q=D().filter(X=>!X.disabled),ee=q.find(X=>X.ref.current===document.activeElement),W=_r(q,M,ee);W&&setTimeout(()=>W.ref.current?.focus())}),ae=c.useCallback((M,q,ee)=>{const W=!L.current&&!ee;(y.value!==void 0&&y.value===q||W)&&(A(M),W&&(L.current=!0))},[y.value]),me=c.useCallback(()=>w?.focus(),[w]),he=c.useCallback((M,q,ee)=>{const W=!L.current&&!ee;(y.value!==void 0&&y.value===q||W)&&T(M)},[y.value]),We=o==="popper"?_o:Pd,ve=We===_o?{side:u,sideOffset:f,align:p,alignOffset:d,arrowPadding:h,collisionBoundary:x,collisionPadding:g,sticky:v,hideWhenDetached:m,avoidCollisions:C}:{};return i.jsx(ti,{scope:r,content:w,viewport:S,onViewportChange:P,itemRefCallback:ae,selectedItem:N,onItemLeave:me,itemTextRefCallback:he,focusSelectedItem:F,selectedItemText:_,position:o,isPositioned:$,searchRef:we,children:i.jsx(Ir,{as:Rd,allowPinchZoom:!0,children:i.jsx(gs,{asChild:!0,trapped:y.open,onMountAutoFocus:M=>{M.preventDefault()},onUnmountAutoFocus:z(s,M=>{y.trigger?.focus({preventScroll:!0}),M.preventDefault()}),children:i.jsx(ps,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:M=>M.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:i.jsx(We,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:M=>M.preventDefault(),...b,...ve,onPlaced:()=>K(!0),ref:I,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:z(b.onKeyDown,M=>{const q=M.ctrlKey||M.altKey||M.metaKey;if(M.key==="Tab"&&M.preventDefault(),!q&&M.key.length===1&&G(M.key),["ArrowUp","ArrowDown","Home","End"].includes(M.key)){let W=D().filter(X=>!X.disabled).map(X=>X.ref.current);if(["ArrowUp","End"].includes(M.key)&&(W=W.slice().reverse()),["ArrowUp","ArrowDown"].includes(M.key)){const X=M.target,te=W.indexOf(X);W=W.slice(te+1)}setTimeout(()=>k(W)),M.preventDefault()}})})})})})})},"SelectContentImpl")),Pd=c.forwardRef(Y(function(t,n){const{__scopeSelect:r,onPlaced:o,...s}=t,a=Je(ot,r),l=wn(ot,r),[u,f]=c.useState(null),[p,d]=c.useState(null),h=ne(n,d),x=Ar(r),g=c.useRef(!1),v=c.useRef(!0),{viewport:m,selectedItem:C,selectedItemText:b,focusSelectedItem:y}=l,w=c.useCallback(()=>{if(a.trigger&&a.valueNode&&u&&p&&m&&C&&b){const I=a.trigger.getBoundingClientRect(),N=p.getBoundingClientRect(),A=a.valueNode.getBoundingClientRect(),_=b.getBoundingClientRect();if(a.dir!=="rtl"){const X=_.left-N.left,te=A.left-X,xe=I.left-te,le=I.width+xe,Me=Math.max(le,N.width),Ke=window.innerWidth-Re,at=Gn(te,[Re,Math.max(Re,Ke-Me)]);u.style.minWidth=le+"px",u.style.left=at+"px"}else{const X=N.right-_.right,te=window.innerWidth-A.right-X,xe=window.innerWidth-I.right-te,le=I.width+xe,Me=Math.max(le,N.width),Ke=window.innerWidth-Re,at=Gn(te,[Re,Math.max(Re,Ke-Me)]);u.style.minWidth=le+"px",u.style.right=at+"px"}const T=x(),D=window.innerHeight-Re*2,$=m.scrollHeight,K=window.getComputedStyle(p),L=parseInt(K.borderTopWidth,10),k=parseInt(K.paddingTop,10),F=parseInt(K.borderBottomWidth,10),U=parseInt(K.paddingBottom,10),V=L+k+$+U+F,we=Math.min(C.offsetHeight*5,V),G=window.getComputedStyle(m),ae=parseInt(G.paddingTop,10),me=parseInt(G.paddingBottom,10),he=I.top+I.height/2-Re,We=D-he,ve=C.offsetHeight/2,M=C.offsetTop+ve,q=L+k+M,ee=V-q;if(q<=he){const X=T.length>0&&C===T[T.length-1].ref.current;u.style.bottom="0px";const te=p.clientHeight-m.offsetTop-m.offsetHeight,xe=Math.max(We,ve+(X?me:0)+te+F),le=q+xe;u.style.height=le+"px"}else{const X=T.length>0&&C===T[0].ref.current;u.style.top="0px";const xe=Math.max(he,L+m.offsetTop+(X?ae:0)+ve)+ee;u.style.height=xe+"px",m.scrollTop=q-he+m.offsetTop}u.style.margin=`${Re}px 0`,u.style.minHeight=we+"px",u.style.maxHeight=D+"px",o?.(),requestAnimationFrame(()=>g.current=!0)}},[x,a.trigger,a.valueNode,u,p,m,C,b,a.dir,o]);oe(()=>w(),[w]);const[R,S]=c.useState();oe(()=>{p&&S(window.getComputedStyle(p).zIndex)},[p]);const P=c.useCallback(I=>{I&&v.current===!0&&(w(),y?.(),v.current=!1)},[w,y]);return i.jsx(jd,{scope:r,contentWrapper:u,shouldExpandOnScrollRef:g,onScrollButtonChange:P,children:i.jsx("div",{ref:f,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:R},children:i.jsx(H.div,{...s,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})},"SelectItemAlignedPosition")),_o=c.forwardRef(Y(function(t,n){const{__scopeSelect:r,align:o="start",collisionPadding:s=Re,...a}=t,l=Tr(r);return i.jsx(vu,{...l,...a,ref:n,align:o,collisionPadding:s,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})},"SelectPopperPosition")),[jd,Nd]=st(ot,{}),Do="SelectViewport",Id=c.forwardRef(Y(function(t,n){const{__scopeSelect:r,nonce:o,...s}=t,a=wn(Do,r),l=Nd(Do,r),u=ne(n,a.onViewportChange),f=c.useRef(0);return i.jsxs(i.Fragment,{children:[i.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),i.jsx(yn.Slot,{scope:r,children:i.jsx(H.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:z(s.onScroll,p=>{const d=p.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:x}=l;if(x?.current&&h){const g=Math.abs(f.current-d.scrollTop);if(g>0){const v=window.innerHeight-Re*2,m=parseFloat(h.style.minHeight),C=parseFloat(h.style.height),b=Math.max(m,C);if(b<v){const y=b+g,w=Math.min(v,y),R=y-w;h.style.height=w+"px",h.style.bottom==="0px"&&(d.scrollTop=R>0?R:0,h.style.justifyContent="flex-end")}}}f.current=d.scrollTop})})})]})},"SelectViewport")),Ad="SelectGroup",[Qf,ep]=st(Ad),nr="SelectItem",[Td,ni]=st(nr),ri=c.forwardRef(Y(function(t,n){const{__scopeSelect:r,value:o,disabled:s=!1,textValue:a,...l}=t,u=Je(nr,r),f=wn(nr,r),p=u.value===o,[d,h]=c.useState(a??""),[x,g]=c.useState(!1),v=Ee(w=>f.itemRefCallback?.(w,o,s)),m=ne(n,v),C=Ie(),b=c.useRef("touch"),y=Y(()=>{s||(u.onValueChange(o),u.onOpenChange(!1))},"handleSelect");return i.jsx(Td,{scope:r,value:o,disabled:s,textId:C,isSelected:p,onItemTextChange:c.useCallback(w=>{h(R=>R||(w?.textContent??"").trim())},[]),children:i.jsx(yn.ItemSlot,{scope:r,value:o,disabled:s,textValue:d,children:i.jsx(H.div,{role:"option","aria-labelledby":C,"data-highlighted":x?"":void 0,"aria-selected":p&&x,"data-state":p?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...l,ref:m,onFocus:z(l.onFocus,()=>g(!0)),onBlur:z(l.onBlur,()=>g(!1)),onClick:z(l.onClick,()=>{b.current!=="mouse"&&y()}),onPointerUp:z(l.onPointerUp,()=>{b.current==="mouse"&&y()}),onPointerDown:z(l.onPointerDown,w=>{b.current=w.pointerType}),onPointerMove:z(l.onPointerMove,w=>{b.current=w.pointerType,s?f.onItemLeave?.():b.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:z(l.onPointerLeave,w=>{w.currentTarget===document.activeElement&&f.onItemLeave?.()}),onKeyDown:z(l.onKeyDown,w=>{s||w.target!==w.currentTarget||f.searchRef?.current!==""&&w.key===" "||(ld.includes(w.key)&&y(),w.key===" "&&w.preventDefault())})})})})},"SelectItem")),qt="SelectItemText",Od=c.forwardRef(Y(function(t,n){const{__scopeSelect:r,className:o,style:s,...a}=t,l=Je(qt,r),u=wn(qt,r),f=ni(qt,r),p=pd(qt,r),[d,h]=c.useState(null),x=Ee(y=>u.itemTextRefCallback?.(y,f.value,f.disabled)),g=ne(n,h,f.onItemTextChange,x),v=d?.textContent,m=c.useMemo(()=>i.jsx("option",{value:f.value,disabled:f.disabled,children:v},f.value),[f.disabled,f.value,v]),{onNativeOptionAdd:C,onNativeOptionRemove:b}=p;return oe(()=>(C(m),()=>b(m)),[C,b,m]),i.jsxs(i.Fragment,{children:[i.jsx(H.span,{id:f.textId,...a,ref:g}),f.isSelected&&l.valueNode&&!l.valueNodeHasChildren&&!kt(l.value)?Tt.createPortal(a.children,l.valueNode):null]})},"SelectItemText")),_d="SelectItemIndicator",Dd=c.forwardRef(Y(function(t,n){const{__scopeSelect:r,...o}=t;return ni(_d,r).isSelected?i.jsx(H.span,{"aria-hidden":!0,...o,ref:n}):null},"SelectItemIndicator")),kd="SelectBubbleInput",Md=c.forwardRef(Y(function({__scopeSelect:t,...n},r){const o=Je(kd,t),{value:s,onValueChange:a,required:l,disabled:u,name:f,autoComplete:p,form:d}=o,{nativeOptions:h,nativeSelectKey:x}=o,g=c.useRef(null),v=ne(r,g),m=s??"",C=Vs(m),b=Array.from(h).some(y=>(y.props.value??"")==="");return c.useEffect(()=>{const y=g.current;if(!y)return;const w=window.HTMLSelectElement.prototype,S=Object.getOwnPropertyDescriptor(w,"value").set;if(C!==m&&S){const P=new Event("change",{bubbles:!0});S.call(y,m),y.dispatchEvent(P)}},[C,m]),i.jsxs(H.select,{"aria-hidden":!0,required:l,tabIndex:-1,name:f,autoComplete:p,disabled:u,form:d,onChange:y=>a(y.target.value),...n,style:{...wu,...n.style},ref:v,defaultValue:m,children:[kt(s)&&!b?i.jsx("option",{value:""}):null,Array.from(h)]},x)},"SelectBubbleInput"));function oi(e){return typeof e=="function"}Y(oi,"isFunction");function kt(e){return e===""||e===void 0}Y(kt,"shouldShowPlaceholder");function Or(e){const t=Ee(e),n=c.useRef(""),r=c.useRef(0),o=c.useCallback(a=>{const l=n.current+a;t(l),Y((function u(f){n.current=f,window.clearTimeout(r.current),f!==""&&(r.current=window.setTimeout(()=>u(""),1e3))}),"updateSearch")(l)},[t]),s=c.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return c.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,s]}Y(Or,"useTypeaheadSearch");function _r(e,t,n){const o=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let a=si(e,Math.max(s,0));o.length===1&&(a=a.filter(f=>f!==n));const u=a.find(f=>f.textValue.toLowerCase().startsWith(o.toLowerCase()));return u!==n?u:void 0}Y(_r,"findNextItem");function si(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Y(si,"wrapArray");const $d=md,Fd=gd,ii=c.forwardRef(({className:e,children:t,...n},r)=>i.jsxs(Qs,{ref:r,className:Q("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-popover px-3 py-2 text-sm shadow-sm focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,i.jsx(xd,{asChild:!0,children:i.jsx($o,{className:"h-4 w-4 opacity-50"})})]}));ii.displayName=Qs.displayName;const ai=c.forwardRef(({className:e,children:t,position:n="popper",...r},o)=>i.jsx(Cd,{children:i.jsx(ei,{ref:o,className:Q("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1",e),position:n,...r,children:i.jsx(Id,{className:Q("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t})})}));ai.displayName=ei.displayName;const en=c.forwardRef(({className:e,children:t,...n},r)=>i.jsxs(ri,{ref:r,className:Q("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[i.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:i.jsx(Dd,{children:i.jsx(ba,{className:"h-4 w-4"})})}),i.jsx(Od,{children:t})]}));en.displayName=ri.displayName;var Ld=Object.defineProperty,Xe=(e,t)=>Ld(e,"name",{value:t,configurable:!0}),Dr="Switch",[Bd,tp]=Pe(Dr),[zd,kr]=Bd(Dr);function ci(e){const{__scopeSwitch:t,checked:n,children:r,defaultChecked:o,disabled:s,form:a,name:l,onCheckedChange:u,required:f,value:p="on",internal_do_not_use_render:d}=e,[h,x]=Ae({prop:n,defaultProp:o??!1,onChange:u,caller:Dr}),[g,v]=c.useState(null),[m,C]=c.useState(null),b=c.useRef(!1),[y,w]=c.useReducer(P=>P+1,0),R=g?!!a||!!g.closest("form"):!0,S={checked:h,setChecked:x,disabled:s,control:g,setControl:v,name:l,form:a,value:p,hasConsumerStoppedPropagationRef:b,userInteractionCount:y,onUserInteraction:w,required:f,defaultChecked:o,isFormControl:R,bubbleInput:m,setBubbleInput:C};return i.jsx(zd,{scope:t,...S,children:ui(d)?d(S):r})}Xe(ci,"SwitchProvider");var Vd="SwitchTrigger",Hd=c.forwardRef(Xe(function({__scopeSwitch:t,onClick:n,...r},o){const{control:s,form:a,value:l,disabled:u,checked:f,required:p,setControl:d,setChecked:h,hasConsumerStoppedPropagationRef:x,onUserInteraction:g,isFormControl:v,bubbleInput:m}=kr(Vd,t),C=ne(o,d),b=c.useRef(f);return c.useEffect(()=>{const y=a?s?.ownerDocument.getElementById(a):s?.form;if(y instanceof HTMLFormElement){const w=Xe(()=>h(b.current),"reset");return y.addEventListener("reset",w),()=>y.removeEventListener("reset",w)}},[s,a,h]),i.jsx(H.button,{type:"button",role:"switch","aria-checked":f,"aria-required":p,"data-state":Mr(f),"data-disabled":u?"":void 0,disabled:u,value:l,...r,ref:C,onClick:z(n,y=>{g(),h(w=>!w),m&&v&&(x.current=y.isPropagationStopped(),x.current||y.stopPropagation())})})},"SwitchTrigger")),li=c.forwardRef(Xe(function(t,n){const{__scopeSwitch:r,name:o,checked:s,defaultChecked:a,required:l,disabled:u,value:f,onCheckedChange:p,form:d,...h}=t;return i.jsx(ci,{__scopeSwitch:r,checked:s,defaultChecked:a,disabled:u,required:l,onCheckedChange:p,name:o,form:d,value:f,internal_do_not_use_render:({isFormControl:x})=>i.jsxs(i.Fragment,{children:[i.jsx(Hd,{...h,ref:n,__scopeSwitch:r}),x&&i.jsx(Gd,{__scopeSwitch:r})]})})},"Switch")),Ud="SwitchThumb",Wd=c.forwardRef(Xe(function(t,n){const{__scopeSwitch:r,...o}=t,s=kr(Ud,r);return i.jsx(H.span,{"data-state":Mr(s.checked),"data-disabled":s.disabled?"":void 0,...o,ref:n})},"SwitchThumb")),Kd="SwitchBubbleInput",Gd=c.forwardRef(Xe(function({__scopeSwitch:t,onClick:n,...r},o){const{control:s,hasConsumerStoppedPropagationRef:a,userInteractionCount:l,checked:u,defaultChecked:f,required:p,disabled:d,name:h,value:x,form:g,bubbleInput:v,setBubbleInput:m}=kr(Kd,t),C=ne(o,m),b=Nr(s),y=c.useRef(!1),w=c.useRef(u),R=c.useRef(l);c.useEffect(()=>{const P=v;if(!P)return;const I=window.HTMLInputElement.prototype,A=Object.getOwnPropertyDescriptor(I,"checked").set,_=l!==R.current;R.current=l;const T=w.current!==u;w.current=u;const D=!(_&&a.current);if(T&&A){y.current=!_;const $=new Event("click",{bubbles:D});A.call(P,u),P.dispatchEvent($),y.current=!1}},[v,u,a,l]);const S=c.useRef(u);return i.jsx(H.input,{type:"checkbox","aria-hidden":!0,defaultChecked:f??S.current,required:p,disabled:d,name:h,value:x,form:g,...r,tabIndex:-1,ref:C,onClick:z(n,P=>{y.current&&P.stopPropagation()}),style:{...r.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function ui(e){return typeof e=="function"}Xe(ui,"isFunction");function Mr(e){return e?"checked":"unchecked"}Xe(Mr,"getState");const tn=c.forwardRef(({className:e,...t},n)=>i.jsx(li,{className:Q("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:i.jsx(Wd,{className:Q("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));tn.displayName=li.displayName;function Yd({frozen:e,values:t,defaults:n,candidates:r,candidatesPort:o,selectedIconRef:s,uploadedIconUrl:a,iconAnalysis:l,iconComposition:u,iconComposeError:f,iconBackground:p,iconScale:d,onIconBackgroundChange:h,onIconScaleChange:x,selectedTrayRef:g,uploadedTrayUrl:v,selectedPort:m,targetDirExists:C,onPickIconCandidate:b,onUploadIcon:y,onClearIcon:w,onPickTray:R,onUploadTray:S,onClearTray:P,onPatch:I,onConfirm:N}){return i.jsxs("section",{className:"rounded-xl border border-border bg-card p-4",children:[i.jsx(Ua,{values:t,defaults:n,frozen:e,iconCandidates:r,iconCandidatesPort:o,uploadedIconUrl:a,selectedIconRef:s,iconAnalysis:l,iconComposition:u,iconComposeError:f,iconBackground:p,iconScale:d,onIconBackgroundChange:h,onIconScaleChange:x,onPickIconCandidate:b,onUploadIcon:y,onClearIcon:w,onPatch:I}),i.jsx(ds,{type:"multiple",className:"mt-4 border-t border-border pt-1",children:i.jsxs(vr,{value:"advanced",className:"border-b-0",children:[i.jsx(gr,{children:"高级选项"}),i.jsxs(xr,{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[i.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border p-3",children:[i.jsx(tn,{id:"showStartupTerminal",checked:t.showStartupTerminal,disabled:e,onCheckedChange:A=>I({showStartupTerminal:A})}),i.jsxs("div",{children:[i.jsx(fe,{htmlFor:"showStartupTerminal",className:"text-foreground",children:"显示启动终端"}),i.jsxs("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:[i.jsx(nn,{className:"mr-0.5 inline size-3"}),"应用启动时打开独立终端窗口,实时显示命令的 PTY 输出(可交互)。"]})]})]}),i.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border p-3",children:[i.jsx(tn,{id:"showAddressBar",checked:t.showAddressBar,disabled:e,onCheckedChange:A=>I({showAddressBar:A})}),i.jsxs("div",{children:[i.jsx(fe,{htmlFor:"showAddressBar",className:"text-foreground",children:"显示地址栏"}),i.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:"服务窗口顶部显示地址栏(Web Navigation API 管理导航)。"})]})]})]}),i.jsxs("div",{children:[i.jsx(fe,{children:"托盘图标"}),i.jsx("p",{className:"mb-1.5 mt-0.5 text-[11px] text-muted-foreground",children:"默认与应用图标一致;纯色候选适合系统托盘(macOS 模板风格)。"}),i.jsx(Wa,{candidates:r,port:o,disabled:e,selectedRef:g,uploadedUrl:v,includeVariants:!0,defaultLabel:"默认跟随应用图标",onPick:R,onUpload:S,onClear:P})]}),i.jsxs("div",{children:[i.jsx(fe,{htmlFor:"pm",children:"包管理器"}),i.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] leading-relaxed text-muted-foreground",children:"仅为生成的应用安装依赖时使用的工具(决定 install 命令与锁文件形态),不影响应用本身的运行方式——生成的应用始终以 Node 启动。默认自动跟随你启动向导所用的包管理器,一般无需修改。"}),i.jsxs($d,{value:t.pm,disabled:e,onValueChange:A=>I({pm:A}),children:[i.jsx(ii,{id:"pm",className:"mt-0",children:i.jsx(Fd,{})}),i.jsxs(ai,{children:[i.jsx(en,{value:"npm",children:"npm"}),i.jsx(en,{value:"pnpm",children:"pnpm"}),i.jsx(en,{value:"bun",children:"bun"})]})]})]}),i.jsxs("div",{className:"rounded-lg border border-border p-3",children:[i.jsx(fe,{children:"生成位置"}),i.jsx("p",{className:"mt-1 font-mono text-[11px] break-all text-muted-foreground",children:n.targetDir||"~/.opentray/create/<应用名>"}),i.jsx("p",{className:"mt-1.5 text-[11px] leading-relaxed text-muted-foreground",children:"生成的项目默认落在 OpenTray 主目录下,同一命令重复创建会落到同一位置; 也可在启动向导时通过位置参数指定其他目录。"}),C?i.jsx("p",{className:"mt-2 text-[11px] font-medium text-amber-400",children:"目标目录已存在且非空——继续生成会失败,或开启下方强制覆盖。"}):null,i.jsxs("div",{className:"mt-3 flex items-start gap-3",children:[i.jsx(tn,{id:"force-overwrite",checked:t.force,disabled:e,onCheckedChange:A=>I({force:A})}),i.jsxs("div",{children:[i.jsx(fe,{htmlFor:"force-overwrite",className:"text-foreground",children:"强制覆盖已存在的目录"}),i.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:"开启后将清空目标目录内的现有内容并重新生成(等同 --force)。请确认目录中没有你需要的文件。"})]})]})]})]})]})}),i.jsxs("div",{className:"mt-4 flex items-center gap-3",children:[i.jsx(de,{onClick:N,disabled:e,children:"确定创建应用"}),i.jsx("span",{className:"text-xs text-muted-foreground",children:m!==void 0?`已选服务 :${m}(点击状态栏服务可切换)`:"未运行也不影响:应用启动时会自行嗅探命令的监听端口"})]})]})}function qd({tags:e,onTagsChange:t,disabled:n=!1,placeholder:r,className:o,...s}){const[a,l]=c.useState(""),u=()=>{a.length!==0&&(t([...e,a]),l(""))};return i.jsxs("div",{className:Q("flex min-h-9 w-full flex-wrap items-center gap-1.5 rounded-md border border-input bg-transparent px-2 py-1.5 font-mono text-xs shadow-xs focus-within:border-ring",n&&"opacity-50",o),children:[e.map((f,p)=>i.jsxs("span",{className:"flex items-center gap-1 rounded bg-accent px-1.5 py-0.5 text-accent-foreground",children:[i.jsx("span",{className:"max-w-56 truncate",title:f,children:f}),n?null:i.jsx("button",{type:"button","aria-label":`移除参数 ${p+1}`,className:"text-muted-foreground hover:text-foreground",onClick:()=>{t(e.filter((d,h)=>h!==p))},children:i.jsx(Lo,{className:"size-3"})})]},`${p}:${f}`)),i.jsx("input",{className:"min-w-24 flex-1 bg-transparent font-mono text-xs outline-none placeholder:text-muted-foreground",value:a,disabled:n,placeholder:r??(e.length===0?"程序(如 npx)":"参数,回车添加"),onChange:f=>l(f.target.value),onKeyDown:f=>{if(f.key==="Enter"){f.preventDefault(),u();return}f.key==="Backspace"&&a.length===0&&e.length>0&&(f.preventDefault(),t(e.slice(0,-1)))},onBlur:u,...s})]})}function Xd({command:e,onCommandChange:t,argv:n,onArgvChange:r,runAlive:o,frozen:s,failedReason:a,commandOptions:l,defaultCwd:u,onCommandOptionsChange:f,onRun:p,onStop:d}){const h=x=>{f({...l,...x})};return i.jsxs("section",{className:"rounded-xl border border-border bg-card p-4",children:[i.jsxs("div",{className:"flex gap-2",children:[l.argsMode==="array"?i.jsx(qd,{tags:n,onTagsChange:r,disabled:o,"aria-label":"命令参数(argv)"}):i.jsx(et,{className:"font-mono",placeholder:"npx somecommand start --xx",value:e,disabled:o,onChange:x=>t(x.target.value),onKeyDown:x=>{x.key==="Enter"&&!o&&p()}}),o?i.jsxs(de,{variant:"destructive",onClick:d,"aria-label":"中断命令",children:[i.jsx(Aa,{}),"中断"]}):i.jsxs(de,{disabled:s,onClick:p,"aria-label":"运行命令",children:[i.jsx(Pa,{}),"运行"]})]}),a!==void 0?i.jsx("p",{className:"mt-2 font-mono text-xs text-red-400",children:a}):null,i.jsx(ds,{type:"multiple",defaultValue:["command"],className:"mt-3 border-t border-border pt-1",children:i.jsxs(vr,{value:"command",className:"border-b-0",children:[i.jsx(gr,{children:i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx(Na,{className:"size-4 text-muted-foreground"}),"命令选项"]})}),i.jsxs(xr,{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[i.jsxs("div",{children:[i.jsx(fe,{children:"参数输入模式"}),i.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"数组模式逐个输入参数(回车添加),原样传递、绝不拆分。"}),i.jsxs("div",{className:"flex gap-1.5",children:[i.jsx(de,{type:"button",size:"sm",variant:l.argsMode==="string"?"default":"outline",disabled:s,onClick:()=>h({argsMode:"string"}),children:"字符串"}),i.jsx(de,{type:"button",size:"sm",variant:l.argsMode==="array"?"default":"outline",disabled:s,onClick:()=>h({argsMode:"array"}),children:"数组 (argv)"})]})]}),i.jsxs("div",{children:[i.jsx(fe,{htmlFor:"cmd-cwd",children:"工作目录 (cwd)"}),i.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"留空使用用户主目录(下方完整路径);相对路径按主目录解析。"}),i.jsx(et,{id:"cmd-cwd",className:"mt-0 font-mono text-xs",disabled:s,value:l.cwd,placeholder:u.length>0?`默认:${u}`:"默认:用户主目录",title:u,onChange:x=>h({cwd:x.target.value})}),u.length>0&&l.cwd.trim().length===0?i.jsx("p",{className:"mt-1 font-mono text-[11px] break-all text-muted-foreground",children:u}):null]})]}),i.jsxs("div",{children:[i.jsx(fe,{children:"环境变量 (env)"}),i.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"启动命令时叠加在当前环境之上;同时写入生成的应用。"}),i.jsxs("div",{className:"space-y-1.5",children:[l.env.length===0?i.jsx("p",{className:"text-xs text-muted-foreground",children:"未配置"}):l.env.map((x,g)=>i.jsxs("div",{className:"flex gap-1.5",children:[i.jsx(et,{className:"font-mono text-xs",disabled:s,"aria-label":`env 名称 ${g+1}`,value:x.key,placeholder:"NAME",onChange:v=>{const m=[...l.env];m[g]={...x,key:v.target.value},h({env:m})}}),i.jsx(et,{className:"font-mono text-xs",disabled:s,"aria-label":`env 值 ${g+1}`,value:x.value,placeholder:"value",onChange:v=>{const m=[...l.env];m[g]={...x,value:v.target.value},h({env:m})}}),i.jsx(de,{type:"button",variant:"ghost",size:"iconSm",disabled:s,"aria-label":"删除环境变量",onClick:()=>{h({env:l.env.filter((v,m)=>m!==g)})},children:"×"})]},g)),i.jsxs(de,{type:"button",variant:"outline",size:"sm",disabled:s,onClick:()=>h({env:[...l.env,{key:"",value:""}]}),children:[i.jsx(nn,{className:"size-3.5"}),"添加变量"]})]})]})]})]})})]})}var Zd=Object.defineProperty,Se=(e,t)=>Zd(e,"name",{value:t,configurable:!0}),$r="Dialog",[di,np]=Pe($r),[Jd,ke]=di($r),Qd=Se(e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:a=!0}=e,l=c.useRef(null),u=c.useRef(null),[f,p]=Ae({prop:r,defaultProp:o??!1,onChange:s,caller:$r}),[d,h]=c.useState(0),[x,g]=c.useState(0);return i.jsx(Jd,{scope:t,triggerRef:l,contentRef:u,contentId:Ie(),titleId:Ie(),descriptionId:Ie(),titlePresent:d>0,descriptionPresent:x>0,setTitleCount:h,setDescriptionCount:g,open:f,onOpenChange:p,onOpenToggle:c.useCallback(()=>p(v=>!v),[p]),modal:a,children:n})},"Dialog"),fi="DialogPortal",[ef,pi]=di(fi,{forceMount:void 0}),tf=Se(e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,s=ke(fi,t);return i.jsx(ef,{scope:t,forceMount:n,children:c.Children.map(r,a=>i.jsx(xt,{present:n||s.open,children:i.jsx(zs,{asChild:!0,container:o,children:a})}))})},"DialogPortal"),rr="DialogOverlay",mi=c.forwardRef(Se(function(t,n){const r=pi(rr,t.__scopeDialog),{forceMount:o=r.forceMount,...s}=t,a=ke(rr,t.__scopeDialog);return a.modal?i.jsx(xt,{present:o||a.open,children:i.jsx(rf,{...s,ref:n})}):null},"DialogOverlay")),nf=tt("DialogOverlay.RemoveScroll"),rf=c.forwardRef(Se(function(t,n){const{__scopeDialog:r,...o}=t,s=ke(rr,r),a=ms(),l=ne(n,a);return i.jsx(Ir,{as:nf,allowPinchZoom:!0,shards:[s.contentRef],children:i.jsx(H.div,{"data-state":Fr(s.open),...o,ref:l,style:{pointerEvents:"auto",...o.style}})})},"DialogOverlayImpl")),It="DialogContent",hi=c.forwardRef(Se(function(t,n){const r=pi(It,t.__scopeDialog),{forceMount:o=r.forceMount,...s}=t,a=ke(It,t.__scopeDialog);return i.jsx(xt,{present:o||a.open,children:a.modal?i.jsx(of,{...s,ref:n}):i.jsx(sf,{...s,ref:n})})},"DialogContent")),of=c.forwardRef(Se(function(t,n){const r=ke(It,t.__scopeDialog),o=c.useRef(null),s=ne(n,r.contentRef,o);return c.useEffect(()=>{const a=o.current;if(a)return Us(a)},[]),i.jsx(vi,{...t,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:z(t.onCloseAutoFocus,a=>{a.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:z(t.onPointerDownOutside,a=>{const l=a.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0;(l.button===2||u)&&a.preventDefault()}),onFocusOutside:z(t.onFocusOutside,a=>a.preventDefault())})},"DialogContentModal")),sf=c.forwardRef(Se(function(t,n){const r=ke(It,t.__scopeDialog),o=c.useRef(!1),s=c.useRef(!1);return i.jsx(vi,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{t.onCloseAutoFocus?.(a),a.defaultPrevented||(o.current||r.triggerRef.current?.focus(),a.preventDefault()),o.current=!1,s.current=!1},onInteractOutside:a=>{t.onInteractOutside?.(a),a.defaultPrevented||(o.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const l=a.target;r.triggerRef.current?.contains(l)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})},"DialogContentNonModal")),vi=c.forwardRef(Se(function(t,n){const{__scopeDialog:r,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:a,...l}=t,u=ke(It,r);return fn(),i.jsx(i.Fragment,{children:i.jsx(gs,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:s,onUnmountAutoFocus:a,children:i.jsx(ps,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionPresent?u.descriptionId:void 0,"aria-labelledby":u.titlePresent?u.titleId:void 0,"data-state":Fr(u.open),...l,ref:n,deferPointerDownOutside:!0,onDismiss:()=>u.onOpenChange(!1)})})})},"DialogContentImpl")),af="DialogTitle",gi=c.forwardRef(Se(function(t,n){const{__scopeDialog:r,...o}=t,s=ke(af,r),{setTitleCount:a}=s;return oe(()=>(a(l=>l+1),()=>a(l=>l-1)),[a]),i.jsx(H.h2,{id:s.titleId,...o,ref:n})},"DialogTitle")),cf="DialogDescription",xi=c.forwardRef(Se(function(t,n){const{__scopeDialog:r,...o}=t,s=ke(cf,r),{setDescriptionCount:a}=s;return oe(()=>(a(l=>l+1),()=>a(l=>l-1)),[a]),i.jsx(H.p,{id:s.descriptionId,...o,ref:n})},"DialogDescription")),lf="DialogClose",uf=c.forwardRef(Se(function(t,n){const{__scopeDialog:r,...o}=t,s=ke(lf,r);return i.jsx(H.button,{type:"button",...o,ref:n,onClick:z(t.onClick,()=>s.onOpenChange(!1))})},"DialogClose"));function Fr(e){return e?"open":"closed"}Se(Fr,"getState");const df=Qd,ff=tf,bi=c.forwardRef(({className:e,...t},n)=>i.jsx(mi,{ref:n,className:Q("fixed inset-0 z-50 bg-black/60 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out",e),...t}));bi.displayName=mi.displayName;const yi=c.forwardRef(({className:e,children:t,...n},r)=>i.jsxs(ff,{children:[i.jsx(bi,{}),i.jsxs(hi,{ref:r,className:Q("fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 border border-border bg-card p-6 shadow-lg rounded-xl",e),...n,children:[t,i.jsxs(uf,{className:"absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none disabled:pointer-events-none",children:[i.jsx(Lo,{className:"h-4 w-4"}),i.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));yi.displayName=hi.displayName;const Et=({className:e,...t})=>i.jsx("div",{className:Q("flex flex-col space-y-1.5 text-left",e),...t});Et.displayName="DialogHeader";const Pt=c.forwardRef(({className:e,...t},n)=>i.jsx(gi,{ref:n,className:Q("text-lg font-semibold leading-none tracking-tight",e),...t}));Pt.displayName=gi.displayName;const wi=c.forwardRef(({className:e,...t},n)=>i.jsx(xi,{ref:n,className:Q("text-sm text-muted-foreground",e),...t}));wi.displayName=xi.displayName;const Bn=["scaffold","icon","install","launch","bundle"];function pf({open:e,phase:t,frozenValues:n,iconSrc:r,iconLabel:o,traySrc:s,trayLabel:a,selectedPort:l,currentStep:u,logs:f,error:p,result:d,onBack:h,onCreate:x,onOpenApp:g,onClose:v,confirmError:m,onOpenChange:C}){const b=c.useRef(null);c.useEffect(()=>{b.current?.scrollTo({top:b.current.scrollHeight})},[f.length]);const y=w=>{const R=Bn.indexOf(w),S=Bn.indexOf(u);return t==="success"||R<S?"done":R===S?"active":""};return i.jsx(df,{open:e,onOpenChange:w=>{t==="pending"&&w===!1||C(w)},children:i.jsx(yi,{className:"max-w-xl",children:t==="confirm"?i.jsxs(i.Fragment,{children:[i.jsxs(Et,{children:[i.jsx(Pt,{children:"确认应用信息"}),i.jsx(wi,{children:"表单已固定,以下值将用于生成应用。"})]}),i.jsxs("dl",{className:"grid grid-cols-[110px_1fr] gap-x-3 gap-y-2 text-sm",children:[i.jsx("dt",{className:"text-muted-foreground",children:"App ID"}),i.jsx("dd",{className:"font-mono break-all",children:n.appId}),i.jsx("dt",{className:"text-muted-foreground",children:"应用名称"}),i.jsx("dd",{className:"break-all",children:n.appName}),i.jsx("dt",{className:"text-muted-foreground",children:"图标"}),i.jsxs("dd",{className:"flex flex-wrap items-center gap-4",children:[i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"icon-checker flex size-10 items-center justify-center overflow-hidden rounded-md","aria-label":"应用图标预览",children:r!==void 0?i.jsx("img",{src:r,alt:"应用图标",className:"size-full object-contain"}):i.jsx("span",{className:"text-[10px] text-muted-foreground",children:"无"})}),i.jsxs("span",{className:"flex flex-col",children:[i.jsx("span",{className:"text-xs leading-tight",children:"应用图标"}),i.jsx("span",{className:"font-mono text-[10px] leading-tight text-muted-foreground",children:o})]})]}),i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"icon-checker flex size-10 items-center justify-center overflow-hidden rounded-md","aria-label":"托盘图标预览",children:s!==void 0?i.jsx("img",{src:s,alt:"托盘图标",className:"size-full object-contain"}):i.jsx("span",{className:"text-[10px] text-muted-foreground",children:"文字"})}),i.jsxs("span",{className:"flex flex-col",children:[i.jsx("span",{className:"text-xs leading-tight",children:"托盘图标"}),i.jsx("span",{className:"font-mono text-[10px] leading-tight text-muted-foreground",children:a})]})]})]}),i.jsx("dt",{className:"text-muted-foreground",children:"服务端口"}),i.jsx("dd",{className:"font-mono",children:l!==void 0?`:${l}(生成后运行时重新嗅探)`:"运行时嗅探"}),i.jsx("dt",{className:"text-muted-foreground",children:"包管理器"}),i.jsx("dd",{children:n.pm})]}),m!==void 0?i.jsx("p",{className:"text-xs font-medium text-red-400",children:m}):null,i.jsxs("div",{className:"flex justify-end gap-2",children:[i.jsx(de,{variant:"outline",onClick:h,children:"返回修改"}),i.jsx(de,{onClick:x,children:"确认生成"})]})]}):t==="pending"?i.jsxs(i.Fragment,{children:[i.jsx(Et,{children:i.jsx(Pt,{children:"正在生成应用…"})}),i.jsx("div",{className:"flex flex-wrap gap-1.5",children:Bn.map(w=>i.jsx(ar,{variant:y(w)==="done"?"success":y(w)==="active"?"warning":"secondary",children:w},w))}),i.jsx("div",{ref:b,className:"h-48 overflow-y-auto rounded-md border border-border bg-[#05070b] p-3 font-mono text-[11px] leading-5 text-[#b7c3d8] whitespace-pre-wrap",children:f.join(`
42
- `)})]}):t==="success"&&d!==void 0?i.jsxs(i.Fragment,{children:[i.jsx(Et,{children:i.jsxs(Pt,{className:"flex items-center gap-2",children:[i.jsx(Ca,{className:"size-5 text-emerald-400"}),"应用已生成"]})}),i.jsxs("dl",{className:"grid grid-cols-[110px_1fr] gap-x-3 gap-y-2 text-sm",children:[i.jsx("dt",{className:"text-muted-foreground",children:"项目目录"}),i.jsx("dd",{className:"font-mono break-all",children:d.projectDir}),d.bundlePath?i.jsxs(i.Fragment,{children:[i.jsx("dt",{className:"text-muted-foreground",children:"macOS Bundle"}),i.jsx("dd",{className:"font-mono break-all",children:d.bundlePath})]}):null]}),i.jsxs("div",{className:"flex justify-end gap-2",children:[i.jsx(de,{variant:"outline",onClick:v,children:"完成"}),i.jsxs(de,{onClick:g,children:[i.jsx(Ra,{}),"打开应用"]})]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:d.pinHint})]}):i.jsxs(i.Fragment,{children:[i.jsx(Et,{children:i.jsxs(Pt,{className:"flex items-center gap-2",children:[i.jsx(Oa,{className:"size-5 text-red-400"}),"生成失败"]})}),i.jsx("p",{className:"break-all font-mono text-xs text-red-400",children:p??"未知错误"}),i.jsx("div",{className:"flex justify-end",children:i.jsx(de,{variant:"outline",onClick:h,children:"返回重试"})})]})})})}const ko=(e,t)=>{const n=c.useRef(e);n.current=e;const r=c.useRef(void 0),o=c.useRef(void 0),s=c.useCallback(()=>{r.current!==void 0&&(clearTimeout(r.current),r.current=void 0);const p=o.current;o.current=void 0,p!==void 0&&n.current(...p)},[]),a=c.useCallback(()=>{r.current!==void 0&&(clearTimeout(r.current),r.current=void 0),o.current=void 0},[]),l=c.useCallback((...p)=>{o.current=p,r.current!==void 0&&clearTimeout(r.current),r.current=setTimeout(()=>{r.current=void 0;const d=o.current;o.current=void 0,d!==void 0&&n.current(...d)},t)},[t]);c.useEffect(()=>s,[s]);const u=c.useRef(l);u.current=l;const f=c.useCallback((...p)=>{u.current(...p)},[]);return f.flush=s,f.cancel=a,f};var mf=Object.defineProperty,Lr=(e,t)=>mf(e,"name",{value:t,configurable:!0}),zn=!1;function Ci(){const[e,t]=c.useState(zn);return c.useEffect(()=>{zn||(zn=!0,t(!0))},[]),e}Lr(Ci,"useIsHydrated");var Si=At[" useSyncExternalStore ".trim().toString()];function Ri(){return()=>{}}Lr(Ri,"subscribe");function Ei(){return Si(Ri,()=>!0,()=>!1)}Lr(Ei,"useIsHydratedModern");var hf=typeof Si=="function"?Ei:Ci,vf=Object.defineProperty,it=(e,t)=>vf(e,"name",{value:t,configurable:!0}),Vn="rovingFocusGroup.onEntryFocus",gf={bubbles:!1,cancelable:!0},Cn="RovingFocusGroup",[or,Pi,xf]=cn(Cn),[bf,ji]=Pe(Cn,[xf]),[yf,wf]=bf(Cn),Cf=c.forwardRef(it(function(t,n){return i.jsx(or.Provider,{scope:t.__scopeRovingFocusGroup,children:i.jsx(or.Slot,{scope:t.__scopeRovingFocusGroup,children:i.jsx(Sf,{...t,ref:n})})})},"RovingFocusGroup")),Sf=c.forwardRef(it(function(t,n){const{__scopeRovingFocusGroup:r,orientation:o,loop:s=!1,dir:a,currentTabStopId:l,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:f,onEntryFocus:p,preventScrollOnEntryFocus:d=!1,...h}=t,x=c.useRef(null),g=ne(n,x),v=Dt(a),[m,C]=Ae({prop:l,defaultProp:u??null,onChange:f,caller:Cn}),[b,y]=c.useState(!1),w=Ee(p),R=Pi(r),S=c.useRef(!1),[P,I]=c.useState(0);return c.useEffect(()=>{const N=x.current;if(N)return N.addEventListener(Vn,w),()=>N.removeEventListener(Vn,w)},[w]),i.jsx(yf,{scope:r,orientation:o,dir:v,loop:s,currentTabStopId:m,onItemFocus:c.useCallback(N=>C(N),[C]),onItemShiftTab:c.useCallback(()=>y(!0),[]),onFocusableItemAdd:c.useCallback(()=>I(N=>N+1),[]),onFocusableItemRemove:c.useCallback(()=>I(N=>N-1),[]),children:i.jsx(H.div,{tabIndex:b||P===0?-1:0,"data-orientation":o,...h,ref:g,style:{outline:"none",...t.style},onMouseDown:z(t.onMouseDown,()=>{S.current=!0}),onFocus:z(t.onFocus,N=>{const A=!S.current;if(N.target===N.currentTarget&&A&&!b){const _=new CustomEvent(Vn,gf);if(N.currentTarget.dispatchEvent(_),!_.defaultPrevented){const T=R().filter(k=>k.focusable),D=T.find(k=>k.active),$=T.find(k=>k.id===m),L=[D,$,...T].filter(Boolean).map(k=>k.ref.current);Br(L,d)}}S.current=!1}),onBlur:z(t.onBlur,()=>y(!1))})})},"RovingFocusGroupImpl")),Rf="RovingFocusGroupItem",Ef=c.forwardRef(it(function(t,n){const{__scopeRovingFocusGroup:r,focusable:o=!0,active:s=!1,tabStopId:a,children:l,...u}=t,f=Ie(),p=a||f,d=wf(Rf,r),h=d.currentTabStopId===p,x=Pi(r),{onFocusableItemAdd:g,onFocusableItemRemove:v,currentTabStopId:m}=d,C=hf();return oe(()=>{if(!(!C||!o))return g(),()=>v()},[C,o,g,v]),c.useEffect(()=>{if(!(C||!o))return g(),()=>v()},[C,o,g,v]),i.jsx(or.ItemSlot,{scope:r,id:p,focusable:o,active:s,children:i.jsx(H.span,{tabIndex:h?0:-1,"data-orientation":d.orientation,...u,ref:n,onMouseDown:z(t.onMouseDown,b=>{o?d.onItemFocus(p):b.preventDefault()}),onFocus:z(t.onFocus,()=>d.onItemFocus(p)),onKeyDown:z(t.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){d.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const y=Ii(b,d.orientation,d.dir);if(y!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let R=x().filter(S=>S.focusable).map(S=>S.ref.current);if(y==="last")R.reverse();else if(y==="prev"||y==="next"){y==="prev"&&R.reverse();const S=R.indexOf(b.currentTarget);R=d.loop?Ai(R,S+1):R.slice(S+1)}setTimeout(()=>Br(R))}}),children:typeof l=="function"?l({isCurrentTabStop:h,hasTabStop:m!=null}):l})})},"RovingFocusGroupItem")),Pf={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Ni(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}it(Ni,"getDirectionAwareKey");function Ii(e,t,n){const r=Ni(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Pf[r]}it(Ii,"getFocusIntent");function Br(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}it(Br,"focusFirst");function Ai(e,t){return e.map((n,r)=>e[(t+r)%e.length])}it(Ai,"wrapArray");var jf=Cf,Nf=Ef,If=Object.defineProperty,wt=(e,t)=>If(e,"name",{value:t,configurable:!0}),zr="Tabs",[Af,rp]=Pe(zr,[ji]),Ti=ji(),[Tf,Vr]=Af(zr),Of=c.forwardRef(wt(function(t,n){const{__scopeTabs:r,value:o,onValueChange:s,defaultValue:a,orientation:l="horizontal",dir:u,activationMode:f="automatic",...p}=t,d=Dt(u),[h,x]=Ae({prop:o,onChange:s,defaultProp:a??"",caller:zr});return i.jsx(Tf,{scope:r,baseId:Ie(),value:h,onValueChange:x,orientation:l,dir:d,activationMode:f,children:i.jsx(H.div,{dir:d,"data-orientation":l,...p,ref:n})})},"Tabs")),_f="TabsList",Df=c.forwardRef(wt(function(t,n){const{__scopeTabs:r,loop:o=!0,...s}=t,a=Vr(_f,r),l=Ti(r);return i.jsx(jf,{asChild:!0,...l,orientation:a.orientation,dir:a.dir,loop:o,children:i.jsx(H.div,{role:"tablist","aria-orientation":a.orientation,...s,ref:n})})},"TabsList")),kf="TabsTrigger",Mf=c.forwardRef(wt(function(t,n){const{__scopeTabs:r,value:o,disabled:s=!1,...a}=t,l=Vr(kf,r),u=Ti(r),f=Hr(l.baseId,o),p=Ur(l.baseId,o),d=o===l.value;return i.jsx(Nf,{asChild:!0,...u,focusable:!s,active:d,children:i.jsx(H.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":p,"data-state":d?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:f,...a,ref:n,onMouseDown:z(t.onMouseDown,h=>{!s&&h.button===0&&h.ctrlKey===!1?l.onValueChange(o):h.preventDefault()}),onKeyDown:z(t.onKeyDown,h=>{s||h.target!==h.currentTarget||[" ","Enter"].includes(h.key)&&l.onValueChange(o)}),onFocus:z(t.onFocus,()=>{const h=l.activationMode!=="manual";!d&&!s&&h&&l.onValueChange(o)})})})},"TabsTrigger")),$f="TabsContent",Ff=c.forwardRef(wt(function(t,n){const{__scopeTabs:r,value:o,forceMount:s,children:a,...l}=t,u=Vr($f,r),f=Hr(u.baseId,o),p=Ur(u.baseId,o),d=o===u.value,h=c.useRef(d);return c.useEffect(()=>{const x=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(x)},[]),i.jsx(xt,{present:s||d,children:({present:x})=>i.jsx(H.div,{"data-state":d?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":f,hidden:!x,id:p,tabIndex:0,...l,ref:n,style:{...t.style,animationDuration:h.current?"0s":void 0},children:x&&a})})},"TabsContent"));function Hr(e,t){return`${e}-trigger-${t}`}wt(Hr,"makeTriggerId");function Ur(e,t){return`${e}-content-${t}`}wt(Ur,"makeContentId");var Lf=Of,Oi=Df,_i=Mf,Di=Ff;const Bf=Lf,ki=c.forwardRef(({className:e,...t},n)=>i.jsx(Oi,{ref:n,className:Q("inline-flex h-9 items-center justify-start gap-1 rounded-t-lg bg-muted/50 p-1 text-muted-foreground w-full overflow-x-auto",e),...t}));ki.displayName=Oi.displayName;const sr=c.forwardRef(({className:e,...t},n)=>i.jsx(_i,{ref:n,className:Q("inline-flex items-center gap-1.5 whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-card data-[state=active]:text-foreground data-[state=active]:shadow",e),...t}));sr.displayName=_i.displayName;const ir=c.forwardRef(({className:e,...t},n)=>i.jsx(Di,{ref:n,className:Q("mt-2 ring-offset-background focus-visible:outline-none",e),...t}));ir.displayName=Di.displayName;const zf=e=>{const t=e.trim();if(t.length!==0)try{return new URL(/^https?:\/\//iu.test(t)?t:`http://${t}`).href}catch{return}};function Vf({command:e,terminalHostRef:t,terminalReady:n,interactive:r,status:o,services:s,iframeTabs:a,activeTab:l,onActiveTabChange:u,onIframeNavigate:f,onIframeHistoryMove:p,onJumpToService:d,className:h}){const x=a.find(b=>`svc-${b.port}`===l),[g,v]=c.useState("");c.useEffect(()=>{v(x?.url??"")},[x?.url,l]);const m=x!==void 0&&x.historyIndex>0,C=x!==void 0&&x.historyIndex<x.history.length-1;return i.jsxs("div",{className:Q("flex flex-col rounded-xl border border-border bg-card overflow-hidden",h),children:[i.jsxs(Bf,{value:l,onValueChange:u,className:"flex min-h-0 flex-1 flex-col",children:[i.jsxs(ki,{children:[i.jsxs(sr,{value:"terminal",children:[i.jsx(nn,{className:"size-3.5"}),"终端",!r&&n?i.jsx("span",{className:"text-[10px] text-amber-400",children:"非交互"}):null]}),a.map(b=>i.jsxs(sr,{value:`svc-${b.port}`,children:[i.jsx(co,{className:"size-3.5"}),Ha(b.url),":",new URL(b.url).port]},b.port))]}),i.jsx("div",{className:"flex h-11 items-center gap-2 border-y border-border px-3",children:x===void 0?i.jsxs(i.Fragment,{children:[i.jsx(nn,{className:"size-4 shrink-0 text-muted-foreground"}),i.jsx("span",{className:"truncate font-mono text-xs text-muted-foreground",children:e||"尚未运行命令"})]}):i.jsxs(i.Fragment,{children:[i.jsx(de,{variant:"ghost",size:"iconSm",disabled:!m,onClick:()=>p(x.port,-1),"aria-label":"后退",children:i.jsx(pa,{})}),i.jsx(de,{variant:"ghost",size:"iconSm",disabled:!C,onClick:()=>p(x.port,1),"aria-label":"前进",children:i.jsx(ma,{})}),i.jsx(de,{variant:"ghost",size:"iconSm",onClick:()=>f(x.port,x.url,"replace"),"aria-label":"重新加载",children:i.jsx(ha,{})}),i.jsx(co,{className:"size-4 shrink-0 text-muted-foreground"}),i.jsx(et,{className:"h-7 font-mono text-xs",value:g,placeholder:"输入 URL 跳转",onChange:b=>v(b.target.value),onKeyDown:b=>{if(b.key!=="Enter")return;const y=zf(g);y!==void 0&&f(x.port,y,"push")}})]})}),i.jsxs(ir,{value:"terminal",forceMount:!0,className:"mt-0 min-h-0 flex-1",style:{display:l==="terminal"?"flex":"none",flexDirection:"column"},children:[i.jsx("div",{ref:t,className:"min-h-0 min-w-0 flex-1 bg-[#05070b] px-1"}),n?null:i.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:"正在加载终端渲染器…"})]}),a.map(b=>i.jsx(ir,{value:`svc-${b.port}`,forceMount:!0,className:"mt-0 min-h-0 flex-1",style:{display:l===`svc-${b.port}`?"flex":"none",flexDirection:"column"},children:i.jsx("iframe",{title:`service-${b.port}`,src:b.url,className:"min-h-0 w-full flex-1 border-0 bg-white",sandbox:"allow-same-origin allow-scripts allow-forms"})},b.port))]}),i.jsxs("div",{className:"flex h-8 shrink-0 items-center gap-3 overflow-x-auto border-t border-border px-3 text-[11px] text-muted-foreground",children:[i.jsxs("span",{className:"font-mono whitespace-nowrap",children:["光标 ",o.cursorY,":",o.cursorX]}),i.jsxs("span",{className:"font-mono whitespace-nowrap",children:[o.cols,"×",o.rows]}),i.jsx("span",{className:"font-mono whitespace-nowrap",children:o.selection===void 0?"无选区":`选区 ${o.selection.start.y}:${o.selection.start.x} – ${o.selection.end.y}:${o.selection.end.x}`}),i.jsx("span",{className:"h-3 w-px bg-border"}),s.length===0?i.jsx("span",{children:"嗅探 HTTP 服务中…(未发现不影响创建应用)"}):s.map(b=>i.jsxs(ar,{variant:l===`svc-${b.port}`?"default":"secondary",className:"cursor-pointer font-mono whitespace-nowrap",onClick:()=>d(b.port),children:[":",b.port,b.title?` · ${b.title}`:""]},b.port))]})]})}const Mo={appId:"",appName:"",iconPath:"",iconBackground:"transparent",iconScale:.8,trayIconPath:"",force:!1,pm:"npm",showStartupTerminal:!1,showAddressBar:!1},Hf={appId:"",appName:"",targetDir:"",iconPath:""};function Uf(){const[e,t]=c.useState(""),[n,r]=c.useState([]),[o,s]=c.useState(za),[a,l]=c.useState(""),[u,f]=c.useState(!1),[p,d]=c.useState(!1),[h,x]=c.useState(!1),[g,v]=c.useState("idle"),[m,C]=c.useState(),[b,y]=c.useState(""),[w,R]=c.useState(!0),[S,P]=c.useState(!1),[I,N]=c.useState(),[A,_]=c.useState(Mo),[T,D]=c.useState(Hf),[$,K]=c.useState([]),[L,k]=c.useState(),[F,U]=c.useState(!1),[V,we]=c.useState([]),[G,ae]=c.useState(),[me,he]=c.useState(),[We,ve]=c.useState(),[M,q]=c.useState(),[ee,W]=c.useState(),[X,te]=c.useState("transparent"),[xe,le]=c.useState(.8),Me=c.useRef(void 0),Ke=c.useRef(void 0),at=c.useRef(!1),Wr=c.useRef(!1),[Mt,$t]=c.useState(),[Sn,Ct]=c.useState(),[Ft,Lt]=c.useState(),[Mi,Bt]=c.useState("terminal"),[Kr,zt]=c.useState([]),[$i,Fi]=c.useState({cursorX:0,cursorY:0,cols:0,rows:0}),[Rn,St]=c.useState(!1),[Li,Rt]=c.useState("confirm"),[Bi,En]=c.useState([]),[zi,Vi]=c.useState(""),[Hi,Ui]=c.useState(),[Wi,Ki]=c.useState(),[Gi,Yi]=c.useState(Mo),Gr=c.useRef(null),$e=c.useRef(void 0),Vt=c.useRef([]),Yr=c.useRef(A);Yr.current=A;const qr=c.useRef(g);qr.current=g;const Xr=(E,B,j)=>{if(B===void 0)return!1;const O=Number.parseInt(B.split(":")[1]??"",10);return!E.some(Z=>Z.index===O)||B.split(":")[0]!==String(j)},Pn=c.useRef(void 0);c.useEffect(()=>{const E=A.iconPath.trim().length>0?A.iconPath.trim():T.iconPath.trim().length>0?T.iconPath.trim():void 0;if(Pn.current=E,E===void 0){ve(void 0),W(void 0),Me.current=void 0;return}E===Me.current&&ee!==void 0||(async()=>{try{q(void 0);const B=await J("/api/icon-analyze",{path:E});if(!B.ok)throw new Error("analyze failed");const j=await B.json();if(Pn.current!==E)return;ve(j),at.current=!1,te(j.suggested),J("/api/form",{iconBackground:j.suggested});const O=await J("/api/icon-compose",{foregroundPath:E,background:j.suggested,scale:xe});if(!O.ok)throw new Error("compose failed");const Z=await O.json();if(Pn.current!==E)return;W(Z),Me.current=E}catch{ve(void 0),W(void 0),q("图标分析或合成失败,预览不可用")}})()},[A.iconPath,T.iconPath]);const Zr=ko(E=>{J("/api/form",{iconScale:E});const B=Qr();eo(B,X,E)},250),qi=E=>{le(E),Zr(E)},Jr=ko(E=>{J("/api/form",{iconBackground:E});const B=Qr();eo(B,E,xe)},120),Xi=E=>{at.current=!0,te(E),Jr(E)},Qr=()=>A.iconPath.trim().length>0?A.iconPath.trim():T.iconPath.trim().length>0?T.iconPath.trim():void 0,eo=c.useCallback(async(E,B,j)=>{if(E===void 0){ve(void 0),W(void 0),Me.current=void 0,Ke.current=void 0;return}Ke.current=E;try{const O=await J("/api/icon-analyze",{path:E});if(!O.ok)throw new Error("analyze failed");const Z=await O.json();if(Ke.current!==E)return;ve(Z);const ue=await J("/api/icon-compose",{foregroundPath:E,background:B,scale:j});if(!ue.ok)throw new Error("compose failed");const Fe=await ue.json();if(Ke.current!==E)return;W(Fe),Me.current=E}catch{ve(void 0),W(void 0),q("图标合成失败,预览未更新")}},[]);c.useEffect(()=>{va()},[]),c.useEffect(()=>{if(!p)return;let E=!1;return(async()=>{const B=Gr.current;if(B===null)return;const j=await ga(B);if(E||j===void 0){E||N("ghostty-web 加载失败,输出将以纯文本显示");return}$e.current=j,P(!0);const O=Vt.current;Vt.current=[];for(const ue of O)j.write(ue);j.onData(ue=>{to.current&&J("/api/terminal-input",{data:ue})}),j.onResize(({cols:ue,rows:Fe})=>{J("/api/terminal-resize",{cols:ue,rows:Fe})});const Z=window.setInterval(()=>{if(!(qr.current==="idle"&&!$e.current))try{Fi(j.readState())}catch{}},300);return()=>window.clearInterval(Z)})(),()=>{E=!0,$e.current?.dispose(),$e.current=void 0}},[p]);const to=c.useRef(!0);c.useEffect(()=>{to.current=w},[w]),c.useEffect(()=>{const E=Va();return E.onmessage=B=>{const j=JSON.parse(B.data);switch(j.type){case"state":v(j.state),j.state==="failed"&&C(j.reason),j.state==="frozen"&&(Rt("confirm"),St(!0)),j.state==="materializing"&&(Rt("pending"),En([])),j.state==="success"&&Rt("success"),j.state==="failed"&&ro.current&&(Rt("failed"),Ui(j.reason));break;case"log":{$e.current!==void 0?$e.current.write(j.chunk):no.current!==void 0?N(O=>(O??"")+j.chunk):Vt.current.push(j.chunk);break}case"term-mode":if(R(j.interactive),!j.interactive&&j.message!==void 0){const O=`\x1B[33m${j.message}\x1B[0m\r
43
- `;$e.current!==void 0?$e.current.write(O):Vt.current.push(O)}break;case"run-status":x(j.running);break;case"command-display":y(j.command);break;case"command-options":s(j.options),l(j.defaultCwd);break;case"services":{K(j.services),k(j.selectedPort),zt(O=>{const Z=[...O];let ue;for(const Fe of j.services)Z.find(la=>la.port===Fe.port)===void 0&&(Z.push({port:Fe.port,url:Fe.url,history:[Fe.url],historyIndex:0}),ue=Fe.port);return ue!==void 0&&Bt(`svc-${ue}`),Z});break}case"icons":we(j.icons),ae(j.port),Xr(j.icons,me,j.port)&&he(void 0),Xr(j.icons,Sn,j.port)&&Ct(void 0);break;case"scrape":U(j.hasIcon);break;case"form":_(j.values),D(j.defaults),f(j.targetDirExists),Wr.current||(Wr.current=!0,te(j.values.iconBackground),le(j.values.iconScale));break;case"materialize-step":Vi(j.step),En(O=>[...O,`[${j.step}] ${j.message}`]);break;case"materialize-log":En(O=>[...O,j.message]);break;case"success":Ki({projectDir:j.projectDir,...j.bundlePath===void 0?{}:{bundlePath:j.bundlePath},pinHint:j.pinHint});break}},()=>E.close()},[]);const no=c.useRef(void 0);c.useEffect(()=>{no.current=I},[I]);const ro=c.useRef(!1);c.useEffect(()=>{ro.current=Rn},[Rn]);const jn=me===void 0?void 0:Number.parseInt(me.split(":")[1]??"",10),Zi=ee!==void 0?Vo(ee.key):Mt!==void 0?Mt:G!==void 0&&jn!==void 0&&V.some(E=>E.index===jn)?pt(G,jn):G!==void 0&&V[0]!==void 0&&me===void 0?pt(G,V[0].index):void 0,Ji=ee!==void 0?`合成 ${ee.background==="transparent"?"透明底":ee.background==="black"?"黑底":"白底"}`:Mt!==void 0?"本地图片":V[0]!==void 0?`${V[0].width}×${V[0].height} ${V[0].format.toUpperCase()}`:"首字母图标",oo=(()=>{if(Ft!==void 0)return Ft;const E=A.trayIconPath.trim();if(E.length>0&&G!==void 0){const j=V.find(O=>O.path===E);if(j!==void 0)return pt(G,j.index)}const B=/^([^:]+):(\d+)$/.exec(Sn??"");if(B!==null){const j=Number(B[1]),O=Number(B[2]);if(Number.isInteger(j)&&Number.isInteger(O))return pt(j,O)}E.length})(),Qi=Ft!==void 0?"本地图片":oo!==void 0?"跟随源图":"跟随应用图标";c.useEffect(()=>{const E=e.trim();if(E.length===0)return;const B=window.setTimeout(()=>{J("/api/prime",{command:E})},400);return()=>window.clearTimeout(B)},[e]);const ea=async()=>{const E=e.trim();if(!(o.argsMode==="string"&&E.length===0)){if(d(!0),Bt("terminal"),$e.current?.reset(),zt([]),K([]),U(!1),we([]),ae(void 0),he(void 0),$t(void 0),Ct(void 0),Lt(void 0),o.argsMode==="array"){if(n.length===0||(n[0]??"").trim().length===0)return;await J("/api/command",{argv:n});return}await J("/api/command",{command:E})}},ta=E=>{if(Kr.find(j=>j.port===E)===void 0){J("/api/select-service",{port:E});return}J("/api/select-service",{port:E}),Bt(`svc-${E}`)},na=(E,B,j)=>{zt(O=>O.map(Z=>{if(Z.port!==E)return Z;if(j==="replace")return{...Z,url:B};const ue=[...Z.history.slice(0,Z.historyIndex+1),B];return{...Z,url:B,history:ue,historyIndex:ue.length-1}}))},ra=(E,B)=>{zt(j=>j.map(O=>{if(O.port!==E)return O;const Z=O.historyIndex+B;return Z<0||Z>=O.history.length?O:{...O,historyIndex:Z,url:O.history[Z]}}))},[oa,Nn]=c.useState(),sa=async()=>{Zr.flush(),Jr.flush(),Rt("confirm"),St(!0);try{const E=await J("/api/confirm",{});if(!E.ok){const B=await E.json().catch(()=>({}));Nn(B.error??`确认失败(${E.status})`);return}Nn(void 0)}catch{Nn("确认请求失败")}};c.useEffect(()=>{g==="frozen"&&Yi({...Yr.current,...A})},[g]);const ia=async()=>{await J("/api/create",{})},aa=g==="discovered"||g==="success"?"success":g==="running"||g==="materializing"?"warning":g==="failed"?"destructive":"secondary",ca=p?"minmax(0, 520px) minmax(0, 1fr) minmax(0, 0fr)":"minmax(0, 1fr) minmax(0, var(--list-w)) minmax(0, 1fr)";return i.jsxs("div",{className:"grid h-screen w-full overflow-hidden",style:{"--list-w":"min(520px, 100vw - 40px)",gridTemplateColumns:ca,transition:"grid-template-columns 450ms cubic-bezier(0.4, 0, 0.2, 1)"},children:[i.jsxs("div",{className:"flex w-full flex-col gap-4 overflow-y-auto p-5 max-md:min-h-screen "+(p?"md:border-r md:border-border":""),style:{gridColumn:p?"1":"2",gridRow:"1",transition:"border-color 450ms",scrollbarGutter:"stable"},children:[i.jsxs("header",{className:"flex items-center gap-3",children:[i.jsx("h1",{className:"text-lg font-bold",children:"create-opentray"}),i.jsx(ar,{variant:aa,className:"ml-auto shrink-0",children:g})]}),i.jsx(Xd,{command:e,onCommandChange:t,argv:n,onArgvChange:E=>r([...E]),runAlive:h,frozen:g==="materializing"||g==="frozen"||g==="success",failedReason:g==="failed"?m:void 0,commandOptions:o,defaultCwd:a,onCommandOptionsChange:E=>{s(E),J("/api/command-options",{cwd:E.cwd,env:E.env,argsMode:E.argsMode})},onRun:()=>{ea()},onStop:()=>{J("/api/stop",{})}}),i.jsx(Yd,{frozen:g==="frozen"||g==="materializing"||g==="success",values:A,defaults:T,candidates:V,candidatesPort:G,selectedIconRef:me,uploadedIconUrl:Mt,iconAnalysis:We,iconComposition:ee,iconComposeError:M,iconBackground:X,iconScale:xe,onIconBackgroundChange:Xi,onIconScaleChange:qi,selectedTrayRef:Sn,uploadedTrayUrl:Ft,selectedPort:L,targetDirExists:u,onPickIconCandidate:E=>{G!==void 0&&(he(`${G}:${E.index}`),$t(void 0),J("/api/icon-select",{port:G,index:E.index}))},onUploadIcon:E=>{const B=URL.createObjectURL(E);$t(B),he(void 0),E.arrayBuffer().then(j=>{fetch("/api/icon-upload",{method:"POST",headers:{"content-type":E.type||"application/octet-stream",authorization:`Bearer ${new URLSearchParams(location.search).get("token")??""}`},body:j}).then(O=>O.json()).then(({path:O})=>{O===void 0||O.length===0||(_(Z=>({...Z,iconPath:O})),J("/api/form",{iconPath:O}))}).catch(()=>{})})},onClearIcon:()=>{he(void 0),$t(void 0),_(E=>({...E,iconPath:""})),J("/api/form",{iconPath:""})},onPickTray:E=>{G!==void 0&&(Ct(`${G}:${E.index}`),Lt(void 0),J("/api/tray-icon-select",{port:G,index:E.index}))},onUploadTray:E=>{const B=URL.createObjectURL(E);Lt(B),Ct(void 0),E.arrayBuffer().then(j=>{fetch("/api/icon-upload",{method:"POST",headers:{"content-type":E.type||"application/octet-stream",authorization:`Bearer ${new URLSearchParams(location.search).get("token")??""}`},body:j}).then(O=>O.json()).then(({path:O})=>{O===void 0||O.length===0||(_(Z=>({...Z,trayIconPath:O})),J("/api/form",{trayIconPath:O}))}).catch(()=>{})})},onClearTray:()=>{Ct(void 0),Lt(void 0),_(E=>({...E,trayIconPath:""})),J("/api/form",{trayIconPath:""})},onPatch:E=>{_(B=>({...B,...E})),J("/api/form",E)},onConfirm:()=>{sa()}})]}),i.jsx("div",{className:"flex min-h-0 min-w-0 flex-col gap-4 overflow-y-auto p-4 max-md:hidden",style:{scrollbarGutter:"stable",gridColumn:p?"2":"3",gridRow:"1",opacity:p?1:0,visibility:p?"visible":"hidden",transition:"opacity 450ms cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear "+(p?"0s":"450ms")},children:p?i.jsxs(i.Fragment,{children:[i.jsx(Vf,{command:b,terminalHostRef:Gr,terminalReady:S,interactive:w,status:$i,services:[...$],iframeTabs:Kr,activeTab:Mi,onActiveTabChange:Bt,onIframeNavigate:na,onIframeHistoryMove:ra,onJumpToService:ta,className:"min-h-[480px] flex-1"}),I!==void 0?i.jsx("pre",{className:"max-h-56 overflow-auto rounded-xl border border-border bg-card p-3 font-mono text-xs whitespace-pre-wrap",children:I}):null]}):null}),i.jsx(pf,{open:Rn,onOpenChange:St,phase:Li,frozenValues:Gi,iconSrc:Zi,iconLabel:Ji,traySrc:oo,trayLabel:Qi,selectedPort:L,currentStep:zi,logs:Bi,error:Hi??m,result:Wi,onBack:()=>St(!1),onCreate:()=>{ia()},onOpenApp:()=>{J("/api/open-app",{})},confirmError:oa,onClose:()=>St(!1)})]})}da.createRoot(document.getElementById("root")).render(i.jsx(fa.StrictMode,{children:i.jsx(Uf,{})}));
1
+ import{c as He,r as d,E as Nt,u as St,b as Cp,d as nu,f as ot,e as Me,j as l,N as Er,g as lt,h as Gt,i as ru,k as fe,m as Mt,l as Ci,n as Ip,o as wp,R as kp,a as Ep}from"./index.js";import{u as wt,b as ie,i as Ze,c as Pe,d as ve,g as _t,o as Be,e as vt,f as kt,h as Ii,j as de,k as Yt,l as Ce,m as Sp,n as Pt,p as Bn,q as Zn,r as Rp,t as it,s as Lo,v as rt,w as At,x as Pn,y as Ko,z as Dn,C as Jn,D as Vs,E as yn,F as wi,H as Dp,J as ou,K as Fp,L as ki,M as Wo,N as su,O as qa,P as Gn,Q as Zs,S as Ei,B as _e,T as iu,U as Si,V as Cr,W as xr,X as Ri,Y as au,Z as Di,_ as Fi,$ as Qo,a0 as Bi,a1 as on,a2 as Mi,a3 as Bp,I as et,a4 as ji,a5 as Mp,a6 as el,a7 as tl,G as nl,A as jp,a as Pp,R as Tp}from"./input.js";import{u as lu,B as bo,T as Sr,p as Np,c as _p}from"./terminal-pane.js";const Op=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Pi=He("check",Op);const Hp=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Tn=He("chevron-down",Hp);const Lp=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Ti=He("chevron-up",Lp);const Kp=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Wp=He("circle-check",Kp);const Qp=[["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"}]],Gp=He("circle-question-mark",Qp);const Yp=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],zp=He("copy",Yp);const Up=[["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"}]],Vp=He("download",Up);const Zp=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],cu=He("external-link",Zp);const Jp=[["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"}]],$p=He("file-text",Jp);const Xp=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],qp=He("folder-open",Xp);const eh=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],th=He("folder",eh);const nh=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],rh=He("list",nh);const oh=[["path",{d:"M5 12h14",key:"1ays0h"}]],sh=He("minus",oh);const ih=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],ah=He("monitor",ih);const lh=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],ch=He("moon",lh);const uh=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],rl=He("panel-left",uh);const dh=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],uu=He("pencil",dh);const fh=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],ph=He("play",fh);const hh=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],du=He("plus",hh);const Ah=[["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"}]],gh=He("refresh-cw",Ah);const mh=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],xh=He("settings-2",mh);const bh=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],vh=He("share-2",bh);const yh=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Ch=He("square",yh);const Ih=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],wh=He("sun",Ih);const kh=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Eh=He("trash-2",kh);const Sh=[["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"}]],Rh=He("triangle-alert",Sh);const Dh=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],fu=He("upload",Dh);const Fh=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ni=He("x",Fh);function pu(e,t,n,r=!0,o){const[s,i]=d.useState(),a=wt(o?`${o}-label`:void 0),c=e??t??s;return ie(()=>{const u=e||t||!r?void 0:Bh(n.current,a);s!==u&&i(u)}),c}function Bh(e,t){const n=Mh(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function Mh(e){if(!e)return;const t=e.parentElement;if(t&&t.tagName==="LABEL")return t;const n=e.id;if(n){const o=e.nextElementSibling;if(o&&o.htmlFor===n)return o}const r=e.labels;return r&&r[0]}function jh(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:Ph,platform:Th,maxTouchPoints:Nh}=jh(),Go=Ph.toLowerCase(),Rr=Th.toLowerCase(),Yo=/^i(os$|p)/.test(Rr)||Rr==="macintel"&&Nh>1,ol="android",Js=Rr===ol||Go.includes(ol),_i=!Yo&&Rr.startsWith("mac");Rr.startsWith("win");const _h=_i||Yo,an=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none");!an&&Go.includes("firefox");!an&&Go.includes("chrom");const Oh=_h,Oi=/jsdom|happydom/.test(Go),$s="data-base-ui-focusable",hu="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",zo="ArrowLeft",Uo="ArrowRight",Au="ArrowUp",Hi="ArrowDown";function vo(e,t){if(!Pe(e))return!1;const n=e;if(t.hasElement(n))return!n.hasAttribute("data-trigger-disabled");for(const[,r]of t.entries())if(ve(r,n))return!r.hasAttribute("data-trigger-disabled");return!1}function bs(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function Hh(e){return e.matches("html,body")}function Vo(e){return Ze(e)&&e.matches(hu)}function Lh(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${hu}`)!=null}function Xs(e){return e?e.getAttribute("role")==="combobox"&&Vo(e):!1}function Kh(e){if(!e||Oi)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function yo(e){return e?e.hasAttribute($s)?e:e.querySelector(`[${$s}]`)||e:null}function xn(e,t,n=!0){return e.filter(o=>o.parentId===t).flatMap(o=>[...!n||o.context?.open?[o]:[],...xn(e,o.id,n)])}function sl(e,t){let n=[],r=e.find(o=>o.id===t)?.parentId;for(;r;){const o=e.find(s=>s.id===r);r=o?.parentId,o&&(n=n.concat(o))}return n}function Lt(e){e.preventDefault(),e.stopPropagation()}function Wh(e){return"nativeEvent"in e}function Li(e){return e.pointerType===""&&e.isTrusted?!0:Js&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Ki(e){return Oi?!1:!Js&&e.width===0&&e.height===0||Js&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function mn(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function Qh(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const $n=Math.min,nn=Math.max,Co=Math.round,Zr=Math.floor,rn=e=>({x:e,y:e}),Gh={left:"right",right:"left",bottom:"top",top:"bottom"};function gu(e,t,n){return nn(e,$n(t,n))}function bn(e,t){return typeof e=="function"?e(t):e}function jt(e){return e.split("-")[0]}function Cn(e){return e.split("-")[1]}function Wi(e){return e==="x"?"y":"x"}function Qi(e){return e==="y"?"height":"width"}function Bt(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Gi(e){return Wi(Bt(e))}function Yh(e,t,n){n===void 0&&(n=!1);const r=Cn(e),o=Gi(e),s=Qi(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Io(i)),[i,Io(i)]}function zh(e){const t=Io(e);return[qs(e),t,qs(t)]}function qs(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const il=["left","right"],al=["right","left"],Uh=["top","bottom"],Vh=["bottom","top"];function Zh(e,t,n){switch(e){case"top":case"bottom":return n?t?al:il:t?il:al;case"left":case"right":return t?Uh:Vh;default:return[]}}function Jh(e,t,n,r){const o=Cn(e);let s=Zh(jt(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(qs)))),s}function Io(e){const t=jt(e);return Gh[t]+e.slice(t.length)}function $h(e){var t,n,r,o;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(r=e.bottom)!=null?r:0,left:(o=e.left)!=null?o:0}}function mu(e){return typeof e!="number"?$h(e):{top:e,right:e,bottom:e,left:e}}function Dr(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Ir(e,t){return t<0||t>=e.length}function Ao(e,t){return tn(e.current,{disabledIndices:t})}function ei(e,t){return tn(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function tn(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:o=1}={}){let s=t;do s+=n?-o:o;while(s>=0&&s<=e.length-1&&wo(e,s,r));return s}function wo(e,t,n){if(typeof n=="function"?n(t):n?.includes(t)??!1)return!0;const o=e[t];return o?!Zo(o)||o.matches(":disabled")?!0:!n&&(o.hasAttribute("disabled")||o.getAttribute("aria-disabled")==="true"):!1}function Xh(e){return e.visibility==="hidden"||e.visibility==="collapse"}function Zo(e,t=e?_t(e):null){return!e||!e.isConnected||!t||Xh(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const qh='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function eA(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const n=e.getRootNode();return Ii(n)?n.host:null}function ti(e){for(const t of Array.from(e.children))if(kt(t)==="summary")return t;return null}function tA(e,t){const n=ti(t);return!!n&&(e===n||ve(n,e))}function xu(e){const t=e?kt(e):"";return e!=null&&e.matches(qh)&&(t!=="summary"||e.parentElement!=null&&kt(e.parentElement)==="details"&&ti(e.parentElement)===e)&&(t!=="details"||ti(e)==null)&&(t!=="input"||e.type!=="hidden")}function bu(e){if(!xu(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=eA(t)){const n=t!==e,r=kt(t)==="slot";if(t.hasAttribute("inert")||n&&kt(t)==="details"&&!t.open&&!tA(e,t)||t.hasAttribute("hidden")||!r&&!nA(t,n))return!1}return!0}function nA(e,t){const n=_t(e);return t?n.display!=="none":Zo(e,n)}function vu(e){const t=e.tabIndex;if(t<0){const n=kt(e);if(n==="details"||n==="audio"||n==="video"||Ze(e)&&e.isContentEditable)return 0}return t}function vs(e){if(kt(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function rA(e,t){const n=vs(e);if(!n)return!0;const r=t.find(o=>{const s=vs(o);return s?.name===n.name&&s.form===n.form&&s.checked});return r?r===n:t.find(o=>{const s=vs(o);return s?.name===n.name&&s.form===n.form})===n}function yu(e){if(Ze(e)&&kt(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return Ze(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function Cu(e,t){yu(e).forEach(n=>{xu(n)&&t.push(n),Cu(n,t)})}function Iu(e,t,n){yu(e).forEach(r=>{Ze(r)&&r.matches(t)&&n.push(r),Iu(r,t,n)})}function Yi(e){return bu(e)&&vu(e)>=0}function wu(e){const t=[];return Cu(e,t),t.filter(bu)}function Kr(e){const t=wu(e);return t.filter(n=>vu(n)>=0&&rA(n,t))}function ku(e,t){const n=Kr(e),r=n.length;if(r===0)return;const o=vt(Be(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function zi(e){return ku(Be(e).body,1)||e}function Eu(e){return ku(Be(e).body,-1)||e}function Su(e,t){if(!e)return null;const n=Kr(Be(e).body),r=n.length;if(r===0)return null;const o=n.indexOf(e);if(o===-1)return null;const s=(o+t+r)%r;return n[s]}function oA(e){return Su(e,1)}function sA(e){return Su(e,-1)}function Yn(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!ve(n,r)}function iA(e){Kr(e).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function ll(e){const t=[];Iu(e,"[data-tabindex]",t),t.forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}function Ui(e){d.useEffect(e,Nt)}const ar=0;class Ot{static create(){return new Ot}currentId=ar;start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=ar,n()},t)}isStarted(){return this.currentId!==ar}clear=()=>{this.currentId!==ar&&(clearTimeout(this.currentId),this.currentId=ar)};disposeEffect=()=>this.clear}function dt(){const e=St(Ot.create).current;return Ui(e.disposeEffect),e}const aA=d.createContext({disabled:!1});function lA(){return d.useContext(aA)}var sn=Cp();const Jr=null;class cA{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;const n=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let o=0;o<n.length;o+=1)n[o]?.(t)};request(t){const n=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}let $r=new cA;class It{static create(){return new It}static request(t){return $r.request(t)}static cancel(t){return $r.cancel(t)}currentId=Jr;request(t){this.cancel(),this.currentId=$r.request(()=>{this.currentId=Jr,t()})}cancel=()=>{this.currentId!==Jr&&($r.cancel(this.currentId),this.currentId=Jr)};disposeEffect=()=>this.cancel}function Xn(){const e=St(It.create).current;return Ui(e.disposeEffect),e}function Xt(e){return e==null?e:"current"in e?e.current:e}function Vi(e,t=!1){const n=Xn();return de((r,o=null)=>{n.cancel();const s=Xt(e);if(s==null)return;const i=s,a=()=>{sn.flushSync(r)};if(typeof i.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){r();return}function c(){Promise.all(i.getAnimations().map(u=>u.finished)).then(()=>{o?.aborted||a()},()=>{if(o?.aborted)return;if(i.getAnimations().some(f=>f.pending||f.playState!=="finished")){c();return}a()})}if(t){const u="data-starting-style";if(!i.hasAttribute(u)){n.request(c);return}const f=new MutationObserver(()=>{i.hasAttribute(u)||(f.disconnect(),c())});f.observe(i,{attributes:!0,attributeFilter:[u]}),o?.addEventListener("abort",()=>f.disconnect(),{once:!0});return}n.request(c)})}function zt(e){const{enabled:t=!0,open:n,ref:r,onComplete:o}=e,s=de(o),i=Vi(r,n);d.useEffect(()=>{if(!t)return;const a=new AbortController;return i(s,a.signal),()=>{a.abort()}},[t,n,s,i])}let ko=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const uA={"data-starting-style":""},dA={"data-ending-style":""},Nn={transitionStatus(e){return e==="starting"?uA:e==="ending"?dA:null}};function or(e,t=!1,n=!1){const[r,o]=d.useState(e&&t?"idle":void 0),[s,i]=d.useState(e);return e&&!s&&(i(!0),o("starting")),!e&&s&&r!=="ending"&&!n&&o("ending"),!e&&!s&&r==="ending"&&o(void 0),ie(()=>{if(!e&&s&&r!=="ending"&&n){const a=It.request(()=>{o("ending")});return()=>{It.cancel(a)}}},[e,s,r,n]),ie(()=>{if(!e||t)return;const a=It.request(()=>{o(void 0)});return()=>{It.cancel(a)}},[t,e]),ie(()=>{if(!e||!t)return;e&&s&&r!=="idle"&&o("starting");const a=It.request(()=>{o("idle")});return()=>{It.cancel(a)}},[t,e,s,r]),{mounted:s,setMounted:i,transitionStatus:r}}var ys={exports:{}},Cs={};var cl;function fA(){if(cl)return Cs;cl=1;var e=nu();function t(h,g){return h===g&&(h!==0||1/h===1/g)||h!==h&&g!==g}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function a(h,g){var A=g(),p=r({inst:{value:A,getSnapshot:g}}),m=p[0].inst,x=p[1];return s(function(){m.value=A,m.getSnapshot=g,c(m)&&x({inst:m})},[h,A,g]),o(function(){return c(m)&&x({inst:m}),h(function(){c(m)&&x({inst:m})})},[h]),i(A),A}function c(h){var g=h.getSnapshot;h=h.value;try{var A=g();return!n(h,A)}catch{return!0}}function u(h,g){return g()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:a;return Cs.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,Cs}var ul;function Ru(){return ul||(ul=1,ys.exports=fA()),ys.exports}var Jo=Ru();const br={v:[]},dl=()=>br.v.forEach(e=>e()),pA=e=>(br.v.push(e)===1&&addEventListener("hashchange",dl),()=>{br.v=br.v.filter(t=>t!==e),br.v.length||removeEventListener("hashchange",dl)}),hA=()=>"/"+location.hash.replace(/^#?\/?/,""),AA=(e,{state:t=null,replace:n=!1}={})=>{const r=location.href,[o,s]=e.replace(/^#?\/?/,"").split("?"),i=new URL(location.href);i.hash=`/${o}`,s&&(i.search=s);const a=i.href;n?history.replaceState(t,"",a):history.pushState(t,"",a);const c=typeof HashChangeEvent<"u"?new HashChangeEvent("hashchange",{oldURL:r,newURL:a}):new Event("hashchange",{detail:{oldURL:r,newURL:a}});dispatchEvent(c)},Du=({ssrPath:e="/"}={})=>[Jo.useSyncExternalStore(pA,hA,()=>e),AA];Du.hrefs=e=>"#"+e;const Is=768;function gA(){const[e,t]=d.useState(void 0);return d.useEffect(()=>{const n=window.matchMedia(`(max-width: ${Is-1}px)`),r=()=>t(window.innerWidth<Is);return n.addEventListener("change",r),t(window.innerWidth<Is),()=>n.removeEventListener("change",r)},[]),!!e}const Fu=d.createContext(void 0);function _n(e){const t=d.useContext(Fu);if(!e&&t===void 0)throw new Error(ot(27));return t}(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=ko.startingStyle]="startingStyle",e[e.endingStyle=ko.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({});const mA={"data-popup-open":""},xA={"data-popup-open":"","data-pressed":""},bA={"data-open":""},vA={"data-closed":""},yA={"data-anchor-hidden":""},Bu={open(e){return e?mA:null}},ni={open(e){return e?xA:null}},Wr={open(e){return e?bA:vA},anchorHidden(e){return e?yA:null}},Zi={...Wr,...Nn},Ji=d.forwardRef(function(t,n){const{render:r,className:o,style:s,forceRender:i=!1,...a}=t,c=_n(),u=c.useState("open"),f=c.useState("nested"),h=c.useState("mounted"),g=c.useState("transitionStatus");return Me("div",t,{state:{open:u,transitionStatus:g},ref:[c.context.backdropRef,n],stateAttributesMapping:Zi,props:[{role:"presentation",hidden:!h,style:{userSelect:"none",WebkitUserSelect:"none"}},a],enabled:i||!f})}),Qr=d.forwardRef(function(t,n){const{render:r,className:o,style:s,disabled:i=!1,nativeButton:a=!0,...c}=t,u=_n(),f=u.useState("open"),{getButtonProps:h,buttonRef:g}=Yt({disabled:i,native:a}),A={disabled:i};function p(m){f&&u.setOpen(!1,Ce(Sp,m.nativeEvent))}return Me("button",t,{state:A,ref:[n,g],props:[{onClick:p},c,h]})}),$i=d.forwardRef(function(t,n){const{render:r,className:o,style:s,id:i,...a}=t,c=_n(),u=wt(i);return c.useSyncedValueWithCleanup("descriptionElementId",u),Me("p",t,{ref:n,props:[{id:u},a]})});function CA(e,t){return t!=null&&!mn(t)?0:typeof e=="function"?e():e}function qn(e,t,n){const r=CA(e,n);return typeof r=="number"?r:r?.[t]}function fl(e){return typeof e=="function"?e():e}function Mu(e,t){return t||e==="click"||e==="mousedown"}function IA(e){return e?.includes("mouse")&&e!=="mousedown"}const wA=d.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Ot,currentIdRef:{current:null},currentContextRef:{current:null}});function kA(e,t){e.current=t.current}function EA(e,t={open:!1}){const{open:n}=t,r="rootStore"in e?e.rootStore:e,o=r.useState("floatingId"),s=d.useContext(wA),{currentIdRef:i,delayRef:a,timeoutMs:c,initialDelayRef:u,currentContextRef:f,hasProvider:h,timeout:g}=s,[A,p]=d.useState(!1),m=d.useRef(n);return ie(()=>{m.current=n},[n]),ie(()=>{function x(){f.current?.setIsInstantPhase(!1),i.current=null,f.current=null,a.current=u.current,g.clear()}if(i.current&&!n&&i.current===o){if(p(!1),c){const C=o;return g.start(c,()=>{r.select("open")||i.current&&i.current!==C||x()}),()=>{(m.current||i.current!==C)&&g.clear()}}x()}},[n,o,i,a,c,u,f,g,r]),ie(()=>{if(!n)return;const x=f.current,C=i.current;g.clear(),f.current={onOpenChange:r.setOpen,setIsInstantPhase:p},i.current=o,a.current={open:0,close:qn(u.current,"close")},C!==null&&C!==o?(p(!0),x?.setIsInstantPhase(!0),x?.onOpenChange(!1,Ce(Pt))):(p(!1),x?.setIsInstantPhase(!1))},[n,o,r,i,a,u,f,g]),ie(()=>()=>{if(i.current===o){if(f.current=null,!m.current)return;i.current=null,kA(a,u),g.clear()}},[f,i,a,o,u,g]),d.useMemo(()=>({hasProvider:h,delayRef:a,isInstantPhase:A}),[h,a,A])}function Fe(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Qt(...e){return()=>{for(let t=0;t<e.length;t+=1){const n=e[t];n&&n()}}}function qe(e){const t=St(SA,e).current;return t.next=e,ie(t.effect),t}function SA(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}const ju={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},$o={...ju,position:"fixed",top:0,left:0},Xi={...ju,position:"absolute"},er=d.forwardRef(function(t,n){const[r,o]=d.useState();ie(()=>{Oh&&an&&o("button")},[]);const s={tabIndex:0,role:r};return l.jsx("span",{...t,ref:n,style:$o,"aria-hidden":r?void 0:!0,...s,"data-base-ui-focus-guard":""})});function Fr(e){return`data-base-ui-${e}`}let Xr=0;function go(e,t={}){const{preventScroll:n=!1,sync:r=!1,shouldFocus:o}=t;cancelAnimationFrame(Xr);function s(){o&&!o()||e?.focus({preventScroll:n})}if(r)return s(),Er;const i=requestAnimationFrame(s);return Xr=i,()=>{Xr===i&&(cancelAnimationFrame(i),Xr=0)}}const ws={inert:new WeakMap,"aria-hidden":new WeakMap},pl="data-base-ui-inert",ri={inert:new WeakSet,"aria-hidden":new WeakSet};let lr=new WeakMap,ks=0;function RA(e){return ri[e]}function Pu(e){return e?Ii(e)?e.host:Pu(e.parentNode):null}const hl=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=Pu(n);return e.contains(r)?r:null}).filter(n=>n!=null),Al=e=>{const t=new Set;return e.forEach(n=>{let r=n;for(;r&&!t.has(r);)t.add(r),r=r.parentNode}),t},gl=(e,t,n)=>{const r=[],o=s=>{!s||n.has(s)||Array.from(s.children).forEach(i=>{kt(i)!=="script"&&(t.has(i)?o(i):r.push(i))})};return o(e),r};function DA(e,t,n,r,{mark:o=!0}){let s=null;r?s="inert":n&&(s="aria-hidden");let i=null,a=null;const c=hl(t,e),u=o?gl(t,Al(c),new Set(c)):[],f=[],h=[];if(s){const g=ws[s],A=RA(s);a=A,i=g;const p=hl(t,Array.from(t.querySelectorAll("[aria-live]"))),m=c.concat(p);gl(t,Al(m),new Set(m)).forEach(C=>{const b=C.getAttribute(s),v=b!==null&&b!=="false",y=(g.get(C)||0)+1;g.set(C,y),f.push(C),y===1&&v&&A.add(C),v||C.setAttribute(s,s==="inert"?"":"true")})}return o&&u.forEach(g=>{const A=(lr.get(g)||0)+1;lr.set(g,A),h.push(g),A===1&&g.setAttribute(pl,"")}),ks+=1,()=>{i&&f.forEach(g=>{const p=(i.get(g)||0)-1;i.set(g,p),p||(!a?.has(g)&&s&&g.removeAttribute(s),a?.delete(g))}),o&&h.forEach(g=>{const A=(lr.get(g)||0)-1;lr.set(g,A),A||g.removeAttribute(pl)}),ks-=1,ks||(ws.inert=new WeakMap,ws["aria-hidden"]=new WeakMap,ri.inert=new WeakSet,ri["aria-hidden"]=new WeakSet,lr=new WeakMap)}}function ml(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:o=!0}=t,s=Be(e[0]).body;return DA(e,s,n,r,{mark:o})}const FA=500,BA=500,MA={style:{transition:"none"}},jA="data-base-ui-click-trigger",Tu={fallbackAxisSide:"none"},Nu={fallbackAxisSide:"end"},PA={clipPath:"inset(50%)",position:"fixed",top:0,left:0},_u=d.createContext(null),Ou=()=>d.useContext(_u),TA=Fr("portal");function Hu(e={}){const{ref:t,container:n,componentProps:r=lt,elementProps:o}=e,s=Zn(),a=Ou()?.portalNode,[c,u]=d.useState(null),[f,h]=d.useState(null),g=de(x=>{x!==null&&h(x)}),A=d.useRef(null);ie(()=>{if(n===null){A.current&&(A.current=null,h(null),u(null));return}const x=(n&&(Rp(n)?n:n.current))??a??document.body;if(x==null){A.current&&(A.current=null,h(null),u(null));return}A.current!==x&&(A.current=x,h(null),u(x))},[n,a]);const p=Me("div",r,{ref:[t,g],props:[{id:s,[TA]:""},o]}),m=c&&p?sn.createPortal(p,c):null;return{node:f,nodeId:d.isValidElement(p)?p.props.id:void 0,subtree:m}}const qi=d.forwardRef(function(t,n){const{render:r,className:o,style:s,children:i,container:a,...c}=t,{node:u,nodeId:f,subtree:h}=Hu({container:a,ref:n,componentProps:t,elementProps:c}),g=d.useRef(null),A=d.useRef(null),p=d.useRef(null),m=d.useRef(null),[x,C]=d.useState(null),b=d.useRef(!1),v=x?.modal,y=x?.open,w=!!x&&!x.modal&&x.open&&!!u;d.useEffect(()=>{if(!u||v)return;function E(S){u&&S.relatedTarget&&Yn(S)&&(S.type==="focusin"?b.current&&(ll(u),b.current=!1):(iA(u),b.current=!0))}return Qt(Fe(u,"focusin",E,!0),Fe(u,"focusout",E,!0))},[u,v]),ie(()=>{!u||y!==!0||!b.current||(ll(u),b.current=!1)},[y,u]);const I=d.useMemo(()=>({beforeOutsideRef:g,afterOutsideRef:A,beforeInsideRef:p,afterInsideRef:m,portalNode:u,setFocusManagerState:C}),[u]);return l.jsxs(d.Fragment,{children:[h,l.jsxs(_u.Provider,{value:I,children:[w&&u&&l.jsx(er,{"data-type":"outside",ref:g,onFocus:E=>{if(Yn(E,u))p.current?.focus();else{const S=x?x.domReference:null;Eu(S)?.focus()}}}),w&&u&&l.jsx("span",{"aria-owns":f,style:PA}),u&&sn.createPortal(i,u),w&&u&&l.jsx(er,{"data-type":"outside",ref:A,onFocus:E=>{if(Yn(E,u))m.current?.focus();else{const S=x?x.domReference:null;zi(S)?.focus(),x?.closeOnFocusOut&&x?.onOpenChange(!1,Ce(Bn,E.nativeEvent))}}})]})]})});function Lu(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(r=>r(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}class ea{nodesRef={current:[]};events=Lu();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(r=>r===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const Ku=d.createContext(null),Wu=d.createContext(null),In=()=>d.useContext(Ku)?.id||null,wn=e=>{const t=d.useContext(Wu);return e??t};function Qu(e){const t=Zn(),n=wn(e),r=In();return ie(()=>{if(!t)return;const o={id:t,parentId:r};return n?.addNode(o),()=>{n?.removeNode(o)}},[n,t,r]),t}function NA(e){const{children:t,id:n}=e,r=In();return l.jsx(Ku.Provider,{value:d.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function _A(e){const{children:t,externalTree:n}=e,r=St(()=>n??new ea).current;return l.jsx(Wu.Provider,{value:r,children:t})}function OA(e,t){const n=rt(At(e));return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const xl=20;let gn=[];function ta(){gn=gn.filter(e=>e.deref()?.isConnected)}function bl(e){ta(),e&&kt(e)!=="body"&&(gn.push(new WeakRef(e)),gn.length>xl&&(gn=gn.slice(-xl)))}function vl(){return ta(),gn[gn.length-1]?.deref()}function HA(e){return e?Yi(e)?e:Kr(e)[0]||e:null}function yl(e){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!e.getAttribute("role")?.includes("dialog"))return;const n=wu(e).filter(o=>{const s=o.getAttribute("data-tabindex")||"";return Yi(o)||o.hasAttribute("data-tabindex")&&!s.startsWith("-")}),r=e.getAttribute("tabindex");n.length===0?r!=="0"&&(e.setAttribute("tabindex","0"),e.setAttribute("data-tabindex","0")):(r!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function na(e){const{context:t,children:n,disabled:r=!1,initialFocus:o=!0,returnFocus:s=!0,restoreFocus:i=!1,modal:a=!0,closeOnFocusOut:c=!0,openInteractionType:u="",nextFocusableElement:f,previousFocusableElement:h,beforeContentFocusGuardRef:g,externalTree:A,getInsideElements:p}=e,m="rootStore"in t?t.rootStore:t,x=m.useState("open"),C=m.useState("domReferenceElement"),b=m.useState("floatingElement"),{events:v,dataRef:y}=m.context,w=de(()=>y.current.floatingContext?.nodeId),I=o===!1,E=Xs(C)&&I,S=qe(o),R=qe(s),k=qe(u),F=qe(x),T=wn(A),N=Ou(),j=d.useRef(!1),D=d.useRef(!1),O=d.useRef(!1),_=d.useRef(null),B=d.useRef(""),H=d.useRef(""),P=d.useRef(null),M=d.useRef(null),L=Gt(P,g,N?.beforeInsideRef),G=Gt(M,N?.afterInsideRef),V=dt(),Y=dt(),Q=Xn(),z=N!=null,K=yo(b),X=de(($=K)=>$?Kr($):[]),ae=de(()=>p?.().filter($=>$!=null)??[]);d.useEffect(()=>{if(r||!a)return;function $(ue){ue.key==="Tab"&&ve(K,vt(Be(K)))&&X().length===0&&!E&&Lt(ue)}const ee=Be(K);return Fe(ee,"keydown",$)},[r,K,a,E,X]),d.useEffect(()=>{if(r||!x)return;const $=Be(K);function ee(){O.current=!1}function ue(he){const se=At(he),Ae=ae(),re=ve(b,se)||ve(C,se)||ve(N?.portalNode,se)||Ae.some(oe=>oe===se||ve(oe,se));O.current=!re,H.current=he.pointerType||"keyboard",se?.closest(`[${jA}]`)&&(D.current=!0,Y.start(0,()=>{D.current=!1}))}function ce(){H.current="keyboard"}return Qt(Fe($,"pointerdown",ue,!0),Fe($,"pointerup",ee,!0),Fe($,"pointercancel",ee,!0),Fe($,"keydown",ce,!0),ee)},[r,b,C,K,x,N,Y,ae]),d.useEffect(()=>{if(r||!c)return;const $=Be(K);function ee(){D.current=!0,Y.start(0,()=>{D.current=!1})}function ue(Ae){const re=At(Ae);Yi(re)&&(_.current=re)}function ce(Ae){const re=Ae.relatedTarget,oe=Ae.currentTarget,le=At(Ae);a&&re==null&&le!=null&&ve(b,le)&&bl(le),queueMicrotask(()=>{const ge=w(),me=m.context.triggerElements,W=ae(),U=re?.hasAttribute(Fr("focus-guard"))&&[P.current,M.current,N?.beforeInsideRef.current,N?.afterInsideRef.current,N?.beforeOutsideRef.current,N?.afterOutsideRef.current,Xt(h),Xt(f)].includes(re),be=!(ve(C,re)||ve(b,re)||ve(re,b)||ve(N?.portalNode,re)||W.some(q=>q===re||ve(q,re))||me.hasMatchingElement(q=>ve(q,re))||U||T&&(xn(T.nodesRef.current,ge).find(q=>ve(q.context?.elements.floating,re)||ve(q.context?.elements.domReference,re))||sl(T.nodesRef.current,ge).find(q=>[q.context?.elements.floating,yo(q.context?.elements.floating)].includes(re)||q.context?.elements.domReference===re)));if(oe===C&&K&&yl(K),i&&oe!==C&&!Zo(le)&&vt($)===$.body){if(Ze(K)&&(K.focus(),i==="popup")){Q.request(()=>{K.focus()});return}const q=X(),ne=_.current,Ee=(ne&&q.includes(ne)?ne:null)||q[q.length-1]||K;Ze(Ee)&&Ee.focus()}if(y.current.insideReactTree){y.current.insideReactTree=!1;return}(E||!a)&&re&&be&&!D.current&&(E||re!==vl())&&(j.current=!0,m.setOpen(!1,Ce(Bn,Ae)))})}function he(){O.current||(y.current.insideReactTree=!0,V.start(0,()=>{y.current.insideReactTree=!1}))}const se=Ze(C)?C:null;if(!(!b&&!se))return Qt(se&&Fe(se,"focusout",ce),se&&Fe(se,"pointerdown",ee),b&&Fe(b,"focusin",ue),b&&Fe(b,"focusout",ce),b&&N&&Fe(b,"focusout",he,!0))},[r,C,b,K,a,T,N,m,c,i,X,E,w,y,V,Y,Q,f,h,ae]),d.useEffect(()=>{if(r||!b||!x)return;const $=Array.from(N?.portalNode?.querySelectorAll(`[${Fr("portal")}]`)||[]),ue=(T?sl(T.nodesRef.current,w()):[]).find(oe=>Xs(oe.context?.elements.domReference||null))?.context?.elements.domReference,he=[...[b,...$,P.current,M.current,N?.beforeOutsideRef.current,N?.afterOutsideRef.current,...ae()],ue,Xt(h),Xt(f),E?C:null].filter(oe=>oe!=null),se=ml(he,{ariaHidden:a||E,mark:!1}),Ae=[b,...$].filter(oe=>oe!=null),re=ml(Ae);return()=>{re(),se()}},[x,r,C,b,a,N,E,T,w,f,h,ae]),ie(()=>{if(!x||r||!Ze(K))return;B.current="",H.current="";const $=Be(K),ee=vt($);queueMicrotask(()=>{const ue=S.current,ce=typeof ue=="function"?ue(k.current||""):ue;if(ce===void 0||ce===!1||ve(K,ee))return;let se=null;const Ae=()=>(se==null&&(se=X(K)),se[0]||K);let re;ce===!0||ce===null?re=Ae():re=Xt(ce),re=re||Ae();const oe=ve(K,vt($));go(re,{preventScroll:re===K,shouldFocus(){if(!F.current)return!1;if(oe)return!0;const le=vt($);return!(le!==re&&ve(K,le))}})})},[r,x,K,X,S,k,F]),ie(()=>{if(r||!K)return;const $=Be(K),ee=vt($),ue=k.current==null;bl(ee);function ce(se){if(se.open||(B.current=OA(se.nativeEvent,H.current)),se.reason===it&&se.nativeEvent.type==="mouseleave"&&(j.current=!0),se.reason===Lo)if(se.nested)j.current=!1;else if(Li(se.nativeEvent)||Ki(se.nativeEvent))j.current=!1;else{let Ae=!1;Be(K).createElement("div").focus({get preventScroll(){return Ae=!0,!1}}),Ae?j.current=!1:j.current=!0}}v.on("openchange",ce);function he(se){const Ae=R.current;let re=typeof Ae=="function"?Ae(se):Ae;if(re===void 0||re===!1)return null;re===null&&(re=!0);const oe=C?.isConnected?C:null,le=ee?.isConnected&&kt(ee)!=="body"?ee:null;let ge=ue?le||oe:oe||le;return ge||(ge=vl()||null),typeof re=="boolean"?ge:Xt(re)||ge||null}return()=>{v.off("openchange",ce);const se=vt($),Ae=ae(),re=ve(b,se)||Ae.some(me=>me===se||ve(me,se))||T&&xn(T.nodesRef.current,w(),!1).some(me=>ve(me.context?.elements.floating,se)),oe=R.current,le=B.current,ge=he(le);queueMicrotask(()=>{const me=HA(ge),W=typeof oe!="boolean";if(oe&&!j.current&&Ze(me)&&(!(!W&&me!==se&&se!==$.body)||re)){const U={preventScroll:!0};le==="keyboard"&&(U.focusVisible=!0),me.focus(U)}j.current=!1})}},[r,b,K,R,k,v,T,C,w,ae]),ie(()=>{if(!an||x||!b)return;const $=vt(Be(b));!Ze($)||!Vo($)||ve(b,$)&&$.blur()},[x,b]),ie(()=>{if(!(r||!N))return N.setFocusManagerState({modal:a,closeOnFocusOut:c,open:x,onOpenChange:m.setOpen,domReference:C}),()=>{N.setFocusManagerState(null)}},[r,N,a,x,m,c,C]),ie(()=>{if(!(r||!K))return yl(K),()=>{queueMicrotask(ta)}},[r,K]);const te=!r&&(a?!E:!0)&&(z||a);return l.jsxs(d.Fragment,{children:[te&&l.jsx(er,{"data-type":"inside",ref:L,onFocus:$=>{if(a){const ee=X();go(ee[ee.length-1])}else N?.portalNode&&(j.current=!1,Yn($,N.portalNode)?zi(C)?.focus():Xt(h??N.beforeOutsideRef)?.focus())}}),n,te&&l.jsx(er,{"data-type":"inside",ref:G,onFocus:$=>{a?go(X()[0]):N?.portalNode&&(c&&(j.current=!0),Yn($,N.portalNode)?Eu(C)?.focus():Xt(f??N.afterOutsideRef)?.focus())}})]})}function Gu(e,t={}){const{enabled:n=!0,event:r="click",toggle:o=!0,ignoreMouse:s=!1,stickIfOpen:i=!0,touchOpenDelay:a=0,reason:c=Pn}=t,u="rootStore"in e?e.rootStore:e,f=u.context.dataRef,h=d.useRef(void 0),g=Xn(),A=dt(),p=d.useMemo(()=>{function m(C,b,v,y){const w=Ce(c,b,v);C&&y==="touch"&&a>0?A.start(a,()=>{u.setOpen(!0,w)}):u.setOpen(C,w)}function x(C,b,v){const y=f.current.openEvent,w=u.select("domReferenceElement")!==b;return C&&w||!C||!o?!0:y&&i?!v(y.type):!1}return{onPointerDown(C){h.current=mn(C.pointerType,!0)&&Ki(C.nativeEvent)?"virtual":C.pointerType},onMouseDown(C){const b=h.current,v=C.nativeEvent,y=u.select("open");if(C.button!==0||r==="click"||mn(b,!0)&&s)return;const w=x(y,C.currentTarget,S=>S==="click"||S==="mousedown"),I=At(v);if(Vo(I)){m(w,v,I,b);return}const E=C.currentTarget;g.request(()=>{m(w,v,E,b)})},onClick(C){if(r==="mousedown-only")return;const b=h.current;if(r==="mousedown"&&b){h.current=void 0;return}if(mn(b,!0)&&s)return;const v=u.select("open"),y=x(v,C.currentTarget,w=>w==="click"||w==="mousedown"||w==="keydown"||w==="keyup");m(y,C.nativeEvent,C.currentTarget,b)},onKeyDown(){h.current=void 0}}},[f,r,s,c,u,i,o,g,A,a]);return d.useMemo(()=>n?{reference:p}:lt,[n,p])}function LA(e,t){let n=null,r=null,o=!1;return{contextElement:e||void 0,getBoundingClientRect(){const s=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},i=t.axis==="x"||t.axis==="both",a=t.axis==="y"||t.axis==="both",c=["mouseenter","mousemove"].includes(t.dataRef.current.openEvent?.type||"")&&t.pointerType!=="touch";let u=s.width,f=s.height,h=s.x,g=s.y;return n==null&&t.x&&i&&(n=s.x-t.x),r==null&&t.y&&a&&(r=s.y-t.y),h-=n||0,g-=r||0,u=0,f=0,!o||c?(u=t.axis==="y"?s.width:0,f=t.axis==="x"?s.height:0,h=i&&t.x!=null?t.x:h,g=a&&t.y!=null?t.y:g):o&&!c&&(f=t.axis==="x"?s.height:f,u=t.axis==="y"?s.width:u),o=!0,{width:u,height:f,x:h,y:g,top:g,right:h+u,bottom:g+f,left:h}}}}function Cl(e){return e!=null&&e.clientX!=null}function KA(e,t={}){const{enabled:n=!0,axis:r="both"}=t,o="rootStore"in e?e.rootStore:e,s=o.useState("open"),i=o.useState("floatingElement"),a=o.useState("domReferenceElement"),c=o.context.dataRef,u=d.useRef(!1),f=d.useRef(null),[h,g]=d.useState(),[A,p]=d.useState([]),m=de(y=>{o.set("positionReference",y)}),x=de((y,w,I)=>{u.current||c.current.openEvent&&!Cl(c.current.openEvent)||o.set("positionReference",LA(I??a,{x:y,y:w,axis:r,dataRef:c,pointerType:h}))}),C=de(y=>{s?f.current||(x(y.clientX,y.clientY,y.currentTarget),p([])):x(y.clientX,y.clientY,y.currentTarget)}),b=mn(h)?i:s;d.useEffect(()=>{if(!n){m(a);return}if(!b)return;function y(){f.current?.(),f.current=null}const w=rt(i);function I(E){const S=At(E);ve(i,S)?y():x(E.clientX,E.clientY)}return!c.current.openEvent||Cl(c.current.openEvent)?f.current=Fe(w,"mousemove",I):m(a),y},[b,n,i,c,a,o,x,m,A]),d.useEffect(()=>()=>{o.set("positionReference",null)},[o]),d.useEffect(()=>{n&&!i&&(u.current=!1)},[n,i]),d.useEffect(()=>{!n&&s&&(u.current=!0)},[n,s]);const v=d.useMemo(()=>{function y(w){g(w.pointerType)}return{onPointerDown:y,onPointerEnter:y,onMouseMove:C,onMouseEnter:C}},[C]);return d.useMemo(()=>n?{reference:v,trigger:v}:{},[n,v])}function WA(){return!1}function QA(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function Xo(e,t={}){const{enabled:n=!0,escapeKey:r=!0,outsidePress:o=!0,outsidePressEvent:s="sloppy",referencePress:i=WA,bubbles:a,externalTree:c}=t,u="rootStore"in e?e.rootStore:e,f=u.useState("open"),h=u.useState("floatingElement"),{dataRef:g}=u.context,A=wn(c),p=de(typeof o=="function"?o:()=>!1),m=typeof o=="function"?p:o,x=m!==!1,C=de(()=>s),{escapeKey:b,outsidePress:v}=QA(a),y=d.useRef(!1),w=d.useRef(!1),I=d.useRef(!1),E=d.useRef(!1),S=d.useRef(""),R=d.useRef(null),k=dt(),F=dt(),T=de(()=>{F.clear(),g.current.insideReactTree=!1}),N=de(L=>{const G=g.current.floatingContext?.nodeId;return(A?xn(A.nodesRef.current,G):[]).some(Y=>Y.context?.open&&!Y.context.dataRef.current[L])}),j=de(L=>bs(L,u.select("floatingElement"))||bs(L,u.select("domReferenceElement"))),D=de(L=>{i()&&u.setOpen(!1,Ce(Pn,L.nativeEvent))}),O=de(L=>{if(!f||!n||!r||L.key!=="Escape"||E.current||!b&&N("__escapeKeyBubbles"))return;const G=Wh(L)?L.nativeEvent:L,V=Ce(Ko,G);u.setOpen(!1,V),V.isCanceled||L.preventDefault(),!b&&!V.isPropagationAllowed&&L.stopPropagation()}),_=de(()=>{g.current.insideReactTree=!0,F.start(0,T)}),B=de(L=>{if(!f||!n||L.button!==0)return;const G=At(L.nativeEvent);ve(u.select("floatingElement"),G)&&(y.current||(y.current=!0,w.current=!1))}),H=de(L=>{!f||!n||(L.defaultPrevented||L.nativeEvent.defaultPrevented)&&y.current&&(w.current=!0)});d.useEffect(()=>{if(!f||!n)return T;g.current.__escapeKeyBubbles=b,g.current.__outsidePressBubbles=v;const L=new Ot,G=new Ot;function V(){L.clear(),E.current=!0}function Y(){L.start(an?5:0,()=>{E.current=!1})}function Q(){I.current=!0,G.start(0,()=>{I.current=!1})}function z(){y.current=!1,w.current=!1}function K(){const W=S.current,U=W==="pen"||!W?"mouse":W,be=C(),q=typeof be=="function"?be():be;return typeof q=="string"?q:q[U]}function X(W){const U=K();return U==="intentional"&&W.type!=="click"||U==="sloppy"&&W.type==="click"}function ae(W){const U=g.current.floatingContext?.nodeId,be=A&&xn(A.nodesRef.current,U).some(q=>bs(W,q.context?.elements.floating));return j(W)||be}function te(W){if(X(W)){W.type!=="click"&&!j(W)&&(G.clear(),I.current=!1),T();return}if(g.current.insideReactTree){T();return}const U=At(W),be=`[${Fr("inert")}]`,q=Pe(U)?U.getRootNode():null,ne=Array.from((Ii(q)?q:Be(u.select("floatingElement"))).querySelectorAll(be)),Ee=u.context.triggerElements;if(U&&(Ee.hasElement(U)||Ee.hasMatchingElement(Ge=>ve(Ge,U))))return;let Se=Pe(U)?U:null;for(;Se&&!Dn(Se);){const Ge=Jn(Se);if(Dn(Ge)||!Pe(Ge))break;Se=Ge}if(!(ne.length&&Pe(U)&&!Hh(U)&&!ve(U,u.select("floatingElement"))&&ne.every(Ge=>!ve(Se,Ge)))){if(Ze(U)&&!("touches"in W)){const Ge=Dn(U),ze=_t(U),Le=/auto|scroll/,ct=Ge||Le.test(ze.overflowX),tt=Ge||Le.test(ze.overflowY),Je=ct&&U.clientWidth>0&&U.scrollWidth>U.clientWidth,ft=tt&&U.clientHeight>0&&U.scrollHeight>U.clientHeight,Ie=ze.direction==="rtl",Ke=ft&&(Ie?W.offsetX<=U.offsetWidth-U.clientWidth:W.offsetX>U.clientWidth),Ne=Je&&W.offsetY>U.clientHeight;if(Ke||Ne)return}if(!ae(W)){if(K()==="intentional"&&I.current){G.clear(),I.current=!1;return}typeof m=="function"&&!m(W)||N("__outsidePressBubbles")||(u.setOpen(!1,Ce(Lo,W)),T())}}}function $(W){K()!=="sloppy"||W.pointerType==="touch"||!u.select("open")||!n||j(W)||te(W)}function ee(W){if(K()!=="sloppy"||!u.select("open")||!n||j(W))return;const U=W.touches[0];U&&(R.current={startTime:Date.now(),startX:U.clientX,startY:U.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},k.start(1e3,()=>{R.current&&(R.current.dismissOnTouchEnd=!1,R.current.dismissOnMouseDown=!1)}))}function ue(W,U){const be=At(W);if(!be)return;const q=Fe(be,W.type,()=>{U(W),q()})}function ce(W){S.current="touch",ue(W,ee)}function he(W){k.clear(),W.type==="pointerdown"&&(S.current=W.pointerType),!(W.type==="mousedown"&&R.current&&!R.current.dismissOnMouseDown)&&ue(W,U=>{U.type==="pointerdown"?$(U):te(U)})}function se(W){if(!y.current)return;const U=w.current;if(z(),K()==="intentional"){if(W.type==="pointercancel"){U&&Q();return}if(!ae(W)){if(U){Q();return}typeof m=="function"&&!m(W)||(G.clear(),I.current=!0,T())}}}function Ae(W){if(K()!=="sloppy"||!R.current||j(W))return;const U=W.touches[0];if(!U)return;const be=Math.abs(U.clientX-R.current.startX),q=Math.abs(U.clientY-R.current.startY),ne=Math.sqrt(be*be+q*q);ne>5&&(R.current.dismissOnTouchEnd=!0),ne>10&&(te(W),k.clear(),R.current=null)}function re(W){ue(W,Ae)}function oe(W){K()!=="sloppy"||!R.current||j(W)||(R.current.dismissOnTouchEnd&&te(W),k.clear(),R.current=null)}function le(W){ue(W,oe)}const ge=Be(h),me=Qt(r&&Qt(Fe(ge,"keydown",O),Fe(ge,"compositionstart",V),Fe(ge,"compositionend",Y)),x&&Qt(Fe(ge,"click",he,!0),Fe(ge,"pointerdown",he,!0),Fe(ge,"pointerup",se,!0),Fe(ge,"pointercancel",se,!0),Fe(ge,"mousedown",he,!0),Fe(ge,"mouseup",se,!0),Fe(ge,"touchstart",ce,!0),Fe(ge,"touchmove",re,!0),Fe(ge,"touchend",le,!0)));return()=>{me(),L.clear(),G.clear(),z(),I.current=!1,T()}},[g,h,r,x,m,f,n,b,v,O,T,C,N,j,A,u,k]);const P=d.useMemo(()=>({onKeyDown:O,onPointerDown:D,onClick:D}),[O,D]),M=d.useMemo(()=>({onKeyDown:O,onPointerDown:H,onMouseDown:H,onClickCapture:_,onMouseDownCapture(L){_(),B(L)},onPointerDownCapture(L){_(),B(L)},onMouseUpCapture:_,onTouchEndCapture:_,onTouchMoveCapture:_}),[O,_,B,H]);return d.useMemo(()=>n?{reference:P,floating:M,trigger:P}:{},[n,P,M])}function Il(e,t,n){let{reference:r,floating:o}=e;const s=Bt(t),i=Gi(t),a=Qi(i),c=jt(t),u=s==="y",f=r.x+r.width/2-o.width/2,h=r.y+r.height/2-o.height/2,g=r[a]/2-o[a]/2;let A;switch(c){case"top":A={x:f,y:r.y-o.height};break;case"bottom":A={x:f,y:r.y+r.height};break;case"right":A={x:r.x+r.width,y:h};break;case"left":A={x:r.x-o.width,y:h};break;default:A={x:r.x,y:r.y}}const p=Cn(t);return p&&(A[i]+=g*(p==="end"?1:-1)*(n&&u?-1:1)),A}async function GA(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:f="viewport",elementContext:h="floating",altBoundary:g=!1,padding:A=0}=bn(t,e),p=mu(A),x=a[g?h==="floating"?"reference":"floating":h],C=Dr(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(x)))==null||n?x:x.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:u,rootBoundary:f,strategy:c})),b=h==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,v=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),y=await(s.isElement==null?void 0:s.isElement(v))&&await(s.getScale==null?void 0:s.getScale(v))||{x:1,y:1},w=Dr(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:v,strategy:c}):b);return{top:(C.top-w.top+p.top)/y.y,bottom:(w.bottom-C.bottom+p.bottom)/y.y,left:(C.left-w.left+p.left)/y.x,right:(w.right-C.right+p.right)/y.x}}const YA=50,zA=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:GA},c=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:f,y:h}=Il(u,r,c),g=r,A=0;const p={};for(let m=0;m<s.length;m++){const x=s[m];if(!x)continue;const{name:C,fn:b}=x,{x:v,y,data:w,reset:I}=await b({x:f,y:h,initialPlacement:r,placement:g,strategy:o,middlewareData:p,rects:u,platform:a,elements:{reference:e,floating:t}});f=v??f,h=y??h,p[C]={...p[C],...w},I&&A<YA&&(A++,typeof I=="object"&&(I.placement&&(g=I.placement),I.rects&&(u=I.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):I.rects),{x:f,y:h}=Il(u,g,c)),m=-1)}return{x:f,y:h,placement:g,strategy:o,middlewareData:p}},UA=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:a,platform:c,elements:u}=t,{mainAxis:f=!0,crossAxis:h=!0,fallbackPlacements:g,fallbackStrategy:A="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...x}=bn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const C=jt(o),b=Bt(a),v=jt(a)===a,y=await(c.isRTL==null?void 0:c.isRTL(u.floating)),w=g||(v||!m?[Io(a)]:zh(a)),I=p!=="none";!g&&I&&w.push(...Jh(a,m,p,y));const E=[a,...w],S=await c.detectOverflow(t,x),R=[];let k=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&R.push(S[C]),h){const j=Yh(o,i,y);R.push(S[j[0]],S[j[1]])}if(k=[...k,{placement:o,overflows:R}],!R.every(j=>j<=0)){var F,T;const j=(((F=s.flip)==null?void 0:F.index)||0)+1,D=E[j];if(D&&(!(h==="alignment"?b!==Bt(D):!1)||k.every(B=>Bt(B.placement)===b?B.overflows[0]>0:!0)))return{data:{index:j,overflows:k},reset:{placement:D}};let O=(T=k.filter(_=>_.overflows[0]<=0).sort((_,B)=>_.overflows[1]-B.overflows[1])[0])==null?void 0:T.placement;if(!O)switch(A){case"bestFit":{var N;const _=(N=k.filter(B=>{if(I){const H=Bt(B.placement);return H===b||H==="y"}return!0}).map(B=>[B.placement,B.overflows.filter(H=>H>0).reduce((H,P)=>H+P,0)]).sort((B,H)=>B[1]-H[1])[0])==null?void 0:N[0];_&&(O=_);break}case"initialPlacement":O=a;break}if(o!==O)return{reset:{placement:O}}}return{}}}},Yu=new Set(["left","top"]);async function VA(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=jt(n),a=Cn(n),c=Bt(n)==="y",u=Yu.has(i)?-1:1,f=s&&c?-1:1,h=bn(t,e);let{mainAxis:g,crossAxis:A,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"&&(A=a==="end"?p*-1:p),c?{x:A*f,y:g*u}:{x:g*u,y:A*f}}const ZA=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:a}=t,c=await VA(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:s+c.y,data:{...c,placement:i}}}}},JA=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:c={fn:b=>{let{x:v,y}=b;return{x:v,y}}},...u}=bn(e,t),f={x:n,y:r},h=await s.detectOverflow(t,u),g=Bt(o),A=Wi(g);let p=f[A],m=f[g];const x=(b,v)=>gu(v+h[b==="y"?"top":"left"],v,v-h[b==="y"?"bottom":"right"]);i&&(p=x(A,p)),a&&(m=x(g,m));const C=c.fn({...t,[A]:p,[g]:m});return{...C,data:{x:C.x-n,y:C.y-r,enabled:{[A]:i,[g]:a}}}}}},$A=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,r;const{x:o,y:s,placement:i,rects:a,middlewareData:c}=t,{offset:u=0,mainAxis:f=!0,crossAxis:h=!0}=bn(e,t),g={x:o,y:s},A=Bt(i),p=Wi(A);let m=g[p],x=g[A];const C=bn(u,t),b=typeof C=="number"?{mainAxis:C,crossAxis:0}:{mainAxis:(n=C.mainAxis)!=null?n:0,crossAxis:(r=C.crossAxis)!=null?r:0};if(f){const w=p==="y"?"height":"width",I=a.reference[p]-a.floating[w]+b.mainAxis,E=a.reference[p]+a.reference[w]-b.mainAxis;m<I?m=I:m>E&&(m=E)}if(h){var v,y;const w=p==="y"?"width":"height",I=Yu.has(jt(i)),E=a.reference[A]-a.floating[w]+(I&&((v=c.offset)==null?void 0:v[A])||0)+(I?0:b.crossAxis),S=a.reference[A]+a.reference[w]+(I?0:((y=c.offset)==null?void 0:y[A])||0)-(I?b.crossAxis:0);x<E?x=E:x>S&&(x=S)}return{[p]:m,[A]:x}}}},XA=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:s}=t,{apply:i=()=>{},...a}=bn(e,t),c=await o.detectOverflow(t,a),u=jt(n),f=Cn(n),h=Bt(n)==="y",{width:g,height:A}=r.floating;let p,m;u==="top"||u==="bottom"?(p=u,m=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(m=u,p=f==="end"?"top":"bottom");const x=A-c.top-c.bottom,C=g-c.left-c.right,b=$n(A-c[p],x),v=$n(g-c[m],C),y=t.middlewareData.shift,w=!y;let I=b,E=v;y!=null&&y.enabled.x&&(E=C),y!=null&&y.enabled.y&&(I=x),w&&!f&&(h?E=g-2*nn(c.left,c.right):I=A-2*nn(c.top,c.bottom)),await i({...t,availableWidth:E,availableHeight:I});const S=await o.getDimensions(s.floating);return g!==S.width||A!==S.height?{reset:{rects:!0}}:{}}}};function zu(e){const t=_t(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ze(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,a=Co(n)!==s||Co(r)!==i;return a&&(n=s,r=i),{width:n,height:r,$:a}}function ra(e){return Pe(e)?e:e.contextElement}function zn(e){const t=ra(e);if(!Ze(t))return rn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=zu(t);let i=(s?Co(n.width):n.width)/r,a=(s?Co(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const qA=rn(0);function Uu(e){const t=rt(e);return!su()||!t.visualViewport?qA:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function eg(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===rt(e)}function Mn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=ra(e);let i=rn(1);t&&(r?Pe(r)&&(i=zn(r)):i=zn(e));const a=eg(s,n,r)?Uu(s):rn(0);let c=(o.left+a.x)/i.x,u=(o.top+a.y)/i.y,f=o.width/i.x,h=o.height/i.y;if(s&&r){const g=rt(s),A=Pe(r)?rt(r):r;let p=g,m=qa(p);for(;m&&A!==p;){const x=zn(m),C=m.getBoundingClientRect(),b=_t(m),v=C.left+(m.clientLeft+parseFloat(b.paddingLeft))*x.x,y=C.top+(m.clientTop+parseFloat(b.paddingTop))*x.y;c*=x.x,u*=x.y,f*=x.x,h*=x.y,c+=v,u+=y,p=rt(m),m=qa(p)}}return Dr({width:f,height:h,x:c,y:u})}function qo(e,t){const n=Wo(e).scrollLeft;return t?t.left+n:Mn(yn(e)).left+n}function Vu(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-qo(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function tg(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=yn(r),a=t?wi(t.floating):!1;if(r===i||a&&s)return n;let c={scrollLeft:0,scrollTop:0},u=rn(1);const f=rn(0),h=Ze(r);if((h||!s)&&((kt(r)!=="body"||ki(i))&&(c=Wo(r)),h)){const A=Mn(r);u=zn(r),f.x=A.x+r.clientLeft,f.y=A.y+r.clientTop}const g=i&&!h&&!s?Vu(i,c):rn(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+f.x+g.x,y:n.y*u.y-c.scrollTop*u.y+f.y+g.y}}function ng(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function rg(e){const t=Wo(e),n=e.ownerDocument.body,r=nn(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),o=nn(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let s=-t.scrollLeft+qo(e);const i=-t.scrollTop;return _t(n).direction==="rtl"&&(s+=nn(e.clientWidth,n.clientWidth)-r),{width:r,height:o,x:s,y:i}}const og=25;function sg(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",o=rt(e),s=yn(e),i=o.visualViewport;let a=s.clientWidth,c=s.clientHeight,u=0,f=0;if(i){const g=!su()||t==="fixed";r?g||(u=-i.offsetLeft,f=-i.offsetTop):(a=i.width,c=i.height,g&&(u=i.offsetLeft,f=i.offsetTop))}if(qo(s)<=0){const g=s.ownerDocument,A=g.body,p=getComputedStyle(A),m=g.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,x=Math.abs(s.clientWidth-A.clientWidth-m),C=getComputedStyle(s).scrollbarGutter==="stable both-edges"?x/2:x;C<=og&&(a-=C)}return{width:a,height:c,x:u,y:f}}function ig(e,t){const n=Mn(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=zn(e),i=e.clientWidth*s.x,a=e.clientHeight*s.y,c=o*s.x,u=r*s.y;return{width:i,height:a,x:c,y:u}}function wl(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=sg(e,n,t);else if(t==="document")r=rg(yn(e));else if(Pe(t))r=ig(t,n);else{const o=Uu(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Dr(r)}function ag(e,t){const n=t.get(e);if(n)return n;let r=Vs(e,[],!1).filter(a=>Pe(a)&&kt(a)!=="body"),o=null;const s=_t(e).position==="fixed";let i=s?Jn(e):e;for(;Pe(i)&&!Dn(i);){const a=_t(i),c=ou(i),u=o?o.position:s?"fixed":"";!c&&(u==="fixed"||u==="absolute"&&a.position==="static")?r=r.filter(h=>h!==i):o=a,i=Jn(i)}return t.set(e,r),r}function lg(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?wi(t)?[]:ag(t,this._c):[].concat(n),r],a=wl(t,i[0],o);let c=a.top,u=a.right,f=a.bottom,h=a.left;for(let g=1;g<i.length;g++){const A=wl(t,i[g],o);c=nn(A.top,c),u=$n(A.right,u),f=$n(A.bottom,f),h=nn(A.left,h)}return{width:u-h,height:f-c,x:h,y:c}}function cg(e){const{width:t,height:n}=zu(e);return{width:t,height:n}}function ug(e,t,n){const r=Ze(t),o=yn(t),s=n==="fixed",i=Mn(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const c=rn(0);if((r||!s)&&((kt(t)!=="body"||ki(o))&&(a=Wo(t)),r)){const g=Mn(t,!0,s,t);c.x=g.x+t.clientLeft,c.y=g.y+t.clientTop}!r&&o&&(c.x=qo(o));const u=o&&!r&&!s?Vu(o,a):rn(0),f=i.left+a.scrollLeft-c.x-u.x,h=i.top+a.scrollTop-c.y-u.y;return{x:f,y:h,width:i.width,height:i.height}}function Es(e){return _t(e).position==="static"}function kl(e,t){if(!Ze(e)||_t(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return yn(e)===n&&(n=n.ownerDocument.body),n}function Zu(e,t){const n=rt(e);if(wi(e))return n;if(!Ze(e)){let o=Jn(e);for(;o&&!Dn(o);){if(Pe(o)&&!Es(o))return o;o=Jn(o)}return n}let r=kl(e,t);for(;r&&Dp(r)&&Es(r);)r=kl(r,t);return r&&Dn(r)&&Es(r)&&!ou(r)?n:r||Fp(e)||n}const dg=async function(e){const t=this.getOffsetParent||Zu,n=this.getDimensions,r=await n(e.floating);return{reference:ug(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function fg(e){return _t(e).direction==="rtl"}const Ju={convertOffsetParentRelativeRectToViewportRelativeRect:tg,getDocumentElement:yn,getClippingRect:lg,getOffsetParent:Zu,getElementRects:dg,getClientRects:ng,getDimensions:cg,getScale:zn,isElement:Pe,isRTL:fg};function $u(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function pg(e,t,n){let r=null,o;const s=yn(e);function i(){var f;clearTimeout(o),(f=r)==null||f.disconnect(),r=null}function a(f,h){f===void 0&&(f=!1),h===void 0&&(h=1),i();const g=e.getBoundingClientRect(),{left:A,top:p,width:m,height:x}=g;if(f||t(),!m||!x)return;const C=Zr(p),b=Zr(s.clientWidth-(A+m)),v=Zr(s.clientHeight-(p+x)),y=Zr(A),I={rootMargin:-C+"px "+-b+"px "+-v+"px "+-y+"px",threshold:nn(0,$n(1,h))||1};let E=!0;function S(R){const k=R[0].intersectionRatio;if(!$u(g,e.getBoundingClientRect()))return a();if(k!==h){if(!E)return a();k?a(!1,k):o=setTimeout(()=>{a(!1,1e-7)},1e3)}E=!1}try{r=new IntersectionObserver(S,{...I,root:s.ownerDocument})}catch{r=new IntersectionObserver(S,I)}r.observe(e)}const c=rt(e),u=()=>a(n);return c.addEventListener("resize",u),a(!0),()=>{c.removeEventListener("resize",u),i()}}function El(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=ra(e),f=o||s?[...u?Vs(u):[],...t?Vs(t):[]]:[];f.forEach(C=>{o&&C.addEventListener("scroll",n),s&&C.addEventListener("resize",n)});const h=u&&a?pg(u,n,s):null;let g=-1,A=null;i&&(A=new ResizeObserver(C=>{let[b]=C;b&&b.target===u&&A&&t&&(A.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var v;(v=A)==null||v.observe(t)})),n()}),u&&!c&&A.observe(u),t&&A.observe(t));let p,m=c?Mn(e):null;c&&x();function x(){const C=Mn(e);m&&!$u(m,C)&&n(),m=C,p=requestAnimationFrame(x)}return n(),()=>{var C;f.forEach(b=>{o&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),h?.(),(C=A)==null||C.disconnect(),A=null,c&&cancelAnimationFrame(p)}}const hg=ZA,Ag=JA,gg=UA,mg=XA,xg=$A,bg=(e,t,n)=>{const r=new Map,o=n??{},s={...Ju,...o.platform,_c:r};return zA(e,t,{...o,platform:s})};var vg=typeof document<"u",yg=function(){},mo=vg?d.useLayoutEffect:yg;function Eo(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,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Eo(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Eo(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Xu(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Sl(e,t){const n=Xu(e);return Math.round(t*n)/n}function Ss(e){const t=d.useRef(e);return mo(()=>{t.current=e}),t}function Cg(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:c,open:u}=e,[f,h]=d.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,A]=d.useState(r);Eo(g,r)||A(r);const[p,m]=d.useState(null),[x,C]=d.useState(null),b=d.useCallback(B=>{B!==I.current&&(I.current=B,m(B))},[]),v=d.useCallback(B=>{B!==E.current&&(E.current=B,C(B))},[]),y=s||p,w=i||x,I=d.useRef(null),E=d.useRef(null),S=d.useRef(f),R=c!=null,k=Ss(c),F=Ss(o),T=Ss(u),N=d.useCallback(()=>{if(!I.current||!E.current)return;const B={placement:t,strategy:n,middleware:g};F.current&&(B.platform=F.current),bg(I.current,E.current,B).then(H=>{const P={...H,isPositioned:T.current!==!1};j.current&&!Eo(S.current,P)&&(S.current=P,sn.flushSync(()=>{h(P)}))})},[g,t,n,F,T]);mo(()=>{u===!1&&S.current.isPositioned&&(S.current.isPositioned=!1,h(B=>({...B,isPositioned:!1})))},[u]);const j=d.useRef(!1);mo(()=>(j.current=!0,()=>{j.current=!1}),[]),mo(()=>{if(y&&(I.current=y),w&&(E.current=w),y&&w){if(k.current)return k.current(y,w,N);N()}},[y,w,N,k,R]);const D=d.useMemo(()=>({reference:I,floating:E,setReference:b,setFloating:v}),[b,v]),O=d.useMemo(()=>({reference:y,floating:w}),[y,w]),_=d.useMemo(()=>{const B={position:n,left:0,top:0};if(!O.floating)return B;const H=Sl(O.floating,f.x),P=Sl(O.floating,f.y);return a?{...B,transform:"translate("+H+"px, "+P+"px)",...Xu(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:H,top:P}},[n,a,O.floating,f.x,f.y]);return d.useMemo(()=>({...f,update:N,refs:D,elements:O,floatingStyles:_}),[f,N,D,O,_])}const Ig=(e,t)=>{const n=hg(e);return{name:n.name,fn:n.fn,options:[e,t]}},wg=(e,t)=>{const n=Ag(e);return{name:n.name,fn:n.fn,options:[e,t]}},kg=(e,t)=>({fn:xg(e).fn,options:[e,t]}),Eg=(e,t)=>{const n=gg(e);return{name:n.name,fn:n.fn,options:[e,t]}},Sg=(e,t)=>{const n=mg(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Rs={exports:{}},Ds={};var Rl;function Rg(){if(Rl)return Ds;Rl=1;var e=nu(),t=Ru();function n(u,f){return u===f&&(u!==0||1/u===1/f)||u!==u&&f!==f}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,i=e.useEffect,a=e.useMemo,c=e.useDebugValue;return Ds.useSyncExternalStoreWithSelector=function(u,f,h,g,A){var p=s(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=a(function(){function C(I){if(!b){if(b=!0,v=I,I=g(I),A!==void 0&&m.hasValue){var E=m.value;if(A(E,I))return y=E}return y=I}if(E=y,r(v,I))return E;var S=g(I);return A!==void 0&&A(E,S)?(v=I,E):(v=I,y=S)}var b=!1,v,y,w=h===void 0?null:h;return[function(){return C(f())},w===null?void 0:function(){return C(w())}]},[f,h,g,A]);var x=o(u,p[0],p[1]);return i(function(){m.hasValue=!0,m.value=x},[x]),c(x),x},Ds}var Dl;function Dg(){return Dl||(Dl=1,Rs.exports=Rg()),Rs.exports}var Fg=Dg();const oi=[];let si;function Bg(){return si}function Mg(e){oi.push(e)}function oa(e){const t=(n,r)=>{const o=St(jg).current;let s;try{si=o;for(const i of oi)i.before(o);s=e(n,r);for(const i of oi)i.after(o);o.didInitialize=!0}finally{si=void 0}return s};return t.displayName=e.displayName||e.name,t}function qu(e){return d.forwardRef(oa(e))}function jg(){return{didInitialize:!1}}const Pg=ru(19),Tg=Pg?_g:Og;function we(e,t,n,r,o){return Tg(e,t,n,r,o)}function Ng(e,t,n,r,o){const s=d.useCallback(()=>t(e.getSnapshot(),n,r,o),[e,t,n,r,o]);return Jo.useSyncExternalStore(e.subscribe,s,s)}Mg({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){const r=e.syncHooks[n],o=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,o)||(t=!0,r.value=o)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{const n=new Set;for(const o of e.syncHooks)n.add(o.store);const r=[];for(const o of n)r.push(o.subscribe(t));return()=>{for(const o of r)o()}}),Jo.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function _g(e,t,n,r,o){const s=Bg();if(!s)return Ng(e,t,n,r,o);const i=s.syncIndex;s.syncIndex+=1;let a;return s.didInitialize?(a=s.syncHooks[i],(a.store!==e||a.selector!==t||!Object.is(a.a1,n)||!Object.is(a.a2,r)||!Object.is(a.a3,o))&&(a.store!==e&&(s.didChangeStore=!0),a.store=e,a.selector=t,a.a1=n,a.a2=r,a.a3=o,a.value=t(e.getSnapshot(),n,r,o))):(a={store:e,selector:t,a1:n,a2:r,a3:o,value:t(e.getSnapshot(),n,r,o)},s.syncHooks.push(a)),a.value}function Og(e,t,n,r,o){return Fg.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,s=>t(s,n,r,o))}class Hg{constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const r of this.listeners){if(n!==this.updateTick)return;r(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){this.setState({...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||this.setState({...this.state,[t]:n})}notifyAll(){const t={...this.state};this.setState(t)}use(t,n,r,o){return we(this,t,n,r,o)}}class Gr extends Hg{constructor(t,n={},r){super(t),this.context=n,this.selectors=r}useSyncedValue(t,n){d.useDebugValue(t);const r=this;ie(()=>{r.state[t]!==n&&r.set(t,n)},[r,t,n])}useSyncedValueWithCleanup(t,n){const r=this;ie(()=>(r.state[t]!==n&&r.set(t,n),()=>{r.set(t,void 0)}),[r,t,n])}useSyncedValues(t){const n=this,r=Object.values(t);ie(()=>{n.update(t)},[n,...r])}useControlledProp(t,n){d.useDebugValue(t);const r=this,o=n!==void 0;ie(()=>{o&&!Object.is(r.state[t],n)&&r.setState({...r.state,[t]:n})},[r,t,n,o])}select(t,n,r,o){const s=this.selectors[t];return s(this.state,n,r,o)}useState(t,n,r,o){return d.useDebugValue(t),we(this,this.selectors[t],n,r,o)}useContextCallback(t,n){d.useDebugValue(t);const r=de(n??Er);this.context[t]=r}useStateSetter(t){const n=d.useRef(void 0);return n.current===void 0&&(n.current=r=>{this.set(t,r)}),n.current}observe(t,n){let r;typeof t=="function"?r=t:r=this.selectors[t];let o=r(this.state);return n(o,o,this),this.subscribe(s=>{const i=r(s);if(!Object.is(o,i)){const a=o;o=i,n(i,a,this)}})}}const Lg={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId};class es extends Gr{constructor(t){const{syncOnly:n,nested:r,onOpenChange:o,triggerElements:s,...i}=t;super({...i,positionReference:i.referenceElement,domReferenceElement:i.referenceElement},{onOpenChange:o,dataRef:{current:{}},events:Lu(),nested:r,triggerElements:s},Lg),this.syncOnly=n}syncOpenEvent=(t,n)=>{(!t||!this.state.open||n!=null&&Qh(n))&&(this.context.dataRef.current.openEvent=t?n:void 0)};dispatchOpenChange=(t,n)=>{this.syncOpenEvent(t,n.event);const r={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",r)};setOpen=(t,n)=>{if(this.syncOnly){this.context.onOpenChange?.(t,n);return}this.dispatchOpenChange(t,n),this.context.onOpenChange?.(t,n)}}function ed(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:o,nested:s,onOpenChange:i}=e,a=t.useState("open"),c=t.useState("activeTriggerElement"),u=t.useState(n?"popupElement":"positionerElement"),f=t.context.triggerElements,h=i,g=d.useRef(null);r===void 0&&g.current===null&&(g.current=new es({open:a,transitionStatus:void 0,referenceElement:c,floatingElement:u,triggerElements:f,onOpenChange:h,floatingId:o,syncOnly:!0,nested:s}));const A=r??g.current;return t.useSyncedValue("floatingId",o),ie(()=>{const p={open:a,floatingId:o,referenceElement:c,floatingElement:u};Pe(c)&&(p.domReferenceElement=c),A.state.positionReference===A.state.referenceElement&&(p.positionReference=c),A.update(p)},[a,o,c,u,A]),A.context.onOpenChange=h,A.context.nested=s,A}const ts={tabIndex:-1,[$s]:""};function Kg(e){return t=>t==="touch"?e.current:!0}function td(e,t=!1){const n=Zn(),r=In()!=null,o=St(()=>e(n,r)).current;return ed({popupStore:o,treatPopupAsFloatingElement:t,floatingRootContext:o.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:o.setOpen}),o}function sa({handle:e,store:t}){return ie(()=>e.attachStore(t),[e,t]),null}function Wg(e,t){const n=d.useRef(null),r=d.useRef(null);return d.useCallback(o=>{if(e===void 0)return;let s=!1;if(n.current!==null){const i=n.current,a=r.current,c=t.context.triggerElements.getById(i);a&&c===a&&(t.context.triggerElements.delete(i),s=!0),n.current=null,r.current=null}if(o!==null&&(n.current=e,r.current=o,t.context.triggerElements.add(e,o),s=!0),s){const i=t.context.triggerElements.size;t.select("open")&&t.state.triggerCount!==i&&t.set("triggerCount",i)}},[t,e])}function ia(e,t,n,r=!1){t?e.preventUnmountingOnClose=!1:r&&(e.preventUnmountingOnClose=!0);const o=n?.id??null;(o||t)&&(e.activeTriggerId=o,e.activeTriggerElement=n??null)}function nd(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function Qg(e,t,n,r={}){const o=n.reason,s=o===it,i=t&&o===Gn,a=!t&&(o===Pn||o===Ko),c=nd(n);if(e.context.onOpenChange?.(t,n),n.isCanceled)return;r.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,n);const u=()=>{const f={...r.extraState,open:t};i?f.instantType="focus":a?f.instantType="dismiss":s&&(f.instantType=void 0),ia(f,t,n.trigger,c()),e.update(f)};s?sn.flushSync(u):u()}function rd(e,t,n,r){const o=n.useState("isMountedByTrigger",e),s=Wg(e,n),i=de(c=>{const u=n.select("open"),f=n.select("activeTriggerId");if(f===e){n.update({activeTriggerElement:c,...u?r:null});return}f==null&&u&&n.update({activeTriggerId:e,activeTriggerElement:c,...r})}),a=d.useCallback(c=>{s(c),c&&i(c)},[s,i]);return ie(()=>{o&&n.update({activeTriggerElement:t.current,...r})},[o,n,t,...Object.values(r)]),{registerTrigger:a,isMountedByThisTrigger:o}}function aa(e,t={}){const{closeOnActiveTriggerUnmount:n=!1}=t,r=d.useRef(null),o=e.useState("open"),s=e.useState("triggerCount"),i=e.useState("activeTriggerId"),a=e.useState("activeTriggerElement");ie(()=>{if(!o){r.current=null,e.state.triggerCount!==0&&e.set("triggerCount",0);return}const c=e.context.triggerElements.size,u={};e.state.triggerCount!==c&&(u.triggerCount=c);const f=e.select("activeTriggerId");let h=null;if(f){const g=e.context.triggerElements.getById(f);if(g)r.current=f,g!==e.state.activeTriggerElement&&(u.activeTriggerElement=g);else{for(const[A,p]of e.context.triggerElements.entries())if(p===e.state.activeTriggerElement){u.activeTriggerId=A,u.activeTriggerElement=p,r.current=A;break}u.activeTriggerId===void 0&&(r.current===f?h=f:r.current=null)}}else r.current=null;if(!h&&!f&&c===1){const g=e.context.triggerElements.entries().next();if(!g.done){const[A,p]=g.value;u.activeTriggerId=A,u.activeTriggerElement=p,r.current=A}}(u.triggerCount!==void 0||u.activeTriggerId!==void 0||u.activeTriggerElement!==void 0)&&e.update(u),h&&n&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===h&&!e.context.triggerElements.getById(h)){const g=Ce(Pt);e.setOpen(!1,g),g.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[o,e,s,i,a,n])}function la(e,t,n){const{mounted:r,setMounted:o,transitionStatus:s}=or(e),i=t.useState("preventUnmountingOnClose"),a=e?!1:i;t.useSyncedValues({mounted:r,transitionStatus:s,preventUnmountingOnClose:a});const c=de(()=>{o(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return zt({enabled:r&&!e&&!a,open:e,ref:t.context.popupRef,onComplete(){e||c()}}),{forceUnmount:c,transitionStatus:s}}function ca(e,t){e.useSyncedValues(t),ie(()=>()=>{e.update({activeTriggerProps:lt,inactiveTriggerProps:lt,popupProps:lt})},[e])}function Gg(e,t){ie(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),ie(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class Yr{constructor(){this.idMap=new Map}add(t,n){this.idMap.set(t,n)}delete(t){this.idMap.delete(t)}hasElement(t){for(const n of this.idMap.values())if(n===t)return!0;return!1}hasMatchingElement(t){for(const n of this.idMap.values())if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}}function Yg(){return new es({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new Yr,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function ua(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:Yg(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:lt,inactiveTriggerProps:lt,popupProps:lt}}function od(e,t,n=!1){return new es({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0})}const wr=e=>e.triggerIdProp??e.activeTriggerId,da=e=>e.openProp??e.open,Fl=e=>(e.popupElement?.id??e.floatingId)||void 0;function sd(e,t){return t!==void 0&&da(e)&&wr(e)===t}function zg(e,t){return sd(e,t)?!0:t!==void 0&&da(e)&&wr(e)==null&&e.triggerCount===1}const fa={open:da,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:wr,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:Fl,isTriggerActive:(e,t)=>t!==void 0&&wr(e)===t,isOpenedByTrigger:(e,t)=>sd(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&wr(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>zg(e,t)?Fl(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function id(e){const t=d.useCallback(r=>e===void 0?Er:e.subscribeStore(r),[e]),n=d.useCallback(()=>e===void 0?void 0:e.store,[e]);return Jo.useSyncExternalStore(t,n,()=>e?.serverStore)}function Ug(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,o=Zn(),s=In()!=null,i=St(()=>new es({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Yr,floatingId:o,syncOnly:!1,nested:s})).current;return ie(()=>{const a={open:t,floatingId:o};r.reference!==void 0&&(a.referenceElement=r.reference,a.domReferenceElement=Pe(r.reference)?r.reference:null),r.floating!==void 0&&(a.floatingElement=r.floating),i.update(a)},[t,o,r.reference,r.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i}function Vg(e){return Zg(e,e.rootContext)}function Zg(e,t){const{nodeId:n,externalTree:r}=e,o=t.useState("referenceElement"),s=t.useState("floatingElement"),i=t.useState("domReferenceElement"),a=t.useState("open"),c=t.useState("floatingId"),[u,f]=d.useState(null),[h,g]=d.useState(void 0),[A,p]=d.useState(void 0),m=d.useRef(null),x=wn(r),C=d.useMemo(()=>({reference:o,floating:s,domReference:i}),[o,s,i]),b=Cg({...e,elements:{...C,...u&&{reference:u}}}),v=Pe(h)?h:null,y=A===void 0?t.state.floatingElement:A;t.useSyncedValue("referenceElement",h??null),t.useSyncedValue("domReferenceElement",h===void 0?i:v),t.useSyncedValue("floatingElement",y);const w=d.useCallback(F=>{const T=Pe(F)?{getBoundingClientRect:()=>F.getBoundingClientRect(),getClientRects:()=>F.getClientRects(),contextElement:F}:F;f(T),b.refs.setReference(T)},[b.refs]),I=d.useCallback(F=>{(Pe(F)||F===null)&&(m.current=F,g(F)),(Pe(b.refs.reference.current)||b.refs.reference.current===null||F!==null&&!Pe(F))&&b.refs.setReference(F)},[b.refs,g]),E=d.useCallback(F=>{p(F),b.refs.setFloating(F)},[b.refs]),S=d.useMemo(()=>({...b.refs,setReference:I,setFloating:E,setPositionReference:w,domReference:m}),[b.refs,I,E,w]),R=d.useMemo(()=>({...b.elements,domReference:i}),[b.elements,i]),k=d.useMemo(()=>({...b,dataRef:t.context.dataRef,open:a,onOpenChange:t.setOpen,events:t.context.events,floatingId:c,refs:S,elements:R,nodeId:n,rootStore:t}),[b,S,R,n,t,a,c]);return ie(()=>{i&&(m.current=i)},[i]),ie(()=>{t.context.dataRef.current.floatingContext=k;const F=x?.nodesRef.current.find(T=>T.id===n);F&&(F.context=k)}),d.useMemo(()=>({...b,context:k,refs:S,elements:R,rootStore:t}),[b,S,R,k,t])}const Fs=_i&&an;function ad(e,t={}){const{enabled:n=!0,delay:r}=t,o="rootStore"in e?e.rootStore:e,{events:s,dataRef:i}=o.context,a=d.useRef(!1),c=d.useRef(null),u=d.useRef(!0),f=dt();d.useEffect(()=>{const g=o.select("domReferenceElement");if(!n)return;const A=rt(g);function p(){const C=o.select("domReferenceElement");!o.select("open")&&Ze(C)&&C===vt(Be(C))&&(a.current=!0)}function m(){u.current=!0}function x(){u.current=!1}return Qt(Fe(A,"blur",p),Fs&&Fe(A,"keydown",m,!0),Fs&&Fe(A,"pointerdown",x,!0))},[o,n]),d.useEffect(()=>{if(!n)return;function g(A){if(A.reason===Pn||A.reason===Ko){const p=o.select("domReferenceElement");Pe(p)&&(c.current=p,a.current=!0)}}return s.on("openchange",g),()=>{s.off("openchange",g)}},[s,n,o]);const h=d.useMemo(()=>{function g(){a.current=!1,c.current=null}return{onMouseLeave(){g()},onFocus(A){const p=A.currentTarget;if(a.current){if(c.current===p)return;g()}const m=At(A.nativeEvent);if(Pe(m)){if(Fs&&!A.relatedTarget){if(!u.current&&!Vo(m))return}else if(!Kh(m))return}const x=vo(A.relatedTarget,o.context.triggerElements),{nativeEvent:C,currentTarget:b}=A,v=typeof r=="function"?r():r;if(o.select("open")&&x||v===0||v===void 0){o.setOpen(!0,Ce(Gn,C,b));return}f.start(v,()=>{a.current||o.setOpen(!0,Ce(Gn,C,b))})},onBlur(A){g();const p=A.relatedTarget,m=A.nativeEvent,x=Pe(p)&&p.hasAttribute(Fr("focus-guard"))&&p.getAttribute("data-type")==="outside";f.start(0,()=>{const C=o.select("domReferenceElement"),b=vt(Be(C));!p&&b===C||ve(i.current.floatingContext?.refs.floating.current,b)||ve(C,b)||x||vo(p??b,o.context.triggerElements)||o.setOpen(!1,Ce(Gn,m))})}}},[i,r,o,f]);return d.useMemo(()=>n?{reference:h,trigger:h}:{},[n,h])}class pa{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new Ot,this.restTimeout=new Ot,this.handleCloseOptions=void 0}static create(){return new pa}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const So=new WeakMap;function Ro(e){if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&So.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),So.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function ld(e,t){const{scopeElement:n,referenceElement:r,floatingElement:o}=t,s=So.get(n);s&&s!==e&&Ro(s),Ro(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=o,So.set(n,e),n.style.pointerEvents="none",r.style.pointerEvents="auto",o.style.pointerEvents="auto"}function ha(e){const t=e.context.dataRef.current,n=St(()=>t.hoverInteractionState??pa.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=n),Ui(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function cd(e,t={}){const{enabled:n=!0,closeDelay:r=0,nodeId:o}=t,s="rootStore"in e?e.rootStore:e,i=s.useState("open"),a=s.useState("floatingElement"),c=s.useState("domReferenceElement"),{dataRef:u}=s.context,f=wn(),h=In(),g=ha(s),A=dt(),p=de(()=>Mu(u.current.openEvent?.type,g.interactedInside)),m=de(()=>IA(u.current.openEvent?.type)),x=de(()=>{Ro(g)});ie(()=>{i||(g.pointerType=void 0,g.restTimeoutPending=!1,g.interactedInside=!1,x())},[i,g,x]),d.useEffect(()=>x,[x]),ie(()=>{if(n&&i&&g.handleCloseOptions?.blockPointerEvents&&m()&&Pe(c)&&a){const C=c,b=a,v=Be(a),y=f?.nodesRef.current.find(S=>S.id===h)?.context?.elements.floating;y&&(y.style.pointerEvents="");const w=g.pointerEventsScopeElement!==b?g.pointerEventsScopeElement:null,I=y!==b?y:null,E=g.handleCloseOptions?.getScope?.()??w??I??C.closest("[data-rootownerid]")??v.body;return ld(g,{scopeElement:E,referenceElement:C,floatingElement:b}),()=>{x()}}},[n,i,c,a,g,m,f,h,x]),d.useEffect(()=>{if(!n)return;function C(){return!!(f&&h&&xn(f.nodesRef.current,h).length>0)}function b(S){const R=qn(r,"close",g.pointerType),k=()=>{s.setOpen(!1,Ce(it,S)),f?.events.emit("floating.closed",S)};R?g.openChangeTimeout.start(R,k):(g.openChangeTimeout.clear(),k())}function v(S){const R=At(S);if(!Lh(R)){g.interactedInside=!1;return}g.interactedInside=R?.closest("[aria-haspopup]")!=null}function y(){g.openChangeTimeout.clear(),A.clear(),f?.events.off("floating.closed",I),x()}function w(S){if(C()&&f){f.events.on("floating.closed",I);return}if(vo(S.relatedTarget,s.context.triggerElements))return;const R=u.current.floatingContext?.nodeId??o,k=S.relatedTarget;if(!(f&&R&&Pe(k)&&xn(f.nodesRef.current,R,!1).some(T=>ve(T.context?.elements.floating,k)))){if(g.handler){g.handler(S);return}x(),m()&&!p()&&b(S)}}function I(S){!f||!h||C()||A.start(0,()=>{f.events.off("floating.closed",I),s.setOpen(!1,Ce(it,S)),f.events.emit("floating.closed",S)})}const E=a;return Qt(E&&Fe(E,"mouseenter",y),E&&Fe(E,"mouseleave",w),E&&Fe(E,"pointerdown",v,!0),()=>{f?.events.off("floating.closed",I)})},[n,a,s,u,r,o,m,p,x,g,f,h,A])}const Jg={current:null};function ud(e,t={}){const{enabled:n=!0,delay:r=0,handleClose:o=null,mouseOnly:s=!1,restMs:i=0,move:a=!0,triggerElementRef:c=Jg,externalTree:u,isActiveTrigger:f=!0,getHandleCloseContext:h,isClosing:g,shouldOpen:A,guardStaleOpen:p=!1}=t,m="rootStore"in e?e.rootStore:e,{dataRef:x,events:C}=m.context,b=wn(u),v=ha(m),y=d.useRef(!1),w=qe(o),I=qe(r),E=qe(i),S=qe(n),R=qe(A),k=qe(g),F=de(()=>Mu(x.current.openEvent?.type,v.interactedInside)),T=de(()=>R.current?.()!==!1),N=de((O,_,B)=>{const H=m.context.triggerElements;if(H.hasElement(_))return!O||!ve(O,_);if(!Pe(B))return!1;const P=B;return H.hasMatchingElement(M=>ve(M,P))&&(!O||!ve(O,P))}),j=de(()=>{if(!v.handler)return;Be(m.select("domReferenceElement")).removeEventListener("mousemove",v.handler),v.handler=void 0}),D=de(()=>{Ro(v)});return f&&(v.handleCloseOptions=w.current?.__options),d.useEffect(()=>j,[j]),d.useEffect(()=>{if(!n)return;function O(_){_.open?y.current=!1:(y.current=_.reason===it,j(),v.openChangeTimeout.clear(),v.restTimeout.clear(),v.blockMouseMove=!0,v.restTimeoutPending=!1)}return C.on("openchange",O),()=>{C.off("openchange",O)}},[n,C,v,j]),d.useEffect(()=>{if(!n)return;function O(L,G=!0){const V=qn(I.current,"close",v.pointerType);V?v.openChangeTimeout.start(V,()=>{m.setOpen(!1,Ce(it,L)),b?.events.emit("floating.closed",L)}):G&&(v.openChangeTimeout.clear(),m.setOpen(!1,Ce(it,L)),b?.events.emit("floating.closed",L))}const _=c.current??(f?m.select("domReferenceElement"):null);if(!Pe(_))return;function B(L){if(v.openChangeTimeout.clear(),v.blockMouseMove=!1,s&&!mn(v.pointerType))return;const G=fl(E.current),V=qn(I.current,"open",v.pointerType),Y=At(L),Q=L.currentTarget??null,z=m.select("domReferenceElement");let K=Q;if(Pe(Y)&&!m.context.triggerElements.hasElement(Y)){for(const se of m.context.triggerElements.elements())if(ve(se,Y)){K=se;break}}Pe(Q)&&Pe(z)&&!m.context.triggerElements.hasElement(Q)&&ve(Q,z)&&(K=z);const X=K==null?!1:N(z,K,Y),ae=m.select("open"),te=k.current?.()??m.select("transitionStatus")==="ending",$=!ae&&te&&y.current,ee=!X&&Pe(K)&&Pe(z)&&ve(z,K)&&$,ue=G>0&&!V,ce=X&&(ae||$)||ee,he=!ae||X;if(ce){T()&&m.setOpen(!0,Ce(it,L,K));return}ue||(V?v.openChangeTimeout.start(V,()=>{he&&T()&&m.setOpen(!0,Ce(it,L,K))}):he&&T()&&m.setOpen(!0,Ce(it,L,K)))}function H(L){if(F()){D();return}j();const G=m.select("domReferenceElement"),V=Be(G);v.restTimeout.clear(),v.restTimeoutPending=!1;const Y=x.current.floatingContext??h?.();if(vo(L.relatedTarget,m.context.triggerElements))return;if(w.current&&Y){m.select("open")||v.openChangeTimeout.clear();const z=c.current;v.handler=w.current({...Y,tree:b,x:L.clientX,y:L.clientY,onClose(){D(),j(),S.current&&!F()&&z===m.select("domReferenceElement")&&O(L,!0)}}),V.addEventListener("mousemove",v.handler),v.handler(L);return}(v.pointerType!=="touch"||!ve(m.select("floatingElement"),L.relatedTarget))&&O(L)}function P(L){ve(_,L.relatedTarget)||(v.openChangeTimeout.clear(),v.restTimeout.clear(),v.restTimeoutPending=!1)}const M=p?Fe(_,"mouseout",P):void 0;return a?Qt(Fe(_,"mousemove",B,{once:!0}),Fe(_,"mouseenter",B),Fe(_,"mouseleave",H),M):Qt(Fe(_,"mouseenter",B),Fe(_,"mouseleave",H),M)},[j,D,x,I,m,n,w,v,f,N,F,s,a,E,c,b,S,h,k,T,p]),d.useMemo(()=>{if(!n)return;function O(_){v.pointerType=_.pointerType}return{onPointerDown:O,onPointerEnter:O,onMouseMove(_){const{nativeEvent:B}=_,H=_.currentTarget,P=m.select("domReferenceElement"),M=m.select("open"),L=N(P,H,_.target);if(s&&!mn(v.pointerType))return;if(M&&L&&v.handleCloseOptions?.blockPointerEvents){const Y=m.select("floatingElement");if(Y){const Q=v.handleCloseOptions?.getScope?.()??H.ownerDocument.body;ld(v,{scopeElement:Q,referenceElement:H,floatingElement:Y})}}const G=fl(E.current);if(M&&!L||G===0||!L&&v.restTimeoutPending&&_.movementX**2+_.movementY**2<2)return;v.restTimeout.clear();function V(){if(v.restTimeoutPending=!1,F())return;const Y=m.select("open");!v.blockMouseMove&&(!Y||L)&&T()&&m.setOpen(!0,Ce(it,B,H))}v.pointerType==="touch"?sn.flushSync(()=>{V()}):L&&M?V():(v.restTimeoutPending=!0,v.restTimeout.start(G,V))}}},[n,v,F,N,s,m,E,T])}const $g="Escape";function Bl(e){return an&&e.movementX===0&&e.movementY===0}function ns(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function qr(e,t){return ns(t,e===Au||e===Hi,e===zo||e===Uo)}function Bs(e,t,n){return ns(t,e===Hi,n?e===zo:e===Uo)||e==="Enter"||e===" "||e===""}function Xg(e,t,n){return ns(t,n?e===zo:e===Uo,e===Hi)}function qg(e,t,n,r){const o=n?e===Uo:e===zo,s=e===Au;return t==="both"||t==="horizontal"&&r?e===$g:ns(t,o,s)}function dd(e,t){const{listRef:n,activeIndex:r,onNavigate:o=()=>{},enabled:s=!0,selectedIndex:i=null,allowEscape:a=!1,loopFocus:c=!1,nested:u=!1,rtl:f=!1,virtual:h=!1,focusItemOnOpen:g="auto",focusItemOnHover:A=!0,openOnArrowKeyDown:p=!0,disabledIndices:m=void 0,orientation:x="vertical",parentOrientation:C,id:b,resetOnPointerLeave:v=!0,externalTree:y,grid:w}=t,I=w!=null,E="rootStore"in e?e.rootStore:e,S=E.useState("open"),R=E.useState("floatingElement"),k=E.useState("domReferenceElement"),F=E.context.dataRef,T=yo(R),N=Xs(k),j=qe(T),D=In(),O=wn(y),_=d.useRef(g),B=d.useRef(i??-1),H=d.useRef(null),P=d.useRef(!0),M=de(W=>{o(B.current===-1?null:B.current,W)}),L=d.useRef(!!R),G=d.useRef(S),V=d.useRef(!1),Y=d.useRef(!1),Q=d.useRef(null),z=qe(m),K=qe(S),X=qe(i),ae=qe(v),te=Xn(),$=Xn(),ee=de(()=>{function W(ne){h?O?.events.emit("virtualfocus",ne):Q.current=go(ne,{sync:V.current,preventScroll:!0})}const U=n.current[B.current],be=Y.current;U&&W(U),(V.current?ne=>ne():ne=>te.request(ne))(()=>{const ne=n.current[B.current]||U;if(!ne)return;U||W(ne),re&&(be||!P.current)&&ne.scrollIntoView?.({block:"nearest",inline:"nearest"})})});ie(()=>{F.current.orientation=x},[F,x]),ie(()=>{s&&(S&&R?(B.current=i??-1,_.current&&i!=null&&(Y.current=!0,M())):L.current&&(B.current=-1,M()))},[s,S,R,i,M]),ie(()=>{if(s){if(!S){V.current=!1;return}if(R)if(r==null){if(V.current=!1,X.current!=null)return;if(L.current&&(B.current=-1,ee()),(!G.current||!L.current)&&_.current&&(H.current!=null||_.current===!0&&H.current==null)){let W=0;const U=()=>{n.current[0]==null?(W<2&&(W?q=>$.request(q):queueMicrotask)(U),W+=1):(B.current=H.current==null||Bs(H.current,x,f)||u?Ao(n):ei(n),H.current=null,M())};U()}}else Ir(n.current,r)||(B.current=r,ee(),Y.current=!1)}},[s,S,R,r,X,u,n,x,f,M,ee,$]),ie(()=>{if(!s||R||!O||h||!L.current)return;const W=O.nodesRef.current,U=W.find(ne=>ne.id===D)?.context?.elements.floating,be=vt(Be(k??U??null)),q=W.some(ne=>ne.context&&ve(ne.context.elements.floating,be));U&&!q&&P.current&&U.focus({preventScroll:!0})},[s,R,k,O,D,h]),ie(()=>{G.current=S,L.current=!!R}),ie(()=>{S||(H.current=null,_.current=g)},[S,g]);const ue=r!=null,ce=de(W=>{if(!K.current)return;const U=n.current.indexOf(W.currentTarget);U!==-1&&(B.current!==U||r!==U)&&(B.current=U,M(W))}),he=de(()=>C??O?.nodesRef.current.find(W=>W.id===D)?.context?.dataRef?.current.orientation),se=de(()=>Ao(n,z.current)),Ae=de(W=>{if(P.current=!1,V.current=!0,W.which===229||!K.current&&W.currentTarget===j.current)return;if(u&&qg(W.key,x,f,I)){qr(W.key,he())||Lt(W),E.setOpen(!1,Ce(Zs,W.nativeEvent)),Ze(k)&&(h?O?.events.emit("virtualfocus",k):k.focus());return}const U=B.current,be=Ao(n,m),q=ei(n,m);if(N||(W.key==="Home"&&(Lt(W),B.current=be,M(W)),W.key==="End"&&(Lt(W),B.current=q,M(W))),w!=null){const ne=w(W,B.current,n,x,c,f,m,be,q);if(ne!=null&&(B.current=ne,M(W)),x==="both")return}if(qr(W.key,x)){if(Lt(W),S&&!h&&vt(W.currentTarget.ownerDocument)===W.currentTarget){B.current=Bs(W.key,x,f)?be:q,M(W);return}Bs(W.key,x,f)?c?U>=q?a&&U!==n.current.length?B.current=-1:(V.current=!1,B.current=be):B.current=tn(n.current,{startingIndex:U,disabledIndices:m}):B.current=Math.min(q,tn(n.current,{startingIndex:U,disabledIndices:m})):c?U<=be?a&&U!==-1?B.current=n.current.length:(V.current=!1,B.current=q):B.current=tn(n.current,{startingIndex:U,decrement:!0,disabledIndices:m}):B.current=Math.max(be,tn(n.current,{startingIndex:U,decrement:!0,disabledIndices:m})),Ir(n.current,B.current)&&(B.current=-1),M(W)}}),re=d.useMemo(()=>({onFocus(U){V.current=!0,ce(U)},onClick:({currentTarget:U})=>U.focus({preventScroll:!0}),onMouseMove(U){Bl(U)||(V.current=!0,Y.current=!1,A&&ce(U))},onPointerLeave(U){if(!K.current||!P.current||U.pointerType==="touch")return;V.current=!0;const be=U.relatedTarget;if(!(!A||n.current.includes(be))&&ae.current&&(Q.current?.(),Q.current=null,B.current=-1,M(U),!h)){const q=j.current,ne=vt(Be(q));q&&ve(q,ne)&&q.focus({preventScroll:!0})}}}),[ce,K,j,A,n,M,ae,h]),oe=d.useMemo(()=>h&&S&&ue&&{"aria-activedescendant":`${b}-${r}`},[h,S,ue,b,r]),le=d.useMemo(()=>({"aria-orientation":x==="both"?void 0:x,...N?{}:oe,onKeyDown(W){if(W.key==="Tab"&&W.shiftKey&&S&&!h){const U=At(W.nativeEvent);if(U&&!ve(j.current,U))return;Lt(W),E.setOpen(!1,Ce(Bn,W.nativeEvent)),Ze(k)&&k.focus();return}Ae(W)},onPointerMove(W){Bl(W)||(P.current=!0)}}),[oe,Ae,j,x,N,E,S,h,k]),ge=d.useMemo(()=>{function W(q){E.setOpen(!0,Ce(Zs,q.nativeEvent,q.currentTarget))}function U(q){g==="auto"&&Li(q.nativeEvent)&&(_.current=!h)}function be(q){_.current=g,g==="auto"&&Ki(q.nativeEvent)&&(_.current=!0)}return{onKeyDown(q){const ne=E.select("open");P.current=!1;const Ee=q.key.startsWith("Arrow"),Se=Xg(q.key,he(),f),Ge=qr(q.key,x),ze=(u?Se:Ge)||q.key==="Enter"||q.key.trim()==="";if(h&&ne)return Ae(q);if(!(!ne&&!p&&Ee)){if(ze){const Le=qr(q.key,he());H.current=u&&Le?null:q.key}if(u){Se&&(Lt(q),ne?(B.current=se(),M(q)):W(q));return}Ge&&(X.current!=null&&(B.current=X.current),Lt(q),!ne&&p?W(q):Ae(q),ne&&M(q))}},onFocus(q){E.select("open")&&!h&&(B.current=-1,M(q))},onPointerDown:be,onPointerEnter:be,onMouseDown:U,onClick:U}},[Ae,g,se,u,M,E,p,x,he,f,X,h]),me=d.useMemo(()=>({...oe,...ge}),[oe,ge]);return d.useMemo(()=>s?{reference:me,floating:le,item:re,trigger:ge}:{},[s,me,le,ge,re])}function fd(e,t){const{listRef:n,elementsRef:r,activeIndex:o,onMatch:s,disabledIndices:i,onTyping:a,enabled:c=!0,resetMs:u=750,selectedIndex:f=null}=t,h="rootStore"in e?e.rootStore:e,g=h.useState("open"),A=dt(),p=d.useRef(""),m=d.useRef(f??o??-1),x=d.useRef(null),C=de(y=>{function w(j){return r?.current[j]}function I(j){const D=w(j);return D&&!Zo(D)||D?.matches(":disabled")?!1:i==null||!wo(Nt,j,i)}function E(j,D,O=0){if(j.length===0)return-1;const _=(O%j.length+j.length)%j.length,B=D.toLowerCase();for(let H=0;H<j.length;H+=1){const P=(_+H)%j.length;if(!(!j[P]?.toLowerCase().startsWith(B)||!I(P)))return P}return-1}const S=n.current;if(p.current.length>0&&y.key===" "&&(Lt(y),a?.(!0)),p.current.length>0&&p.current[0]!==" "&&E(S,p.current)===-1&&y.key!==" "&&a?.(!1),S==null||y.key.length!==1||y.ctrlKey||y.metaKey||y.altKey)return;g&&y.key!==" "&&(Lt(y),a?.(!0));const R=p.current==="";R&&(m.current=f??o??-1),S.every((j,D)=>j&&I(D)?j[0]?.toLowerCase()!==j[1]?.toLowerCase():!0)&&p.current===y.key&&(p.current="",m.current=x.current),p.current+=y.key,A.start(u,()=>{p.current="",m.current=x.current,a?.(!1)});const T=((R?f??o??-1:m.current)??0)+1,N=E(S,p.current,T);N!==-1?(s?.(N),x.current=N):y.key!==" "&&(p.current="",a?.(!1))}),b=de(y=>{const w=y.relatedTarget,I=h.select("domReferenceElement"),E=h.select("floatingElement");ve(I,w)||ve(E,w)||(A.clear(),p.current="",m.current=x.current,a?.(!1))});ie(()=>{!g&&f!==null||(A.clear(),x.current=null,p.current!==""&&(p.current=""))},[g,f,A]);const v=d.useMemo(()=>({onKeyDown:C,onBlur:b}),[C,b]);return d.useMemo(()=>c?{reference:v,floating:v}:{},[c,v])}const Ml=.1,em=Ml*Ml,Oe=.5;function eo(e,t,n,r,o,s){return r>=t!=s>=t&&e<=(o-n)*(t-r)/(s-r)+n}function to(e,t,n,r,o,s,i,a,c,u){let f=!1;return eo(e,t,n,r,o,s)&&(f=!f),eo(e,t,o,s,i,a)&&(f=!f),eo(e,t,i,a,c,u)&&(f=!f),eo(e,t,c,u,n,r)&&(f=!f),f}function tm(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function no(e,t,n,r,o,s){const i=Math.min(n,o),a=Math.max(n,o),c=Math.min(r,s),u=Math.max(r,s);return e>=i&&e<=a&&t>=c&&t<=u}function pd(e={}){const{blockPointerEvents:t=!1}=e,n=new Ot,r=({x:o,y:s,placement:i,elements:a,onClose:c,nodeId:u,tree:f})=>{const h=i?.split("-")[0];let g=!1,A=null,p=null,m=typeof performance<"u"?performance.now():0;function x(b,v){const y=performance.now(),w=y-m;if(A===null||p===null||w===0)return A=b,p=v,m=y,!1;const I=b-A,E=v-p,S=I*I+E*E,R=w*w*em;return A=b,p=v,m=y,S<R}function C(){n.clear(),c()}return function(v){n.clear();const y=a.domReference,w=a.floating;if(!y||!w||h==null||o==null||s==null)return;const{clientX:I,clientY:E}=v,S=At(v),R=v.type==="mouseleave",k=ve(w,S),F=ve(y,S);if(k&&(g=!0,!R))return;if(F&&(g=!1,!R)){g=!0;return}if(R&&Pe(v.relatedTarget)&&ve(w,v.relatedTarget))return;function T(){return!!(f&&xn(f.nodesRef.current,u).length>0)}function N(){T()||C()}if(T())return;const j=y.getBoundingClientRect(),D=w.getBoundingClientRect(),O=o>D.right-D.width/2,_=s>D.bottom-D.height/2,B=D.width>j.width,H=D.height>j.height,P=(B?j:D).left,M=(B?j:D).right,L=(H?j:D).top,G=(H?j:D).bottom;if(h==="top"&&s>=j.bottom-1||h==="bottom"&&s<=j.top+1||h==="left"&&o>=j.right-1||h==="right"&&o<=j.left+1){N();return}let V=!1;switch(h){case"top":V=no(I,E,P,j.top+1,M,D.bottom-1);break;case"bottom":V=no(I,E,P,D.top+1,M,j.bottom-1);break;case"left":V=no(I,E,D.right-1,G,j.left+1,L);break;case"right":V=no(I,E,j.right-1,G,D.left+1,L);break}if(V)return;if(g&&!tm(I,E,j)){N();return}if(!R&&x(I,E)){N();return}let Y=!1;switch(h){case"top":{const Q=B?Oe/2:Oe*4,z=B||O?o+Q:o-Q,K=B?o-Q:O?o+Q:o-Q,X=s+Oe+1,ae=O||B?D.bottom-Oe:D.top,te=O?B?D.bottom-Oe:D.top:D.bottom-Oe;Y=to(I,E,z,X,K,X,D.left,ae,D.right,te);break}case"bottom":{const Q=B?Oe/2:Oe*4,z=B||O?o+Q:o-Q,K=B?o-Q:O?o+Q:o-Q,X=s-Oe,ae=O||B?D.top+Oe:D.bottom,te=O?B?D.top+Oe:D.bottom:D.top+Oe;Y=to(I,E,z,X,K,X,D.left,ae,D.right,te);break}case"left":{const Q=H?Oe/2:Oe*4,z=H||_?s+Q:s-Q,K=H?s-Q:_?s+Q:s-Q,X=o+Oe+1,ae=_||H?D.right-Oe:D.left,te=_?H?D.right-Oe:D.left:D.right-Oe;Y=to(I,E,ae,D.top,te,D.bottom,X,z,X,K);break}case"right":{const Q=H?Oe/2:Oe*4,z=H||_?s+Q:s-Q,K=H?s-Q:_?s+Q:s-Q,X=o-Oe,ae=_||H?D.left+Oe:D.right,te=_?H?D.left+Oe:D.right:D.left+Oe;Y=to(I,E,X,z,X,K,ae,D.top,te,D.bottom);break}}Y?g||n.start(40,N):N()}};return r.__options={...e,blockPointerEvents:t},r}const hd=d.createContext(void 0);function nm(){const e=d.useContext(hd);if(e===void 0)throw new Error(ot(26));return e}const ii="ArrowUp",ai="ArrowDown",li="ArrowLeft",ci="ArrowRight",ui="Home",di="End",rs=new Set([ii,ai,li,ci,ui,di]),rm="Shift",om=[rm,"Control","Alt","Meta"];function sm(e){return Ze(e)&&e.tagName==="INPUT"}function jl(e){return!!(sm(e)&&e.selectionStart!=null||Ze(e)&&e.tagName==="TEXTAREA")}function Pl(e,t,n,r){if(!e||!t||!t.scrollTo)return;let o=e.scrollLeft,s=e.scrollTop;const i=e.clientWidth<e.scrollWidth,a=e.clientHeight<e.scrollHeight;if(i&&r!=="vertical"){const c=Tl(e,t,"left"),u=ro(e),f=ro(t);n==="ltr"&&(c+t.offsetWidth+f.scrollMarginRight>e.scrollLeft+e.clientWidth-u.scrollPaddingRight?o=c+t.offsetWidth+f.scrollMarginRight-e.clientWidth+u.scrollPaddingRight:c-f.scrollMarginLeft<e.scrollLeft+u.scrollPaddingLeft&&(o=c-f.scrollMarginLeft-u.scrollPaddingLeft)),n==="rtl"&&(c-f.scrollMarginLeft<e.scrollLeft+u.scrollPaddingLeft?o=c-f.scrollMarginLeft-u.scrollPaddingLeft:c+t.offsetWidth+f.scrollMarginRight>e.scrollLeft+e.clientWidth-u.scrollPaddingRight&&(o=c+t.offsetWidth+f.scrollMarginRight-e.clientWidth+u.scrollPaddingRight))}if(a&&r!=="horizontal"){const c=Tl(e,t,"top"),u=ro(e),f=ro(t);c-f.scrollMarginTop<e.scrollTop+u.scrollPaddingTop?s=c-f.scrollMarginTop-u.scrollPaddingTop:c+t.offsetHeight+f.scrollMarginBottom>e.scrollTop+e.clientHeight-u.scrollPaddingBottom&&(s=c+t.offsetHeight+f.scrollMarginBottom-e.clientHeight+u.scrollPaddingBottom)}e.scrollTo({left:o,top:s,behavior:"auto"})}function Tl(e,t,n){const r=n==="left"?"offsetLeft":"offsetTop";let o=0;for(;t.offsetParent&&(o+=t[r],t.offsetParent!==e);)t=t.offsetParent;return o}function ro(e){const t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}const im={...Wr,...Nn,nestedDialogOpen(e){return e?{"data-nested-dialog-open":""}:null}},Aa=d.forwardRef(function(t,n){const{render:r,className:o,style:s,finalFocus:i,initialFocus:a,...c}=t,u=_n(),f=u.useState("descriptionElementId"),h=u.useState("disablePointerDismissal"),g=u.useState("floatingRootContext"),A=u.useState("popupProps"),p=u.useState("modal"),m=u.useState("mounted"),x=u.useState("nested"),C=u.useState("nestedOpenDialogCount"),b=u.useState("open"),v=u.useState("openMethod"),y=u.useState("titleElementId"),w=u.useState("transitionStatus"),I=u.useState("role"),E=g.useState("floatingId");nm(),zt({open:b,ref:u.context.popupRef,onComplete(){b&&u.context.onOpenChangeComplete?.(!0)}});const S=a===void 0?Kg(u.context.popupRef):a,R=C>0,k=u.useStateSetter("popupElement"),T=Me("div",t,{state:{open:b,nested:x,transitionStatus:w,nestedDialogOpen:R},props:[A,{id:E,"aria-labelledby":y,"aria-describedby":f,role:I,...ts,hidden:!m,onKeyDown(N){rs.has(N.key)&&N.stopPropagation()},style:{"--nested-dialogs":C}},c],ref:[n,u.context.popupRef,k],stateAttributesMapping:im});return l.jsx(na,{context:g,openInteractionType:v,disabled:!m,closeOnFocusOut:!h,initialFocus:S,returnFocus:i,modal:p!==!1,restoreFocus:"popup",children:T})});function ga(e){return ru(19)?e:e?"true":void 0}const ma=d.forwardRef(function(t,n){const{cutout:r,...o}=t;let s;if(r){const i=r.getBoundingClientRect();s=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${i.left}px ${i.top}px,${i.left}px ${i.bottom}px,${i.right}px ${i.bottom}px,${i.right}px ${i.top}px,${i.left}px ${i.top}px)`}return l.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...o,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})}),xa=d.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t,s=_n(),i=s.useState("mounted"),a=s.useState("modal"),c=s.useState("open");return i||r?l.jsx(hd.Provider,{value:r,children:l.jsxs(qi,{ref:n,...o,children:[i&&a===!0&&l.jsx(ma,{ref:s.context.internalBackdropRef,inert:ga(!c)}),t.children]})}):null});let Nl={},_l={},Ol="";function os(e,t){return ki(e)?e:t}function Hl(e,t,n){return/hidden|clip/.test(e.getComputedStyle(os(t,n)).overflowY)}function am(e){if(typeof document>"u")return!1;const t=Be(e);return rt(t).innerWidth-t.documentElement.clientWidth>0}function lm(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=Be(e),r=n.documentElement,o=n.body,s=os(r,o),i=s.style.overflowY,a=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",s.style.overflowY="scroll";const c=s.offsetWidth;s.style.overflowY="hidden";const u=s.offsetWidth;return s.style.overflowY=i,r.style.scrollbarGutter=a,c===u}function cm(e){const t=Be(e),n=t.documentElement,r=t.body,o=os(n,r),s={overflowY:o.style.overflowY,overflowX:o.style.overflowX};return Object.assign(o.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(o.style,s)}}function um(e){const t=Be(e),n=t.documentElement,r=t.body,o=rt(n);let s=0,i=0,a=!1;const c=It.create();if(an&&(o.visualViewport?.scale??1)!==1)return()=>{};function u(){const A=o.getComputedStyle(n),p=o.getComputedStyle(r),C=(A.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";s=n.scrollTop,i=n.scrollLeft,Nl={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Ol=n.style.scrollBehavior,_l={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const b=n.scrollHeight>n.clientHeight,v=n.scrollWidth>n.clientWidth,y=A.overflowY==="scroll"||p.overflowY==="scroll",w=A.overflowX==="scroll"||p.overflowX==="scroll",I=Math.max(0,o.innerWidth-r.clientWidth),E=Math.max(0,o.innerHeight-r.clientHeight),S=parseFloat(p.marginTop)+parseFloat(p.marginBottom),R=parseFloat(p.marginLeft)+parseFloat(p.marginRight),k=os(n,r);if(a=lm(e),a){n.style.scrollbarGutter=C,k.style.overflowY="hidden",k.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:C,overflowY:"hidden",overflowX:"hidden"}),(b||y)&&(n.style.overflowY="scroll"),(v||w)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:S||E?`calc(100dvh - ${S+E}px)`:"100dvh",width:R||I?`calc(100vw - ${R+I}px)`:"100vw",boxSizing:"border-box",overflowY:"hidden",overflowX:"hidden",scrollBehavior:"unset"}),r.scrollTop=s,r.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function f(){Object.assign(n.style,Nl),Object.assign(r.style,_l),a||(n.scrollTop=s,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=Ol)}function h(){f(),c.request(u)}u();const g=Fe(o,"resize",h);return()=>{c.cancel(),f(),typeof o.removeEventListener=="function"&&g()}}class dm{lockCount=0;restore=null;timeoutLock=Ot.create();timeoutUnlock=Ot.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const n=Be(t),r=n.documentElement,o=n.body,s=rt(r);if(Hl(s,r,o)){const a=new s.MutationObserver(()=>{Hl(s,r,o)||(a.disconnect(),this.restore=null,this.lock(t))}),c={attributes:!0};a.observe(r,c),a.observe(o,c),this.restore=()=>a.disconnect();return}const i=Yo||!am(t);this.restore=i?cm(t):um(t)}}const fm=new dm;function Ad(e=!0,t=null){ie(()=>{if(e)return fm.acquire(t)},[e,t])}function pm({store:e,parentContext:t,isDrawer:n}){const r=e.useState("open"),o=e.useState("disablePointerDismissal"),s=e.useState("modal"),i=e.useState("popupElement"),a=e.useState("floatingRootContext"),[c,u]=d.useState(0),[f,h]=d.useState(0),g=c===0,A=Xo(a,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:s==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(p){if(!e.context.outsidePressEnabledRef.current||"button"in p&&p.button!==0)return!1;if("touches"in p){if(p.type==="touchend"){if(p.changedTouches.length!==1||p.touches.length!==0)return!1}else if(p.touches.length!==1)return!1}const m=At(p);if(g&&!o){if(s){const x=e.context.internalBackdropRef.current,C=e.context.backdropRef.current;return x||C?x===m||C===m||ve(m,i)&&!m?.hasAttribute("data-base-ui-portal"):!0}return!0}return!1},escapeKey:g});return Ad(r&&s===!0,i),e.useContextCallback("onNestedDialogOpen",(p,m)=>{u(p),h(m)}),ie(()=>(t?.onNestedDialogOpen&&(r?t.onNestedDialogOpen(c+1,f+(n?1:0)):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,c,f,t]),ca(e,{activeTriggerProps:A.reference,inactiveTriggerProps:A.trigger,popupProps:A.floating,nestedOpenDialogCount:c,nestedOpenDrawerCount:f}),null}const hm={...fa,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role};class Am extends Gr{constructor(t,n,r){const o=new Yr,s=gm(t,o,n,r);super(s,mm(o),hm)}setOpen=(t,n)=>{if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&n.trigger==null&&this.state.activeTriggerId!=null&&(n.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,n),n.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(t,n);const r={open:t};ia(r,t,n.trigger),this.update(r)}}function gm(e,t,n,r=!1){const o={...ua(),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e};return o.floatingRootContext=od(t,n,r),o}function mm(e){return{popupRef:d.createRef(),backdropRef:d.createRef(),internalBackdropRef:d.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function gd(e,t){const{children:n,open:r,defaultOpen:o=!1,onOpenChange:s,onOpenChangeComplete:i,disablePointerDismissal:a=!1,modal:c=!0,actionsRef:u,handle:f,triggerId:h,defaultTriggerId:g=null}=t,A=e==="drawer",p=e==="alert-dialog",m=p?!0:c,x=p||a,C=p?"alertdialog":"dialog",b=_n(!0),v=b!=null,y={modal:m,disablePointerDismissal:x,nested:v,role:C},w=td((F,T)=>new Am({open:o,openProp:r,activeTriggerId:g,triggerIdProp:h,...y},F,T),!0);w.useControlledProp("openProp",r),w.useControlledProp("triggerIdProp",h),w.useSyncedValues(y),w.useContextCallback("onOpenChange",s),w.useContextCallback("onOpenChangeComplete",i);const I=w.useState("open"),E=w.useState("mounted"),S=w.useState("payload");Gg(w,I),aa(w);const{forceUnmount:R}=la(I,w);d.useImperativeHandle(u,()=>({unmount:R,close:()=>w.setOpen(!1,Ce(Ei))}),[R,w]);const k=I||E;return l.jsxs(Fu.Provider,{value:w,children:[f&&l.jsx(sa,{handle:f,store:w}),k&&l.jsx(pm,{store:w,parentContext:b?.context,isDrawer:A}),typeof n=="function"?n({payload:S}):n]})}function md(e){return gd("dialog",e)}const ba=d.forwardRef(function(t,n){const{render:r,className:o,style:s,id:i,...a}=t,c=_n(),u=wt(i);return c.useSyncedValueWithCleanup("titleElementId",u),Me("h2",t,{ref:n,props:[{id:u},a]})});function xm(e){const t=d.useRef(""),n=d.useCallback(o=>{o.defaultPrevented||(t.current=o.pointerType,e(o,o.pointerType))},[e]);return{onClick:d.useCallback(o=>{if(o.detail===0){e(o,"keyboard");return}"pointerType"in o?e(o,o.pointerType):e(o,t.current),t.current=""},[e]),onPointerDown:n}}function ss(e,t){const n=d.useRef(e),r=de(t);ie(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function bm(e,t){const n=de((s,i)=>{(typeof e=="function"?e():e)||t(i||(Yo?"touch":""))}),{onClick:r,onPointerDown:o}=xm(n);return d.useMemo(()=>({onClick:r,onPointerDown:o}),[r,o])}function xd(e){const[t,n]=d.useState(null),r=bm(e,n);return ss(e,o=>{o&&!e&&n(null)}),d.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}function vm({...e}){return l.jsx(md,{"data-slot":"sheet",...e})}function ym({...e}){return l.jsx(xa,{"data-slot":"sheet-portal",...e})}function Cm({className:e,...t}){return l.jsx(Ji,{"data-slot":"sheet-overlay",className:fe("fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs",e),...t})}function Im({className:e,children:t,side:n="right",showCloseButton:r=!0,...o}){return l.jsxs(ym,{children:[l.jsx(Cm,{}),l.jsxs(Aa,{"data-slot":"sheet-content","data-side":n,className:fe("fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",e),...o,children:[t,r&&l.jsxs(Qr,{"data-slot":"sheet-close",render:l.jsx(_e,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[l.jsx(Ni,{}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function wm({className:e,...t}){return l.jsx("div",{"data-slot":"sheet-header",className:fe("flex flex-col gap-0.5 p-4",e),...t})}function km({className:e,...t}){return l.jsx(ba,{"data-slot":"sheet-title",className:fe("cn-font-heading text-base font-medium text-foreground",e),...t})}function Em({className:e,...t}){return l.jsx($i,{"data-slot":"sheet-description",className:fe("text-sm text-muted-foreground",e),...t})}function qt({className:e,...t}){return l.jsx("div",{"data-slot":"skeleton",className:fe("animate-pulse rounded-md bg-muted",e),...t})}const bd=d.createContext(void 0);function zr(e){const t=d.useContext(bd);if(t===void 0&&!e)throw new Error(ot(72));return t}const Sm={...fa,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin};class Rm extends Gr{constructor(t,n,r){const o=new Yr;super(Dm(t,o,n,r),Fm(o),Sm)}setOpen=(t,n)=>{Qg(this,t,n,{extraState:{openChangeReason:n.reason}})};cancelPendingOpen(t){this.state.floatingRootContext.dispatchOpenChange(!1,Ce(Pn,t))}}function Dm(e,t,n,r=!1){const o={...ua(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e};return o.floatingRootContext=od(t,n,r),o}function Fm(e){return{popupRef:d.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}const Bm=oa(function(t){const{disabled:n=!1,defaultOpen:r=!1,open:o,disableHoverablePopup:s=!1,trackCursorAxis:i="none",actionsRef:a,onOpenChange:c,onOpenChangeComplete:u,handle:f,triggerId:h,defaultTriggerId:g=null,children:A}=t,p=td((F,T)=>new Rm({open:r,openProp:o,activeTriggerId:g,triggerIdProp:h},F,T));p.useControlledProp("openProp",o),p.useControlledProp("triggerIdProp",h),p.useContextCallback("onOpenChange",c),p.useContextCallback("onOpenChangeComplete",u);const m=p.useState("open"),x=!n&&m,C=p.useState("activeTriggerId"),b=p.useState("mounted"),v=p.useState("payload");p.useSyncedValues({trackCursorAxis:i,disableHoverablePopup:s,disabled:n}),aa(p,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:y,transitionStatus:w}=la(x,p),I=p.useState("isInstantPhase"),E=p.useState("instantType"),S=p.useState("lastOpenChangeReason"),R=d.useRef(null);ie(()=>{m&&n&&p.setOpen(!1,Ce(iu))},[m,n,p]),ie(()=>{w==="ending"&&S===Pt||w!=="ending"&&I?(E!=="delay"&&(R.current=E),p.set("instantType","delay")):R.current!==null&&(p.set("instantType",R.current),R.current=null)},[w,I,S,E,p]),ie(()=>{x&&C==null&&p.set("payload",void 0)},[p,C,x]),d.useImperativeHandle(a,()=>({unmount:y,close:()=>p.setOpen(!1,Ce(Ei))}),[y,p]);const k=x||b||!n&&i!=="none";return l.jsxs(bd.Provider,{value:p,children:[f&&l.jsx(sa,{handle:f,store:p}),k&&l.jsx(Mm,{store:p,disabled:n,trackCursorAxis:i}),typeof A=="function"?A({payload:v}):A]})});function Mm({store:e,disabled:t,trackCursorAxis:n}){const r=e.useState("floatingRootContext"),o=Xo(r,{enabled:!t,referencePress:()=>e.select("closeOnClick")}),s=KA(r,{enabled:!t&&n!=="none",axis:n==="none"?void 0:n}),i=d.useMemo(()=>Mt(s.reference,o.reference),[s.reference,o.reference]);return ca(e,{activeTriggerProps:i,inactiveTriggerProps:i,popupProps:o.floating??lt}),null}const jm=d.createContext(void 0);function Pm(){return d.useContext(jm)}const Ll=600,vd="data-base-ui-tooltip-trigger";function Kl(e){if("composedPath"in e){const n=e.composedPath();for(let r=0;r<n.length;r+=1){const o=n[r];if(Pe(o))return o}}const t=e.target;return Pe(t)?t:null}function Tm(e){let t=e;for(;t;){const n=t.closest(`[${vd}]`);if(n)return n;const r=t.getRootNode();t="host"in r&&Pe(r.host)?r.host:null}return null}const Nm=qu(function(t,n){const{render:r,className:o,style:s,handle:i,payload:a,disabled:c,delay:u,closeOnClick:f=!0,closeDelay:h,id:g,...A}=t,p=zr(!0),x=id(i)??p;if(!x)throw new Error(ot(82));const C=wt(g),b=x.useState("isTriggerActive",C),v=x.useState("isOpenedByTrigger",C),y=x.useState("floatingRootContext"),w=d.useRef(null),I=u??Ll,E=h??0,{registerTrigger:S,isMountedByThisTrigger:R}=rd(C,w,x,{payload:a,closeOnClick:f,closeDelay:E}),k=Pm(),{delayRef:F,isInstantPhase:T,hasProvider:N}=EA(y,{open:v}),j=ha(y);x.useSyncedValue("isInstantPhase",T);const D=x.useState("disabled"),O=c??D,_=qe(O),B=x.useState("trackCursorAxis"),H=x.useState("disableHoverablePopup"),P=d.useRef(!1),M=dt(),L=d.useRef(void 0);function G(){return N?qn(F.current,"open")===0?0:u??k??Ll:I}function V(ee){const ue=w.current;if(!ue||!ee)return!1;const ce=Tm(ee);return ce!==null&&ce!==ue&&ve(ue,ce)}function Y(ee){const ue=V(ee);return P.current=ue,ue&&(j.openChangeTimeout.clear(),j.restTimeout.clear(),j.restTimeoutPending=!1,M.clear()),ue}const Q=ud(y,{enabled:!O,mouseOnly:!0,move:!1,handleClose:!H&&B!=="both"?pd():null,restMs:G,delay(){return h==null&&N?{close:qn(F.current,"close")}:{close:E}},triggerElementRef:w,isActiveTrigger:b,isClosing:()=>x.select("transitionStatus")==="ending",shouldOpen(){return!P.current}}),z=ad(y,{enabled:!O}).reference,K=ee=>{const ue=P.current,ce=Kl(ee),he=Y(ce),se=w.current,Ae=se&&ce&&ve(se,ce);if(he&&x.select("open")&&x.select("lastOpenChangeReason")===it){x.setOpen(!1,Ce(it,ee));return}if(ue&&!he&&Ae&&!_.current&&!x.select("open")&&se&&mn(L.current)){const re=()=>{!P.current&&!_.current&&!x.select("open")&&x.setOpen(!0,Ce(it,ee,se))},oe=G();oe===0?(M.clear(),re()):M.start(oe,re)}},X=x.useState("triggerProps",R);return Me("button",t,{state:{open:v},ref:[n,S,w],props:[Q,z,R||B!=="none"?X:void 0,{onMouseOver(ee){K(ee.nativeEvent)},onFocus(ee){V(Kl(ee.nativeEvent))&&ee.preventBaseUIHandler()},onMouseLeave(){P.current=!1,M.clear(),L.current=void 0},onPointerEnter(ee){L.current=ee.pointerType},onPointerDown(ee){L.current=ee.pointerType,x.set("closeOnClick",f),f&&!x.select("open")&&x.cancelPendingOpen(ee.nativeEvent)},onClick(ee){f&&!x.select("open")&&x.cancelPendingOpen(ee.nativeEvent)},id:C,"data-trigger-disabled":O?"":void 0,[vd]:O?void 0:""},A],stateAttributesMapping:Bu})}),yd=d.createContext(void 0);function _m(){const e=d.useContext(yd);if(e===void 0)throw new Error(ot(70));return e}const Om=d.forwardRef(function(t,n){const{children:r,container:o,className:s,render:i,style:a,...c}=t,{node:u,subtree:f}=Hu({container:o,ref:n,componentProps:t,elementProps:c});return!f&&!u?null:l.jsxs(d.Fragment,{children:[f,u&&sn.createPortal(r,u)]})}),Hm=d.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t;return zr().useState("mounted")||r?l.jsx(yd.Provider,{value:r,children:l.jsx(Om,{ref:n,...o})}):null}),Cd=d.createContext(void 0);function Id(){const e=d.useContext(Cd);if(e===void 0)throw new Error(ot(71));return e}const Lm=d.createContext(void 0);function is(){return d.useContext(Lm)?.direction??"ltr"}const Km=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:a,middlewareData:c}=t,{element:u,padding:f=0,offsetParent:h="real"}=bn(e,t)||{};if(u==null)return{};const g=mu(f),A={x:n,y:r},p=Gi(o),m=Qi(p),x=await i.getDimensions(u),C=p==="y",b=C?"top":"left",v=C?"bottom":"right",y=C?"clientHeight":"clientWidth",w=s.reference[m]+s.reference[p]-A[p]-s.floating[m],I=A[p]-s.reference[p],E=h==="real"?await i.getOffsetParent?.(u):a.floating;let S=a.floating[y]||s.floating[m];(!S||!await i.isElement?.(E))&&(S=a.floating[y]||s.floating[m]);const R=w/2-I/2,k=S/2-x[m]/2-1,F=Math.min(g[b],k),T=Math.min(g[v],k),N=F,j=S-x[m]-T,D=S/2-x[m]/2+R,O=gu(N,D,j),_=!c.arrow&&Cn(o)!=null&&D!==O&&s.reference[m]/2-(D<N?F:T)-x[m]/2<0,B=_?D<N?D-N:D-j:0;return{[p]:A[p]+B,data:{[p]:O,centerOffset:D-O-B,..._&&{alignmentOffset:B}},reset:_}}}),Wm=(e,t)=>({...Km(e),options:[e,t]}),Qm={name:"hide",async fn(e){const{width:t,height:n,x:r,y:o}=e.rects.reference,s=t===0&&n===0&&r===0&&o===0,i=await e.platform.detectOverflow(e,{elementContext:"reference"});return{data:{referenceHidden:i.top-n>=0||i.right-t>=0||i.bottom-n>=0||i.left-t>=0||s}}}},Gm={sideX:"left",sideY:"top"},Wl="--available-width",Ql="--available-height";function wd(e,t,n){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?n?"inline-start":"inline-end":"right",bottom:"bottom",left:r?n?"inline-end":"inline-start":"left"}[t]}function Gl(e,t,n){const{rects:r,placement:o}=e;return{side:wd(t,jt(o),n),align:Cn(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function va(e){return Ym(e,Vg)}function Ym(e,t){const{anchor:n,positionMethod:r="absolute",side:o="bottom",sideOffset:s=0,align:i="center",alignOffset:a=0,collisionBoundary:c,collisionPadding:u=5,sticky:f=!1,arrowPadding:h=5,disableAnchorTracking:g=!1,inline:A,keepMounted:p=!1,floatingRootContext:m,mounted:x,collisionAvoidance:C,shift:b,nodeId:v,adaptiveOrigin:y,lazyFlip:w=!1,externalTree:I}=e,[E,S]=d.useState(null);!x&&E!==null&&S(null);const R=C.side||"flip",k=C.align||"flip",F=C.fallbackAxisSide||"end",T=b?.crossAxis??!1,N=b?.rootBoundary,j=typeof n=="function"?n:void 0,D=de(j),O=j?D:n,_=qe(n),B=qe(x),P=is()==="rtl",M=E||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":P?"left":"right","inline-start":P?"right":"left"}[o],L=i==="center"?M:`${M}-${i}`;let G=u;typeof G=="number"?G={top:G,right:G,bottom:G,left:G}:G&&(G={top:G.top||0,right:G.right||0,bottom:G.bottom||0,left:G.left||0});const V=1,Y=o==="bottom"?V:0,Q=o==="top"?V:0,z=o==="right"?V:0,K=o==="left"?V:0,X={boundary:c==="clipping-ancestors"?"clippingAncestors":c,padding:G},ae=d.useRef(null),te=qe(s),$=qe(a),ee=typeof s!="function"?s:0,ue=typeof a!="function"?a:0,ce=[];A&&ce.push(A),ce.push(Ig(Re=>{const Ue=Gl(Re,o,P),Ve=typeof te.current=="function"?te.current(Ue):te.current,$e=typeof $.current=="function"?$.current(Ue):$.current;return{mainAxis:Ve,crossAxis:$e,alignmentAxis:$e}},[ee,ue,P,o]));const he=k==="none"&&R!=="shift",se=!he&&(f||T||R==="shift"),Ae=R==="none"?null:Eg({...X,padding:{top:G.top+V+Y,right:G.right+V+K,bottom:G.bottom+V+Q,left:G.left+V+z},mainAxis:!T&&R==="flip",crossAxis:k==="flip"?"alignment":!1,fallbackAxisSideDirection:F}),re=he?null:wg({...X,rootBoundary:N,mainAxis:k!=="none",crossAxis:se,limiter:f||T?void 0:kg(Re=>{if(!ae.current)return{};const{width:Ue,height:Ve}=ae.current.getBoundingClientRect(),$e=Bt(jt(Re.placement)),gt=$e==="y"?Ue:Ve,pt=$e==="y"?G.left+G.right:G.top+G.bottom;return{offset:gt/2+pt/2}})},[X,f,T,N,G,k]);R==="shift"||k==="shift"||i==="center"?ce.push(re,Ae):ce.push(Ae,re),ce.push(Sg({...X,apply({elements:{floating:Re},availableWidth:Ue,availableHeight:Ve,rects:$e}){if(!B.current)return;const gt=Re.style;gt.setProperty(Wl,`${Ue}px`),gt.setProperty(Ql,`${Ve}px`);const pt=rt(Re).devicePixelRatio||1,{x:Rt,y:st,width:Et,height:Dt}=$e.reference,ht=(Math.round((Rt+Et)*pt)-Math.round(Rt*pt))/pt,De=(Math.round((st+Dt)*pt)-Math.round(st*pt))/pt;gt.setProperty("--anchor-width",`${ht}px`),gt.setProperty("--anchor-height",`${De}px`)}}),Wm(Re=>({element:ae.current||Be(Re.elements.floating).createElement("div"),padding:h,offsetParent:"floating"}),[h]),{name:"transformOrigin",fn(Re){const{elements:Ue,middlewareData:Ve,placement:$e,rects:gt,y:pt}=Re,Rt=jt($e),st=Bt(Rt),Et=ae.current,Dt=Ve.arrow?.x||0,ht=Ve.arrow?.y||0,De=Et?.clientWidth||0,We=Et?.clientHeight||0,mt=Dt+De/2,yt=ht+We/2,Ct=Math.abs(Ve.shift?.y||0),Ft=gt.reference.height/2,Ht=typeof s=="function"?s(Gl(Re,o,P)):s,cn=Ct>Ht,ir={top:`${mt}px calc(100% + ${Ht}px)`,bottom:`${mt}px ${-Ht}px`,left:`calc(100% + ${Ht}px) ${yt}px`,right:`${-Ht}px ${yt}px`}[Rt],kn=`${mt}px ${gt.reference.y+Ft-pt}px`;return Ue.floating.style.setProperty("--transform-origin",se&&st==="y"&&cn?kn:ir),{}}},Qm,y),ie(()=>{!x&&m&&m.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[x,m]);const oe=d.useMemo(()=>({elementResize:!g&&typeof ResizeObserver<"u",layoutShift:!g&&typeof IntersectionObserver<"u"}),[g]),{refs:le,elements:ge,x:me,y:W,middlewareData:U,update:be,placement:q,context:ne,isPositioned:Ee,floatingStyles:Se}=t({rootContext:m,open:p?x:void 0,placement:L,middleware:ce,strategy:r,whileElementsMounted:p?void 0:(...Re)=>El(...Re,oe),nodeId:v,externalTree:I}),{sideX:Ge,sideY:ze}=U.adaptiveOrigin||Gm,Le=Ee?r:"fixed",ct=d.useMemo(()=>{let Re;return Ee?y?Re={position:Le,[Ge]:me,[ze]:W}:Re={...Se,position:Le}:Re={position:Le,top:0,left:0},Re[Wl]="100vw",Re[Ql]="100vh",Ee||(Re.opacity=0),Re},[y,Le,Ge,me,ze,W,Se,Ee]),tt=d.useRef(null);ie(()=>{if(!x)return;const Re=_.current,Ue=typeof Re=="function"?Re():Re,$e=(Yl(Ue)?Ue.current:Ue)||null||null;$e!==tt.current&&(le.setPositionReference($e),tt.current=$e)},[x,le,O,_]),d.useEffect(()=>{if(!x)return;const Re=_.current;typeof Re!="function"&&Yl(Re)&&Re.current!==tt.current&&(le.setPositionReference(Re.current),tt.current=Re.current)},[x,le,O,_]),d.useEffect(()=>{if(p&&x&&ge.reference&&ge.floating)return El(ge.reference,ge.floating,be,oe)},[p,x,ge,be,oe]);const Je=jt(q),ft=wd(o,Je,P),Ie=Cn(q)||"center",Ke=!!U.hide?.referenceHidden;ie(()=>{w&&x&&Ee&&Je!==M&&S(Je)},[w,x,Ee,Je,M]);const Ne=d.useMemo(()=>({position:"absolute",top:U.arrow?.y,left:U.arrow?.x}),[U.arrow]),nt=U.arrow?.centerOffset!==0;return d.useMemo(()=>({positionerStyles:ct,arrowStyles:Ne,arrowRef:ae,arrowUncentered:nt,side:ft,align:Ie,physicalSide:Je,anchorHidden:Ke,refs:le,context:ne,isPositioned:Ee,update:be}),[ct,Ne,ae,nt,ft,Ie,Je,Ke,le,ne,Ee,be])}function Yl(e){return e!=null&&"current"in e}function as(e){return e==="starting"?MA:lt}function ya(e,t,{styles:n,transitionStatus:r,props:o,refs:s,hidden:i,inert:a=!1}){const c={...n};return a&&(c.pointerEvents="none"),Me("div",e,{state:t,ref:s,props:[{role:"presentation",hidden:i,style:c},as(r),o],stateAttributesMapping:Wr})}const zm=d.forwardRef(function(t,n){const{render:r,className:o,anchor:s,positionMethod:i="absolute",side:a="top",align:c="center",sideOffset:u=0,alignOffset:f=0,collisionBoundary:h="clipping-ancestors",collisionPadding:g=5,arrowPadding:A=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:x=Nu,style:C,...b}=t,v=zr(),y=_m(),w=v.useState("open"),I=v.useState("mounted"),E=v.useState("trackCursorAxis"),S=v.useState("disableHoverablePopup"),R=v.useState("floatingRootContext"),k=v.useState("instantType"),F=v.useState("transitionStatus"),T=v.useState("adaptiveOrigin"),N=va({anchor:s,positionMethod:i,floatingRootContext:R,mounted:I,side:a,sideOffset:u,align:c,alignOffset:f,collisionBoundary:h,collisionPadding:g,sticky:p,arrowPadding:A,disableAnchorTracking:m,keepMounted:y,collisionAvoidance:x,adaptiveOrigin:T}),j=d.useMemo(()=>({open:w,side:N.side,align:N.align,anchorHidden:N.anchorHidden,instant:E!=="none"?"tracking-cursor":k}),[w,N.side,N.align,N.anchorHidden,E,k]),D=ya(t,j,{styles:N.positionerStyles,transitionStatus:F,props:b,refs:[n,v.useStateSetter("positionerElement")],hidden:!I,inert:!w||E==="both"||S});return l.jsx(Cd.Provider,{value:N,children:D})}),Um=d.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,a=zr(),{side:c,align:u}=Id(),f=a.useState("open"),h=a.useState("instantType"),g=a.useState("transitionStatus"),A=a.useState("popupProps"),p=a.useState("floatingRootContext"),m=a.useState("disabled"),x=a.useState("closeDelay");zt({open:f,ref:a.context.popupRef,onComplete(){f&&a.context.onOpenChangeComplete?.(!0)}}),cd(p,{enabled:!m,closeDelay:x});const C=a.useStateSetter("popupElement");return Me("div",t,{state:{open:f,side:c,align:u,instant:h,transitionStatus:g},ref:[n,a.context.popupRef,C],props:[ts,A,as(g),i],stateAttributesMapping:Zi})}),Vm=d.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,a=zr(),{arrowRef:c,side:u,align:f,arrowUncentered:h,arrowStyles:g}=Id(),A=a.useState("open"),p=a.useState("instantType");return Me("div",t,{state:{open:A,side:u,align:f,uncentered:h,instant:p},ref:[n,c],props:[{style:g,"aria-hidden":!0},i],stateAttributesMapping:Wr})});function Zm(e){const[t,n]=d.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}function ls({...e}){return l.jsx(Bm,{"data-slot":"tooltip",...e})}function cs({...e}){return l.jsx(Nm,{"data-slot":"tooltip-trigger",...e})}function us({className:e,side:t="top",sideOffset:n=4,align:r="center",alignOffset:o=0,children:s,...i}){return l.jsx(Hm,{children:l.jsx(zm,{align:r,alignOffset:o,side:t,sideOffset:n,className:"isolate z-50",children:l.jsxs(Um,{"data-slot":"tooltip-content",className:fe("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...i,children:[s,l.jsx(Vm,{className:"z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}const Jm="sidebar_state",$m=3600*24*7,Xm="16rem",qm="18rem",e0="3rem",t0="b",kd=d.createContext(null);function ds(){const e=d.useContext(kd);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function n0({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:o,children:s,...i}){const a=gA(),[c,u]=d.useState(!1),[f,h]=d.useState(e),g=t??f,A=d.useCallback(C=>{const b=typeof C=="function"?C(g):C;n?n(b):h(b),document.cookie=`${Jm}=${b}; path=/; max-age=${$m}`},[n,g]),p=d.useCallback(()=>a?u(C=>!C):A(C=>!C),[a,A,u]);d.useEffect(()=>{const C=b=>{b.key===t0&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),p())};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[p]);const m=g?"expanded":"collapsed",x=d.useMemo(()=>({state:m,open:g,setOpen:A,isMobile:a,openMobile:c,setOpenMobile:u,toggleSidebar:p}),[m,g,A,a,c,u,p]);return l.jsx(kd.Provider,{value:x,children:l.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":Xm,"--sidebar-width-icon":e0,...o},className:fe("group/sidebar-wrapper flex h-svh w-full has-data-[variant=inset]:bg-sidebar",r),...i,children:s})})}function r0({side:e="left",variant:t="sidebar",collapsible:n="offcanvas",className:r,children:o,dir:s,...i}){const{isMobile:a,state:c,openMobile:u,setOpenMobile:f}=ds();return n==="none"?l.jsx("div",{"data-slot":"sidebar",className:fe("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",r),...i,children:o}):a?l.jsx(vm,{open:u,onOpenChange:f,...i,children:l.jsxs(Im,{dir:s,"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":qm},side:e,children:[l.jsxs(wm,{className:"sr-only",children:[l.jsx(km,{children:"Sidebar"}),l.jsx(Em,{children:"Displays the mobile sidebar."})]}),l.jsx("div",{className:"flex h-full w-full flex-col",children:o})]})}):l.jsxs("div",{className:"group peer hidden text-sidebar-foreground md:block","data-state":c,"data-collapsible":c==="collapsed"?n:"","data-variant":t,"data-side":e,"data-slot":"sidebar",children:[l.jsx("div",{"data-slot":"sidebar-gap",className:fe("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",t==="floating"||t==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),l.jsx("div",{"data-slot":"sidebar-container","data-side":e,className:fe("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex",t==="floating"||t==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",r),...i,children:l.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border",children:o})})]})}function o0({className:e,...t}){const{toggleSidebar:n}=ds();return l.jsx("button",{"data-sidebar":"rail","data-slot":"sidebar-rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:n,title:"Toggle Sidebar",className:fe("absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2","in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",e),...t})}function s0({className:e,...t}){return l.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:fe("flex flex-col gap-2 p-2",e),...t})}function i0({className:e,...t}){return l.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:fe("flex flex-col gap-2 p-2",e),...t})}function a0({className:e,...t}){return l.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:fe("no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t})}function l0({className:e,...t}){return l.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:fe("relative flex w-full min-w-0 flex-col p-2",e),...t})}function c0({className:e,...t}){return l.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:fe("w-full text-sm",e),...t})}function Ms({className:e,...t}){return l.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:fe("flex w-full min-w-0 flex-col gap-0",e),...t})}function oo({className:e,...t}){return l.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:fe("group/menu-item relative",e),...t})}const u0=Ci("peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function kr({render:e,isActive:t=!1,variant:n="default",size:r="default",tooltip:o,className:s,...i}){const{isMobile:a,state:c}=ds(),u=lu({defaultTagName:"button",props:Mt({className:fe(u0({variant:n,size:r}),s)},i),render:o?l.jsx(cs,{render:e}):e,state:{slot:"sidebar-menu-button",sidebar:"menu-button",size:r,active:t}});return o?(typeof o=="string"&&(o={children:o}),l.jsxs(ls,{children:[u,l.jsx(us,{side:"right",align:"center",hidden:c!=="collapsed"||a,...o})]})):u}const Ed=d.createContext(void 0);function Sd(e){const t=d.useContext(Ed);if(t===void 0&&!e)throw new Error(ot(33));return t}const Rd=d.createContext(void 0);function sr(e){const t=d.useContext(Rd);if(t===void 0&&!e)throw new Error(ot(36));return t}const d0=d.createContext(void 0);function Ca(e=!0){const t=d.useContext(d0);if(t===void 0&&!e)throw new Error(ot(25));return t}function f0(e){const{closeOnClick:t,highlighted:n,id:r,nodeId:o,store:s,typingRef:i,itemRef:a,itemMetadata:c}=e,{events:u}=s.useState("floatingTreeRoot"),f=s.useState("open"),h=Ca(!0),g=h!==void 0;return d.useMemo(()=>({id:r,role:"menuitem",tabIndex:f&&n?0:-1,onKeyDown(A){A.key===" "&&i?.current&&A.preventDefault()},onMouseMove(A){o&&u.emit("itemhover",{nodeId:o,target:A.currentTarget})},onClick(A){t&&u.emit("close",{domEvent:A,reason:Cr})},onMouseUp(A){if(h){const p=h.initialCursorPointRef.current;if(h.initialCursorPointRef.current=null,g&&p&&Math.abs(A.clientX-p.x)<=1&&Math.abs(A.clientY-p.y)<=1||g&&!_i&&A.button===2)return}a.current&&s.context.allowMouseUpTriggerRef.current&&(!g||A.button===2)&&c.type==="regular-item"&&Si(a.current,A,{detail:1})}}),[t,n,r,u,o,f,s,i,a,h,g,c])}const p0={type:"regular-item"};function h0(e){const{closeOnClick:t,disabled:n,highlighted:r,id:o,store:s,typingRef:i=s.context.typingRef,nativeButton:a,itemMetadata:c,nodeId:u}=e,f=d.useRef(null),{getButtonProps:h,buttonRef:g}=Yt({disabled:n,focusableWhenDisabled:!0,native:a,composite:!0}),A=f0({closeOnClick:t,highlighted:r,id:o,nodeId:u,store:s,typingRef:i,itemRef:f,itemMetadata:c}),p=d.useCallback(x=>Mt(A,{onMouseEnter(){c.type==="submenu-trigger"&&c.setActive()}},x,h),[A,h,c]),m=Gt(f,g);return d.useMemo(()=>({getItemProps:p,itemRef:m}),[p,m])}const Dd=d.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function A0(){return d.useContext(Dd)}function fs(e={}){const{guess:t,label:n,metadata:r,textRef:o,index:s}=e,{register:i,unregister:a,subscribeMapChange:c,nextIndexRef:u}=A0(),f=d.useRef(-1),[h,g]=d.useState(s==null&&t?()=>{if(f.current===-1){const x=u.current;u.current+=1,f.current=x}return f.current}:-1),A=s??h,p=d.useRef(null),m=d.useCallback(x=>{const C=p.current;C&&a(C),p.current=x,x&&i(x,{metadata:r??null,index:s??null,label:n,textRef:o})},[s,i,a,r,n,o]);return ie(()=>{if(s==null)return c(x=>{const C=p.current?x.get(p.current)?.index:null;C!=null&&g(C)})},[s,c]),{ref:m,index:A}}const g0=d.forwardRef(function(t,n){const{render:r,className:o,id:s,label:i,nativeButton:a=!1,disabled:c=!1,closeOnClick:u=!0,style:f,...h}=t,g=fs({guess:!0,label:i}),A=Sd(!0),p=wt(s),{store:m}=sr(),x=m.useState("disabled"),C=c||x,b=m.useState("isActive",g.index),v=m.useState("itemProps"),{getItemProps:y,itemRef:w}=h0({closeOnClick:u,disabled:C,highlighted:b,id:p,store:m,nativeButton:a,nodeId:A?.context.nodeId,itemMetadata:p0});return Me("div",t,{state:{disabled:C,highlighted:b},props:[v,h,y],ref:[w,n,g.ref]})}),m0=d.createContext(void 0);function Ia(e){return d.useContext(m0)}const x0=d.forwardRef(function(t,n){const{render:r,className:o,style:s,finalFocus:i,...a}=t,{store:c}=sr(),{side:u,align:f}=Sd(),h=Ia()!=null,g=c.useState("open"),A=c.useState("transitionStatus"),p=c.useState("popupProps"),m=c.useState("mounted"),x=c.useState("instantType"),C=c.useState("activeTriggerElement"),b=c.useState("parent"),v=c.useState("lastOpenChangeReason"),y=c.useState("rootId"),w=c.useState("floatingRootContext"),I=c.useState("floatingTreeRoot"),E=c.useState("closeDelay"),S=c.useState("hoverEnabled"),R=c.useState("disabled"),k=c.useState("openMethod"),F=b.type==="context-menu";zt({open:g,ref:c.context.popupRef,onComplete(){g&&c.context.onOpenChangeComplete?.(!0)}}),d.useEffect(()=>{function O(_){c.setOpen(!1,Ce(_.reason,_.domEvent))}return I.events.on("close",O),()=>{I.events.off("close",O)}},[I.events,c]),cd(w,{enabled:S&&!R&&!F&&b.type!=="menubar",closeDelay:E});const T=c.useStateSetter("popupElement"),N={transitionStatus:A,side:u,align:f,open:g,nested:b.type==="menu",instant:x},j=Me("div",t,{state:N,ref:[n,c.context.popupRef,T],stateAttributesMapping:Zi,props:[p,{onKeyDown(O){h&&rs.has(O.key)&&O.stopPropagation()}},as(A),a,{"data-rootownerid":y}]});let D=b.type===void 0||F;return(C||b.type==="menubar"&&v!==Lo)&&(D=!0),l.jsx(na,{context:w,openInteractionType:k,modal:F,disabled:!m,returnFocus:i===void 0?D:i,initialFocus:b.type!=="menu",restoreFocus:!0,externalTree:b.type!=="menubar"?I:void 0,previousFocusableElement:C,nextFocusableElement:b.type===void 0?c.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:b.type===void 0?c.context.beforeContentFocusGuardRef:void 0,children:j})}),Fd=d.createContext(void 0);function b0(){const e=d.useContext(Fd);if(e===void 0)throw new Error(ot(32));return e}const v0=d.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t,{store:s}=sr();return s.useState("mounted")||r?l.jsx(Fd.Provider,{value:r,children:l.jsx(qi,{ref:n,...o})}):null});function Ur(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:o}=e,s=de(o),[,i]=d.useState(!1),a=St(C0).current,c=St(y0).current,u=d.useRef(0),f=d.useRef(!0),h=d.useRef([]),g=d.useRef(null),A=de(()=>{f.current||(f.current=!0,i(w=>!w))}),p=de((w,I)=>{c.set(w,I),A()}),m=de(w=>{c.delete(w),A()}),x=de(w=>{const I=new Map;return n.current.length=0,r&&(r.current.length=0),w.forEach(E=>{I.set(E.element,{...E.registration.metadata??{},index:E.index}),n.current[E.index]=E.element,r&&(r.current[E.index]=E.registration.label!==void 0?E.registration.label:E.registration.textRef?.current?.textContent??E.element.textContent)}),u.current=n.current.length,I});function C(w){if(g.current?.disconnect(),g.current=null,typeof MutationObserver!="function"||w.length<2)return;const I=new MutationObserver(S=>{if(!k0(S))return;let R=null;for(const k of w)if(k.isConnected){if(R&&Bd(R,k)>0){I.disconnect(),A();return}R=k}});g.current=I;const E=new Set;for(let S=1;S<w.length;S+=1){const R=w0(w[S-1],w[S]);R&&E.add(R)}E.forEach(S=>I.observe(S,{childList:!0}))}const b=de(()=>{const[w,I]=I0(c),E=x(w);C(I),h.current=w,f.current=!1,a.forEach(S=>S(E)),s(E)});ie(()=>(f.current||x(h.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,x]),ie(()=>{f.current&&b()}),ie(()=>()=>{g.current?.disconnect(),f.current=!0},[]);const v=de(w=>(a.add(w),()=>{a.delete(w)})),y=d.useMemo(()=>({register:p,unregister:m,subscribeMapChange:v,nextIndexRef:u}),[p,m,v,u]);return l.jsx(Dd.Provider,{value:y,children:t})}function y0(){return new Map}function C0(){return new Set}function I0(e){const t=new Set,n=[],r=[];e.forEach((s,i)=>{if(!i.isConnected)return;const a=s.index,c={index:a??-1,element:i,registration:s};a===null?r.push(c):a>=0&&(t.add(a),n.push(c))});let o=0;return r.sort((s,i)=>Bd(s.element,i.element)),r.forEach(s=>{for(;t.has(o);)o+=1;s.index=o,n.push(s),o+=1}),t.size>0&&n.sort((s,i)=>s.index-i.index),[n,r.map(s=>s.element)]}function w0(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function k0(e){for(const t of e)for(let n=0;n<t.removedNodes.length;n+=1)if(t.removedNodes[n].isConnected)return!0;return!1}function Bd(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}const E0=20;function Md(e,t,n,r){const[o,s]=d.useState(!1);ie(()=>{if(!e||!t||n==null){s(!1);return}const i=Be(n).documentElement.clientWidth,a=n.offsetWidth;s(i>0&&a>0&&a>=i-E0)},[e,t,n]),Ad(e&&(!t||o),r)}const S0=d.forwardRef(function(t,n){const{anchor:r,positionMethod:o="absolute",className:s,render:i,side:a,align:c,sideOffset:u=0,alignOffset:f=0,collisionBoundary:h="clipping-ancestors",collisionPadding:g=5,arrowPadding:A=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:x=Tu,style:C,...b}=t,{store:v}=sr(),y=b0(),w=Ca(!0),I=v.useState("parent"),E=v.useState("floatingRootContext"),S=v.useState("floatingTreeRoot"),R=v.useState("mounted"),k=v.useState("open"),F=v.useState("modal"),T=v.useState("openMethod"),N=v.useState("activeTriggerElement"),j=v.useState("transitionStatus"),D=v.useState("positionerElement"),O=v.useState("instantType"),_=v.useState("adaptiveOrigin"),B=v.useState("lastOpenChangeReason"),H=v.useState("floatingNodeId"),P=v.useState("floatingParentNodeId"),M=E.useState("domReferenceElement"),L=d.useRef(null),G=Vi(D);let V=r,Y=u,Q=f,z=c,K=x;I.type==="context-menu"&&(V=r??I.context?.anchor,z=z??"start",!a&&z!=="center"&&(Q=t.alignOffset??2,Y=t.sideOffset??-5));let X=a,ae=z;I.type==="menu"?(X=X??"inline-end",ae=ae??"start",K=t.collisionAvoidance??Nu):I.type==="menubar"&&(X=X??(I.context.orientation==="vertical"?"inline-end":"bottom"),ae=ae??"start");const te=I.type==="context-menu",$=va({anchor:V,floatingRootContext:E,positionMethod:w?"fixed":o,mounted:R,side:X,sideOffset:Y,align:ae,alignOffset:Q,arrowPadding:te?0:A,collisionBoundary:h,collisionPadding:g,sticky:p,nodeId:H,keepMounted:y,disableAnchorTracking:m,collisionAvoidance:K,shift:te?{crossAxis:!("side"in K&&K.side==="flip"),rootBoundary:"layoutViewport"}:void 0,externalTree:S,adaptiveOrigin:_});d.useEffect(()=>{function oe(le){le.open&&(le.parentNodeId===H&&v.set("hoverEnabled",!1),le.nodeId!==H&&le.parentNodeId===v.select("floatingParentNodeId")&&v.setOpen(!1,Ce(xr)))}return S.events.on("menuopenchange",oe),()=>{S.events.off("menuopenchange",oe)}},[v,S.events,H]),d.useEffect(()=>{if(v.select("floatingParentNodeId")==null)return;function oe(le){if(le.open||le.nodeId!==v.select("floatingParentNodeId"))return;const ge=le.reason??xr;v.setOpen(!1,Ce(ge))}return S.events.on("menuopenchange",oe),()=>{S.events.off("menuopenchange",oe)}},[S.events,v]);const ee=dt();d.useEffect(()=>{k||ee.clear()},[k,ee]),d.useEffect(()=>{function oe(le){if(!(!k||le.nodeId!==v.select("floatingParentNodeId")))if(le.target&&N&&N!==le.target){const ge=v.select("closeDelay");ge>0?ee.isStarted()||ee.start(ge,()=>{v.setOpen(!1,Ce(xr))}):v.setOpen(!1,Ce(xr))}else ee.clear()}return S.events.on("itemhover",oe),()=>{S.events.off("itemhover",oe)}},[S.events,k,N,v,ee]),d.useEffect(()=>{const oe={open:k,nodeId:H,parentNodeId:P,reason:v.select("lastOpenChangeReason")};S.events.emit("menuopenchange",oe)},[S.events,k,v,H,P]),ie(()=>{const oe=M,le=L.current;if(oe&&(L.current=oe),le&&oe&&oe!==le){v.set("instantType",void 0);const ge=new AbortController;return G(()=>{v.set("instantType","trigger-change")},ge.signal),()=>{ge.abort()}}},[M,G,v]);const ue={open:k,side:$.side,align:$.align,anchorHidden:$.anchorHidden,nested:I.type==="menu",instant:O},ce=I.type==="menubar"&&I.context.modal;Md(k&&(ce||F&&B!==it),T==="touch",D,N);const se=ya(t,ue,{styles:$.positionerStyles,transitionStatus:j,props:b,refs:[n,v.useStateSetter("positionerElement")],hidden:!R,inert:!k}),Ae=R&&I.type!=="menu"&&(I.type!=="menubar"&&F&&B!==it||I.type==="menubar"&&I.context.modal);let re=null;return I.type==="menubar"?re=I.context.contentElement:I.type===void 0&&(re=N),l.jsxs(Ed.Provider,{value:$,children:[Ae&&l.jsx(ma,{ref:I.type==="context-menu"||I.type==="nested-context-menu"?I.context.internalBackdropRef:null,inert:ga(!k),cutout:re}),l.jsx(NA,{id:H,children:l.jsx(Ur,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:se})})]})}),R0=d.createContext(null);function jd(e){return d.useContext(R0)}const D0={...fa,disabled:e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0),openMethod:e=>e.openMethod,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId,activeIndex:e=>e.activeIndex,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")}};class F0 extends Gr{constructor(t){super({...M0(),...t},B0(),D0),this.unsubscribeParentListener=this.observe("parent",n=>{if(this.unsubscribeParentListener?.(),n.type==="menu"){let r=n.store.select("rootId"),o=n.store.select("floatingTreeRoot"),s=n.store.select("keyboardEventRelay");this.unsubscribeParentListener=n.store.subscribe(()=>{const i=n.store.select("rootId"),a=n.store.select("floatingTreeRoot"),c=n.store.select("keyboardEventRelay");r===i&&o===a&&s===c||(r=i,o=a,s=c,this.notifyAll())}),this.context.allowMouseUpTriggerRef=n.store.context.allowMouseUpTriggerRef;return}n.type!==void 0&&(this.context.allowMouseUpTriggerRef=n.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(t,n){this.state.floatingRootContext.context.events.emit("setOpen",{open:t,eventDetails:n})}unsubscribeParentListener=null}function B0(){return{positionerRef:d.createRef(),popupRef:d.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:d.createRef(),beforeContentFocusGuardRef:d.createRef(),onOpenChangeComplete:void 0,triggerElements:new Yr}}function M0(){return{...ua(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new ea,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:lt,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0}}const j0=d.createContext(void 0);function P0(){return d.useContext(j0)}const T0=oa(function(t){const{children:n,open:r,onOpenChange:o,onOpenChangeComplete:s,defaultOpen:i=!1,disabled:a=!1,modal:c,loopFocus:u=!0,orientation:f="vertical",actionsRef:h,closeParentOnEsc:g=!1,handle:A,triggerId:p,defaultTriggerId:m=null,highlightItemOnHover:x=!0}=t,C=Ca(!0),b=sr(!0),v=jd(!0),y=P0(),w=d.useMemo(()=>y&&b?{type:"menu",store:b.store}:v?{type:"menubar",context:v}:C&&!b?{type:"context-menu",context:C}:{type:void 0},[C,b,v,y]),I=N0({open:i,openProp:r,activeTriggerId:m,triggerIdProp:p,parent:w});I.useControlledProp("openProp",r),I.useControlledProp("triggerIdProp",p),I.useContextCallback("onOpenChangeComplete",s);const E=Zn(),S=Zn(),R=I.useState("floatingTreeRoot"),k=Qu(R),F=In(),T=I.useState("open"),N=I.useState("activeTriggerElement"),j=I.useState("positionerElement"),D=I.useState("hoverEnabled"),O=I.useState("disabled"),_=I.useState("lastOpenChangeReason"),B=I.useState("parent"),H=I.useState("activeIndex"),P=I.useState("payload"),M=I.useState("floatingParentNodeId"),L=d.useRef(null),G=d.useRef(B.type!=="context-menu"),V=dt(),Y=d.useRef(!0),Q=dt(),z=M!=null,{openMethod:K,triggerProps:X}=xd(T);I.useSyncedValues({disabled:a,highlightItemOnHover:x,modal:B.type===void 0?c:void 0,openMethod:K,rootId:E}),aa(I);const{forceUnmount:ae}=la(T,I,()=>{I.set("allowMouseEnter",!1)});ie(()=>{C&&!b?I.update({parent:{type:"context-menu",context:C},floatingNodeId:k,floatingParentNodeId:F}):b&&I.update({floatingNodeId:k,floatingParentNodeId:F})},[C,b,k,F,I]),d.useEffect(()=>{if(T||(L.current=null),B.type==="context-menu"){if(!T){V.clear(),G.current=!1;return}V.start(500,()=>{G.current=!0})}},[V,T,B.type]),ie(()=>{!T&&!D&&I.set("hoverEnabled",!0)},[T,D,I]);const te=de((ne,Ee)=>{const Se=Ee.reason;if(!ne&&!I.select("open")||T===ne&&Ee.trigger===N&&_===Se)return;const Ge=nd(Ee);if(!ne&&Ee.trigger==null&&(Ee.trigger=N??void 0),o?.(ne,Ee),Ee.isCanceled)return;I.state.floatingRootContext.dispatchOpenChange(ne,Ee);const ze=Ee.event;if(ne===!1&&ze?.type==="click"&&ze.pointerType==="touch"&&!Y.current)return;ne&&Se===Gn?(Y.current=!1,Q.start(300,()=>{Y.current=!0})):(Y.current=!0,Q.clear());const Le=(Se===Pn||Se===Cr)&&ze.detail===0,ct=!ne&&(Se===Ko||Se==null),tt={open:ne,openChangeReason:Se};L.current=Ee.event,ia(tt,ne,Ee.trigger,Ge()),I.update(tt),B.type==="menubar"&&(Se===Gn||Se===Bn||Se===it||Se===Zs||Se===xr)?I.set("instantType","group"):Le||ct?I.set("instantType",Le?"click":"dismiss"):I.set("instantType",void 0)}),$=ed({popupStore:I,floatingId:S,nested:F!=null,onOpenChange:te}),ee=$.context.events;ie(()=>{const ne=({open:Ee,eventDetails:Se})=>te(Ee,Se);return ee.on("setOpen",ne),()=>{ee?.off("setOpen",ne)}},[ee,te]);const ue=d.useCallback(()=>{I.setOpen(!1,Ce(Ei))},[I]);d.useImperativeHandle(h,()=>({unmount:ae,close:ue}),[ae,ue]);let ce;B.type==="context-menu"&&(ce=B.context),d.useImperativeHandle(ce?.positionerRef,()=>j,[j]),d.useImperativeHandle(ce?.actionsRef,()=>({setOpen:te}),[te]);const he=Xo($,{enabled:!O,bubbles:{escapeKey:g&&B.type==="menu"},outsidePress(){return B.type!=="context-menu"||L.current?.type==="contextmenu"?!0:G.current},externalTree:z?R:void 0}),se=is(),Ae=d.useCallback(ne=>{I.select("activeIndex")!==ne&&I.set("activeIndex",ne)},[I]),re=dd($,{enabled:!O,listRef:I.context.itemDomElements,activeIndex:H,nested:B.type!==void 0,loopFocus:u,orientation:f,parentOrientation:B.type==="menubar"?B.context.orientation:void 0,rtl:se==="rtl",disabledIndices:Nt,onNavigate:Ae,openOnArrowKeyDown:B.type!=="context-menu",externalTree:z?R:void 0,focusItemOnHover:x}),oe=d.useCallback(ne=>{I.context.typingRef.current=ne},[I]),le=fd($,{enabled:!O,listRef:I.context.itemLabels,elementsRef:I.context.itemDomElements,activeIndex:H,resetMs:FA,onMatch:ne=>{T&&ne!==H&&I.set("activeIndex",ne)},onTyping:oe}),ge=d.useMemo(()=>{const ne=Mt(le.reference,re.reference,he.reference,{onMouseMove(){I.set("allowMouseEnter",!0)}},X);return ne["aria-haspopup"]="menu",ne["aria-expanded"]=T,ne},[I,le.reference,re.reference,he.reference,X,T]),me=d.useMemo(()=>{const ne=Mt(re.trigger,he.trigger,X);return ne["aria-haspopup"]="menu",ne["aria-expanded"]=!1,ne},[re.trigger,he.trigger,X]),W=d.useMemo(()=>Mt(ts,{id:S,role:"menu","aria-labelledby":N?.id,onMouseMove(){I.set("allowMouseEnter",!0),B.type==="menu"&&I.set("hoverEnabled",!1)},onClick(){I.select("hoverEnabled")&&I.set("hoverEnabled",!1)},onKeyDown(ne){const Ee=I.select("keyboardEventRelay");Ee&&!ne.isPropagationStopped()&&Ee(ne)}},le.floating,re.floating,he.floating),[N,S,B.type,I,le.floating,re.floating,he.floating]),U=re.item??lt;ca(I,{floatingRootContext:$,activeTriggerProps:ge,inactiveTriggerProps:me,popupProps:W,itemProps:U});const be=d.useMemo(()=>({store:I,parent:w}),[I,w]),q=l.jsxs(Rd.Provider,{value:be,children:[A&&l.jsx(sa,{handle:A,store:I}),typeof n=="function"?n({payload:P}):n]});return B.type===void 0||B.type==="context-menu"?l.jsx(_A,{externalTree:R,children:q}):q});function N0(e){return St(()=>new F0(e)).current}const so=5;function Pd(e,t){const n=_0(t);return e.clientX>=n.left-so&&e.clientX<=n.right+so&&e.clientY>=n.top-so&&e.clientY<=n.bottom+so}function _0(e){const t=e.getBoundingClientRect(),n=rt(e);if(Oi)return t;const r=n.getComputedStyle(e,"::before"),o=n.getComputedStyle(e,"::after");if(!(r.content!=="none"||o.content!=="none"))return t;const i=parseFloat(r.width)||0,a=parseFloat(r.height)||0,c=parseFloat(o.width)||0,u=parseFloat(o.height)||0,f=Math.max(t.width,i,c),h=Math.max(t.height,a,u),g=f-t.width,A=h-t.height;return{left:t.left-g/2,right:t.right+g/2,top:t.top-A/2,bottom:t.bottom+A/2}}function Td(e={}){const{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=Ri(),{ref:o,index:s}=fs(e),i=n===s,a=d.useRef(null),c=Gt(o,a);return{compositeProps:{tabIndex:i?0:-1,onFocus(){r(s)},onMouseMove(){const f=a.current;if(!t||!f)return;const h=f.hasAttribute("disabled")||f.ariaDisabled==="true";!i&&!h&&f.focus()}},compositeRef:c,index:s}}function Nd(e){const{render:t,className:n,style:r,state:o=lt,props:s=Nt,refs:i=Nt,metadata:a,stateAttributesMapping:c,tag:u="div",...f}=e,{compositeProps:h,compositeRef:g}=Td({metadata:a});return Me(u,e,{state:o,ref:[g,...i],props:[h,...s,f],stateAttributesMapping:c})}function _d(e){if(Ze(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid");if(!Dn(e))return _d(Jn(e))}function O0(e,t){const n=d.useRef(null);function r(s){sn.flushSync(()=>{e.setOpen(!1,Ce(Bn,s.nativeEvent,s.currentTarget))}),sA(n.current)?.focus()}function o(s){const i=e.select("positionerElement");if(i&&Yn(s,i))e.context.beforeContentFocusGuardRef.current?.focus();else{sn.flushSync(()=>{e.setOpen(!1,Ce(Bn,s.nativeEvent,s.currentTarget))});let a=oA(e.context.triggerFocusTargetRef.current||t.current);for(;a!==null&&ve(i,a);){const c=a;if(a=zi(a),a===c)break}a?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:o}}function H0(e){const{enabled:t=!0,mouseDownAction:n,open:r}=e,o=d.useRef(!1);return d.useMemo(()=>t?{onMouseDown:s=>{(n==="open"&&!r||n==="close"&&r)&&(o.current=!0,Be(s.currentTarget).addEventListener("click",()=>{o.current=!1},{once:!0}))},onClick:s=>{o.current&&(o.current=!1,s.preventBaseUIHandler())}}:lt,[t,n,r])}const L0=qu(function(t,n){const{render:r,className:o,style:s,disabled:i=!1,nativeButton:a=!0,id:c,openOnHover:u,delay:f=100,closeDelay:h=0,handle:g,payload:A,...p}=t,m=sr(!0),C=id(g)??m?.store;if(!C)throw new Error(ot(85));const b=wt(c),v=C.useState("isTriggerActive",b),y=C.useState("floatingRootContext"),w=C.useState("isOpenedByTrigger",b),I=C.useState("triggerPopupId",b),E=d.useRef(null),S=W0(),R=Ri(!0),k=wn(),F=d.useMemo(()=>k??new ea,[k]),T=Qu(F),N=In(),{registerTrigger:j,isMountedByThisTrigger:D}=rd(b,E,C,{payload:A,closeDelay:h,parent:S,floatingTreeRoot:F,floatingNodeId:T,floatingParentNodeId:N,keyboardEventRelay:R?.relayKeyboardEvent}),O=S.type==="menubar",_=C.useState("disabled"),B=i||_||O&&S.context.disabled,{getButtonProps:H,buttonRef:P}=Yt({disabled:B,native:a});d.useEffect(()=>{!w&&S.type===void 0&&(C.context.allowMouseUpTriggerRef.current=!1)},[C,w,S.type]);const M=d.useRef(null),L=dt(),G=de(oe=>{if(!M.current)return;L.clear(),C.context.allowMouseUpTriggerRef.current=!1;const le=oe.target;ve(M.current,le)||ve(C.select("positionerElement"),le)||le===M.current||le!=null&&_d(le)===C.select("rootId")||Pd(oe,M.current)||F.events.emit("close",{domEvent:oe,reason:au})});d.useEffect(()=>{w&&C.select("lastOpenChangeReason")===it&&Be(M.current).addEventListener("mouseup",G,{once:!0})},[w,G,C]);const V=O&&S.context.hasSubmenuOpen,Q=ud(y,{enabled:(u??V)&&!B&&(!O||V&&!D),handleClose:pd({blockPointerEvents:!O}),mouseOnly:!0,move:!1,restMs:S.type===void 0?f:void 0,delay:{close:h},triggerElementRef:E,externalTree:F,isActiveTrigger:v,isClosing:()=>C.select("transitionStatus")==="ending"}),z=K0(w,C.select("lastOpenChangeReason")),K=Gu(y,{enabled:!B,event:w&&O?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:S.type===void 0?z:!1}),X=ad(y,{enabled:!B&&V}),ae=H0({open:w,enabled:O,mouseDownAction:"open"}),te=d.useMemo(()=>Mt(X.reference,K.reference),[X.reference,K.reference]),$=C.useState("triggerProps",D),{preFocusGuardRef:ee,handlePreFocusGuardFocus:ue,handleFocusTargetFocus:ce}=O0(C,E),he={disabled:B,open:w},se=[M,n,P,j,E],Ae=[te,Q??lt,$,{"aria-haspopup":"menu","aria-controls":I,id:b,onMouseDown:oe=>{if(C.select("open"))return;L.start(200,()=>{C.context.allowMouseUpTriggerRef.current=!0}),Be(oe.currentTarget).addEventListener("mouseup",G,{once:!0})}},O?{role:"menuitem"}:{},ae,p,H],re=Me("button",t,{enabled:!O,stateAttributesMapping:ni,state:he,ref:se,props:Ae});return O?l.jsx(Nd,{tag:"button",render:r,className:o,style:s,state:he,refs:se,props:Ae,stateAttributesMapping:ni}):w?l.jsxs(d.Fragment,{children:[l.jsx(er,{ref:ee,onFocus:ue},`${b}-pre-focus-guard`),l.jsx(d.Fragment,{children:re},b),l.jsx(er,{ref:C.context.triggerFocusTargetRef,onFocus:ce},`${b}-post-focus-guard`)]}):l.jsx(d.Fragment,{children:re},b)});function K0(e,t){const n=dt(),[r,o]=d.useState(!1);return ie(()=>{e&&t===it?(o(!0),n.start(BA,()=>{o(!1)})):e||(n.clear(),o(!1))},[e,t,n]),r}function W0(){const e=jd();return d.useMemo(()=>e?{type:"menubar",context:e}:{type:void 0},[e])}function Od(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function Do({...e}){return l.jsx(T0,{"data-slot":"dropdown-menu",...e})}function Fo({...e}){return l.jsx(L0,{"data-slot":"dropdown-menu-trigger",...e})}function Bo({align:e="start",alignOffset:t=0,side:n="bottom",sideOffset:r=4,className:o,...s}){return l.jsx(v0,{children:l.jsx(S0,{className:"isolate z-50 outline-none",align:e,alignOffset:t,side:n,sideOffset:r,children:l.jsx(x0,{"data-slot":"dropdown-menu-content",className:fe("cn-menu-target cn-menu-translucent z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95",o),...s})})})}function Mo({className:e,inset:t,variant:n="default",...r}){return l.jsx(g0,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:fe("group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",e),...r})}const jo=["zh-CN","ja","ko","en","ar","fr","es","de","ru"],Q0=["ar"],Hd=e=>Q0.includes(e)?"rtl":"ltr",G0=e=>({"zh-CN":"简体中文",ja:"日本語",ko:"한국어",en:"English",ar:"العربية",fr:"Français",es:"Español",de:"Deutsch",ru:"Русский"})[e],Y0=e=>{for(const t of e){const n=t.toLowerCase(),r=jo.find(i=>i.toLowerCase()===n);if(r!==void 0)return r;const o=n.split("-")[0],s=jo.find(i=>i.toLowerCase().split("-")[0]===o);if(s!==void 0)return s;if(o==="zh")return"zh-CN"}return"en"},$t={nav:{add:"Add",applications:"Applications",help:"Help Center"},shell:{product:"create-opentray",toggleSidebar:"Toggle Sidebar"},common:{loading:"Loading…",error:"Something went wrong.",retry:"Retry",cancel:"Cancel",confirm:"Confirm",close:"Close",copy:"Copy",copied:"Copied",download:"Download",refresh:"Refresh",empty:"Nothing here yet."},theme:{title:"Theme",system:"System",light:"Light",dark:"Dark"},language:{title:"Language"},applications:{title:"Applications",statusHealthy:"Healthy",statusInvalidConfig:"Invalid config",statusIncompatible:"Incompatible version",statusMissingPayload:"Missing payload",statusBrokenLink:"Broken link",statusRunning:"Running",edit:"Edit",open:"Open",share:"Share",details:"Details",source:"Source",sourceWizard:"Wizard",sourceRegistered:"Registered",detailsCommand:"Command",detailsCwd:"Working directory",detailsEnv:"Environment keys",detailsPm:"Package manager",detailsWindow:"Window",detailsDevMode:"Developer mode",detailsProjectDir:"Project directory",detailsServiceHint:"Service port hint",uninstall:"Uninstall",uninstallTitle:"Uninstall application?",uninstallDescription:"The registration and its payload link are removed. Dock/taskbar pins must be removed manually.",uninstallWizardDescription:"The wizard project directory and its materialized app bundle are removed after stopping a running entry when authorized. Dock/taskbar pins must be removed manually.",stopRunningTitle:"Force stop and uninstall?",stopRunningDescription:"The application is still running (likely a leftover from an earlier session). Continuing terminates its process tree first, then removes the project.",stopRunningConfirm:"Force stop and uninstall",stopRunningPids:"Running pids",uninstallPurge:"Also delete the linked external target",uninstallPurgeHint:"Deletes the external directory itself after identity revalidation. This cannot be undone.",uninstallPinHint:"macOS Dock pins and Windows taskbar pins are user-managed; remove them manually if present.",emptyHint:"No applications yet — create one from Add.",payload:"Payload",registration:"Registration",linked:"Linked",uninstallRetained:"External target retained:",uninstallDeleted:"External target deleted:"},help:{title:"Help Center",listTitle:"Documents",empty:"No documents available.",readError:"This document could not be read."},export:{title:"Export",shareTitle:"Share application",shareSubtitle:"Built from the current wizard parameters — nothing runs, nothing is written.",command:"Direct command",scriptSh:"Shell script (.sh)",scriptPs1:"PowerShell script (.ps1)",copyCommand:"Copy command",downloadScript:"Download script",downloadFile:"Download file",viewFull:"View full content",building:"Building…",inlineIcon:"Inline icon bytes",inlineIconHint:"Web-scraped icons share as their original URL by default and local icons embed their bytes; toggle to switch between embedding and sharing by reference.",forceCopy:"Force direct copy with embedded icon",forceCopyHint:"Uploaded icons embed as very long data URLs. Scripts are the default; check this only if you accept the length.",envAck:"I reviewed the environment values and accept exporting them",envAckHint:"This application defines environment entries. Complete export includes their values.",envReview:"Environment values (editable before export)",blocked:"Export blocked:"}},un=(e,t)=>{const n=(r,o)=>{if(typeof r=="object"&&r!==null&&!Array.isArray(r)&&typeof o=="object"&&o!==null){const s={...r};for(const[i,a]of Object.entries(o))a!==void 0&&(s[i]=n(r[i],a));return s}return o===void 0?r:o};return n(e,t)},z0={shell:{product:"create-opentray",toggleSidebar:"切换侧边栏"},nav:{add:"新增",applications:"应用列表",help:"帮助中心"},common:{loading:"加载中…",error:"出错了。",retry:"重试",cancel:"取消",confirm:"确认",close:"关闭",copy:"复制",copied:"已复制",download:"下载",refresh:"刷新",empty:"暂无内容。"},theme:{title:"主题",system:"跟随系统",light:"浅色",dark:"深色"},language:{title:"语言"},applications:{title:"应用列表",statusHealthy:"正常",statusInvalidConfig:"配置无效",statusIncompatible:"版本不兼容",statusMissingPayload:"负载缺失",statusBrokenLink:"链接失效",statusRunning:"运行中",edit:"编辑",open:"打开应用",share:"分享",details:"详情",source:"来源",sourceWizard:"向导",sourceRegistered:"注册",detailsCommand:"命令",detailsCwd:"工作目录",detailsEnv:"环境变量键",detailsPm:"包管理器",detailsWindow:"窗口",detailsDevMode:"开发者模式",detailsProjectDir:"项目目录",detailsServiceHint:"服务端口提示",uninstall:"卸载",uninstallTitle:"卸载应用?",uninstallDescription:"将删除注册信息与负载链接。Dock/任务栏图标需手动移除。",uninstallWizardDescription:"将停止运行中的应用(如已授权)并删除项目目录与已物化的应用 Bundle。Dock/任务栏图标需手动移除。",stopRunningTitle:"强制停止并卸载?",stopRunningDescription:"应用仍在运行(可能是上次会话的残留)。继续将先终止其进程树,再删除项目目录与已物化的 Bundle。",stopRunningConfirm:"强制停止并卸载",stopRunningPids:"运行中的进程",uninstallPurge:"同时删除链接的外部目录",uninstallPurgeHint:"重新校验身份后删除外部目录本身,此操作不可撤销。",uninstallPinHint:"macOS Dock 与 Windows 任务栏图标由系统管理,请手动移除。",emptyHint:"还没有应用——去「新增」创建一个。",payload:"负载",registration:"注册",linked:"链接",uninstallRetained:"外部目录已保留:",uninstallDeleted:"外部目录已删除:"},help:{title:"帮助中心",listTitle:"文档",empty:"暂无文档。",readError:"无法读取该文档。"},export:{title:"导出",shareTitle:"分享应用",shareSubtitle:"基于当前向导参数构建——不运行命令、不写入任何内容。",command:"直接命令",scriptSh:"Shell 脚本(.sh)",scriptPs1:"PowerShell 脚本(.ps1)",copyCommand:"复制命令",downloadScript:"下载脚本",downloadFile:"下载文件",viewFull:"查看完整内容",building:"生成中…",inlineIcon:"内联图标字节",inlineIconHint:"网页抓取的图标默认以原始链接分享、本地图标默认内嵌字节;勾选状态即在内嵌与按引用分享之间切换。",forceCopy:"强制直接复制(内嵌图标)",forceCopyHint:"上传的图标会以很长的 data URL 内嵌,默认导出脚本;仅在你接受长度时勾选。",envAck:"我已检查环境变量并接受导出",envAckHint:"该应用定义了环境变量,完整导出将包含其值。",envReview:"环境变量(导出前可编辑)",blocked:"导出被阻止:"}},U0={shell:{product:"create-opentray",toggleSidebar:"サイドバー切替"},nav:{add:"追加",applications:"アプリ一覧",help:"ヘルプセンター"},common:{loading:"読み込み中…",error:"エラーが発生しました。",retry:"再試行",cancel:"キャンセル",confirm:"確認",close:"閉じる",copy:"コピー",copied:"コピーしました",download:"ダウンロード",refresh:"更新",empty:"まだ何もありません。"},theme:{title:"テーマ",system:"システム",light:"ライト",dark:"ダーク"},language:{title:"言語"},applications:{title:"アプリ一覧",statusHealthy:"正常",statusInvalidConfig:"設定が無効",statusIncompatible:"バージョン非対応",statusMissingPayload:"ペイロード欠落",statusBrokenLink:"リンク切れ",statusRunning:"実行中",edit:"編集",uninstall:"アンインストール",uninstallTitle:"アプリをアンインストールしますか?",uninstallDescription:"登録とペイロードリンクを削除します。Dock/タスクバーのピンは手動で外してください。",uninstallPurge:"リンク先の外部ディレクトリも削除する",uninstallPurgeHint:"身份を再検証した上で外部ディレクトリ自体を削除します。元に戻せません。",uninstallPinHint:"macOS の Dock ピンと Windows のタスクバーピンは手動で管理してください。",emptyHint:"登録済みアプリはまだありません。「追加」から作成してください。",payload:"ペイロード",registration:"登録",linked:"リンク",uninstallRetained:"外部ディレクトリは保持されました:",uninstallDeleted:"外部ディレクトリを削除しました:"},help:{title:"ヘルプセンター",listTitle:"ドキュメント",empty:"ドキュメントはありません。",readError:"このドキュメントは読み込めませんでした。"},export:{title:"エクスポート",command:"直接コマンド",scriptSh:"Shell スクリプト(.sh)",scriptPs1:"PowerShell スクリプト(.ps1)",copyCommand:"コマンドをコピー",downloadScript:"スクリプトをダウンロード",forceCopy:"アイコン埋め込みの直接コピーを強制する",forceCopyHint:"アップロードしたアイコンは非常に長い data URL として埋め込まれます。既定はスクリプトです。",envAck:"環境変数を確認し、エクスポートを許可します",envAckHint:"このアプリには環境変数が定義されており、完全なエクスポートに値が含まれます。",envReview:"環境変数(エクスポート前に編集可)",blocked:"エクスポートをブロック:"}},V0={shell:{product:"create-opentray",toggleSidebar:"사이드바 전환"},nav:{add:"추가",applications:"앱 목록",help:"도움말 센터"},common:{loading:"불러오는 중…",error:"문제가 발생했습니다.",retry:"재시도",cancel:"취소",confirm:"확인",close:"닫기",copy:"복사",copied:"복사됨",download:"다운로드",refresh:"새로고침",empty:"아직 없습니다."},theme:{title:"테마",system:"시스템",light:"라이트",dark:"다크"},language:{title:"언어"},applications:{title:"앱 목록",statusHealthy:"정상",statusInvalidConfig:"구성 무효",statusIncompatible:"버전 비호환",statusMissingPayload:"페이로드 누락",statusBrokenLink:"링크 끊김",statusRunning:"실행 중",edit:"편집",uninstall:"제거",uninstallTitle:"앱을 제거할까요?",uninstallDescription:"등록 정보와 페이로드 링크가 삭제됩니다. Dock/작업표시줄 고정은 직접 해제하세요.",uninstallPurge:"연결된 외부 디렉터리도 삭제",uninstallPurgeHint:"신원 재검증 후 외부 디렉터리 자체를 삭제합니다. 되돌릴 수 없습니다.",uninstallPinHint:"macOS Dock 고정과 Windows 작업표시줄 고정은 직접 관리해야 합니다.",emptyHint:"등록된 앱이 아직 없습니다. 「추가」에서 만들어 보세요.",payload:"페이로드",registration:"등록",linked:"링크",uninstallRetained:"외부 디렉터리 유지됨:",uninstallDeleted:"외부 디렉터리 삭제됨:"},help:{title:"도움말 센터",listTitle:"문서",empty:"문서가 없습니다.",readError:"이 문서를 읽을 수 없습니다."},export:{title:"내보내기",command:"직접 명령",scriptSh:"Shell 스크립트(.sh)",scriptPs1:"PowerShell 스크립트(.ps1)",copyCommand:"명령 복사",downloadScript:"스크립트 다운로드",forceCopy:"아이콘 포함 직접 복사 강제",forceCopyHint:"업로드한 아이콘은 매우 긴 data URL로 포함됩니다. 기본은 스크립트입니다.",envAck:"환경 변수를 확인했으며 내보내기를 허용합니다",envAckHint:"이 앱에는 환경 변수가 정의되어 있어 전체 내보내기에 값이 포함됩니다.",envReview:"환경 변수(내보내기 전 편집 가능)",blocked:"내보내기 차단:"}},Z0={shell:{product:"create-opentray",toggleSidebar:"تبديل الشريط الجانبي"},nav:{add:"إضافة",applications:"التطبيقات",help:"مركز المساعدة"},common:{loading:"جارٍ التحميل…",error:"حدث خطأ.",retry:"إعادة المحاولة",cancel:"إلغاء",confirm:"تأكيد",close:"إغلاق",copy:"نسخ",copied:"تم النسخ",download:"تنزيل",refresh:"تحديث",empty:"لا يوجد شيء بعد."},theme:{title:"المظهر",system:"النظام",light:"فاتح",dark:"داكن"},language:{title:"اللغة"},applications:{title:"التطبيقات",statusHealthy:"سليم",statusInvalidConfig:"تهيئة غير صالحة",statusIncompatible:"إصدار غير متوافق",statusMissingPayload:"الحِمل مفقود",statusBrokenLink:"رابط معطّل",statusRunning:"قيد التشغيل",edit:"تحرير",uninstall:"إزالة",uninstallTitle:"إزالة التطبيق؟",uninstallDescription:"سيُحذف التسجيل ورابط الحِمل. يجب إزالة تثبيت Dock/شريط المهام يدويًا.",uninstallPurge:"حذف الدليل الخارجي المرتبط أيضًا",uninstallPurgeHint:"يحذف الدليل الخارجي نفسه بعد إعادة التحقق من الهوية. لا يمكن التراجع.",uninstallPinHint:"تثبيتات Dock في macOS وشريط المهام في Windows يديرها المستخدم؛ أزلها يدويًا.",emptyHint:"لا توجد تطبيقات مسجلة بعد — أنشئ واحدًا من «إضافة».",payload:"الحِمل",registration:"التسجيل",linked:"مرتبط",uninstallRetained:"احتُفظ بالدليل الخارجي:",uninstallDeleted:"حُذف الدليل الخارجي:"},help:{title:"مركز المساعدة",listTitle:"المستندات",empty:"لا توجد مستندات.",readError:"تعذّرت قراءة هذا المستند."},export:{title:"تصدير",command:"أمر مباشر",scriptSh:"سكربت Shell‏ (.sh)",scriptPs1:"سكربت PowerShell‏ (.ps1)",copyCommand:"نسخ الأمر",downloadScript:"تنزيل السكربت",forceCopy:"فرض النسخ المباشر مع تضمين الأيقونة",forceCopyHint:"تُضمَّن الأيقونات المرفوعة كعناوين data URL طويلة جدًا؛ السكربت هو الافتراضي.",envAck:"راجعت متغيرات البيئة وأوافق على تصديرها",envAckHint:"يحدّد هذا التطبيق متغيرات بيئة، وسيشمل التصدير الكامل قيمها.",envReview:"متغيرات البيئة (قابلة للتحرير قبل التصدير)",blocked:"التصدير محجوب:"}},J0={shell:{product:"create-opentray",toggleSidebar:"Basculer la barre latérale"},nav:{add:"Ajouter",applications:"Applications",help:"Centre d'aide"},common:{loading:"Chargement…",error:"Une erreur est survenue.",retry:"Réessayer",cancel:"Annuler",confirm:"Confirmer",close:"Fermer",copy:"Copier",copied:"Copié",download:"Télécharger",refresh:"Actualiser",empty:"Rien pour le moment."},theme:{title:"Thème",system:"Système",light:"Clair",dark:"Sombre"},language:{title:"Langue"},applications:{title:"Applications",statusHealthy:"Sain",statusInvalidConfig:"Config invalide",statusIncompatible:"Version incompatible",statusMissingPayload:"Charge utile manquante",statusBrokenLink:"Lien rompu",statusRunning:"En cours",edit:"Modifier",uninstall:"Désinstaller",uninstallTitle:"Désinstaller l'application ?",uninstallDescription:"L'enregistrement et le lien de charge utile sont supprimés. Les épingles Dock/barre des tâches se retirent manuellement.",uninstallPurge:"Supprimer aussi le répertoire externe lié",uninstallPurgeHint:"Supprime le répertoire externe lui-même après revalidation de l'identité. Irréversible.",uninstallPinHint:"Les épingles Dock (macOS) et barre des tâches (Windows) sont gérées par l'utilisateur.",emptyHint:"Aucune application enregistrée — créez-en une depuis Ajouter.",payload:"Charge utile",registration:"Enregistrement",linked:"Lié",uninstallRetained:"Répertoire externe conservé :",uninstallDeleted:"Répertoire externe supprimé :"},help:{title:"Centre d'aide",listTitle:"Documents",empty:"Aucun document.",readError:"Impossible de lire ce document."},export:{title:"Exporter",command:"Commande directe",scriptSh:"Script shell (.sh)",scriptPs1:"Script PowerShell (.ps1)",copyCommand:"Copier la commande",downloadScript:"Télécharger le script",forceCopy:"Forcer la copie directe avec icône intégrée",forceCopyHint:"Les icônes téléversées sont incorporées en data URLs très longues ; le script est la valeur par défaut.",envAck:"J'ai revu les variables d'environnement et accepte de les exporter",envAckHint:"Cette application définit des variables d'environnement ; l'export complet inclut leurs valeurs.",envReview:"Variables d'environnement (modifiables avant export)",blocked:"Export bloqué :"}},$0={shell:{product:"create-opentray",toggleSidebar:"Alternar barra lateral"},nav:{add:"Añadir",applications:"Aplicaciones",help:"Centro de ayuda"},common:{loading:"Cargando…",error:"Algo salió mal.",retry:"Reintentar",cancel:"Cancelar",confirm:"Confirmar",close:"Cerrar",copy:"Copiar",copied:"Copiado",download:"Descargar",refresh:"Actualizar",empty:"Aún no hay nada."},theme:{title:"Tema",system:"Sistema",light:"Claro",dark:"Oscuro"},language:{title:"Idioma"},applications:{title:"Aplicaciones",statusHealthy:"Sano",statusInvalidConfig:"Config no válida",statusIncompatible:"Versión incompatible",statusMissingPayload:"Carga útil ausente",statusBrokenLink:"Enlace roto",statusRunning:"En ejecución",edit:"Editar",uninstall:"Desinstalar",uninstallTitle:"¿Desinstalar la aplicación?",uninstallDescription:"Se eliminan el registro y el enlace de carga útil. Los anclajes del Dock/barra de tareas se quitan manualmente.",uninstallPurge:"Eliminar también el directorio externo enlazado",uninstallPurgeHint:"Elimina el directorio externo tras revalidar la identidad. No se puede deshacer.",uninstallPinHint:"Los anclajes del Dock (macOS) y de la barra de tareas (Windows) los gestiona el usuario.",emptyHint:"Aún no hay aplicaciones registradas: crea una desde Añadir.",payload:"Carga útil",registration:"Registro",linked:"Enlazado",uninstallRetained:"Directorio externo conservado:",uninstallDeleted:"Directorio externo eliminado:"},help:{title:"Centro de ayuda",listTitle:"Documentos",empty:"No hay documentos.",readError:"No se pudo leer este documento."},export:{title:"Exportar",command:"Comando directo",scriptSh:"Script de shell (.sh)",scriptPs1:"Script de PowerShell (.ps1)",copyCommand:"Copiar comando",downloadScript:"Descargar script",forceCopy:"Forzar copia directa con icono incrustado",forceCopyHint:"Los iconos subidos se incrustan como data URLs muy largas; el script es la opción predeterminada.",envAck:"He revisado las variables de entorno y acepto exportarlas",envAckHint:"Esta aplicación define variables de entorno; la exportación completa incluye sus valores.",envReview:"Variables de entorno (editables antes de exportar)",blocked:"Exportación bloqueada:"}},X0={shell:{product:"create-opentray",toggleSidebar:"Seitenleiste umschalten"},nav:{add:"Hinzufügen",applications:"Anwendungen",help:"Hilfecenter"},common:{loading:"Lädt…",error:"Etwas ist schiefgelaufen.",retry:"Erneut versuchen",cancel:"Abbrechen",confirm:"Bestätigen",close:"Schließen",copy:"Kopieren",copied:"Kopiert",download:"Herunterladen",refresh:"Aktualisieren",empty:"Noch nichts vorhanden."},theme:{title:"Design",system:"System",light:"Hell",dark:"Dunkel"},language:{title:"Sprache"},applications:{title:"Anwendungen",statusHealthy:"Intakt",statusInvalidConfig:"Ungültige Konfiguration",statusIncompatible:"Inkompatible Version",statusMissingPayload:"Payload fehlt",statusBrokenLink:"Defekter Link",statusRunning:"Läuft",edit:"Bearbeiten",uninstall:"Deinstallieren",uninstallTitle:"Anwendung deinstallieren?",uninstallDescription:"Registrierung und Payload-Link werden entfernt. Dock-/Taskleisten-Anker bitte manuell entfernen.",uninstallPurge:"Verknüpftes externes Verzeichnis ebenfalls löschen",uninstallPurgeHint:"Löscht das externe Verzeichnis nach Identitätsprüfung. Nicht rückgängig machbar.",uninstallPinHint:"Dock-Anker (macOS) und Taskleisten-Anker (Windows) verwaltet der Benutzer manuell.",emptyHint:"Noch keine registrierten Anwendungen — erstelle eine unter „Hinzufügen“.",payload:"Payload",registration:"Registrierung",linked:"Verknüpft",uninstallRetained:"Externes Verzeichnis behalten:",uninstallDeleted:"Externes Verzeichnis gelöscht:"},help:{title:"Hilfecenter",listTitle:"Dokumente",empty:"Keine Dokumente.",readError:"Dieses Dokument konnte nicht gelesen werden."},export:{title:"Exportieren",command:"Direktbefehl",scriptSh:"Shell-Skript (.sh)",scriptPs1:"PowerShell-Skript (.ps1)",copyCommand:"Befehl kopieren",downloadScript:"Skript herunterladen",forceCopy:"Direktes Kopieren mit eingebettetem Symbol erzwingen",forceCopyHint:"Hochgeladene Symbole werden als sehr lange Data-URLs eingebettet; Standard ist das Skript.",envAck:"Ich habe die Umgebungsvariablen geprüft und akzeptiere ihren Export",envAckHint:"Diese Anwendung definiert Umgebungsvariablen; der vollständige Export enthält deren Werte.",envReview:"Umgebungsvariablen (vor dem Export bearbeitbar)",blocked:"Export blockiert:"}},q0={shell:{product:"create-opentray",toggleSidebar:"Показать/скрыть боковую панель"},nav:{add:"Добавить",applications:"Приложения",help:"Центр справки"},common:{loading:"Загрузка…",error:"Что-то пошло не так.",retry:"Повторить",cancel:"Отмена",confirm:"Подтвердить",close:"Закрыть",copy:"Копировать",copied:"Скопировано",download:"Скачать",refresh:"Обновить",empty:"Пока ничего нет."},theme:{title:"Тема",system:"Системная",light:"Светлая",dark:"Тёмная"},language:{title:"Язык"},applications:{title:"Приложения",statusHealthy:"Исправно",statusInvalidConfig:"Неверная конфигурация",statusIncompatible:"Несовместимая версия",statusMissingPayload:"Отсутствует payload",statusBrokenLink:"Битая ссылка",statusRunning:"Выполняется",edit:"Изменить",uninstall:"Удалить",uninstallTitle:"Удалить приложение?",uninstallDescription:"Регистрация и ссылка payload будут удалены. Значки Dock/панели задач удаляйте вручную.",uninstallPurge:"Также удалить связанный внешний каталог",uninstallPurgeHint:"Удаляет внешний каталог после повторной проверки идентичности. Отменить нельзя.",uninstallPinHint:"Значки Dock (macOS) и панели задач (Windows) управляются пользователем вручную.",emptyHint:"Зарегистрированных приложений пока нет — создайте первое в разделе «Добавить».",payload:"Payload",registration:"Регистрация",linked:"Ссылка",uninstallRetained:"Внешний каталог сохранён:",uninstallDeleted:"Внешний каталог удалён:"},help:{title:"Центр справки",listTitle:"Документы",empty:"Документов нет.",readError:"Не удалось прочитать этот документ."},export:{title:"Экспорт",command:"Прямая команда",scriptSh:"Скрипт shell (.sh)",scriptPs1:"Скрипт PowerShell (.ps1)",copyCommand:"Копировать команду",downloadScript:"Скачать скрипт",forceCopy:"Принудительное копирование со встроенной иконкой",forceCopyHint:"Загруженные иконки встраиваются как очень длинные data-URL; по умолчанию — скрипт.",envAck:"Я проверил переменные окружения и согласен на их экспорт",envAckHint:"В этом приложении заданы переменные окружения; полный экспорт включает их значения.",envReview:"Переменные окружения (можно изменить перед экспортом)",blocked:"Экспорт заблокирован:"}},ex={en:$t,"zh-CN":un($t,z0),ja:un($t,U0),ko:un($t,V0),ar:un($t,Z0),fr:un($t,J0),es:un($t,$0),de:un($t,X0),ru:un($t,q0)},tx=e=>ex[e],Ld="create-opentray.locale",Kd="create-opentray.theme",Wd="lang",Qd=new Set(jo),nx=()=>{try{const t=new URLSearchParams(window.location.search).get(Wd);return t!==null&&Qd.has(t)?t:null}catch{return null}},rx=e=>{try{const t=new URL(window.location.href);t.searchParams.set(Wd,e),window.history.replaceState(null,"",t)}catch{}},zl=e=>{try{return window.localStorage.getItem(e)}catch{return null}},Ul=(e,t)=>{try{window.localStorage.setItem(e,t)}catch{}},ox=()=>window.matchMedia("(prefers-color-scheme: dark)").matches,Vl=e=>e==="system"?ox()?"dark":"light":e,fi=(e,t)=>{const n=document.documentElement;n.lang=e,n.dir=Hd(e),n.classList.toggle("dark",Vl(t)==="dark"),n.style.colorScheme=Vl(t)},sx=()=>{const e=nx(),t=e!==null?e:null,n=zl(Ld),r=t!==null?t:n!==null&&Qd.has(n)?n:Y0(navigator.languages??[navigator.language]),o=zl(Kd);return{locale:r,theme:o==="light"||o==="dark"||o==="system"?o:"system"}},Gd=d.createContext(void 0),ix=({initialLocale:e,initialTheme:t,children:n})=>{const[r,o]=d.useState(e),[s,i]=d.useState(t);d.useEffect(()=>{fi(r,s)},[r,s]),d.useEffect(()=>{if(s!=="system")return;const f=window.matchMedia("(prefers-color-scheme: dark)"),h=()=>{fi(r,"system")};return f.addEventListener("change",h),()=>f.removeEventListener("change",h)},[s,r]);const a=d.useCallback(f=>{rx(f),Ul(Ld,f),o(f)},[]),c=d.useCallback(f=>{Ul(Kd,f),i(f)},[]),u=d.useMemo(()=>({locale:r,messages:tx(r),direction:Hd(r),theme:s,setLocale:a,setTheme:c}),[r,s,a,c]);return l.jsx(Gd.Provider,{value:u,children:n})},ps=()=>{const e=d.useContext(Gd);if(e===void 0)throw new Error("usePreferences must be used inside PreferencesProvider");return e},Yd=d.createContext(void 0),zd=()=>{const[e]=Du(),t=d.useMemo(()=>new URLSearchParams(e.split("?")[1]??""),[e]),n=(e.split("?")[0]??"/add").replace(/^\/?/u,"");return{route:n==="applications"||n==="help"?n:"add",query:t}},Ud=()=>{const e=d.useContext(Yd);if(e===void 0)throw new Error("useWorkbenchNavigation must be used inside WorkbenchShell");return e},ax={"zh-CN":"中",ja:"日",ko:"한",en:"EN",ar:"ع",fr:"FR",es:"ES",de:"DE",ru:"RU"},lx=({product:e})=>{const{state:t,toggleSidebar:n}=ds(),r=t==="collapsed",o=`${e} · ${r?"展开":"收起"}`;return r?l.jsx(kr,{size:"lg",className:"group/brand relative justify-center",children:l.jsxs("span",{className:"relative grid size-8 shrink-0 place-items-center",children:[l.jsx("img",{src:"/logo.png",alt:e,width:24,height:24,className:"size-6 rounded-md transition-opacity group-hover/brand:opacity-0 focus-visible-within:opacity-0"}),l.jsx("button",{type:"button",onClick:n,"aria-label":o,title:o,className:"absolute inset-0 grid place-items-center rounded-md opacity-0 transition-opacity hover:bg-sidebar-accent focus-visible:opacity-100 group-hover/brand:opacity-100",children:l.jsx(rl,{"aria-hidden":!0,className:"size-4"})})]})}):l.jsxs(kr,{size:"lg",className:"justify-start pr-1",children:[l.jsx("img",{src:"/logo.png",alt:e,width:24,height:24,className:"size-6 shrink-0 rounded-md"}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:e}),l.jsx("button",{type:"button",onClick:n,"aria-label":o,title:o,className:"grid size-6 shrink-0 place-items-center rounded-md hover:bg-sidebar-accent",children:l.jsx(rl,{"aria-hidden":!0,className:"size-4"})})]})},cx=({children:e,panelOpen:t})=>{const{locale:n,messages:r,setLocale:o,theme:s,setTheme:i}=ps(),{route:a}=zd(),c=d.useCallback(m=>{window.location.hash=`#/${m}`},[]),[u,f]=d.useState(()=>window.innerWidth>=768),h=t===!0;d.useEffect(()=>{const m=window.matchMedia("(min-width: 768px)"),x=()=>{f(m.matches&&!h)};return x(),m.addEventListener("change",x),()=>m.removeEventListener("change",x)},[h]);const g=d.useMemo(()=>({route:a,navigate:c}),[a,c]),A=[{route:"add",icon:l.jsx(du,{"aria-hidden":!0}),label:r.nav.add},{route:"applications",icon:l.jsx(rh,{"aria-hidden":!0}),label:r.nav.applications},{route:"help",icon:l.jsx(Gp,{"aria-hidden":!0}),label:r.nav.help}],p=s==="system"?r.theme.system:s==="light"?r.theme.light:r.theme.dark;return l.jsx(Yd.Provider,{value:g,children:l.jsxs(n0,{open:u,onOpenChange:f,children:[l.jsxs(r0,{collapsible:"icon",children:[l.jsx(s0,{children:l.jsx(Ms,{children:l.jsx(oo,{children:l.jsx(lx,{product:r.shell.product})})})}),l.jsx(a0,{children:l.jsx(l0,{children:l.jsx(c0,{children:l.jsx(Ms,{children:A.map(m=>l.jsx(oo,{children:l.jsxs(ls,{children:[l.jsxs(cs,{render:l.jsx(kr,{isActive:a===m.route,tooltip:m.label,"aria-label":m.label,onClick:()=>{c(m.route)}}),children:[m.icon,l.jsx("span",{children:m.label})]}),l.jsx(us,{side:"right",children:m.label})]})},m.route))})})})}),l.jsx(i0,{children:l.jsxs(Ms,{children:[l.jsx(oo,{children:l.jsxs(Do,{children:[l.jsx(Fo,{render:l.jsxs(kr,{tooltip:r.language.title,"aria-label":r.language.title,children:[l.jsx("span",{"aria-hidden":!0,className:"text-xs font-semibold",children:ax[n]}),l.jsx("span",{children:r.language.title})]})}),l.jsx(Bo,{side:"top",align:"start",children:jo.map(m=>l.jsx(Mo,{onClick:()=>{o(m)},children:G0(m)},m))})]})}),l.jsx(oo,{children:l.jsxs(Do,{children:[l.jsx(Fo,{render:l.jsxs(kr,{tooltip:`${r.theme.title}: ${p}`,"aria-label":`${r.theme.title}: ${p}`,children:[s==="light"?l.jsx(wh,{"aria-hidden":!0}):s==="dark"?l.jsx(ch,{"aria-hidden":!0}):l.jsx(ah,{"aria-hidden":!0}),l.jsx("span",{children:p})]})}),l.jsx(Bo,{side:"top",align:"start",children:[["system",r.theme.system],["light",r.theme.light],["dark",r.theme.dark]].map(([m,x])=>l.jsx(Mo,{onClick:()=>{i(m)},children:x},m))})]})})]})}),l.jsx(o0,{"aria-label":r.shell.toggleSidebar})]}),l.jsx("main",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden",children:e})]})})},ux=()=>new URLSearchParams(window.location.search).get("token")??"",ln=async(e,t={})=>{const n=await fetch(e,{method:t.method??"GET",headers:{authorization:`Bearer ${ux()}`,...t.body===void 0?{}:{"content-type":"application/json"}},...t.body===void 0?{}:{body:JSON.stringify(t.body)}}),r=await n.json().catch(()=>({}));return{status:n.status,data:r}},dx=()=>ln("/api/apps"),Vd=e=>ln(`/api/apps/${encodeURIComponent(e)}/config`),fx=e=>ln(`/api/apps/${encodeURIComponent(e)}/icon`),px=(e,t)=>ln(`/api/apps/${encodeURIComponent(e)}/uninstall`,{method:"POST",body:{...t}}),hx=()=>ln("/api/skill/list"),Ax=e=>ln(`/api/skill?path=${encodeURIComponent(e)}`),gx=(e,t)=>ln(`/api/apps/${encodeURIComponent(e)}/export`,{method:"POST",body:{...t}}),mx=e=>ln(`/api/apps/${encodeURIComponent(e)}/open`,{method:"POST",body:{}}),xx=e=>ln("/api/export",{method:"POST",body:{...e}}).then(t=>{if(t.status!==200)return t;const n=t.data;return n.ok!==!0?{status:409,data:{code:n.code,message:n.message}}:{status:200,data:n.kind==="command"?{command:n.command}:{filename:n.filename,content:n.content,...n.commandLine===void 0?{}:{commandLine:n.commandLine},...n.iconSharedAs===void 0?{}:{iconSharedAs:n.iconSharedAs},...n.iconReference===void 0?{}:{iconReference:n.iconReference}}}});function bx(e){if(!e)return null;for(const t of e.elements){const n=t.tagName;if(n==="BUTTON"||n==="INPUT"){const r=t;if(r.type==="submit")return r}}return null}function Zd(e){return{checked(t){return e.indeterminate?{}:t?{"data-checked":""}:{"data-unchecked":""}},...Di}}const vx=d.createContext(void 0);function yx(){return d.useContext(vx)}const Jd=d.createContext(void 0);function Cx(){const e=d.useContext(Jd);if(e===void 0)throw new Error(ot(14));return e}const Ix="data-parent",wx=d.forwardRef(function(t,n){const{checked:r,className:o,defaultChecked:s=!1,"aria-labelledby":i,disabled:a=!1,form:c,id:u,indeterminate:f=!1,inputRef:h,name:g,onCheckedChange:A,parent:p=!1,readOnly:m=!1,render:x,required:C=!1,uncheckedValue:b,value:v,nativeButton:y=!1,style:w,...I}=t,{clearErrors:E}=Fi(),{disabled:S,name:R,setDirty:k,setFilled:F,setFocused:T,setTouched:N,state:j,validationMode:D,validityData:O,validation:_}=Qo(),B=lA(),{labelId:H,controlId:P,registerControlId:M,getDescriptionProps:L}=Bi(),G=yx(),V=G?.allValues===void 0?void 0:G.parent,Y=V!==void 0,Q=S||B.disabled||G?.disabled||a,z=R??g,K=v??z,X=wt(),ae=wt();let te=u||P;Y&&(p?te=ae:K!==void 0?te=`${V.id}-${K}`:te||=ae);let $={};Y&&(p?$=V.getParentProps():K!==void 0&&($=V.getChildProps(K)));const{checked:ee=r,indeterminate:ue=f,onCheckedChange:ce,...he}=$,se=G?.value,Ae=d.useRef(null),re=St(()=>Symbol()),oe=d.useRef(!1),{getButtonProps:le,buttonRef:ge}=Yt({disabled:Q,native:y}),me=G?.validation??_,[W,U]=on({controlled:K!==void 0&&se!==void 0&&!p?se.includes(K):ee,default:s,name:"Checkbox",state:"checked"}),be=Y?!!ee:W,q=Y&&ue||f;ie(()=>{M!==Er&&(oe.current=!0,M(re.current,te))},[te,M,re]),d.useEffect(()=>{const Ie=re.current;return()=>{!oe.current||M===Er||(oe.current=!1,M(Ie,void 0))}},[M,re]),Mi(Ae,X,W,void 0,!G&&!Q,g);const ne=d.useRef(null),Ee=me.registerInput,Se=G?K:void 0,Ge=d.useCallback(Ie=>Ee(Ie,{controlRef:Ae,value:Se}),[Ee,Se]),ze=Gt(h,ne,p?void 0:Ge),Le=pu(i,H,ne,!y,te??void 0);ie(()=>{ne.current&&(ne.current.indeterminate=q,W&&F(!0))},[W,q,F]),ss(W,()=>{G||(E(z),F(W),k(W!==O.initialValue),me.change(W))});const ct=Mt({checked:W,disabled:Q,form:c,name:p?void 0:z,id:y?void 0:te??void 0,required:C,ref:ze,style:z?Xi:$o,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(Ie){if(Ie.nativeEvent.defaultPrevented)return;if(m){Ie.preventDefault();return}const Ke=Ie.currentTarget.checked,Ne=Ce(Pt,Ie.nativeEvent);if(A?.(Ke,Ne),!Ne.isCanceled&&(ce?.(Ke,Ne),!Ne.isCanceled&&(U(Ke),K!==void 0&&G!==void 0&&!p&&!Y))){const nt=Ke?[...G.value,K]:G.value.filter(Re=>Re!==K);G.setValue(nt,Ne)}},onClick(Ie){Ie.stopPropagation()},onFocus(){Ae.current?.focus()}},v!==void 0?{value:(G?W&&v:v)||""}:lt,L,Ie=>me.getValidationProps(Q,Ie));d.useEffect(()=>{if(!V||K===void 0)return;const Ie=V.disabledStatesRef.current;return Ie.set(K,Q),()=>{Ie.delete(K)}},[V,Q,K]);const tt=d.useMemo(()=>({...j,checked:be,disabled:Q,readOnly:m,required:C,indeterminate:q}),[j,be,Q,m,C,q]),Je=Zd(tt),ft=Me("span",t,{state:tt,ref:[ge,Ae,n],props:[{id:y?te??void 0:X,role:"checkbox","aria-checked":q?"mixed":be,"aria-readonly":m||void 0,"aria-required":C||void 0,"aria-labelledby":Le,[Ix]:p?"":void 0,onFocus(){Q||T(!0)},onBlur(){const Ie=ne.current;Ie&&(N(!0),T(!1),D==="onBlur"&&me.commit(G?se:Ie.checked))},onKeyDown(Ie){if(Ie.key!=="Enter"||(Ie.preventBaseUIHandler(),Ie.defaultPrevented))return;const Ke=ne.current?.form??null,Ne=Ie.currentTarget,nt=Ie.nativeEvent,Re=Ie.preventDefault,Ue=nt.preventDefault;let Ve=!1;Ie.preventDefault=()=>{Ve=!0,Re.call(Ie)},nt.preventDefault=()=>{Ve=!0,Ue.call(nt)},Ue.call(nt),rt(Ne).queueMicrotask(()=>{Ie.preventDefault=Re,nt.preventDefault=Ue,Ve||bx(Ke)?.click()})},onClick(Ie){if(m||Q)return;Ie.preventDefault();const Ke=ne.current;Ke&&Si(Ke,Ie)}},I,he,le,L,Ie=>me.getValidationProps(Q,Ie)],stateAttributesMapping:Je});return l.jsxs(Jd.Provider,{value:tt,children:[ft,!W&&!G&&z&&!p&&b!==void 0&&l.jsx("input",{type:"hidden",form:c,name:z,value:b,disabled:Q}),l.jsx("input",{...ct,suppressHydrationWarning:!0})]})}),kx=d.forwardRef(function(t,n){const{render:r,className:o,style:s,keepMounted:i=!1,...a}=t,c=Cx(),u=c.checked||c.indeterminate,{mounted:f,transitionStatus:h,setMounted:g}=or(u),A=d.useRef(null),p={...c,transitionStatus:h};zt({open:u,ref:A,onComplete(){u||g(!1)}});const x={...Zd(c),...Nn},C=i||f,b=Me("span",t,{ref:[n,A],state:p,stateAttributesMapping:x,props:a});return C?b:null});function pi({className:e,...t}){return l.jsx(wx,{"data-slot":"checkbox",className:fe("peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary",e),...t,children:l.jsx(kx,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:l.jsx(Pi,{})})})}function je({className:e,...t}){return l.jsx("label",{"data-slot":"label",className:fe("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}const $d=d.createContext(void 0);function Xd(){const e=d.useContext($d);if(e===void 0)throw new Error(ot(10));return e}const Ex={value:()=>null},Sx=d.forwardRef(function(t,n){const{render:r,className:o,disabled:s=!1,hiddenUntilFound:i,keepMounted:a,loopFocus:c,onValueChange:u,multiple:f=!1,orientation:h="vertical",value:g,defaultValue:A,style:p,...m}=t,x=d.useMemo(()=>{if(g===void 0)return A??[]},[g,A]),C=d.useRef([]),[b,v]=on({controlled:g,default:x,name:"Accordion",state:"value"}),y=de((S,R,k)=>{if(f)if(R){const F=b.slice();if(F.push(S),u?.(F,k),k.isCanceled)return;v(F)}else{const F=b.filter(T=>T!==S);if(u?.(F,k),k.isCanceled)return;v(F)}else{const F=b[0]===S?[]:[S];if(u?.(F,k),k.isCanceled)return;v(F)}}),w=d.useMemo(()=>({value:b,disabled:s,orientation:h}),[b,s,h]),I=d.useMemo(()=>({disabled:s,handleValueChange:y,hiddenUntilFound:i??!1,keepMounted:a??!1,state:w,value:b}),[s,y,i,a,w,b]),E=Me("div",t,{state:w,ref:n,props:m,stateAttributesMapping:Ex});return l.jsx($d.Provider,{value:I,children:l.jsx(Ur,{elementsRef:C,children:E})})});function Rx(e){const{open:t,defaultOpen:n,onOpenChange:r,disabled:o}=e,[s,i]=on({controlled:t,default:n,name:"Collapsible",state:"open"}),{mounted:a,setMounted:c,transitionStatus:u}=or(s,!0,!0),f=wt(),[h,g]=d.useState(),A=h===null?void 0:h??f,p=de(m=>{const x=!s,C=Ce(Pn,m.nativeEvent);r(x,C),!C.isCanceled&&i(x)});return d.useMemo(()=>({defaultPanelId:f,disabled:o,handleTrigger:p,mounted:a,open:s,panelId:A,setMounted:c,setOpen:i,setPanelIdState:g,transitionStatus:u}),[f,o,p,a,s,A,c,i,g,u])}const qd=d.createContext(void 0);function ef(){const e=d.useContext(qd);if(e===void 0)throw new Error(ot(15));return e}const tf=d.createContext(void 0);function wa(){const e=d.useContext(tf);if(e===void 0)throw new Error(ot(9));return e}let ka=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=ko.startingStyle]="startingStyle",e[e.endingStyle=ko.endingStyle]="endingStyle",e})({}),Dx=(function(e){return e.panelOpen="data-panel-open",e})({});const Fx={[ka.open]:""},Bx={[ka.closed]:""},Mx={open(e){return e?{[Dx.panelOpen]:""}:null}},jx={open(e){return e?Fx:Bx}};let Px=(function(e){return e.index="data-index",e.disabled="data-disabled",e.open="data-open",e})({});const Ea={...jx,index:e=>({[Px.index]:String(e)}),...Nn,value:()=>null},Tx=d.forwardRef(function(t,n){const{className:r,disabled:o=!1,onOpenChange:s,render:i,value:a,style:c,...u}=t,{ref:f,index:h}=fs(),g=Gt(n,f),{disabled:A,handleValueChange:p,state:m,value:x}=Xd(),C=wt(),b=a??C,v=o||A,y=x.indexOf(b)!==-1,w=de((O,_)=>{s?.(O,_),!_.isCanceled&&p(b,O,_)}),I=Rx({open:y,onOpenChange:w,disabled:v}),E=d.useMemo(()=>({open:I.open,disabled:I.disabled,transitionStatus:I.transitionStatus}),[I.open,I.disabled,I.transitionStatus]),S=d.useMemo(()=>({...I,onOpenChange:w,state:E}),[I,E,w]),R=d.useMemo(()=>({...m,hidden:!y&&!I.mounted,index:h,disabled:v,open:y}),[I.mounted,v,h,y,m]),k=wt(),[F,T]=d.useState(),N=F===null?void 0:F??k,j=d.useMemo(()=>({defaultTriggerId:k,open:y,state:R,setTriggerId:T,triggerId:N}),[k,y,R,T,N]),D=Me("div",t,{state:R,ref:g,props:u,stateAttributesMapping:Ea});return l.jsx(qd.Provider,{value:S,children:l.jsx(tf.Provider,{value:j,children:D})})}),Nx=d.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,{state:a}=wa();return Me("h3",t,{state:a,ref:n,props:i,stateAttributesMapping:Ea})}),_x=d.forwardRef(function(t,n){const{disabled:r,className:o,id:s,render:i,nativeButton:a=!0,style:c,...u}=t,{panelId:f,open:h,handleTrigger:g,disabled:A}=ef(),p=r||A,{getButtonProps:m,buttonRef:x}=Yt({disabled:p,focusableWhenDisabled:!0,native:a}),{defaultTriggerId:C,state:b,setTriggerId:v}=wa(),y=s||void 0,w=y??C;return ie(()=>(v(S=>y??(S===null?void 0:S)),()=>{v(S=>S===y?null:S)}),[y,v]),Me("button",t,{state:b,ref:[n,x],props:[{"aria-controls":h?f:void 0,"aria-expanded":h,id:w,onClick:g},u,m],stateAttributesMapping:Mx})}),cr={height:void 0,width:void 0};function Ox(e){const{externalRef:t,hiddenUntilFound:n,id:r,keepMounted:o,mounted:s,onOpenChange:i,open:a,setMounted:c,setOpen:u,transitionStatus:f}=e,h=d.useRef(null),g=d.useRef(null),[A,p]=d.useState(cr),m=d.useRef(cr),x=d.useRef(!1),C=d.useRef(a),b=d.useRef(!1),[v,y]=d.useState(!1),w=d.useRef(null),I=Gt(t,h),E=qe(a),S=Vi(h),R=!a&&!s,k=v?"idle":f,F=a&&(C.current||b.current),T=!a&&s&&g.current==="css-animation"&&A.height===void 0&&A.width===void 0?m.current:A,N=n&&R&&g.current!=="css-animation",j=de((H,P=!0)=>{P&&(m.current=H),p(H)}),D=de(()=>{w.current?.(),w.current=null}),O=de(H=>{D(),w.current=()=>{w.current=null,H()}}),_=de(()=>{a&&s&&g.current==="css-animation"&&(b.current=!0)});ie(()=>{!v||f==="starting"||y(!1)},[v,f]),d.useEffect(()=>()=>{_(),D()},[_,D]),ie(()=>{const H=h.current;if(!H)return;!a&&w.current&&D();const P=Hx(H,F);if(g.current=P,a&&f==="idle"&&C.current&&P==="css-animation"){m.current=On(H);return}if(a&&f==="starting"){const G=x.current;if(x.current=!1,P==="none"){j(On(H)),y(!0);return}if(P==="css-transition"){const Q=Lx(H);if(j(On(H)),!G)return Q;const z=io(H,"transition-duration","0s");return O(z),y(!0),Q}j(On(H));const V=io(H,"animation-name","none");if(!G){V();return}const Y=io(H,"animation-duration","0s");V(),O(Y),y(!0);return}if(!a&&s&&(f==="idle"||f==="starting")){if(C.current=!1,b.current=!1,P==="none"){j(cr,!1),c(!1);return}j(On(H));return}if(f!=="ending")return;if(P==="none"){c(!1);return}const M=On(H);if(!(M.height>0||M.width>0)){c(!1);return}j(M),P==="css-animation"&&io(H,"animation-name","none")()},[s,a,D,j,c,O,F,f]),zt({enabled:a&&s&&k==="idle",open:!0,ref:h,onComplete(){a&&j(cr,!1)}}),d.useEffect(()=>{if(a||!s||k!=="ending"||!h.current)return;const P=new AbortController;let M=-1;function L(){E.current||(c(!1),j(cr,!1))}return M=It.request(()=>{S(L,P.signal)}),()=>{It.cancel(M),P.abort()}},[E,s,a,k,S,j,c]),ie(()=>{const H=h.current;!H||!n||!R||H.setAttribute("hidden","until-found")},[R,n]),d.useEffect(function(){const P=h.current;if(!P)return;function M(L){const G=Ce(Pt,L);i(!0,G),!G.isCanceled&&(x.current=!0,u(!0))}return Fe(P,"beforematch",M)},[i,u]);const B=o||n||s||a;return{height:T.height,props:{...N?{[ka.startingStyle]:""}:void 0,hidden:R,id:r},ref:I,shouldPreventOpenAnimation:F,shouldRender:B,transitionStatus:k,width:T.width}}function On(e){return{height:e.scrollHeight,width:e.scrollWidth}}function Hx(e,t){const n=rt(e).getComputedStyle(e),r=(n.animationName.split(",").map(s=>s.trim()).some(s=>s!==""&&s!=="none")||t)&&Zl(n.animationDuration),o=Zl(n.transitionDuration);return r&&o||o?"css-transition":r?"css-animation":"none"}function Zl(e){return e.split(",").map(t=>t.trim()).some(t=>t!==""&&Number.parseFloat(t)>0)}function io(e,t,n){const r=e.style.getPropertyValue(t),o=e.style.getPropertyPriority(t);return e.style.setProperty(t,n),()=>{if(r===""){e.style.removeProperty(t);return}e.style.setProperty(t,r,o)}}function Lx(e){const t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(o=>{e.style.setProperty(o,"initial","important")});function n(){Object.entries(t).forEach(([o,s])=>{if(s===""){e.style.removeProperty(o);return}e.style.setProperty(o,s)})}const r=It.request(n);return()=>{It.cancel(r),n()}}let Jl=(function(e){return e.accordionPanelHeight="--accordion-panel-height",e.accordionPanelWidth="--accordion-panel-width",e})({});const Kx=d.forwardRef(function(t,n){const{className:r,hiddenUntilFound:o,keepMounted:s,id:i,render:a,style:c,...u}=t,{hiddenUntilFound:f,keepMounted:h}=Xd(),{defaultPanelId:g,mounted:A,onOpenChange:p,open:m,setMounted:x,setOpen:C,setPanelIdState:b,transitionStatus:v}=ef(),y=o??f,w=s??h,I=i||void 0,E=i??g;ie(()=>(b(P=>I??(P===null?void 0:P)),()=>{b(P=>P===I?null:P)}),[I,b]);const{height:S,props:R,ref:k,shouldPreventOpenAnimation:F,shouldRender:T,transitionStatus:N,width:j}=Ox({externalRef:n,hiddenUntilFound:y,id:E,keepMounted:w,mounted:A,onOpenChange:p,open:m,setMounted:x,setOpen:C,transitionStatus:v}),{state:D,triggerId:O}=wa(),_={...D,transitionStatus:N},B=Ip(c,_),H=Me("div",{...t,style:void 0},{state:_,ref:k,props:[R,{"aria-labelledby":O,role:"region",style:{[Jl.accordionPanelHeight]:S===void 0?"auto":`${S}px`,[Jl.accordionPanelWidth]:j===void 0?"auto":`${j}px`}},u,B?{style:B}:void 0,F?{style:{animationName:"none"}}:void 0],stateAttributesMapping:Ea});return T?H:null});function Sa({className:e,...t}){return l.jsx(Sx,{"data-slot":"accordion",className:fe("flex w-full flex-col",e),...t})}function Ra({className:e,...t}){return l.jsx(Tx,{"data-slot":"accordion-item",className:fe("not-last:border-b",e),...t})}function Da({className:e,children:t,...n}){return l.jsx(Nx,{className:"flex",children:l.jsxs(_x,{"data-slot":"accordion-trigger",className:fe("group/accordion-trigger relative flex flex-1 items-start justify-between rounded-lg border border-transparent py-2.5 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:after:border-ring aria-disabled:pointer-events-none aria-disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground",e),...n,children:[t,l.jsx(Tn,{className:"pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden"}),l.jsx(Ti,{className:"pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline"})]})})}function Fa({className:e,children:t,...n}){return l.jsx(Kx,{"data-slot":"accordion-content",className:"overflow-hidden text-sm data-open:animate-accordion-down data-closed:animate-accordion-up",...n,children:l.jsx("div",{className:fe("h-(--accordion-panel-height) pt-0 pb-2.5 data-ending-style:h-0 data-starting-style:h-0 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",e),children:t})})}const nf=d.createContext(void 0);function Wx(){return d.useContext(nf)}const Qx=d.forwardRef(function(t,n){const{className:r,defaultPressed:o=!1,disabled:s=!1,form:i,onPressedChange:a,pressed:c,render:u,type:f,value:h,nativeButton:g=!0,style:A,...p}=t,m=wt(h||void 0),x=Wx(),C=x?.value??[],b=x?void 0:o,v=(s||x?.disabled)??!1,[y,w]=on({controlled:x?m!==void 0&&C.indexOf(m)>-1:c,default:b,name:"Toggle",state:"pressed"}),{getButtonProps:I,buttonRef:E}=Yt({disabled:v,native:g}),S={disabled:v,pressed:y},R=[E,n],k=[{"aria-pressed":y,onClick(N){const j=!y,D=Ce(Pt,N.nativeEvent);a?.(j,D),!D.isCanceled&&(m&&x?.setGroupValue?.(m,j,D),!D.isCanceled&&w(j))}},p,I],F=Me("button",t,{enabled:!x,state:S,ref:R,props:k}),T=d.useMemo(()=>({disabled:v,focusableWhenDisabled:!1}),[v]);return x?l.jsx(Nd,{tag:"button",render:u,className:r,style:A,metadata:T,state:S,refs:R,props:k}):F}),rf="data-composite-item-active",Gx=[];function Yx(e){const{loopFocus:t=!0,orientation:n="both",grid:r,onLoop:o,direction:s,highlightedIndex:i,onHighlightedIndexChange:a,rootRef:c,enableHomeAndEndKeys:u=!1,stopEventPropagation:f,disabledIndices:h,modifierKeys:g=Gx}=e,[A,p]=d.useState(0),m=r!=null,x=d.useRef(null),C=Gt(x,c),b=d.useRef([]),v=d.useRef(!1),y=i??A,w=de((k,F=!1)=>{if((a??p)(k),F){const T=b.current[k];Pl(x.current,T,s,n)}}),I=de(k=>{if(k.size===0||v.current)return;v.current=!0;const F=Array.from(k.keys()),T=F.find(j=>j?.hasAttribute(rf))??null,N=T?k.get(T)?.index??-1:-1;if(N!==-1)w(N);else if(wo(F,y,h)){const j=tn(F,{disabledIndices:h});Ir(F,j)||w(j)}Pl(x.current,T,s,n)});ie(()=>{if(h==null||i!=null||!v.current)return;const k=b.current;if(wo(k,y,h)){const F=tn(k,{disabledIndices:h});Ir(k,F)||w(F)}},[h,i,y,b,w]);const E=de((k,F,T)=>o?o(k,F,T,b):T),S=de(k=>{const F=k.key===ui||k.key===di;if(!rs.has(k.key)||!u&&F||zx(k,g)||!x.current)return;const N=s==="rtl",j=N?li:ci,D=N?ci:li,O=n==="vertical"?ai:j,_=n==="vertical"?ii:D,B=At(k.nativeEvent);if(B!=null&&jl(B)&&!Od(B)){const V=B.selectionStart,Y=B.selectionEnd,Q=B.value;if(V==null||k.shiftKey||V!==Y||k.key!==_&&V<Q.length||k.key!==O&&V>0)return}let H=y;const P=Ao(b,h),M=ei(b,h);r!=null&&(H=r({disabledIndices:h,elementsRef:b,event:k,highlightedIndex:y,loopFocus:t,maxIndex:M,minIndex:P,onLoop:E,orientation:n,rtl:N}));const L=n!=="vertical"&&k.key===j||n!=="horizontal"&&k.key===ai,G=n!=="vertical"&&k.key===D||n!=="horizontal"&&k.key===ii;u&&(k.key===ui?H=P:k.key===di&&(H=M)),H===y&&(L||G)&&(t&&H===M&&L?(H=P,o&&(H=o(k,y,H,b))):t&&H===P&&G?(H=M,o&&(H=o(k,y,H,b))):H=tn(b.current,{startingIndex:H,decrement:G,disabledIndices:h})),H!==y&&!Ir(b.current,H)&&(f&&k.stopPropagation(),(m||F||L||G)&&k.preventDefault(),w(H,!0),queueMicrotask(()=>{b.current[H]?.focus()}))});return{props:{ref:C,onFocus(k){const F=x.current,T=At(k.nativeEvent);!F||T==null||!jl(T)||T.setSelectionRange(0,T.value.length)},onKeyDown:S},highlightedIndex:y,onHighlightedIndexChange:w,elementsRef:b,onMapChange:I,relayKeyboardEvent:S}}function zx(e,t){for(const n of om)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function of(e){const{render:t,className:n,style:r,refs:o=Nt,props:s=Nt,state:i=lt,stateAttributesMapping:a,highlightedIndex:c,onHighlightedIndexChange:u,orientation:f,grid:h,loopFocus:g,onLoop:A,enableHomeAndEndKeys:p,onMapChange:m,stopEventPropagation:x=!0,rootRef:C,disabledIndices:b,modifierKeys:v,highlightItemOnHover:y=!1,tag:w="div",...I}=e,E=is(),{props:S,highlightedIndex:R,onHighlightedIndexChange:k,elementsRef:F,onMapChange:T,relayKeyboardEvent:N}=Yx({grid:h,loopFocus:g,onLoop:A,orientation:f,highlightedIndex:c,onHighlightedIndexChange:u,rootRef:C,stopEventPropagation:x,enableHomeAndEndKeys:p,direction:E,disabledIndices:b,modifierKeys:v}),j=Me(w,e,{state:i,ref:o,props:[S,...s,I],stateAttributesMapping:a}),D=d.useMemo(()=>({highlightedIndex:R,onHighlightedIndexChange:k,highlightItemOnHover:y,relayKeyboardEvent:N}),[R,k,y,N]);return l.jsx(Bp.Provider,{value:D,children:l.jsx(Ur,{elementsRef:F,onMapChange:O=>{m?.(O),T(O)},children:j})})}const Ux=d.createContext(void 0);function Vx(){return d.useContext(Ux)}const Zx=d.forwardRef(function(t,n){const{defaultValue:r,disabled:o=!1,loopFocus:s=!0,onValueChange:i,orientation:a="horizontal",multiple:c=!1,value:u,className:f,render:h,style:g,...A}=t,p=Ia(),m=Vx(),x=u!==void 0||r!==void 0,C=(p?.disabled??!1)||(m?.disabled??!1)||o,[b,v]=on({controlled:u,default:u===void 0?r??Nt:void 0,name:"ToggleGroup",state:"value"}),y=de((R,k,F)=>{let T;c?(T=b.slice(),k?T.push(R):T.splice(b.indexOf(R),1)):T=k?[R]:[],i?.(T,F),!F.isCanceled&&v(T)}),w={disabled:C,multiple:c,orientation:a},I=d.useMemo(()=>({disabled:C,setGroupValue:y,value:b,isValueInitialized:x}),[C,y,b,x]),E={role:"group"},S=Me("div",t,{enabled:!!p,state:w,ref:n,props:[E,A]});return l.jsx(nf.Provider,{value:I,children:p?S:l.jsx(of,{render:h,className:f,style:g,state:w,refs:[n],props:[E,A],loopFocus:s,enableHomeAndEndKeys:!0,orientation:a})})}),Jx=Ci("group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-muted"},size:{default:"h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",sm:"h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2"}},defaultVariants:{variant:"default",size:"default"}}),sf=d.createContext({size:"default",variant:"default",spacing:2,orientation:"horizontal"});function Ba({className:e,variant:t,size:n,spacing:r=2,orientation:o="horizontal",children:s,...i}){return l.jsx(Zx,{"data-slot":"toggle-group","data-variant":t,"data-size":n,"data-spacing":r,"data-orientation":o,style:{"--gap":r},className:fe("group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch",e),...i,children:l.jsx(sf.Provider,{value:{variant:t,size:n,spacing:r,orientation:o},children:s})})}function Br({className:e,children:t,variant:n="default",size:r="default",...o}){const s=d.useContext(sf);return l.jsx(Qx,{"data-slot":"toggle-group-item","data-variant":s.variant||n,"data-size":s.size||r,"data-spacing":s.spacing,className:fe("shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t",Jx({variant:s.variant||n,size:s.size||r}),e),...o,children:t})}function Ma({...e}){return l.jsx(md,{"data-slot":"dialog",...e})}function $x({...e}){return l.jsx(xa,{"data-slot":"dialog-portal",...e})}function Xx({...e}){return l.jsx(Qr,{"data-slot":"dialog-close",...e})}function qx({className:e,...t}){return l.jsx(Ji,{"data-slot":"dialog-overlay",className:fe("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...t})}function ja({className:e,children:t,showCloseButton:n=!0,...r}){return l.jsxs($x,{children:[l.jsx(qx,{}),l.jsxs(Aa,{"data-slot":"dialog-content",className:fe("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...r,children:[t,n&&l.jsxs(Qr,{"data-slot":"dialog-close",render:l.jsx(_e,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[l.jsx(Ni,{}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Ln({className:e,...t}){return l.jsx("div",{"data-slot":"dialog-header",className:fe("flex flex-col gap-2",e),...t})}function eb({className:e,showCloseButton:t=!1,children:n,...r}){return l.jsxs("div",{"data-slot":"dialog-footer",className:fe("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",e),...r,children:[n,t&&l.jsx(Qr,{render:l.jsx(_e,{variant:"outline"}),children:"Close"})]})}function Kn({className:e,...t}){return l.jsx(ba,{"data-slot":"dialog-title",className:fe("cn-font-heading text-base leading-none font-medium",e),...t})}function Pa({className:e,...t}){return l.jsx($i,{"data-slot":"dialog-description",className:fe("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}const af=new Set(["npx","create-opentray","create","set"]),en={comment:"text-muted-foreground italic",keyword:"text-emerald-600 dark:text-emerald-400 font-medium",flag:"text-sky-600 dark:text-sky-400",string:"text-amber-700 dark:text-amber-300 break-all",env:"text-violet-600 dark:text-violet-400",variable:"text-rose-600 dark:text-rose-400"},tb=(e,t)=>e.split(/(\s+|\$[A-Za-z_][A-Za-z0-9_]*)/g).map((r,o)=>{const s=`${t}-u${o}`;return r.startsWith("$")?l.jsx("span",{className:en.variable,children:r},s):af.has(r)?l.jsx("span",{className:en.keyword,children:r},s):r.startsWith("--")?l.jsx("span",{className:en.flag,children:r},s):/^[A-Za-z_][A-Za-z0-9_]*=/.test(r)?l.jsx("span",{className:en.env,children:r},s):l.jsx("span",{children:r},s)}),nb=(e,t)=>e.startsWith("#")?l.jsx("span",{className:en.comment,children:e}):e.split(/('(?:[^']|'\\'')*')/g).map((r,o)=>{const s=`${t}-s${o}`;if(!r.startsWith("'"))return l.jsx("span",{children:tb(r,s)},s);const i=r.slice(1,-1);return af.has(i)?l.jsx("span",{className:en.keyword,children:r},s):i.startsWith("--")?l.jsx("span",{className:en.flag,children:r},s):/^[A-Za-z_][A-Za-z0-9_]*=/.test(i)?l.jsx("span",{className:en.env,children:r},s):l.jsx("span",{className:en.string,children:r},s)}),rb=({content:e})=>l.jsx("pre",{className:"tech-ltr bg-muted max-h-72 overflow-auto rounded-md p-2 text-xs whitespace-pre-wrap break-words",children:e.split(`
2
+ `).map((t,n)=>l.jsx("div",{children:t.length===0?" ":nb(t,n)},n))}),lf=({open:e,subtitle:t,hasEnv:n,share:r=!1,runner:o,onClose:s})=>{const{messages:i}=ps(),[a,c]=d.useState("sh"),[u,f]=d.useState(!1),[h,g]=d.useState(null),[A,p]=d.useState(null),[m,x]=d.useState(null),[C,b]=d.useState(!1),[v,y]=d.useState(!1),w=d.useRef(o);w.current=o,d.useEffect(()=>{f(!1),g(null)},[e]),d.useEffect(()=>{if(!e){p(null),x(null);return}if(n&&!u){p(null),b(!1);return}let R=!1;return b(!0),y(!1),x(null),(async()=>{const k=await w.current({format:a,acknowledgeEnv:u,...h===null?{}:{inlineIcon:h}});if(R)return;if(b(!1),k.status===200){const T=k.data;"content"in T&&T.content!==void 0&&(h===null&&T.iconSharedAs!==void 0&&g(T.iconSharedAs==="embedded"),p({filename:T.filename??"create-opentray.sh",content:T.content,...T.commandLine===void 0?{}:{commandLine:T.commandLine},...T.iconReference===void 0?{}:{iconReference:T.iconReference}}));return}p(null);const F=k.data;"code"in F&&x(`${F.message??F.code}`)})(),()=>{R=!0}},[e,a,u,h,n]);const I=!n||u,E=()=>{if(A===null)return;const R=new Blob([A.content],{type:a==="sh"?"text/x-shellscript":"text/plain"}),k=URL.createObjectURL(R),F=document.createElement("a");F.href=k,F.download=A.filename,F.click(),URL.revokeObjectURL(k)},S=async()=>{A!==null&&(await navigator.clipboard.writeText(A.commandLine??A.content),y(!0))};return l.jsx(Ma,{open:e,onOpenChange:R=>{R||s()},children:l.jsxs(ja,{children:[l.jsxs(Ln,{children:[l.jsx(Kn,{children:r?i.export.shareTitle:i.export.title}),l.jsxs(Pa,{children:[l.jsx("span",{className:"tech-ltr block truncate",children:t}),r&&l.jsx("span",{className:"text-muted-foreground mt-1 block text-xs",children:i.export.shareSubtitle})]})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsxs(Ba,{variant:"outline",size:"sm",spacing:0,value:[a],onValueChange:R=>{const k=R[0];(k==="sh"||k==="ps1")&&c(k)},children:[l.jsx(Br,{value:"sh",children:i.export.scriptSh}),l.jsx(Br,{value:"ps1",children:i.export.scriptPs1})]}),C&&l.jsx("span",{className:"text-muted-foreground self-center text-xs",children:i.export.building})]}),n&&l.jsx("div",{className:"border-warning rounded-md border p-3",children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx(pi,{id:"export-env-ack",checked:u,onCheckedChange:R=>f(R===!0)}),l.jsxs(je,{htmlFor:"export-env-ack",className:"text-xs leading-snug",children:[i.export.envAck,l.jsx("span",{className:"text-muted-foreground block",children:i.export.envAckHint})]})]})}),A?.iconReference!==void 0&&A.iconReference!=="none"&&l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx(pi,{id:"export-inline-icon",checked:h===!0,onCheckedChange:R=>g(R===!0)}),l.jsxs(je,{htmlFor:"export-inline-icon",className:"text-xs leading-snug",children:[i.export.inlineIcon,l.jsx("span",{className:"text-muted-foreground block",children:i.export.inlineIconHint})]})]}),m!==null&&l.jsxs("p",{className:"text-destructive text-xs",role:"alert",children:[i.export.blocked," ",m]}),A!==null&&l.jsx(Sa,{children:l.jsxs(Ra,{value:"content",children:[l.jsx(Da,{className:"text-xs",children:i.export.viewFull}),l.jsx(Fa,{children:l.jsx(rb,{content:A.content})})]})}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsxs(_e,{size:"sm",variant:"outline",disabled:!I||A===null,onClick:()=>{S()},children:[l.jsx(zp,{width:14,height:14,"aria-hidden":!0}),v?i.common.copied:i.export.copyCommand]}),l.jsxs(_e,{size:"sm",disabled:!I||A===null,onClick:E,children:[l.jsx(Vp,{width:14,height:14,"aria-hidden":!0}),i.export.downloadFile]})]})]})})};function ob(e){return gd("alert-dialog",e)}function $l({...e}){return l.jsx(ob,{"data-slot":"alert-dialog",...e})}function sb({...e}){return l.jsx(xa,{"data-slot":"alert-dialog-portal",...e})}function ib({className:e,...t}){return l.jsx(Ji,{"data-slot":"alert-dialog-overlay",className:fe("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...t})}function Xl({className:e,size:t="default",...n}){return l.jsxs(sb,{children:[l.jsx(ib,{}),l.jsx(Aa,{"data-slot":"alert-dialog-content","data-size":t,className:fe("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...n})]})}function ql({className:e,...t}){return l.jsx("div",{"data-slot":"alert-dialog-header",className:fe("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",e),...t})}function ec({className:e,...t}){return l.jsx("div",{"data-slot":"alert-dialog-footer",className:fe("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",e),...t})}function tc({className:e,...t}){return l.jsx(ba,{"data-slot":"alert-dialog-title",className:fe("cn-font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",e),...t})}function nc({className:e,...t}){return l.jsx($i,{"data-slot":"alert-dialog-description",className:fe("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}function rc({className:e,...t}){return l.jsx(_e,{"data-slot":"alert-dialog-action",className:fe(e),...t})}function oc({className:e,variant:t="outline",size:n="default",...r}){return l.jsx(Qr,{"data-slot":"alert-dialog-cancel",className:fe(e),render:l.jsx(_e,{variant:t,size:n}),...r})}const sc={healthy:"statusHealthy","invalid-config":"statusInvalidConfig","incompatible-version":"statusIncompatible","missing-payload":"statusMissingPayload","broken-link":"statusBrokenLink",running:"statusRunning"},ic=e=>({statusHealthy:e.applications.statusHealthy,statusInvalidConfig:e.applications.statusInvalidConfig,statusIncompatible:e.applications.statusIncompatible,statusMissingPayload:e.applications.statusMissingPayload,statusBrokenLink:e.applications.statusBrokenLink,statusRunning:e.applications.statusRunning}),ab=e=>{const t=e.command??{},n=e.window??{};return{command:[t.executable??"",...t.args??[]].filter(Boolean).join(" "),cwd:t.cwd??"",envKeys:Object.keys(t.env??{}),packageManager:typeof e.packageManager=="string"?e.packageManager:"",window:`${n.width??"—"}×${n.height??"—"}`.replace(/—×—/u,"—"),developerMode:e.developerMode===!0}},dn=({label:e,value:t})=>l.jsxs("div",{className:"grid grid-cols-[110px_1fr] gap-x-3 gap-y-1 text-xs",children:[l.jsx("span",{className:"text-muted-foreground",children:e}),l.jsx("span",{className:"tech-ltr break-all",children:t})]}),lb=({app:e,dataUrl:t})=>{const n=(e.appName??e.key).trim().charAt(0).toUpperCase()||"A";return l.jsx("span",{className:"bg-muted text-muted-foreground flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-md text-sm font-semibold","aria-hidden":!0,children:t!==void 0?l.jsx("img",{src:t,alt:"",className:"size-full object-contain"}):n})},cb=()=>{const{messages:e}=ps(),{navigate:t,route:n}=Ud(),[r,o]=d.useState([]),[s,i]=d.useState("loading"),[a,c]=d.useState(null),[u,f]=d.useState(null),[h,g]=d.useState(!1),[A,p]=d.useState(null),[m,x]=d.useState(null),[C,b]=d.useState(null),[v,y]=d.useState({}),[w,I]=d.useState({}),E=d.useCallback(async()=>{i(O=>O==="ready"?"stale":"loading");const D=await dx();D.status===200?(o(D.data),y({}),i("ready"),await Promise.all(D.data.filter(O=>O.hasIcon===!0).map(async O=>{const _=await fx(O.key),B=_.data;_.status===200&&"dataUrl"in B&&B.dataUrl!==void 0&&I(H=>({...H,[O.key]:B.dataUrl}))}))):i("stale")},[]);d.useEffect(()=>{n==="applications"&&E()},[n,E]),d.useEffect(()=>{const D=()=>{E()};return window.addEventListener("create-opentray:apps-changed",D),()=>window.removeEventListener("create-opentray:apps-changed",D)},[E]);const S=async D=>{if(C===D.key){b(null);return}if(b(D.key),v[D.key]===void 0){const O=await Vd(D.key);y(_=>({..._,[D.key]:O.status===200?ab(O.data):"error"}))}},R=async D=>{const O=await mx(D.key),_=O.data;p(O.status===200&&"ok"in _&&_.ok===!0?_.detail:"message"in _?_.message:e.common.error)},k=D=>{p([D.projectPath!==void 0?D.projectPath:"",D.targetRetained===!0?`${e.applications.uninstallRetained} ${D.payloadPath??""}`:"",D.targetDeleted===!0?`${e.applications.uninstallDeleted} ${D.payloadPath??""}`:"",D.manualPinCleanupHint].filter(Boolean).join(`
3
+ `))},F=async(D,O)=>{const _=await px(D.key,{...O,purgeTarget:h});if(_.status===200)k(_.data);else{const B=_.data;if(_.status===409&&B.code==="app_running"&&(B.pids!==void 0||B.pid!==void 0)){const H=B.pids??(B.pid!==void 0?[B.pid]:[]);f({app:D,pids:H});return}p(B.message??e.common.error)}await E()},T=async()=>{const D=a;c(null),D!==null&&await F(D,{stopRunning:!1})},N=async()=>{const D=u;f(null),D!==null&&await F(D.app,{stopRunning:!0})},j=D=>m===null?Promise.resolve({status:400,data:{code:"state_error",message:"no target"}}):gx(m.key,D);return l.jsxs("section",{className:"flex h-full flex-col overflow-hidden","aria-label":e.applications.title,children:[l.jsxs("header",{className:"flex items-center justify-between border-b border-border px-4 py-3",children:[l.jsx("h1",{className:"text-sm font-semibold",children:e.applications.title}),l.jsx(_e,{variant:"ghost",size:"icon-sm","aria-label":e.common.refresh,onClick:()=>{E()},children:l.jsx(gh,{width:16,height:16,"aria-hidden":!0})})]}),l.jsxs("div",{className:"min-h-0 flex-1 overflow-auto p-4",children:[s==="loading"&&l.jsxs("div",{className:"space-y-2","aria-label":e.common.loading,children:[l.jsx(qt,{className:"h-14 w-full"}),l.jsx(qt,{className:"h-14 w-full"}),l.jsx(qt,{className:"h-14 w-full"})]}),s!=="loading"&&r.length===0&&l.jsx("p",{className:"text-muted-foreground text-sm",children:e.applications.emptyHint}),r.length>0&&l.jsx("ul",{className:"space-y-2",children:r.map(D=>{const O=C===D.key,_=v[D.key],B=D.status!=="healthy";return l.jsxs("li",{className:"border-border bg-card text-card-foreground rounded-lg border px-3 py-2",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(lb,{app:D,dataUrl:w[D.key]}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"truncate text-sm font-medium",children:D.appName??D.key}),B&&l.jsxs(ls,{children:[l.jsx(cs,{render:H=>l.jsx(bo,{variant:"destructive",...H,children:ic(e)[sc[D.status]]})}),l.jsx(us,{children:D.error?.message??ic(e)[sc[D.status]]})]}),D.isLink&&l.jsx(bo,{variant:"outline",children:e.applications.linked})]}),l.jsx("div",{className:"tech-ltr text-muted-foreground truncate text-xs",children:D.appId??D.key})]}),l.jsxs(_e,{variant:"ghost",size:"sm","aria-expanded":O,onClick:()=>{S(D)},children:[O?l.jsx(Ti,{width:14,height:14,"aria-hidden":!0}):l.jsx(Tn,{width:14,height:14,"aria-hidden":!0}),e.applications.details]}),l.jsxs(_e,{variant:"outline",size:"sm",onClick:()=>{window.location.hash=`#/add?edit=${encodeURIComponent(D.key)}`},children:[l.jsx(uu,{width:14,height:14,"aria-hidden":!0}),e.applications.edit]}),l.jsxs(_e,{variant:"outline",size:"sm",onClick:()=>{R(D)},children:[l.jsx(cu,{width:14,height:14,"aria-hidden":!0}),e.applications.open]}),l.jsxs(_e,{variant:"outline",size:"sm",onClick:()=>x(D),children:[l.jsx(vh,{width:14,height:14,"aria-hidden":!0}),e.applications.share]}),l.jsxs(_e,{variant:"destructive",size:"sm",onClick:()=>c(D),children:[l.jsx(Eh,{width:14,height:14,"aria-hidden":!0}),e.applications.uninstall]})]}),O&&l.jsxs("div",{className:"border-border mt-2 space-y-1 rounded-md border bg-muted/40 p-3",children:[_===void 0&&l.jsx("p",{className:"text-muted-foreground text-xs",children:e.common.loading}),_==="error"&&l.jsx("p",{className:"text-destructive text-xs",role:"alert",children:e.common.error}),_!==void 0&&_!=="error"&&l.jsxs(l.Fragment,{children:[l.jsx(dn,{label:e.applications.source,value:D.source==="wizard"?e.applications.sourceWizard:e.applications.sourceRegistered}),l.jsx(dn,{label:e.applications.detailsCommand,value:_.command}),l.jsx(dn,{label:e.applications.detailsCwd,value:_.cwd}),l.jsx(dn,{label:e.applications.detailsEnv,value:_.envKeys.length>0?_.envKeys.join(", "):"—"}),l.jsx(dn,{label:e.applications.detailsPm,value:_.packageManager}),l.jsx(dn,{label:e.applications.detailsWindow,value:_.window}),l.jsx(dn,{label:e.applications.detailsDevMode,value:_.developerMode?"ON":"OFF"}),l.jsx(dn,{label:e.applications.detailsProjectDir,value:D.projectDir??D.payloadPath??D.registrationDir})]})]})]},D.key)})}),s==="stale"&&l.jsx("p",{className:"text-warning mt-3 text-xs",role:"status",children:e.common.error}),A!==null&&l.jsx("p",{className:"text-muted-foreground bg-muted mt-3 whitespace-pre-line rounded-md p-3 text-xs",role:"status",children:A})]}),l.jsx($l,{open:a!==null,onOpenChange:D=>{D||c(null)},children:l.jsxs(Xl,{children:[l.jsxs(ql,{children:[l.jsx(tc,{children:e.applications.uninstallTitle}),l.jsxs(nc,{children:[a?.source==="wizard"?e.applications.uninstallWizardDescription:e.applications.uninstallDescription,l.jsx("span",{className:"tech-ltr mt-2 block truncate",children:a?.appId??a?.key}),a?.projectDir!==void 0&&l.jsx("span",{className:"tech-ltr mt-1 block truncate",children:a.projectDir})]})]}),a?.isLink===!0&&l.jsxs("label",{className:"flex items-start gap-2 text-xs",children:[l.jsx(pi,{checked:h,onCheckedChange:D=>g(D===!0)}),l.jsxs("span",{children:[e.applications.uninstallPurge,l.jsx("span",{className:"text-muted-foreground block",children:e.applications.uninstallPurgeHint})]})]}),l.jsx("p",{className:"text-muted-foreground text-xs",children:e.applications.uninstallPinHint}),l.jsxs(ec,{children:[l.jsx(oc,{children:e.common.cancel}),l.jsx(rc,{onClick:()=>{T()},children:e.applications.uninstall})]})]})}),l.jsx($l,{open:u!==null,onOpenChange:D=>{D||f(null)},children:l.jsxs(Xl,{children:[l.jsxs(ql,{children:[l.jsx(tc,{children:e.applications.stopRunningTitle}),l.jsxs(nc,{children:[e.applications.stopRunningDescription,l.jsxs("span",{className:"tech-ltr mt-2 block",children:[e.applications.stopRunningPids,": ",u?.pids.join(", ")]}),l.jsx("span",{className:"tech-ltr mt-1 block truncate",children:u?.app.appId??u?.app.key})]})]}),l.jsx("p",{className:"text-muted-foreground text-xs",children:e.applications.uninstallPinHint}),l.jsxs(ec,{children:[l.jsx(oc,{children:e.common.cancel}),l.jsx(rc,{onClick:()=>{N()},children:e.applications.stopRunningConfirm})]})]})}),l.jsx(lf,{open:m!==null,subtitle:m?.appId??m?.key??"",hasEnv:m?.hasEnv===!0,runner:j,onClose:()=>x(null)})]})},Ta=d.createContext({indent:20,currentItem:void 0,tree:void 0,toggleIconType:"plus-minus"});function cf(){return d.useContext(Ta)}function ub({indent:e=20,tree:t,className:n,toggleIconType:r="chevron",...o}){const s=t&&typeof t.getContainerProps=="function"?t.getContainerProps():{},i={...o,...s},{style:a,...c}=i,u={...a,"--tree-indent":`${e}px`};return l.jsx(Ta.Provider,{value:{indent:e,tree:t,toggleIconType:r},children:l.jsx("div",{"data-slot":"tree",style:u,className:fe("flex flex-col",n),...c})})}function db({item:e,className:t,render:n,children:r,...o}){const s=cf(),{indent:i}=s,a=typeof e.getProps=="function"?e.getProps():{},c={...o,children:r,...a},{style:u,...f}=c,g={"data-slot":"tree-item",style:{...u,"--tree-padding":`${e.getItemMeta().level*i}px`},className:fe("z-10 ps-(--tree-padding) outline-hidden select-none not-last:pb-0.5 focus:z-20 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),"data-focus":typeof e.isFocused=="function"?e.isFocused()||!1:void 0,"data-folder":typeof e.isFolder=="function"?e.isFolder()||!1:void 0,"data-selected":typeof e.isSelected=="function"?e.isSelected()||!1:void 0,"data-drag-target":typeof e.isDragTarget=="function"?e.isDragTarget()||!1:void 0,"data-search-match":typeof e.isMatchingSearch=="function"?e.isMatchingSearch()||!1:void 0,"aria-expanded":e.isExpanded()};return l.jsx(Ta.Provider,{value:{...s,currentItem:e},children:lu({defaultTagName:"button",render:n,props:Mt(g,f)})})}function fb({item:e,children:t,className:n,...r}){const{currentItem:o,toggleIconType:s}=cf(),i=e||o;return i?l.jsxs("span",{"data-slot":"tree-item-label",className:fe("in-focus-visible:ring-ring/50 bg-background hover:bg-accent in-data-[selected=true]:bg-accent in-data-[selected=true]:text-accent-foreground in-data-[drag-target=true]:bg-accent flex items-center gap-1 transition-colors not-in-data-[folder=true]:ps-7 in-focus-visible:ring-[3px] in-data-[search-match=true]:bg-blue-50! [&_svg]:pointer-events-none [&_svg]:shrink-0","rounded-md","py-1.5","px-2","text-sm",n),...r,children:[i.isFolder()&&(s==="plus-minus"?i.isExpanded()?l.jsx(sh,{"aria-hidden":!0,className:"text-muted-foreground size-3.5",stroke:"currentColor",strokeWidth:"1"}):l.jsx(du,{"aria-hidden":!0,className:"text-muted-foreground size-3.5",stroke:"currentColor",strokeWidth:"1"}):l.jsx(Tn,{"aria-hidden":!0,className:"text-muted-foreground size-4 in-aria-[expanded=false]:-rotate-90"})),t||(typeof i.getItemName=="function"?i.getItemName():null)]}):(console.warn("TreeItemLabel: No item provided via props or context"),null)}const ac={};function pb(e){let t=ac[e];if(t)return t;t=ac[e]=[];for(let n=0;n<128;n++){const r=String.fromCharCode(n);t.push(r)}for(let n=0;n<e.length;n++){const r=e.charCodeAt(n);t[r]="%"+("0"+r.toString(16).toUpperCase()).slice(-2)}return t}function tr(e,t){typeof t!="string"&&(t=tr.defaultChars);const n=pb(t);return e.replace(/(%[a-f0-9]{2})+/gi,function(r){let o="";for(let s=0,i=r.length;s<i;s+=3){const a=parseInt(r.slice(s+1,s+3),16);if(a<128){o+=n[a];continue}if((a&224)===192&&s+3<i){const c=parseInt(r.slice(s+4,s+6),16);if((c&192)===128){const u=a<<6&1984|c&63;u<128?o+="��":o+=String.fromCharCode(u),s+=3;continue}}if((a&240)===224&&s+6<i){const c=parseInt(r.slice(s+4,s+6),16),u=parseInt(r.slice(s+7,s+9),16);if((c&192)===128&&(u&192)===128){const f=a<<12&61440|c<<6&4032|u&63;f<2048||f>=55296&&f<=57343?o+="���":o+=String.fromCharCode(f),s+=6;continue}}if((a&248)===240&&s+9<i){const c=parseInt(r.slice(s+4,s+6),16),u=parseInt(r.slice(s+7,s+9),16),f=parseInt(r.slice(s+10,s+12),16);if((c&192)===128&&(u&192)===128&&(f&192)===128){let h=a<<18&1835008|c<<12&258048|u<<6&4032|f&63;h<65536||h>1114111?o+="����":(h-=65536,o+=String.fromCharCode(55296+(h>>10),56320+(h&1023))),s+=9;continue}}o+="�"}return o})}tr.defaultChars=";/?:@&=+$,#";tr.componentChars="";const lc={};function hb(e){let t=lc[e];if(t)return t;t=lc[e]=[];for(let n=0;n<128;n++){const r=String.fromCharCode(n);/^[0-9a-z]$/i.test(r)?t.push(r):t.push("%"+("0"+n.toString(16).toUpperCase()).slice(-2))}for(let n=0;n<e.length;n++)t[e.charCodeAt(n)]=e[n];return t}function Vr(e,t,n){typeof t!="string"&&(n=t,t=Vr.defaultChars),typeof n>"u"&&(n=!0);const r=hb(t);let o="";for(let s=0,i=e.length;s<i;s++){const a=e.charCodeAt(s);if(n&&a===37&&s+2<i&&/^[0-9a-f]{2}$/i.test(e.slice(s+1,s+3))){o+=e.slice(s,s+3),s+=2;continue}if(a<128){o+=r[a];continue}if(a>=55296&&a<=57343){if(a>=55296&&a<=56319&&s+1<i){const c=e.charCodeAt(s+1);if(c>=56320&&c<=57343){o+=encodeURIComponent(e[s]+e[s+1]),s++;continue}}o+="%EF%BF%BD";continue}o+=encodeURIComponent(e[s])}return o}Vr.defaultChars=";/?:@&=+$,-_.!~*'()#";Vr.componentChars="-_.!~*'()";function hi(e){let t="";return t+=e.protocol||"",t+=e.slashes?"//":"",t+=e.auth?e.auth+"@":"",e.hostname&&e.hostname.indexOf(":")!==-1?t+="["+e.hostname+"]":t+=e.hostname||"",t+=e.port?":"+e.port:"",t+=e.pathname||"",t+=e.search||"",t+=e.hash||"",t}function Po(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}const Ab=/^([a-z0-9.+-]+:)/i,gb=/:[0-9]*$/,mb=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,xb=["<",">",'"',"`"," ","\r",`
4
+ `," "],bb=["{","}","|","\\","^","`"].concat(xb),vb=["'"].concat(bb),cc=["%","/","?",";","#"].concat(vb),uc=["/","?","#"],yb=255,dc=/^[+a-z0-9A-Z_-]{0,63}$/,Cb=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,fc={javascript:!0,"javascript:":!0},pc={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Ai(e,t){if(e&&e instanceof Po)return e;const n=new Po;return n.parse(e,t),n}Po.prototype.parse=function(e,t){let n,r,o,s=e;if(s=s.trim(),!t&&e.split("#").length===1){const u=mb.exec(s);if(u)return this.pathname=u[1],u[2]&&(this.search=u[2]),this}let i=Ab.exec(s);if(i&&(i=i[0],n=i.toLowerCase(),this.protocol=i,s=s.substr(i.length)),(t||i||s.match(/^\/\/[^@\/]+@[^@\/]+/))&&(o=s.substr(0,2)==="//",o&&!(i&&fc[i])&&(s=s.substr(2),this.slashes=!0)),!fc[i]&&(o||i&&!pc[i])){let u=-1;for(let p=0;p<uc.length;p++)r=s.indexOf(uc[p]),r!==-1&&(u===-1||r<u)&&(u=r);let f,h;u===-1?h=s.lastIndexOf("@"):h=s.lastIndexOf("@",u),h!==-1&&(f=s.slice(0,h),s=s.slice(h+1),this.auth=f),u=-1;for(let p=0;p<cc.length;p++)r=s.indexOf(cc[p]),r!==-1&&(u===-1||r<u)&&(u=r);u===-1&&(u=s.length),s[u-1]===":"&&u--;const g=s.slice(0,u);s=s.slice(u),this.parseHost(g),this.hostname=this.hostname||"";const A=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!A){const p=this.hostname.split(/\./);for(let m=0,x=p.length;m<x;m++){const C=p[m];if(C&&!C.match(dc)){let b="";for(let v=0,y=C.length;v<y;v++)C.charCodeAt(v)>127?b+="x":b+=C[v];if(!b.match(dc)){const v=p.slice(0,m),y=p.slice(m+1),w=C.match(Cb);w&&(v.push(w[1]),y.unshift(w[2])),y.length&&(s=y.join(".")+s),this.hostname=v.join(".");break}}}}this.hostname.length>yb&&(this.hostname=""),A&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}const a=s.indexOf("#");a!==-1&&(this.hash=s.substr(a),s=s.slice(0,a));const c=s.indexOf("?");return c!==-1&&(this.search=s.substr(c),s=s.slice(0,c)),s&&(this.pathname=s),pc[n]&&this.hostname&&!this.pathname&&(this.pathname=""),this};Po.prototype.parseHost=function(e){let t=gb.exec(e);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)};const Ib=Object.freeze(Object.defineProperty({__proto__:null,decode:tr,encode:Vr,format:hi,parse:Ai},Symbol.toStringTag,{value:"Module"})),uf=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,df=/[\0-\x1F\x7F-\x9F]/,wb=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,Na=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B4E\u1B4F\u1B5A-\u1B60\u1B7D-\u1B7F\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDD6E\uDEAD\uDED0\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9\uDFD4\uDFD5\uDFD7\uDFD8]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09\uDFE1]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDD6D-\uDD6F\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD839\uDDFF|\uD83A[\uDD5E\uDD5F]/,ff=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C1\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2429\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E5\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBD2\uFD40-\uFD4F\uFD90\uFD91\uFDC8-\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD803[\uDD8E\uDD8F\uDED1-\uDED8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDC00-\uDCEF\uDCFA-\uDCFC\uDD00-\uDEB3\uDEBA-\uDED0\uDEE0-\uDEF0\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED8\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0-\uDCBB\uDCC0\uDCC1\uDCD0-\uDCD8\uDD00-\uDE57\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF-\uDEF8\uDF00-\uDF92\uDF94-\uDFEF\uDFFA]/,pf=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,kb=Object.freeze(Object.defineProperty({__proto__:null,Any:uf,Cc:df,Cf:wb,P:Na,S:ff,Z:pf},Symbol.toStringTag,{value:"Module"})),Eb=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function Sb(e){return e>=55296&&e<=57343||e>1114111?65533:Eb.get(e)??e}function Rb(e){const t=atob(e),n=t.length&-2,r=new Uint16Array(n/2);for(let o=0,s=0;o<n;o+=2){const i=t.charCodeAt(o),a=t.charCodeAt(o+1);r[s++]=i|a<<8}return r}const Db=Rb("QR08ALkAAgH6AYsDNQR2BO0EPgXZBQEGLAbdBxMISQrvCmQLfQurDKQNLw4fD4YPpA+6D/IPAAAAAAAAAAAAAAAAKhBMEY8TmxUWF2EYLBkxGuAa3RsJHDscWR8YIC8jSCSIJcMl6ie3Ku8rEC0CLjoupS7kLgAIRU1hYmNmZ2xtbm9wcnN0dVQAWgBeAGUAaQBzAHcAfgCBAIQAhwCSAJoAoACsALMAbABpAGcAO4DGAMZAUAA7gCYAJkBjAHUAdABlADuAwQDBQHIiZXZlAAJhAAFpeW0AcgByAGMAO4DCAMJAEGRyAADgNdgE3XIAYQB2AGUAO4DAAMBA8CFoYZFj4SFjcgBhZAAAoFMqAAFncIsAjgBvAG4ABGFmAADgNdg43fAlbHlGdW5jdGlvbgCgYSBpAG4AZwA7gMUAxUAAAWNzpACoAHIAAOA12Jzc6SFnbgCgVCJpAGwAZABlADuAwwDDQG0AbAA7gMQAxEAABGFjZWZvcnN1xQDYANoA7QDxAPYA+QD8AAABY3LJAM8AayNzbGFzaAAAoBYidgHTANUAAKDnKmUAZAAAoAYjeQARZIABY3J0AOAA5QDrAGEidXNlAACgNSLuI291bGxpcwCgLCFhAJJjcgAA4DXYBd1wAGYAAOA12Dnd5SF2ZdhiYwDyAOoAbSJwZXEAAKBOIgAHSE9hY2RlZmhpbG9yc3UXARoBHwE6AVIBVQFiAWQBZgGCAakB6QHtAfIBYwB5ACdkUABZADuAqQCpQIABY3B5ACUBKAE1AfUhdGUGYWmg0iJ0KGFsRGlmZmVyZW50aWFsRAAAoEUhbCJleXMAAKAtIQACYWVpb0EBRAFKAU0B8iFvbgxhZABpAGwAO4DHAMdAcgBjAAhhbiJpbnQAAKAwIm8AdAAKYQABZG5ZAV0BaSJsbGEAuGB0I2VyRG90ALdg8gA5AWkAp2NyImNsZQAAAkRNUFRwAXQBeQF9AW8AdAAAoJkiaSJudXMAAKCWIuwhdXMAoJUiaSJtZXMAAKCXIm8AAAFjc4cBlAFrKndpc2VDb250b3VySW50ZWdyYWwAAKAyImUjQ3VybHkAAAFEUZwBpAFvJXVibGVRdW90ZQAAoB0gdSJvdGUAAKAZIAACbG5wdbABtgHNAdgBbwBuAGWgNyIAoHQqgAFnaXQAvAHBAcUB8iJ1ZW50AKBhIm4AdAAAoC8i7yV1ckludGVncmFsAKAuIgABZnLRAdMBAKACIe8iZHVjdACgECJuLnRlckNsb2Nrd2lzZUNvbnRvdXJJbnRlZ3JhbAAAoDMi7yFzcwCgLypjAHIAAOA12J7ccABDoNMiYQBwAACgTSKABURKU1phY2VmaW9zAAsCEgIVAhgCGwIsAjQCOQI9AnMCfwNvoEUh9CJyYWhkAKARKWMAeQACZGMAeQAFZGMAeQAPZIABZ3JzACECJQIoAuchZXIAoCEgcgAAoKEhaAB2AACg5CoAAWF5MAIzAvIhb24OYRRkbAB0oAciYQCUY3IAAOA12AfdAAFhZkECawIAAWNtRQJnAvIjaXRpY2FsAAJBREdUUAJUAl8CYwJjInV0ZQC0YG8AdAFZAloC2WJiJGxlQWN1dGUA3WJyImF2ZQBgYGkibGRlANxi7yFuZACgxCJmJWVyZW50aWFsRAAAoEYhcAR9AgAAAAAAAIECjgIAABoDZgAA4DXYO91EoagAhQKJAm8AdAAAoNwgcSJ1YWwAAKBQIuIhbGUAA0NETFJVVpkCqAK1Au8C/wIRA28AbgB0AG8AdQByAEkAbgB0AGUAZwByAGEA7ADEAW8AdAKvAgAAAACwAqhgbiNBcnJvdwAAoNMhAAFlb7kC0AJmAHQAgAFBUlQAwQLGAs0CciJyb3cAAKDQIekkZ2h0QXJyb3cAoNQhZQDlACsCbgBnAAABTFLWAugC5SFmdAABQVLcAuECciJyb3cAAKD4J+kkZ2h0QXJyb3cAoPon6SRnaHRBcnJvdwCg+SdpImdodAAAAUFU9gL7AnIicm93AACg0iFlAGUAAKCoInAAQQIGAwAAAAALA3Iicm93AACg0SFvJHduQXJyb3cAAKDVIWUlcnRpY2FsQmFyAACgJSJuAAADQUJMUlRhJAM2AzoDWgNxA3oDciJyb3cAAKGTIUJVLAMwA2EAcgAAoBMpcCNBcnJvdwAAoPUhciJldmUAEWPlIWZ00gJDAwAASwMAAFIDaSVnaHRWZWN0b3IAAKBQKWUkZVZlY3RvcgAAoF4p5SJjdG9yQqC9IWEAcgAAoFYpaSJnaHQA1AFiAwAAaQNlJGVWZWN0b3IAAKBfKeUiY3RvckKgwSFhAHIAAKBXKWUAZQBBoKQiciJyb3cAAKCnIXIAcgBvAPcAtAIAAWN0gwOHA3IAAOA12J/c8iFvaxBhAAhOVGFjZGZnbG1vcHFzdHV4owOlA6kDsAO/A8IDxgPNA9ID8gP9AwEEFAQeBCAEJQRHAEphSAA7gNAA0EBjAHUAdABlADuAyQDJQIABYWl5ALYDuQO+A/Ihb24aYXIAYwA7gMoAykAtZG8AdAAWYXIAAOA12AjdcgBhAHYAZQA7gMgAyEDlIm1lbnQAoAgiAAFhcNYD2QNjAHIAEmF0AHkAUwLhAwAAAADpA20lYWxsU3F1YXJlAACg+yVlJ3J5U21hbGxTcXVhcmUAAKCrJQABZ3D2A/kDbwBuABhhZgAA4DXYPN3zImlsb26VY3UAAAFhaQYEDgRsAFSgdSppImxkZQAAoEIi7CNpYnJpdW0AoMwhAAFjaRgEGwRyAACgMCFtAACgcyphAJdjbQBsADuAywDLQAABaXApBC0E8yF0cwCgAyLvJG5lbnRpYWxFAKBHIYACY2Zpb3MAPQQ/BEMEXQRyBHkAJGRyAADgNdgJ3WwibGVkAFMCTAQAAAAAVARtJWFsbFNxdWFyZQAAoPwlZSdyeVNtYWxsU3F1YXJlAACgqiVwA2UEAABpBAAAAABtBGYAAOA12D3dwSFsbACgACLyI2llcnRyZgCgMSFjAPIAcQQABkpUYWJjZGZnb3JzdIgEiwSOBJMElwSkBKcEqwStBLIE5QTqBGMAeQADZDuAPgA+QO0hbWFkoJMD3GNyImV2ZQAeYYABZWl5AJ0EoASjBOQhaWwiYXIAYwAcYRNkbwB0ACBhcgAA4DXYCt0AoNkicABmAADgNdg+3eUiYXRlcgADRUZHTFNUvwTIBM8E1QTZBOAEcSJ1YWwATKBlIuUhc3MAoNsidSRsbEVxdWFsAACgZyJyI2VhdGVyAACgoirlIXNzAKB3IuwkYW50RXF1YWwAoH4qaSJsZGUAAKBzImMAcgAA4DXYotwAoGsiAARBYWNmaW9zdfkE/QQFBQgFCwUTBSIFKwVSIkRjeQAqZAABY3QBBQQFZQBrAMdiXmDpIXJjJGFyAACgDCFsJWJlcnRTcGFjZQAAoAsh8AEYBQAAGwVmAACgDSHpJXpvbnRhbExpbmUAoAAlAAFjdCYFKAXyABIF8iFvayZhbQBwAEQBMQU5BW8AdwBuAEgAdQBtAPAAAAFxInVhbAAAoE8iAAdFSk9hY2RmZ21ub3N0dVMFVgVZBVwFYwVtBXAFcwV6BZAFtgXFBckFzQVjAHkAFWTsIWlnMmFjAHkAAWRjAHUAdABlADuAzQDNQAABaXlnBWwFcgBjADuAzgDOQBhkbwB0ADBhcgAAoBEhcgBhAHYAZQA7gMwAzEAAoREhYXB/BYsFAAFjZ4MFhQVyACphaSNuYXJ5SQAAoEghbABpAGUA8wD6AvQBlQUAAKUFZaAsIgABZ3KaBZ4F8iFhbACgKyLzI2VjdGlvbgCgwiJpI3NpYmxlAAABQ1SsBbEFbyJtbWEAAKBjIGkibWVzAACgYiCAAWdwdAC8Bb8FwwVvAG4ALmFmAADgNdhA3WEAmWNjAHIAAKAQIWkibGRlAChh6wHSBQAA1QVjAHkABmRsADuAzwDPQIACY2Zvc3UA4QXpBe0F8gX9BQABaXnlBegFcgBjADRhGWRyAADgNdgN3XAAZgAA4DXYQd3jAfcFAAD7BXIAAOA12KXc8iFjeQhk6yFjeQRkgANISmFjZm9zAAwGDwYSBhUGHQYhBiYGYwB5ACVkYwB5AAxk8CFwYZpjAAFleRkGHAbkIWlsNmEaZHIAAOA12A7dcABmAADgNdhC3WMAcgAA4DXYptyABUpUYWNlZmxtb3N0AD0GQAZDBl4GawZkB2gHcAd0B80H2gdjAHkACWQ7gDwAPECAAmNtbnByAEwGTwZSBlUGWwb1IXRlOWHiIWRhm2NnAACg6ifsI2FjZXRyZgCgEiFyAACgniGAAWFleQBkBmcGagbyIW9uPWHkIWlsO2EbZAABZnNvBjQHdAAABUFDREZSVFVWYXKABp4GpAbGBssG3AYDByEHwQIqBwABbnKEBowGZyVsZUJyYWNrZXQAAKDoJ/Ihb3cAoZAhQlKTBpcGYQByAACg5CHpJGdodEFycm93AKDGIWUjaWxpbmcAAKAII28A9QGqBgAAsgZiJWxlQnJhY2tldAAAoOYnbgDUAbcGAAC+BmUkZVZlY3RvcgAAoGEp5SJjdG9yQqDDIWEAcgAAoFkpbCJvb3IAAKAKI2kiZ2h0AAABQVbSBtcGciJyb3cAAKCUIeUiY3RvcgCgTikAAWVy4AbwBmUAAKGjIkFW5gbrBnIicm93AACgpCHlImN0b3IAoFopaSNhbmdsZQBCorIi+wYAAAAA/wZhAHIAAKDPKXEidWFsAACgtCJwAIABRFRWAAoHEQcYB+8kd25WZWN0b3IAoFEpZSRlVmVjdG9yAACgYCnlImN0b3JCoL8hYQByAACgWCnlImN0b3JCoLwhYQByAACgUilpAGcAaAB0AGEAcgByAG8A9wDMAnMAAANFRkdMU1Q/B0cHTgdUB1gHXwfxJXVhbEdyZWF0ZXIAoNoidSRsbEVxdWFsAACgZiJyI2VhdGVyAACgdiLlIXNzAKChKuwkYW50RXF1YWwAoH0qaSJsZGUAAKByInIAAOA12A/dZaDYIuYjdGFycm93AKDaIWkiZG90AD9hgAFucHcAege1B7kHZwAAAkxSbHKCB5QHmwerB+UhZnQAAUFSiAeNB3Iicm93AACg9SfpJGdodEFycm93AKD3J+kkZ2h0QXJyb3cAoPYn5SFmdAABYXLcAqEHaQBnAGgAdABhAHIAcgBvAPcA5wJpAGcAaAB0AGEAcgByAG8A9wDuAmYAAOA12EPdZQByAAABTFK/B8YHZSRmdEFycm93AACgmSHpJGdodEFycm93AKCYIYABY2h0ANMH1QfXB/IAWgYAoLAh8iFva0FhAKBqIgAEYWNlZmlvc3XpB+wH7gf/BwMICQgOCBEIcAAAoAUpeQAcZAABZGzyB/kHaSR1bVNwYWNlAACgXyBsI2ludHJmAACgMyFyAADgNdgQ3e4jdXNQbHVzAKATInAAZgAA4DXYRN1jAPIA/gecY4AESmFjZWZvc3R1ACEIJAgoCDUIgQiFCDsKQApHCmMAeQAKZGMidXRlAENhgAFhZXkALggxCDQI8iFvbkdh5CFpbEVhHWSAAWdzdwA7CGEIfQjhInRpdmWAAU1UVgBECEwIWQhlJWRpdW1TcGFjZQAAoAsgaABpAAABY25SCFMIawBTAHAAYQBjAOUASwhlAHIAeQBUAGgAaQDuAFQI9CFlZAABR0xnCHUIcgBlAGEAdABlAHIARwByAGUAYQB0AGUA8gDrBGUAcwBzAEwAZQBzAPMA2wdMImluZQAKYHIAAOA12BHdAAJCbnB0jAiRCJkInAhyImVhawAAoGAgwiZyZWFraW5nU3BhY2WgYGYAAKAVIUOq7CqzCMIIzQgAAOcIGwkAAAAAAAAtCQAAbwkAAIcJAACdCcAJGQoAADQKAAFvdbYIvAjuI2dydWVudACgYiJwIkNhcAAAoG0ibyh1YmxlVmVydGljYWxCYXIAAKAmIoABbHF4ANII1wjhCOUibWVudACgCSL1IWFsVKBgImkibGRlAADgQiI4A2kic3RzAACgBCJyI2VhdGVyAACjbyJFRkdMU1T1CPoIAgkJCQ0JFQlxInVhbAAAoHEidSRsbEVxdWFsAADgZyI4A3IjZWF0ZXIAAOBrIjgD5SFzcwCgeSLsJGFudEVxdWFsAOB+KjgDaSJsZGUAAKB1IvUhbXBEASAJJwnvI3duSHVtcADgTiI4A3EidWFsAADgTyI4A2UAAAFmczEJRgn0JFRyaWFuZ2xlQqLqIj0JAAAAAEIJYQByAADgzyk4A3EidWFsAACg7CJzAICibiJFR0xTVABRCVYJXAlhCWkJcSJ1YWwAAKBwInIjZWF0ZXIAAKB4IuUhc3MA4GoiOAPsJGFudEVxdWFsAOB9KjgDaSJsZGUAAKB0IuUic3RlZAABR0x1CX8J8iZlYXRlckdyZWF0ZXIA4KIqOAPlI3NzTGVzcwDgoSo4A/IjZWNlZGVzAKGAIkVTjwmVCXEidWFsAADgryo4A+wkYW50RXF1YWwAoOAiAAFlaaAJqQl2JmVyc2VFbGVtZW50AACgDCLnJWh0VHJpYW5nbGVCousitgkAAAAAuwlhAHIAAODQKTgDcSJ1YWwAAKDtIgABcXXDCeAJdSNhcmVTdQAAAWJwywnVCfMhZXRF4I8iOANxInVhbAAAoOIi5SJyc2V0ReCQIjgDcSJ1YWwAAKDjIoABYmNwAOYJ8AkNCvMhZXRF4IIi0iBxInVhbAAAoIgi4yJlZWRzgKGBIkVTVAD6CQAKBwpxInVhbAAA4LAqOAPsJGFudEVxdWFsAKDhImkibGRlAADgfyI4A+UicnNldEXggyLSIHEidWFsAACgiSJpImxkZQCAoUEiRUZUACIKJwouCnEidWFsAACgRCJ1JGxsRXF1YWwAAKBHImkibGRlAACgSSJlJXJ0aWNhbEJhcgAAoCQiYwByAADgNdip3GkAbABkAGUAO4DRANFAnWMAB0VhY2RmZ21vcHJzdHV2XgphCmgKcgp2CnoKgQqRCpYKqwqtCrsKyArNCuwhaWdSYWMAdQB0AGUAO4DTANNAAAFpeWwKcQpyAGMAO4DUANRAHmRiImxhYwBQYXIAAOA12BLdcgBhAHYAZQA7gNIA0kCAAWFlaQCHCooKjQpjAHIATGFnAGEAqWNjInJvbgCfY3AAZgAA4DXYRt3lI25DdXJseQABRFGeCqYKbyV1YmxlUXVvdGUAAKAcIHUib3RlAACgGCAAoFQqAAFjbLEKtQpyAADgNdiq3GEAcwBoADuA2ADYQGkAbAHACsUKZABlADuA1QDVQGUAcwAAoDcqbQBsADuA1gDWQGUAcgAAAUJQ0wrmCgABYXLXCtoKcgAAoD4gYQBjAAABZWvgCuIKAKDeI2UAdAAAoLQjYSVyZW50aGVzaXMAAKDcI4AEYWNmaGlsb3JzAP0KAwsFCwkLCwsMCxELIwtaC3IjdGlhbEQAAKACInkAH2RyAADgNdgT3WkApmOgY/Ujc01pbnVzsWAAAWlwFQsgC24AYwBhAHIAZQBwAGwAYQBuAOUACgVmAACgGSGAobsqZWlvACoLRQtJC+MiZWRlc4CheiJFU1QANAs5C0ALcSJ1YWwAAKCvKuwkYW50RXF1YWwAoHwiaSJsZGUAAKB+Im0AZQAAoDMgAAFkcE0LUQv1IWN0AKAPIm8jcnRpb24AYaA3ImwAAKAdIgABY2leC2ILcgAA4DXYq9yoYwACVWZvc2oLbwtzC3cLTwBUADuAIgAiQHIAAOA12BTdcABmAACgGiFjAHIAAOA12KzcAAZCRWFjZWZoaW9yc3WPC5MLlwupC7YL2AvbC90LhQyTDJoMowzhIXJyAKAQKUcAO4CuAK5AgAFjbnIAnQugC6ML9SF0ZVRhZwAAoOsncgB0oKAhbAAAoBYpgAFhZXkArwuyC7UL8iFvblhh5CFpbFZhIGR2oBwhZSJyc2UAAAFFVb8LzwsAAWxxwwvIC+UibWVudACgCyL1JGlsaWJyaXVtAKDLIXAmRXF1aWxpYnJpdW0AAKBvKXIAAKAcIW8AoWPnIWh0AARBQ0RGVFVWYewLCgwQDDIMNwxeDHwM9gIAAW5y8Av4C2clbGVCcmFja2V0AACg6SfyIW93AKGSIUJM/wsDDGEAcgAAoOUhZSRmdEFycm93AACgxCFlI2lsaW5nAACgCSNvAPUBFgwAAB4MYiVsZUJyYWNrZXQAAKDnJ24A1AEjDAAAKgxlJGVWZWN0b3IAAKBdKeUiY3RvckKgwiFhAHIAAKBVKWwib29yAACgCyMAAWVyOwxLDGUAAKGiIkFWQQxGDHIicm93AACgpiHlImN0b3IAoFspaSNhbmdsZQBCorMiVgwAAAAAWgxhAHIAAKDQKXEidWFsAACgtSJwAIABRFRWAGUMbAxzDO8kd25WZWN0b3IAoE8pZSRlVmVjdG9yAACgXCnlImN0b3JCoL4hYQByAACgVCnlImN0b3JCoMAhYQByAACgUykAAXB1iQyMDGYAAKAdIe4kZEltcGxpZXMAoHAp6SRnaHRhcnJvdwCg2yEAAWNongyhDHIAAKAbIQCgsSHsJGVEZWxheWVkAKD0KYAGSE9hY2ZoaW1vcXN0dQC/DMgMzAzQDOIM5gwKDQ0NFA0ZDU8NVA1YDQABQ2PDDMYMyCFjeSlkeQAoZEYiVGN5ACxkYyJ1dGUAWmEAorwqYWVpedgM2wzeDOEM8iFvbmBh5CFpbF5hcgBjAFxhIWRyAADgNdgW3e8hcnQAAkRMUlXvDPYM/QwEDW8kd25BcnJvdwAAoJMhZSRmdEFycm93AACgkCHpJGdodEFycm93AKCSIXAjQXJyb3cAAKCRIechbWGjY+EkbGxDaXJjbGUAoBgicABmAADgNdhK3XICHw0AAAAAIg10AACgGiLhIXJlgKGhJUlTVQAqDTINSg3uJXRlcnNlY3Rpb24AoJMidQAAAWJwNw1ADfMhZXRFoI8icSJ1YWwAAKCRIuUicnNldEWgkCJxInVhbAAAoJIibiJpb24AAKCUImMAcgAA4DXYrtxhAHIAAKDGIgACYmNtcF8Nag2ODZANc6DQImUAdABFoNAicSJ1YWwAAKCGIgABY2huDYkNZSJlZHMAgKF7IkVTVAB4DX0NhA1xInVhbAAAoLAq7CRhbnRFcXVhbACgfSJpImxkZQAAoH8iVABoAGEA9ADHCwCgESIAodEiZXOVDZ8NciJzZXQARaCDInEidWFsAACghyJlAHQAAKDRIoAFSFJTYWNmaGlvcnMAtQ27Db8NyA3ODdsN3w3+DRgOHQ4jDk8AUgBOADuA3gDeQMEhREUAoCIhAAFIY8MNxg1jAHkAC2R5ACZkAAFidcwNzQ0JYKRjgAFhZXkA1A3XDdoN8iFvbmRh5CFpbGJhImRyAADgNdgX3QABZWnjDe4N8gHoDQAA7Q3lImZvcmUAoDQiYQCYYwABY27yDfkNayNTcGFjZQAA4F8gCiDTInBhY2UAoAkg7CFkZYChPCJFRlQABw4MDhMOcSJ1YWwAAKBDInUkbGxFcXVhbAAAoEUiaSJsZGUAAKBIInAAZgAA4DXYS93pI3BsZURvdACg2yAAAWN0Jw4rDnIAAOA12K/c8iFva2Zh4QpFDlYOYA5qDgAAbg5yDgAAAAAAAAAAAAB5DnwOqA6zDgAADg8RDxYPGg8AAWNySA5ODnUAdABlADuA2gDaQHIAb6CfIeMhaXIAoEkpcgDjAVsOAABdDnkADmR2AGUAbGEAAWl5Yw5oDnIAYwA7gNsA20AjZGIibGFjAHBhcgAA4DXYGN1yAGEAdgBlADuA2QDZQOEhY3JqYQABZGl/Dp8OZQByAAABQlCFDpcOAAFhcokOiw5yAF9gYQBjAAABZWuRDpMOAKDfI2UAdAAAoLUjYSVyZW50aGVzaXMAAKDdI28AbgBQoMMi7CF1cwCgjiIAAWdwqw6uDm8AbgByYWYAAOA12EzdAARBREVUYWRwc78O0g7ZDuEOBQPqDvMOBw9yInJvdwDCoZEhyA4AAMwOYQByAACgEilvJHduQXJyb3cAAKDFIW8kd25BcnJvdwAAoJUhcSV1aWxpYnJpdW0AAKBuKWUAZQBBoKUiciJyb3cAAKClIW8AdwBuAGEAcgByAG8A9wAQA2UAcgAAAUxS+Q4AD2UkZnRBcnJvdwAAoJYh6SRnaHRBcnJvdwCglyFpAGyg0gNvAG4ApWPpIW5nbmFjAHIAAOA12LDcaSJsZGUAaGFtAGwAO4DcANxAgAREYmNkZWZvc3YALQ8xDzUPNw89D3IPdg97D4AP4SFzaACgqyJhAHIAAKDrKnkAEmThIXNobKCpIgCg5ioAAWVyQQ9DDwCgwSKAAWJ0eQBJD00Paw9hAHIAAKAWIGmgFiDjIWFsAAJCTFNUWA9cD18PZg9hAHIAAKAjIukhbmV8YGUkcGFyYXRvcgAAoFgnaSJsZGUAAKBAItQkaGluU3BhY2UAoAogcgAA4DXYGd1wAGYAAOA12E3dYwByAADgNdix3GQiYXNoAACgqiKAAmNlZm9zAI4PkQ+VD5kPng/pIXJjdGHkIWdlAKDAInIAAOA12BrdcABmAADgNdhO3WMAcgAA4DXYstwAAmZpb3OqD64Prw+0D3IAAOA12BvdnmNwAGYAAOA12E/dYwByAADgNdiz3IAEQUlVYWNmb3N1AMgPyw/OD9EP2A/gD+QP6Q/uD2MAeQAvZGMAeQAHZGMAeQAuZGMAdQB0AGUAO4DdAN1AAAFpedwP3w9yAGMAdmErZHIAAOA12BzdcABmAADgNdhQ3WMAcgAA4DXYtNxtAGwAeGEABEhhY2RlZm9z/g8BEAUQDRAQEB0QIBAkEGMAeQAWZGMidXRlAHlhAAFheQkQDBDyIW9ufWEXZG8AdAB7YfIBFRAAABwQbwBXAGkAZAB0AOgAVAhhAJZjcgAAoCghcABmAACgJCFjAHIAAOA12LXc4QtCEEkQTRAAAGcQbRByEAAAAAAAAAAAeRCKEJcQ8hD9EAAAGxEhETIROREAAD4RYwB1AHQAZQA7gOEA4UByImV2ZQADYYCiPiJFZGl1eQBWEFkQWxBgEGUQAOA+IjMDAKA/InIAYwA7gOIA4kB0AGUAO4C0ALRAMGRsAGkAZwA7gOYA5kByoGEgAOA12B7dcgBhAHYAZQA7gOAA4EAAAWVwfBCGEAABZnCAEIQQ8yF5bQCgNSHoAIMQaABhALFjAAFhcI0QWwAAAWNskRCTEHIAAWFnAACgPypkApwQAAAAALEQAKInImFkc3ajEKcQqRCuEG4AZAAAoFUqAKBcKmwib3BlAACgWCoAoFoqAKMgImVsbXJzersQvRDAEN0Q5RDtEACgpCllAACgICJzAGQAYaAhImEEzhDQENIQ1BDWENgQ2hDcEACgqCkAoKkpAKCqKQCgqykAoKwpAKCtKQCgrikAoK8pdAB2oB8iYgBkoL4iAKCdKQABcHTpEOwQaAAAoCIixWDhIXJyAKB8IwABZ3D1EPgQbwBuAAVhZgAA4DXYUt0Ao0giRWFlaW9wBxEJEQ0RDxESERQRAKBwKuMhaXIAoG8qAKBKImQAAKBLInMAJ2DyIW94ZaBIIvEADhFpAG4AZwA7gOUA5UCAAWN0eQAmESoRKxFyAADgNdi23CpgbQBwAGWgSCLxAPgBaQBsAGQAZQA7gOMA40BtAGwAO4DkAORAAAFjaUERRxFvAG4AaQBuAPQA6AFuAHQAAKARKgAITmFiY2RlZmlrbG5vcHJzdWQRaBGXEZ8RpxGrEdIR1hErEjASexKKEn0RThNbE3oTbwB0AACg7SoAAWNybBGJEWsAAAJjZXBzdBF4EX0RghHvIW5nAKBMInAjc2lsb24A9mNyImltZQAAoDUgaQBtAGWgPSJxAACgzSJ2AY0RkRFlAGUAAKC9ImUAZABnoAUjZQAAoAUjcgBrAHSgtSPiIXJrAKC2IwABb3mjEaYRbgDnAHcRMWTxIXVvAKAeIIACY21wcnQAtBG5Eb4RwRHFEeEhdXPloDUi5ABwInR5dgAAoLApcwDpAH0RbgBvAPUA6gCAAWFodwDLEcwRzhGyYwCgNiHlIWVuAKBsInIAAOA12B/dZwCAA2Nvc3R1dncA4xHyEQUSEhIhEiYSKRKAAWFpdQDpEesR7xHwAKMFcgBjAACg7yVwAACgwyKAAWRwdAD4EfwRABJvAHQAAKAAKuwhdXMAoAEqaSJtZXMAAKACKnECCxIAAAAADxLjIXVwAKAGKmEAcgAAoAUm8iNpYW5nbGUAAWR1GhIeEu8hd24AoL0lcAAAoLMlcCJsdXMAAKAEKmUA5QBCD+UAkg9hInJvdwAAoA0pgAFha28ANhJoEncSAAFjbjoSZRJrAIABbHN0AEESRxJNEm8jemVuZ2UAAKDrKXEAdQBhAHIA5QBcBPIjaWFuZ2xlgKG0JWRscgBYElwSYBLvIXduAKC+JeUhZnQAoMIlaSJnaHQAAKC4JWsAAKAjJLEBbRIAAHUSsgFxEgAAcxIAoJIlAKCRJTQAAKCTJWMAawAAoIglAAFlb38ShxJx4D0A5SD1IWl2AOBhIuUgdAAAoBAjAAJwdHd4kRKVEpsSnxJmAADgNdhT3XSgpSJvAG0AAKClIvQhaWUAoMgiAAZESFVWYmRobXB0dXayEsES0RLgEvcS+xIKExoTHxMjEygTNxMAAkxSbHK5ErsSvRK/EgCgVyUAoFQlAKBWJQCgUyUAolAlRFVkdckSyxLNEs8SAKBmJQCgaSUAoGQlAKBnJQACTFJsctgS2hLcEt4SAKBdJQCgWiUAoFwlAKBZJQCjUSVITFJobHLrEu0S7xLxEvMS9RIAoGwlAKBjJQCgYCUAoGslAKBiJQCgXyVvAHgAAKDJKQACTFJscgITBBMGEwgTAKBVJQCgUiUAoBAlAKAMJQCiACVEVWR1EhMUExYTGBMAoGUlAKBoJQCgLCUAoDQlaSJudXMAAKCfIuwhdXMAoJ4iaSJtZXMAAKCgIgACTFJsci8TMRMzEzUTAKBbJQCgWCUAoBglAKAUJQCjAiVITFJobHJCE0QTRhNIE0oTTBMAoGolAKBhJQCgXiUAoDwlAKAkJQCgHCUAAWV2UhNVE3YA5QD5AGIAYQByADuApgCmQAACY2Vpb2ITZhNqE24TcgAA4DXYt9xtAGkAAKBPIG0A5aA9IogRbAAAoVwAYmh0E3YTAKDFKfMhdWIAoMgnbAF+E4QTbABloCIgdAAAoCIgcAAAoU4iRWWJE4sTAKCuKvGgTyI8BeEMqRMAAN8TABQDFB8UAAAjFDQUAAAAAIUUAAAAAI0UAAAAANcU4xT3FPsUAACIFQAAlhWAAWNwcgCuE7ET1RP1IXRlB2GAoikiYWJjZHMAuxO/E8QTzhPSE24AZAAAoEQqciJjdXAAAKBJKgABYXXIE8sTcAAAoEsqcAAAoEcqbwB0AACgQCoA4CkiAP4AAWVv2RPcE3QAAKBBIO4ABAUAAmFlaXXlE+8T9RP4E/AB6hMAAO0TcwAAoE0qbwBuAA1hZABpAGwAO4DnAOdAcgBjAAlhcABzAHOgTCptAACgUCpvAHQAC2GAAWRtbgAIFA0UEhRpAGwAO4C4ALhAcCJ0eXYAAKCyKXQAAIGiADtlGBQZFKJAcgBkAG8A9ABiAXIAAOA12CDdgAFjZWkAKBQqFDIUeQBHZGMAawBtoBMn4SFyawCgEyfHY3IAAKPLJUVjZWZtcz8UQRRHFHcUfBSAFACgwykAocYCZWxGFEkUcQAAoFciZQBhAlAUAAAAAGAUciJyb3cAAAFsclYUWhTlIWZ0AKC6IWkiZ2h0AACguyGAAlJTYWNkAGgUaRRrFG8UcxSuYACgyCRzAHQAAKCbIukhcmMAoJoi4SFzaACgnSJuImludAAAoBAqaQBkAACg7yrjIWlyAKDCKfUhYnN1oGMmaQB0AACgYybsApMUmhS2FAAAwxRvAG4AZaA6APGgVCKrAG0CnxQAAAAAoxRhAHSgLABAYAChASJmbKcUqRTuABMNZQAAAW14rhSyFOUhbnQAoAEiZQDzANIB5wG6FAAAwBRkoEUibwB0AACgbSpuAPQAzAGAAWZyeQDIFMsUzhQA4DXYVN1vAOQA1wEAgakAO3MeAdMUcgAAoBchAAFhb9oU3hRyAHIAAKC1IXMAcwAAoBcnAAFjdeYU6hRyAADgNdi43AABYnDuFPIUZaDPKgCg0SploNAqAKDSKuQhb3QAoO8igANkZWxwcnZ3AAYVEBUbFSEVRBVlFYQV4SFycgABbHIMFQ4VAKA4KQCgNSlwAhYVAAAAABkVcgAAoN4iYwAAoN8i4SFycnCgtiEAoD0pgKIqImJjZG9zACsVMBU6FT4VQRVyImNhcAAAoEgqAAFhdTQVNxVwAACgRipwAACgSipvAHQAAKCNInIAAKBFKgDgKiIA/gACYWxydksVURVuFXMVcgByAG2gtyEAoDwpeQCAAWV2dwBYFWUVaRVxAHACXxUAAAAAYxVyAGUA4wAXFXUA4wAZFWUAZQAAoM4iZSJkZ2UAAKDPImUAbgA7gKQApEBlI2Fycm93AAABbHJ7FX8V5SFmdACgtiFpImdodAAAoLchZQDkAG0VAAFjaYsVkRVvAG4AaQBuAPQAkwFuAHQAAKAxImwiY3R5AACgLSOACUFIYWJjZGVmaGlqbG9yc3R1d3oAuBW7Fb8V1RXgFegV+RUKFhUWHxZUFlcWZRbFFtsW7xb7FgUXChdyAPIAtAJhAHIAAKBlKQACZ2xyc8YVyhXOFdAV5yFlcgCgICDlIXRoAKA4IfIA9QxoAHagECAAoKMiawHZFd4VYSJyb3cAAKAPKWEA4wBfAgABYXnkFecV8iFvbg9hNGQAoUYhYW/tFfQVAAFnciEC8RVyAACgyiF0InNlcQAAoHcqgAFnbG0A/xUCFgUWO4CwALBAdABhALRjcCJ0eXYAAKCxKQABaXIOFhIW8yFodACgfykA4DXYId1hAHIAAAFschsWHRYAoMMhAKDCIYACYWVnc3YAKBauAjYWOhY+Fm0AAKHEIm9zLhY0Fm4AZABzoMQi9SFpdACgZiZhIm1tYQDdY2kAbgAAoPIiAKH3AGlvQxZRFmQAZQAAgfcAO29KFksW90BuI3RpbWVzAACgxyJuAPgAUBZjAHkAUmRjAG8CXhYAAAAAYhZyAG4AAKAeI28AcAAAoA0jgAJscHR1dwBuFnEWdRaSFp4W7CFhciRgZgAA4DXYVd0AotkCZW1wc30WhBaJFo0WcQBkoFAibwB0AACgUSJpIm51cwAAoDgi7CF1cwCgFCLxInVhcmUAoKEiYgBsAGUAYgBhAHIAdwBlAGQAZwDlANcAbgCAAWFkaAClFqoWtBZyAHIAbwD3APUMbwB3AG4AYQByAHIAbwB3APMA8xVhI3Jwb29uAAABbHK8FsAWZQBmAPQAHBZpAGcAaAD0AB4WYgHJFs8WawBhAHIAbwD3AJILbwLUFgAAAADYFnIAbgAAoB8jbwBwAACgDCOAAWNvdADhFukW7BYAAXJ55RboFgDgNdi53FVkbAAAoPYp8iFvaxFhAAFkcvMW9xZvAHQAAKDxImkA5qC/JVsSAAFhaP8WAhdyAPIANQNhAPIA1wvhIm5nbGUAoKYpAAFjaQ4XEBd5AF9k5yJyYXJyAKD/JwAJRGFjZGVmZ2xtbm9wcXJzdHV4MRc4F0YXWxcyBF4XaRd5F40XrBe0F78X2RcVGCEYLRg1GEAYAAFEbzUXgRZvAPQA+BUAAWNzPBdCF3UAdABlADuA6QDpQPQhZXIAoG4qAAJhaW95TRdQF1YXWhfyIW9uG2FyAGOgViI7gOoA6kDsIW9uAKBVIk1kbwB0ABdhAAFEcmIXZhdvAHQAAKBSIgDgNdgi3XKhmipuF3QXYQB2AGUAO4DoAOhAZKCWKm8AdAAAoJgqgKGZKmlscwCAF4UXhxfuInRlcnMAoOcjAKATIWSglSpvAHQAAKCXKoABYXBzAJMXlheiF2MAcgATYXQAeQBzogUinxcAAAAAoRdlAHQAAKAFInAAMaADIDMBqRerFwCgBCAAoAUgAAFnc7AXsRdLYXAAAKACIAABZ3C4F7sXbwBuABlhZgAA4DXYVt2AAWFscwDFF8sXzxdyAHOg1SJsAACg4yl1AHMAAKBxKmkAAKG1A2x21RfYF28AbgC1Y/VjAAJjc3V24BfoF/0XEBgAAWlv5BdWF3IAYwAAoFYiaQLuFwAAAADwF+0ADQThIW50AAFnbPUX+Rd0AHIAAKCWKuUhc3MAoJUqgAFhZWkAAxgGGAoYbABzAD1gcwB0AACgXyJ2AESgYSJEAACgeCrwImFyc2wAoOUpAAFEYRkYHRhvAHQAAKBTInIAcgAAoHEpgAFjZGkAJxgqGO0XcgAAoC8hbwD0AIwCAAFhaDEYMhi3YzuA8ADwQAABbXI5GD0YbAA7gOsA60BvAACgrCCAAWNpcABGGEgYSxhsACFgcwD0ACwEAAFlb08YVxhjAHQAYQB0AGkAbwDuABoEbgBlAG4AdABpAGEAbADlADME4Ql1GAAAgRgAAIMYiBgAAAAAoRilGAAAqhgAALsYvhjRGAAA1xgnGWwAbABpAG4AZwBkAG8AdABzAGUA8QBlF3kARGRtImFsZQAAoEAmgAFpbHIAjRiRGJ0Y7CFpZwCgA/tpApcYAAAAAJoYZwAAoAD7aQBnAACgBPsA4DXYI93sIWlnAKAB++whaWcA4GYAagCAAWFsdACvGLIYthh0AACgbSZpAGcAAKAC+24AcwAAoLElbwBmAJJh8AHCGAAAxhhmAADgNdhX3QABYWvJGMwYbADsAGsEdqDUIgCg2SphI3J0aW50AACgDSoAAWFv2hgiGQABY3PeGB8ZsQPnGP0YBRkSGRUZAAAdGbID7xjyGPQY9xj5GAAA+xg7gL0AvUAAoFMhO4C8ALxAAKBVIQCgWSEAoFshswEBGQAAAxkAoFQhAKBWIbQCCxkOGQAAAAAQGTuAvgC+QACgVyEAoFwhNQAAoFghtgEZGQAAGxkAoFohAKBdITgAAKBeIWwAAKBEIHcAbgAAoCIjYwByAADgNdi73IAIRWFiY2RlZmdpamxub3JzdHYARhlKGVoZXhlmGWkZkhmWGZkZnRmgGa0ZxhnLGc8Z4BkjGmygZyIAoIwqgAFjbXAAUBlTGVgZ9SF0ZfVhbQBhAOSgswM6FgCghipyImV2ZQAfYQABaXliGWUZcgBjAB1hM2RvAHQAIWGAoWUibHFzAMYEcBl6GfGhZSLOBAAAdhlsAGEAbgD0AN8EgKF+KmNkbACBGYQZjBljAACgqSpvAHQAb6CAKmyggioAoIQqZeDbIgD+cwAAoJQqcgAA4DXYJN3noGsirATtIWVsAKA3IWMAeQBTZIChdyJFYWoApxmpGasZAKCSKgCgpSoAoKQqAAJFYWVztBm2Gb0ZwhkAoGkicABwoIoq8iFveACgiipxoIgq8aCIKrUZaQBtAACg5yJwAGYAAOA12FjdYQB2AOUAYwIAAWNp0xnWGXIAAKAKIW0AAKFzImVs3BneGQCgjioAoJAqAIM+ADtjZGxxco0E6xn0GfgZ/BkBGgABY2nvGfEZAKCnKnIAAKB6Km8AdAAAoNci0CFhcgCglSl1ImVzdAAAoHwqgAJhZGVscwAKGvQZFhrVBCAa8AEPGgAAFBpwAHIAbwD4AFkZcgAAoHgpcQAAAWxxxAQbGmwAZQBzAPMASRlpAO0A5AQAAWVuJxouGnIjdG5lcXEAAOBpIgD+xQAsGgAFQWFiY2Vma29zeUAaQxpmGmoabRqDGocalhrCGtMacgDyAMwCAAJpbG1yShpOGlAaVBpyAHMA8ABxD2YAvWBpAGwA9AASBQABZHJYGlsaYwB5AEpkAKGUIWN3YBpkGmkAcgAAoEgpAKCtIWEAcgAAoA8h6SFyYyVhgAFhbHIAcxp7Gn8a8iF0c3WgZSZpAHQAAKBlJuwhaXAAoCYg4yFvbgCguSJyAADgNdgl3XMAAAFld4wakRphInJvdwAAoCUpYSJyb3cAAKAmKYACYW1vcHIAnxqjGqcauhq+GnIAcgAAoP8h9CFodACgOyJrAAABbHKsGrMaZSRmdGFycm93AACgqSHpJGdodGFycm93AKCqIWYAAOA12Fnd4iFhcgCgFSCAAWNsdADIGswa0BpyAADgNdi93GEAcwDoAGka8iFvaydhAAFicNca2xr1IWxsAKBDIOghZW4AoBAg4Qr2GgAA/RoAAAgbExsaGwAAIRs7GwAAAAA+G2IbmRuVG6sbAACyG80b0htjAHUAdABlADuA7QDtQAChYyBpeQEbBhtyAGMAO4DuAO5AOGQAAWN4CxsNG3kANWRjAGwAO4ChAKFAAAFmcssCFhsA4DXYJt1yAGEAdgBlADuA7ADsQIChSCFpbm8AJxsyGzYbAAFpbisbLxtuAHQAAKAMKnQAAKAtIuYhaW4AoNwpdABhAACgKSHsIWlnM2GAAWFvcABDG1sbXhuAAWNndABJG0sbWRtyACthgAFlbHAAcQVRG1UbaQBuAOUAyAVhAHIA9AByBWgAMWFmAACgtyJlAGQAtWEAoggiY2ZvdGkbbRt1G3kb4SFyZQCgBSFpAG4AdKAeImkAZQAAoN0pZABvAPQAWxsAoisiY2VscIEbhRuPG5QbYQBsAACguiIAAWdyiRuNG2UAcgDzACMQ4wCCG2EicmhrAACgFyryIW9kAKA8KgACY2dwdJ8boRukG6gbeQBRZG8AbgAvYWYAAOA12FrdYQC5Y3UAZQBzAHQAO4C/AL9AAAFjabUbuRtyAADgNdi+3G4AAKIIIkVkc3bCG8QbyBvQAwCg+SJvAHQAAKD1Inag9CIAoPMiaaBiIOwhZGUpYesB1hsAANkbYwB5AFZkbAA7gO8A70AAA2NmbW9zdeYb7hvyG/Ub+hsFHAABaXnqG+0bcgBjADVhOWRyAADgNdgn3eEhdGg3YnAAZgAA4DXYW93jAf8bAAADHHIAAOA12L/c8iFjeVhk6yFjeVRkAARhY2ZnaGpvcxUcGhwiHCYcKhwtHDAcNRzwIXBhdqC6A/BjAAFleR4cIRzkIWlsN2E6ZHIAAOA12CjdciJlZW4AOGFjAHkARWRjAHkAXGRwAGYAAOA12FzdYwByAADgNdjA3IALQUJFSGFiY2RlZmdoamxtbm9wcnN0dXYAXhxtHHEcdRx5HN8cBx0dHTwd3B3tHfEdAR4EHh0eLB5FHrwewx7hHgkfPR9LH4ABYXJ0AGQcZxxpHHIA8gBvB/IAxQLhIWlsAKAbKeEhcnIAoA4pZ6BmIgCgiyphAHIAAKBiKWMJjRwAAJAcAACVHAAAAAAAAAAAAACZHJwcAACmHKgcrRwAANIc9SF0ZTph7SJwdHl2AKC0KXIAYQDuAFoG4iFkYbtjZwAAoegnZGyhHKMcAKCRKeUAiwYAoIUqdQBvADuAqwCrQHIAgKOQIWJmaGxwc3QAuhy/HMIcxBzHHMoczhxmoOQhcwAAoB8pcwAAoB0p6wCyGnAAAKCrIWwAAKA5KWkAbQAAoHMpbAAAoKIhAKGrKmFl1hzaHGkAbAAAoBkpc6CtKgDgrSoA/oABYWJyAOUc6RztHHIAcgAAoAwpcgBrAACgcicAAWFr8Rz4HGMAAAFla/Yc9xx7YFtgAAFlc/wc/hwAoIspbAAAAWR1Ax0FHQCgjykAoI0pAAJhZXV5Dh0RHRodHB3yIW9uPmEAAWRpFR0YHWkAbAA8YewAowbiAPccO2QAAmNxcnMkHScdLB05HWEAAKA2KXUAbwDyoBwgqhEAAWR1MB00HeghYXIAoGcpcyJoYXIAAKBLKWgAAKCyIQCiZCJmZ3FzRB1FB5Qdnh10AIACYWhscnQATh1WHWUdbB2NHXIicm93AHSgkCFhAOkAzxxhI3Jwb29uAAABZHVeHWId7yF3bgCgvSFwAACgvCHlJGZ0YXJyb3dzAKDHIWkiZ2h0AIABYWhzAHUdex2DHXIicm93APOglCGdBmEAcgBwAG8AbwBuAPMAzgtxAHUAaQBnAGEAcgByAG8A9wBlGugkcmVldGltZXMAoMsi8aFkIk0HAACaHWwAYQBuAPQAXgcAon0qY2Rnc6YdqR2xHbcdYwAAoKgqbwB0AG+gfypyoIEqAKCDKmXg2iIA/nMAAKCTKoACYWRlZ3MAwB3GHcod1h3ZHXAAcAByAG8A+ACmHG8AdAAAoNYicQAAAWdxzx3SHXQA8gBGB2cAdADyAHQcdADyAFMHaQDtAGMHgAFpbHIA4h3mHeod8yFodACgfClvAG8A8gDKBgDgNdgp3UWgdiIAoJEqYQH1Hf4dcgAAAWR1YB35HWygvCEAoGopbABrAACghCVjAHkAWWQAomoiYWNodAweDx4VHhkecgDyAGsdbwByAG4AZQDyAGAW4SFyZACgaylyAGkAAKD6JQABaW8hHiQe5CFvdEBh9SFzdGGgsCPjIWhlAKCwIwACRWFlczMeNR48HkEeAKBoInAAcKCJKvIhb3gAoIkqcaCHKvGghyo0HmkAbQAAoOYiAARhYm5vcHR3elIeXB5fHoUelh6mHqsetB4AAW5yVh5ZHmcAAKDsJ3IAAKD9IXIA6wCwBmcAgAFsbXIAZh52Hnse5SFmdAABYXKIB2weaQBnAGgAdABhAHIAcgBvAPcAkwfhInBzdG8AoPwnaQBnAGgAdABhAHIAcgBvAPcAmgdwI2Fycm93AAABbHKNHpEeZQBmAPQAxhxpImdodAAAoKwhgAFhZmwAnB6fHqIecgAAoIUpAOA12F3ddQBzAACgLSppIm1lcwAAoDQqYQGvHrMecwB0AACgFyLhAIoOZaHKJbkeRhLuIWdlAKDKJWEAcgBsoCgAdAAAoJMpgAJhY2htdADMHs8e1R7bHt0ecgDyAJ0GbwByAG4AZQDyANYWYQByAGSgyyEAoG0pAKAOIHIAaQAAoL8iAANhY2hpcXTrHu8e1QfzHv0eBh/xIXVvAKA5IHIAAOA12MHcbQDloXIi+h4AAPweAKCNKgCgjyoAAWJ19xwBH28AcqAYIACgGiDyIW9rQmEAhDwAO2NkaGlscXJCBhcfxh0gHyQfKB8sHzEfAAFjaRsfHR8AoKYqcgAAoHkqcgBlAOUAkx3tIWVzAKDJIuEhcnIAoHYpdSJlc3QAAKB7KgABUGk1HzkfYQByAACglillocMlAgdfEnIAAAFkdUIfRx9zImhhcgAAoEop6CFhcgCgZikAAWVuTx9WH3IjdG5lcXEAAOBoIgD+xQBUHwAHRGFjZGVmaGlsbm9wc3VuH3Ifoh+rH68ftx+7H74f5h/uH/MfBwj/HwsgxCFvdACgOiIAAmNscHJ5H30fiR+eH3IAO4CvAK9AAAFldIEfgx8AoEImZaAgJ3MAZQAAoCAnc6CmIXQAbwCAoaYhZGx1AJQfmB+cH28AdwDuAHkDZQBmAPQA6gbwAOkO6yFlcgCgriUAAW95ph+qH+0hbWEAoCkqPGThIXNoAKAUIOElc3VyZWRhbmdsZQCgISJyAADgNdgq3W8AAKAnIYABY2RuAMQfyR/bH3IAbwA7gLUAtUBhoiMi0B8AANMf1x9zAPQAKxFpAHIAAKDwKm8AdAA7gLcAt0B1AHMA4qESIh4TAADjH3WgOCIAoCoqYwHqH+0fcAAAoNsq8gB+GnAAbAB1APMACAgAAWRw9x/7H+UhbHMAoKciZgAA4DXYXt0AAWN0AyAHIHIAAOA12MLc8CFvcwCgPiJsobwDECAVIPQiaW1hcACguCJhAPAAEyAADEdMUlZhYmNkZWZnaGlqbG1vcHJzdHV2dzwgRyBmIG0geSCqILgg2iDeIBEhFSEyIUMhTSFQIZwhnyHSIQAiIyKLIrEivyIUIwABZ3RAIEMgAODZIjgD9uBrItIgBwmAAWVsdABNIF8gYiBmAHQAAAFhclMgWCByInJvdwAAoM0h6SRnaHRhcnJvdwCgziEA4NgiOAP24Goi0iBfCekkZ2h0YXJyb3cAoM8hAAFEZHEgdSDhIXNoAKCvIuEhc2gAoK4igAJiY25wdACCIIYgiSCNIKIgbABhAACgByL1IXRlRGFnAADgICLSIACiSSJFaW9wlSCYIJwgniAA4HAqOANkAADgSyI4A3MASWFyAG8A+AAyCnUAcgBhoG4mbADzoG4mmwjzAa8gAACzIHAAO4CgAKBAbQBwAOXgTiI4AyoJgAJhZW91eQDBIMogzSDWINkg8AHGIAAAyCAAoEMqbwBuAEhh5CFpbEZhbgBnAGSgRyJvAHQAAOBtKjgDcAAAoEIqPWThIXNoAKATIACjYCJBYWRxc3jpIO0g+SD+IAIhDCFyAHIAAKDXIXIAAAFocvIg9SBrAACgJClvoJch9wAGD28AdAAA4FAiOAN1AGkA9gC7CAABZWkGIQohYQByAACgKCntAN8I6SFzdPOgBCLlCHIAAOA12CvdAAJFZXN0/wgcISshLiHxoXEiIiEAABMJ8aFxIgAJAAAnIWwAYQBuAPQAEwlpAO0AGQlyoG8iAKBvIoABQWFwADghOyE/IXIA8gBeIHIAcgAAoK4hYQByAACg8ipzogsiSiEAAAAAxwtkoPwiAKD6ImMAeQBaZIADQUVhZGVzdABcIV8hYiFmIWkhkyGWIXIA8gBXIADgZiI4A3IAcgAAoJohcgAAoCUggKFwImZxcwBwIYQhjiF0AAABYXJ1IXohcgByAG8A9wBlIWkAZwBoAHQAYQByAHIAbwD3AD4h8aFwImAhAACKIWwAYQBuAPQAZwlz4H0qOAMAoG4iaQDtAG0JcqBuImkA5aDqIkUJaQDkADoKAAFwdKMhpyFmAADgNdhf3YCBrAA7aW4AriGvIcchrEBuAIChCSJFZHYAtyG6Ib8hAOD5IjgDbwB0AADg9SI4A+EB1gjEIcYhAKD3IgCg9iJpAHagDCLhAagJzyHRIQCg/iIAoP0igAFhb3IA2CHsIfEhcgCAoSYiYXN0AOAh5SHpIWwAbABlAOwAywhsAADg/SrlIADgAiI4A2wiaW50AACgFCrjoYAi9yEAAPohdQDlAJsJY+CvKjgDZaCAIvEAkwkAAkFhaXQHIgoiFyIeInIA8gBsIHIAcgAAoZshY3cRIhQiAOAzKTgDAOCdITgDZyRodGFycm93AACgmyFyAGkA5aDrIr4JgANjaGltcHF1AC8iPCJHIpwhTSJQIloigKGBImNlcgA2Iv0JOSJ1AOUABgoA4DXYw9zvIXJ0bQKdIQAAAABEImEAcgDhAOEhbQBloEEi8aBEIiYKYQDyAMsIcwB1AAABYnBWIlgi5QDUCeUA3wmAAWJjcABgInMieCKAoYQiRWVzAGci7glqIgDgxSo4A2UAdABl4IIi0iBxAPGgiCJoImMAZaCBIvEA/gmAoYUiRWVzAH8iFgqCIgDgxio4A2UAdABl4IMi0iBxAPGgiSKAIgACZ2lscpIilCKaIpwi7AAMCWwAZABlADuA8QDxQOcAWwlpI2FuZ2xlAAABbHKkIqoi5SFmdGWg6iLxAEUJaSJnaHQAZaDrIvEAvgltoL0DAKEjAGVzuCK8InIAbwAAoBYhcAAAoAcggARESGFkZ2lscnMAziLSItYi2iLeIugi7SICIw8j4SFzaACgrSLhIXJyAKAEKXAAAOBNItIg4SFzaACgrCIAAWV04iLlIgDgZSLSIADgPgDSIG4iZmluAACg3imAAUFldADzIvci+iJyAHIAAKACKQDgZCLSIHLgPADSIGkAZQAA4LQi0iAAAUF0BiMKI3IAcgAAoAMp8iFpZQDgtSLSIGkAbQAA4Dwi0iCAAUFhbgAaIx4jKiNyAHIAAKDWIXIAAAFociMjJiNrAACgIylvoJYh9wD/DuUhYXIAoCcpUxJqFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVCMAAF4jaSN/I4IjjSOeI8AUAAAAAKYjwCMAANoj3yMAAO8jHiQvJD8kRCQAAWNzVyNsFHUAdABlADuA8wDzQAABaXlhI2cjcgBjoJoiO4D0APRAPmSAAmFiaW9zAHEjdCN3I3EBeiNzAOgAdhTsIWFjUWF2AACgOCrvIWxkAKC8KewhaWdTYQABY3KFI4kjaQByAACgvykA4DXYLN1vA5QjAAAAAJYjAACcI24A22JhAHYAZQA7gPIA8kAAoMEpAAFibaEjjAphAHIAAKC1KQACYWNpdKwjryO6I70jcgDyAFkUAAFpcrMjtiNyAACgvinvIXNzAKC7KW4A5QDZCgCgwCmAAWFlaQDFI8gjyyNjAHIATWFnAGEAyWOAAWNkbgDRI9Qj1iPyIW9uv2MAoLYpdQDzAHgBcABmAADgNdhg3YABYWVsAOQj5yPrI3IAAKC3KXIAcAAAoLkpdQDzAHwBAKMoImFkaW9zdvkj/CMPJBMkFiQbJHIA8gBeFIChXSplZm0AAyQJJAwkcgBvoDQhZgAAoDQhO4CqAKpAO4C6ALpA5yFvZgCgtiJyAACgVipsIm9wZQAAoFcqAKBbKoABY2xvACMkJSQrJPIACCRhAHMAaAA7gPgA+EBsAACgmCJpAGwBMyQ4JGQAZQA7gPUA9UBlAHMAYaCXInMAAKA2Km0AbAA7gPYA9kDiIWFyAKA9I+EKXiQAAHokAAB8JJQkAACYJKkkAAAAALUkEQsAAPAkAAAAAAQleiUAAIMlcgCAoSUiYXN0AGUkbyQBCwCBtgA7bGokayS2QGwAZQDsABgDaQJ1JAAAAAB4JG0AAKDzKgCg/Sp5AD9kcgCAAmNpbXB0AIUkiCSLJJkSjyRuAHQAJWBvAGQALmBpAGwAAKAwIOUhbmsAoDEgcgAA4DXYLd2AAWltbwCdJKAkpCR2oMYD1WNtAGEA9AD+B24AZQAAoA4m9KHAA64kAAC0JGMjaGZvcmsAAKDUItZjAAFhdbgkxCRuAAABY2u9JMIkawBooA8hAKAOIfYAaRpzAACkKwBhYmNkZW1zdNMkIRPXJNsk4STjJOck6yTjIWlyAKAjKmkAcgAAoCIqAAFvdYsW3yQAoCUqAKByKm4AO4CxALFAaQBtAACgJip3AG8AAKAnKoABaXB1APUk+iT+JO4idGludACgFSpmAADgNdhh3W4AZAA7gKMAo0CApHoiRWFjZWlub3N1ABMlFSUYJRslTCVRJVklSSV1JQCgsypwAACgtyp1AOUAPwtjoK8qgKJ6ImFjZW5zACclLSU0JTYlSSVwAHAAcgBvAPgAFyV1AHIAbAB5AGUA8QA/C/EAOAuAAWFlcwA8JUElRSXwInByb3gAoLkqcQBxAACgtSppAG0AAKDoImkA7QBEC20AZQDzoDIgIguAAUVhcwBDJVclRSXwAEAlgAFkZnAATwtfJXElgAFhbHMAZSVpJW0l7CFhcgCgLiPpIW5lAKASI/UhcmYAoBMjdKAdIu8AWQvyIWVsAKCwIgABY2l9JYElcgAA4DXYxdzIY24iY3NwAACgCCAAA2Zpb3BzdZElKxuVJZolnyWkJXIAAOA12C7dcABmAADgNdhi3XIiaW1lAACgVyBjAHIAAOA12MbcgAFhZW8AqiW6JcAldAAAAWVpryW2JXIAbgBpAG8AbgDzABkFbgB0AACgFipzAHQAZaA/APEACRj0AG0LgApBQkhhYmNkZWZoaWxtbm9wcnN0dXgA4yXyJfYl+iVpJpAmpia9JtUm5ib4JlonaCdxJ3UnnietJ7EnyCfiJ+cngAFhcnQA6SXsJe4lcgDyAJkM8gD6AuEhaWwAoBwpYQByAPIA3BVhAHIAAKBkKYADY2RlbnFydAAGJhAmEyYYJiYmKyZaJgABZXUKJg0mAOA9IjEDdABlAFVhaQDjACAN7SJwdHl2AKCzKWcAgKHpJ2RlbAAgJiImJCYAoJIpAKClKeUA9wt1AG8AO4C7ALtAcgAApZIhYWJjZmhscHN0dz0mQCZFJkcmSiZMJk4mUSZVJlgmcAAAoHUpZqDlIXMAAKAgKQCgMylzAACgHinrALka8ACVHmwAAKBFKWkAbQAAoHQpbAAAoKMhAKCdIQABYWleJmImaQBsAACgGilvAG6gNiJhAGwA8wB2C4ABYWJyAG8mciZ2JnIA8gAvEnIAawAAoHMnAAFha3omgSZjAAABZWt/JoAmfWBdYAABZXOFJocmAKCMKWwAAAFkdYwmjiYAoI4pAKCQKQACYWV1eZcmmiajJqUm8iFvbllhAAFkaZ4moSZpAGwAV2HsAA8M4gCAJkBkAAJjbHFzrSawJrUmuiZhAACgNylkImhhcgAAoGkpdQBvAPKgHSCjAWgAAKCzIYABYWNnAMMm0iaUC2wAgKEcIWlwcwDLJs4migxuAOUAoAxhAHIA9ADaC3QAAKCtJYABaWxyANsm3ybjJvMhaHQAoH0pbwBvAPIANgwA4DXYL90AAWFv6ib1JnIAAAFkde8m8SYAoMEhbKDAIQCgbCl2oMED8WOAAWducwD+Jk4nUCdoAHQAAANhaGxyc3QKJxInISc1Jz0nRydyInJvdwB0oJIhYQDpAFYmYSNycG9vbgAAAWR1GiceJ28AdwDuAPAmcAAAoMAh5SFmdAABYWgnJy0ncgByAG8AdwDzAAkMYQByAHAAbwBvAG4A8wATBGklZ2h0YXJyb3dzAACgySFxAHUAaQBnAGEAcgByAG8A9wBZJugkcmVldGltZXMAoMwiZwDaYmkAbgBnAGQAbwB0AHMAZQDxABwYgAFhaG0AYCdjJ2YncgDyAAkMYQDyABMEAKAPIG8idXN0AGGgsSPjIWhlAKCxI+0haWQAoO4qAAJhYnB0fCeGJ4knmScAAW5ygCeDJ2cAAKDtJ3IAAKD+IXIA6wAcDIABYWZsAI8nkieVJ3IAAKCGKQDgNdhj3XUAcwAAoC4qaSJtZXMAAKA1KgABYXCiJ6gncgBnoCkAdAAAoJQp7yJsaW50AKASKmEAcgDyADwnAAJhY2hxuCe8J6EMwCfxIXVvAKA6IHIAAOA12MfcAAFidYAmxCdvAPKgGSCoAYABaGlyAM4n0ifWJ3IAZQDlAE0n7SFlcwCgyiJpAIChuSVlZmwAXAxjEt4n9CFyaQCgzinsInVoYXIAoGgpAKAeIWENBSgJKA0oSyhVKIYoAACLKLAoAAAAAOMo5ygAABApJCkxKW0pcSmHKaYpAACYKgAAAACxKmMidXRlAFthcQB1AO8ABR+ApHsiRWFjZWlucHN5ABwoHignKCooLygyKEEoRihJKACgtCrwASMoAAAlKACguCpvAG4AYWF1AOUAgw1koLAqaQBsAF9hcgBjAF1hgAFFYXMAOCg6KD0oAKC2KnAAAKC6KmkAbQAAoOki7yJsaW50AKATKmkA7QCIDUFkbwB0AGKixSKRFgAAAABTKACgZiqAA0FhY21zdHgAYChkKG8ocyh1KHkogihyAHIAAKDYIXIAAAFocmkoayjrAJAab6CYIfcAzAd0ADuApwCnQGkAO2D3IWFyAKApKW0AAAFpbn4ozQBuAHUA8wDOAHQAAKA2J3IA7+A12DDdIxkAAmFjb3mRKJUonSisKHIAcAAAoG8mAAFoeZkonChjAHkASWRIZHIAdABtAqUoAAAAAKgoaQDkAFsPYQByAGEA7ABsJDuArQCtQAABZ22zKLsobQBhAAChwwNmdroouijCY4CjPCJkZWdsbnByAMgozCjPKNMo1yjaKN4obwB0AACgairxoEMiCw5FoJ4qAKCgKkWgnSoAoJ8qZQAAoEYi7CF1cwCgJCrhIXJyAKByKWEAcgDyAPwMAAJhZWl07Sj8KAEpCCkAAWxz8Sj4KGwAcwBlAHQAbQDpAH8oaABwAACgMyrwImFyc2wAoOQpAAFkbFoPBSllAACgIyNloKoqc6CsKgDgrCoA/oABZmxwABUpGCkfKfQhY3lMZGKgLwBhoMQpcgAAoD8jZgAA4DXYZN1hAAABZHIoKRcDZQBzAHWgYCZpAHQAAKBgJoABY3N1ADYpRilhKQABYXU6KUApcABzoJMiAOCTIgD+cABzoJQiAOCUIgD+dQAAAWJwSylWKQChjyJlcz4NUCllAHQAZaCPIvEAPw0AoZAiZXNIDVspZQB0AGWgkCLxAEkNAKGhJWFmZilbBHIAZQFrKVwEAKChJWEAcgDyAAMNAAJjZW10dyl7KX8pgilyAADgNdjI3HQAbQDuAM4AaQDsAAYpYQByAOYAVw0AAWFyiimOKXIA5qAGJhESAAFhbpIpoylpImdodAAAAWVwmSmgKXAAcwBpAGwAbwDuANkXaADpAKAkcwCvYIACYmNtbnAArin8KY4NJSooKgCkgiJFZGVtbnByc7wpvinCKcgpzCnUKdgp3CkAoMUqbwB0AACgvSpkoIYibwB0AACgwyr1IWx0AKDBKgABRWXQKdIpAKDLKgCgiiLsIXVzAKC/KuEhcnIAoHkpgAFlaXUA4inxKfQpdAAAoYIiZW7oKewpcQDxoIYivSllAHEA8aCKItEpbQAAoMcqAAFicPgp+ikAoNUqAKDTKmMAgKJ7ImFjZW5zAAcqDSoUKhYqRihwAHAAcgBvAPgAIyh1AHIAbAB5AGUA8QCDDfEAfA2AAWFlcwAcKiIqPShwAHAAcgBvAPgAPChxAPEAOShnAACgaiYApoMiMTIzRWRlaGxtbnBzPCo/KkIqRSpHKlIqWCpjKmcqaypzKncqO4C5ALlAO4CyALJAO4CzALNAAKDGKgABb3NLKk4qdAAAoL4qdQBiAACg2CpkoIcibwB0AACgxCpzAAABb3VdKmAqbAAAoMknYgAAoNcq4SFycgCgeyn1IWx0AKDCKgABRWVvKnEqAKDMKgCgiyLsIXVzAKDAKoABZWl1AH0qjCqPKnQAAKGDImVugyqHKnEA8aCHIkYqZQBxAPGgiyJwKm0AAKDIKgABYnCTKpUqAKDUKgCg1iqAAUFhbgCdKqEqrCpyAHIAAKDZIXIAAAFocqYqqCrrAJUab6CZIfcAxQf3IWFyAKAqKWwAaQBnADuA3wDfQOELzyrZKtwq6SrsKvEqAAD1KjQrAAAAAAAAAAAAAEwrbCsAAHErvSsAAAAAAADRK3IC1CoAAAAA2CrnIWV0AKAWI8RjcgDrAOUKgAFhZXkA4SrkKucq8iFvbmVh5CFpbGNhQmRvAPQAIg5sInJlYwAAoBUjcgAA4DXYMd0AAmVpa2/7KhIrKCsuK/IBACsAAAkrZQAAATRm6g0EK28AcgDlAOsNYQBzorgDECsAAAAAEit5AG0A0WMAAWNuFislK2sAAAFhcxsrIStwAHAAcgBvAPgAFw5pAG0AAKA8InMA8AD9DQABYXMsKyEr8AAXDnIAbgA7gP4A/kDsATgrOyswG2QA5QBnAmUAcwCAgdcAO2JkAEMrRCtJK9dAYaCgInIAAKAxKgCgMCqAAWVwcwBRK1MraSvhAAkh4qKkIlsrXysAAAAAYytvAHQAAKA2I2kAcgAAoPEqb+A12GXdcgBrAACg2irhAHgociJpbWUAAKA0IIABYWlwAHYreSu3K2QA5QC+DYADYWRlbXBzdACFK6MrmiunK6wrsCuzK24iZ2xlAACitSVkbHFykCuUK5ornCvvIXduAKC/JeUhZnRloMMl8QACBwCgXCJpImdodABloLkl8QBdDG8AdAAAoOwlaSJudXMAAKA6KuwhdXMAoDkqYgAAoM0p6SFtZQCgOyrlInppdW0AoOIjgAFjaHQAwivKK80rAAFyecYrySsA4DXYydxGZGMAeQBbZPIhb2tnYQABaW/UK9creAD0ANERaCJlYWQAAAFsct4r5ytlAGYAdABhAHIAcgBvAPcAXQbpJGdodGFycm93AKCgIQAJQUhhYmNkZmdobG1vcHJzdHV3CiwNLBEsHSwnLDEsQCxLLFIsYix6LIQsjyzLLOgs7Sz/LAotcgDyAAkDYQByAACgYykAAWNyFSwbLHUAdABlADuA+gD6QPIACQ1yAOMBIywAACUseQBeZHYAZQBtYQABaXkrLDAscgBjADuA+wD7QENkgAFhYmgANyw6LD0scgDyANEO7CFhY3FhYQDyAOAOAAFpckQsSCzzIWh0AKB+KQDgNdgy3XIAYQB2AGUAO4D5APlAYQFWLF8scgAAAWxyWixcLACgvyEAoL4hbABrAACggCUAAWN0Zix2LG8CbCwAAAAAcyxyAG4AZaAcI3IAAKAcI28AcAAAoA8jcgBpAACg+CUAAWFsfiyBLGMAcgBrYTuAqACoQAABZ3CILIssbwBuAHNhZgAA4DXYZt0AA2FkaGxzdZksniynLLgsuyzFLHIAcgBvAPcACQ1vAHcAbgBhAHIAcgBvAPcA2A5hI3Jwb29uAAABbHKvLLMsZQBmAPQAWyxpAGcAaAD0AF0sdQDzAKYOaQAAocUDaGzBLMIs0mNvAG4AxWPwI2Fycm93cwCgyCGAAWNpdADRLOEs5CxvAtcsAAAAAN4scgBuAGWgHSNyAACgHSNvAHAAAKAOI24AZwBvYXIAaQAAoPklYwByAADgNdjK3IABZGlyAPMs9yz6LG8AdAAAoPAi7CFkZWlhaQBmoLUlAKC0JQABYW0DLQYtcgDyAMosbAA7gPwA/EDhIm5nbGUAoKcpgAdBQkRhY2RlZmxub3Byc3oAJy0qLTAtNC2bLZ0toS2/LcMtxy3TLdgt3C3gLfwtcgDyABADYQByAHag6CoAoOkqYQBzAOgA/gIAAW5yOC08LechcnQAoJwpgANla25wcnN0AJkpSC1NLVQtXi1iLYItYQBwAHAA4QAaHG8AdABoAGkAbgDnAKEXgAFoaXIAoSmzJFotbwBwAPQAdCVooJUh7wD4JgABaXVmLWotZwBtAOEAuygAAWJwbi14LXMjZXRuZXEAceCKIgD+AODLKgD+cyNldG5lcQBx4IsiAP4A4MwqAP4AAWhyhi2KLWUAdADhABIraSNhbmdsZQAAAWxyki2WLeUhZnQAoLIiaSJnaHQAAKCzInkAMmThIXNoAKCiIoABZWxyAKcttC24LWKiKCKuLQAAAACyLWEAcgAAoLsicQAAoFoi7CFpcACg7iIAAWJ0vC1eD2EA8gBfD3IAAOA12DPddAByAOkAlS1zAHUAAAFicM0t0C0A4IIi0iAA4IMi0iBwAGYAAOA12GfdcgBvAPAAWQt0AHIA6QCaLQABY3XkLegtcgAA4DXYy9wAAWJw7C30LW4AAAFFZXUt8S0A4IoiAP5uAAABRWV/LfktAOCLIgD+6SJnemFnAKCaKYADY2Vmb3BycwANLhAuJS4pLiMuLi40LukhcmN1YQABZGkULiEuAAFiZxguHC5hAHIAAKBfKmUAcaAnIgCgWSLlIXJwAKAYIXIAAOA12DTdcABmAADgNdho3WWgQCJhAHQA6ABqD2MAcgAA4DXYzNzjCuQRUC4AAFQuAABYLmIuAAAAAGMubS5wLnQuAAAAAIguki4AAJouJxIqEnQAcgDpAB0ScgAA4DXYNd0AAUFhWy5eLnIA8gDnAnIA8gCTB75jAAFBYWYuaS5yAPIA4AJyAPIAjAdhAPAAeh5pAHMAAKD7IoABZHB0APgReS6DLgABZmx9LoAuAOA12GnddQDzAP8RaQBtAOUABBIAAUFhiy6OLnIA8gDuAnIA8gCaBwABY3GVLgoScgAA4DXYzdwAAXB0nS6hLmwAdQDzACUScgDpACASAARhY2VmaW9zdbEuvC7ELsguzC7PLtQu2S5jAAABdXm2LrsudABlADuA/QD9QE9kAAFpecAuwy5yAGMAd2FLZG4AO4ClAKVAcgAA4DXYNt1jAHkAV2RwAGYAAOA12GrdYwByAADgNdjO3AABY23dLt8ueQBOZGwAO4D/AP9AAAVhY2RlZmhpb3N38y73Lv8uAi8MLxAvEy8YLx0vIi9jInV0ZQB6YQABYXn7Lv4u8iFvbn5hN2RvAHQAfGEAAWV0Bi8KL3QAcgDmAB8QYQC2Y3IAAOA12DfdYwB5ADZk5yJyYXJyAKDdIXAAZgAA4DXYa91jAHIAAOA12M/cAAFqbiYvKC8AoA0gagAAoAwg");var bt;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.FLAG13=8192]="FLAG13",e[e.BRANCH_LENGTH=8064]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(bt||(bt={}));var Xe;(function(e){e[e.NUM=35]="NUM",e[e.SEMI=59]="SEMI",e[e.EQUALS=61]="EQUALS",e[e.ZERO=48]="ZERO",e[e.NINE=57]="NINE",e[e.LOWER_A=97]="LOWER_A",e[e.LOWER_F=102]="LOWER_F",e[e.LOWER_X=120]="LOWER_X",e[e.LOWER_Z=122]="LOWER_Z",e[e.UPPER_A=65]="UPPER_A",e[e.UPPER_F=70]="UPPER_F",e[e.UPPER_Z=90]="UPPER_Z"})(Xe||(Xe={}));const hc=32;function gi(e){return e>=Xe.ZERO&&e<=Xe.NINE}function Fb(e){return e>=Xe.UPPER_A&&e<=Xe.UPPER_F||e>=Xe.LOWER_A&&e<=Xe.LOWER_F}function Bb(e){return e>=Xe.UPPER_A&&e<=Xe.UPPER_Z||e>=Xe.LOWER_A&&e<=Xe.LOWER_Z||gi(e)}function Mb(e){return e===Xe.EQUALS||Bb(e)}var ut;(function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"})(ut||(ut={}));var An;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(An||(An={}));class jb{decodeTree;emitCodePoint;errors;constructor(t,n,r){this.decodeTree=t,this.emitCodePoint=n,this.errors=r}state=ut.EntityStart;consumed=1;result=0;treeIndex=0;excess=1;decodeMode=An.Strict;runConsumed=0;startEntity(t){this.decodeMode=t,this.state=ut.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1,this.runConsumed=0}write(t,n){switch(this.state){case ut.EntityStart:return t.charCodeAt(n)===Xe.NUM?(this.state=ut.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=ut.NamedEntity,this.stateNamedEntity(t,n));case ut.NumericStart:return this.stateNumericStart(t,n);case ut.NumericDecimal:return this.stateNumericDecimal(t,n);case ut.NumericHex:return this.stateNumericHex(t,n);case ut.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|hc)===Xe.LOWER_X?(this.state=ut.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=ut.NumericDecimal,this.stateNumericDecimal(t,n))}stateNumericHex(t,n){for(;n<t.length;){const r=t.charCodeAt(n);if(gi(r)||Fb(r)){const o=r<=Xe.NINE?r-Xe.ZERO:(r|hc)-Xe.LOWER_A+10;this.result=this.result*16+o,this.consumed++,n++}else return this.emitNumericEntity(r,3)}return-1}stateNumericDecimal(t,n){for(;n<t.length;){const r=t.charCodeAt(n);if(gi(r))this.result=this.result*10+(r-Xe.ZERO),this.consumed++,n++;else return this.emitNumericEntity(r,2)}return-1}emitNumericEntity(t,n){if(this.consumed<=n)return this.errors?.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(t===Xe.SEMI)this.consumed+=1;else if(this.decodeMode===An.Strict)return 0;return this.emitCodePoint(Sb(this.result),this.consumed),this.errors&&(t!==Xe.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(t,n){const{decodeTree:r}=this;let o=r[this.treeIndex],s=(o&bt.VALUE_LENGTH)>>14;for(;n<t.length;){if(s===0&&(o&bt.FLAG13)!==0){const a=(o&bt.BRANCH_LENGTH)>>7;if(this.runConsumed===0){const c=o&bt.JUMP_TABLE;if(t.charCodeAt(n)!==c)return this.result===0?0:this.emitNotTerminatedNamedEntity();n++,this.excess++,this.runConsumed++}for(;this.runConsumed<a;){if(n>=t.length)return-1;const c=this.runConsumed-1,u=r[this.treeIndex+1+(c>>1)],f=c%2===0?u&255:u>>8&255;if(t.charCodeAt(n)!==f)return this.runConsumed=0,this.result===0?0:this.emitNotTerminatedNamedEntity();n++,this.excess++,this.runConsumed++}this.runConsumed=0,this.treeIndex+=1+(a>>1),o=r[this.treeIndex],s=(o&bt.VALUE_LENGTH)>>14}if(n>=t.length)break;const i=t.charCodeAt(n);if(i===Xe.SEMI&&s!==0&&(o&bt.FLAG13)!==0)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);if(this.treeIndex=Tb(r,o,this.treeIndex+Math.max(1,s),i),this.treeIndex<0)return this.result===0||this.decodeMode===An.Attribute&&(s===0||Mb(i))?0:this.emitNotTerminatedNamedEntity();if(o=r[this.treeIndex],s=(o&bt.VALUE_LENGTH)>>14,s!==0){if(i===Xe.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==An.Strict&&(o&bt.FLAG13)===0&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}n++,this.excess++}return-1}emitNotTerminatedNamedEntity(){const{result:t,decodeTree:n}=this,r=(n[t]&bt.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,r,this.consumed),this.errors?.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,n,r){const{decodeTree:o}=this;return this.emitCodePoint(n===1?o[t]&~(bt.VALUE_LENGTH|bt.FLAG13):o[t+1],r),n===3&&this.emitCodePoint(o[t+2],r),r}end(){switch(this.state){case ut.NamedEntity:return this.result!==0&&(this.decodeMode!==An.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case ut.NumericDecimal:return this.emitNumericEntity(0,2);case ut.NumericHex:return this.emitNumericEntity(0,3);case ut.NumericStart:return this.errors?.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case ut.EntityStart:return 0}}}function Pb(e){let t="";const n=new jb(e,r=>t+=String.fromCodePoint(r));return function(o,s){let i=0,a=0;for(;(a=o.indexOf("&",a))>=0;){t+=o.slice(i,a),n.startEntity(s);const u=n.write(o,a+1);if(u<0){i=a+n.end();break}i=a+u,a=u===0?i+1:i}const c=t+o.slice(i);return t="",c}}function Tb(e,t,n,r){const o=(t&bt.BRANCH_LENGTH)>>7,s=t&bt.JUMP_TABLE;if(o===0)return s!==0&&r===s?n:-1;if(s){const u=r-s;return u<0||u>=o?-1:e[n+u]-1}const i=o+1>>1;let a=0,c=o-1;for(;a<=c;){const u=a+c>>>1,f=u>>1,g=e[n+f]>>(u&1)*8&255;if(g<r)a=u+1;else if(g>r)c=u-1;else return e[n+i+u]}return-1}const Nb=Pb(Db);function hf(e){return Nb(e,An.Strict)}var _b=class{src_Any=uf.source;src_Cc=df.source;src_Z=pf.source;src_P=Na.source;src_ZPCc=[this.src_Z,this.src_P,this.src_Cc].join("|");src_ZCc=[this.src_Z,this.src_Cc].join("|");cache={};opts={maxLength:1e4,urlAuth:!1,schema_names:[]};constructor(e={}){this.opts={...this.opts,...e}}set(e={}){return this.opts={...this.opts,...e},this.cache={},this}escapeRE(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}nestedPairRE(e,t,n=4){const r=this.escapeRE(e),o=this.escapeRE(t),s=`(?:(?!${this.src_ZCc}|${r}|${o}).)`;let i=`${r}${s}{0,1000}${o}`;for(let a=2;a<=n;a++)i=`${r}(?:${s}|${i}){0,1000}${o}`;return i}get_text_separators(){return this.cache.text_separators??=/[><\uff5c]/}get_pseudo_letter(){return this.cache.src_pseudo_letter??=new RegExp(`(?:(?!${this.get_text_separators().source}|${this.src_ZPCc})${this.src_Any})`)}get_ipv4_addr(){return this.cache.src_ip4??=new RegExp("(?:(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])[.]){3}(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])")}get_ipv6_addr(){const e="[0-9A-Fa-f]{1,4}",t=`(?:(?:${e}:${e})|${this.get_ipv4_addr().source})`;return this.cache.src_ip6_addr??=new RegExp(`(?:(?:${e}:){6}${t}|::(?:${e}:){5}${t}|(?:${e})?::(?:${e}:){4}${t}|(?:(?:${e}:){0,1}${e})?::(?:${e}:){3}${t}|(?:(?:${e}:){0,2}${e})?::(?:${e}:){2}${t}|(?:(?:${e}:){0,3}${e})?::${e}:${t}|(?:(?:${e}:){0,4}${e})?::${t}|(?:(?:${e}:){0,5}${e})?::${e}|(?:(?:${e}:){0,6}${e})?::)`)}get_ipv6_url_host(){return this.cache.src_ip6_host??=new RegExp(`\\[${this.get_ipv6_addr().source}\\]`)}get_ipv6_mail_host(){return this.cache.src_ipv6_mail_host??=new RegExp(`\\[IPv6:${this.get_ipv6_addr().source}\\]`)}get_auth(){return this.cache.src_auth??=new RegExp(`(?:(?:(?!${this.src_ZCc}|[@/\\[\\]()]).){1,50}@)?`)}get_port(){return this.cache.src_port??=new RegExp("(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?")}get_host_terminator(){return this.cache.src_host_terminator??=new RegExp(`(?=$|${this.get_text_separators().source}|${this.src_ZPCc})(?!${this.opts["---"]?"-(?!--)|":"-|"}_|:\\d|\\.-|\\.(?!$|${this.src_ZPCc}))`)}get_path_terminator(){return this.cache.src_path_terminator??=new RegExp(`${this.src_ZPCc}|${this.get_text_separators().source}`)}get_path(){return this.cache.src_path??=new RegExp(`(?:[/?#](?:${this.nestedPairRE("[","]")}|${this.nestedPairRE("(",")")}|${this.nestedPairRE("{","}")}|\\"(?:(?!${this.src_ZCc}|["]).){1,100}\\"|\\'(?:(?!${this.src_ZCc}|[']).){1,100}\\'|\\'(?=${this.get_pseudo_letter().source}|[-])|\\.{2,20}[:]?[a-zA-Z0-9%/&]|\\.(?!${this.src_ZCc}|[.]|$)|`+(this.opts["---"]?"\\-(?!--(?:[^-]|$))(?:-{0,19})|":"\\-{1,20}|")+`,(?!${this.src_ZCc}|$)|;(?!${this.src_ZCc}|$)|\\!{1,20}(?!${this.src_ZCc}|[!]|$)|\\?(?!${this.src_ZCc}|[?]|$)|`+this.get_path_extra().source+`[\\\\/:%@#&=_~*]|(?!${this.get_path_terminator().source}).){1,${this.opts.maxLength}}|\\/)?`)}get_mail_name(){return this.cache.src_mail_name??=new RegExp("[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9](?:[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9]|[.](?=[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9])){0,63}")}get_xn(){return this.cache.src_xn??=new RegExp("xn--[a-z0-9\\-]{1,59}")}get_tld(){if(this.cache.tld)return this.cache.tld;const e=[...new Set(this.opts.tlds||[])].sort().reverse().join("|");return this.cache.tld=new RegExp(`${e||"$#none#$"}|${this.get_xn().source}`),this.cache.tld}get_domain_root(){return this.cache.src_domain_root??=new RegExp("(?:"+this.get_xn().source+`|${this.get_pseudo_letter().source}{1,63})`)}get_domain(){return this.cache.src_domain??=new RegExp("(?:"+this.get_xn().source+`|(?:${this.get_pseudo_letter().source})|(?:${this.get_pseudo_letter().source}(?:-|${this.get_pseudo_letter().source}){0,61}${this.get_pseudo_letter().source}))`)}get_url_host_port(){return this.cache.url_host_port??=new RegExp("(?:"+this.get_ipv6_url_host().source+`|(?:(?:(?:${this.get_domain().source})\\.){0,10}${this.get_domain().source}))`+this.get_port().source+this.get_host_terminator().source)}get_fuzzy_url_host_port(){return this.cache.fuzzy_url_host_port??=new RegExp("(?:"+(this.opts.fuzzyIP?this.get_ipv4_addr().source+"|":"")+`(?:(?:(?:${this.get_domain().source})\\.){1,10}(?:${this.get_tld().source})))`+this.get_host_terminator().source)}get_mail_host(){return this.cache.src_mail_host??=new RegExp("(?:"+this.get_ipv6_mail_host().source+`|(?:(?:(?:${this.get_domain().source})\\.){0,4}${this.get_domain().source}))`+this.get_host_terminator().source)}get_fuzzy_mail_host(){return this.cache.src_fuzzy_mail_host??=new RegExp("(?:"+this.get_ipv6_mail_host().source+`|(?:(?:(?:${this.get_domain().source})[.]){1,4}${this.get_domain_root().source}))`+this.get_host_terminator().source)}get_path_extra(){return this.cache.src_path_extra??=new RegExp("")}get_fuzzy_mail_host_search(){return this.cache.mail_fuzzy_host_search??=new RegExp(`@${this.get_fuzzy_mail_host().source}`,"ig")}get_fuzzy_link_search(){return this.cache.link_fuzzy_search??=new RegExp(`(^|(?![.:/\\-_@])(?:[$+<=>^\`||]|${this.src_ZPCc}))(?:(?![$+<=>^\`||])${this.get_fuzzy_url_host_port().source}${this.get_path().source})`,"ig")}get_http_validator(){return this.cache.http_validator??=new RegExp("\\/\\/"+(this.opts.urlAuth?this.get_auth().source:"")+this.get_url_host_port().source+this.get_path().source,"iy")}get_relative_proto_validator(){return this.cache.relative_proto_validator??=new RegExp((this.opts.urlAuth?this.get_auth().source:"")+`(?:localhost|${this.get_ipv6_url_host().source}|(?:(?:${this.get_domain().source})[.]){1,10}${this.get_domain_root().source})`+this.get_port().source+this.get_host_terminator().source+this.get_path().source,"iy")}get_mail_name_validator(){return this.cache.mail_name_validator??=new RegExp(`(?:^|${this.get_text_separators().source}|"|\\(|${this.src_ZCc})(${this.get_mail_name().source})$`)}get_mailto_validator(){return this.cache.mailto_validator??=new RegExp(`${this.get_mail_name().source}@${this.get_mail_host().source}`,"iy")}get_schema_names(){return this.cache.schema_names??=new RegExp((this.opts.schema_names||[]).map(e=>this.escapeRE(e)).join("|"))}get_schema_search(){return this.cache.schema_search??=new RegExp(`(^|(?!_)(?:[><|]|${this.src_ZPCc}))(${this.get_schema_names().source})`,"ig")}get_schema_at_start(){return this.cache.schema_at_start??=new RegExp(`^${this.get_schema_search().source}`,"i")}},js={validate:(e,t,n)=>{const r=n.re.get_http_validator();r.lastIndex=t;const o=r.exec(e);return o?o[0].length:0},normalize:(e,t)=>t.normalize(e)},Ob={"http:":js,"https:":js,"ftp:":js,"//":{validate:function(e,t,n){const r=n.re.get_relative_proto_validator();r.lastIndex=t;const o=r.exec(e);return o?t>=3&&e[t-3]===":"||t>=3&&e[t-3]==="/"?0:o[0].length:0},normalize:(e,t)=>t.normalize(e)},"mailto:":{validate:function(e,t,n){const r=n.re.get_mailto_validator();r.lastIndex=t;const o=r.exec(e);return o?o[0].length:0},normalize:(e,t)=>t.normalize(e)}},Hb="a:cdefgilmnoqrstuwxz|b:abdefghijmnorstvwyz|c:acdfghiklmnoruvwxyz|d:ejkmoz|e:cegrstu|f:ijkmor|g:abdefghilmnpqrstuwy|h:kmnrtu|i:delmnoqrst|j:emop|k:eghimnprwyz|l:abcikrstuvy|m:acdeghklmnopqrstuvwxyz|n:acefgilopruz|o:m|p:aefghklmnrstwy|q:a|r:eosuw|s:abcdeghijklmnortuvxyz|t:cdfghjklmnortvwz|u:agksyz|v:aceginu|w:fs|y:et|z:amw",Lb="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф";function Kb(){const e=Lb.split("|");return Hb.split("|").forEach(t=>{const n=t.indexOf(":"),r=t.slice(0,n);for(const o of t.slice(n+1))e.push(r+o)}),e}var Wb={fuzzyLink:!1,fuzzyEmail:!0,fuzzyIP:!1,"---":!1,tlds:Kb(),urlAuth:!1,maxLength:1e4},Ac=class{schema;index;lastIndex;raw;text;url;constructor(e,t,n,r){const o=e.slice(n,r);this.schema=t.toLowerCase(),this.index=n,this.lastIndex=r,this.raw=o,this.text=o,this.url=o}},Qb=class{__opts__;__schemas__;re;constructor(e={}){const{rebuilder:t,...n}=e;this.__opts__={...Wb,...n},this.__schemas__={...Ob},this.re=t||new _b,this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)})}add(e,t=null){if(!t)delete this.__schemas__[e];else{const n={normalize:(r,o)=>o.normalize(r),...t};this.__schemas__[e]=n}return this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}set(e={}){return this.__opts__={...this.__opts__,...e},this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}test(e){if(!e.length)return!1;let t,n;for(n=this.re.get_schema_search(),n.lastIndex=0;(t=n.exec(e))!==null;)if(this.testSchemaAt(e,t[2],n.lastIndex))return!0;if(this.__opts__.fuzzyLink&&this.__schemas__["http:"]&&(n=this.re.get_fuzzy_link_search(),n.lastIndex=0,n.exec(e)!==null))return!0;if(this.__opts__.fuzzyEmail&&this.__schemas__["mailto:"]&&e.indexOf("@")>=0){const r=this.re.get_fuzzy_mail_host_search(),o=this.re.get_mail_name_validator();for(r.lastIndex=0;(t=r.exec(e))!==null;){const s=e.slice(Math.max(0,t.index-65),t.index);if(o.test(s))return!0}}return!1}testSchemaAt(e,t,n){return this.__schemas__[t.toLowerCase()]?this.__schemas__[t.toLowerCase()].validate(e.slice(0,n+this.__opts__.maxLength),n,this):0}match(e){const t=[],n=this.re.get_schema_search();let r,o,s,i,a,c,u=!1,f=!1,h=!1,g=0;if(!e.length)return null;for(n.lastIndex=0,this.__opts__.fuzzyLink&&this.__schemas__["http:"]&&(r=this.re.get_fuzzy_link_search(),r.lastIndex=0),this.__opts__.fuzzyEmail&&this.__schemas__["mailto:"]&&(o=this.re.get_fuzzy_mail_host_search(),o.lastIndex=0,s=this.re.get_mail_name_validator());;){const A=Math.max(g-1,0);if(o&&s&&!h&&(!a||a.index<g))for(o.lastIndex<A&&(o.lastIndex=A);;){const b=o.exec(e);if(!b){h=!0,a=void 0;break}const v=s.exec(e.slice(Math.max(0,b.index-65),b.index));if(v){if(a={schema:"mailto:",index:b.index-v[1].length,lastIndex:b.index+b[0].length},a.index>=g)break;o.lastIndex<A&&(o.lastIndex=A)}}if(r&&!f&&(!i||i.index<g))for(r.lastIndex<A&&(r.lastIndex=A);;){const b=r.exec(e);if(!b){f=!0,i=void 0;break}if(i={schema:"",index:b.index+b[1].length,lastIndex:b.index+b[0].length},i.index>=g)break;r.lastIndex<A&&(r.lastIndex=A)}let p=a;(!p||i&&(i.index<p.index||i.index===p.index&&i.lastIndex>p.lastIndex))&&(p=i);let m;if(!u)for(;;){if(!c){n.lastIndex<A&&(n.lastIndex=A);const y=n.exec(e);if(!y){u=!0;break}c={schema:y[2],index:y.index+y[1].length,lastIndex:y.index+y[0].length}}if(c.index<g){c=void 0;continue}if(p&&c.index>p.index)break;const b=c;c=void 0;const v=this.testSchemaAt(e,b.schema,b.lastIndex);if(v){m={schema:b.schema,index:b.index,lastIndex:b.lastIndex+v};break}}let x=m;if((!x||a&&(a.index<x.index||a.index===x.index&&a.lastIndex>x.lastIndex))&&(x=a),(!x||i&&(i.index<x.index||i.index===x.index&&i.lastIndex>x.lastIndex))&&(x=i),!x)break;x===a?a=void 0:x===i&&(i=void 0);const C=new Ac(e,x.schema,x.index,x.lastIndex);C.schema?this.__schemas__[C.schema].normalize(C,this):this.normalize(C),t.push(C),g=x.lastIndex}return t.length?t:null}matchAtStart(e){if(!e.length)return null;const t=this.re.get_schema_at_start().exec(e);if(!t)return null;const n=this.testSchemaAt(e,t[2],t[0].length);if(!n)return null;const r=new Ac(e,t[2],t.index+t[1].length,t.index+t[0].length+n);return this.__schemas__[r.schema].normalize(r,this),r}tlds(e,t=!1){return e=Array.isArray(e)?e:[e],t?this.__opts__.tlds=this.__opts__.tlds.concat(e):this.__opts__.tlds=e,this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}normalize(e){e.schema||(e.url=`http://${e.url}`),e.schema==="mailto:"&&!/^mailto:/i.test(e.url)&&(e.url=`mailto:${e.url}`)}};const Un=2147483647,Kt=36,_a=1,Mr=26,Gb=38,Yb=700,Af=72,gf=128,mf="-",zb=/^xn--/,Ub=/[^\0-\x7F]/,Vb=/[\x2E\u3002\uFF0E\uFF61]/g,Zb={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Ps=Kt-_a,Wt=Math.floor,Ts=String.fromCharCode;function fn(e){throw new RangeError(Zb[e])}function Jb(e,t){const n=[];let r=e.length;for(;r--;)n[r]=t(e[r]);return n}function xf(e,t){const n=e.split("@");let r="";n.length>1&&(r=n[0]+"@",e=n[1]),e=e.replace(Vb,".");const o=e.split("."),s=Jb(o,t).join(".");return r+s}function bf(e){const t=[];let n=0;const r=e.length;for(;n<r;){const o=e.charCodeAt(n++);if(o>=55296&&o<=56319&&n<r){const s=e.charCodeAt(n++);(s&64512)==56320?t.push(((o&1023)<<10)+(s&1023)+65536):(t.push(o),n--)}else t.push(o)}return t}const $b=e=>String.fromCodePoint(...e),Xb=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:Kt},gc=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},vf=function(e,t,n){let r=0;for(e=n?Wt(e/Yb):e>>1,e+=Wt(e/t);e>Ps*Mr>>1;r+=Kt)e=Wt(e/Ps);return Wt(r+(Ps+1)*e/(e+Gb))},yf=function(e){const t=[],n=e.length;let r=0,o=gf,s=Af,i=e.lastIndexOf(mf);i<0&&(i=0);for(let a=0;a<i;++a)e.charCodeAt(a)>=128&&fn("not-basic"),t.push(e.charCodeAt(a));for(let a=i>0?i+1:0;a<n;){const c=r;for(let f=1,h=Kt;;h+=Kt){a>=n&&fn("invalid-input");const g=Xb(e.charCodeAt(a++));g>=Kt&&fn("invalid-input"),g>Wt((Un-r)/f)&&fn("overflow"),r+=g*f;const A=h<=s?_a:h>=s+Mr?Mr:h-s;if(g<A)break;const p=Kt-A;f>Wt(Un/p)&&fn("overflow"),f*=p}const u=t.length+1;s=vf(r-c,u,c==0),Wt(r/u)>Un-o&&fn("overflow"),o+=Wt(r/u),r%=u,t.splice(r++,0,o)}return String.fromCodePoint(...t)},Cf=function(e){const t=[];e=bf(e);const n=e.length;let r=gf,o=0,s=Af;for(const c of e)c<128&&t.push(Ts(c));const i=t.length;let a=i;for(i&&t.push(mf);a<n;){let c=Un;for(const f of e)f>=r&&f<c&&(c=f);const u=a+1;c-r>Wt((Un-o)/u)&&fn("overflow"),o+=(c-r)*u,r=c;for(const f of e)if(f<r&&++o>Un&&fn("overflow"),f===r){let h=o;for(let g=Kt;;g+=Kt){const A=g<=s?_a:g>=s+Mr?Mr:g-s;if(h<A)break;const p=h-A,m=Kt-A;t.push(Ts(gc(A+p%m,0))),h=Wt(p/m)}t.push(Ts(gc(h,0))),s=vf(o,u,a===i),o=0,++a}++o,++r}return t.join("")},qb=function(e){return xf(e,function(t){return zb.test(t)?yf(t.slice(4).toLowerCase()):t})},ev=function(e){return xf(e,function(t){return Ub.test(t)?"xn--"+Cf(t):t})},mc={version:"2.3.1",ucs2:{decode:bf,encode:$b},decode:yf,encode:Cf,toASCII:ev,toUnicode:qb};var xc=Object.defineProperty,If=(e,t)=>{let n={};for(var r in e)xc(n,r,{get:e[r],enumerable:!0});return xc(n,Symbol.toStringTag,{value:"Module"}),n},tv=If({arrayReplaceAt:()=>kf,asciiTrim:()=>As,callable:()=>wf,escapeHtml:()=>vn,escapeRE:()=>dv,fromCodePoint:()=>jr,isMdAsciiPunct:()=>Nr,isPunctChar:()=>Sf,isPunctCharCode:()=>Tr,isSpace:()=>Ye,isValidEntityCode:()=>Oa,isWhiteSpace:()=>Pr,lib:()=>fv,normalizeReference:()=>hs,unescapeAll:()=>nr,unescapeMd:()=>sv});function wf(e){const t=function(...n){return Reflect.construct(e,n,new.target&&new.target!==t?new.target:e)};return Object.defineProperty(t,"name",{value:e.name}),Object.setPrototypeOf(t,e),t.prototype=e.prototype,t}function kf(e,t,n){return[].concat(e.slice(0,t),n,e.slice(t+1))}function Oa(e){return!(e>=55296&&e<=57343||e>=64976&&e<=65007||(e&65535)===65535||(e&65535)===65534||e>=0&&e<=8||e===11||e>=14&&e<=31||e>=127&&e<=159||e>1114111)}function jr(e){if(e>65535){e-=65536;const t=55296+(e>>10),n=56320+(e&1023);return String.fromCharCode(t,n)}return String.fromCharCode(e)}var Ef=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,nv=new RegExp(`${Ef.source}|${/&([a-z#][a-z0-9]{1,31});/gi.source}`,"gi"),rv=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function ov(e,t){if(t.charCodeAt(0)===35&&rv.test(t)){const r=t[1].toLowerCase()==="x"?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return Oa(r)?jr(r):e}const n=hf(e);return n!==e?n:e}function sv(e){return e.indexOf("\\")<0?e:e.replace(Ef,"$1")}function nr(e){return e.indexOf("\\")<0&&e.indexOf("&")<0?e:e.replace(nv,function(t,n,r){return n||ov(t,r)})}var iv=/[&<>"]/,av=/[&<>"]/g,lv={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"};function cv(e){return lv[e]}function vn(e){return iv.test(e)?e.replace(av,cv):e}var uv=/[.?*+^$[\]\\(){}|-]/g;function dv(e){return e.replace(uv,"\\$&")}function Ye(e){switch(e){case 9:case 32:return!0}return!1}function Pr(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function Sf(e){return Na.test(e)||ff.test(e)}function Tr(e){return Sf(jr(e))}function Nr(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function hs(e){return e=e.trim().replace(/\s+/g," "),e.toLowerCase().toUpperCase()}function bc(e){return e===32||e===9||e===10||e===13}function As(e){let t=0;for(;t<e.length&&bc(e.charCodeAt(t));t++);let n=e.length-1;for(;n>=t&&bc(e.charCodeAt(n));n--);return e.slice(t,n+1)}var fv={mdurl:Ib,ucmicro:kb};function pv(e,t,n){let r,o,s,i;const a=e.posMax,c=e.pos;for(e.pos=t+1,r=1;e.pos<a;){if(s=e.src.charCodeAt(e.pos),s===93&&(r--,r===0)){o=!0;break}if(i=e.pos,e.md.inline.skipToken(e),s===91){if(i===e.pos-1)r++;else if(n)return e.pos=c,-1}}let u=-1;return o&&(u=e.pos),e.pos=c,u}function hv(e,t,n){let r,o=t;const s={ok:!1,pos:0,str:""};if(e.charCodeAt(o)===60){for(o++;o<n;){if(r=e.charCodeAt(o),r===10||r===60)return s;if(r===62)return s.pos=o+1,s.str=nr(e.slice(t+1,o)),s.ok=!0,s;if(r===92&&o+1<n){o+=2;continue}o++}return s}let i=0;for(;o<n&&(r=e.charCodeAt(o),!(r===32||r<32||r===127));){if(r===92&&o+1<n){if(e.charCodeAt(o+1)===32){o++;continue}o+=2;continue}if(r===40&&(i++,i>32))return s;if(r===41){if(i===0)break;i--}o++}return t===o||i!==0||(s.str=nr(e.slice(t,o)),s.pos=o,s.ok=!0),s}function Av(e,t,n,r){let o,s=t;const i={ok:!1,can_continue:!1,pos:0,str:"",marker:0};if(r)i.str=r.str,i.marker=r.marker;else{if(s>=n)return i;let a=e.charCodeAt(s);if(a!==34&&a!==39&&a!==40)return i;t++,s++,a===40&&(a=41),i.marker=a}for(;s<n;){if(o=e.charCodeAt(s),o===i.marker)return i.pos=s+1,i.str+=nr(e.slice(t,s)),i.ok=!0,i;if(o===40&&i.marker===41)return i;o===92&&s+1<n&&s++,s++}return i.can_continue=!0,i.str+=nr(e.slice(t,s)),i}var gv=If({parseLinkDestination:()=>hv,parseLinkLabel:()=>pv,parseLinkTitle:()=>Av});function _r(e){"@babel/helpers - typeof";return _r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_r(e)}function mv(e,t){if(_r(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(_r(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function xv(e){var t=mv(e,"string");return _r(t)=="symbol"?t:t+""}function xe(e,t,n){return(t=xv(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Fn=class{constructor(e,t,n){xe(this,"map",null),xe(this,"level",0),xe(this,"children",null),xe(this,"content",""),xe(this,"markup",""),xe(this,"info",""),xe(this,"block",!1),xe(this,"hidden",!1),this.type=e,this.tag=t,this.attrs=null,this.nesting=n,this.meta=null}attrIndex(e){if(!this.attrs)return-1;const t=this.attrs;for(let n=0,r=t.length;n<r;n++)if(t[n][0]===e)return n;return-1}attrPush(e){this.attrs?this.attrs.push(e):this.attrs=[e]}attrSet(e,t){const n=this.attrIndex(e),r=[e,t];n<0?this.attrPush(r):this.attrs[n]=r}attrGet(e){const t=this.attrIndex(e);let n=null;return t>=0&&(n=this.attrs[t][1]),n}attrJoin(e,t){const n=this.attrIndex(e);n<0?this.attrPush([e,t]):this.attrs[n][1]=`${this.attrs[n][1]} ${t}`}},Or=class{constructor(){xe(this,"__rules__",[]),xe(this,"__cache__",null)}__find__(e){for(let t=0;t<this.__rules__.length;t++)if(this.__rules__[t].name===e)return t;return-1}__compile__(){const e=new Set;this.__rules__.forEach(t=>{t.enabled&&t.alt.forEach(n=>{n&&e.add(n)})}),this.__cache__=Object.create(null),this.__cache__[""]=[],this.__rules__.forEach(t=>{t.enabled&&this.__cache__[""].push(t.fn)}),e.forEach(t=>{this.__cache__[t]=[],this.__rules__.forEach(n=>{n.enabled&&n.alt.indexOf(t)>=0&&this.__cache__[t].push(n.fn)})})}at(e,t,n={}){const r=this.__find__(e);if(r===-1)throw new Error(`Parser rule not found: ${e}`);this.__rules__[r].fn=t,this.__rules__[r].alt=n.alt||[],this.__cache__=null}before(e,t,n,r={}){const o=this.__find__(e);if(o===-1)throw new Error(`Parser rule not found: ${e}`);this.__rules__.splice(o,0,{name:t,enabled:!0,fn:n,alt:r.alt||[]}),this.__cache__=null}after(e,t,n,r={}){const o=this.__find__(e);if(o===-1)throw new Error(`Parser rule not found: ${e}`);this.__rules__.splice(o+1,0,{name:t,enabled:!0,fn:n,alt:r.alt||[]}),this.__cache__=null}push(e,t,n={}){this.__rules__.push({name:e,enabled:!0,fn:t,alt:n.alt||[]}),this.__cache__=null}enable(e,t=!1){Array.isArray(e)||(e=[e]);const n=[];return e.forEach(r=>{const o=this.__find__(r);if(o<0){if(t)return;throw new Error(`Rules manager: invalid rule name ${r}`)}this.__rules__[o].enabled=!0,n.push(r)}),this.__cache__=null,n}enableOnly(e,t=!1){Array.isArray(e)||(e=[e]),this.__rules__.forEach(n=>{n.enabled=!1}),this.enable(e,t)}disable(e,t=!1){Array.isArray(e)||(e=[e]);const n=[];return e.forEach(r=>{const o=this.__find__(r);if(o<0){if(t)return;throw new Error(`Rules manager: invalid rule name ${r}`)}this.__rules__[o].enabled=!1,n.push(r)}),this.__cache__=null,n}getRules(e){return this.__cache__||this.__compile__(),this.__cache__[e]||[]}},Ut={};Ut.code_inline=function(e,t,n,r,o){const s=e[t];return`<code${o.renderAttrs(s)}>${vn(s.content)}</code>`};Ut.code_block=function(e,t,n,r,o){const s=e[t];return`<pre${o.renderAttrs(s)}><code>${vn(e[t].content)}</code></pre>
5
+ `};Ut.fence=function(e,t,n,r,o){const s=e[t],i=s.info?nr(s.info).trim():"";let a="",c="";if(i){const f=i.split(/(\s+)/g);a=f[0],c=f.slice(2).join("")}let u;if(n.highlight?u=n.highlight(s.content,a,c)||vn(s.content):u=vn(s.content),u.indexOf("<pre")===0)return u+`
6
+ `;if(i){const f=s.attrIndex("class"),h=s.attrs?s.attrs.slice():[];f<0?h.push(["class",`${n.langPrefix}${a}`]):(h[f]=[h[f][0],h[f][1]],h[f][1]+=` ${n.langPrefix}${a}`);const g={attrs:h};return`<pre><code${o.renderAttrs(g)}>${u}</code></pre>
7
+ `}return`<pre><code${o.renderAttrs(s)}>${u}</code></pre>
8
+ `};Ut.image=function(e,t,n,r,o){const s=e[t];return s.attrs[s.attrIndex("alt")][1]=o.renderInlineAsText(s.children,n,r),o.renderToken(e,t,n)};Ut.hardbreak=function(e,t,n){return n.xhtmlOut?`<br />
9
+ `:`<br>
10
+ `};Ut.softbreak=function(e,t,n){return n.breaks?n.xhtmlOut?`<br />
11
+ `:`<br>
12
+ `:`
13
+ `};Ut.text=function(e,t){return vn(e[t].content)};Ut.html_block=function(e,t){return e[t].content};Ut.html_inline=function(e,t){return e[t].content};var Rf=class{constructor(){xe(this,"rules",Object.assign({},Ut))}renderAttrs(e){let t,n,r;if(!e.attrs)return"";for(r="",t=0,n=e.attrs.length;t<n;t++)r+=` ${vn(e.attrs[t][0])}="${vn(String(e.attrs[t][1]))}"`;return r}renderToken(e,t,n){const r=e[t];let o="";if(r.hidden)return"";let s=t-1;for(;s>=0&&e[s].hidden&&e[s].nesting===0;)s--;r.block&&r.nesting!==-1&&s>=0&&e[s].hidden&&e[s].nesting===-1&&(o+=`
14
+ `),o+=(r.nesting===-1?"</":"<")+r.tag,o+=this.renderAttrs(r),r.nesting===0&&n.xhtmlOut&&(o+=" /");let i=!1;if(r.block&&(i=!0,r.nesting===1)){let a=t+1;for(;a<e.length&&e[a].hidden&&e[a].nesting===0;)a++;if(a<e.length){const c=e[a];(c.type==="inline"||c.hidden||c.nesting===-1&&c.tag===r.tag)&&(i=!1)}}return o+=i?`>
15
+ `:">",o}renderInline(e,t,n){let r="";const o=this.rules;for(let s=0,i=e.length;s<i;s++){const a=e[s].type;typeof o[a]<"u"?r+=o[a](e,s,t,n,this):r+=this.renderToken(e,s,t)}return r}renderInlineAsText(e,t,n){let r="";for(let o=0,s=e.length;o<s;o++)switch(e[o].type){case"text":case"code_inline":r+=e[o].content;break;case"image":r+=this.renderInlineAsText(e[o].children,t,n);break;case"html_inline":case"html_block":r+=e[o].content;break;case"softbreak":case"hardbreak":r+=`
16
+ `}return r}render(e,t,n){let r="";const o=this.rules;for(let s=0,i=e.length;s<i;s++){const a=e[s].type;a==="inline"?r+=this.renderInline(e[s].children,t,n):typeof o[a]<"u"?r+=o[a](e,s,t,n,this):r+=this.renderToken(e,s,t)}return r}},Df=class{constructor(e,t,n){xe(this,"tokens",[]),xe(this,"inlineMode",!1),xe(this,"Token",Fn),this.src=e,this.env=n,this.md=t}},bv=/\r\n?|\n/g,vv=/\0/g;function yv(e){let t;t=e.src.replace(bv,`
17
+ `),t=t.replace(vv,"�"),e.src=t}function Cv(e){let t;e.inlineMode?(t=new e.Token("inline","",0),t.content=e.src,t.map=[0,1],t.children=[],e.tokens.push(t)):e.md.block.parse(e.src,e.md,e.env,e.tokens)}function Iv(e){const t=e.tokens;let n=0;for(let r=0;r<t.length;r++)t[r].type!=="reference_definition"&&(r!==n&&(t[n]=t[r]),n++);t.length!==n&&(t.length=n)}function wv(e){const t=e.tokens;for(let n=0,r=t.length;n<r;n++){const o=t[n];o.type==="inline"&&e.md.inline.parse(o.content,e.md,e.env,o.children)}}function kv(e){return/^<a[>\s]/i.test(e)}function Ev(e){return/^<\/a\s*>/i.test(e)}function Sv(e){const t=e.tokens;if(e.md.options.linkify)for(let n=0,r=t.length;n<r;n++){if(t[n].type!=="inline"||!e.md.linkify.test(t[n].content))continue;let o=t[n].children,s=0;for(let i=o.length-1;i>=0;i--){const a=o[i];if(a.type==="link_close"){for(i--;o[i].level!==a.level&&o[i].type!=="link_open";)i--;continue}if(a.type==="html_inline"&&(kv(a.content)&&s>0&&s--,Ev(a.content)&&s++),!(s>0)&&a.type==="text"&&e.md.linkify.test(a.content)){const c=a.content;let u=e.md.linkify.match(c);const f=[];let h=a.level,g=0;u.length>0&&u[0].index===0&&i>0&&o[i-1].type==="text_special"&&(u=u.slice(1));for(let A=0;A<u.length;A++){const p=u[A].url,m=e.md.normalizeLink(p);if(!e.md.validateLink(m))continue;let x=u[A].text;u[A].schema?u[A].schema==="mailto:"&&!/^mailto:/i.test(x)?x=e.md.normalizeLinkText(`mailto:${x}`).replace(/^mailto:/,""):x=e.md.normalizeLinkText(x):x=e.md.normalizeLinkText(`http://${x}`).replace(/^http:\/\//,"");const C=u[A].index;if(C>g){const w=new e.Token("text","",0);w.content=c.slice(g,C),w.level=h,f.push(w)}const b=new e.Token("link_open","a",1);b.attrs=[["href",m]],b.level=h++,b.markup="linkify",b.info="auto",f.push(b);const v=new e.Token("text","",0);v.content=x,v.level=h,f.push(v);const y=new e.Token("link_close","a",-1);y.level=--h,y.markup="linkify",y.info="auto",f.push(y),g=u[A].lastIndex}if(g<c.length){const A=new e.Token("text","",0);A.content=c.slice(g),A.level=h,f.push(A)}t[n].children=o=kf(o,i,f)}}}}var Ff=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,Rv=/\((c|tm|r)\)/i,Dv=/\((c|tm|r)\)/gi,Fv={c:"©",r:"®",tm:"™"};function Bv(e,t){return Fv[t.toLowerCase()]}function Mv(e){let t=0;for(let n=e.length-1;n>=0;n--){const r=e[n];r.type==="text"&&!t&&(r.content=r.content.replace(Dv,Bv)),r.type==="link_open"&&r.info==="auto"&&t--,r.type==="link_close"&&r.info==="auto"&&t++}}function jv(e){let t=0;for(let n=e.length-1;n>=0;n--){const r=e[n];r.type==="text"&&!t&&Ff.test(r.content)&&(r.content=r.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/gm,"$1—").replace(/(^|\s)--(?=\s|$)/gm,"$1–").replace(/(^|[^-\s])--(?=[^-\s]|$)/gm,"$1–")),r.type==="link_open"&&r.info==="auto"&&t--,r.type==="link_close"&&r.info==="auto"&&t++}}function Pv(e){let t;if(e.md.options.typographer)for(t=e.tokens.length-1;t>=0;t--)e.tokens[t].type==="inline"&&(Rv.test(e.tokens[t].content)&&Mv(e.tokens[t].children),Ff.test(e.tokens[t].content)&&jv(e.tokens[t].children))}var Tv=/['"]/,vc=/['"]/g,yc="’";function ao(e,t,n,r){e[t]||(e[t]=[]),e[t].push({pos:n,ch:r})}function Nv(e,t){let n="",r=0;t.sort((o,s)=>o.pos-s.pos);for(let o=0;o<t.length;o++){const s=t[o];n+=e.slice(r,s.pos)+s.ch,r=s.pos+1}return n+e.slice(r)}function _v(e,t){let n;const r=[],o={};for(let s=0;s<e.length;s++){const i=e[s],a=e[s].level;for(n=r.length-1;n>=0&&!(r[n].level<=a);n--);if(r.length=n+1,i.type!=="text")continue;const c=i.content;let u=0;const f=c.length;e:for(;u<f;){vc.lastIndex=u;const h=vc.exec(c);if(!h)break;let g=!0,A=!0;u=h.index+1;const p=h[0]==="'";let m=32;if(h.index-1>=0)m=c.charCodeAt(h.index-1);else for(n=s-1;n>=0&&!(e[n].type==="softbreak"||e[n].type==="hardbreak");n--)if(e[n].content){m=e[n].content.charCodeAt(e[n].content.length-1);break}let x=32;if(u<f)x=c.charCodeAt(u);else for(n=s+1;n<e.length&&!(e[n].type==="softbreak"||e[n].type==="hardbreak");n++)if(e[n].content){x=e[n].content.charCodeAt(0);break}const C=Nr(m)||Tr(m),b=Nr(x)||Tr(x),v=Pr(m),y=Pr(x);if(y?g=!1:b&&(v||C||(g=!1)),v?A=!1:C&&(y||b||(A=!1)),x===34&&h[0]==='"'&&m>=48&&m<=57&&(A=g=!1),g&&A&&(g=C,A=b),!g&&!A){p&&ao(o,s,h.index,yc);continue}if(A)for(n=r.length-1;n>=0;n--){let w=r[n];if(r[n].level<a)break;if(w.single===p&&r[n].level===a){w=r[n];let I,E;p?(I=t.md.options.quotes[2],E=t.md.options.quotes[3]):(I=t.md.options.quotes[0],E=t.md.options.quotes[1]),ao(o,s,h.index,E),ao(o,w.token,w.pos,I),r.length=n;continue e}}g?r.push({token:s,pos:h.index,single:p,level:a}):A&&p&&ao(o,s,h.index,yc)}}Object.keys(o).forEach(function(s){const i=Number(s);e[i].content=Nv(e[i].content,o[s])})}function Ov(e){if(e.md.options.typographer)for(let t=e.tokens.length-1;t>=0;t--)e.tokens[t].type!=="inline"||!Tv.test(e.tokens[t].content)||_v(e.tokens[t].children,e)}function Hv(e){let t,n;const r=e.length;for(t=0;t<r;t++)e[t].type==="text_special"&&(e[t].type="text");for(t=n=0;t<r;t++)e[t].type==="text"&&t+1<r&&e[t+1].type==="text"?e[t+1].content=e[t].content+e[t+1].content:(t!==n&&(e[n]=e[t]),n++);t!==n&&(e.length=n)}function Lv(e){let t,n;const r=e.tokens,o=r.length;for(let s=0;s<o;s++){if(r[s].type!=="inline")continue;const i=r[s].children,a=i.length;for(t=0;t<a;t++)i[t].type==="text_special"&&(i[t].type="text"),i[t].children&&Hv(i[t].children);for(t=n=0;t<a;t++)i[t].type==="text"&&t+1<a&&i[t+1].type==="text"?i[t+1].content=i[t].content+i[t+1].content:(t!==n&&(i[n]=i[t]),n++);t!==n&&(i.length=n)}}var Ns=[["normalize",yv],["block",Cv],["strip_references",Iv],["inline",wv],["linkify",Sv],["replacements",Pv],["smartquotes",Ov],["text_join",Lv]],Bf=class{constructor(){xe(this,"ruler",new Or),xe(this,"State",Df);for(let e=0;e<Ns.length;e++)this.ruler.push(Ns[e][0],Ns[e][1])}process(e){const t=this.ruler.getRules("");for(let n=0,r=t.length;n<r;n++)t[n](e)}},Mf=class{constructor(e,t,n,r){xe(this,"bMarks",[]),xe(this,"eMarks",[]),xe(this,"tShift",[]),xe(this,"sCount",[]),xe(this,"bsCount",[]),xe(this,"blkIndent",0),xe(this,"line",0),xe(this,"lineMax",0),xe(this,"tight",!1),xe(this,"listIndent",-1),xe(this,"parentType","root"),xe(this,"level",0),xe(this,"Token",Fn),this.src=e,this.md=t,this.env=n,this.tokens=r;const o=this.src;for(let s=0,i=0,a=0,c=0,u=o.length,f=!1;i<u;i++){const h=o.charCodeAt(i);if(!f)if(Ye(h)){a++,h===9?c+=4-c%4:c++;continue}else f=!0;(h===10||i===u-1)&&(h!==10&&i++,this.bMarks.push(s),this.eMarks.push(i),this.tShift.push(a),this.sCount.push(c),this.bsCount.push(0),f=!1,a=0,c=0,s=i+1)}this.bMarks.push(o.length),this.eMarks.push(o.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}push(e,t,n){const r=new Fn(e,t,n);return r.block=!0,n<0&&this.level--,r.level=this.level,n>0&&this.level++,this.tokens.push(r),r}isEmpty(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]}skipEmptyLines(e){for(let t=this.lineMax;e<t&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e}skipSpaces(e){for(let t=this.src.length;e<t&&Ye(this.src.charCodeAt(e));e++);return e}skipSpacesBack(e,t){if(e<=t)return e;for(;e>t;)if(!Ye(this.src.charCodeAt(--e)))return e+1;return e}skipChars(e,t){for(let n=this.src.length;e<n&&this.src.charCodeAt(e)===t;e++);return e}skipCharsBack(e,t,n){if(e<=n)return e;for(;e>n;)if(t!==this.src.charCodeAt(--e))return e+1;return e}getLines(e,t,n,r){if(e>=t)return"";const o=new Array(t-e);for(let s=0,i=e;i<t;i++,s++){let a=0;const c=this.bMarks[i];let u=c,f;for(i+1<t||r?f=this.eMarks[i]+1:f=this.eMarks[i];u<f&&a<n;){const h=this.src.charCodeAt(u);if(Ye(h))h===9?a+=4-(a+this.bsCount[i])%4:a++;else if(u-c<this.tShift[i])a++;else break;u++}a>n?o[s]=new Array(a-n+1).join(" ")+this.src.slice(u,f):o[s]=this.src.slice(u,f)}return o.join("")}},Kv=65536;function _s(e,t){const n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t];return e.src.slice(n,r)}function Cc(e){const t=[],n=e.length;let r=0,o=e.charCodeAt(r),s=!1,i=0,a="";for(;r<n;)o===124&&(s?(a+=e.substring(i,r-1),i=r):(t.push(a+e.substring(i,r)),a="",i=r+1)),s=o===92,r++,o=e.charCodeAt(r);return t.push(a+e.substring(i)),t}function Wv(e,t,n,r){if(t+2>n)return!1;let o=t+1;if(e.sCount[o]<e.blkIndent||e.sCount[o]-e.blkIndent>=4)return!1;let s=e.bMarks[o]+e.tShift[o];if(s>=e.eMarks[o])return!1;const i=e.src.charCodeAt(s++);if(i!==124&&i!==45&&i!==58||s>=e.eMarks[o])return!1;const a=e.src.charCodeAt(s++);if(a!==124&&a!==45&&a!==58&&!Ye(a)||i===45&&Ye(a))return!1;for(;s<e.eMarks[o];){const y=e.src.charCodeAt(s);if(y!==124&&y!==45&&y!==58&&!Ye(y))return!1;s++}let c=_s(e,t+1),u=c.split("|");const f=[];for(let y=0;y<u.length;y++){const w=u[y].trim();if(!w){if(y===0||y===u.length-1)continue;return!1}if(!/^:?-+:?$/.test(w))return!1;w.charCodeAt(w.length-1)===58?f.push(w.charCodeAt(0)===58?"center":"right"):w.charCodeAt(0)===58?f.push("left"):f.push("")}if(c=_s(e,t).trim(),c.indexOf("|")===-1||e.sCount[t]-e.blkIndent>=4)return!1;u=Cc(c),u.length&&u[0]===""&&u.shift(),u.length&&u[u.length-1]===""&&u.pop();const h=u.length;if(h===0||h!==f.length)return!1;if(r)return!0;const g=e.parentType;e.parentType="table";const A=e.md.block.ruler.getRules("blockquote"),p=e.push("table_open","table",1),m=[t,0];p.map=m;const x=e.push("thead_open","thead",1);x.map=[t,t+1];const C=e.push("tr_open","tr",1);C.map=[t,t+1];for(let y=0;y<u.length;y++){const w=e.push("th_open","th",1);f[y]&&(w.attrs=[["style",`text-align:${f[y]}`]]);const I=e.push("inline","",0);I.content=u[y].trim(),I.children=[],e.push("th_close","th",-1)}e.push("tr_close","tr",-1),e.push("thead_close","thead",-1);let b,v=0;for(o=t+2;o<n&&!(e.sCount[o]<e.blkIndent);o++){let y=!1;for(let I=0,E=A.length;I<E;I++)if(A[I](e,o,n,!0)){y=!0;break}if(y||(c=_s(e,o).trim(),!c)||e.sCount[o]-e.blkIndent>=4||(u=Cc(c),u.length&&u[0]===""&&u.shift(),u.length&&u[u.length-1]===""&&u.pop(),v+=h-u.length,v>Kv))break;if(o===t+2){const I=e.push("tbody_open","tbody",1);I.map=b=[t+2,0]}const w=e.push("tr_open","tr",1);w.map=[o,o+1];for(let I=0;I<h;I++){const E=e.push("td_open","td",1);f[I]&&(E.attrs=[["style",`text-align:${f[I]}`]]);const S=e.push("inline","",0);S.content=u[I]?u[I].trim():"",S.children=[],e.push("td_close","td",-1)}e.push("tr_close","tr",-1)}return b&&(e.push("tbody_close","tbody",-1),b[1]=o),e.push("table_close","table",-1),m[1]=o,e.parentType=g,e.line=o,!0}function Qv(e,t,n){if(e.sCount[t]-e.blkIndent<4)return!1;let r=t+1,o=r;for(;r<n;){if(e.isEmpty(r)){r++;continue}if(e.sCount[r]-e.blkIndent>=4){r++,o=r;continue}break}e.line=o;const s=e.push("code_block","code",0);return s.content=e.getLines(t,o,4+e.blkIndent,!1)+`
18
+ `,s.map=[t,e.line],!0}function Gv(e,t,n,r){let o=e.bMarks[t]+e.tShift[t],s=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||o+3>s)return!1;const i=e.src.charCodeAt(o);if(i!==126&&i!==96)return!1;let a=o;o=e.skipChars(o,i);let c=o-a;if(c<3)return!1;const u=e.src.slice(a,o),f=e.src.slice(o,s);if(i===96&&f.indexOf(String.fromCharCode(i))>=0)return!1;if(r)return!0;let h=t,g=!1;for(;h++,!(h>=n||(o=a=e.bMarks[h]+e.tShift[h],s=e.eMarks[h],o<s&&e.sCount[h]<e.blkIndent));)if(e.src.charCodeAt(o)===i&&!(e.sCount[h]-e.blkIndent>=4)&&(o=e.skipChars(o,i),!(o-a<c)&&(o=e.skipSpaces(o),!(o<s)))){g=!0;break}c=e.sCount[t],e.line=h+(g?1:0);const A=e.push("fence","code",0);return A.info=f,A.content=e.getLines(t+1,h,c,!0),A.markup=u,A.map=[t,e.line],!0}function Yv(e,t,n,r){let o=e.bMarks[t]+e.tShift[t],s=e.eMarks[t];const i=e.lineMax;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(o)!==62)return!1;if(r)return!0;const a=[],c=[],u=[],f=[],h=e.md.block.ruler.getRules("blockquote"),g=e.parentType;e.parentType="blockquote";let A=!1,p;for(p=t;p<n;p++){const v=e.sCount[p]<e.blkIndent;if(o=e.bMarks[p]+e.tShift[p],s=e.eMarks[p],o>=s)break;if(e.src.charCodeAt(o++)===62&&!v){let w=e.sCount[p]+1,I,E;e.src.charCodeAt(o)===32?(o++,w++,E=!1,I=!0):e.src.charCodeAt(o)===9?(I=!0,(e.bsCount[p]+w)%4===3?(o++,w++,E=!1):E=!0):I=!1;let S=w;for(a.push(e.bMarks[p]),e.bMarks[p]=o;o<s;){const R=e.src.charCodeAt(o);if(Ye(R))R===9?S+=4-(S+e.bsCount[p]+(E?1:0))%4:S++;else break;o++}A=o>=s,c.push(e.bsCount[p]),e.bsCount[p]=e.sCount[p]+1+(I?1:0),u.push(e.sCount[p]),e.sCount[p]=S-w,f.push(e.tShift[p]),e.tShift[p]=o-e.bMarks[p];continue}if(A)break;let y=!1;for(let w=0,I=h.length;w<I;w++)if(h[w](e,p,n,!0)){y=!0;break}if(y){e.lineMax=p,e.blkIndent!==0&&(a.push(e.bMarks[p]),c.push(e.bsCount[p]),f.push(e.tShift[p]),u.push(e.sCount[p]),e.sCount[p]-=e.blkIndent);break}a.push(e.bMarks[p]),c.push(e.bsCount[p]),f.push(e.tShift[p]),u.push(e.sCount[p]),e.sCount[p]=-1}const m=e.blkIndent;e.blkIndent=0;const x=e.push("blockquote_open","blockquote",1);x.markup=">";const C=[t,0];x.map=C,e.md.block.tokenize(e,t,p);const b=e.push("blockquote_close","blockquote",-1);b.markup=">",e.lineMax=i,e.parentType=g,C[1]=e.line;for(let v=0;v<f.length;v++)e.bMarks[v+t]=a[v],e.tShift[v+t]=f[v],e.sCount[v+t]=u[v],e.bsCount[v+t]=c[v];return e.blkIndent=m,!0}function zv(e,t,n,r){const o=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let s=e.bMarks[t]+e.tShift[t];const i=e.src.charCodeAt(s++);if(i!==42&&i!==45&&i!==95)return!1;let a=1;for(;s<o;){const u=e.src.charCodeAt(s++);if(u!==i&&!Ye(u))return!1;u===i&&a++}if(a<3)return!1;if(r)return!0;e.line=t+1;const c=e.push("hr","hr",0);return c.map=[t,e.line],c.markup=Array(a+1).join(String.fromCharCode(i)),!0}function Ic(e,t){const n=e.eMarks[t];let r=e.bMarks[t]+e.tShift[t];const o=e.src.charCodeAt(r++);return o!==42&&o!==45&&o!==43||r<n&&!Ye(e.src.charCodeAt(r))?-1:r}function wc(e,t){const n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t];let o=n;if(o+1>=r)return-1;let s=e.src.charCodeAt(o++);if(s<48||s>57)return-1;for(;;){if(o>=r)return-1;if(s=e.src.charCodeAt(o++),s>=48&&s<=57){if(o-n>=10)return-1;continue}if(s===41||s===46)break;return-1}return o<r&&(s=e.src.charCodeAt(o),!Ye(s))?-1:o}function Uv(e,t){const n=e.level+2;for(let r=t+2,o=e.tokens.length-2;r<o;r++)e.tokens[r].level===n&&e.tokens[r].type==="paragraph_open"&&(e.tokens[r+2].hidden=!0,e.tokens[r].hidden=!0,r+=2)}function Vv(e,t,n,r){let o,s,i,a,c=t,u=!0;if(e.sCount[c]-e.blkIndent>=4||e.listIndent>=0&&e.sCount[c]-e.listIndent>=4&&e.sCount[c]<e.blkIndent)return!1;let f=!1;r&&e.parentType==="paragraph"&&e.sCount[c]>=e.blkIndent&&(f=!0);let h,g,A;if((A=wc(e,c))>=0){if(h=!0,i=e.bMarks[c]+e.tShift[c],g=Number(e.src.slice(i,A-1)),f&&g!==1)return!1}else if((A=Ic(e,c))>=0)h=!1;else return!1;if(f&&e.skipSpaces(A)>=e.eMarks[c])return!1;if(r)return!0;const p=e.src.charCodeAt(A-1),m=e.tokens.length;h?(a=e.push("ordered_list_open","ol",1),g!==1&&(a.attrs=[["start",g]])):a=e.push("bullet_list_open","ul",1);const x=[c,0];a.map=x,a.markup=String.fromCharCode(p);let C=!1;const b=e.md.block.ruler.getRules("list"),v=e.parentType;for(e.parentType="list";c<n;){s=A,o=e.eMarks[c];const y=e.sCount[c]+A-(e.bMarks[c]+e.tShift[c]);let w=y;for(;s<o;){const D=e.src.charCodeAt(s);if(D===9)w+=4-(w+e.bsCount[c])%4;else if(D===32)w++;else break;s++}const I=s;let E;I>=o?E=1:E=w-y,E>4&&(E=1);const S=y+E;a=e.push("list_item_open","li",1),a.markup=String.fromCharCode(p);const R=[c,0];a.map=R,h&&(a.info=e.src.slice(i,A-1));const k=e.tight,F=e.tShift[c],T=e.sCount[c],N=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=S,e.tight=!0,e.tShift[c]=I-e.bMarks[c],e.sCount[c]=w,I>=o&&e.isEmpty(c+1)?e.line=Math.min(e.line+2,n):e.md.block.tokenize(e,c,n),(!e.tight||C)&&(u=!1),C=e.line-c>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=N,e.tShift[c]=F,e.sCount[c]=T,e.tight=k,a=e.push("list_item_close","li",-1),a.markup=String.fromCharCode(p),c=e.line,R[1]=c,c>=n||e.sCount[c]<e.blkIndent||e.sCount[c]-e.blkIndent>=4)break;let j=!1;for(let D=0,O=b.length;D<O;D++)if(b[D](e,c,n,!0)){j=!0;break}if(j)break;if(h){if(A=wc(e,c),A<0)break;i=e.bMarks[c]+e.tShift[c]}else if(A=Ic(e,c),A<0)break;if(p!==e.src.charCodeAt(A-1))break}return h?a=e.push("ordered_list_close","ol",-1):a=e.push("bullet_list_close","ul",-1),a.markup=String.fromCharCode(p),x[1]=c,e.line=c,e.parentType=v,u&&Uv(e,m),!0}function Zv(e,t,n,r){let o=e.bMarks[t]+e.tShift[t],s=e.eMarks[t],i=t+1;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(o)!==91)return!1;function a(y){const w=e.lineMax;if(y>=w||e.isEmpty(y))return null;let I=!1;if(e.sCount[y]-e.blkIndent>3&&(I=!0),e.sCount[y]<0&&(I=!0),!I){const R=e.md.block.ruler.getRules("reference"),k=e.parentType;e.parentType="reference";let F=!1;for(let T=0,N=R.length;T<N;T++)if(R[T](e,y,w,!0)){F=!0;break}if(e.parentType=k,F)return null}const E=e.bMarks[y]+e.tShift[y],S=e.eMarks[y];return e.src.slice(E,S+1)}let c=e.src.slice(o,s+1);s=c.length;let u=-1;for(o=1;o<s;o++){const y=c.charCodeAt(o);if(y===91)return!1;if(y===93){u=o;break}else if(y===10){const w=a(i);w!==null&&(c+=w,s=c.length,i++)}else if(y===92&&(o++,o<s&&c.charCodeAt(o)===10)){const w=a(i);w!==null&&(c+=w,s=c.length,i++)}}if(u<0||c.charCodeAt(u+1)!==58)return!1;for(o=u+2;o<s;o++){const y=c.charCodeAt(o);if(y===10){const w=a(i);w!==null&&(c+=w,s=c.length,i++)}else if(!Ye(y))break}const f=e.md.helpers.parseLinkDestination(c,o,s);if(!f.ok)return!1;const h=e.md.normalizeLink(f.str);if(!e.md.validateLink(h))return!1;o=f.pos;const g=o,A=i,p=o;for(;o<s;o++){const y=c.charCodeAt(o);if(y===10){const w=a(i);w!==null&&(c+=w,s=c.length,i++)}else if(!Ye(y))break}let m=e.md.helpers.parseLinkTitle(c,o,s);for(;m.can_continue;){const y=a(i);if(y===null)break;c+=y,o=s,s=c.length,i++,m=e.md.helpers.parseLinkTitle(c,o,s,m)}let x;for(o<s&&p!==o&&m.ok?(x=m.str,o=m.pos):(x="",o=g,i=A);o<s&&Ye(c.charCodeAt(o));)o++;if(o<s&&c.charCodeAt(o)!==10&&x)for(x="",o=g,i=A;o<s&&Ye(c.charCodeAt(o));)o++;if(o<s&&c.charCodeAt(o)!==10)return!1;const C=hs(c.slice(1,u));if(!C)return!1;if(r)return!0;typeof e.env.references>"u"&&(e.env.references={}),typeof e.env.references[C]>"u"&&(e.env.references[C]={title:x,href:h});const b=e.push("reference_definition","",0);b.map=[t,i],b.hidden=!0;const v=Object.create(null);return v.label=C,b.meta=v,e.line=i,!0}var Jv=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],jf=`<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>`,Pf="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",$v=new RegExp(`^(?:${jf}|${Pf}|<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->|<[?][\\s\\S]*?[?]>|<![A-Za-z][^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)`),Xv=new RegExp(`^(?:${jf}|${Pf})`),En=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Za-z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp(`^</?(${Jv.join("|")})(?=(\\s|/?>|$))`,"i"),/^$/,!0],[new RegExp(`${Xv.source}\\s*$`),/^$/,!1]];function qv(e,t,n,r){let o=e.bMarks[t]+e.tShift[t],s=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(o)!==60)return!1;let i=e.src.slice(o,s),a=0;for(;a<En.length&&!En[a][0].test(i);a++);if(a===En.length)return!1;if(r)return En[a][2];let c=t+1;const u=En[a][1].test("");if(!En[a][1].test(i)){for(;c<n&&!(e.sCount[c]<e.blkIndent&&(u||!e.isEmpty(c)));c++)if(o=e.bMarks[c]+e.tShift[c],s=e.eMarks[c],i=e.src.slice(o,s),En[a][1].test(i)){i.length!==0&&c++;break}}e.line=c;const f=e.push("html_block","",0);return f.map=[t,c],f.content=e.getLines(t,c,e.blkIndent,!0),!0}function ey(e,t,n,r){let o=e.bMarks[t]+e.tShift[t],s=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let i=e.src.charCodeAt(o);if(i!==35||o>=s)return!1;let a=1;for(i=e.src.charCodeAt(++o);i===35&&o<s&&a<=6;)a++,i=e.src.charCodeAt(++o);if(a>6||o<s&&!Ye(i))return!1;if(r)return!0;s=e.skipSpacesBack(s,o);const c=e.skipCharsBack(s,35,o);c>o&&Ye(e.src.charCodeAt(c-1))&&(s=c),e.line=t+1;const u=e.push("heading_open",`h${a}`,1);u.markup="########".slice(0,a),u.map=[t,e.line];const f=e.push("inline","",0);f.content=As(e.src.slice(o,s)),f.map=[t,e.line],f.children=[];const h=e.push("heading_close",`h${a}`,-1);return h.markup="########".slice(0,a),!0}function ty(e,t,n){const r=e.md.block.ruler.getRules("paragraph");if(e.sCount[t]-e.blkIndent>=4)return!1;const o=e.parentType;e.parentType="paragraph";let s=0,i,a=t+1;for(;a<n&&!e.isEmpty(a);a++){if(e.sCount[a]-e.blkIndent>3)continue;if(e.sCount[a]>=e.blkIndent){let A=e.bMarks[a]+e.tShift[a];const p=e.eMarks[a];if(A<p&&(i=e.src.charCodeAt(A),(i===45||i===61)&&(A=e.skipChars(A,i),A=e.skipSpaces(A),A>=p))){s=i===61?1:2;break}}if(e.sCount[a]<0)continue;let g=!1;for(let A=0,p=r.length;A<p;A++)if(r[A](e,a,n,!0)){g=!0;break}if(g)break}if(!s)return e.parentType=o,!1;const c=As(e.getLines(t,a,e.blkIndent,!1));e.line=a+1;const u=e.push("heading_open",`h${s}`,1);u.markup=String.fromCharCode(i),u.map=[t,e.line];const f=e.push("inline","",0);f.content=c,f.map=[t,e.line-1],f.children=[];const h=e.push("heading_close",`h${s}`,-1);return h.markup=String.fromCharCode(i),e.parentType=o,!0}function ny(e,t,n){const r=e.md.block.ruler.getRules("paragraph"),o=e.parentType;let s=t+1;for(e.parentType="paragraph";s<n&&!e.isEmpty(s);s++){if(e.sCount[s]-e.blkIndent>3||e.sCount[s]<0)continue;let u=!1;for(let f=0,h=r.length;f<h;f++)if(r[f](e,s,n,!0)){u=!0;break}if(u)break}const i=As(e.getLines(t,s,e.blkIndent,!1));e.line=s;const a=e.push("paragraph_open","p",1);a.map=[t,e.line];const c=e.push("inline","",0);return c.content=i,c.map=[t,e.line],c.children=[],e.push("paragraph_close","p",-1),e.parentType=o,!0}var lo=[["table",Wv,["paragraph","reference"]],["code",Qv],["fence",Gv,["paragraph","reference","blockquote","list"]],["blockquote",Yv,["paragraph","reference","blockquote","list"]],["hr",zv,["paragraph","reference","blockquote","list"]],["list",Vv,["paragraph","reference","blockquote"]],["reference",Zv],["html_block",qv,["paragraph","reference","blockquote"]],["heading",ey,["paragraph","reference","blockquote"]],["lheading",ty],["paragraph",ny]],Tf=class{constructor(){xe(this,"ruler",new Or),xe(this,"State",Mf);for(let e=0;e<lo.length;e++)this.ruler.push(lo[e][0],lo[e][1],{alt:(lo[e][2]||[]).slice()})}tokenize(e,t,n){const r=this.ruler.getRules(""),o=r.length,s=e.md.options.maxNesting;let i=t,a=!1;for(;i<n&&(e.line=i=e.skipEmptyLines(i),!(i>=n||e.sCount[i]<e.blkIndent));){if(e.level>=s){e.line=n;break}const c=e.line;let u=!1;for(let f=0;f<o;f++)if(u=r[f](e,i,n,!1),u){if(c>=e.line)throw new Error("block rule didn't increment state.line");break}if(!u)throw new Error("none of the block rules matched");e.tight=!a,e.isEmpty(e.line-1)&&(a=!0),i=e.line,i<n&&e.isEmpty(i)&&(a=!0,i++,e.line=i)}}parse(e,t,n,r){if(!e)return;const o=new this.State(e,t,n,r);this.tokenize(o,o.line,o.lineMax)}},Nf=class{constructor(e,t,n,r){xe(this,"pos",0),xe(this,"level",0),xe(this,"pending",""),xe(this,"pendingLevel",0),xe(this,"cache",{}),xe(this,"backticks",{}),xe(this,"backticksScanned",!1),xe(this,"linkLevel",0),xe(this,"delimiters",[]),xe(this,"_prev_delimiters",[]),xe(this,"Token",Fn),this.src=e,this.env=n,this.md=t,this.tokens=r,this.tokens_meta=Array(r.length),this.posMax=this.src.length}pushPending(){const e=new Fn("text","",0);return e.content=this.pending,e.level=this.pendingLevel,this.tokens.push(e),this.pending="",e}push(e,t,n){this.pending&&this.pushPending();const r=new Fn(e,t,n);let o;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),r.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],o={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(o),r}scanDelims(e,t){const n=this.posMax,r=this.src.charCodeAt(e);let o;if(e===0)o=32;else if(e===1)o=this.src.charCodeAt(0),(o&63488)===55296&&(o=65533);else if(o=this.src.charCodeAt(e-1),(o&64512)===56320){const p=this.src.charCodeAt(e-2);o=(p&64512)===55296?65536+(p-55296<<10)+(o-56320):65533}else(o&64512)===55296&&(o=65533);let s=e;for(;s<n&&this.src.charCodeAt(s)===r;)s++;const i=s-e;let a=s<n?this.src.charCodeAt(s):32;if((a&64512)===55296){const p=this.src.charCodeAt(s+1);a=(p&64512)===56320?65536+(a-55296<<10)+(p-56320):65533}else(a&64512)===56320&&(a=65533);const c=Nr(o)||Tr(o),u=Nr(a)||Tr(a),f=Pr(o),h=Pr(a),g=!h&&(!u||f||c),A=!f&&(!c||h||u);return{can_open:g&&(t||!A||c),can_close:A&&(t||!g||u),length:i}}};function ry(e){switch(e){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}function oy(e,t){let n=e.pos;for(;n<e.posMax&&!ry(e.src.charCodeAt(n));)n++;return n===e.pos?!1:(t||(e.pending+=e.src.slice(e.pos,n)),e.pos=n,!0)}var sy=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function iy(e,t){if(!e.md.options.linkify||e.linkLevel>0)return!1;const n=e.pos,r=e.posMax;if(n+3>r||e.src.charCodeAt(n)!==58||e.src.charCodeAt(n+1)!==47||e.src.charCodeAt(n+2)!==47)return!1;const o=e.pending.match(sy);if(!o)return!1;const s=o[1],i=e.md.linkify.matchAtStart(e.src.slice(n-s.length));if(!i)return!1;let a=i.url;if(a.length<=s.length)return!1;let c=a.length;for(;c>0&&a.charCodeAt(c-1)===42;)c--;c!==a.length&&(a=a.slice(0,c));const u=e.md.normalizeLink(a);if(!e.md.validateLink(u))return!1;if(!t){e.pending=e.pending.slice(0,-s.length);const f=e.push("link_open","a",1);f.attrs=[["href",u]],f.markup="linkify",f.info="auto";const h=e.push("text","",0);h.content=e.md.normalizeLinkText(a);const g=e.push("link_close","a",-1);g.markup="linkify",g.info="auto"}return e.pos+=a.length-s.length,!0}function ay(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==10)return!1;const r=e.pending.length-1,o=e.posMax;if(!t)if(r>=0&&e.pending.charCodeAt(r)===32)if(r>=1&&e.pending.charCodeAt(r-1)===32){let s=r-1;for(;s>=1&&e.pending.charCodeAt(s-1)===32;)s--;e.pending=e.pending.slice(0,s),e.push("hardbreak","br",0)}else e.pending=e.pending.slice(0,-1),e.push("softbreak","br",0);else e.push("softbreak","br",0);for(n++;n<o&&Ye(e.src.charCodeAt(n));)n++;return e.pos=n,!0}var Ha=[];for(let e=0;e<256;e++)Ha.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(e){Ha[e.charCodeAt(0)]=1});function ly(e,t){let n=e.pos;const r=e.posMax;if(e.src.charCodeAt(n)!==92||(n++,n>=r))return!1;let o=e.src.charCodeAt(n);if(o===10){for(t||e.push("hardbreak","br",0),n++;n<r&&(o=e.src.charCodeAt(n),!!Ye(o));)n++;return e.pos=n,!0}if(o===32){if(!t){const a=e.push("text_special","",0);a.content="\\",a.markup="\\",a.info="escape"}return e.pos=n,!0}let s=e.src[n];if(o>=55296&&o<=56319&&n+1<r){const a=e.src.charCodeAt(n+1);a>=56320&&a<=57343&&(s+=e.src[n+1],n++)}const i="\\"+s;if(!t){const a=e.push("text_special","",0);o<256&&Ha[o]!==0?a.content=s:a.content=i,a.markup=i,a.info="escape"}return e.pos=n+1,!0}function cy(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==96)return!1;const r=n;n++;const o=e.posMax;for(;n<o&&e.src.charCodeAt(n)===96;)n++;const s=e.src.slice(r,n),i=s.length;if(e.backticksScanned&&(e.backticks[i]||0)<=r)return t||(e.pending+=s),e.pos+=i,!0;let a=n,c;for(;(c=e.src.indexOf("`",a))!==-1;){for(a=c+1;a<o&&e.src.charCodeAt(a)===96;)a++;const u=a-c;if(u===i){if(!t){const f=e.push("code_inline","code",0);f.markup=s,f.content=e.src.slice(n,c).replace(/\n/g," ").replace(/^ (.+) $/,"$1")}return e.pos=a,!0}e.backticks[u]=c}return e.backticksScanned=!0,t||(e.pending+=s),e.pos+=i,!0}function uy(e,t){const n=e.pos,r=e.src.charCodeAt(n);if(t||r!==126)return!1;const o=e.scanDelims(e.pos,!0);let s=o.length;const i=String.fromCharCode(r);if(s<2)return!1;let a;s%2&&(a=e.push("text","",0),a.content=i,s--);for(let c=0;c<s;c+=2)a=e.push("text","",0),a.content=i+i,e.delimiters.push({marker:r,length:0,token:e.tokens.length-1,end:-1,open:o.can_open,close:o.can_close});return e.pos+=o.length,!0}function kc(e,t){let n;const r=[],o=t.length;for(let s=0;s<o;s++){const i=t[s];if(i.marker!==126||i.end===-1)continue;const a=t[i.end];n=e.tokens[i.token],n.type="s_open",n.tag="s",n.nesting=1,n.markup="~~",n.content="",n=e.tokens[a.token],n.type="s_close",n.tag="s",n.nesting=-1,n.markup="~~",n.content="",e.tokens[a.token-1].type==="text"&&e.tokens[a.token-1].content==="~"&&r.push(a.token-1)}for(;r.length;){const s=r.pop();let i=s+1;for(;i<e.tokens.length&&e.tokens[i].type==="s_close";)i++;i--,s!==i&&(n=e.tokens[i],e.tokens[i]=e.tokens[s],e.tokens[s]=n)}}function dy(e){const t=e.tokens_meta,n=e.tokens_meta.length;kc(e,e.delimiters);for(let o=0;o<n;o++){var r;const s=(r=t[o])===null||r===void 0?void 0:r.delimiters;s&&kc(e,s)}}var _f={tokenize:uy,postProcess:dy};function fy(e,t){const n=e.pos,r=e.src.charCodeAt(n);if(t||r!==95&&r!==42)return!1;const o=e.scanDelims(e.pos,r===42);for(let s=0;s<o.length;s++){const i=e.push("text","",0);i.content=String.fromCharCode(r),e.delimiters.push({marker:r,length:o.length,token:e.tokens.length-1,end:-1,open:o.can_open,close:o.can_close})}return e.pos+=o.length,!0}function Ec(e,t){const n=t.length;for(let r=n-1;r>=0;r--){const o=t[r];if(o.marker!==95&&o.marker!==42||o.end===-1)continue;const s=t[o.end],i=r>0&&t[r-1].end===o.end+1&&t[r-1].marker===o.marker&&t[r-1].token===o.token-1&&t[o.end+1].token===s.token+1,a=String.fromCharCode(o.marker),c=e.tokens[o.token];c.type=i?"strong_open":"em_open",c.tag=i?"strong":"em",c.nesting=1,c.markup=i?a+a:a,c.content="";const u=e.tokens[s.token];u.type=i?"strong_close":"em_close",u.tag=i?"strong":"em",u.nesting=-1,u.markup=i?a+a:a,u.content="",i&&(e.tokens[t[r-1].token].content="",e.tokens[t[o.end+1].token].content="",r--)}}function py(e){const t=e.tokens_meta,n=e.tokens_meta.length;Ec(e,e.delimiters);for(let o=0;o<n;o++){var r;const s=(r=t[o])===null||r===void 0?void 0:r.delimiters;s&&Ec(e,s)}}var Of={tokenize:fy,postProcess:py};function hy(e,t){let n,r,o,s,i="",a="",c=e.pos,u=!0;if(e.src.charCodeAt(e.pos)!==91)return!1;const f=e.pos,h=e.posMax,g=e.pos+1,A=e.md.helpers.parseLinkLabel(e,e.pos,!0);if(A<0)return!1;let p=A+1;if(p<h&&e.src.charCodeAt(p)===40){for(u=!1,p++;p<h&&(n=e.src.charCodeAt(p),!(!Ye(n)&&n!==10));p++);if(p>=h)return!1;if(c=p,o=e.md.helpers.parseLinkDestination(e.src,p,e.posMax),o.ok){for(i=e.md.normalizeLink(o.str),e.md.validateLink(i)?p=o.pos:i="",c=p;p<h&&(n=e.src.charCodeAt(p),!(!Ye(n)&&n!==10));p++);if(o=e.md.helpers.parseLinkTitle(e.src,p,e.posMax),p<h&&c!==p&&o.ok)for(a=o.str,p=o.pos;p<h&&(n=e.src.charCodeAt(p),!(!Ye(n)&&n!==10));p++);}(p>=h||e.src.charCodeAt(p)!==41)&&(u=!0),p++}if(u){if(typeof e.env.references>"u")return!1;if(p<h&&e.src.charCodeAt(p)===91?(c=p+1,p=e.md.helpers.parseLinkLabel(e,p),p>=0?r=e.src.slice(c,p++):p=A+1):p=A+1,r||(r=e.src.slice(g,A)),r=hs(r),s=e.env.references[r],!s)return e.pos=f,!1;i=s.href,a=s.title}if(!t){e.pos=g,e.posMax=A;const m=e.push("link_open","a",1),x=[["href",i]];if(m.attrs=x,a&&x.push(["title",a]),r){const C=Object.create(null);C.label=r,m.meta=C}e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push("link_close","a",-1)}return e.pos=p,e.posMax=h,!0}function Ay(e,t){let n,r,o,s,i,a,c,u,f="";const h=e.pos,g=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;const A=e.pos+2,p=e.md.helpers.parseLinkLabel(e,e.pos+1,!1);if(p<0)return!1;if(s=p+1,s<g&&e.src.charCodeAt(s)===40){for(s++;s<g&&(n=e.src.charCodeAt(s),!(!Ye(n)&&n!==10));s++);if(s>=g)return!1;for(u=s,a=e.md.helpers.parseLinkDestination(e.src,s,e.posMax),a.ok&&(f=e.md.normalizeLink(a.str),e.md.validateLink(f)?s=a.pos:f=""),u=s;s<g&&(n=e.src.charCodeAt(s),!(!Ye(n)&&n!==10));s++);if(a=e.md.helpers.parseLinkTitle(e.src,s,e.posMax),s<g&&u!==s&&a.ok)for(c=a.str,s=a.pos;s<g&&(n=e.src.charCodeAt(s),!(!Ye(n)&&n!==10));s++);else c="";if(s>=g||e.src.charCodeAt(s)!==41)return e.pos=h,!1;s++}else{if(typeof e.env.references>"u")return!1;if(s<g&&e.src.charCodeAt(s)===91?(u=s+1,s=e.md.helpers.parseLinkLabel(e,s),s>=0?o=e.src.slice(u,s++):s=p+1):s=p+1,o||(o=e.src.slice(A,p)),o=hs(o),i=e.env.references[o],!i)return e.pos=h,!1;f=i.href,c=i.title}if(!t){r=e.src.slice(A,p);const m=[];e.md.inline.parse(r,e.md,e.env,m);const x=e.push("image","img",0),C=[["src",f],["alt",""]];if(x.attrs=C,x.children=m,x.content=r,c&&C.push(["title",c]),o){const b=Object.create(null);b.label=o,x.meta=b}}return e.pos=s,e.posMax=g,!0}var gy=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,my=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function xy(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==60)return!1;const r=e.pos,o=e.posMax;for(;;){if(++n>=o)return!1;const i=e.src.charCodeAt(n);if(i===60)return!1;if(i===62)break}const s=e.src.slice(r+1,n);if(my.test(s)){const i=e.md.normalizeLink(s);if(!e.md.validateLink(i))return!1;if(!t){const a=e.push("link_open","a",1);a.attrs=[["href",i]],a.markup="autolink",a.info="auto";const c=e.push("text","",0);c.content=e.md.normalizeLinkText(s);const u=e.push("link_close","a",-1);u.markup="autolink",u.info="auto"}return e.pos+=s.length+2,!0}if(gy.test(s)){const i=e.md.normalizeLink(`mailto:${s}`);if(!e.md.validateLink(i))return!1;if(!t){const a=e.push("link_open","a",1);a.attrs=[["href",i]],a.markup="autolink",a.info="auto";const c=e.push("text","",0);c.content=e.md.normalizeLinkText(s);const u=e.push("link_close","a",-1);u.markup="autolink",u.info="auto"}return e.pos+=s.length+2,!0}return!1}function by(e){return/^<a[>\s]/i.test(e)}function vy(e){return/^<\/a\s*>/i.test(e)}function yy(e){const t=e|32;return t>=97&&t<=122}function Cy(e,t){if(!e.md.options.html)return!1;const n=e.posMax,r=e.pos;if(e.src.charCodeAt(r)!==60||r+2>=n)return!1;const o=e.src.charCodeAt(r+1);if(o!==33&&o!==63&&o!==47&&!yy(o))return!1;const s=e.src.slice(r).match($v);if(!s)return!1;if(!t){const i=e.push("html_inline","",0);i.content=s[0],by(i.content)&&e.linkLevel++,vy(i.content)&&e.linkLevel--}return e.pos+=s[0].length,!0}var Iy=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,wy=/^&([a-z][a-z0-9]{1,31});/i;function ky(e,t){const n=e.pos,r=e.posMax;if(e.src.charCodeAt(n)!==38||n+1>=r)return!1;if(e.src.charCodeAt(n+1)===35){const o=e.src.slice(n).match(Iy);if(o){if(!t){const s=o[1][0].toLowerCase()==="x"?parseInt(o[1].slice(1),16):parseInt(o[1],10),i=e.push("text_special","",0);i.content=Oa(s)?jr(s):jr(65533),i.markup=o[0],i.info="entity"}return e.pos+=o[0].length,!0}}else{const o=e.src.slice(n).match(wy);if(o){const s=hf(o[0]);if(s!==o[0]){if(!t){const i=e.push("text_special","",0);i.content=s,i.markup=o[0],i.info="entity"}return e.pos+=o[0].length,!0}}}return!1}function Sc(e){const t={},n=e.length;if(!n)return;let r=0,o=-2;const s=[];for(let i=0;i<n;i++){const a=e[i];if(s.push(0),(e[r].marker!==a.marker||o!==a.token-1)&&(r=i),o=a.token,a.length=a.length||0,!a.close)continue;t.hasOwnProperty(a.marker)||(t[a.marker]=[-1,-1,-1,-1,-1,-1]);const c=t[a.marker][(a.open?3:0)+a.length%3];let u=r-s[r]-1,f=u;for(;u>c;u-=s[u]+1){const h=e[u];if(h.marker===a.marker&&h.open&&h.end<0){let g=!1;if((h.close||a.open)&&(h.length+a.length)%3===0&&(h.length%3!==0||a.length%3!==0)&&(g=!0),!g){const A=u>0&&!e[u-1].open?s[u-1]+1:0;s[i]=i-u+A,s[u]=A,a.open=!1,h.end=i,h.close=!1,f=-1,o=-2;break}}}f!==-1&&(t[a.marker][(a.open?3:0)+(a.length||0)%3]=f)}}function Ey(e){const t=e.tokens_meta,n=e.tokens_meta.length;Sc(e.delimiters);for(let o=0;o<n;o++){var r;const s=(r=t[o])===null||r===void 0?void 0:r.delimiters;s&&Sc(s)}}function Sy(e){let t,n,r=0;const o=e.tokens,s=e.tokens.length;for(t=n=0;t<s;t++)o[t].nesting<0&&r--,o[t].level=r,o[t].nesting>0&&r++,o[t].type==="text"&&t+1<s&&o[t+1].type==="text"?o[t+1].content=o[t].content+o[t+1].content:(t!==n&&(o[n]=o[t]),n++);t!==n&&(o.length=n)}var Os=[["text",oy],["linkify",iy],["newline",ay],["escape",ly],["backticks",cy],["strikethrough",_f.tokenize],["emphasis",Of.tokenize],["link",hy],["image",Ay],["autolink",xy],["html_inline",Cy],["entity",ky]],Hs=[["balance_pairs",Ey],["strikethrough",_f.postProcess],["emphasis",Of.postProcess],["fragments_join",Sy]],Hf=class{constructor(){xe(this,"ruler",new Or),xe(this,"ruler2",new Or),xe(this,"State",Nf);for(let e=0;e<Os.length;e++)this.ruler.push(Os[e][0],Os[e][1]);for(let e=0;e<Hs.length;e++)this.ruler2.push(Hs[e][0],Hs[e][1])}skipToken(e){const t=e.pos,n=this.ruler.getRules(""),r=n.length,o=e.md.options.maxNesting,s=e.cache;if(typeof s[t]<"u"){e.pos=s[t];return}let i=!1;if(e.level<o){for(let a=0;a<r;a++)if(e.level++,i=n[a](e,!0),e.level--,i){if(t>=e.pos)throw new Error("inline rule didn't increment state.pos");break}}else e.pos=e.posMax;i||e.pos++,s[t]=e.pos}tokenize(e){const t=this.ruler.getRules(""),n=t.length,r=e.posMax,o=e.md.options.maxNesting;for(;e.pos<r;){const s=e.pos;let i=!1;if(e.level<o){for(let a=0;a<n;a++)if(i=t[a](e,!1),i){if(s>=e.pos)throw new Error("inline rule didn't increment state.pos");break}}if(i){if(e.pos>=r)break;continue}e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()}parse(e,t,n,r){const o=new this.State(e,t,n,r);this.tokenize(o);const s=this.ruler2.getRules(""),i=s.length;for(let a=0;a<i;a++)s[a](o)}},Ry={default:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},zero:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","strip_references","inline","text_join"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","fragments_join"]}}},commonmark:{options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","strip_references","inline","text_join"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","fragments_join"]}}}},Dy=/^(vbscript|javascript|file|data):/,Fy=/^data:image\/(gif|png|jpeg|webp);/,Rc=["http:","https:","mailto:"],Vt=class{validateLink(e){const t=e.trim().toLowerCase();return Dy.test(t)?Fy.test(t):!0}normalizeLink(e){const t=Ai(e,!0);if(t.hostname&&(!t.protocol||Rc.indexOf(t.protocol)>=0))try{t.hostname=mc.toASCII(t.hostname)}catch{}return Vr(hi(t))}normalizeLinkText(e){const t=Ai(e,!0);if(t.hostname&&(!t.protocol||Rc.indexOf(t.protocol)>=0))try{t.hostname=mc.toUnicode(t.hostname)}catch{}return tr(hi(t),tr.defaultChars+"%")}constructor(...e){xe(this,"inline",new Hf),xe(this,"block",new Tf),xe(this,"core",new Bf),xe(this,"renderer",new Rf),xe(this,"linkify",new Qb),xe(this,"utils",tv),xe(this,"helpers",Object.assign({},gv));const[t,n]=e;typeof t=="string"?(this.configure(t),n&&this.set(n)):(this.configure("default"),this.set(t||{}))}set(e){return Object.assign(this.options,e),this}configure(e){let t;if(typeof e=="string"){const o=e;if(t=Ry[o],!t)throw new Error(`Wrong 'markdown-it' preset "${o}", check name`)}else t=e;if(!t)throw new Error("Wrong `markdown-it` preset, can't be empty");t.options&&(this.options={...t.options});const n=t.components;if(n){var r;["core","block","inline"].forEach(s=>{var i;const a=(i=n[s])===null||i===void 0?void 0:i.rules;a&&this[s].ruler.enableOnly(a)});const o=(r=n.inline)===null||r===void 0?void 0:r.rules2;o&&this.inline.ruler2.enableOnly(o)}return this}enable(e,t=!1){let n=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(o=>{n=n.concat(this[o].ruler.enable(e,!0))}),n=n.concat(this.inline.ruler2.enable(e,!0));const r=e.filter(o=>n.indexOf(o)<0);if(r.length&&!t)throw new Error(`MarkdownIt. Failed to enable unknown rule(s): ${r}`);return this}disable(e,t=!1){let n=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(o=>{n=n.concat(this[o].ruler.disable(e,!0))}),n=n.concat(this.inline.ruler2.disable(e,!0));const r=e.filter(o=>n.indexOf(o)<0);if(r.length&&!t)throw new Error(`MarkdownIt. Failed to disable unknown rule(s): ${r}`);return this}use(e,...t){return e.apply(e,[this,...t]),this}parse(e,t){if(typeof e!="string")throw new Error("Input data should be a String");const n=new this.core.State(e,this,t);return this.core.process(n),n.tokens}render(e,t={}){return this.renderer.render(this.parse(e,t),this.options,t)}parseInline(e,t){const n=new this.core.State(e,this,t);return n.inlineMode=!0,this.core.process(n),n.tokens}renderInline(e,t={}){return this.renderer.render(this.parseInline(e,t),this.options,t)}};xe(Vt,"Token",Fn);xe(Vt,"Ruler",Or);xe(Vt,"Renderer",Rf);xe(Vt,"ParserCore",Bf);xe(Vt,"StateCore",Df);xe(Vt,"ParserBlock",Tf);xe(Vt,"StateBlock",Mf);xe(Vt,"ParserInline",Hf);xe(Vt,"StateInline",Nf);var By=wf(Vt),Ls,Dc;function My(){return Dc||(Dc=1,Ls=function(t,n){var r=3,o="-",s=o.charCodeAt(0),i=o.length;function a(c,u,f,h){var g,A,p,m,x,C,b,v=!1,y=c.bMarks[u]+c.tShift[u],w=c.eMarks[u];if(u!==0||s!==c.src.charCodeAt(0))return!1;for(g=y+1;g<=w;g++)if(o[(g-y)%i]!==c.src[g]){b=g+1;break}if(p=Math.floor((g-y)/i),p<r)return!1;if(g-=(g-y)%i,h)return!0;for(A=u;A++,!(A>=f||c.src.slice(y,w)==="..."||(y=c.bMarks[A]+c.tShift[A],w=c.eMarks[A],y<w&&c.sCount[A]<c.blkIndent));)if(s===c.src.charCodeAt(y)&&!(c.sCount[A]-c.blkIndent>=4)){for(g=y+1;g<=w&&o[(g-y)%i]===c.src[g];g++);if(!(Math.floor((g-y)/i)<p)&&(g-=(g-y)%i,g=c.skipSpaces(g),!(g<w))){v=!0;break}}return x=c.parentType,C=c.lineMax,c.parentType="container",c.lineMax=A,m=c.push("front_matter",null,0),m.hidden=!0,m.markup=c.src.slice(u,g),m.block=!0,m.map=[u,A+(v?1:0)],m.meta=c.src.slice(b,y-1),c.parentType=x,c.lineMax=C,c.line=A+(v?1:0),n(m.meta),!0}t.block.ruler.before("table","front_matter",a,{alt:["paragraph","reference","blockquote","list"]})}),Ls}var jy=My();const Py=wp(jy);var Ty=Object.defineProperty,Ny=Object.defineProperties,_y=Object.getOwnPropertyDescriptors,Fc=Object.getOwnPropertySymbols,Oy=Object.prototype.hasOwnProperty,Hy=Object.prototype.propertyIsEnumerable,Bc=(e,t,n)=>t in e?Ty(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,at=(e,t)=>{for(var n in t||(t={}))Oy.call(t,n)&&Bc(e,n,t[n]);if(Fc)for(var n of Fc(t))Hy.call(t,n)&&Bc(e,n,t[n]);return e},Hr=(e,t)=>Ny(e,_y(t)),To=(e,t,n)=>new Promise((r,o)=>{var s=c=>{try{a(n.next(c))}catch(u){o(u)}},i=c=>{try{a(n.throw(c))}catch(u){o(u)}},a=c=>c.done?r(c.value):Promise.resolve(c.value).then(s,i);a((n=n.apply(e,t)).next())});function Ly(e,t){return typeof e=="function"?e(t):e}function Lr(e,t){return n=>{t.setState(r=>Hr(at({},r),{[e]:Ly(n,r[e])}))}}var Mc=(e,t=100,n=1e3)=>new Promise(r=>{let o;const s=setInterval(()=>{e()&&(r(),clearInterval(s),clearTimeout(o))},t);o=setTimeout(()=>{clearInterval(s),r()},n)}),Lf="Headless Tree: ",mi=e=>Error(Lf+e),Ky=e=>console.warn(Lf+e),Wy={key:"tree",getInitialState:e=>at({expandedItems:[],focusedItem:null},e),getDefaultConfig:(e,t)=>at({setExpandedItems:Lr("expandedItems",t),setFocusedItem:Lr("focusedItem",t)},e),stateHandlerNames:{expandedItems:"setExpandedItems",focusedItem:"setFocusedItem"},treeInstance:{getItemsMeta:({tree:e})=>{const{rootItemId:t}=e.getConfig(),{expandedItems:n}=e.getState(),r=[],o=new Set(n),s=(c,u,f,h,g)=>{var A;if(u.includes(c)){Ky(`Circular reference for ${u.join(".")}`);return}if(r.push({itemId:c,level:f,index:r.length,parentId:u.at(-1),setSize:h,posInSet:g}),o.has(c)){const p=(A=e.retrieveChildrenIds(c))!=null?A:[];let m=0;for(const x of p)s(x,u.concat(c),f+1,p.length,m++)}},i=e.retrieveChildrenIds(t);let a=0;for(const c of i)s(c,[t],0,i.length,a++);return r},getFocusedItem:({tree:e})=>{var t;const n=e.getState().focusedItem;return(t=n!==null?e.getItemInstance(n):null)!=null?t:e.getItems()[0]},getRootItem:({tree:e})=>{const{rootItemId:t}=e.getConfig();return e.getItemInstance(t)},focusNextItem:({tree:e})=>{var t;const n=e.getFocusedItem().getItemMeta();if(!n)return;const r=Math.min(n.index+1,e.getItems().length-1);(t=e.getItems()[r])==null||t.setFocused()},focusPreviousItem:({tree:e})=>{var t;const n=e.getFocusedItem().getItemMeta();if(!n)return;const r=Math.max(n.index-1,0);(t=e.getItems()[r])==null||t.setFocused()},updateDomFocus:({tree:e})=>{setTimeout(()=>To(null,null,function*(){var t,n,r,o,s;const i=e.getFocusedItem();(n=(t=e.getConfig()).scrollToItem)==null||n.call(t,i),yield Mc(()=>i.getElement()!==null,20,500);const a=i.getElement();if(!a){(r=e.getItems()[0])==null||r.setFocused(),(s=(o=e.getItems()[0])==null?void 0:o.getElement())==null||s.focus();return}a.focus()}))},getContainerProps:({prev:e,tree:t},n)=>Hr(at({},e?.()),{role:"tree","aria-label":n??"",ref:t.registerElement}),isSearchOpen:()=>!1},itemInstance:{scrollTo:(e,t)=>To(null,[e,t],function*({tree:n,item:r},o){var s,i,a;(i=(s=n.getConfig()).scrollToItem)==null||i.call(s,r),yield Mc(()=>r.getElement()!==null,20),(a=r.getElement())==null||a.scrollIntoView(o)}),getId:({itemId:e})=>e,getKey:({itemId:e})=>e,getProps:({item:e,prev:t})=>{const n=e.getItemMeta();return Hr(at({},t?.()),{ref:e.registerElement,role:"treeitem","aria-setsize":n.setSize,"aria-posinset":n.posInSet+1,"aria-selected":"false","aria-label":e.getItemName(),"aria-level":n.level+1,"aria-expanded":e.isFolder()?e.isExpanded():void 0,tabIndex:e.isFocused()?0:-1,onClick:r=>{e.setFocused(),e.primaryAction(),!(r.ctrlKey||r.shiftKey||r.metaKey)&&e.isFolder()&&(e.isExpanded()?e.collapse():e.expand())}})},expand:({tree:e,item:t,itemId:n})=>{var r;t.isFolder()&&((r=e.getState().loadingItemChildrens)!=null&&r.includes(n)||(e.applySubStateUpdate("expandedItems",o=>[...o,n]),e.rebuildTree()))},collapse:({tree:e,item:t,itemId:n})=>{t.isFolder()&&(e.applySubStateUpdate("expandedItems",r=>r.filter(o=>o!==n)),e.rebuildTree())},getItemData:({tree:e,itemId:t})=>e.retrieveItemData(t),equals:({item:e},t)=>e.getId()===t?.getId(),isExpanded:({tree:e,itemId:t})=>e.getState().expandedItems.includes(t),isDescendentOf:({item:e},t)=>{const n=e.getParent();return!!(n?.getId()===t||n?.isDescendentOf(t))},isFocused:({tree:e,item:t,itemId:n})=>e.getState().focusedItem===n||e.getState().focusedItem===null&&t.getItemMeta().index===0,isFolder:({tree:e,item:t,itemId:n})=>n===e.getConfig().rootItemId||e.getConfig().isItemFolder(t),getItemName:({tree:e,item:t})=>e.getConfig().getItemName(t),setFocused:({tree:e,itemId:t})=>{e.applySubStateUpdate("focusedItem",t)},primaryAction:({tree:e,item:t})=>{var n,r;return(r=(n=e.getConfig()).onPrimaryAction)==null?void 0:r.call(n,t)},getParent:({tree:e,item:t})=>t.getItemMeta().parentId?e.getItemInstance(t.getItemMeta().parentId):void 0,getIndexInParent:({item:e})=>e.getItemMeta().posInSet,getChildren:({tree:e,itemId:t})=>e.retrieveChildrenIds(t).map(n=>e.getItemInstance(n)),getTree:({tree:e})=>e,getItemAbove:({tree:e,item:t})=>e.getItems()[t.getItemMeta().index-1],getItemBelow:({tree:e,item:t})=>e.getItems()[t.getItemMeta().index+1]},hotkeys:{focusNextItem:{hotkey:"ArrowDown",canRepeat:!0,preventDefault:!0,isEnabled:e=>{var t,n;return!((n=(t=e.isSearchOpen)==null?void 0:t.call(e))!=null&&n)&&!e.getState().dnd},handler:(e,t)=>{t.focusNextItem(),t.updateDomFocus()}},focusPreviousItem:{hotkey:"ArrowUp",canRepeat:!0,preventDefault:!0,isEnabled:e=>{var t,n;return!((n=(t=e.isSearchOpen)==null?void 0:t.call(e))!=null&&n)&&!e.getState().dnd},handler:(e,t)=>{t.focusPreviousItem(),t.updateDomFocus()}},expandOrDown:{hotkey:"ArrowRight",canRepeat:!0,handler:(e,t)=>{const n=t.getFocusedItem();n.isExpanded()||!n.isFolder()?(t.focusNextItem(),t.updateDomFocus()):n.expand()}},collapseOrUp:{hotkey:"ArrowLeft",canRepeat:!0,handler:(e,t)=>{var n;const r=t.getFocusedItem();(!r.isExpanded()||!r.isFolder())&&r.getItemMeta().level!==0?((n=r.getParent())==null||n.setFocused(),t.updateDomFocus()):r.collapse()}},focusFirstItem:{hotkey:"Home",handler:(e,t)=>{var n;(n=t.getItems()[0])==null||n.setFocused(),t.updateDomFocus()}},focusLastItem:{hotkey:"End",handler:(e,t)=>{var n;(n=t.getItems()[t.getItems().length-1])==null||n.setFocused(),t.updateDomFocus()}}}},Qy=(e,t,n)=>{const r={};return[r,()=>{const s=n(r);e:for(let i=0;i<e.length;i++){const a=e[i][t];if(!a)continue e;t:for(const[c,u]of Object.entries(a)){if(!u)continue t;const f=r[c];r[c]=(...h)=>u(Hr(at({},s),{prev:f}),...h)}}}]},Gy=e=>{var t;const n=e?.map(r=>r.key);for(const r of e??[]){const o=(t=r.deps)==null?void 0:t.find(s=>!n?.includes(s));if(o)throw mi(`${r.key} needs ${o}`)}},Yy=(e,t)=>{const n=e.length;for(let r=0;r<n;r++)for(let o=r+1;o<n;o++)t(e[o],e[r])<0&&([e[r],e[o]]=[e[o],e[r]]);return e},zy=e=>(t,n)=>{var r,o;return n.key&&((r=t.overwrites)!=null&&r.includes(n.key))?1:t.key&&((o=n.overwrites)!=null&&o.includes(t.key))?-1:e.indexOf(t)-e.indexOf(n)},Uy=(e=[])=>Yy(e,zy(e)),Vy=e=>{var t,n,r,o;const s=(t=e.instanceBuilder)!=null?t:Qy,i=[Wy,...Uy(e.features)];Gy(i);const a=[...i],[c,u]=s(a,"treeInstance",R=>({tree:R}));let f=i.reduce((R,k)=>{var F,T;return(T=(F=k.getInitialState)==null?void 0:F.call(k,R,c))!=null?T:R},(r=(n=e.initialState)!=null?n:e.state)!=null?r:{}),h=i.reduce((R,k)=>{var F,T;return(T=(F=k.getDefaultConfig)==null?void 0:F.call(k,R,c))!=null?T:R},e);const g=i.reduce((R,k)=>at(at({},R),k.stateHandlerNames),{});let A;const p={current:{}};let m=!1;const x={};let C=[];const b={},v={};let y={};const w={},I=()=>{C=[],y={};const[R,k]=s(a,"itemInstance",F=>({item:F,tree:c,itemId:h.rootItemId}));k(),x[h.rootItemId]=R,y[h.rootItemId]={itemId:h.rootItemId,index:-1,parentId:null,level:-1,posInSet:0,setSize:1};for(const F of c.getItemsMeta())if(y[F.itemId]=F,x[F.itemId])C.push(x[F.itemId]);else{const[T,N]=s(a,"itemInstance",j=>({item:j,tree:c,itemId:F.itemId}));N(),x[F.itemId]=T,C.push(T)}m=!1},E=R=>{for(const k of i)R(k)},S={key:"main",treeInstance:{getState:()=>f,setState:({},R)=>{var k;(k=h.setState)==null||k.call(h,f)},setMounted:({},R)=>{var k;const F=p.current;F.isMounted=R,R&&((k=F.waitingForMount)==null||k.forEach(T=>T()),F.waitingForMount=[])},applySubStateUpdate:({},R,k)=>{var F;const T=()=>{f[R]=typeof k=="function"?k(f[R]):k;const j=h[g[R]];j?.(f[R])},N=p.current;N.isMounted?T():((F=N.waitingForMount)!=null||(N.waitingForMount=[]),N.waitingForMount.push(T))},rebuildTree:()=>{var R,k;const F=p.current;F.isMounted?(I(),(R=h.setState)==null||R.call(h,f)):((k=F.waitingForMount)!=null||(F.waitingForMount=[]),F.waitingForMount.push(()=>{var T;I(),(T=h.setState)==null||T.call(h,f)}))},scheduleRebuildTree:()=>{m=!0},getConfig:()=>h,setConfig:(R,k)=>{var F,T,N;const j=typeof k=="function"?k(h):k,D=((F=j.state)==null?void 0:F.expandedItems)&&((T=j.state)==null?void 0:T.expandedItems)!==f.expandedItems;h=j,j.state&&(f=at(at({},f),j.state)),D&&(I(),(N=h.setState)==null||N.call(h,f))},getItemInstance:({},R)=>{const k=x[R];if(!k){const[F,T]=s(a,"itemInstance",N=>({item:N,tree:c,itemId:R}));return T(),F}return k},getItems:()=>(m&&I(),C),registerElement:({},R)=>{A!==R&&(A&&!R?E(k=>{var F;return(F=k.onTreeUnmount)==null?void 0:F.call(k,c,A)}):!A&&R&&E(k=>{var F;return(F=k.onTreeMount)==null?void 0:F.call(k,c,R)}),A=R)},getElement:()=>A,getDataRef:()=>p,getHotkeyPresets:()=>w},itemInstance:{registerElement:({itemId:R,item:k},F)=>{if(b[R]===F)return;const T=b[R];T&&!F?E(N=>{var j;return(j=N.onItemUnmount)==null?void 0:j.call(N,k,T,c)}):!T&&F&&E(N=>{var j;return(j=N.onItemMount)==null?void 0:j.call(N,k,F,c)}),b[R]=F},getElement:({itemId:R})=>b[R],getDataRef:({itemId:R})=>{var k;return(k=v[R])!=null?k:v[R]={current:{}}},getItemMeta:({itemId:R})=>{var k;return(k=y[R])!=null?k:{itemId:R,parentId:null,level:-1,index:-1,posInSet:0,setSize:1}}}};a.unshift(S);for(const R of a)Object.assign(w,(o=R.hotkeys)!=null?o:{});return u(),c},Zy={key:"selection",getInitialState:e=>at({selectedItems:[]},e),getDefaultConfig:(e,t)=>at({setSelectedItems:Lr("selectedItems",t)},e),stateHandlerNames:{selectedItems:"setSelectedItems"},treeInstance:{setSelectedItems:({tree:e},t)=>{e.applySubStateUpdate("selectedItems",t)},getSelectedItems:({tree:e})=>e.getState().selectedItems.map(e.getItemInstance)},itemInstance:{select:({tree:e,itemId:t})=>{const{selectedItems:n}=e.getState();e.setSelectedItems(n.includes(t)?n:[...n,t])},deselect:({tree:e,itemId:t})=>{const{selectedItems:n}=e.getState();e.setSelectedItems(n.filter(r=>r!==t))},isSelected:({tree:e,itemId:t})=>{const{selectedItems:n}=e.getState();return n.includes(t)},selectUpTo:({tree:e,item:t,itemId:n},r)=>{const o=t.getItemMeta().index,s=e.getDataRef();if(!s.current.selectUpToAnchorId){s.current.selectUpToAnchorId=n,e.setSelectedItems([n]);return}const a=e.getItemInstance(s.current.selectUpToAnchorId).getItemMeta().index,[c,u]=o<a?[o,a]:[a,o],f=e.getItems().slice(c,u+1).map(A=>A.getItemMeta().itemId);if(!r){e.setSelectedItems(f);return}const{selectedItems:h}=e.getState(),g=[...new Set([...h,...f])];e.setSelectedItems(g)},toggleSelect:({item:e})=>{e.isSelected()?e.deselect():e.select()},getProps:({tree:e,item:t,itemId:n,prev:r})=>Hr(at({},r?.()),{"aria-selected":t.isSelected()?"true":"false",onClick:o=>{var s,i;o.shiftKey?t.selectUpTo(o.ctrlKey||o.metaKey):o.ctrlKey||o.metaKey?t.toggleSelect():e.setSelectedItems([n]),o.shiftKey||(e.getDataRef().current.selectUpToAnchorId=n),(i=(s=r?.())==null?void 0:s.onClick)==null||i.call(s,o)}})},hotkeys:{toggleSelectedItem:{hotkey:"Control+Space",preventDefault:!0,handler:(e,t)=>{t.getFocusedItem().toggleSelect()}},selectUpwards:{hotkey:"Shift+ArrowUp",handler:(e,t)=>{const n=t.getFocusedItem(),r=n.getItemAbove();r&&(n.isSelected()&&r.isSelected()?n.deselect():r.select(),r.setFocused(),t.updateDomFocus())}},selectDownwards:{hotkey:"Shift+ArrowDown",handler:(e,t)=>{const n=t.getFocusedItem(),r=n.getItemBelow();r&&(n.isSelected()&&r.isSelected()?n.deselect():r.select(),r.setFocused(),t.updateDomFocus())}},selectAll:{hotkey:"Control+KeyA",preventDefault:!0,handler:(e,t)=>{t.setSelectedItems(t.getItems().map(n=>n.getId()))}}}},jc=e=>e.code!==""&&e.code!=="Unidentified"?e.code:e.key,Pc={letter:/^Key[A-Z]$/,letterornumber:/^(Key[A-Z]|Digit[0-9])$/,plus:/^(NumpadAdd|Plus)$/,minus:/^(NumpadSubtract|Minus)$/,control:/^(ControlLeft|ControlRight)$/,shift:/^(ShiftLeft|ShiftRight)$/,metaorcontrol:/^(MetaLeft|MetaRight|ControlLeft|ControlRight)$/,enter:/^(Enter|NumpadEnter)$/},Tc=new Set(["MetaLeft","MetaRight","Meta","ControlLeft","ControlRight","Control","AltLeft","AltRight","Alt","ShiftLeft","ShiftRight","Shift"]),Jy=(e,t,n)=>{const r=n.hotkey.toLowerCase().split("+"),o=r.every(i=>{if(i in Pc)return[...e].some(c=>Pc[i].test(c));const a=[...e].map(c=>c.toLowerCase());return a.includes(i.toLowerCase())||a.includes(`key${i.toLowerCase()}`)}),s=!n.isEnabled||n.isEnabled(t);return o&&s&&e.size===r.length},$y=(e,t,n,r)=>{var o;return(o=Object.entries(at(at({},n),r)).find(([,s])=>Jy(e,t,s)))==null?void 0:o[0]},Ks={clearPressedKeys:e=>{e.current.pressedKeys=new Set},dispatchKeyDown:(e,t,n,r={})=>{var o,s,i,a,c;const{isInputFocused:u=!1,releaseAfterDispatch:f=!1}=r,{ignoreHotkeysOnInputs:h,onTreeHotkey:g,hotkeys:A}=e.getConfig();if(u&&h)return;const p=jc({code:(o=n.code)!=null?o:"",key:(s=n.key)!=null?s:""});(a=(i=t.current).pressedKeys)!=null||(i.pressedKeys=new Set);const m=!t.current.pressedKeys.has(p);p&&t.current.pressedKeys.add(p);const x=$y(t.current.pressedKeys,e,e.getHotkeyPresets(),A);if(f&&p&&t.current.pressedKeys.delete(p),!x)return;const C=at(at({},e.getHotkeyPresets()[x]),A?.[x]);C&&(!C.allowWhenInputFocused&&u||!C.canRepeat&&!m||(C.preventDefault&&((c=n.preventDefault)==null||c.call(n)),C.handler(n,e),g?.(x,n)))},dispatchKeyUp:(e,t)=>{var n,r,o,s;const i=jc({code:(n=t.code)!=null?n:"",key:(r=t.key)!=null?r:""});i&&((s=(o=e.current).pressedKeys)!=null||(o.pressedKeys=new Set),Tc.has(i)&&(e.current.pressedKeys=new Set([...e.current.pressedKeys].filter(a=>Tc.has(a)))),e.current.pressedKeys.delete(i))}},Xy={key:"hotkeys-core",onTreeMount:(e,t)=>{const n=e.getDataRef(),r=i=>{const a=i.target instanceof HTMLInputElement;Ks.dispatchKeyDown(e,n,i,{isInputFocused:a,releaseAfterDispatch:a})},o=i=>{Ks.dispatchKeyUp(n,i)},s=()=>{Ks.clearPressedKeys(n)};t.addEventListener("keydown",r),document.addEventListener("keyup",o),window.addEventListener("focus",s),n.current.keydownHandler=r,n.current.keyupHandler=o,n.current.resetHandler=s},onTreeUnmount:(e,t)=>{const n=e.getDataRef();n.current.keyupHandler&&(document.removeEventListener("keyup",n.current.keyupHandler),delete n.current.keyupHandler),n.current.keydownHandler&&(t.removeEventListener("keydown",n.current.keydownHandler),delete n.current.keydownHandler),n.current.resetHandler&&(window.removeEventListener("focus",n.current.resetHandler),delete n.current.resetHandler)}},qy="sync dataLoader returned undefined",eC="sync dataLoader returned promise",Ws=e=>{if(!e)throw mi(qy);if(typeof e=="object"&&"then"in e)throw mi(eC);return e},tC={key:"sync-data-loader",getInitialState:e=>at({loadingItemData:[],loadingItemChildrens:[]},e),getDefaultConfig:(e,t)=>at({setLoadingItemData:Lr("loadingItemData",t),setLoadingItemChildrens:Lr("loadingItemChildrens",t)},e),stateHandlerNames:{loadingItemData:"setLoadingItemData",loadingItemChildrens:"setLoadingItemChildrens"},treeInstance:{waitForItemDataLoaded:()=>To(null,null,function*(){}),waitForItemChildrenLoaded:()=>To(null,null,function*(){}),retrieveItemData:({tree:e},t)=>Ws(e.getConfig().dataLoader.getItem(t)),retrieveChildrenIds:({tree:e},t)=>{const{dataLoader:n}=e.getConfig();return"getChildren"in n?Ws(n.getChildren(t)):Ws(n.getChildrenWithData(t)).map(r=>r.data)},loadItemData:({tree:e},t)=>e.retrieveItemData(t),loadChildrenIds:({tree:e},t)=>e.retrieveChildrenIds(t)},itemInstance:{isLoading:()=>!1,hasLoadedData:()=>!0}},nC=Object.defineProperty,rC=Object.defineProperties,oC=Object.getOwnPropertyDescriptors,Nc=Object.getOwnPropertySymbols,sC=Object.prototype.hasOwnProperty,iC=Object.prototype.propertyIsEnumerable,_c=(e,t,n)=>t in e?nC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,co=(e,t)=>{for(var n in t||(t={}))sC.call(t,n)&&_c(e,n,t[n]);if(Nc)for(var n of Nc(t))iC.call(t,n)&&_c(e,n,t[n]);return e},aC=(e,t)=>rC(e,oC(t)),lC=e=>{const[t]=d.useState(()=>({current:Vy(e)})),[n,r]=d.useState(()=>t.current.getState());return d.useEffect(()=>(t.current.setMounted(!0),t.current.rebuildTree(),()=>{t.current.setMounted(!1)}),[t]),t.current.setConfig(o=>aC(co(co({},o),e),{state:co(co({},n),e.state),setState:s=>{var i;r(s),(i=e.setState)==null||i.call(e,s)}})),t.current};const cC=/^(https?:|mailto:|#|\.\/|#\/)/iu,uC=e=>e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;"),jn=By({html:!1,linkify:!0,typographer:!1,breaks:!1});Py(jn,()=>{});jn.core.ruler.push("render_front_matter",e=>{for(const t of e.tokens)t.type==="front_matter"&&(t.type="fence",t.tag="code",t.info="yaml",t.content=String(t.meta??"").replace(/\n$/,""),t.block=!0);return!0});jn.validateLink=e=>cC.test(e.trim());const Kf=e=>{for(const t of e)t.type==="link_open"&&(t.attrSet("rel","noreferrer noopener"),t.attrSet("target","_blank")),t.children!==null&&Kf(t.children)};jn.core.ruler.push("external_links",e=>(Kf(e.tokens),!0));jn.renderer.rules.fence=(e,t)=>{const n=e[t];return`<pre class="tech-ltr"><code${n.info.trim().length>0?` class="language-${uC(n.info.trim())}"`:""}>${jn.utils.escapeHtml(n.content)}</code></pre>
19
+ `};const dC=e=>jn.render(e),fC=["prose prose-sm","dark:prose-invert","max-w-[75ch]","prose-headings:font-semibold prose-headings:tracking-tight","prose-h1:text-xl prose-h2:text-lg prose-h3:text-base","prose-p:my-2 prose-li:my-0.5","prose-code:before:content-none prose-code:after:content-none","prose-code:font-mono prose-code:text-[0.85em]","prose-pre:bg-muted prose-pre:text-foreground prose-pre:rounded-lg","prose-a:text-primary prose-a:decoration-primary/40 hover:prose-a:decoration-primary","prose-table:border-collapse prose-table:text-xs","prose-th:border prose-th:border-border prose-th:bg-muted prose-th:px-2 prose-th:py-1 prose-th:text-start prose-th:font-semibold","prose-td:border prose-td:border-border prose-td:px-2 prose-td:py-1 prose-td:align-top","prose-td:font-mono","prose-hr:border-border prose-blockquote:border-primary/40"].join(" "),pC=(e,t)=>e.children!==void 0?t?l.jsx(qp,{"aria-hidden":!0,className:"pointer-events-none size-4 text-amber-500"}):l.jsx(th,{"aria-hidden":!0,className:"pointer-events-none size-4 text-amber-500"}):l.jsx($p,{"aria-hidden":!0,className:"pointer-events-none size-4 text-muted-foreground"}),Oc=16,hC=({entries:e,selected:t,onSelect:n})=>{const r=d.useMemo(()=>{const c=new Map;for(const f of e){const h=f.path.split("/"),g=h[h.length-1]??f.path;f.type==="directory"?c.set(f.path,{name:g,path:f.path,children:[]}):c.set(f.path,{name:g,path:f.path})}for(const f of e){const h=f.path.split("/");for(let g=1;g<h.length;g+=1){const A=h.slice(0,g).join("/");c.has(A)||c.set(A,{name:h[g-1]??A,path:A,children:[]})}}for(const f of c.values())f.children!==void 0&&(f.children=[...c.values()].filter(h=>h.path!==""&&h.path.split("/").slice(0,-1).join("/")===f.path).map(h=>h.path));const u={name:"skill",path:"",children:[]};return u.children=[...c.values()].filter(f=>f.path!==""&&f.path.split("/").length===1).map(f=>f.path),c.set("root",u),Object.fromEntries(c)},[e]),o=d.useMemo(()=>Object.values(r).filter(c=>c.children!==void 0&&c.path!=="").map(c=>c.path),[r]),[s,i]=d.useState([t]),a=lC({initialState:{selectedItems:[t],expandedItems:o},setSelectedItems:c=>{i(u=>{const f=typeof c=="function"?c(u):c,h=f[0];return h!==void 0&&r[h]?.children===void 0&&h!=="root"&&n(h),f})},indent:Oc,rootItemId:"root",getItemName:c=>c.getItemData().name,isItemFolder:c=>(c.getItemData()?.children?.length??0)>0,dataLoader:{getItem:c=>r[c]??{name:c,path:""},getChildren:c=>r[c]?.children??[]},features:[tC,Zy,Xy]});return l.jsx(ub,{indent:Oc,tree:a,children:a.getItems().map(c=>{const u=c.getItemData(),f=u.children===void 0&&u.path!=="";return l.jsx(db,{item:c,onClick:()=>{f&&n(u.path)},children:l.jsx(fb,{className:"tech-ltr relative before:bg-background before:absolute before:inset-x-0 before:-inset-y-0.5 before:-z-10",children:l.jsxs("span",{className:"flex items-center gap-2",children:[pC(u,c.isExpanded()),c.getItemName()]})})},c.getId())})})},AC=()=>{const{messages:e}=ps(),[t,n]=d.useState([]),[r,o]=d.useState("SKILL.md"),[s,i]=d.useState(null),[a,c]=d.useState(null),[u,f]=d.useState(!0),[h,g]=d.useState(!1);d.useEffect(()=>{(async()=>{const p=await hx();p.status===200?n(p.data):c(e.help.readError),f(!1)})()},[e.help.readError]),d.useEffect(()=>{g(!0),c(null),(async()=>{const p=await Ax(r);p.status===200&&"content"in p.data?i(p.data.content):(i(null),c(e.help.readError)),g(!1)})()},[r,e.help.readError]);const A=d.useMemo(()=>s===null?"":dC(s),[s]);return l.jsxs("section",{className:"flex h-full min-h-0 overflow-hidden","aria-label":e.help.title,children:[l.jsx("nav",{className:"w-64 shrink-0 overflow-y-auto border-e border-border p-2","aria-label":e.help.listTitle,children:u?l.jsxs("div",{className:"space-y-2",children:[l.jsx(qt,{className:"h-5 w-full"}),l.jsx(qt,{className:"h-5 w-4/5"}),l.jsx(qt,{className:"h-5 w-3/5"})]}):t.length===0?l.jsx("p",{className:"text-muted-foreground px-2 text-xs",children:e.help.empty}):l.jsx(hC,{entries:t,selected:r,onSelect:o})}),l.jsx("article",{className:"min-h-0 min-w-0 flex-1 overflow-y-auto p-6","aria-live":"polite",children:h?l.jsxs("div",{className:"space-y-2",children:[l.jsx(qt,{className:"h-6 w-1/2"}),l.jsx(qt,{className:"h-4 w-full"}),l.jsx(qt,{className:"h-4 w-5/6"})]}):a!==null?l.jsx("p",{className:"text-destructive text-sm",children:a}):l.jsx("div",{className:fC,dangerouslySetInnerHTML:{__html:A}})})]})},Wf=e=>`/api/icon-composed/${e}?token=${encodeURIComponent(new URLSearchParams(location.search).get("token")??"")}`,gC={cwd:"",env:[],argsMode:"string",family:null},La=new URLSearchParams(location.search).get("token")??"",Qe=(e,t={})=>fetch(e,{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${La}`},body:JSON.stringify(t)}),mC=()=>new EventSource(`/api/events?token=${encodeURIComponent(La)}`),Wn=(e,t)=>`/api/icon-data/${e}/${t}?token=${encodeURIComponent(La)}`,xC=e=>{try{return new URL(e).hostname}catch{return e}};function bC({values:e,defaults:t,frozen:n,iconCandidates:r,iconCandidatesPort:o,uploadedIconUrl:s,selectedIconRef:i,iconAnalysis:a,iconComposition:c,iconComposeError:u,iconBackground:f,iconScale:h,onIconBackgroundChange:g,onIconScaleChange:A,onPickIconCandidate:p,onUploadIcon:m,onClearIcon:x,onPatch:C}){const b=n,v=d.useRef(null),[y,w]=d.useState(!1);return l.jsxs("div",{className:"grid grid-cols-1 gap-y-1",children:[l.jsxs("div",{children:[l.jsx(je,{children:"应用图标"}),l.jsxs("div",{className:"mt-1.5 flex flex-wrap items-start gap-3",children:[l.jsx("button",{type:"button",disabled:b,"aria-label":"选择本地图片作为应用图标",onClick:()=>v.current?.click(),onDragOver:I=>{I.preventDefault(),b||w(!0)},onDragLeave:()=>w(!1),onDrop:I=>{if(I.preventDefault(),w(!1),b)return;const E=I.dataTransfer.files[0];E!==void 0&&m(E)},className:fe("flex size-20 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-dashed border-border bg-popover transition-colors",b?"opacity-50":"hover:border-primary",y&&"border-primary bg-primary/10"),children:s!==void 0?l.jsx("img",{src:s,alt:"已选图标",className:"icon-checker size-full rounded object-contain"}):l.jsxs("span",{className:"flex flex-col items-center gap-1 text-muted-foreground",children:[l.jsx(fu,{className:"size-4"}),l.jsx("span",{className:"text-[10px] leading-tight",children:"点击或拖入图片"})]})}),l.jsx("input",{ref:v,type:"file",accept:"image/png,image/jpeg,image/svg+xml,image/webp,image/gif",className:"hidden",disabled:b,onChange:I=>{const E=I.target.files?.[0];E!==void 0&&m(E),I.target.value=""}}),l.jsx("div",{className:"flex flex-1 flex-wrap items-center gap-2",children:r.length===0?l.jsx("span",{className:"text-xs text-muted-foreground",children:"未抓取到候选图标;将使用首字母图标"}):r.map(I=>{const E=o===void 0?void 0:Wn(o,I.index),S=i===`${o}:${I.index}`,R=i===void 0&&I.index===0;return l.jsx("button",{type:"button",disabled:b,title:`${I.width}×${I.height} ${I.format.toUpperCase()}`,onClick:()=>p(I),className:fe("icon-checker flex size-14 items-center justify-center overflow-hidden rounded-lg border p-1 transition-all",S||R?"border-primary ring-2 ring-primary/60":"border-border hover:border-primary/60",b&&"opacity-50"),children:E!==void 0?l.jsx("img",{src:E,alt:`候选图标 ${I.width}×${I.height}`,className:"size-full object-contain"}):null},I.index)})}),i!==void 0||s!==void 0?l.jsx("button",{type:"button",disabled:b,onClick:x,className:"text-[11px] text-muted-foreground underline-offset-2 hover:underline",children:"清除选择(回到默认)"}):null]}),l.jsx("div",{className:"mt-3 rounded-lg border border-border p-3",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{role:"img",className:"icon-checker size-14 shrink-0 overflow-hidden rounded-[10px]","aria-label":"图标合成预览",children:c!==void 0?l.jsx("img",{src:Wf(c.key),alt:"图标合成预览",className:"size-full object-contain",onError:I=>{I.currentTarget.style.display="none"}}):l.jsx("span",{className:"flex size-full items-center justify-center text-[10px] text-muted-foreground",children:"预览"})}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx(je,{children:"图标背景"}),l.jsx("div",{className:"mt-1.5 flex gap-1.5",children:["black","white","transparent"].map(I=>l.jsxs("button",{type:"button",disabled:b,"aria-pressed":f===I,onClick:()=>g(I),className:fe("flex h-7 items-center gap-1.5 rounded-md border px-2.5 text-[11px] transition-colors",f===I?"border-foreground bg-secondary text-secondary-foreground":"border-border text-muted-foreground hover:border-foreground/40"),children:[I==="black"?"黑色":I==="white"?"白色":"透明",a!==void 0&&a.suggested===I?l.jsx("span",{className:"text-[10px] text-muted-foreground/70",children:"自动"}):null]},I))}),l.jsxs("div",{className:"mt-2.5",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(je,{className:"text-[11px]",children:"前景缩放"}),l.jsxs("span",{className:"text-[11px] tabular-nums text-muted-foreground",children:[Math.round(h*100),"%"]})]}),l.jsx("input",{type:"range",min:50,max:95,step:5,value:Math.round(h*100),disabled:b,onChange:I=>A(Number(I.target.value)/100),className:"mt-1 w-full accent-foreground","aria-label":"前景图标缩放"})]}),u!==void 0?l.jsx("p",{role:"alert",className:"mt-1.5 text-[11px] font-medium text-red-400",children:u}):null,a!==void 0?l.jsx("p",{className:"mt-1.5 text-[11px] leading-relaxed text-muted-foreground",children:f==="transparent"?"透明背景:原始像素直接透出。":`已按明暗自动选择${a.suggested===f?"":"(已手动覆盖)"}:${a.luminance===void 0?"无法分析明暗":`前景明度 ${a.luminance.toFixed(2)}、覆盖率 ${(a.coverage*100).toFixed(0)}%`}。`}):null]})]})})]}),l.jsxs("div",{children:[l.jsx(je,{htmlFor:"appId",children:"App ID"}),l.jsx(et,{id:"appId",className:"mt-1 font-mono",disabled:b,value:e.appId,placeholder:t.appId||"由命令推导(如 start.somecommand.npx)",onChange:I=>C({appId:I.target.value})})]}),l.jsxs("div",{children:[l.jsx(je,{htmlFor:"appName",children:"应用名称"}),l.jsx(et,{id:"appName",className:"mt-1",disabled:b,value:e.appName,placeholder:t.appName||"从服务页面标题抓取",onChange:I=>C({appName:I.target.value})})]})]})}function vC({candidates:e,port:t,disabled:n,selectedRef:r,uploadedUrl:o,includeVariants:s,defaultLabel:i,onPick:a,onUpload:c,onClear:u}){const f=d.useRef(null),[h,g]=d.useState(!1),A=s?e:e.filter(m=>m.variant==="original"),p=e.filter(m=>m.variant==="original");return l.jsxs("div",{className:"flex flex-wrap items-start gap-3",children:[l.jsx("button",{type:"button",disabled:n,"aria-label":"选择本地图片",onClick:()=>f.current?.click(),onDragOver:m=>{m.preventDefault(),n||g(!0)},onDragLeave:()=>g(!1),onDrop:m=>{if(m.preventDefault(),g(!1),n)return;const x=m.dataTransfer.files[0];x!==void 0&&c(x)},className:fe("flex size-16 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-dashed border-border bg-popover transition-colors",n?"opacity-50":"hover:border-primary",h&&"border-primary bg-primary/10"),children:o!==void 0?l.jsx("img",{src:o,alt:"已选图标",className:"icon-checker size-full rounded object-contain"}):l.jsxs("span",{className:"flex flex-col items-center gap-1 text-muted-foreground",children:[l.jsx(fu,{className:"size-4"}),l.jsx("span",{className:"text-[10px] leading-tight",children:"上传"})]})}),l.jsx("input",{ref:f,type:"file",accept:"image/png,image/jpeg,image/svg+xml,image/webp,image/gif",className:"hidden",disabled:n,onChange:m=>{const x=m.target.files?.[0];x!==void 0&&c(x),m.target.value=""}}),l.jsxs("div",{className:"flex flex-1 flex-wrap items-center gap-2",children:[A.length===0?l.jsx("span",{className:"text-xs text-muted-foreground",children:"暂无候选图标"}):A.map(m=>{const x=t===void 0?void 0:Wn(t,m.index),C=r===`${t}:${m.index}`,b=r===void 0&&m.variant==="original"&&m.index===(p[0]?.index??-1);return l.jsx("button",{type:"button",disabled:n,title:m.variant==="original"?`${m.width}×${m.height} ${m.format.toUpperCase()}`:`${m.variant==="solid-black"?"黑色":"白色"}纯色 ${m.format.toUpperCase()}`,onClick:()=>a(m),className:fe("icon-checker flex size-12 items-center justify-center overflow-hidden rounded-lg border p-1 transition-all",C||b?"border-primary ring-2 ring-primary/60":"border-border hover:border-primary/60",n&&"opacity-50"),children:x!==void 0?l.jsx("img",{src:x,alt:`候选 ${m.variant}`,className:"size-full object-contain"}):null},`${m.variant}:${m.index}`)}),i!==void 0&&r===void 0&&A.length>0?l.jsx("span",{className:"text-[11px] text-muted-foreground",children:i}):null]}),r!==void 0||o!==void 0?l.jsx("button",{type:"button",disabled:n,onClick:u,className:"text-[11px] text-muted-foreground underline-offset-2 hover:underline",children:"清除"}):null]})}function yC(e){const t=d.useRef(!0);t.current&&(t.current=!1,e())}const Qf=d.createContext(null);function Zt(){const e=d.useContext(Qf);if(e===null)throw new Error(ot(60));return e}const CC=(e,t)=>Object.is(e,t);function rr(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function xo(e,t,n){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:rr(r,t,n))}function IC(e,t,n){return e.filter(r=>!rr(t,r,n))}function xi(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Gf(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function wC(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(Gf(t)){for(const n of t)for(const r of n.items)if(r&&r.value==null&&r.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function Yf(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return xi(e)}function Hn(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?xi(e.value):xi(e)}function zf(e,t,n){function r(){return Yf(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){const o=t,s=Gf(o)?o.flatMap(i=>i.items):o;if(e==null||typeof e!="object"){const i=s.find(a=>a.value===e);return i&&i.label!=null?i.label:r()}if("value"in e){const i=s.find(a=>a&&a.value===e.value);if(i&&i.label!=null)return i.label}}return r()}function kC(e,t,n){return e.reduce((r,o,s)=>(s>0&&r.push(", "),r.push(l.jsx(d.Fragment,{children:zf(o,t,n)},s)),r),[])}const ke={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{const{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Hn(t,r)!==""},hasNullItemLabel:(e,t)=>t?wC(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(o=>rr(t,o,n)):rr(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function EC(e,t,n=(r,o)=>r===o){return e.length===t.length&&e.every((r,o)=>n(r,t[o]))}function vr(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const Tt=1;function Ka(e,t){return Math.max(0,e-t)}function No(e,t){if(t<=0)return 0;const n=vr(e,0,t),r=n,o=t-n,s=r<=Tt,i=o<=Tt;return s&&i?r<=o?0:t:s?0:i?t:n}function SC(e){const{id:t,value:n,defaultValue:r=null,onValueChange:o,open:s,defaultOpen:i=!1,onOpenChange:a,name:c,form:u,autoComplete:f,disabled:h=!1,readOnly:g=!1,required:A=!1,modal:p=!0,actionsRef:m,inputRef:x,onOpenChangeComplete:C,items:b,multiple:v=!1,itemToStringLabel:y,itemToStringValue:w,isItemEqualToValue:I=CC,highlightItemOnHover:E=!0,children:S}=e,{clearErrors:R}=Fi(),{setDirty:k,setTouched:F,setFocused:T,validityData:N,setFilled:j,name:D,disabled:O,validation:_,validationMode:B}=Qo(),H=ji({id:t}),P=O||h,M=D??c,[L,G]=on({controlled:n,default:v?r??Nt:r,name:"Select",state:"value"}),[V,Y]=on({controlled:s,default:i,name:"Select",state:"open"}),Q=d.useRef([]),z=d.useRef([]),K=d.useRef(null),X=d.useRef(null),ae=d.useRef(0),te=d.useRef(null),$=d.useRef([]),ee=d.useRef(!1),ue=d.useRef(null),ce=d.useRef(null),he=d.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),se=d.useRef(!1),{mounted:Ae,setMounted:re,transitionStatus:oe}=or(V),{openMethod:le,triggerProps:ge}=xd(V),me=St(()=>new Gr({id:H,labelId:void 0,modal:p,multiple:v,itemToStringLabel:y,itemToStringValue:w,isItemEqualToValue:I,value:L,open:V,mounted:Ae,transitionStatus:oe,items:b,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,W=we(me,ke.activeIndex),U=we(me,ke.selectedIndex),be=we(me,ke.triggerElement),q=we(me,ke.positionerElement),ne=Zm(le),Ee=le??ne,Se=d.useMemo(()=>v?"":Hn(L,w),[v,L,w]),Ge=d.useMemo(()=>v&&Array.isArray(L)?L.map(De=>Hn(De,w)):Hn(L,w),[v,L,w]),ze=qe(be),Le=de(()=>Ge);Mi(ze,H,L,Le,!P,c);const ct=d.useRef(L),tt=v?Array.isArray(L)&&L.length>0:L!=null&&Se!=="";ie(()=>{j(tt)},[tt,j]),ie(function(){let We=L,mt=!1;if(v){const Ft=Array.isArray(L)?L:[];mt=Ft.length===0,We=Ft[Ft.length-1]}const yt=mt?-1:xo($.current,We,I),Ct=yt===-1?null:yt;Ct===null&&(ce.current=null),!V&&me.set("selectedIndex",Ct)},[v,V,L,I,me]);function Je(De){const We=N.initialValue;return Array.isArray(De)&&Array.isArray(We)?!EC(De,We,(mt,yt)=>rr(mt,yt,I)):De!==We}ss(L,()=>{R(M),k(Je(L)),_.change(L)});const ft=de((De,We)=>{a?.(De,We),!We.isCanceled&&(Y(De),!De&&(We.reason===Bn||We.reason===Lo)&&(F(!0),T(!1),B==="onBlur"&&_.commit(L)))}),Ie=de(()=>{re(!1),me.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),C?.(!1)});zt({enabled:!m,open:V,ref:K,onComplete(){V||Ie()}}),d.useImperativeHandle(m,()=>({unmount:Ie}),[Ie]);const Ke=de((De,We)=>{o?.(De,We),!We.isCanceled&&G(De)}),Ne=de(De=>{const We=Ka(De.scrollHeight,De.clientHeight),mt=No(De.scrollTop,We),yt=mt>0,Ct=mt<We;me.set("scrollUpArrowVisible",yt),me.set("scrollDownArrowVisible",Ct)}),nt=Ug({open:V,onOpenChange:ft,elements:{reference:be,floating:q}}),Re=Gu(nt,{enabled:!g&&!P,event:"mousedown"}),Ue=Xo(nt),Ve=dd(nt,{enabled:!g&&!P,listRef:Q,activeIndex:W,selectedIndex:U,disabledIndices:Nt,onNavigate(De){De===null&&!V||me.set("activeIndex",De)},focusItemOnHover:E}),$e=fd(nt,{enabled:!g&&!P&&(V||!v),listRef:z,activeIndex:W,selectedIndex:U,disabledIndices:De=>Od(Q.current[De]),onMatch(De){V?me.set("activeIndex",De):Ke($.current[De],Ce(Pt))},onTyping(De){ee.current=De}}),gt=d.useMemo(()=>Mt($e.reference,Ve.reference,Ue.reference,Re.reference,ge),[Re.reference,$e.reference,Ve.reference,Ue.reference,ge]),pt=d.useMemo(()=>Mt(ts,$e.floating,Ve.floating,Ue.floating),[$e.floating,Ve.floating,Ue.floating]),Rt=Ve.item??lt;yC(()=>{me.update({popupProps:pt,triggerProps:gt})}),me.useSyncedValues({id:H,modal:p,multiple:v,value:L,open:V,mounted:Ae,transitionStatus:oe,popupProps:pt,triggerProps:gt,items:b,itemToStringLabel:y,itemToStringValue:w,isItemEqualToValue:I,openMethod:Ee});const st=d.useMemo(()=>({store:me,floatingContext:nt,required:A,disabled:P,readOnly:g,multiple:v,highlightItemOnHover:E,setValue:Ke,setOpen:ft,listRef:Q,popupRef:K,scrollHandlerRef:X,handleScrollArrowVisibility:Ne,scrollArrowsMountedCountRef:ae,itemProps:Rt,valueRef:te,valuesRef:$,labelsRef:z,typingRef:ee,selectionRef:he,firstItemTextRef:ue,selectedItemTextRef:ce,validation:_,onOpenChangeComplete:C,alignItemWithTriggerActiveRef:se,initialValueRef:ct}),[me,nt,A,P,g,v,E,Ke,ft,Rt,_,C,Ne]),Et=Gt(x,_.inputRef),Dt=v?void 0:M,ht=d.useMemo(()=>!v||!Array.isArray(L)||!M?null:L.map(De=>{const We=Hn(De,w);return l.jsx("input",{type:"hidden",form:u,name:M,value:We,disabled:P},We)}),[v,L,u,M,w,P]);return l.jsxs(Qf.Provider,{value:st,children:[S,l.jsx("input",{..._.getValidationProps(P,{onFocus(){me.state.triggerElement?.focus({focusVisible:!0})},onChange(De){if(De.nativeEvent.defaultPrevented||P||g)return;const We=De.currentTarget.value,mt=Ce(Pt,De.nativeEvent);function yt(){if(v)return;const Ct=We.toLowerCase();let Ft=$.current.findIndex(cn=>Hn(cn,w).toLowerCase()===Ct||Yf(cn,y).toLowerCase()===Ct);Ft===-1&&(Ft=$.current.findIndex((cn,ir)=>{const kn=z.current[ir];return kn!=null&&kn.toLowerCase()===Ct}));const Ht=$.current[Ft];Ht!=null&&Ke(Ht,mt)}me.set("forceMount",!0),queueMicrotask(yt)}}),id:H&&Dt==null?`${H}-hidden-input`:void 0,form:u,name:Dt,autoComplete:f,value:Se,disabled:P,required:A&&!(v&&tt),readOnly:g,ref:Et,style:M?Xi:$o,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),ht]})}function RC(e,t){return e??t}const DC=400,FC={...ni,...Di,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},BC=d.forwardRef(function(t,n){const{render:r,className:o,id:s,disabled:i=!1,nativeButton:a=!0,style:c,...u}=t,{setTouched:f,setFocused:h,validationMode:g,state:A,disabled:p}=Qo(),{labelId:m}=Bi(),{store:x,setOpen:C,selectionRef:b,validation:v,readOnly:y,required:w,alignItemWithTriggerActiveRef:I,disabled:E}=Zt(),S=p||E||i,R=we(x,ke.open),k=we(x,ke.mounted),F=we(x,ke.value),T=we(x,ke.triggerProps),N=we(x,ke.positionerElement),j=we(x,ke.listElement),D=we(x,ke.popupSide),O=we(x,ke.id),_=we(x,ke.labelId),B=we(x,ke.hasSelectedValue),H=k&&N?D:null,P=s??O,M=RC(m,_);ji({id:P});const L=qe(N),G=d.useRef(null),{getButtonProps:V,buttonRef:Y}=Yt({disabled:S,native:a}),Q=x.useStateSetter("triggerElement"),z=dt(),K=dt(),X=dt();d.useEffect(()=>{if(R)return X.start(DC,()=>{b.current.allowUnselectedMouseUp=!0,b.current.allowSelectedMouseUp=!0}),()=>{X.clear()};b.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},K.clear()},[R,b,K,X]);const ae=Mt(T,{id:P,role:"combobox","aria-expanded":R,"aria-haspopup":"listbox","aria-controls":R?j?.id??yo(N)?.id:void 0,"aria-labelledby":M,"aria-readonly":y||void 0,"aria-required":w||void 0,tabIndex:S?-1:0,onFocus(ee){h(!0),R&&I.current&&C(!1,Ce(Pt,ee.nativeEvent)),z.start(0,()=>{x.set("forceMount",!0)})},onBlur(ee){ve(N,ee.relatedTarget)||(f(!0),h(!1),g==="onBlur"&&v.commit(F))},onMouseDown(ee){if(R)return;const ue=Be(ee.currentTarget);function ce(he){if(!G.current)return;const se=he.target;ve(G.current,se)||ve(L.current,se)||Pd(he,G.current)||C(!1,Ce(au,he))}K.start(0,()=>{ue.addEventListener("mouseup",ce,{once:!0})})}},u,V),te=v.getValidationProps(S,ae);te.role="combobox";const $={...A,open:R,disabled:S,value:F,readOnly:y,popupSide:H,placeholder:!B};return Me("button",t,{ref:[n,G,Y,Q],state:$,stateAttributesMapping:FC,props:te})}),MC={value:()=>null},jC=d.forwardRef(function(t,n){const{className:r,render:o,children:s,placeholder:i,style:a,...c}=t,{store:u,valueRef:f}=Zt(),h=we(u,ke.value),g=we(u,ke.items),A=we(u,ke.itemToStringLabel),p=we(u,ke.hasSelectedValue),m=!p&&i!=null&&s==null,x=we(u,ke.hasNullItemLabel,m),C={value:h,placeholder:!p};let b=null;return typeof s=="function"?b=s(h):s!=null?b=s:m&&!x?b=i:Array.isArray(h)?b=kC(h,g,A):b=zf(h,g,A),Me("span",t,{state:C,ref:[n,f],props:[{children:b},c],stateAttributesMapping:MC})}),PC=d.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,{store:a}=Zt(),u={open:we(a,ke.open)};return Me("span",t,{state:u,ref:n,props:[{"aria-hidden":!0,children:"▼"},i],stateAttributesMapping:Bu})}),TC=d.forwardRef(function(t,n){const{store:r}=Zt(),o=we(r,ke.mounted),s=we(r,ke.forceMount);return o||s?l.jsx(qi,{ref:n,...t}):null}),Uf=d.createContext(void 0);function Wa(){const e=d.useContext(Uf);if(!e)throw new Error(ot(59));return e}function _o(e,t){e&&Object.assign(e.style,t)}const Vf={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},NC={position:"fixed"},_C=d.forwardRef(function(t,n){const{anchor:r,className:o,render:s,positionMethod:i,side:a,align:c,sideOffset:u,alignOffset:f,collisionBoundary:h="clipping-ancestors",collisionPadding:g,arrowPadding:A,sticky:p,disableAnchorTracking:m,alignItemWithTrigger:x=!0,collisionAvoidance:C=Tu,style:b,...v}=t,{store:y,listRef:w,labelsRef:I,alignItemWithTriggerActiveRef:E,selectedItemTextRef:S,valuesRef:R,initialValueRef:k,popupRef:F,setValue:T,floatingContext:N}=Zt(),j=we(y,ke.open),D=we(y,ke.mounted),O=we(y,ke.modal),_=we(y,ke.value),B=we(y,ke.openMethod),H=we(y,ke.positionerElement),P=we(y,ke.triggerElement),M=we(y,ke.isItemEqualToValue),L=we(y,ke.transitionStatus),G=d.useRef(null),V=d.useRef(null),[Y,Q]=d.useState(x),z=D&&Y&&B!=="touch";!D&&Y!==x&&Q(x),d.useImperativeHandle(E,()=>z),Md((z||O)&&j,B==="touch",H,P);const K=va({anchor:r,floatingRootContext:N,positionMethod:i,mounted:D,side:a,sideOffset:u,align:c,alignOffset:f,arrowPadding:A,collisionBoundary:h,collisionPadding:g,sticky:p,disableAnchorTracking:m??z,collisionAvoidance:C,keepMounted:!0}),X=z?"none":K.side,ae=z?NC:K.positionerStyles,te={open:j,side:X,align:K.align,anchorHidden:K.anchorHidden};ie(()=>{y.set("popupSide",K.side)},[y,K.side]);const $=y.useStateSetter("positionerElement"),ee=ya(t,te,{styles:ae,transitionStatus:L,props:v,refs:[n,$],hidden:!D,inert:!j}),ue=d.useRef(0),ce=de(se=>{if(R.current.length===0)return;const Ae=ue.current;if(ue.current=se.size,se.size===Ae)return;const re=Ce(Pt);if(Ae!==0&&!y.state.multiple&&_!==null&&xo(R.current,_,M)===-1){const le=k.current,me=le!=null&&xo(R.current,le,M)!==-1?le:null;T(me,re),me===null&&(y.set("selectedIndex",null),S.current=null)}if(Ae!==0&&y.state.multiple&&Array.isArray(_)){const oe=_.filter(le=>xo(R.current,le,M)!==-1);oe.length!==_.length&&(T(oe,re),oe.length===0&&(y.set("selectedIndex",null),S.current=null))}if(j&&z){y.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const oe={height:""};_o(H,oe),_o(F.current,oe)}}),he=d.useMemo(()=>({...K,side:X,alignItemWithTriggerActive:z,setControlledAlignItemWithTrigger:Q,scrollUpArrowRef:G,scrollDownArrowRef:V}),[K,X,z,Q]);return l.jsx(Ur,{elementsRef:w,labelsRef:I,onMapChange:ce,children:l.jsxs(Uf.Provider,{value:he,children:[D&&O&&l.jsx(ma,{inert:ga(!j),cutout:P}),ee]})})}),uo="base-ui-disable-scrollbar",bi={className:uo,getElement(e){return l.jsx("style",{nonce:e,href:uo,precedence:"base-ui:low",children:`.${uo}{scrollbar-width:none}.${uo}::-webkit-scrollbar{display:none}`})}},OC=d.createContext(void 0),HC={disableStyleElements:!1};function LC(){return d.useContext(OC)??HC}const KC={...Wr,...Nn},WC=d.forwardRef(function(t,n){const{render:r,className:o,style:s,finalFocus:i,...a}=t,{store:c,popupRef:u,onOpenChangeComplete:f,setOpen:h,valueRef:g,firstItemTextRef:A,selectedItemTextRef:p,multiple:m,handleScrollArrowVisibility:x,scrollHandlerRef:C,listRef:b,highlightItemOnHover:v,floatingContext:y}=Zt(),{side:w,align:I,alignItemWithTriggerActive:E,isPositioned:S,setControlledAlignItemWithTrigger:R}=Wa(),k=Ia()!=null,F=is(),{nonce:T,disableStyleElements:N}=LC(),j=we(c,ke.id),D=we(c,ke.open),O=we(c,ke.openMethod),_=we(c,ke.mounted),B=we(c,ke.popupProps),H=we(c,ke.transitionStatus),P=we(c,ke.triggerElement),M=we(c,ke.positionerElement),L=we(c,ke.listElement),G=d.useRef(!1),V=d.useRef(!1),Y=d.useRef({}),Q=Xn(),z=de(te=>{if(!M||!u.current||!V.current)return;const $=M.style.top==="0px",ee=M.style.bottom==="0px";if(G.current||!E||!$&&!ee){x(te);return}const ue=Lc(M),ce=yr(M.getBoundingClientRect().height,"y",ue),he=Be(M),se=rt(M),Ae=se.getComputedStyle(M),re=parseFloat(Ae.marginTop),oe=parseFloat(Ae.marginBottom),le=Hc(se.getComputedStyle(u.current)),ge=Math.min(he.documentElement.clientHeight-re-oe,le),me=te.scrollTop,W=fo(te);let U=null;const be=Se=>{M.style.height=`${Se}px`},q=$?W-me:me,ne=Math.min(ce+q,ge);if(q<=Tt){const Se=vr(q,0,ge-ce);Se>0&&be(ce+Se),te.scrollTop=$?W:0,ge-(ce+Se)<=Tt&&(G.current=!0),x(te);return}if(ge-ne>Tt)U=$?1/0:0;else if(ee&&me<W){const Se=ce+q-ge;U=me-(q-Se)}const Ee=Math.ceil(ne);if(Ee!==0&&be(Ee),U!=null){const Se=vr(U,0,fo(te));Math.abs(te.scrollTop-Se)>Tt&&(te.scrollTop=Se)}Ee>=ge-Tt&&(G.current=!0),x(te)});d.useImperativeHandle(C,()=>z,[z]),zt({open:D,ref:u,onComplete(){D&&f?.(!0)}});const K={open:D,transitionStatus:H,side:w,align:I};ie(()=>{!M||!u.current||Object.keys(Y.current).length||(Y.current={top:M.style.top||"0",left:M.style.left||"0",right:M.style.right,height:M.style.height,bottom:M.style.bottom,minHeight:M.style.minHeight,maxHeight:M.style.maxHeight,marginTop:M.style.marginTop,marginBottom:M.style.marginBottom})},[u,M]),ie(()=>{D||E||(V.current=!1,G.current=!1,_o(M,Y.current))},[D,E,M,u]),ie(()=>{const te=u.current;if(!D||!P||!M||!te||E&&!S||c.state.transitionStatus==="ending")return;if(V.current=!0,te.style.removeProperty("--transform-origin"),!E){Q.request(()=>x(L||te));return}const $=QC(te);try{let ee=p.current;ee?.isConnected||(ee=!ke.hasSelectedValue(c.state)&&A.current?.isConnected?A.current:null);const ue=g.current,ce=rt(M),he=ce.getComputedStyle(M),se=ce.getComputedStyle(te),Ae=Be(P),re=Lc(P),oe=po(P.getBoundingClientRect(),re),le=po(M.getBoundingClientRect(),re),ge=oe.height,me=L||te,W=me.scrollHeight,U=parseFloat(se.borderBottomWidth),be=parseFloat(he.marginTop)||10,q=parseFloat(he.marginBottom)||10,ne=parseFloat(he.minHeight)||100,Ee=Hc(se),Se=5,Ge=5,ze=20,Le=Ae.documentElement.clientHeight-be-q,ct=Ae.documentElement.clientWidth,tt=Le-oe.bottom+ge;let Je,ft=F==="rtl"?oe.right-le.width:oe.left,Ie=0;if(ee&&ue){const st=po(ue.getBoundingClientRect(),re);Je=po(ee.getBoundingClientRect(),re),ft=le.left+(F==="rtl"?st.right-Je.right:st.left-Je.left);const Et=st.top-oe.top+st.height/2;Ie=Je.top-le.top+Je.height/2-Et}const Ke=tt+Ie+q+U;let Ne=Math.min(Le,Ke);const nt=Le-be-q,Re=Ke-Ne,Ue=ct-Ge;M.style.left=`${vr(ft,Se,Ue-le.width)}px`,M.style.height=`${Ne}px`,M.style.maxHeight="none",M.style.marginTop=`${be}px`,M.style.marginBottom=`${q}px`,te.style.height="100%";const Ve=fo(me),$e=Re>=Ve-Tt;$e&&(Ne=Math.min(Le,le.height)-(Re-Ve));const gt=oe.top<ze||oe.bottom>Le-ze||Math.ceil(Ne)+Tt<Math.min(W,ne),pt=(ce.visualViewport?.scale??1)!==1&&an;if(gt||pt){_o(M,Y.current),R(!1);return}const Rt=Math.max(ne,Ne);if($e){const st=Math.max(0,Le-Ke);M.style.top=le.height>=nt?"0":`${st}px`,M.style.height=`${Ne}px`,me.scrollTop=fo(me)}else M.style.bottom="0",me.scrollTop=Re;if(Je){const st=le.top,Et=le.height,Dt=Je.top+Je.height/2,ht=vr(Et>0?(Dt-st)/Et*100:50,0,100);te.style.setProperty("--transform-origin",`50% ${ht}%`)}(Rt===Le||Ne>=Ee)&&(G.current=!0),x(me),v&&c.state.selectedIndex===null&&c.state.activeIndex===null&&b.current[0]!=null&&c.set("activeIndex",0)}finally{$()}},[c,D,M,P,g,A,p,u,x,E,R,Q,L,b,v,F,S]),d.useEffect(()=>{if(!E||!M||!D)return;const te=rt(M);function $(ee){h(!1,Ce(Mp,ee))}return Fe(te,"resize",$)},[h,E,M,D]);const X={...L?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":m||void 0,id:`${j}-list`},onKeyDown(te){k&&rs.has(te.key)&&te.stopPropagation()},onScroll(te){L||z(te.currentTarget)},...E&&{style:L?{height:"100%"}:Vf},className:!L&&E?bi.className:void 0},ae=Me("div",t,{ref:[n,u],state:K,stateAttributesMapping:KC,props:[B,X,as(H),a]});return l.jsxs(d.Fragment,{children:[!N&&bi.getElement(T),l.jsx(na,{context:y,modal:!1,disabled:!_,openInteractionType:O,returnFocus:i,restoreFocus:!0,children:ae})]})});function Hc(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function fo(e){return Ka(e.scrollHeight,e.clientHeight)}function Lc(e){return Ju.getScale(e)}function yr(e,t,n){return e/n[t]}function po(e,t){return Dr({x:yr(e.x,"x",t),y:yr(e.y,"y",t),width:yr(e.width,"x",t),height:yr(e.height,"y",t)})}const Kc=[["transform","none"],["scale","1"],["translate","0 0"]];function QC(e){const{style:t}=e,n={};for(const[r,o]of Kc)n[r]=t.getPropertyValue(r),t.setProperty(r,o,"important");return()=>{for(const[r]of Kc){const o=n[r];o?t.setProperty(r,o):t.removeProperty(r)}}}const GC=d.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,{store:a,scrollHandlerRef:c,multiple:u}=Zt(),{alignItemWithTriggerActive:f}=Wa(),h=we(a,ke.hasScrollArrows),g=we(a,ke.openMethod),p={id:`${we(a,ke.id)}-list`,role:"listbox","aria-multiselectable":u||void 0,onScroll(x){c.current?.(x.currentTarget)},...f&&{style:Vf},className:h&&g!=="touch"?bi.className:void 0},m=a.useStateSetter("listElement");return Me("div",t,{ref:[n,m],props:[p,i]})}),Zf=d.createContext(void 0);function Qa(){const e=d.useContext(Zf);if(!e)throw new Error(ot(57));return e}const YC=d.memo(d.forwardRef(function(t,n){const{render:r,className:o,style:s,value:i=null,label:a,disabled:c=!1,nativeButton:u=!1,...f}=t,h=d.useRef(null),g=fs({guess:!0,label:a,textRef:h}),{store:A,itemProps:p,setOpen:m,setValue:x,selectionRef:C,typingRef:b,valuesRef:v,multiple:y,selectedItemTextRef:w,disabled:I,readOnly:E}=Zt(),S=I||c,R=we(A,ke.isActive,g.index),k=we(A,ke.open),F=we(A,ke.isSelected,i),T=we(A,ke.isSelectedByFocus,g.index),N=we(A,ke.isItemEqualToValue),j=g.index,D=d.useRef(null);ie(()=>{const Q=v.current;return Q[j]=i,()=>{delete Q[j]}},[j,i,v]),ie(()=>{const Q=A.state.value;let z=Q;y&&Array.isArray(Q)&&(z=Q.length>0?Q[Q.length-1]:void 0),z!==void 0&&rr(i,z,N)&&(A.set("selectedIndex",j),h.current&&(w.current=h.current))},[j,y,N,A,i,w]);const O=d.useRef("mouse"),_=d.useRef(!1),{getButtonProps:B,buttonRef:H}=Yt({disabled:S,focusableWhenDisabled:!0,native:u,composite:!0}),P={disabled:S,selected:F,highlighted:R};function M(Q){if(I||E)return;const z=A.state.value;if(y){const K=Array.isArray(z)?z:[],X=F?IC(K,i,N):[...K,i];x(X,Ce(Cr,Q))}else x(i,Ce(Cr,Q)),m(!1,Ce(Cr,Q))}function L(){C.current.dragY=0}const G={role:"option","aria-selected":F,tabIndex:k&&R?0:-1,onKeyDown(Q){A.set("activeIndex",j),Q.key===" "&&b.current&&Q.preventDefault()},onClick(Q){const z=O.current!=="touch",K=Q.nativeEvent.pointerType,X=z&&Li(Q.nativeEvent)&&(K!==void 0||R),ae=z&&!X&&!_.current;_.current=!1,!(S||ae)&&M(Q.nativeEvent)},onPointerEnter(Q){O.current=Q.pointerType},onPointerMove(Q){if(Q.pointerType==="mouse"&&Q.buttons===1){const z=C.current;z.dragY+=Q.movementY,z.dragY**2>=64&&(z.allowUnselectedMouseUp=!0)}},onPointerDown(Q){O.current=Q.pointerType,_.current=!0,L()},onMouseUp(){if(L(),S||O.current==="touch"||_.current)return;const Q=!C.current.allowSelectedMouseUp&&F,z=!C.current.allowUnselectedMouseUp&&!F;Q||z||(_.current=!0,D.current?.click(),_.current=!1)}},V=Me("div",t,{ref:[H,n,g.ref,D],state:P,props:[p,G,f,B]}),Y=d.useMemo(()=>({selected:F,index:j,textRef:h,selectedByFocus:T}),[F,j,h,T]);return l.jsx(Zf.Provider,{value:Y,children:V})})),zC=d.forwardRef(function(t,n){const{selected:r}=Qa();return t.keepMounted||r?l.jsx(UC,{...t,ref:n}):null}),UC=d.memo(d.forwardRef((e,t)=>{const{render:n,className:r,style:o,keepMounted:s,...i}=e,{selected:a}=Qa(),c=d.useRef(null),{transitionStatus:u,setMounted:f}=or(a),g=Me("span",e,{ref:[t,c],state:{selected:a,transitionStatus:u},props:[{"aria-hidden":!0,children:"✔️"},i],stateAttributesMapping:Nn});return zt({open:a,ref:c,onComplete(){a||f(!1)}}),g})),VC=d.memo(d.forwardRef(function(t,n){const{index:r,textRef:o,selectedByFocus:s}=Qa(),{firstItemTextRef:i,selectedItemTextRef:a}=Zt(),{render:c,className:u,style:f,...h}=t,g=d.useCallback(p=>{p&&(r===0&&(i.current=p),s&&(a.current=p))},[i,a,r,s]);return Me("div",t,{ref:[g,n,o],props:h})})),Jf=d.forwardRef(function(t,n){const{render:r,className:o,style:s,direction:i,keepMounted:a,...c}=t,u=i==="up",{store:f,popupRef:h,listRef:g,handleScrollArrowVisibility:A,scrollArrowsMountedCountRef:p}=Zt(),{side:m,scrollDownArrowRef:x,scrollUpArrowRef:C}=Wa(),b=u?ke.scrollUpArrowVisible:ke.scrollDownArrowVisible,v=we(f,b),y=we(f,ke.openMethod),w=v&&y!=="touch",I=dt(),E=u?C:x,{mounted:S,transitionStatus:R,setMounted:k}=or(w);ie(()=>(p.current+=1,f.set("hasScrollArrows",!0),()=>{p.current=Math.max(0,p.current-1),p.current===0&&f.set("hasScrollArrows",!1)}),[f,p]),zt({open:w,ref:E,onComplete(){w||k(!1)}});const N=Me("div",t,{ref:[n,E],state:{direction:i,visible:w,side:m,transitionStatus:R},props:[{"aria-hidden":!0,children:u?"▲":"▼",style:{position:"absolute"},onMouseMove(D){if(D.movementX===0&&D.movementY===0||I.isStarted())return;f.set("activeIndex",null);function O(){const _=f.state.listElement??h.current;if(!_)return;f.set("activeIndex",null),A(_);const B=Ka(_.scrollHeight,_.clientHeight),H=No(_.scrollTop,B),P=H===(u?0:B),M=g.current;if(H!==_.scrollTop&&(_.scrollTop=H),P){I.clear();return}if(M.length>0){const L=E.current?.offsetHeight||0;_.scrollTop=ZC(M,u,H,_.clientHeight,L,B)}I.start(40,O)}I.start(40,O)},onMouseLeave(){I.clear()}},c],stateAttributesMapping:Nn});return S||a?N:null});function ZC(e,t,n,r,o,s){if(t){let f=0;const h=n+o-Tt;for(let p=0;p<e.length;p+=1){const m=e[p];if(m&&m.offsetTop>=h){f=p;break}}const g=Math.max(0,f-1),A=e[g];return g<f&&A?No(A.offsetTop-o,s):0}let i=e.length-1;const a=n+r-o+Tt;for(let f=0;f<e.length;f+=1){const h=e[f];if(h&&h.offsetTop+h.offsetHeight>a){i=Math.max(0,f-1);break}}const c=Math.min(e.length-1,i+1),u=e[c];return c>i&&u?No(u.offsetTop+u.offsetHeight-r+o,s):s}const JC=d.forwardRef(function(t,n){return l.jsx(Jf,{...t,ref:n,direction:"down"})}),$C=d.forwardRef(function(t,n){return l.jsx(Jf,{...t,ref:n,direction:"up"})}),XC=SC;function qC({className:e,...t}){return l.jsx(jC,{"data-slot":"select-value",className:fe("flex flex-1 text-left",e),...t})}function e1({className:e,size:t="default",children:n,...r}){return l.jsxs(BC,{"data-slot":"select-trigger","data-size":t,className:fe("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[n,l.jsx(PC,{render:l.jsx(Tn,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function t1({className:e,children:t,side:n="bottom",sideOffset:r=4,align:o="center",alignOffset:s=0,alignItemWithTrigger:i=!0,...a}){return l.jsx(TC,{children:l.jsx(_C,{side:n,sideOffset:r,align:o,alignOffset:s,alignItemWithTrigger:i,className:"isolate z-50",children:l.jsxs(WC,{"data-slot":"select-content","data-align-trigger":i,className:fe("cn-menu-target cn-menu-translucent relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...a,children:[l.jsx(n1,{}),l.jsx(GC,{children:t}),l.jsx(r1,{})]})})})}function Qs({className:e,children:t,...n}){return l.jsxs(YC,{"data-slot":"select-item",className:fe("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[l.jsx(VC,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:t}),l.jsx(zC,{render:l.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:l.jsx(Pi,{className:"pointer-events-none"})})]})}function n1({className:e,...t}){return l.jsx($C,{"data-slot":"select-scroll-up-button",className:fe("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:l.jsx(Ti,{})})}function r1({className:e,...t}){return l.jsx(JC,{"data-slot":"select-scroll-down-button",className:fe("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:l.jsx(Tn,{})})}const $f=d.createContext(void 0);function o1(){const e=d.useContext($f);if(e===void 0)throw new Error(ot(63));return e}const Xf={...Di,checked(e){return e?{"data-checked":""}:{"data-unchecked":""}}},s1=d.forwardRef(function(t,n){const{checked:r,className:o,defaultChecked:s,"aria-labelledby":i,form:a,id:c,inputRef:u,name:f,nativeButton:h=!1,onCheckedChange:g,readOnly:A=!1,required:p=!1,disabled:m=!1,render:x,uncheckedValue:C,value:b,style:v,...y}=t,{clearErrors:w}=Fi(),{state:I,setTouched:E,setDirty:S,validityData:R,setFilled:k,setFocused:F,validationMode:T,disabled:N,name:j,validation:D}=Qo(),{labelId:O}=Bi(),_=N||m,B=j??f,H=d.useRef(null),P=Gt(H,u,D.inputRef),M=d.useRef(null),L=wt(),G=ji({id:c,implicit:!1,controlRef:M}),V=h?void 0:G,[Y,Q]=on({controlled:r,default:!!s,name:"Switch",state:"checked"});Mi(M,L,Y,void 0,!_,f),ie(()=>{H.current&&k(H.current.checked)},[k]),ss(Y,()=>{w(B),S(Y!==R.initialValue),k(Y),D.change(Y)});const{getButtonProps:z,buttonRef:K}=Yt({disabled:_,native:h}),X=pu(i,O,H,!h,V),ae={id:h?G:L,role:"switch","aria-checked":Y,"aria-readonly":A||void 0,"aria-required":p||void 0,"aria-labelledby":X,onFocus(){_||F(!0)},onBlur(){const ue=H.current;!ue||_||(E(!0),F(!1),T==="onBlur"&&D.commit(ue.checked))},onClick(ue){if(A||_)return;ue.preventDefault();const ce=H.current;ce&&Si(ce,ue)}},te={...D.getValidationProps(_),checked:Y,disabled:_,form:a,id:V,name:B,required:p,style:B?Xi:$o,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:P,onChange(ue){if(ue.nativeEvent.defaultPrevented)return;if(A){ue.preventDefault();return}const ce=ue.currentTarget.checked,he=Ce(Pt,ue.nativeEvent);g?.(ce,he),!he.isCanceled&&Q(ce)},onClick(ue){ue.stopPropagation()},onFocus(){M.current?.focus()},...b!==void 0?{value:b}:lt},$=d.useMemo(()=>({...I,checked:Y,disabled:_,readOnly:A,required:p}),[I,Y,_,A,p]),ee=Me("span",t,{state:$,ref:[n,M,K],props:[ae,y,z,ue=>D.getValidationProps(_,ue)],stateAttributesMapping:Xf});return l.jsxs($f.Provider,{value:$,children:[ee,!Y&&B&&C!==void 0&&l.jsx("input",{type:"hidden",form:a,name:B,value:C,disabled:_}),l.jsx("input",{...te,suppressHydrationWarning:!0})]})}),i1=d.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,a=o1();return Me("span",t,{state:a,ref:n,stateAttributesMapping:Xf,props:i})});function ur({className:e,size:t="default",...n}){return l.jsx(s1,{"data-slot":"switch","data-size":t,className:fe("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",e),...n,children:l.jsx(i1,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}function a1({frozen:e,values:t,defaults:n,candidates:r,candidatesPort:o,selectedIconRef:s,uploadedIconUrl:i,iconAnalysis:a,iconComposition:c,iconComposeError:u,iconBackground:f,iconScale:h,onIconBackgroundChange:g,onIconScaleChange:A,selectedTrayRef:p,uploadedTrayUrl:m,selectedPort:x,targetDirExists:C,onPickIconCandidate:b,onUploadIcon:v,onClearIcon:y,onPickTray:w,onUploadTray:I,onClearTray:E,onPatch:S,onConfirm:R}){return l.jsxs("section",{className:"rounded-xl border border-border bg-card p-4",children:[l.jsx(bC,{values:t,defaults:n,frozen:e,iconCandidates:r,iconCandidatesPort:o,uploadedIconUrl:i,selectedIconRef:s,iconAnalysis:a,iconComposition:c,iconComposeError:u,iconBackground:f,iconScale:h,onIconBackgroundChange:g,onIconScaleChange:A,onPickIconCandidate:b,onUploadIcon:v,onClearIcon:y,onPatch:S}),l.jsx(Sa,{className:"mt-4 border-t border-border pt-1",children:l.jsxs(Ra,{value:"advanced",className:"border-b-0",children:[l.jsx(Da,{children:"高级选项"}),l.jsxs(Fa,{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[l.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border p-3",children:[l.jsx(ur,{id:"showStartupTerminal",checked:t.showStartupTerminal,disabled:e,onCheckedChange:k=>S({showStartupTerminal:k})}),l.jsxs("div",{children:[l.jsx(je,{htmlFor:"showStartupTerminal",className:"text-foreground",children:"显示启动终端"}),l.jsxs("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:[l.jsx(Sr,{className:"mr-0.5 inline size-3"}),"应用启动时打开独立终端窗口,实时显示命令的 PTY 输出(可交互)。"]})]})]}),l.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border p-3",children:[l.jsx(ur,{id:"showAddressBar",checked:t.showAddressBar,disabled:e,onCheckedChange:k=>S({showAddressBar:k})}),l.jsxs("div",{children:[l.jsx(je,{htmlFor:"showAddressBar",className:"text-foreground",children:"显示地址栏"}),l.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:"服务窗口顶部显示地址栏(Web Navigation API 管理导航)。"})]})]}),l.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border p-3",children:[l.jsx(ur,{id:"imageSmoothingEnabled",checked:t.imageSmoothingEnabled,disabled:e,onCheckedChange:k=>S({imageSmoothingEnabled:k})}),l.jsxs("div",{children:[l.jsx(je,{htmlFor:"imageSmoothingEnabled",className:"text-foreground",children:"平滑缩放(imageSmoothingEnabled)"}),l.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:"默认开启高质量缩放;上传低分辨率像素风图标时关闭可保留硬边锯齿(等比放大应用到应用图标前景与托盘图标)。"})]})]}),l.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border p-3",children:[l.jsx(ur,{id:"developerMode",checked:t.developerMode,disabled:e,onCheckedChange:k=>S({developerMode:k})}),l.jsxs("div",{children:[l.jsx(je,{htmlFor:"developerMode",className:"text-foreground",children:"允许开发者模式"}),l.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:"仅表示生成应用内的 WebView DevTools 准入;不改变其它行为。"})]})]})]}),l.jsxs("div",{children:[l.jsx(je,{children:"托盘图标"}),l.jsx("p",{className:"mb-1.5 mt-0.5 text-[11px] text-muted-foreground",children:"默认与应用图标一致;纯色候选适合系统托盘(macOS 模板风格)。"}),l.jsx(vC,{candidates:r,port:o,disabled:e,selectedRef:p,uploadedUrl:m,includeVariants:!0,defaultLabel:"默认跟随应用图标",onPick:w,onUpload:I,onClear:E})]}),l.jsxs("div",{children:[l.jsx(je,{htmlFor:"pm",children:"包管理器"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] leading-relaxed text-muted-foreground",children:"仅为生成的应用安装依赖时使用的工具(决定 install 命令与锁文件形态),不影响应用本身的运行方式——生成的应用始终以 Node 启动。默认自动跟随你启动向导所用的包管理器,一般无需修改。"}),l.jsxs(XC,{value:t.pm,disabled:e,onValueChange:k=>S({pm:k}),children:[l.jsx(e1,{id:"pm",className:"mt-0",children:l.jsx(qC,{})}),l.jsxs(t1,{children:[l.jsx(Qs,{value:"npm",children:"npm"}),l.jsx(Qs,{value:"pnpm",children:"pnpm"}),l.jsx(Qs,{value:"bun",children:"bun"})]})]})]}),l.jsxs("div",{className:"rounded-lg border border-border p-3",children:[l.jsx(je,{children:"生成位置"}),l.jsx("p",{className:"mt-1 font-mono text-[11px] break-all text-muted-foreground",children:n.targetDir||"~/.opentray/create/<应用名>"}),l.jsx("p",{className:"mt-1.5 text-[11px] leading-relaxed text-muted-foreground",children:"生成的项目默认落在 OpenTray 主目录下,同一命令重复创建会落到同一位置; 也可在启动向导时通过位置参数指定其他目录。"}),C?l.jsx("p",{className:"mt-2 text-[11px] font-medium text-amber-400",children:"目标目录已存在且非空——继续生成会失败,或开启下方强制覆盖。"}):null,l.jsxs("div",{className:"mt-3 flex items-start gap-3",children:[l.jsx(ur,{id:"force-overwrite",checked:t.force,disabled:e,onCheckedChange:k=>S({force:k})}),l.jsxs("div",{children:[l.jsx(je,{htmlFor:"force-overwrite",className:"text-foreground",children:"强制覆盖已存在的目录"}),l.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:"开启后将清空目标目录内的现有内容并重新生成(等同 --force)。请确认目录中没有你需要的文件。"})]})]})]})]})]})}),l.jsxs("div",{className:"mt-4 flex items-center gap-3",children:[l.jsx(_e,{onClick:R,disabled:e,children:"确定创建应用"}),l.jsx("span",{className:"text-xs text-muted-foreground",children:x!==void 0?`已选服务 :${x}(点击状态栏服务可切换)`:"未运行也不影响:应用启动时会自行嗅探命令的监听端口"})]})]})}var ho={},Gs,Wc;function l1(){if(Wc)return Gs;Wc=1;var e=["||","&&",";;","|&","<(","<<<",">>",">&","<&","&",";","(",")","|","<",">"],t=/[\n\r\u2028\u2029]/,n=/[\s#!"$&'():;<=>@\\^`|]/g;return Gs=function(o){return o.map(function(s){if(s==="")return"''";if(s&&typeof s=="object"){if("op"in s&&s.op==="glob"){if(typeof s.pattern!="string")throw new TypeError("glob token requires a string `pattern`");if(t.test(s.pattern))throw new TypeError("glob `pattern` must not contain line terminators");return s.pattern.replace(n,"\\$&")}if("op"in s&&typeof s.op=="string"){if(e.indexOf(s.op)<0)throw new TypeError("invalid `op` value: "+JSON.stringify(s.op));return s.op.replace(/[\s\S]/g,"\\$&")}if("comment"in s&&typeof s.comment=="string"){if(t.test(s.comment))throw new TypeError("`comment` must not contain line terminators");return"#"+s.comment}throw new TypeError("unrecognized object token shape")}return/["\s\\]/.test(s)&&!/'/.test(s)?"'"+s.replace(/(['])/g,"\\$1")+"'":/["'\s]/.test(s)?'"'+s.replace(/(["\\$`!])/g,"\\$1")+'"':String(s).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}~])/g,"$1\\$2")}).join(" ")},Gs}var Ys,Qc;function c1(){if(Qc)return Ys;Qc=1;for(var e="(?:"+["\\|\\|","\\&\\&",";;","\\|\\&","\\<\\(","\\<\\<\\<",">>",">\\&","<\\&","[&;()|<>]"].join("|")+")",t=new RegExp("^"+e+"$"),n="|&;()<> \\t",r="'([^']*?)'",o='"((\\\\"|[^"])*?)"',s=/^#$/,i="'",a='"',c="$",u="",f=4294967296,h=0;h<4;h++)u+=(f*Math.random()).toString(16);var g=new RegExp("^"+u);function A(x,C){for(var b=C.lastIndex,v=[],y;y=C.exec(x);)v[v.length]=y,C.lastIndex===y.index&&(C.lastIndex+=1);return C.lastIndex=b,v}function p(x,C,b){var v=typeof x=="function"?x(b):x[b];return typeof v>"u"&&b!=""?v="":typeof v>"u"&&(v="$"),typeof v=="object"?C+u+JSON.stringify(v)+u:C+v}function m(x,C,b){b||(b={});var v=b.escape||"\\",y=b.splitUnquoted===!0?`
20
+ `:typeof b.splitUnquoted=="string"?b.splitUnquoted:"",w="(\\"+v+`['"`+n+`]|[^\\s'"`+n+"])+",I=new RegExp(["("+e+")","("+w+"|"+o+"|"+r+")+"].join("|"),"g"),E=A(x,I);if(E.length===0)return[];C||(C={});var S=!1;return E.map(function(R){var k=R[0];if(!k||S)return;if(t.test(k))return{op:k};var F=!1,T=!1,N="",j=[],D=!1,O=null,_=!1,B;function H(){B+=1;var z,K,X=k.charAt(B);if(X==="{"){if(B+=1,k.charAt(B)==="}")throw new Error("Bad substitution: "+k.slice(B-2,B+1));var ae=1;for(z=B;ae>0&&z<k.length;)k.charAt(z)==="{"&&k.charAt(z-1)==="$"?ae+=1:k.charAt(z)==="}"&&(ae-=1),z+=1;if(ae!==0)throw new Error("Bad substitution: "+k.slice(B));z-=1,K=k.slice(B,z),B=z}else if(/[*@#?$!_-]/.test(X))K=X,B+=1;else{var te=k.slice(B);z=te.match(/[^\w\d_]/),z?(K=te.slice(0,z.index),B+=z.index-1):(K=te,B=k.length)}return p(C,"",K)}function P(){if(O!==null){if(O===0)N!==""&&(j[j.length]=N,N="");else{j[j.length]=N,N="";for(var z=1;z<O;z+=1)j[j.length]=""}O=null}}for(B=0;B<k.length;B++){var M=k.charAt(B);if(y&&M!==c&&P(),_=_||!F&&(M==="*"||M==="?"),T)N+=M,T=!1;else if(F)M===F?F=!1:F==i?N+=M:M===v?(B+=1,M=k.charAt(B),M===a||M===v||M===c?N+=M:N+=v+M):M===c?N+=H():N+=M;else if(M===a||M===i)F=M,D=!0;else{if(t.test(M))return{op:k};if(s.test(M)){S=!0;var L={comment:x.slice(R.index+B+1)};return N.length?[N,L]:[L]}else if(M===v)T=!0;else if(M===c){var G=H();if(!y)N+=G;else for(var V=0;V<G.length;V+=1){var Y=G.charAt(V);y.indexOf(Y)<0?(P(),N+=Y):O===null?O=Y===" "||Y===" "||Y===`
21
+ `?0:1:Y!==" "&&Y!==" "&&Y!==`
22
+ `&&(O+=1)}}else N+=M}}if(_)return{op:"glob",pattern:N};if(y){if(O!==null&&O>0){j[j.length]=N,N="";for(var Q=1;Q<O;Q+=1)j[j.length]=""}return(N!==""||D&&j.length===0)&&(j[j.length]=N),j}return N}).reduce(function(R,k){return typeof k>"u"||[].concat(k).forEach(function(F){R[R.length]=F}),R},[])}return Ys=function(C,b,v){var y=m(C,b,v);return typeof b!="function"?y:y.reduce(function(w,I){if(typeof I=="object")return w[w.length]=I,w;var E=I.split(RegExp("("+u+".*?"+u+")","g"));return E.length===1?(w[w.length]=E[0],w):(E.filter(Boolean).forEach(function(S){w[w.length]=g.test(S)?JSON.parse(S.split(u)[1]):S}),w)},[])},Ys}var Gc;function u1(){return Gc||(Gc=1,ho.quote=l1(),ho.parse=c1()),ho}var d1=u1();const qf=["npm","go","rust","python","dotnet","custom"],pn={npm:"npm",go:"Go",rust:"Rust",python:"Python",dotnet:".NET",custom:"自定义"},f1={npm:"npmjs",go:"golang",rust:"rust",python:"python",dotnet:"dotnet"},ep=["npx","pnpx","bunx","yarn dlx","nubx","deno run","vpx"],p1=["uvx","pipx run"],tp={family:"npm",runner:"npx",runnerFlags:"",pkg:"",version:"",args:"",binary:"",raw:""},Ga=e=>{if(/["']/.test(e)){const r=(e.match(/'/gu)??[]).length,o=(e.match(/"/gu)??[]).length;if(r%2===1||o%2===1)return[]}const t=d1.parse(e),n=[];for(const r of t){if(typeof r!="string")return[];n.push(r)}return n.length===0?[]:n},Ya=e=>e.startsWith("-")&&e.length>1,Rn=e=>{const t=e.lastIndexOf("@");return t>0?{base:e.slice(0,t),version:e.slice(t+1)}:{base:e,version:""}},Qn=e=>e.map(t=>t.trim()).filter(t=>t.length>0).join(" "),dr=(e,t)=>{if(t.trim().length===0)return e;const{version:n}=Rn(e);return n.length>0?e:`${e}@${t.trim()}`},h1=e=>/^(npm|jsr):/.test(e)?e:`npm:${e}`,A1=/^[A-Za-z0-9@._/:+=-]+$/u,g1=e=>A1.test(e)&&e.length>0?e:`'${e.replaceAll("'","'\\''")}'`,Sn=e=>e.map(g1).join(" "),fr=e=>{const t=[];let n=0;for(;n<e.length&&Ya(e[n]??"");)t.push(e[n]??""),n+=1;return{flags:t,rest:e.slice(n)}},m1=[new Set(["-A","--allow-all","--allow-read","--allow-write","--allow-net","--allow-env","--allow-run","--allow-sys","--allow-ffi","--allow-hrtime","--no-check","--no-remote","--quiet","-q","--cached-only"]),new Set(["-y","--yes"])],x1=e=>e.includes("=")?!1:m1.some(t=>t.has(e)),pr=e=>e.every(t=>x1(t)),b1=(e,t)=>{const n=t.split(" ");if(e.length<n.length)return-1;for(let r=0;r<n.length;r+=1)if((e[r]??"")!==(n[r]??""))return-1;return n.length},hn=e=>({...tp,...e}),hr=e=>hn({family:"custom",raw:Sn(e)}),v1=e=>{const t=e[0]??"",n=e[1]??"";for(const r of ep){const o=b1(e,r);if(o>0){const{flags:s,rest:i}=fr(e.slice(o));if(!pr(s))return hr(e);const a=i[0]??"",{base:c,version:u}=a.length>0?Rn(a):{base:"",version:""};return hn({family:"npm",runner:r,runnerFlags:s.join(" "),pkg:c,version:u,args:Sn(i.slice(1)),raw:e.join(" ")})}}if(t==="go"&&n==="run"){const{flags:r,rest:o}=fr(e.slice(2));if(!pr(r))return hr(e);const s=o[0]??"",{base:i,version:a}=s.length>0?Rn(s):{base:"",version:""};return hn({family:"go",runner:"",runnerFlags:r.join(" "),pkg:i,version:a,args:Sn(o.slice(1)),raw:e.join(" ")})}if(t==="cargo"&&n==="install"){const{flags:r,rest:o}=fr(e.slice(2));if(!pr(r))return hr(e);const s=o[0]??"",i=s.length>0?Rn(s).base:"";return hn({family:"rust",runner:"",runnerFlags:r.join(" "),pkg:i,args:Sn(o.slice(1)),raw:e.join(" ")})}if(t==="uvx"||t==="pipx"&&n==="run"){const r=t==="uvx"?1:2,{flags:o,rest:s}=fr(e.slice(r));if(!pr(o))return hr(e);const i=s[0]??"",{base:a,version:c}=i.length>0?Rn(i):{base:"",version:""};return hn({family:"python",runner:t==="uvx"?"uvx":"pipx run",runnerFlags:o.join(" "),pkg:a,version:c,args:Sn(s.slice(1)),raw:e.join(" ")})}if(t==="dnx"){const{flags:r,rest:o}=fr(e.slice(1));if(!pr(r))return hr(e);const s=o[0]??"",{base:i,version:a}=s.length>0?Rn(s):{base:"",version:""};return hn({family:"dotnet",runner:"",runnerFlags:r.join(" "),pkg:i,version:a,args:Sn(o.slice(1)),raw:e.join(" ")})}return hn({family:"custom",raw:Sn(e)})},y1=e=>{const t=Ga(e);return t.length===0?hn({family:"custom",raw:e}):v1(t)},np=e=>{const t=e.pkg.trim(),n=e.binary.trim().length>0?e.binary.trim():t;return{install:Qn(["cargo","install",e.runnerFlags,t]),run:Qn([n,e.args])}},vi=e=>{switch(e.family){case"custom":return e.raw.trim();case"rust":return np(e).run;case"npm":{const t=e.runner==="deno run"?h1(dr(e.pkg.trim(),e.version)):dr(e.pkg.trim(),e.version);return Qn([e.runner,e.runnerFlags,t,e.args])}case"go":return Qn(["go","run",e.runnerFlags,dr(e.pkg.trim(),e.version),e.args]);case"python":return Qn([e.runner,e.runnerFlags,dr(e.pkg.trim(),e.version),e.args]);case"dotnet":return Qn(["dnx",e.runnerFlags,dr(e.pkg.trim(),e.version),e.args])}},Ar=(e,t)=>{const n=e.trim().replace(/^(npm|jsr):/,""),r=n.split(/[/\\]/).filter(i=>i.length>0&&!i.startsWith("@")),o=r[r.length-1]??n;let s=Rn(o).base.toLowerCase();return t==="python"&&(s=s.replace(/[._]/g,"-")),s.replace(/[^a-z0-9-]/g,"")},gr=e=>{const t=[];for(const n of Ga(e)){if(Ya(n))break;const r=n.toLowerCase().replace(/[^a-z0-9-]/g,"");if(r.length===0)break;t.push(r)}return t},C1=e=>{if(e.family==="custom"){const i=[];for(const u of Ga(e.raw)){if(Ya(u))break;i.push(u)}const a=i.map(u=>{const f=u.split(/[/\\]/).filter(h=>h.length>0);if(f.some(h=>h.startsWith("@"))){const h=f.filter(g=>!g.startsWith("@"));return(h[h.length-1]??"").split("@")[0]??""}return(f[f.length-1]??u).split("@")[0]??""}).filter(u=>u.length>0).reverse(),c=a.length>0?a.join("."):"app.opentray";return{appId:c,appName:c==="app.opentray"?"Opentray App":c.split(".").filter(u=>u.length>0).map(u=>u.charAt(0).toUpperCase()+u.slice(1)).join(" "),identitySegments:a,tail:""}}const t=f1[e.family];let n;switch(e.family){case"npm":n=[...gr(e.args),Ar(e.pkg,"npm")];break;case"go":n=[...gr(e.args),Ar(e.pkg,"go")];break;case"rust":{const i=Ar(e.pkg,"rust"),a=e.binary.trim().length>0?e.binary.trim().toLowerCase().replace(/[^a-z0-9-]/g,""):i;n=[...gr(e.args),a];break}case"python":n=[...gr(e.args),Ar(e.pkg,"python")];break;case"dotnet":n=[...gr(e.args),Ar(e.pkg,"dotnet")];break}const r=n.filter(i=>i.length>0),o=r.length>0?`${r.join(".")}.${t}`:"app.opentray",s=r.length>0?r.map(i=>i.charAt(0).toUpperCase()+i.slice(1)).join(" "):"Opentray App";return{appId:o,appName:s,identitySegments:r,tail:t}},I1=e=>{const t=e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return t.length>0?t:"opentray-app"},w1=(e,t)=>{let n;for(const r of e)r.key.trim()===t&&(n=r.value);return n},k1=e=>e.family==="npm"&&(e.runner==="npx"||e.runner==="pnpx")?[{key:"npm_config_yes",value:"true",note:"跳过 npm 安装确认(等效 -y),首次运行无需交互"}]:[],E1='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>.NET</title><path d="M24 8.77h-2.468v7.565h-1.425V8.77h-2.462V7.53H24zm-6.852 7.565h-4.821V7.53h4.63v1.24h-3.205v2.494h2.953v1.234h-2.953v2.604h3.396zm-6.708 0H8.882L4.78 9.863a2.896 2.896 0 0 1-.258-.51h-.036c.032.189.048.592.048 1.21v5.772H3.157V7.53h1.659l3.965 6.32c.167.261.275.442.323.54h.024c-.04-.233-.06-.629-.06-1.185V7.529h1.372zm-8.703-.693a.868.829 0 0 1-.869.829.868.829 0 0 1-.868-.83.868.829 0 0 1 .868-.828.868.829 0 0 1 .869.829Z"/></svg>',S1='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Go</title><path d="M1.811 10.231c-.047 0-.058-.023-.035-.059l.246-.315c.023-.035.081-.058.128-.058h4.172c.046 0 .058.035.035.07l-.199.303c-.023.036-.082.07-.117.07zM.047 11.306c-.047 0-.059-.023-.035-.058l.245-.316c.023-.035.082-.058.129-.058h5.328c.047 0 .07.035.058.07l-.093.28c-.012.047-.058.07-.105.07zm2.828 1.075c-.047 0-.059-.035-.035-.07l.163-.292c.023-.035.07-.07.117-.07h2.337c.047 0 .07.035.07.082l-.023.28c0 .047-.047.082-.082.082zm12.129-2.36c-.736.187-1.239.327-1.963.514-.176.046-.187.058-.34-.117-.174-.199-.303-.327-.548-.444-.737-.362-1.45-.257-2.115.175-.795.514-1.204 1.274-1.192 2.22.011.935.654 1.706 1.577 1.835.795.105 1.46-.175 1.987-.77.105-.13.198-.27.315-.434H10.47c-.245 0-.304-.152-.222-.35.152-.362.432-.97.596-1.274a.315.315 0 01.292-.187h4.253c-.023.316-.023.631-.07.947a4.983 4.983 0 01-.958 2.29c-.841 1.11-1.94 1.8-3.33 1.986-1.145.152-2.209-.07-3.143-.77-.865-.655-1.356-1.52-1.484-2.595-.152-1.274.222-2.419.993-3.424.83-1.086 1.928-1.776 3.272-2.02 1.098-.2 2.15-.07 3.096.571.62.41 1.063.97 1.356 1.648.07.105.023.164-.117.2m3.868 6.461c-1.064-.024-2.034-.328-2.852-1.029a3.665 3.665 0 01-1.262-2.255c-.21-1.32.152-2.489.947-3.529.853-1.122 1.881-1.706 3.272-1.95 1.192-.21 2.314-.095 3.33.595.923.63 1.496 1.484 1.648 2.605.198 1.578-.257 2.863-1.344 3.962-.771.783-1.718 1.273-2.805 1.495-.315.06-.63.07-.934.106zm2.78-4.72c-.011-.153-.011-.27-.034-.387-.21-1.157-1.274-1.81-2.384-1.554-1.087.245-1.788.935-2.045 2.033-.21.912.234 1.835 1.075 2.21.643.28 1.285.244 1.905-.07.923-.48 1.425-1.228 1.484-2.233z"/></svg>',R1='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>npm</title><path d="M1.763 0C.786 0 0 .786 0 1.763v20.474C0 23.214.786 24 1.763 24h20.474c.977 0 1.763-.786 1.763-1.763V1.763C24 .786 23.214 0 22.237 0zM5.13 5.323l13.837.019-.009 13.836h-3.464l.01-10.382h-3.456L12.04 19.17H5.113z"/></svg>',D1='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Python</title><path d="M14.25.18l.9.2.73.26.59.3.45.32.34.34.25.34.16.33.1.3.04.26.02.2-.01.13V8.5l-.05.63-.13.55-.21.46-.26.38-.3.31-.33.25-.35.19-.35.14-.33.1-.3.07-.26.04-.21.02H8.77l-.69.05-.59.14-.5.22-.41.27-.33.32-.27.35-.2.36-.15.37-.1.35-.07.32-.04.27-.02.21v3.06H3.17l-.21-.03-.28-.07-.32-.12-.35-.18-.36-.26-.36-.36-.35-.46-.32-.59-.28-.73-.21-.88-.14-1.05-.05-1.23.06-1.22.16-1.04.24-.87.32-.71.36-.57.4-.44.42-.33.42-.24.4-.16.36-.1.32-.05.24-.01h.16l.06.01h8.16v-.83H6.18l-.01-2.75-.02-.37.05-.34.11-.31.17-.28.25-.26.31-.23.38-.2.44-.18.51-.15.58-.12.64-.1.71-.06.77-.04.84-.02 1.27.05zm-6.3 1.98l-.23.33-.08.41.08.41.23.34.33.22.41.09.41-.09.33-.22.23-.34.08-.41-.08-.41-.23-.33-.33-.22-.41-.09-.41.09zm13.09 3.95l.28.06.32.12.35.18.36.27.36.35.35.47.32.59.28.73.21.88.14 1.04.05 1.23-.06 1.23-.16 1.04-.24.86-.32.71-.36.57-.4.45-.42.33-.42.24-.4.16-.36.09-.32.05-.24.02-.16-.01h-8.22v.82h5.84l.01 2.76.02.36-.05.34-.11.31-.17.29-.25.25-.31.24-.38.2-.44.17-.51.15-.58.13-.64.09-.71.07-.77.04-.84.01-1.27-.04-1.07-.14-.9-.2-.73-.25-.59-.3-.45-.33-.34-.34-.25-.34-.16-.33-.1-.3-.04-.25-.02-.2.01-.13v-5.34l.05-.64.13-.54.21-.46.26-.38.3-.32.33-.24.35-.2.35-.14.33-.1.3-.06.26-.04.21-.02.13-.01h5.84l.69-.05.59-.14.5-.21.41-.28.33-.32.27-.35.2-.36.15-.36.1-.35.07-.32.04-.28.02-.21V6.07h2.09l.14.01zm-6.47 14.25l-.23.33-.08.41.08.41.23.33.33.23.41.08.41-.08.33-.23.23-.33.08-.41-.08-.41-.23-.33-.33-.23-.41-.08-.41.08z"/></svg>',F1='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Rust</title><path d="M23.8346 11.7033l-1.0073-.6236a13.7268 13.7268 0 00-.0283-.2936l.8656-.8069a.3483.3483 0 00-.1154-.578l-1.1066-.414a8.4958 8.4958 0 00-.087-.2856l.6904-.9587a.3462.3462 0 00-.2257-.5446l-1.1663-.1894a9.3574 9.3574 0 00-.1407-.2622l.49-1.0761a.3437.3437 0 00-.0274-.3361.3486.3486 0 00-.3006-.154l-1.1845.0416a6.7444 6.7444 0 00-.1873-.2268l.2723-1.153a.3472.3472 0 00-.417-.4172l-1.1532.2724a14.0183 14.0183 0 00-.2278-.1873l.0415-1.1845a.3442.3442 0 00-.49-.328l-1.076.491c-.0872-.0476-.1742-.0952-.2623-.1407l-.1903-1.1673A.3483.3483 0 0016.256.955l-.9597.6905a8.4867 8.4867 0 00-.2855-.086l-.414-1.1066a.3483.3483 0 00-.5781-.1154l-.8069.8666a9.2936 9.2936 0 00-.2936-.0284L12.2946.1683a.3462.3462 0 00-.5892 0l-.6236 1.0073a13.7383 13.7383 0 00-.2936.0284L9.9803.3374a.3462.3462 0 00-.578.1154l-.4141 1.1065c-.0962.0274-.1903.0567-.2855.086L7.744.955a.3483.3483 0 00-.5447.2258L7.009 2.348a9.3574 9.3574 0 00-.2622.1407l-1.0762-.491a.3462.3462 0 00-.49.328l.0416 1.1845a7.9826 7.9826 0 00-.2278.1873L3.8413 3.425a.3472.3472 0 00-.4171.4171l.2713 1.1531c-.0628.075-.1255.1509-.1863.2268l-1.1845-.0415a.3462.3462 0 00-.328.49l.491 1.0761a9.167 9.167 0 00-.1407.2622l-1.1662.1894a.3483.3483 0 00-.2258.5446l.6904.9587a13.303 13.303 0 00-.087.2855l-1.1065.414a.3483.3483 0 00-.1155.5781l.8656.807a9.2936 9.2936 0 00-.0283.2935l-1.0073.6236a.3442.3442 0 000 .5892l1.0073.6236c.008.0982.0182.1964.0283.2936l-.8656.8079a.3462.3462 0 00.1155.578l1.1065.4141c.0273.0962.0567.1914.087.2855l-.6904.9587a.3452.3452 0 00.2268.5447l1.1662.1893c.0456.088.0922.1751.1408.2622l-.491 1.0762a.3462.3462 0 00.328.49l1.1834-.0415c.0618.0769.1235.1528.1873.2277l-.2713 1.1541a.3462.3462 0 00.4171.4161l1.153-.2713c.075.0638.151.1255.2279.1863l-.0415 1.1845a.3442.3442 0 00.49.327l1.0761-.49c.087.0486.1741.0951.2622.1407l.1903 1.1662a.3483.3483 0 00.5447.2268l.9587-.6904a9.299 9.299 0 00.2855.087l.414 1.1066a.3452.3452 0 00.5781.1154l.8079-.8656c.0972.0111.1954.0203.2936.0294l.6236 1.0073a.3472.3472 0 00.5892 0l.6236-1.0073c.0982-.0091.1964-.0183.2936-.0294l.8069.8656a.3483.3483 0 00.578-.1154l.4141-1.1066a8.4626 8.4626 0 00.2855-.087l.9587.6904a.3452.3452 0 00.5447-.2268l.1903-1.1662c.088-.0456.1751-.0931.2622-.1407l1.0762.49a.3472.3472 0 00.49-.327l-.0415-1.1845a6.7267 6.7267 0 00.2267-.1863l1.1531.2713a.3472.3472 0 00.4171-.416l-.2713-1.1542c.0628-.0749.1255-.1508.1863-.2278l1.1845.0415a.3442.3442 0 00.328-.49l-.49-1.076c.0475-.0872.0951-.1742.1407-.2623l1.1662-.1893a.3483.3483 0 00.2258-.5447l-.6904-.9587.087-.2855 1.1066-.414a.3462.3462 0 00.1154-.5781l-.8656-.8079c.0101-.0972.0202-.1954.0283-.2936l1.0073-.6236a.3442.3442 0 000-.5892zm-6.7413 8.3551a.7138.7138 0 01.2986-1.396.714.714 0 11-.2997 1.396zm-.3422-2.3142a.649.649 0 00-.7715.5l-.3573 1.6685c-1.1035.501-2.3285.7795-3.6193.7795a8.7368 8.7368 0 01-3.6951-.814l-.3574-1.6684a.648.648 0 00-.7714-.499l-1.473.3158a8.7216 8.7216 0 01-.7613-.898h7.1676c.081 0 .1356-.0141.1356-.088v-2.536c0-.074-.0536-.0881-.1356-.0881h-2.0966v-1.6077h2.2677c.2065 0 1.1065.0587 1.394 1.2088.0901.3533.2875 1.5044.4232 1.8729.1346.413.6833 1.2381 1.2685 1.2381h3.5716a.7492.7492 0 00.1296-.0131 8.7874 8.7874 0 01-.8119.9526zM6.8369 20.024a.714.714 0 11-.2997-1.396.714.714 0 01.2997 1.396zM4.1177 8.9972a.7137.7137 0 11-1.304.5791.7137.7137 0 011.304-.579zm-.8352 1.9813l1.5347-.6824a.65.65 0 00.33-.8585l-.3158-.7147h1.2432v5.6025H3.5669a8.7753 8.7753 0 01-.2834-3.348zm6.7343-.5437V8.7836h2.9601c.153 0 1.0792.1772 1.0792.8697 0 .575-.7107.7815-1.2948.7815zm10.7574 1.4862c0 .2187-.008.4363-.0243.651h-.9c-.09 0-.1265.0586-.1265.1477v.413c0 .973-.5487 1.1846-1.0296 1.2382-.4576.0517-.9648-.1913-1.0275-.4717-.2704-1.5186-.7198-1.8436-1.4305-2.4034.8817-.5599 1.799-1.386 1.799-2.4915 0-1.1936-.819-1.9458-1.3769-2.3153-.7825-.5163-1.6491-.6195-1.883-.6195H5.4682a8.7651 8.7651 0 014.907-2.7699l1.0974 1.151a.648.648 0 00.9182.0213l1.227-1.1743a8.7753 8.7753 0 016.0044 4.2762l-.8403 1.8982a.652.652 0 00.33.8585l1.6178.7188c.0283.2875.0425.577.0425.8717zm-9.3006-9.5993a.7128.7128 0 11.984 1.0316.7137.7137 0 01-.984-1.0316zm8.3389 6.71a.7107.7107 0 01.9395-.3625.7137.7137 0 11-.9405.3635z"/></svg>',mr=e=>{const t=e.replace(/<title>[\s\S]*?<\/title>/g,"");return({className:r})=>l.jsx("span",{"aria-hidden":"true",className:fe("inline-flex size-4 shrink-0 [&_svg]:size-full [&_svg]:fill-current",r),dangerouslySetInnerHTML:{__html:t}})},Oo={npm:mr(R1),go:mr(S1),rust:mr(F1),python:mr(D1),dotnet:mr(E1),custom:uu},B1=qf.filter(e=>e!=="custom"),Yc=(e,t,n)=>l.jsx(Ba,{variant:"outline",size:"sm",className:"flex max-w-full flex-wrap",value:[t],onValueChange:r=>{const o=r[0];o!==void 0&&e.includes(o)&&n(o)},children:e.map(r=>l.jsx(Br,{value:r,className:"px-2.5 text-xs",children:r},r))});function M1({open:e,draft:t,envPreset:n,onEnvPresetChange:r,onDraftChange:o,onFamilyChange:s,onCancel:i,onApply:a}){const c=p=>{p||i()},u=p=>o({...t,...p}),f=C1(t),h=vi(t),g=t.family==="rust"?np(t):null,A=Oo[t.family];return l.jsx(Ma,{open:e,onOpenChange:c,children:l.jsxs(ja,{className:"max-h-[85vh] overflow-y-auto sm:max-w-md",children:[l.jsxs(Ln,{children:[l.jsxs(Kn,{className:"flex items-center gap-2",children:[l.jsxs(Do,{children:[l.jsxs(Fo,{className:"flex size-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring","aria-label":"切换命令系列",title:"切换命令系列",children:[l.jsx(A,{className:"size-4"}),l.jsx(Tn,{className:"size-3"})]}),l.jsx(Bo,{align:"start",className:"w-36",children:B1.map(p=>{const m=Oo[p];return l.jsxs(Mo,{onClick:()=>s(p),className:p===t.family?"bg-accent/60":void 0,children:[l.jsx(m,{className:"text-muted-foreground"}),pn[p]]},p)})})]}),"配置 ",pn[t.family]," 系列命令"]}),l.jsx(Pa,{children:"修改字段实时预览命令与默认应用标识;确定后写回命令行。"})]}),l.jsxs("div",{className:"space-y-4",children:[t.family==="npm"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx(je,{children:"Runner"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"同一包换 runner 推导结果不变;deno run 自动补 npm: 前缀。"}),Yc(ep,t.runner,p=>u({runner:p}))]}),t.runnerFlags.length>0||t.runner==="deno run"?l.jsxs("div",{children:[l.jsx(je,{children:"Runner 参数"}),l.jsx(et,{className:"mt-1.5 font-mono text-xs",placeholder:"-A",value:t.runnerFlags,onChange:p=>u({runnerFlags:p.target.value})})]}):null,l.jsxs("div",{className:"grid grid-cols-[1fr_110px] gap-3",children:[l.jsxs("div",{children:[l.jsx(je,{children:"包名"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"支持 @scope/name 与 npm: 前缀。"}),l.jsx(et,{className:"mt-0 font-mono text-xs",placeholder:"@deepseek-ai/dsh",value:t.pkg,onChange:p=>u({pkg:p.target.value})})]}),l.jsxs("div",{children:[l.jsx(je,{children:"版本"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"留空 = latest。"}),l.jsx(et,{className:"mt-0 font-mono text-xs",placeholder:"latest",value:t.version,onChange:p=>u({version:p.target.value})})]})]}),l.jsxs("div",{children:[l.jsx(je,{children:"运行参数"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"追加在包名之后;子命令参与 appId 推导。"}),l.jsx(et,{className:"mt-0 font-mono text-xs",placeholder:"web --port 3000",value:t.args,onChange:p=>u({args:p.target.value})})]})]}):null,t.family==="go"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"grid grid-cols-[1fr_110px] gap-3",children:[l.jsxs("div",{children:[l.jsx(je,{children:"Module 路径"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"取末段作为身份,如 rsc.io/fortune → fortune。"}),l.jsx(et,{className:"mt-0 font-mono text-xs",placeholder:"rsc.io/fortune",value:t.pkg,onChange:p=>u({pkg:p.target.value})})]}),l.jsxs("div",{children:[l.jsx(je,{children:"版本"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"留空 = 本地/默认。"}),l.jsx(et,{className:"mt-0 font-mono text-xs",placeholder:"latest",value:t.version,onChange:p=>u({version:p.target.value})})]})]}),l.jsxs("div",{children:[l.jsx(je,{children:"运行参数"}),l.jsx(et,{className:"mt-0 font-mono text-xs",placeholder:"serve --port 8080",value:t.args,onChange:p=>u({args:p.target.value})})]})]}):null,t.family==="rust"&&g!==null?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsxs("div",{children:[l.jsx(je,{children:"安装 crate"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"cargo install 目标;Rust 不能直跑,需先安装。"}),l.jsx(et,{className:"mt-0 font-mono text-xs",placeholder:"ripgrep",value:t.pkg,onChange:p=>u({pkg:p.target.value})})]}),l.jsxs("div",{children:[l.jsx(je,{children:"运行二进制"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"留空默认与 crate 同名。"}),l.jsx(et,{className:"mt-0 font-mono text-xs",placeholder:t.pkg.trim().length>0?t.pkg.trim():"二进制名",value:t.binary,onChange:p=>u({binary:p.target.value})})]})]}),l.jsxs("div",{children:[l.jsx(je,{children:"运行参数"}),l.jsx(et,{className:"mt-0 font-mono text-xs",placeholder:"--json .",value:t.args,onChange:p=>u({args:p.target.value})})]}),l.jsxs("div",{className:"space-y-1 rounded-lg bg-muted/60 p-2.5 font-mono text-xs",children:[l.jsxs("p",{className:"text-muted-foreground",children:[l.jsx("span",{className:"mr-1.5 select-none",children:"$"}),g.install]}),l.jsxs("p",{children:[l.jsx("span",{className:"mr-1.5 select-none text-muted-foreground",children:"$"}),g.run]})]})]}):null,t.family==="python"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx(je,{children:"Runner"}),Yc(p1,t.runner,p=>u({runner:p}))]}),l.jsxs("div",{className:"grid grid-cols-[1fr_110px] gap-3",children:[l.jsxs("div",{children:[l.jsx(je,{children:"包名"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"包名中的 . _ 归一为 - 参与推导。"}),l.jsx(et,{className:"mt-0 font-mono text-xs",placeholder:"ruff",value:t.pkg,onChange:p=>u({pkg:p.target.value})})]}),l.jsxs("div",{children:[l.jsx(je,{children:"版本"}),l.jsx(et,{className:"mt-0 font-mono text-xs",placeholder:"latest",value:t.version,onChange:p=>u({version:p.target.value})})]})]}),l.jsxs("div",{children:[l.jsx(je,{children:"运行参数"}),l.jsx(et,{className:"mt-0 font-mono text-xs",placeholder:"format --check .",value:t.args,onChange:p=>u({args:p.target.value})})]})]}):null,t.family==="dotnet"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"grid grid-cols-[1fr_110px] gap-3",children:[l.jsxs("div",{children:[l.jsx(je,{children:"工具 ID"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:".NET 10 dnx:NuGet 工具临时运行,无需安装。"}),l.jsx(et,{className:"mt-0 font-mono text-xs",placeholder:"dotnet-format",value:t.pkg,onChange:p=>u({pkg:p.target.value})})]}),l.jsxs("div",{children:[l.jsx(je,{children:"版本"}),l.jsx(et,{className:"mt-0 font-mono text-xs",placeholder:"latest",value:t.version,onChange:p=>u({version:p.target.value})})]})]}),l.jsxs("div",{children:[l.jsx(je,{children:"运行参数"}),l.jsx(et,{className:"mt-0 font-mono text-xs",placeholder:"--verify-no-changes",value:t.args,onChange:p=>u({args:p.target.value})})]})]}):null]},t.family),l.jsx("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-muted/60 px-3 py-2",children:l.jsx("code",{className:"min-w-0 flex-1 font-mono text-xs break-all",children:h.length>0?h:l.jsx("span",{className:"text-muted-foreground",children:"填写后生成命令…"})})}),n!==null?l.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[l.jsx("span",{className:"text-[11px] text-muted-foreground",children:"环境变量预设"}),n.state==="off"?l.jsxs("button",{type:"button",className:"rounded-md px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground underline-offset-2 transition-colors hover:bg-accent hover:text-foreground hover:underline",title:n.defaultNote,onClick:()=>r("enable"),children:["+ ",n.key,"=true(启用)"]}):l.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-md border border-border bg-secondary/60 py-0.5 pr-1 pl-1.5 font-mono text-[11px]",title:"来自下方「命令选项 → 环境变量」配置(唯一可信源),两侧同步",children:[n.key,"=",n.explicitValue??"",l.jsx("span",{className:"font-sans text-[10px] text-muted-foreground",children:"env 已配置"}),l.jsx("button",{type:"button","aria-label":"移除环境变量预设",title:n.defaultNote,className:"rounded px-1 text-muted-foreground transition-colors hover:text-foreground",onClick:()=>r("disable"),children:"×"})]})]}):l.jsx("p",{className:"text-[11px] text-muted-foreground",children:"此系列/runner 无需注入环境变量。"}),l.jsxs("div",{className:"space-y-1 rounded-lg border border-border bg-muted/40 p-3",children:[l.jsx("p",{className:"text-[11px] text-muted-foreground",children:"默认应用标识(由命令推导,可在下方应用配置中覆盖)"}),l.jsx("code",{className:"font-mono text-sm font-medium break-all",children:f.appId}),l.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["名称 ",f.appName," · ~/.opentray/create/",I1(f.appId),"/"]})]}),l.jsxs(eb,{children:[l.jsx(Xx,{render:l.jsx(_e,{variant:"outline"}),children:"取消"}),l.jsxs(_e,{onClick:()=>{a(t)},children:[l.jsx(Pi,{}),"确定"]})]})]})})}const zc=e=>({...tp,family:e,runner:e==="python"?"uvx":e==="npm"?"npx":""}),Uc=e=>e!=="custom",zs=(e,t)=>e.family===t.family&&e.runner===t.runner&&e.runnerFlags===t.runnerFlags&&e.pkg===t.pkg&&e.version===t.version&&e.args===t.args&&e.binary===t.binary&&e.raw===t.raw;function j1({command:e,onCommandChange:t,commandOptions:n,onCommandOptionsChange:r,disabled:o,onRun:s}){const i=d.useMemo(()=>y1(e),[e]),a=n.family,c=d.useRef({}),[u,f]=d.useState(null),[h,g]=d.useState(a?.family??null);d.useEffect(()=>{if(a!==null){if(c.current[a.family]=a,u===null){g(P=>P===a.family?P:a.family);return}!Uc(a.family)||u.currentFamily!==a.family||f(P=>{if(P===null||P.currentFamily!==a.family)return P;const M=P.drafts[a.family],L=P.bases[a.family];return M===void 0||L===void 0||!zs(M,L)?P:{...P,drafts:{...P.drafts,[a.family]:a},bases:{...P.bases,[a.family]:a}}})}},[a,u===null]);const A=h??i.family,p=P=>{if(a!==null&&a.family===P)return a;const M=c.current[P];return M!==void 0?M:i.family===P?i:zc(P)},[m,x]=d.useState(!1),[C,b]=d.useState(!1),[v,y]=d.useState(!1),w=u===null?void 0:u.drafts[u.currentFamily],I=w??n.family??i,E=k1(I)[0],S=E===void 0?void 0:w1(n.env,E.key),R=E===void 0?null:{key:E.key,defaultNote:E.note,state:S!==void 0?"explicit":"off",...S!==void 0?{explicitValue:S}:{}},k=S!==void 0,F=P=>{const M=E?.key??"npm_config_yes",L=P==="enable"?[...n.env.filter(G=>G.key.trim()!==M),{key:M,value:"true"}]:n.env.filter(G=>G.key.trim()!==M);r({...n,env:L})},T=P=>{if(P===A)return;g(P);const M={...n,...n.argsMode==="array"?{argsMode:"string"}:{}},L=p(P);c.current[P]===void 0&&(c.current[P]=L),r({...M,family:P==="custom"?null:L}),t(vi(L))},N=()=>{if(!Uc(A))return;const P=p(A);f({snapshot:{family:A,state:P},currentFamily:A,drafts:{[A]:P},bases:{[A]:P}})},j=P=>{f(M=>M===null||M.currentFamily!==P.family?M:{...M,drafts:{...M.drafts,[P.family]:P}})},D=P=>{f(M=>{if(M===null||M.currentFamily===P)return M;const L=M.drafts[P],G=M.bases[P],V=p(P),Y=L!==void 0&&G!==void 0&&!zs(L,G),Q=Y?L:V;return{...M,currentFamily:P,drafts:{...M.drafts,[P]:Q},bases:{...M.bases,[P]:Y?G:V}}})},O=()=>{f(P=>{if(P===null)return P;const M=c.current[P.snapshot.family];return(M===void 0||zs(M,P.snapshot.state))&&(c.current[P.snapshot.family]=P.snapshot.state),null})},_=P=>{c.current[P.family]=P,g(P.family),t(vi(P)),r({...n,...n.argsMode==="array"?{argsMode:"string"}:{},family:P}),f(null)},B=Oo[A],H=A==="custom";return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex h-8 w-full min-w-0 items-stretch rounded-lg border border-input bg-transparent transition-colors outline-none focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 disabled:opacity-50 dark:bg-input/30",children:[l.jsxs(Do,{children:[l.jsxs(Fo,{disabled:o,className:"flex w-11 items-center justify-between gap-1 rounded-l-lg border-r border-input transition-colors outline-none hover:bg-accent focus-visible:z-10 focus-visible:border-ring","aria-label":`命令系列:${pn[A]},点击切换`,title:`命令系列:${pn[A]}`,children:[l.jsx(B,{className:"size-4 text-muted-foreground ms-2"}),l.jsx(Tn,{className:"size-3 text-muted-foreground/70 me-0.75"})]}),l.jsx(Bo,{align:"start",className:"w-36",children:qf.map(P=>{const M=Oo[P];return l.jsxs(Mo,{onClick:()=>T(P),className:P===A?"bg-accent/60":void 0,children:[l.jsx(M,{className:"text-muted-foreground"}),pn[P]]},P)})})]}),H?l.jsx("input",{className:"h-full w-full min-w-0 flex-1 bg-transparent px-2.5 font-mono text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed",placeholder:"npx somecommand start --xx",disabled:o,value:e,onChange:P=>t(P.target.value),onKeyDown:P=>{P.key==="Enter"&&!o&&s()}}):l.jsx("button",{type:"button",className:"h-full min-w-0 flex-1 cursor-pointer truncate px-2.5 text-left font-mono text-sm outline-none select-none disabled:cursor-not-allowed disabled:opacity-60",disabled:o,title:e.length>0?e:`点击配置 ${pn[A]} 系列命令`,"aria-label":`配置 ${pn[A]} 系列命令`,onClick:N,children:e.length>0?e:l.jsxs("span",{className:"text-muted-foreground",children:["点击配置 ",pn[A]," 系列命令…"]})}),k&&E!==void 0?l.jsxs(ls,{open:m||C||v,onOpenChange:P=>{P||y(!1)},children:[l.jsx(cs,{render:l.jsx("span",{tabIndex:0,className:"mr-1 flex size-6 shrink-0 self-center cursor-help items-center justify-center rounded-md text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring","aria-label":"命令将携带 npm_config_yes 环境变量,悬停或点击查看",onPointerEnter:()=>x(!0),onPointerLeave:()=>x(!1),onFocus:()=>b(!0),onBlur:()=>b(!1),onClick:()=>y(P=>!P)}),children:l.jsx(Sr,{className:"size-3.5"})}),l.jsx(us,{side:"top",children:l.jsxs("div",{className:"space-y-1 text-left",children:[l.jsx("p",{className:"text-[11px] opacity-70",children:"环境变量预设"}),l.jsxs("p",{className:"font-mono text-xs",children:[E.key,"=",S]}),l.jsx("p",{className:"text-[11px] opacity-70",children:"来自「命令选项 → 环境变量」配置(唯一可信源,两侧同步)"})]})})]}):null]}),l.jsx(M1,{open:u!==null,draft:w??zc(A),envPreset:R,onEnvPresetChange:F,onDraftChange:j,onFamilyChange:D,onCancel:O,onApply:_})]})}function P1({tags:e,onTagsChange:t,disabled:n=!1,placeholder:r,className:o,...s}){const[i,a]=d.useState(""),c=()=>{i.length!==0&&(t([...e,i]),a(""))};return l.jsxs("div",{className:fe("flex min-h-9 w-full flex-wrap items-center gap-1.5 rounded-md border border-input bg-transparent px-2 py-1.5 font-mono text-xs shadow-xs focus-within:border-ring",n&&"opacity-50",o),children:[e.map((u,f)=>l.jsxs("span",{className:"flex items-center gap-1 rounded bg-accent px-1.5 py-0.5 text-accent-foreground",children:[l.jsx("span",{className:"max-w-56 truncate",title:u,children:u}),n?null:l.jsx("button",{type:"button","aria-label":`移除参数 ${f+1}`,className:"text-muted-foreground hover:text-foreground",onClick:()=>{t(e.filter((h,g)=>g!==f))},children:l.jsx(Ni,{className:"size-3"})})]},`${f}:${u}`)),l.jsx("input",{className:"min-w-24 flex-1 bg-transparent font-mono text-xs outline-none placeholder:text-muted-foreground",value:i,disabled:n,placeholder:r??(e.length===0?"程序(如 npx)":"参数,回车添加"),onChange:u=>a(u.target.value),onKeyDown:u=>{if(u.key==="Enter"){u.preventDefault(),c();return}u.key==="Backspace"&&i.length===0&&e.length>0&&(u.preventDefault(),t(e.slice(0,-1)))},onBlur:c,...s})]})}function T1({command:e,onCommandChange:t,argv:n,onArgvChange:r,runAlive:o,frozen:s,failedReason:i,commandOptions:a,defaultCwd:c,onCommandOptionsChange:u,onRun:f,onStop:h}){const g=A=>{u({...a,...A})};return l.jsxs("section",{className:"rounded-xl border border-border bg-card p-4",children:[l.jsxs("div",{className:"flex gap-2",children:[a.argsMode==="array"?l.jsx(P1,{tags:n,onTagsChange:r,disabled:o,"aria-label":"命令参数(argv)"}):l.jsx(j1,{command:e,onCommandChange:t,commandOptions:a,onCommandOptionsChange:u,disabled:o||s,onRun:f}),o?l.jsxs(_e,{variant:"destructive",onClick:h,"aria-label":"中断命令",children:[l.jsx(Ch,{}),"中断"]}):l.jsxs(_e,{disabled:s,onClick:f,"aria-label":"运行命令",children:[l.jsx(ph,{}),"运行"]})]}),i!==void 0?l.jsx("p",{className:"mt-2 font-mono text-xs text-red-400",children:i}):null,l.jsx(Sa,{defaultValue:["command"],className:"mt-3 border-t border-border pt-1",children:l.jsxs(Ra,{value:"command",className:"border-b-0",children:[l.jsx(Da,{children:l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(xh,{className:"size-4 text-muted-foreground"}),"命令选项"]})}),l.jsxs(Fa,{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[l.jsxs("div",{children:[l.jsx(je,{children:"参数输入模式"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"数组模式逐个输入参数(回车添加),原样传递、绝不拆分。"}),l.jsxs(Ba,{variant:"outline",size:"sm",spacing:0,value:[a.argsMode],onValueChange:A=>{const p=A[0];(p==="string"||p==="array")&&g({argsMode:p})},disabled:s,children:[l.jsx(Br,{value:"string",children:"字符串"}),l.jsx(Br,{value:"array",children:"数组 (argv)"})]})]}),l.jsxs("div",{children:[l.jsx(je,{htmlFor:"cmd-cwd",children:"工作目录 (cwd)"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"留空使用用户主目录(下方完整路径);相对路径按主目录解析。"}),l.jsx(et,{id:"cmd-cwd",className:"mt-0 font-mono text-xs",disabled:s,value:a.cwd,placeholder:c.length>0?`默认:${c}`:"默认:用户主目录",title:c,onChange:A=>g({cwd:A.target.value})}),c.length>0&&a.cwd.trim().length===0?l.jsx("p",{className:"mt-1 font-mono text-[11px] break-all text-muted-foreground",children:c}):null]})]}),l.jsxs("div",{children:[l.jsx(je,{children:"环境变量 (env)"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"启动命令时叠加在当前环境之上;同时写入生成的应用。"}),l.jsxs("div",{className:"space-y-1.5",children:[a.env.length===0?l.jsx("p",{className:"text-xs text-muted-foreground",children:"未配置"}):a.env.map((A,p)=>l.jsxs("div",{className:"flex gap-1.5",children:[l.jsx(et,{className:"font-mono text-xs",disabled:s,"aria-label":`env 名称 ${p+1}`,value:A.key,placeholder:"NAME",onChange:m=>{const x=[...a.env];x[p]={...A,key:m.target.value},g({env:x})}}),l.jsx(et,{className:"font-mono text-xs",disabled:s,"aria-label":`env 值 ${p+1}`,value:A.value,placeholder:"value",onChange:m=>{const x=[...a.env];x[p]={...A,value:m.target.value},g({env:x})}}),l.jsx(_e,{variant:"ghost",size:"icon-sm",disabled:s,"aria-label":"删除环境变量",onClick:()=>{g({env:a.env.filter((m,x)=>x!==p)})},children:"×"})]},p)),l.jsxs(_e,{variant:"outline",size:"sm",disabled:s,onClick:()=>g({env:[...a.env,{key:"",value:""}]}),children:[l.jsx(Sr,{className:"size-3.5"}),"添加变量"]})]})]})]})]})})]})}const Us=["scaffold","icon","install"];function N1({open:e,phase:t,frozenValues:n,iconSrc:r,iconLabel:o,traySrc:s,trayLabel:i,selectedPort:a,currentStep:c,logs:u,error:f,result:h,onBack:g,onCreate:A,onShare:p,onOpenApp:m,onClose:x,confirmError:C,onOpenChange:b}){const v=d.useRef(null);d.useEffect(()=>{v.current?.scrollTo({top:v.current.scrollHeight})},[u.length]);const y=w=>{const I=Us.indexOf(w),E=Us.indexOf(c);return t==="success"||I<E?"done":I===E?"active":""};return l.jsx(Ma,{open:e,onOpenChange:w=>{t==="pending"&&w===!1||b(w)},children:l.jsx(ja,{className:"max-w-xl",children:t==="confirm"?l.jsxs(l.Fragment,{children:[l.jsxs(Ln,{children:[l.jsx(Kn,{children:"确认应用信息"}),l.jsx(Pa,{children:"表单已固定,以下值将用于生成应用。"})]}),l.jsxs("dl",{className:"grid grid-cols-[110px_1fr] gap-x-3 gap-y-2 text-sm",children:[l.jsx("dt",{className:"text-muted-foreground",children:"App ID"}),l.jsx("dd",{className:"font-mono break-all",children:n.appId}),l.jsx("dt",{className:"text-muted-foreground",children:"应用名称"}),l.jsx("dd",{className:"break-all",children:n.appName}),l.jsx("dt",{className:"text-muted-foreground",children:"图标"}),l.jsxs("dd",{className:"flex flex-wrap items-center gap-4",children:[l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"icon-checker flex size-10 items-center justify-center overflow-hidden rounded-md","aria-label":"应用图标预览",children:r!==void 0?l.jsx("img",{src:r,alt:"应用图标",className:"size-full object-contain"}):l.jsx("span",{className:"text-[10px] text-muted-foreground",children:"无"})}),l.jsxs("span",{className:"flex flex-col",children:[l.jsx("span",{className:"text-xs leading-tight",children:"应用图标"}),l.jsx("span",{className:"font-mono text-[10px] leading-tight text-muted-foreground",children:o})]})]}),l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"icon-checker flex size-10 items-center justify-center overflow-hidden rounded-md","aria-label":"托盘图标预览",children:s!==void 0?l.jsx("img",{src:s,alt:"托盘图标",className:"size-full object-contain"}):l.jsx("span",{className:"text-[10px] text-muted-foreground",children:"文字"})}),l.jsxs("span",{className:"flex flex-col",children:[l.jsx("span",{className:"text-xs leading-tight",children:"托盘图标"}),l.jsx("span",{className:"font-mono text-[10px] leading-tight text-muted-foreground",children:i})]})]})]}),l.jsx("dt",{className:"text-muted-foreground",children:"服务端口"}),l.jsx("dd",{className:"font-mono",children:a!==void 0?`:${a}(生成后运行时重新嗅探)`:"运行时嗅探"}),l.jsx("dt",{className:"text-muted-foreground",children:"包管理器"}),l.jsx("dd",{children:n.pm})]}),C!==void 0?l.jsx("p",{className:"text-xs font-medium text-red-400",children:C}):null,l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(_e,{variant:"outline",onClick:g,children:"返回修改"}),l.jsx(_e,{variant:"outline",onClick:p,children:"分享"}),l.jsx(_e,{onClick:A,children:"确认生成"})]})]}):t==="pending"?l.jsxs(l.Fragment,{children:[l.jsx(Ln,{children:l.jsx(Kn,{children:"正在生成应用…"})}),l.jsx("div",{className:"flex flex-wrap gap-1.5",children:Us.map(w=>l.jsx(bo,{variant:y(w)==="done"?"default":"secondary",children:w},w))}),l.jsx("div",{ref:v,className:"h-48 overflow-y-auto rounded-md border border-border bg-[#05070b] p-3 font-mono text-[11px] leading-5 text-[#b7c3d8] whitespace-pre-wrap",children:u.join(`
23
+ `)})]}):t==="success"&&h!==void 0?l.jsxs(l.Fragment,{children:[l.jsx(Ln,{children:l.jsxs(Kn,{className:"flex items-center gap-2",children:[l.jsx(Wp,{className:"size-5 text-emerald-400"}),"应用已生成"]})}),l.jsxs("dl",{className:"grid grid-cols-[110px_1fr] gap-x-3 gap-y-2 text-sm",children:[l.jsx("dt",{className:"text-muted-foreground",children:"项目目录"}),l.jsx("dd",{className:"font-mono break-all",children:h.projectDir}),h.bundlePath?l.jsxs(l.Fragment,{children:[l.jsx("dt",{className:"text-muted-foreground",children:"macOS Bundle"}),l.jsx("dd",{className:"font-mono break-all",children:h.bundlePath})]}):null]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(_e,{variant:"outline",onClick:x,children:"完成"}),l.jsxs(_e,{onClick:m,children:[l.jsx(cu,{}),"打开应用"]})]}),l.jsx("p",{className:"text-xs text-muted-foreground",children:h.pinHint})]}):l.jsxs(l.Fragment,{children:[l.jsx(Ln,{children:l.jsxs(Kn,{className:"flex items-center gap-2",children:[l.jsx(Rh,{className:"size-5 text-red-400"}),"生成失败"]})}),l.jsx("p",{className:"break-all font-mono text-xs text-red-400",children:f??"未知错误"}),l.jsx("div",{className:"flex justify-end",children:l.jsx(_e,{variant:"outline",onClick:g,children:"返回重试"})})]})})})}const Vc=(e,t)=>{const n=d.useRef(e);n.current=e;const r=d.useRef(void 0),o=d.useRef(void 0),s=d.useCallback(()=>{r.current!==void 0&&(clearTimeout(r.current),r.current=void 0);const f=o.current;o.current=void 0,f!==void 0&&n.current(...f)},[]),i=d.useCallback(()=>{r.current!==void 0&&(clearTimeout(r.current),r.current=void 0),o.current=void 0},[]),a=d.useCallback((...f)=>{o.current=f,r.current!==void 0&&clearTimeout(r.current),r.current=setTimeout(()=>{r.current=void 0;const h=o.current;o.current=void 0,h!==void 0&&n.current(...h)},t)},[t]);d.useEffect(()=>s,[s]);const c=d.useRef(a);c.current=a;const u=d.useCallback((...f)=>{c.current(...f)},[]);return u.flush=s,u.cancel=i,u},rp=d.createContext(void 0);function op(){const e=d.useContext(rp);if(e===void 0)throw new Error(ot(64));return e}const za={tabActivationDirection:e=>({"data-activation-direction":e})},_1=d.forwardRef(function(t,n){const{className:r,defaultValue:o=0,onValueChange:s,orientation:i="horizontal",render:a,value:c,style:u,...f}=t,h=t.defaultValue!==void 0,g=d.useRef([]),[A,p]=d.useState(()=>new Map),[m,x]=on({controlled:c,default:o,name:"Tabs",state:"value"}),C=c!==void 0,[b,v]=d.useState(()=>new Map),y=d.useRef(void 0),w=d.useCallback(K=>yi(b,K),[b]),[I,E]=d.useState(()=>({previousValue:m,tabActivationDirection:"none"})),{previousValue:S,tabActivationDirection:R}=I;let k=R,F=!1;S!==m&&(k=Zc(S,m,i,b),F=S!=null&&m!=null&&w(m)==null);const T=F?S:m,N=S!==T||R!==k;ie(()=>{N&&E({previousValue:T,tabActivationDirection:k})},[T,N,k]);const j=de((K,X)=>{const ae=Zc(m,K,i,b);X.activationDirection=ae,s?.(K,X),!X.isCanceled&&x(K)}),D=de((K,X)=>{s?.(K,Ce(X,void 0,void 0,{activationDirection:"none"}))}),O=de((K,X)=>(p(ae=>{const te=new Map(ae);return te.set(K,X),te}),()=>{p(ae=>{if(ae.get(K)!==X)return ae;const te=new Map(ae);return te.delete(K),te})})),_=d.useCallback(K=>A.get(K),[A]),B=d.useCallback(K=>{for(const X of b.values())if(K===X.value)return X.id},[b]),H=d.useMemo(()=>({getTabElementBySelectedValue:w,getTabIdByPanelValue:B,getTabPanelIdByValue:_,onValueChange:j,orientation:i,registerMountedTabPanel:O,setTabMap:v,tabActivationDirection:k,value:m}),[w,B,_,j,i,O,v,k,m]),P=d.useMemo(()=>{for(const K of b.values())if(K.value===m)return K},[b,m]),M=d.useMemo(()=>{for(const K of b.values())if(!K.disabled)return K.value},[b]),L=d.useRef(!h),G=d.useRef(o),V=d.useRef(h),Y=d.useRef(!1);ie(()=>{if(C)return;function K($,ee){x($),E({previousValue:$,tabActivationDirection:"none"}),D($,ee),L.current=!1}if(b.size===0){Y.current&&m!==null&&!y.current?.isConnected&&K(null,tl);return}Y.current=!0,y.current=b.keys().next().value;const X=P?.disabled,ae=P==null&&m!==null;if(!X&&m===G.current&&(V.current=!1),V.current&&X&&m===G.current)return;const te=L.current;if(X||ae){const $=M??null;if(m===$){L.current=!1;return}let ee=tl;te?ee=el:X&&(ee=iu),K($,ee);return}te&&P!=null&&(D(m,el),L.current=!1)},[M,C,D,P,x,b,m]);const z=Me("div",t,{state:{orientation:i,tabActivationDirection:k},ref:n,props:f,stateAttributesMapping:za});return l.jsx(rp.Provider,{value:H,children:l.jsx(Ur,{elementsRef:g,children:z})})});function yi(e,t){for(const[n,r]of e.entries())if(t===r.value)return n;return null}function Zc(e,t,n,r){if(e==null||t==null)return"none";const[o,s,i]=n==="horizontal"?["left","left","right"]:["top","up","down"],a=yi(r,e),c=yi(r,t);if(a==null||c==null)return a!==c&&(typeof e=="number"||typeof e=="string")&&typeof e==typeof t?t>e?i:s:"none";const u=a.getBoundingClientRect()[o],f=c.getBoundingClientRect()[o];return f<u?s:f>u?i:"none"}const sp=d.createContext(void 0);function O1(){const e=d.useContext(sp);if(e===void 0)throw new Error(ot(65));return e}const H1=d.forwardRef(function(t,n){const{className:r,disabled:o=!1,render:s,value:i,id:a,nativeButton:c=!0,style:u,...f}=t,{value:h,getTabPanelIdByValue:g,onValueChange:A,orientation:p,tabActivationDirection:m}=op(),{activateOnFocus:x,registerTabResizeObserverElement:C,tabsListElement:b}=O1(),{highlightedIndex:v,onHighlightedIndexChange:y}=Ri(),w=wt(a),I=d.useMemo(()=>({disabled:o,id:w,value:i}),[o,w,i]),{compositeProps:E,compositeRef:S,index:R}=Td({metadata:I}),k=i===h,F=d.useRef(!1),T=d.useRef(null),N=de(Y=>{T.current?.(),T.current=Y?C(Y):null});ie(()=>{if(F.current){F.current=!1;return}if(!(k&&R>-1&&v!==R))return;const Y=b;if(Y!=null){const Q=vt(Be(Y));if(Q&&ve(Y,Q))return}o||y(R)},[k,R,v,y,o,b]);const{getButtonProps:j,buttonRef:D}=Yt({disabled:o,native:c,focusableWhenDisabled:!0}),O=g(i),_=d.useRef(!1),B=d.useRef(!1);function H(Y){A(i,Ce(Pt,Y.nativeEvent,void 0,{activationDirection:"none"}))}function P(Y){k||o||H(Y)}function M(Y){k||o||x&&(!_.current||B.current)&&H(Y)}function L(Y){if(k||o)return;_.current=!0,B.current=Y.button===0;const Q=Be(Y.currentTarget);function z(){_.current=!1,B.current=!1,Q.removeEventListener("pointerup",z),Q.removeEventListener("pointercancel",z)}Q.addEventListener("pointerup",z),Q.addEventListener("pointercancel",z)}return Me("button",t,{state:{disabled:o,active:k,orientation:p,tabActivationDirection:m},ref:[n,D,S,N],props:[E,{role:"tab","aria-controls":O,"aria-selected":k,id:w,onClick:P,onFocus:M,onPointerDown:L,[rf]:k?"":void 0,onKeyDownCapture(){F.current=!0}},f,j],stateAttributesMapping:za})}),L1=d.forwardRef(function(t,n){const{activateOnFocus:r=!1,className:o,loopFocus:s=!0,render:i,style:a,...c}=t,{orientation:u,setTabMap:f,tabActivationDirection:h}=op(),[g,A]=d.useState(0),[p,m]=d.useState(null),x=d.useRef(new Set),C=d.useRef(new Set),b=d.useRef(null);ie(()=>{if(typeof ResizeObserver>"u")return;const S=new ResizeObserver(()=>{x.current.forEach(R=>{R()})});return b.current=S,p&&S.observe(p),C.current.forEach(R=>{S.observe(R)}),()=>{S.disconnect(),b.current=null}},[p]);const v=de(S=>(x.current.add(S),()=>{x.current.delete(S)})),y=de(S=>(C.current.add(S),b.current?.observe(S),()=>{C.current.delete(S),b.current?.unobserve(S)})),w={orientation:u,tabActivationDirection:h},I={"aria-orientation":u==="vertical"?"vertical":void 0,role:"tablist"},E=d.useMemo(()=>({activateOnFocus:r,registerIndicatorUpdateListener:v,registerTabResizeObserverElement:y,tabsListElement:p}),[r,v,y,p]);return l.jsx(sp.Provider,{value:E,children:l.jsx(of,{render:i,className:o,style:a,state:w,refs:[n,m],props:[I,c],stateAttributesMapping:za,highlightedIndex:g,enableHomeAndEndKeys:!0,loopFocus:s,orientation:u,onHighlightedIndexChange:A,onMapChange:f,disabledIndices:Nt})})});function K1({className:e,orientation:t="horizontal",...n}){return l.jsx(_1,{"data-slot":"tabs","data-orientation":t,className:fe("group/tabs flex gap-2 data-horizontal:flex-col",e),...n})}const W1=Ci("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function Q1({className:e,variant:t="default",...n}){return l.jsx(L1,{"data-slot":"tabs-list","data-variant":t,className:fe(W1({variant:t}),e),...n})}function Jc({className:e,...t}){return l.jsx(H1,{"data-slot":"tabs-trigger",className:fe("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent","data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground","after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",e),...t})}function $c({className:e,size:t="default",...n}){return l.jsx("div",{"data-slot":"card","data-size":t,className:fe("group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",e),...n})}function Xc({className:e,...t}){return l.jsx("div",{"data-slot":"card-header",className:fe("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)",e),...t})}function qc({className:e,...t}){return l.jsx("div",{"data-slot":"card-content",className:fe("px-(--card-spacing)",e),...t})}function G1({className:e,...t}){return l.jsx("div",{"data-slot":"card-footer",className:fe("flex items-center rounded-b-xl border-t bg-muted/50 p-(--card-spacing)",e),...t})}const ip=d.memo(({port:e,url:t,visible:n,className:r})=>{const o=d.useRef(null),s=d.useRef(t);return d.useEffect(()=>{const i=o.current;if(i===null){s.current=t;return}s.current!==t&&(s.current=t,i.src=t)},[t]),l.jsx("iframe",{ref:o,title:`service-${e}`,src:t,className:r,style:{width:"100%",height:"100%",border:0,background:"#fff",display:n?"block":"none"},sandbox:"allow-same-origin allow-scripts allow-forms"})});ip.displayName="StableIframe";const Y1=e=>{const t=e.trim();if(t.length!==0)try{return new URL(/^https?:\/\//iu.test(t)?t:`http://${t}`).href}catch{return}},eu=({status:e,services:t,activeTab:n,onJumpToService:r})=>l.jsxs(G1,{className:"h-8 shrink-0 gap-3 overflow-x-auto px-3 py-0 text-[11px] text-muted-foreground",children:[l.jsxs("span",{className:"font-mono whitespace-nowrap",children:["光标 ",e.cursorY,":",e.cursorX]}),l.jsxs("span",{className:"font-mono whitespace-nowrap",children:[e.cols,"×",e.rows]}),l.jsx("span",{className:"font-mono whitespace-nowrap",children:e.selection===void 0?"无选区":`选区 ${e.selection.start.y}:${e.selection.start.x} – ${e.selection.end.y}:${e.selection.end.x}`}),l.jsx("span",{className:"h-3 w-px bg-border"}),t.length===0?l.jsx("span",{children:"嗅探 HTTP 服务中…(未发现不影响创建应用)"}):t.map(o=>l.jsxs(bo,{variant:n===`svc-${o.port}`?"default":"secondary",className:"cursor-pointer font-mono whitespace-nowrap",onClick:()=>r(o.port),children:[":",o.port,o.title?` · ${o.title}`:""]},o.port))]});function z1({command:e,terminalHostRef:t,terminalReady:n,interactive:r,status:o,services:s,iframeTabs:i,activeTab:a,onActiveTabChange:c,onIframeNavigate:u,onIframeHistoryMove:f,onJumpToService:h,className:g}){return l.jsxs("div",{className:fe("flex min-h-0 flex-col gap-2",g),children:[l.jsx(K1,{value:a,onValueChange:c,children:l.jsxs(Q1,{variant:"line",className:"w-full justify-start border-b px-2",children:[l.jsxs(Jc,{value:"terminal",children:[l.jsx(Sr,{className:"size-3.5"}),"终端",!r&&n?l.jsx("span",{className:"text-[10px] text-amber-400",children:"非交互"}):null]}),i.map(A=>l.jsxs(Jc,{value:`svc-${A.port}`,children:[l.jsx(nl,{className:"size-3.5"}),xC(A.url),":",new URL(A.url).port]},A.port))]})}),l.jsx("div",{className:"flex min-h-0 flex-1 flex-col",hidden:a!=="terminal",children:l.jsxs($c,{size:"sm",className:"min-h-0 flex-1 gap-0",children:[l.jsx(Xc,{className:"border-b [.border-b]:pb-2",children:l.jsxs("span",{className:"tech-ltr flex min-w-0 items-center gap-2 font-mono text-xs text-muted-foreground",children:[l.jsx(Sr,{className:"size-4 shrink-0"}),l.jsx("span",{className:"truncate",children:e||"尚未运行命令"})]})}),l.jsxs(qc,{className:"min-h-0 flex-1 p-0",children:[l.jsx("div",{ref:t,className:"min-h-0 min-w-0 h-full bg-[#05070b] px-1"}),n?null:l.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:"正在加载终端渲染器…"})]}),l.jsx(eu,{status:o,services:s,activeTab:a,onJumpToService:h})]})}),i.map(A=>l.jsx("div",{className:"flex min-h-0 flex-1 flex-col",hidden:a!==`svc-${A.port}`,children:l.jsxs($c,{size:"sm",className:"min-h-0 flex-1 gap-0",children:[l.jsx(Xc,{className:"border-b [.border-b]:pb-2",children:l.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[l.jsx(_e,{variant:"ghost",size:"icon-sm",disabled:A.historyIndex===0,onClick:()=>f(A.port,-1),"aria-label":"后退",children:l.jsx(jp,{})}),l.jsx(_e,{variant:"ghost",size:"icon-sm",disabled:A.historyIndex>=A.history.length-1,onClick:()=>f(A.port,1),"aria-label":"前进",children:l.jsx(Pp,{})}),l.jsx(_e,{variant:"ghost",size:"icon-sm",onClick:()=>u(A.port,A.url,"replace"),"aria-label":"重新加载",children:l.jsx(Tp,{})}),l.jsx(nl,{className:"size-4 shrink-0 text-muted-foreground"}),l.jsx(et,{className:"tech-ltr h-7 font-mono text-xs",defaultValue:A.url,placeholder:"输入 URL 跳转",onKeyDown:p=>{if(p.key!=="Enter")return;const m=p.target.value,x=Y1(m);x!==void 0&&u(A.port,x,"push")}},`${A.port}:${A.historyIndex}:${A.url}`)]})}),l.jsx(qc,{className:"min-h-0 flex-1 p-0",children:l.jsx(ip,{port:A.port,url:A.url,visible:a===`svc-${A.port}`})}),l.jsx(eu,{status:o,services:s,activeTab:a,onJumpToService:h})]})},A.port))]})}const tu={appId:"",appName:"",iconPath:"",iconBackground:"transparent",iconScale:.8,trayIconPath:"",force:!1,pm:"npm",showStartupTerminal:!1,showAddressBar:!1,imageSmoothingEnabled:!0,developerMode:!1},U1={appId:"",appName:"",targetDir:"",iconPath:""};function V1(){const{query:e}=zd(),t=e.get("edit"),[n,r]=d.useState(void 0),[o,s]=d.useState(""),[i,a]=d.useState([]),[c,u]=d.useState(gC),[f,h]=d.useState(""),[g,A]=d.useState(!1),[p,m]=d.useState(!1),x=d.useCallback(Z=>{m(Z),Vn.set(Z)},[]);d.useEffect(()=>(Vn.set(p),()=>Vn.set(!1)),[p]);const[C,b]=d.useState(!1),[v,y]=d.useState("idle"),[w,I]=d.useState(),[E,S]=d.useState(""),[R,k]=d.useState(!0),[F,T]=d.useState(!1),[N,j]=d.useState(),[D,O]=d.useState(tu),[_,B]=d.useState(U1),[H,P]=d.useState([]),[M,L]=d.useState(),[G,V]=d.useState(!1),[Y,Q]=d.useState([]),[z,K]=d.useState(),[X,ae]=d.useState(),[te,$]=d.useState(),[ee,ue]=d.useState(),[ce,he]=d.useState(),[se,Ae]=d.useState("transparent"),[re,oe]=d.useState(.8),le=d.useRef(void 0),ge=d.useRef(void 0),me=d.useRef(!1),W=d.useRef(!1),[U,be]=d.useState(),[q,ne]=d.useState(),[Ee,Se]=d.useState(),[Ge,ze]=d.useState("terminal"),[Le,ct]=d.useState([]),[tt,Je]=d.useState({cursorX:0,cursorY:0,cols:0,rows:0}),[ft,Ie]=d.useState(!1),[Ke,Ne]=d.useState("confirm"),[nt,Re]=d.useState([]),[Ue,Ve]=d.useState(""),[$e,gt]=d.useState(),[pt,Rt]=d.useState(),[st,Et]=d.useState(tu),Dt=d.useRef(null),ht=d.useRef(void 0),De=d.useRef([]),We=d.useRef(D);We.current=D;const mt=d.useRef(v);mt.current=v;const yt=(Z,ye,J)=>{if(ye===void 0)return!1;const pe=Number.parseInt(ye.split(":")[1]??"",10);return!Z.some(Te=>Te.index===pe)||ye.split(":")[0]!==String(J)},Ct=d.useRef(void 0);d.useEffect(()=>{const Z=D.iconPath.trim().length>0?D.iconPath.trim():_.iconPath.trim().length>0?_.iconPath.trim():void 0;if(Ct.current=Z,Z===void 0){$(void 0),he(void 0),le.current=void 0;return}Z===le.current&&ce!==void 0||(async()=>{try{ue(void 0);const ye=await Qe("/api/icon-analyze",{path:Z});if(!ye.ok)throw new Error("analyze failed");const J=await ye.json();if(Ct.current!==Z)return;$(J),me.current=!1,Ae(J.suggested),Qe("/api/form",{iconBackground:J.suggested});const pe=await Qe("/api/icon-compose",{foregroundPath:Z,background:J.suggested,scale:re});if(!pe.ok)throw new Error("compose failed");const Te=await pe.json();if(Ct.current!==Z)return;he(Te),le.current=Z}catch{$(void 0),he(void 0),ue("图标分析或合成失败,预览不可用")}})()},[D.iconPath,_.iconPath]);const Ft=Vc(Z=>{Qe("/api/form",{iconScale:Z});const ye=kn();Ua(ye,se,Z)},250),Ht=Z=>{oe(Z),Ft(Z)},cn=Vc(Z=>{Qe("/api/form",{iconBackground:Z});const ye=kn();Ua(ye,Z,re)},120),ir=Z=>{me.current=!0,Ae(Z),cn(Z)},kn=()=>D.iconPath.trim().length>0?D.iconPath.trim():_.iconPath.trim().length>0?_.iconPath.trim():void 0,Ua=d.useCallback(async(Z,ye,J)=>{if(Z===void 0){$(void 0),he(void 0),le.current=void 0,ge.current=void 0;return}ge.current=Z;try{const pe=await Qe("/api/icon-analyze",{path:Z});if(!pe.ok)throw new Error("analyze failed");const Te=await pe.json();if(ge.current!==Z)return;$(Te);const xt=await Qe("/api/icon-compose",{foregroundPath:Z,background:ye,scale:J});if(!xt.ok)throw new Error("compose failed");const Jt=await xt.json();if(ge.current!==Z)return;he(Jt),le.current=Z}catch{$(void 0),he(void 0),ue("图标合成失败,预览未更新")}},[]);d.useEffect(()=>{Np()},[]);const ap=d.useRef(!1);d.useEffect(()=>{t===null||n===t||(r(t),(async()=>{const Z=await Vd(t);if(Z.status!==200||"code"in Z.data)return;const ye=Z.data;if(ye.command?.executable!==void 0&&s(ye.command.executable),ye.command?.args!==void 0&&a([...ye.command.args]),ye.command?.executable!==void 0&&u(J=>({...J,argsMode:"array"})),ye.appName!==void 0){const J=ye.appName;O(pe=>({...pe,appName:J}))}if(ye.icons?.imageSmoothingEnabled!==void 0){const J=ye.icons.imageSmoothingEnabled;O(pe=>({...pe,imageSmoothingEnabled:J}))}if(ye.developerMode!==void 0){const J=ye.developerMode;O(pe=>({...pe,developerMode:J,force:!0}))}if(ye.command?.cwd!==void 0){const J=ye.command.cwd;u(pe=>({...pe,cwd:J}))}if(ye.command?.env!==void 0){const J=Object.entries(ye.command.env).map(([pe,Te])=>({key:pe,value:Te}));u(pe=>({...pe,env:J}))}ap.current=!0})())},[t,n]),d.useEffect(()=>{if(!p)return;let Z=!1;return(async()=>{const ye=Dt.current;if(ye===null)return;const J=await _p(ye);if(Z||J===void 0){Z||j("ghostty-web 加载失败,输出将以纯文本显示");return}ht.current=J,T(!0);const pe=De.current;De.current=[];for(const xt of pe)J.write(xt);J.onData(xt=>{Va.current&&Qe("/api/terminal-input",{data:xt})}),J.onResize(({cols:xt,rows:Jt})=>{Qe("/api/terminal-resize",{cols:xt,rows:Jt})});const Te=window.setInterval(()=>{if(!(mt.current==="idle"&&!ht.current))try{Je(J.readState())}catch{}},300);return()=>window.clearInterval(Te)})(),()=>{Z=!0,ht.current?.dispose(),ht.current=void 0}},[p]);const Va=d.useRef(!0);d.useEffect(()=>{Va.current=R},[R]),d.useEffect(()=>{const Z=mC();return Z.onmessage=ye=>{const J=JSON.parse(ye.data);switch(J.type){case"snapshot":{y(J.state),b(J.runAlive),s(J.command),S(J.command),u(J.commandOptions),k(J.interactive),O(J.form),B(J.defaults),A(J.targetDirExists),P(J.services),L(J.selectedPort),Q(J.icons??[]),K(J.iconsPort),ct(J.services.map(Te=>({port:Te.port,url:Te.url,history:[Te.url],historyIndex:0})));const pe=J.runAlive||J.services.length>0;x(pe),ze(pe&&J.services.length>0?`svc-${J.services[0].port}`:"terminal");break}case"state":y(J.state),J.state==="failed"&&I(J.reason),J.state==="frozen"&&(Ne("confirm"),Ie(!0)),J.state==="materializing"&&(Ne("pending"),Re([])),J.state==="success"&&Ne("success"),J.state==="failed"&&Ja.current&&(Ne("failed"),gt(J.reason));break;case"log":{ht.current!==void 0?ht.current.write(J.chunk):Za.current!==void 0?j(pe=>(pe??"")+J.chunk):De.current.push(J.chunk);break}case"term-mode":if(k(J.interactive),!J.interactive&&J.message!==void 0){const pe=`\x1B[33m${J.message}\x1B[0m\r
24
+ `;ht.current!==void 0?ht.current.write(pe):De.current.push(pe)}break;case"run-status":b(J.running);break;case"command-display":S(J.command);break;case"command-options":u(J.options),h(J.defaultCwd);break;case"services":{P(J.services),L(J.selectedPort),ct(pe=>{const Te=[...pe];let xt;for(const Jt of J.services)Te.find(yp=>yp.port===Jt.port)===void 0&&(Te.push({port:Jt.port,url:Jt.url,history:[Jt.url],historyIndex:0}),xt=Jt.port);return xt!==void 0&&ze(`svc-${xt}`),Te});break}case"icons":Q(J.icons),K(J.port),yt(J.icons,X,J.port)&&ae(void 0),yt(J.icons,q,J.port)&&ne(void 0);break;case"scrape":V(J.hasIcon);break;case"form":{O(t!==null?Te=>Te:J.values),B(J.defaults),A(J.targetDirExists),W.current||(W.current=!0,Ae(J.values.iconBackground),oe(J.values.iconScale));break}case"materialize-step":Ve(J.step),Re(pe=>[...pe,`[${J.step}] ${J.message}`]);break;case"materialize-log":Re(pe=>[...pe,J.message]);break;case"success":Rt({projectDir:J.projectDir,...J.bundlePath===void 0?{}:{bundlePath:J.bundlePath},pinHint:J.pinHint}),window.dispatchEvent(new Event("create-opentray:apps-changed"));break}},()=>Z.close()},[]);const Za=d.useRef(void 0);d.useEffect(()=>{Za.current=N},[N]);const Ja=d.useRef(!1);d.useEffect(()=>{Ja.current=ft},[ft]);const gs=X===void 0?void 0:Number.parseInt(X.split(":")[1]??"",10),lp=ce!==void 0?Wf(ce.key):U!==void 0?U:z!==void 0&&gs!==void 0&&Y.some(Z=>Z.index===gs)?Wn(z,gs):z!==void 0&&Y!==void 0&&Y[0]!==void 0&&X===void 0?Wn(z,Y[0].index):void 0,cp=ce!==void 0?`合成 ${ce.background==="transparent"?"透明底":ce.background==="black"?"黑底":"白底"}`:U!==void 0?"本地图片":Y[0]!==void 0?`${Y[0].width}×${Y[0].height} ${Y[0].format.toUpperCase()}`:"首字母图标",$a=(()=>{if(Ee!==void 0)return Ee;const Z=D.trayIconPath.trim();if(Z.length>0&&z!==void 0){const J=Y.find(pe=>pe.path===Z);if(J!==void 0)return Wn(z,J.index)}const ye=/^([^:]+):(\d+)$/.exec(q??"");if(ye!==null){const J=Number(ye[1]),pe=Number(ye[2]);if(Number.isInteger(J)&&Number.isInteger(pe))return Wn(J,pe)}Z.length})(),up=Ee!==void 0?"本地图片":$a!==void 0?"跟随源图":"跟随应用图标";d.useEffect(()=>{const Z=o.trim();if(Z.length===0)return;const ye=window.setTimeout(()=>{Qe("/api/prime",{command:Z})},400);return()=>window.clearTimeout(ye)},[o]);const dp=async()=>{const Z=o.trim();if(!(c.argsMode==="string"&&Z.length===0)){if(x(!0),ze("terminal"),ht.current?.reset(),ct([]),P([]),V(!1),Q([]),K(void 0),ae(void 0),be(void 0),ne(void 0),Se(void 0),c.argsMode==="array"){if(i.length===0||(i[0]??"").trim().length===0)return;await Qe("/api/command",{argv:i});return}await Qe("/api/command",{command:Z})}},fp=Z=>{if(Le.find(J=>J.port===Z)===void 0){Qe("/api/select-service",{port:Z});return}Qe("/api/select-service",{port:Z}),ze(`svc-${Z}`)},pp=(Z,ye,J)=>{ct(pe=>pe.map(Te=>{if(Te.port!==Z)return Te;if(J==="replace")return{...Te,url:ye};const xt=[...Te.history.slice(0,Te.historyIndex+1),ye];return{...Te,url:ye,history:xt,historyIndex:xt.length-1}}))},hp=(Z,ye)=>{ct(J=>J.map(pe=>{if(pe.port!==Z)return pe;const Te=pe.historyIndex+ye;return Te<0||Te>=pe.history.length?pe:{...pe,historyIndex:Te,url:pe.history[Te]}}))},[Ap,ms]=d.useState(),gp=async()=>{Ft.flush(),cn.flush(),Ne("confirm"),Ie(!0);try{const Z=await Qe("/api/confirm",{});if(!Z.ok){const ye=await Z.json().catch(()=>({}));ms(ye.error??`确认失败(${Z.status})`);return}ms(void 0)}catch{ms("确认请求失败")}};d.useEffect(()=>{v==="frozen"&&Et({...We.current,...D})},[v]);const mp=async()=>{await Qe("/api/create",{})},[xp,Xa]=d.useState(!1),bp=Z=>xx(Z),xs=async()=>{Ie(!1),(await Qe("/api/cancel",{})).ok||y(ye=>ye==="frozen"?"discovered":ye)},vp=p?"minmax(0, 520px) minmax(0, 1fr) minmax(0, 0fr)":"minmax(0, 1fr) minmax(0, var(--list-w)) minmax(0, 1fr)";return l.jsxs("div",{className:"grid h-full w-full overflow-hidden",style:{"--list-w":"min(520px, 100vw - 40px)",gridTemplateColumns:vp,transition:"grid-template-columns 450ms cubic-bezier(0.4, 0, 0.2, 1)"},children:[l.jsxs("div",{className:"flex w-full flex-col gap-4 overflow-y-auto p-5 pr-2 max-md:min-h-full "+(p?"md:border-r md:border-border":""),style:{gridColumn:p?"1":"2",gridRow:"1",transition:"border-color 450ms",scrollbarGutter:"stable"},children:[l.jsx(T1,{command:o,onCommandChange:s,argv:i,onArgvChange:Z=>a([...Z]),runAlive:C,frozen:v==="materializing"||v==="frozen"||v==="success",failedReason:v==="failed"?w:void 0,commandOptions:c,defaultCwd:f,onCommandOptionsChange:Z=>{u(Z),Qe("/api/command-options",{cwd:Z.cwd,env:Z.env,argsMode:Z.argsMode,family:Z.family})},onRun:()=>{dp()},onStop:()=>{Qe("/api/stop",{})}}),l.jsx(a1,{frozen:v==="frozen"||v==="materializing"||v==="success",values:D,defaults:_,candidates:Y,candidatesPort:z,selectedIconRef:X,uploadedIconUrl:U,iconAnalysis:te,iconComposition:ce,iconComposeError:ee,iconBackground:se,iconScale:re,onIconBackgroundChange:ir,onIconScaleChange:Ht,selectedTrayRef:q,uploadedTrayUrl:Ee,selectedPort:M,targetDirExists:g,onPickIconCandidate:Z=>{z!==void 0&&(ae(`${z}:${Z.index}`),be(void 0),Qe("/api/icon-select",{port:z,index:Z.index}))},onUploadIcon:Z=>{const ye=URL.createObjectURL(Z);be(ye),ae(void 0),Z.arrayBuffer().then(J=>{fetch("/api/icon-upload",{method:"POST",headers:{"content-type":Z.type||"application/octet-stream",authorization:`Bearer ${new URLSearchParams(location.search).get("token")??""}`},body:J}).then(pe=>pe.json()).then(({path:pe})=>{pe===void 0||pe.length===0||(O(Te=>({...Te,iconPath:pe})),Qe("/api/form",{iconPath:pe}))}).catch(()=>{})})},onClearIcon:()=>{ae(void 0),be(void 0),O(Z=>({...Z,iconPath:""})),Qe("/api/form",{iconPath:""})},onPickTray:Z=>{z!==void 0&&(ne(`${z}:${Z.index}`),Se(void 0),Qe("/api/tray-icon-select",{port:z,index:Z.index}))},onUploadTray:Z=>{const ye=URL.createObjectURL(Z);Se(ye),ne(void 0),Z.arrayBuffer().then(J=>{fetch("/api/icon-upload",{method:"POST",headers:{"content-type":Z.type||"application/octet-stream",authorization:`Bearer ${new URLSearchParams(location.search).get("token")??""}`},body:J}).then(pe=>pe.json()).then(({path:pe})=>{pe===void 0||pe.length===0||(O(Te=>({...Te,trayIconPath:pe})),Qe("/api/form",{trayIconPath:pe}))}).catch(()=>{})})},onClearTray:()=>{ne(void 0),Se(void 0),O(Z=>({...Z,trayIconPath:""})),Qe("/api/form",{trayIconPath:""})},onPatch:Z=>{O(ye=>({...ye,...Z})),Qe("/api/form",Z)},onConfirm:()=>{gp()}})]}),l.jsx("div",{className:"flex min-h-0 min-w-0 flex-col gap-4 overflow-y-auto p-4 pr-1 max-md:hidden",style:{scrollbarGutter:"stable",gridColumn:p?"2":"3",gridRow:"1",opacity:p?1:0,visibility:p?"visible":"hidden",transition:"opacity 450ms cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear "+(p?"0s":"450ms")},children:p?l.jsxs(l.Fragment,{children:[l.jsx(z1,{command:E,terminalHostRef:Dt,terminalReady:F,interactive:R,status:tt,services:[...H],iframeTabs:Le,activeTab:Ge,onActiveTabChange:ze,onIframeNavigate:pp,onIframeHistoryMove:hp,onJumpToService:fp,className:"min-h-[480px] flex-1"}),N!==void 0?l.jsx("pre",{className:"max-h-56 overflow-auto rounded-xl border border-border bg-card p-3 font-mono text-xs whitespace-pre-wrap",children:N}):null]}):null}),l.jsx(N1,{open:ft,onOpenChange:Z=>{if(Z){Ie(!0);return}if(Ke==="confirm"){xs();return}Ie(!1)},phase:Ke,frozenValues:st,iconSrc:lp,iconLabel:cp,traySrc:$a,trayLabel:up,selectedPort:M,currentStep:Ue,logs:nt,error:$e??w,result:pt,onBack:()=>{xs()},onCreate:()=>{mp()},onShare:()=>Xa(!0),onOpenApp:()=>{Qe("/api/open-app",{})},confirmError:Ap,onClose:()=>{if(Ke==="confirm"){xs();return}Ie(!1)}}),l.jsx(lf,{open:xp,subtitle:st?.appId??E,hasEnv:c.env.some(Z=>Z.key.trim().length>0),share:!0,runner:bp,onClose:()=>Xa(!1)})]})}function Z1(){const{route:e}=Ud();return l.jsxs(l.Fragment,{children:[l.jsx("div",{hidden:e!=="add",className:"min-h-0 flex-1",children:l.jsx(V1,{})}),l.jsx("div",{hidden:e!=="applications",className:"min-h-0 flex-1",children:l.jsx(cb,{})}),l.jsx("div",{hidden:e!=="help",className:"min-h-0 flex-1",children:l.jsx(AC,{})})]})}const Vn={open:!1,listeners:new Set,set(e){if(this.open!==e){this.open=e;for(const t of this.listeners)t()}},subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}},J1=()=>{const[e,t]=d.useState(Vn.open);return d.useEffect(()=>Vn.subscribe(()=>t(Vn.open)),[]),e};function $1(){return l.jsx(cx,{panelOpen:J1(),children:l.jsx(Z1,{})})}const Ho=sx();fi(Ho.locale,Ho.theme);kp.createRoot(document.getElementById("root")).render(l.jsx(Ep.StrictMode,{children:l.jsx(ix,{initialLocale:Ho.locale,initialTheme:Ho.theme,children:l.jsx($1,{})})}));