react-reason-editor 1.0.149 → 1.0.150

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.
@@ -56,407 +56,407 @@ return be(Bh,{scope:t,forceMount:r,children:X.Children.map(n,e=>/* @__PURE__ */b
56
56
  return be(wh,{as:qh,allowPinchZoom:!0,shards:[a.contentRef],children:/* @__PURE__ */be(Vd.div,{"data-state":ep(a.open),...n,ref:o,style:{pointerEvents:"auto",...n.style}})})},"DialogOverlayImpl")),Gh="DialogContent",Wh=/* @__PURE__ */X.forwardRef(/* @__PURE__ */Eh(function(e,t){let r=Vh(Gh,e.__scopeDialog),{forceMount:n=r.forceMount,...a}=e,o=Ph(Gh,e.__scopeDialog);/* @__PURE__ */
57
57
  return be(Cu,{present:n||o.open,children:o.modal?/* @__PURE__ */be(Kh,{...a,ref:t}):/* @__PURE__ */be(Yh,{...a,ref:t})})},"DialogContent")),Kh=/* @__PURE__ */X.forwardRef(/* @__PURE__ */Eh(function(e,t){let r=Ph(Gh,e.__scopeDialog),n=X.useRef(null),a=rd(t,r.contentRef,n);return X.useEffect(()=>{let e=n.current;if(e)return Mh(e)},[]),/* @__PURE__ */be(Xh,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:Yc(e.onCloseAutoFocus,e=>{e.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:Yc(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;(2===t.button||r)&&e.preventDefault()}),onFocusOutside:Yc(e.onFocusOutside,e=>e.preventDefault())})},"DialogContentModal")),Yh=/* @__PURE__ */X.forwardRef(/* @__PURE__ */Eh(function(e,t){let r=Ph(Gh,e.__scopeDialog),n=X.useRef(!1),a=X.useRef(!1);/* @__PURE__ */
58
58
  return be(Xh,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(n.current||r.triggerRef.current?.focus(),t.preventDefault()),n.current=!1,a.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(n.current=!0,"pointerdown"===t.detail.originalEvent.type&&(a.current=!0));let o=t.target;r.triggerRef.current?.contains(o)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&a.current&&t.preventDefault()}})},"DialogContentNonModal")),Xh=/* @__PURE__ */X.forwardRef(/* @__PURE__ */Eh(function(e,t){let{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:o,...i}=e,s=Ph(Gh,r);return _u(),/* @__PURE__ */be(ye,{children:/* @__PURE__ */be(su,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:o,children:/* @__PURE__ */be(Yd,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":ep(s.open),...i,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},"DialogContentImpl")),Zh=/* @__PURE__ */X.forwardRef(/* @__PURE__ */Eh(function(e,t){let{__scopeDialog:r,...n}=e,a=Ph("DialogTitle",r),{setTitleCount:o}=a;return sd(()=>(o(e=>e+1),()=>o(e=>e-1)),[o]),/* @__PURE__ */be(Vd.h2,{id:a.titleId,...n,ref:t})},"DialogTitle")),Jh=/* @__PURE__ */X.forwardRef(/* @__PURE__ */Eh(function(e,t){let{__scopeDialog:r,...n}=e,a=Ph("DialogDescription",r),{setDescriptionCount:o}=a;return sd(()=>(o(e=>e+1),()=>o(e=>e-1)),[o]),/* @__PURE__ */be(Vd.p,{id:a.descriptionId,...n,ref:t})},"DialogDescription")),Qh=/* @__PURE__ */X.forwardRef(/* @__PURE__ */Eh(function(e,t){let{__scopeDialog:r,...n}=e,a=Ph("DialogClose",r);/* @__PURE__ */
59
- return be(Vd.button,{type:"button",...n,ref:t,onClick:Yc(e.onClick,()=>a.onOpenChange(!1))})},"DialogClose"));function ep(e){return e?"open":"closed"}Eh(ep,"getState");var tp=e=>e?.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var rp=(...e)=>e.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),np={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};function ap(e){return null!=e}function op(e,t={}){return function(e,t={}){let r=t.attributeNames??{},n=e=>r[e]??e,a=e.size??e.width??np.width,o=e.size??e.height??np.height,i=e.aliases?.filter(e=>"string"==typeof e&&""!==e.trim()).map(e=>`lucide-${e}`)??[],s=[...e.name?[`lucide-${e.name}`]:[],...i],l=t.className?.split(" ").filter(Boolean)??[],c=!1===t.includeDefaultClasses?rp(...l):rp("lucide",...s,...l),d=t.absoluteStrokeWidth?Number(t.strokeWidth??np["stroke-width"])*Number(e.size??e.width??np.width)/Number(t.size??t.width??np.width):t.strokeWidth??np["stroke-width"];return["svg",{...Object.entries(np).reduce((e,[t,r])=>(e[n(t)]=r,e),{}),..."color"in t&&t.color&&{[n("stroke")]:t.color},..."size"in t&&ap(t.size)&&{[n("width")]:t.size,[n("height")]:t.size},..."width"in t&&ap(t.width)&&{[n("width")]:t.width},..."height"in t&&ap(t.height)&&{[n("height")]:t.height},[n("stroke-width")]:d,...c&&{[n("class")]:c},[n("viewBox")]:`0 0 ${a} ${o}`,...!1===t.hasA11yProp?{[n("aria-hidden")]:"true"}:{},..."attributes"in t&&t.attributes},e.node.map(e=>{let[r,a,o]=e,i=t.nonScalingStroke?{[n("vector-effect")]:"non-scaling-stroke",...a}:a;return o?[r,i,o]:[r,i]})]}(e,{...t,attributeNames:{...t.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}var ip=te({}),sp=ne(({color:e,size:t,width:r,height:n,strokeWidth:a,absoluteStrokeWidth:o,nonScalingStroke:i,className:s="",children:l,iconNode:c=[],icon:d={node:c,aliases:[],size:24},...u},h)=>{let{size:p=24,strokeWidth:m=2,absoluteStrokeWidth:f=!1,nonScalingStroke:g=!1,color:v="currentColor",className:y=""}=se(ip)??{},b=!!l||(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1})(u),[x,w,S=[]]=op(d,{color:e??v,width:r??t??p,height:n??t??p,strokeWidth:a??m,absoluteStrokeWidth:o??f,nonScalingStroke:i??g,className:rp(y,s),hasA11yProp:b,attributes:u});return re(x,{ref:h,...w},[...S.map(([e,t])=>re(e,t)),...Array.isArray(l)?l:[l]])});function lp(e,t=[],r=[]){let n="string"==typeof e?function(e,t,r=[]){if(null==t)throw Error("[lucide]: iconNode is required when icon name is used");return{name:tp(e),size:24,node:t,...r.length>0?{aliases:r}:{}}}(e,t,r):e,a=ne(({className:e,...t},r)=>re(sp,{ref:r,icon:n,className:e,...t}));return n.name&&(a.displayName=(e=>{let t=(e=>{let t="",r=!1;for(let n of e)"-"===n||"_"===n||n<=" "?r=t.length>0:(0===t.length?t+=n.toLowerCase():t+=r?n.toUpperCase():n,r=!1);return t})(e);return t.charAt(0).toUpperCase()+t.slice(1)})(n.name)),a}var cp={name:"arrow-down-from-line",size:24,node:[["path",{d:"M19 3H5",key:"1236rx"}],["path",{d:"M12 21V7",key:"gj6g52"}],["path",{d:"m6 15 6 6 6-6",key:"h15q88"}]]},dp=(lp(cp),{name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]}),up=lp(dp),hp={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]},pp=lp(hp),mp={name:"chevron-right",size:24,node:[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]},fp=lp(mp),gp={name:"chevrons-down-up",size:24,node:[["path",{d:"m7 20 5-5 5 5",key:"13a0gw"}],["path",{d:"m7 4 5 5 5-5",key:"1kwcof"}]]},vp=(lp(gp),{name:"chevrons-up-down",size:24,node:[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]}),yp=(lp(vp),{name:"circle-x",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],aliases:["x-circle"]}),bp=(lp(yp),{name:"circle",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]}),xp=lp(bp),wp={name:"clipboard-paste",size:24,node:[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]]},Sp=lp(wp),kp={name:"clipboard",size:24,node:[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]},Cp=lp(kp),Np={name:"cloud",size:24,node:[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]},Tp=(lp(Np),{name:"columns-2",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],aliases:["columns"]}),Ap=(lp(Tp),{name:"copy",size:24,node:[["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"}]]}),Mp=lp(Ap),Dp={name:"database",size:24,node:[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]},Ep=(lp(Dp),{name:"ellipsis",size:24,node:[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],aliases:["more-horizontal"]}),Ip=(lp(Ep),{name:"file-plus",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]}),Rp=(lp(Ip),{name:"file-plus-corner",size:24,node:[["path",{d:"M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35",key:"17jvcc"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M14 19h6",key:"bvotb8"}],["path",{d:"M17 16v6",key:"18yu1i"}]],aliases:["file-plus-2"]}),zp=(lp(Rp),{name:"file-text",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]}),_p=lp(zp),Pp={name:"folder-open",size:24,node:[["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"}]]},Op=lp(Pp),Lp={name:"folder-plus",size:24,node:[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["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"}]]},Fp=(lp(Lp),{name:"folder",size:24,node:[["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"}]]}),Bp=lp(Fp),Vp={name:"folders",size:24,node:[["path",{d:"M20 5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h2.5a1.5 1.5 0 0 1 1.2.6l.6.8a1.5 1.5 0 0 0 1.2.6z",key:"a4852j"}],["path",{d:"M3 8.268a2 2 0 0 0-1 1.738V19a2 2 0 0 0 2 2h11a2 2 0 0 0 1.732-1",key:"yxbcw3"}]]},$p=(lp(Vp),{name:"hard-drive",size:24,node:[["path",{d:"M10 16h.01",key:"1bzywj"}],["path",{d:"M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"18tbho"}],["path",{d:"M21.946 12.013H2.054",key:"zqlbp7"}],["path",{d:"M6 16h.01",key:"1pmjb7"}]]}),Hp=(lp($p),{name:"hash",size:24,node:[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]}),jp=lp(Hp),qp={name:"info",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]},Up=(lp(qp),{name:"layers",size:24,node:[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],aliases:["layers-3"]}),Gp=lp(Up),Wp={name:"lightbulb",size:24,node:[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]},Kp=(lp(Wp),{name:"link-2",size:24,node:[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]}),Yp=lp(Kp),Xp={name:"loader-circle",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],aliases:["loader-2"]},Zp=(lp(Xp),{name:"log-in",size:24,node:[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]]}),Jp=(lp(Zp),{name:"log-out",size:24,node:[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]}),Qp=(lp(Jp),{name:"message-square-plus",size:24,node:[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M12 8v6",key:"1ib9pf"}],["path",{d:"M9 11h6",key:"1fldmi"}]]}),em=(lp(Qp),{name:"message-square",size:24,node:[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]}),tm=(lp(em),{name:"paintbrush",size:24,node:[["path",{d:"m14.622 17.897-10.68-2.913",key:"vj2p1u"}],["path",{d:"M18.376 2.622a1 1 0 1 1 3.002 3.002L17.36 9.643a.5.5 0 0 0 0 .707l.944.944a2.41 2.41 0 0 1 0 3.408l-.944.944a.5.5 0 0 1-.707 0L8.354 7.348a.5.5 0 0 1 0-.707l.944-.944a2.41 2.41 0 0 1 3.408 0l.944.944a.5.5 0 0 0 .707 0z",key:"18tc5c"}],["path",{d:"M9 8c-1.804 2.71-3.97 3.46-6.583 3.948a.507.507 0 0 0-.302.819l7.32 8.883a1 1 0 0 0 1.185.204C12.735 20.405 16 16.792 16 15",key:"ytzfxy"}]]}),rm=(lp(tm),{name:"pen",size:24,node:[["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"}]],aliases:["edit-2"]}),nm=(lp(rm),{name:"pencil",size:24,node:[["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"}]]}),am=lp(nm),om={name:"rotate-ccw",size:24,node:[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]},im=(lp(om),{name:"search",size:24,node:[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]}),sm=(lp(im),{name:"server",size:24,node:[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]}),lm=(lp(sm),{name:"settings",size:24,node:[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]}),cm=(lp(lm),{name:"sparkles",size:24,node:[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],aliases:["stars"]}),dm=lp(cm),um={name:"square-split-vertical",size:24,node:[["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"M21 16v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-3",key:"14rx03"}],["path",{d:"M3 8V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v3",key:"1haecz"}]],aliases:["split-square-vertical"]},hm=(lp(um),{name:"tag",size:24,node:[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]}),pm=lp(hm),mm={name:"text-align-start",size:24,node:[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]],aliases:["text","align-left"]},fm=lp(mm),gm={name:"trash",size:24,node:[["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"}]],aliases:["trash-2"]},vm=lp(gm),ym={name:"wand-sparkles",size:24,node:[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],aliases:["wand-2"]},bm=(lp(ym),{name:"workflow",size:24,node:[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]}),xm=(lp(bm),{name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]});lp(xm);function wm(e){var t,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=wm(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Sm(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=wm(e))&&(n&&(n+=" "),n+=t);return n}var km=(e=/* @__PURE__ */new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Cm="-",Nm=[],Tm=e=>{let t=Dm(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return Mm(e);let r=e.split(Cm);return Am(r,+(""===r[0]&&r.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=n[e],a=r[e];return t?a?((e,t)=>{let r=Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r})(a,t):t:a||Nm}return r[e]||Nm}}},Am=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;let n=e[t],a=r.nextPart.get(n);if(a){let r=Am(e,t+1,a);if(r)return r}let o=r.validators;if(null===o)return;let i=0===t?e.join(Cm):e.slice(t).join(Cm),s=o.length;for(let l=0;l<s;l++){let e=o[l];if(e.validator(i))return e.classGroupId}},Mm=e=>-1===e.slice(1,-1).indexOf(":")?void 0:(()=>{let t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?"arbitrary.."+n:void 0})(),Dm=e=>{let{theme:t,classGroups:r}=e;return Em(r,t)},Em=(e,t)=>{let r=km();for(let n in e){let a=e[n];Im(a,r,n,t)}return r},Im=(e,t,r,n)=>{let a=e.length;for(let o=0;o<a;o++){let a=e[o];Rm(a,t,r,n)}},Rm=(e,t,r,n)=>{"string"!=typeof e?"function"!=typeof e?Pm(e,t,r,n):_m(e,t,r,n):zm(e,t,r)},zm=(e,t,r)=>{(""===e?t:Om(t,e)).classGroupId=r},_m=(e,t,r,n)=>{Lm(e)?Im(e(n),t,r,n):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(r,e)))},Pm=(e,t,r,n)=>{let a=Object.entries(e),o=a.length;for(let i=0;i<o;i++){let[e,o]=a[i];Im(o,Om(t,e),r,n)}},Om=(e,t)=>{let r=e,n=t.split(Cm),a=n.length;for(let o=0;o<a;o++){let e=n[o],t=r.nextPart.get(e);t||(t=km(),r.nextPart.set(e,t)),r=t}return r},Lm=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,Fm=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null),a=(a,o)=>{r[a]=o,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(e){let t=r[e];return void 0!==t?t:void 0!==(t=n[e])?(a(e,t),t):void 0},set(e,t){e in r?r[e]=t:a(e,t)}}},Bm=[],Vm=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),$m=e=>{let{prefix:t,experimentalParseClassName:r}=e,n=e=>{let t,r=[],n=0,a=0,o=0,i=e.length;for(let d=0;d<i;d++){let i=e[d];if(0===n&&0===a){if(":"===i){r.push(e.slice(o,d)),o=d+1;continue}if("/"===i){t=d;continue}}"["===i?n++:"]"===i?n--:"("===i?a++:")"===i&&a--}let s=0===r.length?e:e.slice(o),l=s,c=!1;return s.endsWith("!")?(l=s.slice(0,-1),c=!0):s.startsWith("!")&&(l=s.slice(1),c=!0),Vm(r,c,l,t&&t>o?t-o:void 0)};if(t){let e=t+":",r=n;n=t=>t.startsWith(e)?r(t.slice(e.length)):Vm(Bm,!1,t,void 0,!0)}if(r){let e=n;n=t=>r({className:t,parseClassName:e})}return n},Hm=e=>{let t=/* @__PURE__ */new Map;return e.orderSensitiveModifiers.forEach((e,r)=>{t.set(e,1e6+r)}),e=>{let r=[],n=[];for(let a=0;a<e.length;a++){let o=e[a],i="["===o[0],s=t.has(o);i||s?(n.length>0&&(n.sort(),r.push(...n),n=[]),r.push(o)):n.push(o)}return n.length>0&&(n.sort(),r.push(...n)),r}},jm=e=>{let t=Object.create(null),r=e.postfixLookupClassGroups;if(r)for(let n=0;n<r.length;n++)t[r[n]]=!0;return t},qm=/\s+/,Um=e=>{if("string"==typeof e)return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Um(e[n]))&&(r&&(r+=" "),r+=t);return r},Gm=(e,...t)=>{let r,n,a,o,i=e=>{let t=n(e);if(t)return t;let o=((e,t)=>{let{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:o,postfixLookupClassGroupIds:i}=t,s=[],l=e.trim().split(qm),c="";for(let d=l.length-1;d>=0;--d){let e=l[d],{isExternal:t,modifiers:u,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:m}=r(e);if(t){c=e+(c.length>0?" "+c:c);continue}let f,g=!!m;if(g){f=n(p.substring(0,m));let e=f&&i[f]?n(p):void 0;e&&e!==f&&(f=e,g=!1)}else f=n(p);if(!f){if(!g){c=e+(c.length>0?" "+c:c);continue}if(f=n(p),!f){c=e+(c.length>0?" "+c:c);continue}g=!1}let v=0===u.length?"":1===u.length?u[0]:o(u).join(":"),y=h?v+"!":v,b=y+f;if(s.indexOf(b)>-1)continue;s.push(b);let x=a(f,g);for(let r=0;r<x.length;++r){let e=x[r];s.push(y+e)}c=e+(c.length>0?" "+c:c)}return c})(e,r);return a(e,o),o};return o=s=>(r=(e=>({cache:Fm(e.cacheSize),parseClassName:$m(e),sortModifiers:Hm(e),postfixLookupClassGroupIds:jm(e),...Tm(e)}))(t.reduce((e,t)=>t(e),e())),n=r.cache.get,a=r.cache.set,o=i,i(s)),(...e)=>o(((...e)=>{let t,r,n=0,a="";for(;n<e.length;)(t=e[n++])&&(r=Um(t))&&(a&&(a+=" "),a+=r);return a})(...e))},Wm=[],Km=e=>{let t=t=>t[e]||Wm;return t.isThemeGetter=!0,t},Ym=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Xm=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Zm=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Jm=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Qm=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ef=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,tf=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,rf=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,nf=e=>Zm.test(e),af=e=>!!e&&!Number.isNaN(Number(e)),of=e=>!!e&&Number.isInteger(Number(e)),sf=e=>e.endsWith("%")&&af(e.slice(0,-1)),lf=e=>Jm.test(e),cf=()=>!0,df=e=>Qm.test(e)&&!ef.test(e),uf=()=>!1,hf=e=>tf.test(e),pf=e=>rf.test(e),mf=e=>!vf(e)&&!Nf(e),ff=e=>e.startsWith("@container")&&("/"===e[10]&&void 0!==e[11]||"s"===e[11]&&void 0!==e[16]&&e.startsWith("-size/",10)||"n"===e[11]&&void 0!==e[18]&&e.startsWith("-normal/",10)),gf=e=>zf(e,Lf,uf),vf=e=>Ym.test(e),yf=e=>zf(e,Ff,df),bf=e=>zf(e,Bf,af),xf=e=>zf(e,$f,cf),wf=e=>zf(e,Vf,uf),Sf=e=>zf(e,Pf,uf),kf=e=>zf(e,Of,pf),Cf=e=>zf(e,Hf,hf),Nf=e=>Xm.test(e),Tf=e=>_f(e,Ff),Af=e=>_f(e,Vf),Mf=e=>_f(e,Pf),Df=e=>_f(e,Lf),Ef=e=>_f(e,Of),If=e=>_f(e,Hf,!0),Rf=e=>_f(e,$f,!0),zf=(e,t,r)=>{let n=Ym.exec(e);return!!n&&(n[1]?t(n[1]):r(n[2]))},_f=(e,t,r=!1)=>{let n=Xm.exec(e);return!!n&&(n[1]?t(n[1]):r)},Pf=e=>"position"===e||"percentage"===e,Of=e=>"image"===e||"url"===e,Lf=e=>"length"===e||"size"===e||"bg-size"===e,Ff=e=>"length"===e,Bf=e=>"number"===e,Vf=e=>"family-name"===e,$f=e=>"number"===e||"weight"===e,Hf=e=>"shadow"===e,jf=/*#__PURE__*/Gm(()=>{let e=Km("color"),t=Km("font"),r=Km("text"),n=Km("font-weight"),a=Km("tracking"),o=Km("leading"),i=Km("breakpoint"),s=Km("container"),l=Km("spacing"),c=Km("radius"),d=Km("shadow"),u=Km("inset-shadow"),h=Km("text-shadow"),p=Km("drop-shadow"),m=Km("blur"),f=Km("perspective"),g=Km("aspect"),v=Km("ease"),y=Km("animate"),b=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Nf,vf],x=()=>[Nf,vf,l],w=()=>[nf,"full","auto",...x()],S=()=>[of,"none","subgrid",Nf,vf],k=()=>["auto",{span:["full",of,Nf,vf]},of,Nf,vf],C=()=>[of,"auto",Nf,vf],N=()=>["auto","min","max","fr",Nf,vf],T=()=>["auto",...x()],A=()=>[nf,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...x()],M=()=>[nf,"screen","full","dvw","lvw","svw","min","max","fit",...x()],D=()=>[nf,"screen","full","lh","dvh","lvh","svh","min","max","fit",...x()],E=()=>[e,Nf,vf],I=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Mf,Sf,{position:[Nf,vf]}],R=()=>["auto","cover","contain",Df,gf,{size:[Nf,vf]}],z=()=>[sf,Tf,yf],_=()=>["","none","full",c,Nf,vf],P=()=>["",af,Tf,yf],O=()=>[af,sf,Mf,Sf],L=()=>["","none",m,Nf,vf],F=()=>["none",af,Nf,vf],B=()=>["none",af,Nf,vf],V=()=>[af,Nf,vf],$=()=>[nf,"full",...x()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[lf],breakpoint:[lf],color:[cf],container:[lf],"drop-shadow":[lf],ease:["in","out","in-out"],font:[mf],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[lf],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[lf],shadow:[lf],spacing:["px",af],text:[lf],"text-shadow":[lf],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",nf,vf,Nf,g]}],container:["container"],"container-type":[{"@container":["","normal","size",Nf,vf]}],"container-named":[ff],columns:[{columns:[af,vf,Nf,s]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:b()}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:w()}],"inset-x":[{"inset-x":w()}],"inset-y":[{"inset-y":w()}],start:[{"inset-s":w(),start:w()}],end:[{"inset-e":w(),end:w()}],"inset-bs":[{"inset-bs":w()}],"inset-be":[{"inset-be":w()}],top:[{top:w()}],right:[{right:w()}],bottom:[{bottom:w()}],left:[{left:w()}],visibility:["visible","invisible","collapse"],z:[{z:[of,"auto",Nf,vf]}],basis:[{basis:[nf,"full","auto",s,...x()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[af,nf,"auto","initial","none",vf]}],grow:[{grow:["",af,Nf,vf]}],shrink:[{shrink:["",af,Nf,vf]}],order:[{order:[of,"first","last","none",Nf,vf]}],"grid-cols":[{"grid-cols":S()}],"col-start-end":[{col:k()}],"col-start":[{"col-start":C()}],"col-end":[{"col-end":C()}],"grid-rows":[{"grid-rows":S()}],"row-start-end":[{row:k()}],"row-start":[{"row-start":C()}],"row-end":[{"row-end":C()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":N()}],"auto-rows":[{"auto-rows":N()}],gap:[{gap:x()}],"gap-x":[{"gap-x":x()}],"gap-y":[{"gap-y":x()}],"justify-content":[{justify:["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe","normal"]}],"justify-items":[{"justify-items":["start","end","center","stretch","center-safe","end-safe","normal"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"align-items":[{items:["start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"align-self":[{self:["auto","start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"place-items":[{"place-items":["start","end","center","stretch","center-safe","end-safe","baseline"]}],"place-self":[{"place-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],p:[{p:x()}],px:[{px:x()}],py:[{py:x()}],ps:[{ps:x()}],pe:[{pe:x()}],pbs:[{pbs:x()}],pbe:[{pbe:x()}],pt:[{pt:x()}],pr:[{pr:x()}],pb:[{pb:x()}],pl:[{pl:x()}],m:[{m:T()}],mx:[{mx:T()}],my:[{my:T()}],ms:[{ms:T()}],me:[{me:T()}],mbs:[{mbs:T()}],mbe:[{mbe:T()}],mt:[{mt:T()}],mr:[{mr:T()}],mb:[{mb:T()}],ml:[{ml:T()}],"space-x":[{"space-x":x()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":x()}],"space-y-reverse":["space-y-reverse"],size:[{size:A()}],"inline-size":[{inline:["auto",...M()]}],"min-inline-size":[{"min-inline":["auto",...M()]}],"max-inline-size":[{"max-inline":["none",...M()]}],"block-size":[{block:["auto",...D()]}],"min-block-size":[{"min-block":["auto",...D()]}],"max-block-size":[{"max-block":["none",...D()]}],w:[{w:[s,"screen",...A()]}],"min-w":[{"min-w":[s,"screen","none",...A()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[i]},...A()]}],h:[{h:["screen","lh",...A()]}],"min-h":[{"min-h":["screen","lh","none",...A()]}],"max-h":[{"max-h":["screen","lh",...A()]}],"font-size":[{text:["base",r,Tf,yf]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Rf,xf]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",sf,vf]}],"font-family":[{font:[Af,wf,t]}],"font-features":[{"font-features":[vf]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,Nf,vf]}],"line-clamp":[{"line-clamp":[af,"none",Nf,bf]}],leading:[{leading:[o,...x()]}],"list-image":[{"list-image":["none",Nf,vf]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Nf,vf]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:E()}],"text-color":[{text:E()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[af,"from-font","auto",Nf,yf]}],"text-decoration-color":[{decoration:E()}],"underline-offset":[{"underline-offset":[af,"auto",Nf,vf]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:x()}],"tab-size":[{tab:[of,Nf,vf]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Nf,vf]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Nf,vf]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:I()}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:R()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},of,Nf,vf],radial:["",Nf,vf],conic:[of,Nf,vf]},Ef,kf]}],"bg-color":[{bg:E()}],"gradient-from-pos":[{from:z()}],"gradient-via-pos":[{via:z()}],"gradient-to-pos":[{to:z()}],"gradient-from":[{from:E()}],"gradient-via":[{via:E()}],"gradient-to":[{to:E()}],rounded:[{rounded:_()}],"rounded-s":[{"rounded-s":_()}],"rounded-e":[{"rounded-e":_()}],"rounded-t":[{"rounded-t":_()}],"rounded-r":[{"rounded-r":_()}],"rounded-b":[{"rounded-b":_()}],"rounded-l":[{"rounded-l":_()}],"rounded-ss":[{"rounded-ss":_()}],"rounded-se":[{"rounded-se":_()}],"rounded-ee":[{"rounded-ee":_()}],"rounded-es":[{"rounded-es":_()}],"rounded-tl":[{"rounded-tl":_()}],"rounded-tr":[{"rounded-tr":_()}],"rounded-br":[{"rounded-br":_()}],"rounded-bl":[{"rounded-bl":_()}],"border-w":[{border:P()}],"border-w-x":[{"border-x":P()}],"border-w-y":[{"border-y":P()}],"border-w-s":[{"border-s":P()}],"border-w-e":[{"border-e":P()}],"border-w-bs":[{"border-bs":P()}],"border-w-be":[{"border-be":P()}],"border-w-t":[{"border-t":P()}],"border-w-r":[{"border-r":P()}],"border-w-b":[{"border-b":P()}],"border-w-l":[{"border-l":P()}],"divide-x":[{"divide-x":P()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":P()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:["solid","dashed","dotted","double","hidden","none"]}],"divide-style":[{divide:["solid","dashed","dotted","double","hidden","none"]}],"border-color":[{border:E()}],"border-color-x":[{"border-x":E()}],"border-color-y":[{"border-y":E()}],"border-color-s":[{"border-s":E()}],"border-color-e":[{"border-e":E()}],"border-color-bs":[{"border-bs":E()}],"border-color-be":[{"border-be":E()}],"border-color-t":[{"border-t":E()}],"border-color-r":[{"border-r":E()}],"border-color-b":[{"border-b":E()}],"border-color-l":[{"border-l":E()}],"divide-color":[{divide:E()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[af,Nf,vf]}],"outline-w":[{outline:["",af,Tf,yf]}],"outline-color":[{outline:E()}],shadow:[{shadow:["","none",d,If,Cf]}],"shadow-color":[{shadow:E()}],"inset-shadow":[{"inset-shadow":["none",u,If,Cf]}],"inset-shadow-color":[{"inset-shadow":E()}],"ring-w":[{ring:P()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:E()}],"ring-offset-w":[{"ring-offset":[af,yf]}],"ring-offset-color":[{"ring-offset":E()}],"inset-ring-w":[{"inset-ring":P()}],"inset-ring-color":[{"inset-ring":E()}],"text-shadow":[{"text-shadow":["none",h,If,Cf]}],"text-shadow-color":[{"text-shadow":E()}],opacity:[{opacity:[af,Nf,vf]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[af]}],"mask-image-linear-from-pos":[{"mask-linear-from":O()}],"mask-image-linear-to-pos":[{"mask-linear-to":O()}],"mask-image-linear-from-color":[{"mask-linear-from":E()}],"mask-image-linear-to-color":[{"mask-linear-to":E()}],"mask-image-t-from-pos":[{"mask-t-from":O()}],"mask-image-t-to-pos":[{"mask-t-to":O()}],"mask-image-t-from-color":[{"mask-t-from":E()}],"mask-image-t-to-color":[{"mask-t-to":E()}],"mask-image-r-from-pos":[{"mask-r-from":O()}],"mask-image-r-to-pos":[{"mask-r-to":O()}],"mask-image-r-from-color":[{"mask-r-from":E()}],"mask-image-r-to-color":[{"mask-r-to":E()}],"mask-image-b-from-pos":[{"mask-b-from":O()}],"mask-image-b-to-pos":[{"mask-b-to":O()}],"mask-image-b-from-color":[{"mask-b-from":E()}],"mask-image-b-to-color":[{"mask-b-to":E()}],"mask-image-l-from-pos":[{"mask-l-from":O()}],"mask-image-l-to-pos":[{"mask-l-to":O()}],"mask-image-l-from-color":[{"mask-l-from":E()}],"mask-image-l-to-color":[{"mask-l-to":E()}],"mask-image-x-from-pos":[{"mask-x-from":O()}],"mask-image-x-to-pos":[{"mask-x-to":O()}],"mask-image-x-from-color":[{"mask-x-from":E()}],"mask-image-x-to-color":[{"mask-x-to":E()}],"mask-image-y-from-pos":[{"mask-y-from":O()}],"mask-image-y-to-pos":[{"mask-y-to":O()}],"mask-image-y-from-color":[{"mask-y-from":E()}],"mask-image-y-to-color":[{"mask-y-to":E()}],"mask-image-radial":[{"mask-radial":[Nf,vf]}],"mask-image-radial-from-pos":[{"mask-radial-from":O()}],"mask-image-radial-to-pos":[{"mask-radial-to":O()}],"mask-image-radial-from-color":[{"mask-radial-from":E()}],"mask-image-radial-to-color":[{"mask-radial-to":E()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"]}],"mask-image-conic-pos":[{"mask-conic":[af]}],"mask-image-conic-from-pos":[{"mask-conic-from":O()}],"mask-image-conic-to-pos":[{"mask-conic-to":O()}],"mask-image-conic-from-color":[{"mask-conic-from":E()}],"mask-image-conic-to-color":[{"mask-conic-to":E()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:I()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:R()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Nf,vf]}],filter:[{filter:["","none",Nf,vf]}],blur:[{blur:L()}],brightness:[{brightness:[af,Nf,vf]}],contrast:[{contrast:[af,Nf,vf]}],"drop-shadow":[{"drop-shadow":["","none",p,If,Cf]}],"drop-shadow-color":[{"drop-shadow":E()}],grayscale:[{grayscale:["",af,Nf,vf]}],"hue-rotate":[{"hue-rotate":[af,Nf,vf]}],invert:[{invert:["",af,Nf,vf]}],saturate:[{saturate:[af,Nf,vf]}],sepia:[{sepia:["",af,Nf,vf]}],"backdrop-filter":[{"backdrop-filter":["","none",Nf,vf]}],"backdrop-blur":[{"backdrop-blur":L()}],"backdrop-brightness":[{"backdrop-brightness":[af,Nf,vf]}],"backdrop-contrast":[{"backdrop-contrast":[af,Nf,vf]}],"backdrop-grayscale":[{"backdrop-grayscale":["",af,Nf,vf]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[af,Nf,vf]}],"backdrop-invert":[{"backdrop-invert":["",af,Nf,vf]}],"backdrop-opacity":[{"backdrop-opacity":[af,Nf,vf]}],"backdrop-saturate":[{"backdrop-saturate":[af,Nf,vf]}],"backdrop-sepia":[{"backdrop-sepia":["",af,Nf,vf]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":x()}],"border-spacing-x":[{"border-spacing-x":x()}],"border-spacing-y":[{"border-spacing-y":x()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Nf,vf]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[af,"initial",Nf,vf]}],ease:[{ease:["linear","initial",v,Nf,vf]}],delay:[{delay:[af,Nf,vf]}],animate:[{animate:["none",y,Nf,vf]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[f,Nf,vf]}],"perspective-origin":[{"perspective-origin":b()}],rotate:[{rotate:F()}],"rotate-x":[{"rotate-x":F()}],"rotate-y":[{"rotate-y":F()}],"rotate-z":[{"rotate-z":F()}],scale:[{scale:B()}],"scale-x":[{"scale-x":B()}],"scale-y":[{"scale-y":B()}],"scale-z":[{"scale-z":B()}],"scale-3d":["scale-3d"],skew:[{skew:V()}],"skew-x":[{"skew-x":V()}],"skew-y":[{"skew-y":V()}],transform:[{transform:[Nf,vf,"","none","gpu","cpu"]}],"transform-origin":[{origin:b()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:$()}],"translate-x":[{"translate-x":$()}],"translate-y":[{"translate-y":$()}],"translate-z":[{"translate-z":$()}],"translate-none":["translate-none"],zoom:[{zoom:[of,Nf,vf]}],accent:[{accent:E()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:E()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Nf,vf]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":E()}],"scrollbar-track-color":[{"scrollbar-track":E()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":x()}],"scroll-mx":[{"scroll-mx":x()}],"scroll-my":[{"scroll-my":x()}],"scroll-ms":[{"scroll-ms":x()}],"scroll-me":[{"scroll-me":x()}],"scroll-mbs":[{"scroll-mbs":x()}],"scroll-mbe":[{"scroll-mbe":x()}],"scroll-mt":[{"scroll-mt":x()}],"scroll-mr":[{"scroll-mr":x()}],"scroll-mb":[{"scroll-mb":x()}],"scroll-ml":[{"scroll-ml":x()}],"scroll-p":[{"scroll-p":x()}],"scroll-px":[{"scroll-px":x()}],"scroll-py":[{"scroll-py":x()}],"scroll-ps":[{"scroll-ps":x()}],"scroll-pe":[{"scroll-pe":x()}],"scroll-pbs":[{"scroll-pbs":x()}],"scroll-pbe":[{"scroll-pbe":x()}],"scroll-pt":[{"scroll-pt":x()}],"scroll-pr":[{"scroll-pr":x()}],"scroll-pb":[{"scroll-pb":x()}],"scroll-pl":[{"scroll-pl":x()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Nf,vf]}],fill:[{fill:["none",...E()]}],"stroke-w":[{stroke:[af,Tf,yf,bf]}],stroke:[{stroke:["none",...E()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function qf(...e){return jf(Sm(e))}var Uf="REASON-file-sources",Gf="REASON-active-file-source",Wf={id:"local-default",name:"Local Files",type:"local",isDefault:!0,createdAt:/* @__PURE__ */(new Date).toISOString(),updatedAt:/* @__PURE__ */(new Date).toISOString()};function Kf(){try{let e=localStorage.getItem(Uf);if(e){let t=JSON.parse(e);return t.some(e=>"local-default"===e.id)?t:[Wf,...t]}}catch(e){}return[Wf]}function Yf(e){try{localStorage.setItem(Uf,JSON.stringify(e))}catch(e){}}function Xf(){try{return localStorage.getItem(Gf)||"local-default"}catch(e){return"local-default"}}function Zf(e){try{localStorage.setItem(Gf,e)}catch(e){}}function Jf(e){let[t,r]=fe(e),n=me(e);return le(()=>{if(n.current!==e){if(Array.isArray(n.current)&&Array.isArray(e)&&0===n.current.length&&0===e.length)return;n.current=e,r(e)}},[e]),[t,r]}function Qf(e,t){return"function"==typeof e?"object"==typeof t?e(t):e():e}function eg(e,t="data-id"){let r=e;for(!r.tagName&&e.target&&(r=e.target);r;){if(r.getAttribute&&r.getAttribute(t))return r;r=r.parentNode}return null}function tg(e,t="data-id"){let r=eg(e,t);return r?rg(r,t):null}function rg(e,t="data-id"){let r=e.getAttribute(t);return r?function(e){if(e.startsWith(":"))return e.substring(1);let t=1*e;return isNaN(t)?e:t}(r):null}function ng(e){return"string"==typeof e?":"+e:e}
60
- /* @__PURE__ */(new Date).valueOf();var ag={detect:()=>!0,addEvent:function(e,t,r){return e.addEventListener(t,r),()=>e.removeEventListener(t,r)},addGlobalEvent:function(e,t){return document.addEventListener(e,t),()=>document.removeEventListener(e,t)},getTopNode:function(){return window.document.body}};function og(e){Object.assign(ag,e)}function ig(e,t,r){ag.addEvent(e,r,function(e){let n=eg(e);if(!n)return;let a=rg(n);if("function"==typeof t)return t(a,e);let o,i=e.target;for(;i!=n;){if(o=i.dataset?i.dataset.action:null,o&&t[o])return void t[o](a,e);i=i.parentNode}t[r]&&t[r](a,e)})}function sg(e,t){ig(e,t,"click"),t.dblclick&&ig(e,t.dblclick,"dblclick")}function lg(e,t,r){for(let n=0;n<hg.length;n++){if(n===r)continue;let a=hg[n],o=a.props.parent?.();if(o&&e.contains(o)&&a.node.contains(t))return!0}return!1}var cg=/* @__PURE__ */new Date,dg=!1,ug=[],hg=[],pg=e=>{let t=e.target;if(!dg&&t.isConnected)for(let r=hg.length-1;r>=0;r--){let{node:n,date:a,props:o}=hg[r];if(!(a>cg)&&!n.contains(t)&&n!==t&&(lg(n,t,r)||(o.callback&&o.callback(e),o.modal||e.defaultPrevented)))break}else dg=!1},mg=e=>{cg=/* @__PURE__ */new Date,dg=!0;for(let t=hg.length-1;t>=0;t--){let{node:r}=hg[t];if(!r.contains(e.target)&&r!==e.target){dg=!1;break}}};function fg(e,t){ug.length||(ug=[ag.addGlobalEvent("click",pg,e),ag.addGlobalEvent("contextmenu",pg,e),ag.addGlobalEvent("mousedown",mg,e)]),"object"!=typeof t&&(t={callback:t});let r={node:e,date:/* @__PURE__ */new Date,props:t};return hg.push(r),{destroy(){(function(e,t){for(let r=e.length-1;r>=0;r--)if(e[r]===t){e.splice(r,1);break}})(hg,r),hg.length||(ug.forEach(e=>e()),ug=[])}}}var gg,vg,yg,bg,xg=e=>-1!==e.indexOf("bottom"),wg=e=>-1!==e.indexOf("left"),Sg=e=>-1!==e.indexOf("right"),kg=e=>-1!==e.indexOf("top"),Cg=e=>-1!==e.indexOf("fit"),Ng=e=>-1!==e.indexOf("overlap");function Tg(e,t,r="bottom",n=0,a=0){if(!e)return null;gg=n,vg=a,yg="auto";let o=0,i=0,s=r,l=Ag(e),c=Ng(r)?ag.getTopNode(e):l;if(!l)return null;let d=l.getBoundingClientRect(),u=e.getBoundingClientRect(),h=c.getBoundingClientRect(),p=window.getComputedStyle(c),m={left:0,top:0,bottom:0,right:0};for(let x in m){let e=`border-${x}-width`;m[x]=parseFloat(p.getPropertyValue(e))}if(t){let e=function(e,t){let r=0,n=ag.getTopNode(e);for(;e&&e!==n;){let n=getComputedStyle(e).position;if(("absolute"===n||"relative"===n||"fixed"===n)&&(r=parseInt(getComputedStyle(e).zIndex)||0),(e=e.parentNode)===t)break}return r}(t,l);o=Math.max(e+1,20)}if(t){if(bg=t.getBoundingClientRect(),Cg(r)&&(yg=bg.width+"px"),"point"!==r)if((e=>e.split("-").every(e=>["center","fit"].indexOf(e)>-1))(r))Cg(r)?gg=0:(gg=h.width/2,i=1),vg=(h.height-u.height)/2;else{let e=+!Ng(r);gg=Sg(r)?bg.right+e:bg.left-e,vg=xg(r)?bg.bottom+1:bg.top;let t=(e=>{let t=e.match(/(start|center|end)/);return t?t[0]:null})(r);t&&(Sg(r)||wg(r)?"center"===t?vg-=(u.height-bg.height)/2:"end"===t&&(vg-=u.height-bg.height):(xg(r)||kg(r))&&("center"===t?gg-=(u.width-bg.width)/2:"end"===t&&(gg-=u.width-bg.width),Ng(r)||(gg+=1)))}}else bg={left:n,right:n,top:a,bottom:a};let f=(wg(r)||Sg(r))&&(xg(r)||kg(r));wg(r)&&(i=2);let g=gg-u.width-h.left;t&&wg(r)&&!f&&g<0&&(gg=bg.right,i=0,s=s.replace("left","right"));let v=gg+u.width*(1-i/2)-h.right;if(v>0)if(Sg(r)){let e=bg.left-h.x-u.width;t&&!f&&e>=0?(gg=bg.left-u.width,s=s.replace("right","left")):gg-=v+m.right}else gg=h.right-m.right-u.width;i&&(gg=Math.round(gg-u.width*i/2));let y=g<0||v>0||!f;kg(r)&&(vg=bg.top-u.height,t&&vg<h.y&&y&&(vg=bg.bottom,s=s.replace("top","bottom")));let b=vg+u.height-h.bottom;return b>0&&(t&&xg(r)&&y?(vg-=u.height+bg.height+1,s=s.replace("bottom","top")):vg-=b+m.bottom),gg-=d.left+m.left,vg-=d.top+m.top,gg=(Ng(r)?gg:Math.max(gg,0))+c.scrollLeft,vg=(Ng(r)?vg:Math.max(vg,0))+c.scrollTop,yg||="auto",{at:s,x:gg,y:vg,z:o,width:yg}}function Ag(e){let t=ag.getTopNode(e);for(e&&=e.parentElement;e;){let r=getComputedStyle(e).position;if(e===t||"relative"===r||"absolute"===r||"fixed"===r)return e;e=e.parentNode}return null}var Mg=/* @__PURE__ */(new Date).valueOf();function Dg(){return Mg+=1}function Eg(e){return e<10?"0"+e:e.toString()}function Ig(e){let t=11*Math.floor(e/11);return{start:t,end:t+11}}function Rg(e){let t=(e.getDay()+6)%7,r=new Date(e.valueOf());r.setDate(e.getDate()+(3-t)),r.setHours(0,0,0,0);let n=new Date(r.getFullYear(),0,1),a=Math.round((r.getTime()-n.getTime())/864e5);return 1+Math.floor(a/7)}var zg=["",""];function _g(e,t,r){switch(e){case"%d":return Eg(t.getDate());case"%m":return Eg(t.getMonth()+1);case"%j":return t.getDate();case"%n":return t.getMonth()+1;case"%y":return Eg(t.getFullYear()%100);case"%Y":return t.getFullYear();case"%D":return r.dayShort[t.getDay()];case"%l":return r.dayFull[t.getDay()];case"%M":return r.monthShort[t.getMonth()];case"%F":return r.monthFull[t.getMonth()];case"%h":return Eg((t.getHours()+11)%12+1);case"%g":return(t.getHours()+11)%12+1;case"%G":return t.getHours();case"%H":return Eg(t.getHours());case"%i":return Eg(t.getMinutes());case"%a":return((t.getHours()>11?r.pm:r.am)||zg)[0];case"%A":return((t.getHours()>11?r.pm:r.am)||zg)[1];case"%s":return Eg(t.getSeconds());case"%S":return function(e){let t=Eg(e);return 2==t.length?"0"+t:t}(t.getMilliseconds());case"%W":return Eg(Rg(t));case"%w":{let e=r.weekStart??1;if(1===e)return Eg(Rg(t));let n=(t.getDay()-e+7)%7,a=(1-e+7)%7,o=new Date(t.valueOf());return o.setDate(t.getDate()+(a-n)),Eg(Rg(o))}case"%c":{let e=t.getFullYear()+"";return e+="-"+Eg(t.getMonth()+1),e+="-"+Eg(t.getDate()),e+="T",e+=Eg(t.getHours()),e+=":"+Eg(t.getMinutes()),e+=":"+Eg(t.getSeconds()),e}case"%Q":return Math.floor(t.getMonth()/3)+1;default:return e}}var Pg=/%[a-zA-Z]/g;function Og(e,t){return"function"==typeof e?e:function(r){return r?(r.getMonth||(r=new Date(r)),e.replace(Pg,e=>_g(e,r,t))):""}}function Lg(e){return e&&"object"==typeof e&&!Array.isArray(e)}function Fg(e,t){for(let r in t){let n=t[r];e[r]=Lg(e[r])&&Lg(n)?Fg({...e[r]},t[r]):t[r]}return e}function Bg(e){return{getGroup(t){let r=e[t];return e=>r&&r[e]||e},getRaw:()=>e,extend(t,r){if(!t)return this;let n;return n=r?Fg({...t},e):Fg({...e},t),Bg(n)}}}var Vg={core:{ok:"OK",cancel:"Cancel",select:"Select","No data":"No data","Rows per page":"Rows per page","Total pages":"Total pages"},calendar:{monthFull:["January","February","March","April","May","June","July","August","September","October","November","December"],monthShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayFull:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],hours:"Hours",minutes:"Minutes",done:"Done",clear:"Clear",today:"Today",am:["am","AM"],pm:["pm","PM"],weekStart:0,clockFormat:24},formats:{timeFormat:"%H:%i",dateFormat:"%m/%d/%Y",monthYearFormat:"%F %Y",yearFormat:"%Y"},lang:"en-US"},$g=te(""),Hg=te({}),jg=te(null),qg=te(null),Ug=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,fieldId:qg,helpers:Hg,i18n:jg,theme:$g},Symbol.toStringTag,{value:"Module"}));function Gg(e){let t=se(qg),[r]=fe(()=>e||t||Dg());return r}function Wg({type:e="",css:t="",icon:r="",disabled:n=!1,title:a="",tooltip:o,text:i="",children:s,onClick:l}){let c=pe(()=>{let r=e?e.split(" ").filter(e=>""!==e).map(e=>"wx-"+e).join(" "):"";return t+(t?" ":"")+r},[e,t]);/* @__PURE__ */
61
- return xe("button",{title:a,className:`wx-2ZWgb4 wx-button ${c} ${r&&!s?"wx-icon":""}`,disabled:n,onClick:e=>{l&&l(e)},"data-tooltip-text":o,children:[r&&/* @__PURE__ */be("i",{className:"wx-2ZWgb4 "+r}),s||i||" "]})}function Kg({id:e,label:t="",inputValue:r="",value:n=!1,onChange:a,disabled:o=!1,css:i=""}){let s=Gg(e),[l,c]=Jf(n);/* @__PURE__ */
62
- return xe("div",{className:`wx-2IvefP wx-checkbox ${i}`,children:[/* @__PURE__ */be("input",{type:"checkbox",id:s,disabled:o,className:"wx-2IvefP wx-check",checked:l,value:r,onChange:({target:e})=>{let t=e.checked;c(t),a&&a({value:t,inputValue:r})}}),/* @__PURE__ */xe("label",{htmlFor:s,className:"wx-2IvefP wx-label",children:[/* @__PURE__ */be("span",{className:"wx-2IvefP wx-before"}),t&&/* @__PURE__ */be("span",{className:"wx-2IvefP wx-after",children:t})]})]})}function Yg({theme:e="",target:t,children:r}){let n=me(null),a=me(null),[o,i]=fe(null);n.current||=document.createElement("div");let s=se($g);return le(()=>{i(t||function(e){let t=ag.getTopNode(e);for(;e&&e!==t&&!e.getAttribute("data-wx-portal-root");)e=e.parentNode;return e}(a.current)||ag.getTopNode(a.current))},[a.current]),/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be("span",{ref:a,style:{display:"none"}}),a.current&&o?vt(/* @__PURE__ */be("div",{className:`wx-3ZWsT0 wx-${e||s}-theme`,children:r}),o):null]})}function Xg({left:e=0,top:t=0,at:r="bottom",parent:n=null,width:a="auto",css:o="",onCancel:i,children:s,trackScroll:l=!1}){let[c,d]=fe(0),[u,h]=fe(0),[p,m]=fe("auto"),[f,g]=fe(!1),v=me(null),y=me(null),b=me(i);function x(e){return n&&(a+"").indexOf("%")>-1?a.replace(/(\d+)%/,(e,t)=>(t=t*n.offsetWidth/100+"px",a.replace(e,t))):a&&"auto"!==a?a:e}le(()=>{b.current=i},[i]);let w=ie(()=>{if(!v.current)return;let a=Tg(v.current,n,r,e,t);a&&(d(a.x),h(a.y),m(x(a.width)))},[v,n,r,e,t,a]);return he(()=>{let e,t=e=>{b.current&&e.target!==y.current&&v.current&&!v.current.contains(e.target)&&b.current(e)};return requestAnimationFrame(()=>{w(),g(!0),l&&v.current&&(y.current=Ag(v.current),y.current&&y.current.addEventListener("scroll",t,!0)),n&&(e=new ResizeObserver(w),e.observe(n))}),()=>{l&&y.current&&y.current.removeEventListener("scroll",t,!0),e?.disconnect()}},[]),he(()=>{w()},[n,r,e,t]),le(()=>{if(v.current)return fg(v.current,{callback:e=>{b.current&&b.current(e)},parent:()=>n}).destroy},[n]),/* @__PURE__ */be("div",{ref:v,className:["wx-37M6Fj","wx-popup",o].filter(Boolean).join(" "),style:{position:"absolute",visibility:f?"visible":"hidden",top:u+"px",left:c+"px",width:p},children:s})}function Zg({position:e="bottom",align:t="start",autoFit:r=!0,onCancel:n=null,width:a="100%",css:o="",children:i}){let s=me(null),[l,c]=fe(e),[d,u]=fe(t),h=me(n);return le(()=>{h.current=n},[n]),le(()=>{if(r){let e=s.current;if(e){let t=e.getBoundingClientRect(),r=document.body.getBoundingClientRect();t.right>=r.right&&u("end"),t.bottom>=r.bottom&&c("top")}}},[]),le(()=>{if(s.current)return fg(s.current,e=>{h.current&&h.current(e)}).destroy},[]),/* @__PURE__ */be("div",{ref:s,className:["wx-dropdown",`wx-${l}-${d}`,o||"","wx-aaaVytZW"].filter(Boolean).join(" "),style:{width:a},children:i})}function Jg({position:e="bottom",align:t="start",autoFit:r=!0,inline:n=!1,onCancel:a,width:o="100%",children:i,...s}){let[l,c]=fe(void 0),d=me(null),u=pe(()=>`${e}-${t}`,[e,t]);return he(()=>{d.current&&c(d.current.parentNode)},[]),/* @__PURE__ */xe(ye,{children:[l&&(n?/* @__PURE__ */be(Zg,{onCancel:a,position:e,align:t,autoFit:r,width:o,...s,children:i}):/* @__PURE__ */be(Yg,{children:/* @__PURE__ */be(Xg,{parent:l,at:u,onCancel:a,width:o,...s,children:i})})),/* @__PURE__ */be("span",{ref:d,className:"wx-portal-node wx-32GZ52"})]})}function Qg(){return Bg(Vg)}var ev=oe(function({data:e,checkboxes:t,itemTemplate:r,value:n}){/* @__PURE__ */
63
- return xe(ye,{children:[t&&/* @__PURE__ */be(Kg,{id:e.id,css:"wx-list-checkbox",value:n&&n.includes(e.id)}),r?Qf(r,{option:e}):e.label]})});function tv({visibleItems:e,visibleRange:t,navIndex:r,checkboxes:n,itemTemplate:a,value:o,measureRefCallback:i}){return e.map((e,s)=>{let l=t.start+s;/* @__PURE__ */
64
- return be("div",{ref:0===s?i:void 0,className:"wx-233fr7 wx-item "+(l===r?"wx-focus":""),"data-id":e.id,children:/* @__PURE__ */be(ev,{data:e,checkboxes:n,itemTemplate:a,value:o})},e.id)})}function rv({items:e=[],children:t,onSelect:r,onReady:n,virtualized:a=!1,checkboxes:o,multiselect:i,value:s,...l}){let c=me(),d=me(!1),u=me(function(){let e,t,r,n,a=null,o=!1,i=!1,s=e=>{a=e,o=null!==a,r(a)},l=(t,r)=>{if(!i&&null!==t&&e){let n=e.querySelectorAll(".wx-list > .wx-item")[t];n&&(n.scrollIntoView({block:"nearest"}),r&&r.preventDefault())}},c=(r,n)=>{let o=null===r?null:Math.max(0,Math.min(a+r,t.length-1));o!==a&&(s(o),e?l(o,n):requestAnimationFrame(()=>l(o,n)))};return{move:e=>{let r=tg(e),n=t.findIndex(e=>e.id===r);n!==a&&s(n)},keydown:(e,t)=>{switch(e.code){case"Enter":o?n():s(0);break;case"Space":o||s(0);break;case"Escape":case"Tab":r(a=null);break;case"ArrowDown":c(o?1:t||0,e);break;case"ArrowUp":c(o?-1:t||0,e)}},init:(a,o,s,l,c)=>{e=a,t=o,r=s,n=l,i=c},navigate:c}}()),[h,p]=fe(null),m=me(h),[f,g]=fe(0),[v,y]=fe(24),b=me(!1),x=(se(jg)||Qg()).getGroup("core"),w=me(e);le(()=>{w.current=e},[e]);let S=me(s);le(()=>{S.current=s},[s]);let k=me(0);le(()=>{k.current=v},[v]);let C=ie(e=>{e&&e.stopPropagation();let t,n=w.current,a=S.current,o=m.current,s=n[o]?.id;t=i?a&&a.includes(s)?a.filter(e=>e!==s):[...a||[],s]:s,r&&r({id:t})},[i,r]),N=me(C);le(()=>{N.current=C},[C]);let T=ie(e=>{if(c.current){let t=e*k.current-c.current.clientHeight+k.current;g(t),c.current.scrollTop=t}},[k.current]),A=ie(e=>{c.current=e,a&&(e&&!d.current&&null!==m.current&&requestAnimationFrame(()=>{c.current&&(T(m.current),d.current=!0)}),e||(d.current=!1))},[T]),M=ie(e=>{if(!e||b.current)return;let t=e.getBoundingClientRect().height;t&&(y(t),k.current=t,b.current=!0)},[]);le(()=>{u.current.init(c.current,e,e=>{p(e),m.current=e},e=>N.current(e),a)},[e,c.current,a]),le(()=>{n&&n({navigate:a?(e,t)=>{u.current.navigate(e,t),T(m.current)}:u.current.navigate,keydown:a?(e,t)=>{let r=m.current,n=w.current;if(0!==r&&r!==n.length-1&&("ArrowDown"===e.key||"ArrowUp"===e.key)&&e.preventDefault(),u.current.keydown(e,t),c.current){let e=c.current.scrollTop<=m.current*k.current,t=c.current.scrollTop+c.current.clientHeight>=m.current*k.current+k.current;e?t||T(m.current):(c.current.scrollTop=m.current*k.current,g(c.current.scrollTop))}}:u.current.keydown,move:u.current.move})},[]);let D=me(0),E=me(e);E.current!==e&&(E.current=e,D.current+=1);let I=ie(()=>{u.current.navigate(null)},[u]),R=ie(e=>{a&&g(e.target.scrollTop)},[a]),z=pe(()=>Math.ceil((c.current?.clientHeight||0)/v),[v,f]),_=pe(()=>{if(!a)return{start:0,end:e.length};if(!e.length)return{start:0,end:0};let t=Math.floor(f/v),r=t+z;return{start:Math.max(0,t-10),end:Math.min(e.length,r+10)}},[a,e,f,v,z]),P=pe(()=>{if(!a)return e;let{start:t,end:r}=_;return e.slice(t,r).map(e=>({...e}))},[a,e,_]),O=_.start*v,L=e.length*v;return le(()=>{a&&g(0)},[e,a]),le(()=>{null===h&&(d.current=!1)},[h]),null===h?null:/* @__PURE__ */be(Jg,{onCancel:I,...l,children:/* @__PURE__ */be("div",{className:"wx-233fr7 wx-list",ref:A,onClick:C,onMouseMove:u.current.move,onScroll:R,children:e.length?a?/* @__PURE__ */be("div",{className:"wx-233fr7 wx-list-wrapper",style:{height:`${L}px`},children:/* @__PURE__ */be("div",{className:"wx-233fr7 wx-list-content",style:{transform:`translateY(${O}px)`},children:/* @__PURE__ */be(tv,{visibleRange:_,visibleItems:P,navIndex:h,measureRefCallback:M,checkboxes:o,itemTemplate:t,value:s})})}):/* @__PURE__ */be(tv,{visibleRange:_,visibleItems:P,navIndex:h,measureRefCallback:M,checkboxes:o,itemTemplate:t,value:s}):/* @__PURE__ */be("div",{className:"wx-233fr7 wx-no-data",children:x("No data")})})},D.current)}function nv({value:e="",id:t,readonly:r=!1,focus:n=!1,select:a=!1,type:o="text",placeholder:i="",disabled:s=!1,error:l=!1,title:c="",tooltip:d,css:u="",icon:h="",clear:p=!1,onChange:m}){let f=Gg(t),[g,v]=Jf(e),y=me(null),b=pe(()=>h&&-1===u.indexOf("wx-icon-left")?"wx-icon-right "+u:u,[h,u]),x=pe(()=>h&&-1!==u.indexOf("wx-icon-left"),[h,u]);le(()=>{let e=setTimeout(()=>{n&&y.current&&y.current.focus(),a&&y.current&&y.current.select()},1);return()=>clearTimeout(e)},[n,a]);let w=ie(e=>{let t=e.target.value;v(t),m&&m({value:t,input:!0})},[m]),S=ie(e=>m&&m({value:e.target.value}),[m]);let k=o;return"password"!==o&&"number"!==o&&(k="text"),le(()=>{let e=S,t=y.current;return t.addEventListener("change",e),()=>{t&&t.removeEventListener("change",e)}},[S]),/* @__PURE__ */xe("div",{className:`wx-hQ64J4 wx-text ${b} ${l?"wx-error":""} ${s?"wx-disabled":""} ${p?"wx-clear":""}`,"data-tooltip-text":d,children:[/* @__PURE__ */be("input",{className:"wx-hQ64J4 wx-input",ref:y,id:f,readOnly:r,disabled:s,placeholder:i,type:k,title:c,value:g,onInput:w}),p&&!s&&g?/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be("i",{className:"wx-hQ64J4 wx-icon wxi-close",onClick:function(e){e.stopPropagation(),v(""),m&&m({value:""})}}),x&&/* @__PURE__ */be("i",{className:`wx-hQ64J4 wx-icon ${h}`})]}):h?/* @__PURE__ */be("i",{className:`wx-hQ64J4 wx-icon ${h}`}):null]})}function av({date:e,type:t,part:r,onShift:n}){let{calendar:a,formats:o}=se(jg).getRaw(),i=e.getFullYear(),s=pe(()=>{switch(t){case"month":return Og(o.monthYearFormat,a)(e);case"year":return Og(o.yearFormat,a)(e);case"duodecade":{let{start:e,end:t}=Ig(i),r=Og(o.yearFormat,a);return`${r(new Date(e,0,1))} - ${r(new Date(t,11,31))}`}default:return""}},[e,t,i,a,o]);/* @__PURE__ */
59
+ return be(Vd.button,{type:"button",...n,ref:t,onClick:Yc(e.onClick,()=>a.onOpenChange(!1))})},"DialogClose"));function ep(e){return e?"open":"closed"}Eh(ep,"getState");var tp=e=>e?.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var rp=(...e)=>e.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),np={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};function ap(e){return null!=e}function op(e,t={}){return function(e,t={}){let r=t.attributeNames??{},n=e=>r[e]??e,a=e.size??e.width??np.width,o=e.size??e.height??np.height,i=e.aliases?.filter(e=>"string"==typeof e&&""!==e.trim()).map(e=>`lucide-${e}`)??[],s=[...e.name?[`lucide-${e.name}`]:[],...i],l=t.className?.split(" ").filter(Boolean)??[],c=!1===t.includeDefaultClasses?rp(...l):rp("lucide",...s,...l),d=t.absoluteStrokeWidth?Number(t.strokeWidth??np["stroke-width"])*Number(e.size??e.width??np.width)/Number(t.size??t.width??np.width):t.strokeWidth??np["stroke-width"];return["svg",{...Object.entries(np).reduce((e,[t,r])=>(e[n(t)]=r,e),{}),..."color"in t&&t.color&&{[n("stroke")]:t.color},..."size"in t&&ap(t.size)&&{[n("width")]:t.size,[n("height")]:t.size},..."width"in t&&ap(t.width)&&{[n("width")]:t.width},..."height"in t&&ap(t.height)&&{[n("height")]:t.height},[n("stroke-width")]:d,...c&&{[n("class")]:c},[n("viewBox")]:`0 0 ${a} ${o}`,...!1===t.hasA11yProp?{[n("aria-hidden")]:"true"}:{},..."attributes"in t&&t.attributes},e.node.map(e=>{let[r,a,o]=e,i=t.nonScalingStroke?{[n("vector-effect")]:"non-scaling-stroke",...a}:a;return o?[r,i,o]:[r,i]})]}(e,{...t,attributeNames:{...t.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}var ip=te({}),sp=ne(({color:e,size:t,width:r,height:n,strokeWidth:a,absoluteStrokeWidth:o,nonScalingStroke:i,className:s="",children:l,iconNode:c=[],icon:d={node:c,aliases:[],size:24},...u},h)=>{let{size:p=24,strokeWidth:m=2,absoluteStrokeWidth:f=!1,nonScalingStroke:g=!1,color:v="currentColor",className:y=""}=se(ip)??{},b=!!l||(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1})(u),[x,w,S=[]]=op(d,{color:e??v,width:r??t??p,height:n??t??p,strokeWidth:a??m,absoluteStrokeWidth:o??f,nonScalingStroke:i??g,className:rp(y,s),hasA11yProp:b,attributes:u});return re(x,{ref:h,...w},[...S.map(([e,t])=>re(e,t)),...Array.isArray(l)?l:[l]])});function lp(e,t=[],r=[]){let n="string"==typeof e?function(e,t,r=[]){if(null==t)throw Error("[lucide]: iconNode is required when icon name is used");return{name:tp(e),size:24,node:t,...r.length>0?{aliases:r}:{}}}(e,t,r):e,a=ne(({className:e,...t},r)=>re(sp,{ref:r,icon:n,className:e,...t}));return n.name&&(a.displayName=(e=>{let t=(e=>{let t="",r=!1;for(let n of e)"-"===n||"_"===n||n<=" "?r=t.length>0:(0===t.length?t+=n.toLowerCase():t+=r?n.toUpperCase():n,r=!1);return t})(e);return t.charAt(0).toUpperCase()+t.slice(1)})(n.name)),a}var cp={name:"arrow-down-from-line",size:24,node:[["path",{d:"M19 3H5",key:"1236rx"}],["path",{d:"M12 21V7",key:"gj6g52"}],["path",{d:"m6 15 6 6 6-6",key:"h15q88"}]]},dp=(lp(cp),{name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]}),up=lp(dp),hp={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]},pp=lp(hp),mp={name:"chevron-right",size:24,node:[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]},fp=lp(mp),gp={name:"chevrons-down-up",size:24,node:[["path",{d:"m7 20 5-5 5 5",key:"13a0gw"}],["path",{d:"m7 4 5 5 5-5",key:"1kwcof"}]]},vp=(lp(gp),{name:"chevrons-up-down",size:24,node:[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]}),yp=(lp(vp),{name:"circle-x",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],aliases:["x-circle"]}),bp=(lp(yp),{name:"circle",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]}),xp=lp(bp),wp={name:"clipboard-paste",size:24,node:[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]]},Sp=lp(wp),kp={name:"clipboard",size:24,node:[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]},Cp=lp(kp),Np={name:"cloud",size:24,node:[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]},Tp=(lp(Np),{name:"columns-2",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],aliases:["columns"]}),Ap=(lp(Tp),{name:"copy",size:24,node:[["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"}]]}),Mp=lp(Ap),Dp={name:"database",size:24,node:[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]},Ep=(lp(Dp),{name:"ellipsis",size:24,node:[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],aliases:["more-horizontal"]}),Ip=(lp(Ep),{name:"file-plus",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]}),Rp=(lp(Ip),{name:"file-plus-corner",size:24,node:[["path",{d:"M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35",key:"17jvcc"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M14 19h6",key:"bvotb8"}],["path",{d:"M17 16v6",key:"18yu1i"}]],aliases:["file-plus-2"]}),zp=(lp(Rp),{name:"file-text",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]}),_p=lp(zp),Pp={name:"folder-open",size:24,node:[["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"}]]},Op=lp(Pp),Lp={name:"folder-plus",size:24,node:[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["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"}]]},Fp=(lp(Lp),{name:"folder",size:24,node:[["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"}]]}),Bp=lp(Fp),Vp={name:"folders",size:24,node:[["path",{d:"M20 5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h2.5a1.5 1.5 0 0 1 1.2.6l.6.8a1.5 1.5 0 0 0 1.2.6z",key:"a4852j"}],["path",{d:"M3 8.268a2 2 0 0 0-1 1.738V19a2 2 0 0 0 2 2h11a2 2 0 0 0 1.732-1",key:"yxbcw3"}]]},$p=(lp(Vp),{name:"hard-drive",size:24,node:[["path",{d:"M10 16h.01",key:"1bzywj"}],["path",{d:"M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"18tbho"}],["path",{d:"M21.946 12.013H2.054",key:"zqlbp7"}],["path",{d:"M6 16h.01",key:"1pmjb7"}]]}),Hp=(lp($p),{name:"hash",size:24,node:[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]}),jp=lp(Hp),qp={name:"layers",size:24,node:[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],aliases:["layers-3"]},Up=lp(qp),Gp={name:"lightbulb",size:24,node:[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]},Wp=(lp(Gp),{name:"link-2",size:24,node:[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]}),Kp=lp(Wp),Yp={name:"loader-circle",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],aliases:["loader-2"]},Xp=(lp(Yp),{name:"message-square-plus",size:24,node:[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M12 8v6",key:"1ib9pf"}],["path",{d:"M9 11h6",key:"1fldmi"}]]}),Zp=(lp(Xp),{name:"message-square",size:24,node:[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]}),Jp=(lp(Zp),{name:"pen",size:24,node:[["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"}]],aliases:["edit-2"]}),Qp=(lp(Jp),{name:"pencil",size:24,node:[["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"}]]}),em=lp(Qp),tm={name:"rotate-ccw",size:24,node:[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]},rm=(lp(tm),{name:"search",size:24,node:[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]}),nm=(lp(rm),{name:"server",size:24,node:[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]}),am=(lp(nm),{name:"settings",size:24,node:[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]}),om=(lp(am),{name:"sparkles",size:24,node:[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],aliases:["stars"]}),im=lp(om),sm={name:"square-split-vertical",size:24,node:[["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"M21 16v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-3",key:"14rx03"}],["path",{d:"M3 8V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v3",key:"1haecz"}]],aliases:["split-square-vertical"]},lm=(lp(sm),{name:"tag",size:24,node:[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]}),cm=lp(lm),dm={name:"text-align-start",size:24,node:[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]],aliases:["text","align-left"]},um=lp(dm),hm={name:"trash",size:24,node:[["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"}]],aliases:["trash-2"]},pm=lp(hm),mm={name:"workflow",size:24,node:[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]},fm=(lp(mm),{name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]});lp(fm);function gm(e){var t,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=gm(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function vm(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=gm(e))&&(n&&(n+=" "),n+=t);return n}var ym=(e=/* @__PURE__ */new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),bm="-",xm=[],wm=e=>{let t=Cm(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return km(e);let r=e.split(bm);return Sm(r,+(""===r[0]&&r.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=n[e],a=r[e];return t?a?((e,t)=>{let r=Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r})(a,t):t:a||xm}return r[e]||xm}}},Sm=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;let n=e[t],a=r.nextPart.get(n);if(a){let r=Sm(e,t+1,a);if(r)return r}let o=r.validators;if(null===o)return;let i=0===t?e.join(bm):e.slice(t).join(bm),s=o.length;for(let l=0;l<s;l++){let e=o[l];if(e.validator(i))return e.classGroupId}},km=e=>-1===e.slice(1,-1).indexOf(":")?void 0:(()=>{let t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?"arbitrary.."+n:void 0})(),Cm=e=>{let{theme:t,classGroups:r}=e;return Nm(r,t)},Nm=(e,t)=>{let r=ym();for(let n in e){let a=e[n];Tm(a,r,n,t)}return r},Tm=(e,t,r,n)=>{let a=e.length;for(let o=0;o<a;o++){let a=e[o];Am(a,t,r,n)}},Am=(e,t,r,n)=>{"string"!=typeof e?"function"!=typeof e?Em(e,t,r,n):Dm(e,t,r,n):Mm(e,t,r)},Mm=(e,t,r)=>{(""===e?t:Im(t,e)).classGroupId=r},Dm=(e,t,r,n)=>{Rm(e)?Tm(e(n),t,r,n):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(r,e)))},Em=(e,t,r,n)=>{let a=Object.entries(e),o=a.length;for(let i=0;i<o;i++){let[e,o]=a[i];Tm(o,Im(t,e),r,n)}},Im=(e,t)=>{let r=e,n=t.split(bm),a=n.length;for(let o=0;o<a;o++){let e=n[o],t=r.nextPart.get(e);t||(t=ym(),r.nextPart.set(e,t)),r=t}return r},Rm=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,zm=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null),a=(a,o)=>{r[a]=o,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(e){let t=r[e];return void 0!==t?t:void 0!==(t=n[e])?(a(e,t),t):void 0},set(e,t){e in r?r[e]=t:a(e,t)}}},_m=[],Pm=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),Om=e=>{let{prefix:t,experimentalParseClassName:r}=e,n=e=>{let t,r=[],n=0,a=0,o=0,i=e.length;for(let d=0;d<i;d++){let i=e[d];if(0===n&&0===a){if(":"===i){r.push(e.slice(o,d)),o=d+1;continue}if("/"===i){t=d;continue}}"["===i?n++:"]"===i?n--:"("===i?a++:")"===i&&a--}let s=0===r.length?e:e.slice(o),l=s,c=!1;return s.endsWith("!")?(l=s.slice(0,-1),c=!0):s.startsWith("!")&&(l=s.slice(1),c=!0),Pm(r,c,l,t&&t>o?t-o:void 0)};if(t){let e=t+":",r=n;n=t=>t.startsWith(e)?r(t.slice(e.length)):Pm(_m,!1,t,void 0,!0)}if(r){let e=n;n=t=>r({className:t,parseClassName:e})}return n},Lm=e=>{let t=/* @__PURE__ */new Map;return e.orderSensitiveModifiers.forEach((e,r)=>{t.set(e,1e6+r)}),e=>{let r=[],n=[];for(let a=0;a<e.length;a++){let o=e[a],i="["===o[0],s=t.has(o);i||s?(n.length>0&&(n.sort(),r.push(...n),n=[]),r.push(o)):n.push(o)}return n.length>0&&(n.sort(),r.push(...n)),r}},Fm=e=>{let t=Object.create(null),r=e.postfixLookupClassGroups;if(r)for(let n=0;n<r.length;n++)t[r[n]]=!0;return t},Bm=/\s+/,Vm=e=>{if("string"==typeof e)return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Vm(e[n]))&&(r&&(r+=" "),r+=t);return r},$m=(e,...t)=>{let r,n,a,o,i=e=>{let t=n(e);if(t)return t;let o=((e,t)=>{let{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:o,postfixLookupClassGroupIds:i}=t,s=[],l=e.trim().split(Bm),c="";for(let d=l.length-1;d>=0;--d){let e=l[d],{isExternal:t,modifiers:u,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:m}=r(e);if(t){c=e+(c.length>0?" "+c:c);continue}let f,g=!!m;if(g){f=n(p.substring(0,m));let e=f&&i[f]?n(p):void 0;e&&e!==f&&(f=e,g=!1)}else f=n(p);if(!f){if(!g){c=e+(c.length>0?" "+c:c);continue}if(f=n(p),!f){c=e+(c.length>0?" "+c:c);continue}g=!1}let v=0===u.length?"":1===u.length?u[0]:o(u).join(":"),y=h?v+"!":v,b=y+f;if(s.indexOf(b)>-1)continue;s.push(b);let x=a(f,g);for(let r=0;r<x.length;++r){let e=x[r];s.push(y+e)}c=e+(c.length>0?" "+c:c)}return c})(e,r);return a(e,o),o};return o=s=>(r=(e=>({cache:zm(e.cacheSize),parseClassName:Om(e),sortModifiers:Lm(e),postfixLookupClassGroupIds:Fm(e),...wm(e)}))(t.reduce((e,t)=>t(e),e())),n=r.cache.get,a=r.cache.set,o=i,i(s)),(...e)=>o(((...e)=>{let t,r,n=0,a="";for(;n<e.length;)(t=e[n++])&&(r=Vm(t))&&(a&&(a+=" "),a+=r);return a})(...e))},Hm=[],jm=e=>{let t=t=>t[e]||Hm;return t.isThemeGetter=!0,t},qm=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Um=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Gm=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Wm=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Km=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Ym=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Xm=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Zm=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Jm=e=>Gm.test(e),Qm=e=>!!e&&!Number.isNaN(Number(e)),ef=e=>!!e&&Number.isInteger(Number(e)),tf=e=>e.endsWith("%")&&Qm(e.slice(0,-1)),rf=e=>Wm.test(e),nf=()=>!0,af=e=>Km.test(e)&&!Ym.test(e),of=()=>!1,sf=e=>Xm.test(e),lf=e=>Zm.test(e),cf=e=>!hf(e)&&!xf(e),df=e=>e.startsWith("@container")&&("/"===e[10]&&void 0!==e[11]||"s"===e[11]&&void 0!==e[16]&&e.startsWith("-size/",10)||"n"===e[11]&&void 0!==e[18]&&e.startsWith("-normal/",10)),uf=e=>Mf(e,Rf,of),hf=e=>qm.test(e),pf=e=>Mf(e,zf,af),mf=e=>Mf(e,_f,Qm),ff=e=>Mf(e,Of,nf),gf=e=>Mf(e,Pf,of),vf=e=>Mf(e,Ef,of),yf=e=>Mf(e,If,lf),bf=e=>Mf(e,Lf,sf),xf=e=>Um.test(e),wf=e=>Df(e,zf),Sf=e=>Df(e,Pf),kf=e=>Df(e,Ef),Cf=e=>Df(e,Rf),Nf=e=>Df(e,If),Tf=e=>Df(e,Lf,!0),Af=e=>Df(e,Of,!0),Mf=(e,t,r)=>{let n=qm.exec(e);return!!n&&(n[1]?t(n[1]):r(n[2]))},Df=(e,t,r=!1)=>{let n=Um.exec(e);return!!n&&(n[1]?t(n[1]):r)},Ef=e=>"position"===e||"percentage"===e,If=e=>"image"===e||"url"===e,Rf=e=>"length"===e||"size"===e||"bg-size"===e,zf=e=>"length"===e,_f=e=>"number"===e,Pf=e=>"family-name"===e,Of=e=>"number"===e||"weight"===e,Lf=e=>"shadow"===e,Ff=/*#__PURE__*/$m(()=>{let e=jm("color"),t=jm("font"),r=jm("text"),n=jm("font-weight"),a=jm("tracking"),o=jm("leading"),i=jm("breakpoint"),s=jm("container"),l=jm("spacing"),c=jm("radius"),d=jm("shadow"),u=jm("inset-shadow"),h=jm("text-shadow"),p=jm("drop-shadow"),m=jm("blur"),f=jm("perspective"),g=jm("aspect"),v=jm("ease"),y=jm("animate"),b=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",xf,hf],x=()=>[xf,hf,l],w=()=>[Jm,"full","auto",...x()],S=()=>[ef,"none","subgrid",xf,hf],k=()=>["auto",{span:["full",ef,xf,hf]},ef,xf,hf],C=()=>[ef,"auto",xf,hf],N=()=>["auto","min","max","fr",xf,hf],T=()=>["auto",...x()],A=()=>[Jm,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...x()],M=()=>[Jm,"screen","full","dvw","lvw","svw","min","max","fit",...x()],D=()=>[Jm,"screen","full","lh","dvh","lvh","svh","min","max","fit",...x()],E=()=>[e,xf,hf],I=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",kf,vf,{position:[xf,hf]}],R=()=>["auto","cover","contain",Cf,uf,{size:[xf,hf]}],z=()=>[tf,wf,pf],_=()=>["","none","full",c,xf,hf],P=()=>["",Qm,wf,pf],O=()=>[Qm,tf,kf,vf],L=()=>["","none",m,xf,hf],F=()=>["none",Qm,xf,hf],B=()=>["none",Qm,xf,hf],V=()=>[Qm,xf,hf],$=()=>[Jm,"full",...x()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[rf],breakpoint:[rf],color:[nf],container:[rf],"drop-shadow":[rf],ease:["in","out","in-out"],font:[cf],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[rf],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[rf],shadow:[rf],spacing:["px",Qm],text:[rf],"text-shadow":[rf],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Jm,hf,xf,g]}],container:["container"],"container-type":[{"@container":["","normal","size",xf,hf]}],"container-named":[df],columns:[{columns:[Qm,hf,xf,s]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:b()}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:w()}],"inset-x":[{"inset-x":w()}],"inset-y":[{"inset-y":w()}],start:[{"inset-s":w(),start:w()}],end:[{"inset-e":w(),end:w()}],"inset-bs":[{"inset-bs":w()}],"inset-be":[{"inset-be":w()}],top:[{top:w()}],right:[{right:w()}],bottom:[{bottom:w()}],left:[{left:w()}],visibility:["visible","invisible","collapse"],z:[{z:[ef,"auto",xf,hf]}],basis:[{basis:[Jm,"full","auto",s,...x()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Qm,Jm,"auto","initial","none",hf]}],grow:[{grow:["",Qm,xf,hf]}],shrink:[{shrink:["",Qm,xf,hf]}],order:[{order:[ef,"first","last","none",xf,hf]}],"grid-cols":[{"grid-cols":S()}],"col-start-end":[{col:k()}],"col-start":[{"col-start":C()}],"col-end":[{"col-end":C()}],"grid-rows":[{"grid-rows":S()}],"row-start-end":[{row:k()}],"row-start":[{"row-start":C()}],"row-end":[{"row-end":C()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":N()}],"auto-rows":[{"auto-rows":N()}],gap:[{gap:x()}],"gap-x":[{"gap-x":x()}],"gap-y":[{"gap-y":x()}],"justify-content":[{justify:["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe","normal"]}],"justify-items":[{"justify-items":["start","end","center","stretch","center-safe","end-safe","normal"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"align-items":[{items:["start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"align-self":[{self:["auto","start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"place-items":[{"place-items":["start","end","center","stretch","center-safe","end-safe","baseline"]}],"place-self":[{"place-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],p:[{p:x()}],px:[{px:x()}],py:[{py:x()}],ps:[{ps:x()}],pe:[{pe:x()}],pbs:[{pbs:x()}],pbe:[{pbe:x()}],pt:[{pt:x()}],pr:[{pr:x()}],pb:[{pb:x()}],pl:[{pl:x()}],m:[{m:T()}],mx:[{mx:T()}],my:[{my:T()}],ms:[{ms:T()}],me:[{me:T()}],mbs:[{mbs:T()}],mbe:[{mbe:T()}],mt:[{mt:T()}],mr:[{mr:T()}],mb:[{mb:T()}],ml:[{ml:T()}],"space-x":[{"space-x":x()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":x()}],"space-y-reverse":["space-y-reverse"],size:[{size:A()}],"inline-size":[{inline:["auto",...M()]}],"min-inline-size":[{"min-inline":["auto",...M()]}],"max-inline-size":[{"max-inline":["none",...M()]}],"block-size":[{block:["auto",...D()]}],"min-block-size":[{"min-block":["auto",...D()]}],"max-block-size":[{"max-block":["none",...D()]}],w:[{w:[s,"screen",...A()]}],"min-w":[{"min-w":[s,"screen","none",...A()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[i]},...A()]}],h:[{h:["screen","lh",...A()]}],"min-h":[{"min-h":["screen","lh","none",...A()]}],"max-h":[{"max-h":["screen","lh",...A()]}],"font-size":[{text:["base",r,wf,pf]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Af,ff]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",tf,hf]}],"font-family":[{font:[Sf,gf,t]}],"font-features":[{"font-features":[hf]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,xf,hf]}],"line-clamp":[{"line-clamp":[Qm,"none",xf,mf]}],leading:[{leading:[o,...x()]}],"list-image":[{"list-image":["none",xf,hf]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",xf,hf]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:E()}],"text-color":[{text:E()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[Qm,"from-font","auto",xf,pf]}],"text-decoration-color":[{decoration:E()}],"underline-offset":[{"underline-offset":[Qm,"auto",xf,hf]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:x()}],"tab-size":[{tab:[ef,xf,hf]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",xf,hf]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",xf,hf]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:I()}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:R()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ef,xf,hf],radial:["",xf,hf],conic:[ef,xf,hf]},Nf,yf]}],"bg-color":[{bg:E()}],"gradient-from-pos":[{from:z()}],"gradient-via-pos":[{via:z()}],"gradient-to-pos":[{to:z()}],"gradient-from":[{from:E()}],"gradient-via":[{via:E()}],"gradient-to":[{to:E()}],rounded:[{rounded:_()}],"rounded-s":[{"rounded-s":_()}],"rounded-e":[{"rounded-e":_()}],"rounded-t":[{"rounded-t":_()}],"rounded-r":[{"rounded-r":_()}],"rounded-b":[{"rounded-b":_()}],"rounded-l":[{"rounded-l":_()}],"rounded-ss":[{"rounded-ss":_()}],"rounded-se":[{"rounded-se":_()}],"rounded-ee":[{"rounded-ee":_()}],"rounded-es":[{"rounded-es":_()}],"rounded-tl":[{"rounded-tl":_()}],"rounded-tr":[{"rounded-tr":_()}],"rounded-br":[{"rounded-br":_()}],"rounded-bl":[{"rounded-bl":_()}],"border-w":[{border:P()}],"border-w-x":[{"border-x":P()}],"border-w-y":[{"border-y":P()}],"border-w-s":[{"border-s":P()}],"border-w-e":[{"border-e":P()}],"border-w-bs":[{"border-bs":P()}],"border-w-be":[{"border-be":P()}],"border-w-t":[{"border-t":P()}],"border-w-r":[{"border-r":P()}],"border-w-b":[{"border-b":P()}],"border-w-l":[{"border-l":P()}],"divide-x":[{"divide-x":P()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":P()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:["solid","dashed","dotted","double","hidden","none"]}],"divide-style":[{divide:["solid","dashed","dotted","double","hidden","none"]}],"border-color":[{border:E()}],"border-color-x":[{"border-x":E()}],"border-color-y":[{"border-y":E()}],"border-color-s":[{"border-s":E()}],"border-color-e":[{"border-e":E()}],"border-color-bs":[{"border-bs":E()}],"border-color-be":[{"border-be":E()}],"border-color-t":[{"border-t":E()}],"border-color-r":[{"border-r":E()}],"border-color-b":[{"border-b":E()}],"border-color-l":[{"border-l":E()}],"divide-color":[{divide:E()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[Qm,xf,hf]}],"outline-w":[{outline:["",Qm,wf,pf]}],"outline-color":[{outline:E()}],shadow:[{shadow:["","none",d,Tf,bf]}],"shadow-color":[{shadow:E()}],"inset-shadow":[{"inset-shadow":["none",u,Tf,bf]}],"inset-shadow-color":[{"inset-shadow":E()}],"ring-w":[{ring:P()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:E()}],"ring-offset-w":[{"ring-offset":[Qm,pf]}],"ring-offset-color":[{"ring-offset":E()}],"inset-ring-w":[{"inset-ring":P()}],"inset-ring-color":[{"inset-ring":E()}],"text-shadow":[{"text-shadow":["none",h,Tf,bf]}],"text-shadow-color":[{"text-shadow":E()}],opacity:[{opacity:[Qm,xf,hf]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Qm]}],"mask-image-linear-from-pos":[{"mask-linear-from":O()}],"mask-image-linear-to-pos":[{"mask-linear-to":O()}],"mask-image-linear-from-color":[{"mask-linear-from":E()}],"mask-image-linear-to-color":[{"mask-linear-to":E()}],"mask-image-t-from-pos":[{"mask-t-from":O()}],"mask-image-t-to-pos":[{"mask-t-to":O()}],"mask-image-t-from-color":[{"mask-t-from":E()}],"mask-image-t-to-color":[{"mask-t-to":E()}],"mask-image-r-from-pos":[{"mask-r-from":O()}],"mask-image-r-to-pos":[{"mask-r-to":O()}],"mask-image-r-from-color":[{"mask-r-from":E()}],"mask-image-r-to-color":[{"mask-r-to":E()}],"mask-image-b-from-pos":[{"mask-b-from":O()}],"mask-image-b-to-pos":[{"mask-b-to":O()}],"mask-image-b-from-color":[{"mask-b-from":E()}],"mask-image-b-to-color":[{"mask-b-to":E()}],"mask-image-l-from-pos":[{"mask-l-from":O()}],"mask-image-l-to-pos":[{"mask-l-to":O()}],"mask-image-l-from-color":[{"mask-l-from":E()}],"mask-image-l-to-color":[{"mask-l-to":E()}],"mask-image-x-from-pos":[{"mask-x-from":O()}],"mask-image-x-to-pos":[{"mask-x-to":O()}],"mask-image-x-from-color":[{"mask-x-from":E()}],"mask-image-x-to-color":[{"mask-x-to":E()}],"mask-image-y-from-pos":[{"mask-y-from":O()}],"mask-image-y-to-pos":[{"mask-y-to":O()}],"mask-image-y-from-color":[{"mask-y-from":E()}],"mask-image-y-to-color":[{"mask-y-to":E()}],"mask-image-radial":[{"mask-radial":[xf,hf]}],"mask-image-radial-from-pos":[{"mask-radial-from":O()}],"mask-image-radial-to-pos":[{"mask-radial-to":O()}],"mask-image-radial-from-color":[{"mask-radial-from":E()}],"mask-image-radial-to-color":[{"mask-radial-to":E()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"]}],"mask-image-conic-pos":[{"mask-conic":[Qm]}],"mask-image-conic-from-pos":[{"mask-conic-from":O()}],"mask-image-conic-to-pos":[{"mask-conic-to":O()}],"mask-image-conic-from-color":[{"mask-conic-from":E()}],"mask-image-conic-to-color":[{"mask-conic-to":E()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:I()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:R()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",xf,hf]}],filter:[{filter:["","none",xf,hf]}],blur:[{blur:L()}],brightness:[{brightness:[Qm,xf,hf]}],contrast:[{contrast:[Qm,xf,hf]}],"drop-shadow":[{"drop-shadow":["","none",p,Tf,bf]}],"drop-shadow-color":[{"drop-shadow":E()}],grayscale:[{grayscale:["",Qm,xf,hf]}],"hue-rotate":[{"hue-rotate":[Qm,xf,hf]}],invert:[{invert:["",Qm,xf,hf]}],saturate:[{saturate:[Qm,xf,hf]}],sepia:[{sepia:["",Qm,xf,hf]}],"backdrop-filter":[{"backdrop-filter":["","none",xf,hf]}],"backdrop-blur":[{"backdrop-blur":L()}],"backdrop-brightness":[{"backdrop-brightness":[Qm,xf,hf]}],"backdrop-contrast":[{"backdrop-contrast":[Qm,xf,hf]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Qm,xf,hf]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Qm,xf,hf]}],"backdrop-invert":[{"backdrop-invert":["",Qm,xf,hf]}],"backdrop-opacity":[{"backdrop-opacity":[Qm,xf,hf]}],"backdrop-saturate":[{"backdrop-saturate":[Qm,xf,hf]}],"backdrop-sepia":[{"backdrop-sepia":["",Qm,xf,hf]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":x()}],"border-spacing-x":[{"border-spacing-x":x()}],"border-spacing-y":[{"border-spacing-y":x()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",xf,hf]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Qm,"initial",xf,hf]}],ease:[{ease:["linear","initial",v,xf,hf]}],delay:[{delay:[Qm,xf,hf]}],animate:[{animate:["none",y,xf,hf]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[f,xf,hf]}],"perspective-origin":[{"perspective-origin":b()}],rotate:[{rotate:F()}],"rotate-x":[{"rotate-x":F()}],"rotate-y":[{"rotate-y":F()}],"rotate-z":[{"rotate-z":F()}],scale:[{scale:B()}],"scale-x":[{"scale-x":B()}],"scale-y":[{"scale-y":B()}],"scale-z":[{"scale-z":B()}],"scale-3d":["scale-3d"],skew:[{skew:V()}],"skew-x":[{"skew-x":V()}],"skew-y":[{"skew-y":V()}],transform:[{transform:[xf,hf,"","none","gpu","cpu"]}],"transform-origin":[{origin:b()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:$()}],"translate-x":[{"translate-x":$()}],"translate-y":[{"translate-y":$()}],"translate-z":[{"translate-z":$()}],"translate-none":["translate-none"],zoom:[{zoom:[ef,xf,hf]}],accent:[{accent:E()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:E()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",xf,hf]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":E()}],"scrollbar-track-color":[{"scrollbar-track":E()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":x()}],"scroll-mx":[{"scroll-mx":x()}],"scroll-my":[{"scroll-my":x()}],"scroll-ms":[{"scroll-ms":x()}],"scroll-me":[{"scroll-me":x()}],"scroll-mbs":[{"scroll-mbs":x()}],"scroll-mbe":[{"scroll-mbe":x()}],"scroll-mt":[{"scroll-mt":x()}],"scroll-mr":[{"scroll-mr":x()}],"scroll-mb":[{"scroll-mb":x()}],"scroll-ml":[{"scroll-ml":x()}],"scroll-p":[{"scroll-p":x()}],"scroll-px":[{"scroll-px":x()}],"scroll-py":[{"scroll-py":x()}],"scroll-ps":[{"scroll-ps":x()}],"scroll-pe":[{"scroll-pe":x()}],"scroll-pbs":[{"scroll-pbs":x()}],"scroll-pbe":[{"scroll-pbe":x()}],"scroll-pt":[{"scroll-pt":x()}],"scroll-pr":[{"scroll-pr":x()}],"scroll-pb":[{"scroll-pb":x()}],"scroll-pl":[{"scroll-pl":x()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",xf,hf]}],fill:[{fill:["none",...E()]}],"stroke-w":[{stroke:[Qm,wf,pf,mf]}],stroke:[{stroke:["none",...E()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function Bf(...e){return Ff(vm(e))}var Vf="REASON-file-sources",$f="REASON-active-file-source",Hf={id:"local-default",name:"Local Files",type:"local",isDefault:!0,createdAt:/* @__PURE__ */(new Date).toISOString(),updatedAt:/* @__PURE__ */(new Date).toISOString()};function jf(){try{let e=localStorage.getItem(Vf);if(e){let t=JSON.parse(e);return t.some(e=>"local-default"===e.id)?t:[Hf,...t]}}catch(e){}return[Hf]}function qf(e){try{localStorage.setItem(Vf,JSON.stringify(e))}catch(e){}}function Uf(){try{return localStorage.getItem($f)||"local-default"}catch(e){return"local-default"}}function Gf(e){try{localStorage.setItem($f,e)}catch(e){}}function Wf(e){let[t,r]=fe(e),n=me(e);return le(()=>{if(n.current!==e){if(Array.isArray(n.current)&&Array.isArray(e)&&0===n.current.length&&0===e.length)return;n.current=e,r(e)}},[e]),[t,r]}function Kf(e,t){return"function"==typeof e?"object"==typeof t?e(t):e():e}function Yf(e,t="data-id"){let r=e;for(!r.tagName&&e.target&&(r=e.target);r;){if(r.getAttribute&&r.getAttribute(t))return r;r=r.parentNode}return null}function Xf(e,t="data-id"){let r=Yf(e,t);return r?Zf(r,t):null}function Zf(e,t="data-id"){let r=e.getAttribute(t);return r?function(e){if(e.startsWith(":"))return e.substring(1);let t=1*e;return isNaN(t)?e:t}(r):null}function Jf(e){return"string"==typeof e?":"+e:e}
60
+ /* @__PURE__ */(new Date).valueOf();var Qf={detect:()=>!0,addEvent:function(e,t,r){return e.addEventListener(t,r),()=>e.removeEventListener(t,r)},addGlobalEvent:function(e,t){return document.addEventListener(e,t),()=>document.removeEventListener(e,t)},getTopNode:function(){return window.document.body}};function eg(e){Object.assign(Qf,e)}function tg(e,t,r){Qf.addEvent(e,r,function(e){let n=Yf(e);if(!n)return;let a=Zf(n);if("function"==typeof t)return t(a,e);let o,i=e.target;for(;i!=n;){if(o=i.dataset?i.dataset.action:null,o&&t[o])return void t[o](a,e);i=i.parentNode}t[r]&&t[r](a,e)})}function rg(e,t){tg(e,t,"click"),t.dblclick&&tg(e,t.dblclick,"dblclick")}function ng(e,t,r){for(let n=0;n<sg.length;n++){if(n===r)continue;let a=sg[n],o=a.props.parent?.();if(o&&e.contains(o)&&a.node.contains(t))return!0}return!1}var ag=/* @__PURE__ */new Date,og=!1,ig=[],sg=[],lg=e=>{let t=e.target;if(!og&&t.isConnected)for(let r=sg.length-1;r>=0;r--){let{node:n,date:a,props:o}=sg[r];if(!(a>ag)&&!n.contains(t)&&n!==t&&(ng(n,t,r)||(o.callback&&o.callback(e),o.modal||e.defaultPrevented)))break}else og=!1},cg=e=>{ag=/* @__PURE__ */new Date,og=!0;for(let t=sg.length-1;t>=0;t--){let{node:r}=sg[t];if(!r.contains(e.target)&&r!==e.target){og=!1;break}}};function dg(e,t){ig.length||(ig=[Qf.addGlobalEvent("click",lg,e),Qf.addGlobalEvent("contextmenu",lg,e),Qf.addGlobalEvent("mousedown",cg,e)]),"object"!=typeof t&&(t={callback:t});let r={node:e,date:/* @__PURE__ */new Date,props:t};return sg.push(r),{destroy(){(function(e,t){for(let r=e.length-1;r>=0;r--)if(e[r]===t){e.splice(r,1);break}})(sg,r),sg.length||(ig.forEach(e=>e()),ig=[])}}}var ug,hg,pg,mg,fg=e=>-1!==e.indexOf("bottom"),gg=e=>-1!==e.indexOf("left"),vg=e=>-1!==e.indexOf("right"),yg=e=>-1!==e.indexOf("top"),bg=e=>-1!==e.indexOf("fit"),xg=e=>-1!==e.indexOf("overlap");function wg(e,t,r="bottom",n=0,a=0){if(!e)return null;ug=n,hg=a,pg="auto";let o=0,i=0,s=r,l=Sg(e),c=xg(r)?Qf.getTopNode(e):l;if(!l)return null;let d=l.getBoundingClientRect(),u=e.getBoundingClientRect(),h=c.getBoundingClientRect(),p=window.getComputedStyle(c),m={left:0,top:0,bottom:0,right:0};for(let x in m){let e=`border-${x}-width`;m[x]=parseFloat(p.getPropertyValue(e))}if(t){let e=function(e,t){let r=0,n=Qf.getTopNode(e);for(;e&&e!==n;){let n=getComputedStyle(e).position;if(("absolute"===n||"relative"===n||"fixed"===n)&&(r=parseInt(getComputedStyle(e).zIndex)||0),(e=e.parentNode)===t)break}return r}(t,l);o=Math.max(e+1,20)}if(t){if(mg=t.getBoundingClientRect(),bg(r)&&(pg=mg.width+"px"),"point"!==r)if((e=>e.split("-").every(e=>["center","fit"].indexOf(e)>-1))(r))bg(r)?ug=0:(ug=h.width/2,i=1),hg=(h.height-u.height)/2;else{let e=+!xg(r);ug=vg(r)?mg.right+e:mg.left-e,hg=fg(r)?mg.bottom+1:mg.top;let t=(e=>{let t=e.match(/(start|center|end)/);return t?t[0]:null})(r);t&&(vg(r)||gg(r)?"center"===t?hg-=(u.height-mg.height)/2:"end"===t&&(hg-=u.height-mg.height):(fg(r)||yg(r))&&("center"===t?ug-=(u.width-mg.width)/2:"end"===t&&(ug-=u.width-mg.width),xg(r)||(ug+=1)))}}else mg={left:n,right:n,top:a,bottom:a};let f=(gg(r)||vg(r))&&(fg(r)||yg(r));gg(r)&&(i=2);let g=ug-u.width-h.left;t&&gg(r)&&!f&&g<0&&(ug=mg.right,i=0,s=s.replace("left","right"));let v=ug+u.width*(1-i/2)-h.right;if(v>0)if(vg(r)){let e=mg.left-h.x-u.width;t&&!f&&e>=0?(ug=mg.left-u.width,s=s.replace("right","left")):ug-=v+m.right}else ug=h.right-m.right-u.width;i&&(ug=Math.round(ug-u.width*i/2));let y=g<0||v>0||!f;yg(r)&&(hg=mg.top-u.height,t&&hg<h.y&&y&&(hg=mg.bottom,s=s.replace("top","bottom")));let b=hg+u.height-h.bottom;return b>0&&(t&&fg(r)&&y?(hg-=u.height+mg.height+1,s=s.replace("bottom","top")):hg-=b+m.bottom),ug-=d.left+m.left,hg-=d.top+m.top,ug=(xg(r)?ug:Math.max(ug,0))+c.scrollLeft,hg=(xg(r)?hg:Math.max(hg,0))+c.scrollTop,pg||="auto",{at:s,x:ug,y:hg,z:o,width:pg}}function Sg(e){let t=Qf.getTopNode(e);for(e&&=e.parentElement;e;){let r=getComputedStyle(e).position;if(e===t||"relative"===r||"absolute"===r||"fixed"===r)return e;e=e.parentNode}return null}var kg=/* @__PURE__ */(new Date).valueOf();function Cg(){return kg+=1}function Ng(e){return e<10?"0"+e:e.toString()}function Tg(e){let t=11*Math.floor(e/11);return{start:t,end:t+11}}function Ag(e){let t=(e.getDay()+6)%7,r=new Date(e.valueOf());r.setDate(e.getDate()+(3-t)),r.setHours(0,0,0,0);let n=new Date(r.getFullYear(),0,1),a=Math.round((r.getTime()-n.getTime())/864e5);return 1+Math.floor(a/7)}var Mg=["",""];function Dg(e,t,r){switch(e){case"%d":return Ng(t.getDate());case"%m":return Ng(t.getMonth()+1);case"%j":return t.getDate();case"%n":return t.getMonth()+1;case"%y":return Ng(t.getFullYear()%100);case"%Y":return t.getFullYear();case"%D":return r.dayShort[t.getDay()];case"%l":return r.dayFull[t.getDay()];case"%M":return r.monthShort[t.getMonth()];case"%F":return r.monthFull[t.getMonth()];case"%h":return Ng((t.getHours()+11)%12+1);case"%g":return(t.getHours()+11)%12+1;case"%G":return t.getHours();case"%H":return Ng(t.getHours());case"%i":return Ng(t.getMinutes());case"%a":return((t.getHours()>11?r.pm:r.am)||Mg)[0];case"%A":return((t.getHours()>11?r.pm:r.am)||Mg)[1];case"%s":return Ng(t.getSeconds());case"%S":return function(e){let t=Ng(e);return 2==t.length?"0"+t:t}(t.getMilliseconds());case"%W":return Ng(Ag(t));case"%w":{let e=r.weekStart??1;if(1===e)return Ng(Ag(t));let n=(t.getDay()-e+7)%7,a=(1-e+7)%7,o=new Date(t.valueOf());return o.setDate(t.getDate()+(a-n)),Ng(Ag(o))}case"%c":{let e=t.getFullYear()+"";return e+="-"+Ng(t.getMonth()+1),e+="-"+Ng(t.getDate()),e+="T",e+=Ng(t.getHours()),e+=":"+Ng(t.getMinutes()),e+=":"+Ng(t.getSeconds()),e}case"%Q":return Math.floor(t.getMonth()/3)+1;default:return e}}var Eg=/%[a-zA-Z]/g;function Ig(e,t){return"function"==typeof e?e:function(r){return r?(r.getMonth||(r=new Date(r)),e.replace(Eg,e=>Dg(e,r,t))):""}}function Rg(e){return e&&"object"==typeof e&&!Array.isArray(e)}function zg(e,t){for(let r in t){let n=t[r];e[r]=Rg(e[r])&&Rg(n)?zg({...e[r]},t[r]):t[r]}return e}function _g(e){return{getGroup(t){let r=e[t];return e=>r&&r[e]||e},getRaw:()=>e,extend(t,r){if(!t)return this;let n;return n=r?zg({...t},e):zg({...e},t),_g(n)}}}var Pg={core:{ok:"OK",cancel:"Cancel",select:"Select","No data":"No data","Rows per page":"Rows per page","Total pages":"Total pages"},calendar:{monthFull:["January","February","March","April","May","June","July","August","September","October","November","December"],monthShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayFull:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],hours:"Hours",minutes:"Minutes",done:"Done",clear:"Clear",today:"Today",am:["am","AM"],pm:["pm","PM"],weekStart:0,clockFormat:24},formats:{timeFormat:"%H:%i",dateFormat:"%m/%d/%Y",monthYearFormat:"%F %Y",yearFormat:"%Y"},lang:"en-US"},Og=te(""),Lg=te({}),Fg=te(null),Bg=te(null),Vg=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,fieldId:Bg,helpers:Lg,i18n:Fg,theme:Og},Symbol.toStringTag,{value:"Module"}));function $g(e){let t=se(Bg),[r]=fe(()=>e||t||Cg());return r}function Hg({type:e="",css:t="",icon:r="",disabled:n=!1,title:a="",tooltip:o,text:i="",children:s,onClick:l}){let c=pe(()=>{let r=e?e.split(" ").filter(e=>""!==e).map(e=>"wx-"+e).join(" "):"";return t+(t?" ":"")+r},[e,t]);/* @__PURE__ */
61
+ return xe("button",{title:a,className:`wx-2ZWgb4 wx-button ${c} ${r&&!s?"wx-icon":""}`,disabled:n,onClick:e=>{l&&l(e)},"data-tooltip-text":o,children:[r&&/* @__PURE__ */be("i",{className:"wx-2ZWgb4 "+r}),s||i||" "]})}function jg({id:e,label:t="",inputValue:r="",value:n=!1,onChange:a,disabled:o=!1,css:i=""}){let s=$g(e),[l,c]=Wf(n);/* @__PURE__ */
62
+ return xe("div",{className:`wx-2IvefP wx-checkbox ${i}`,children:[/* @__PURE__ */be("input",{type:"checkbox",id:s,disabled:o,className:"wx-2IvefP wx-check",checked:l,value:r,onChange:({target:e})=>{let t=e.checked;c(t),a&&a({value:t,inputValue:r})}}),/* @__PURE__ */xe("label",{htmlFor:s,className:"wx-2IvefP wx-label",children:[/* @__PURE__ */be("span",{className:"wx-2IvefP wx-before"}),t&&/* @__PURE__ */be("span",{className:"wx-2IvefP wx-after",children:t})]})]})}function qg({theme:e="",target:t,children:r}){let n=me(null),a=me(null),[o,i]=fe(null);n.current||=document.createElement("div");let s=se(Og);return le(()=>{i(t||function(e){let t=Qf.getTopNode(e);for(;e&&e!==t&&!e.getAttribute("data-wx-portal-root");)e=e.parentNode;return e}(a.current)||Qf.getTopNode(a.current))},[a.current]),/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be("span",{ref:a,style:{display:"none"}}),a.current&&o?vt(/* @__PURE__ */be("div",{className:`wx-3ZWsT0 wx-${e||s}-theme`,children:r}),o):null]})}function Ug({left:e=0,top:t=0,at:r="bottom",parent:n=null,width:a="auto",css:o="",onCancel:i,children:s,trackScroll:l=!1}){let[c,d]=fe(0),[u,h]=fe(0),[p,m]=fe("auto"),[f,g]=fe(!1),v=me(null),y=me(null),b=me(i);function x(e){return n&&(a+"").indexOf("%")>-1?a.replace(/(\d+)%/,(e,t)=>(t=t*n.offsetWidth/100+"px",a.replace(e,t))):a&&"auto"!==a?a:e}le(()=>{b.current=i},[i]);let w=ie(()=>{if(!v.current)return;let a=wg(v.current,n,r,e,t);a&&(d(a.x),h(a.y),m(x(a.width)))},[v,n,r,e,t,a]);return he(()=>{let e,t=e=>{b.current&&e.target!==y.current&&v.current&&!v.current.contains(e.target)&&b.current(e)};return requestAnimationFrame(()=>{w(),g(!0),l&&v.current&&(y.current=Sg(v.current),y.current&&y.current.addEventListener("scroll",t,!0)),n&&(e=new ResizeObserver(w),e.observe(n))}),()=>{l&&y.current&&y.current.removeEventListener("scroll",t,!0),e?.disconnect()}},[]),he(()=>{w()},[n,r,e,t]),le(()=>{if(v.current)return dg(v.current,{callback:e=>{b.current&&b.current(e)},parent:()=>n}).destroy},[n]),/* @__PURE__ */be("div",{ref:v,className:["wx-37M6Fj","wx-popup",o].filter(Boolean).join(" "),style:{position:"absolute",visibility:f?"visible":"hidden",top:u+"px",left:c+"px",width:p},children:s})}function Gg({position:e="bottom",align:t="start",autoFit:r=!0,onCancel:n=null,width:a="100%",css:o="",children:i}){let s=me(null),[l,c]=fe(e),[d,u]=fe(t),h=me(n);return le(()=>{h.current=n},[n]),le(()=>{if(r){let e=s.current;if(e){let t=e.getBoundingClientRect(),r=document.body.getBoundingClientRect();t.right>=r.right&&u("end"),t.bottom>=r.bottom&&c("top")}}},[]),le(()=>{if(s.current)return dg(s.current,e=>{h.current&&h.current(e)}).destroy},[]),/* @__PURE__ */be("div",{ref:s,className:["wx-dropdown",`wx-${l}-${d}`,o||"","wx-aaaVytZW"].filter(Boolean).join(" "),style:{width:a},children:i})}function Wg({position:e="bottom",align:t="start",autoFit:r=!0,inline:n=!1,onCancel:a,width:o="100%",children:i,...s}){let[l,c]=fe(void 0),d=me(null),u=pe(()=>`${e}-${t}`,[e,t]);return he(()=>{d.current&&c(d.current.parentNode)},[]),/* @__PURE__ */xe(ye,{children:[l&&(n?/* @__PURE__ */be(Gg,{onCancel:a,position:e,align:t,autoFit:r,width:o,...s,children:i}):/* @__PURE__ */be(qg,{children:/* @__PURE__ */be(Ug,{parent:l,at:u,onCancel:a,width:o,...s,children:i})})),/* @__PURE__ */be("span",{ref:d,className:"wx-portal-node wx-32GZ52"})]})}function Kg(){return _g(Pg)}var Yg=oe(function({data:e,checkboxes:t,itemTemplate:r,value:n}){/* @__PURE__ */
63
+ return xe(ye,{children:[t&&/* @__PURE__ */be(jg,{id:e.id,css:"wx-list-checkbox",value:n&&n.includes(e.id)}),r?Kf(r,{option:e}):e.label]})});function Xg({visibleItems:e,visibleRange:t,navIndex:r,checkboxes:n,itemTemplate:a,value:o,measureRefCallback:i}){return e.map((e,s)=>{let l=t.start+s;/* @__PURE__ */
64
+ return be("div",{ref:0===s?i:void 0,className:"wx-233fr7 wx-item "+(l===r?"wx-focus":""),"data-id":e.id,children:/* @__PURE__ */be(Yg,{data:e,checkboxes:n,itemTemplate:a,value:o})},e.id)})}function Zg({items:e=[],children:t,onSelect:r,onReady:n,virtualized:a=!1,checkboxes:o,multiselect:i,value:s,...l}){let c=me(),d=me(!1),u=me(function(){let e,t,r,n,a=null,o=!1,i=!1,s=e=>{a=e,o=null!==a,r(a)},l=(t,r)=>{if(!i&&null!==t&&e){let n=e.querySelectorAll(".wx-list > .wx-item")[t];n&&(n.scrollIntoView({block:"nearest"}),r&&r.preventDefault())}},c=(r,n)=>{let o=null===r?null:Math.max(0,Math.min(a+r,t.length-1));o!==a&&(s(o),e?l(o,n):requestAnimationFrame(()=>l(o,n)))};return{move:e=>{let r=Xf(e),n=t.findIndex(e=>e.id===r);n!==a&&s(n)},keydown:(e,t)=>{switch(e.code){case"Enter":o?n():s(0);break;case"Space":o||s(0);break;case"Escape":case"Tab":r(a=null);break;case"ArrowDown":c(o?1:t||0,e);break;case"ArrowUp":c(o?-1:t||0,e)}},init:(a,o,s,l,c)=>{e=a,t=o,r=s,n=l,i=c},navigate:c}}()),[h,p]=fe(null),m=me(h),[f,g]=fe(0),[v,y]=fe(24),b=me(!1),x=(se(Fg)||Kg()).getGroup("core"),w=me(e);le(()=>{w.current=e},[e]);let S=me(s);le(()=>{S.current=s},[s]);let k=me(0);le(()=>{k.current=v},[v]);let C=ie(e=>{e&&e.stopPropagation();let t,n=w.current,a=S.current,o=m.current,s=n[o]?.id;t=i?a&&a.includes(s)?a.filter(e=>e!==s):[...a||[],s]:s,r&&r({id:t})},[i,r]),N=me(C);le(()=>{N.current=C},[C]);let T=ie(e=>{if(c.current){let t=e*k.current-c.current.clientHeight+k.current;g(t),c.current.scrollTop=t}},[k.current]),A=ie(e=>{c.current=e,a&&(e&&!d.current&&null!==m.current&&requestAnimationFrame(()=>{c.current&&(T(m.current),d.current=!0)}),e||(d.current=!1))},[T]),M=ie(e=>{if(!e||b.current)return;let t=e.getBoundingClientRect().height;t&&(y(t),k.current=t,b.current=!0)},[]);le(()=>{u.current.init(c.current,e,e=>{p(e),m.current=e},e=>N.current(e),a)},[e,c.current,a]),le(()=>{n&&n({navigate:a?(e,t)=>{u.current.navigate(e,t),T(m.current)}:u.current.navigate,keydown:a?(e,t)=>{let r=m.current,n=w.current;if(0!==r&&r!==n.length-1&&("ArrowDown"===e.key||"ArrowUp"===e.key)&&e.preventDefault(),u.current.keydown(e,t),c.current){let e=c.current.scrollTop<=m.current*k.current,t=c.current.scrollTop+c.current.clientHeight>=m.current*k.current+k.current;e?t||T(m.current):(c.current.scrollTop=m.current*k.current,g(c.current.scrollTop))}}:u.current.keydown,move:u.current.move})},[]);let D=me(0),E=me(e);E.current!==e&&(E.current=e,D.current+=1);let I=ie(()=>{u.current.navigate(null)},[u]),R=ie(e=>{a&&g(e.target.scrollTop)},[a]),z=pe(()=>Math.ceil((c.current?.clientHeight||0)/v),[v,f]),_=pe(()=>{if(!a)return{start:0,end:e.length};if(!e.length)return{start:0,end:0};let t=Math.floor(f/v),r=t+z;return{start:Math.max(0,t-10),end:Math.min(e.length,r+10)}},[a,e,f,v,z]),P=pe(()=>{if(!a)return e;let{start:t,end:r}=_;return e.slice(t,r).map(e=>({...e}))},[a,e,_]),O=_.start*v,L=e.length*v;return le(()=>{a&&g(0)},[e,a]),le(()=>{null===h&&(d.current=!1)},[h]),null===h?null:/* @__PURE__ */be(Wg,{onCancel:I,...l,children:/* @__PURE__ */be("div",{className:"wx-233fr7 wx-list",ref:A,onClick:C,onMouseMove:u.current.move,onScroll:R,children:e.length?a?/* @__PURE__ */be("div",{className:"wx-233fr7 wx-list-wrapper",style:{height:`${L}px`},children:/* @__PURE__ */be("div",{className:"wx-233fr7 wx-list-content",style:{transform:`translateY(${O}px)`},children:/* @__PURE__ */be(Xg,{visibleRange:_,visibleItems:P,navIndex:h,measureRefCallback:M,checkboxes:o,itemTemplate:t,value:s})})}):/* @__PURE__ */be(Xg,{visibleRange:_,visibleItems:P,navIndex:h,measureRefCallback:M,checkboxes:o,itemTemplate:t,value:s}):/* @__PURE__ */be("div",{className:"wx-233fr7 wx-no-data",children:x("No data")})})},D.current)}function Jg({value:e="",id:t,readonly:r=!1,focus:n=!1,select:a=!1,type:o="text",placeholder:i="",disabled:s=!1,error:l=!1,title:c="",tooltip:d,css:u="",icon:h="",clear:p=!1,onChange:m}){let f=$g(t),[g,v]=Wf(e),y=me(null),b=pe(()=>h&&-1===u.indexOf("wx-icon-left")?"wx-icon-right "+u:u,[h,u]),x=pe(()=>h&&-1!==u.indexOf("wx-icon-left"),[h,u]);le(()=>{let e=setTimeout(()=>{n&&y.current&&y.current.focus(),a&&y.current&&y.current.select()},1);return()=>clearTimeout(e)},[n,a]);let w=ie(e=>{let t=e.target.value;v(t),m&&m({value:t,input:!0})},[m]),S=ie(e=>m&&m({value:e.target.value}),[m]);let k=o;return"password"!==o&&"number"!==o&&(k="text"),le(()=>{let e=S,t=y.current;return t.addEventListener("change",e),()=>{t&&t.removeEventListener("change",e)}},[S]),/* @__PURE__ */xe("div",{className:`wx-hQ64J4 wx-text ${b} ${l?"wx-error":""} ${s?"wx-disabled":""} ${p?"wx-clear":""}`,"data-tooltip-text":d,children:[/* @__PURE__ */be("input",{className:"wx-hQ64J4 wx-input",ref:y,id:f,readOnly:r,disabled:s,placeholder:i,type:k,title:c,value:g,onInput:w}),p&&!s&&g?/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be("i",{className:"wx-hQ64J4 wx-icon wxi-close",onClick:function(e){e.stopPropagation(),v(""),m&&m({value:""})}}),x&&/* @__PURE__ */be("i",{className:`wx-hQ64J4 wx-icon ${h}`})]}):h?/* @__PURE__ */be("i",{className:`wx-hQ64J4 wx-icon ${h}`}):null]})}function Qg({date:e,type:t,part:r,onShift:n}){let{calendar:a,formats:o}=se(Fg).getRaw(),i=e.getFullYear(),s=pe(()=>{switch(t){case"month":return Ig(o.monthYearFormat,a)(e);case"year":return Ig(o.yearFormat,a)(e);case"duodecade":{let{start:e,end:t}=Tg(i),r=Ig(o.yearFormat,a);return`${r(new Date(e,0,1))} - ${r(new Date(t,11,31))}`}default:return""}},[e,t,i,a,o]);/* @__PURE__ */
65
65
  return xe("div",{className:"wx-8HQVQV wx-header",children:["right"===r?/* @__PURE__ */be("span",{className:"wx-8HQVQV wx-spacer"}):/* @__PURE__ */be("i",{className:"wx-8HQVQV wx-pager wxi-angle-left",onClick:()=>n&&n({diff:-1,type:t})}),
66
- /* @__PURE__ */be("span",{className:"wx-8HQVQV wx-label",onClick:function(){n&&n({diff:0,type:t})},children:s}),"left"===r?/* @__PURE__ */be("span",{className:"wx-8HQVQV wx-spacer"}):/* @__PURE__ */be("i",{className:"wx-8HQVQV wx-pager wxi-angle-right",onClick:()=>n&&n({diff:1,type:t})})]})}function ov({onClick:e,children:t}){/* @__PURE__ */
67
- return be("button",{className:"wx-3s8W4d wx-button",onClick:e,children:t})}var iv="wx-1XEF33",sv={month:{component:function({value:e,current:t,part:r="",markers:n=null,css:a="",onCancel:o,onChange:i}){let s=(se(jg)||Qg()).getRaw().calendar,l=(s.weekStart||7)%7,c=s.dayShort.slice(l).concat(s.dayShort.slice(0,l)),d=(e,t,r)=>new Date(e.getFullYear(),e.getMonth()+(t||0),e.getDate()+(r||0)),u="normal"!==r;function h(e){let t=e.getDay();return 0===t||6===t}let p=me(0),m=pe(()=>"normal"==r?[e?d(e).valueOf():0]:e?[e.start?d(e.start).valueOf():0,e.end?d(e.end).valueOf():0]:[0,0],[r,e]),f=pe(()=>{let e=function(){let e=d(t,0,1-t.getDate());return e.setDate(e.getDate()-(e.getDay()-(l-7))%7),e}(),r=function(){let e=d(t,1,-t.getDate());return e.setDate(e.getDate()+(6-e.getDay()+l)%7),e}(),a=t.getMonth(),o=[];for(let t=e;t<=r;t.setDate(t.getDate()+1)){let e={day:t.getDate(),in:t.getMonth()===a,date:t.valueOf()},r="";if(r+=e.in?"":" wx-inactive",r+=m.indexOf(e.date)>-1?" wx-selected":"",u){let t=e.date==m[0],n=e.date==m[1];t&&!n?r+=" wx-left":n&&!t&&(r+=" wx-right"),e.date>m[0]&&e.date<m[1]&&(r+=" wx-inrange")}if(r+=h(t)?" wx-weekend":"",n){let e=n(t);e&&(r+=" "+e)}o.push({...e,css:r})}return o},[t,m,u,n]),g=me(null),v=me({});return v.current.click=function(e,t){t.timeStamp!==p.current&&(p.current=t.timeStamp,t.stopPropagation(),i&&i(new Date(e)),o&&o())},le(()=>{sg(g.current,v.current)},[]),/* @__PURE__ */xe("div",{className:`wx-398RBS wx-month ${a}`,children:[/* @__PURE__ */be("div",{className:"wx-398RBS wx-weekdays",children:c.map(e=>/* @__PURE__ */be("div",{className:"wx-398RBS wx-weekday",children:e},e))}),/* @__PURE__ */be("div",{className:"wx-398RBS wx-days",ref:g,children:f.map(e=>/* @__PURE__ */be("div",{className:`wx-398RBS wx-day ${e.css} ${e.in?"":"wx-out"}`,"data-id":e.date,children:e.day},e.date))})]})},next:function(e){return e=new Date(e),e.setMonth(e.getMonth()+1),e},prev:function(e){return e=new Date(e),e.setMonth(e.getMonth()-1),e}},year:{component:function({value:e,current:t,part:r,onCancel:n,onChange:a,onShift:o}){let i=me(/* @__PURE__ */new Date),[s,l]=Jf(e||i.current),[c,d]=Jf(t||i.current),u=se(jg).getRaw().calendar,h=u.monthShort||[],p=pe(()=>c.getMonth(),[c]),m=ie((e,t)=>{if(null!=e){t.stopPropagation();let r=new Date(c);r.setMonth(e),d(r),o&&o({current:r})}"normal"===r&&l(new Date(c)),n&&n()},[c,r,o,n]),f=ie(()=>{let e=new Date(lv(s,r)||c);e.setMonth(c.getMonth()),e.setFullYear(c.getFullYear()),a&&a(e)},[s,c,r,a]),g=ie(e=>{let t=e.target.closest("[data-id]");if(t){let r=parseInt(t.getAttribute("data-id"),10);m(r,e)}},[m]);/* @__PURE__ */
68
- return xe(ye,{children:[/* @__PURE__ */be("div",{className:"wx-34U8T8 wx-months",onClick:g,children:h.map((e,t)=>/* @__PURE__ */be("div",{className:"wx-34U8T8 wx-month"+(p===t?" wx-current":""),"data-id":t,children:e},t))}),/* @__PURE__ */be("div",{className:"wx-34U8T8 wx-buttons",children:/* @__PURE__ */be(ov,{onClick:f,children:u.done})})]})},next:function(e){return e=new Date(e),e.setFullYear(e.getFullYear()+1),e},prev:function(e){return e=new Date(e),e.setFullYear(e.getFullYear()-1),e}},duodecade:{component:({value:e,current:t,onCancel:r,onChange:n,onShift:a,part:o})=>{let i=se(jg).getRaw().calendar,[s,l]=Jf(t),[c,d]=Jf(e),u=pe(()=>s.getFullYear(),[s]),h=pe(()=>{let{start:e,end:t}=Ig(u),r=[];for(let n=e;n<=t;++n)r.push(n);return r},[u]),p={click:function(e,t){if(e){t.stopPropagation();let r=new Date(s);r.setFullYear(e),l(r),a&&a({current:r})}"normal"===o&&d(new Date(s)),r&&r()}};let m=me(null);return le(()=>{m.current&&sg(m.current,p)},[]),/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be("div",{className:iv+" wx-years",ref:m,children:h.map((e,t)=>/* @__PURE__ */be("div",{className:`wx-1XEF33 wx-year ${u==e?"wx-current":""} ${0===t?"wx-prev-decade":""} ${11===t?"wx-next-decade":""}`,"data-id":e,children:e},t))}),/* @__PURE__ */be("div",{className:iv+" wx-buttons",children:/* @__PURE__ */be(ov,{onClick:function(){let e=new Date(lv(c,o)||s);e.setFullYear(s.getFullYear()),n&&n(e)},children:i.done})})]})},next:function(e){return e=new Date(e),e.setFullYear(e.getFullYear()+10),e},prev:function(e){return e=new Date(e),e.setFullYear(e.getFullYear()-10),e}}};function lv(e,t){let r;if("normal"===t)r=e;else{let{start:n,end:a}=e;r="left"===t?n:("right"==t||n)&&a}return r}var cv=["clear","today"];function dv({value:e,current:t,onCurrentChange:r,part:n="normal",markers:a=null,buttons:o,css:i="",onShift:s,onChange:l}){let c=se(jg).getGroup("calendar"),[d,u]=fe("month"),h=Array.isArray(o)?o:o?cv:[],p=e=>{let{diff:n,current:a}=e;if(0!==n){if(n){let e=sv[d];r(n>0?e.next(t):e.prev(t))}else a&&r(a);s&&s()}else"month"===d?u("year"):"year"===d&&u("duodecade")},m=pe(()=>sv[d].component,[d]);/* @__PURE__ */
69
- return be("div",{className:`wx-2Gr4AS wx-calendar ${"normal"!==n&&"both"!==n?"wx-part":""} ${i}`,children:/* @__PURE__ */xe("div",{className:"wx-2Gr4AS wx-wrap",children:[/* @__PURE__ */be(av,{date:t,part:n,type:d,onShift:p}),/* @__PURE__ */xe("div",{children:[/* @__PURE__ */be(m,{value:e,current:t,onCurrentChange:r,part:n,markers:a,onCancel:()=>{"duodecade"===d?u("year"):"year"===d&&u("month")},onChange:e=>{u("month"),l&&l({select:!0,value:e})},onShift:p}),"month"===d&&h.length>0&&/* @__PURE__ */be("div",{className:"wx-2Gr4AS wx-buttons",children:h.map(e=>/* @__PURE__ */be("div",{className:"wx-2Gr4AS wx-button-item",children:/* @__PURE__ */be(ov,{onClick:t=>((e,t)=>{e.preventDefault(),l&&l({value:t})})(t,function(e){return"done"===e?-1:"clear"===e?null:"today"===e?/* @__PURE__ */new Date:void 0}(e)),children:c(e)})},e))})]})]})})}function uv(e){let{words:t=null,optional:r=!1,children:n}=e,a=se(jg),o=pe(()=>{let e=a;return(!e||!e.extend)&&(e=Bg(Vg)),null!==t&&(e=e.extend(t,r)),e},[t,r,a]);/* @__PURE__ */
70
- return be(jg.Provider,{value:o,children:n})}function hv(e,t,r,n){if(!e||n){let e=t?new Date(t):/* @__PURE__ */new Date;e.setDate(1),r(e)}else if(1!==e.getDate()){let t=new Date(e);t.setDate(1),r(t)}}var pv=["clear","today"];function mv({value:e,current:t,markers:r=null,buttons:n=pv,css:a="",onChange:o}){let[i,s]=Jf(e),[l,c]=Jf(t);le(()=>{hv(l,i,c,!1)},[i,l]);let d=ie(e=>{let t=e.value;t?(s(new Date(t)),hv(l,new Date(t),c,!0)):s(null),o&&o({value:t?new Date(t):null})},[o,l]),u=ie(e=>{c(e)},[c]);return l?/* @__PURE__ */be(uv,{children:/* @__PURE__ */be(dv,{value:i,current:l,markers:r,buttons:n,css:a,onChange:d,onCurrentChange:u})}):null}function fv(e){return e||={},e.width||(e.width="unset"),e}var gv=["clear","today"];function vv({value:e,id:t,disabled:r=!1,error:n=!1,placeholder:a="",format:o="",buttons:i=gv,css:s="",title:l="",tooltip:c,editable:d=!1,clear:u=!1,onChange:h,dropdown:p={}}){let{calendar:m,formats:f}=(se(jg)||Qg()).getRaw(),g=o||f?.dateFormat,v="function"==typeof g?g:Og(g,m),[y,b]=fe(e),[x,w]=fe(!1);function S(){w(!1)}function k(e){let t=e===y||e&&y&&e.valueOf()===y.valueOf()||!e&&!y;b(e),t||h&&h({value:e}),setTimeout(S,1)}le(()=>{b(e)},[e]);let C=pe(()=>y?v(y):"",[y,v]);return le(()=>{let e=S;return window.addEventListener("scroll",e),()=>window.removeEventListener("scroll",e)},[]),/* @__PURE__ */xe("div",{className:"wx-1lKOFG wx-datepicker",onClick:()=>w(!0),children:[/* @__PURE__ */be(nv,{css:`wx-date-input ${s}`,title:l,tooltip:c,value:C,id:t,readonly:!d,disabled:r,error:n,placeholder:a,onInput:S,onChange:function({value:e,input:t}){if(!d&&!u||t)return;let r="function"==typeof d?d(e):e?new Date(e):null;r=isNaN(r)?y||null:r||null,k(r)},icon:"wxi-calendar",clear:u}),x&&!r&&/* @__PURE__ */be(Jg,{onCancel:S,...fv(p),children:/* @__PURE__ */be(mv,{buttons:i,value:y,onChange:e=>k(e.value)})})]})}function yv({value:e="",options:t=[],textOptions:r=null,placeholder:n="",disabled:a=!1,error:o=!1,title:i="",tooltip:s,textField:l="label",clear:c=!1,css:d="",children:u,onChange:h,dropdown:p={}}){let m=me(null),f=me(null),[g,v]=Jf(e);let y=pe(()=>g||0===g?(r||t).find(e=>e.id===g):null,[g,r,t]),b=ie(({id:e})=>{(e||0===e)&&(v(e),m.current(null),h&&h({value:e}))},[v,h]),x=ie(e=>{e.stopPropagation(),v(""),h&&h({value:""})},[v,h]),w=ie(()=>t.findIndex(e=>e.id===g),[t,g]);/* @__PURE__ */
66
+ /* @__PURE__ */be("span",{className:"wx-8HQVQV wx-label",onClick:function(){n&&n({diff:0,type:t})},children:s}),"left"===r?/* @__PURE__ */be("span",{className:"wx-8HQVQV wx-spacer"}):/* @__PURE__ */be("i",{className:"wx-8HQVQV wx-pager wxi-angle-right",onClick:()=>n&&n({diff:1,type:t})})]})}function ev({onClick:e,children:t}){/* @__PURE__ */
67
+ return be("button",{className:"wx-3s8W4d wx-button",onClick:e,children:t})}var tv="wx-1XEF33",rv={month:{component:function({value:e,current:t,part:r="",markers:n=null,css:a="",onCancel:o,onChange:i}){let s=(se(Fg)||Kg()).getRaw().calendar,l=(s.weekStart||7)%7,c=s.dayShort.slice(l).concat(s.dayShort.slice(0,l)),d=(e,t,r)=>new Date(e.getFullYear(),e.getMonth()+(t||0),e.getDate()+(r||0)),u="normal"!==r;function h(e){let t=e.getDay();return 0===t||6===t}let p=me(0),m=pe(()=>"normal"==r?[e?d(e).valueOf():0]:e?[e.start?d(e.start).valueOf():0,e.end?d(e.end).valueOf():0]:[0,0],[r,e]),f=pe(()=>{let e=function(){let e=d(t,0,1-t.getDate());return e.setDate(e.getDate()-(e.getDay()-(l-7))%7),e}(),r=function(){let e=d(t,1,-t.getDate());return e.setDate(e.getDate()+(6-e.getDay()+l)%7),e}(),a=t.getMonth(),o=[];for(let t=e;t<=r;t.setDate(t.getDate()+1)){let e={day:t.getDate(),in:t.getMonth()===a,date:t.valueOf()},r="";if(r+=e.in?"":" wx-inactive",r+=m.indexOf(e.date)>-1?" wx-selected":"",u){let t=e.date==m[0],n=e.date==m[1];t&&!n?r+=" wx-left":n&&!t&&(r+=" wx-right"),e.date>m[0]&&e.date<m[1]&&(r+=" wx-inrange")}if(r+=h(t)?" wx-weekend":"",n){let e=n(t);e&&(r+=" "+e)}o.push({...e,css:r})}return o},[t,m,u,n]),g=me(null),v=me({});return v.current.click=function(e,t){t.timeStamp!==p.current&&(p.current=t.timeStamp,t.stopPropagation(),i&&i(new Date(e)),o&&o())},le(()=>{rg(g.current,v.current)},[]),/* @__PURE__ */xe("div",{className:`wx-398RBS wx-month ${a}`,children:[/* @__PURE__ */be("div",{className:"wx-398RBS wx-weekdays",children:c.map(e=>/* @__PURE__ */be("div",{className:"wx-398RBS wx-weekday",children:e},e))}),/* @__PURE__ */be("div",{className:"wx-398RBS wx-days",ref:g,children:f.map(e=>/* @__PURE__ */be("div",{className:`wx-398RBS wx-day ${e.css} ${e.in?"":"wx-out"}`,"data-id":e.date,children:e.day},e.date))})]})},next:function(e){return e=new Date(e),e.setMonth(e.getMonth()+1),e},prev:function(e){return e=new Date(e),e.setMonth(e.getMonth()-1),e}},year:{component:function({value:e,current:t,part:r,onCancel:n,onChange:a,onShift:o}){let i=me(/* @__PURE__ */new Date),[s,l]=Wf(e||i.current),[c,d]=Wf(t||i.current),u=se(Fg).getRaw().calendar,h=u.monthShort||[],p=pe(()=>c.getMonth(),[c]),m=ie((e,t)=>{if(null!=e){t.stopPropagation();let r=new Date(c);r.setMonth(e),d(r),o&&o({current:r})}"normal"===r&&l(new Date(c)),n&&n()},[c,r,o,n]),f=ie(()=>{let e=new Date(nv(s,r)||c);e.setMonth(c.getMonth()),e.setFullYear(c.getFullYear()),a&&a(e)},[s,c,r,a]),g=ie(e=>{let t=e.target.closest("[data-id]");if(t){let r=parseInt(t.getAttribute("data-id"),10);m(r,e)}},[m]);/* @__PURE__ */
68
+ return xe(ye,{children:[/* @__PURE__ */be("div",{className:"wx-34U8T8 wx-months",onClick:g,children:h.map((e,t)=>/* @__PURE__ */be("div",{className:"wx-34U8T8 wx-month"+(p===t?" wx-current":""),"data-id":t,children:e},t))}),/* @__PURE__ */be("div",{className:"wx-34U8T8 wx-buttons",children:/* @__PURE__ */be(ev,{onClick:f,children:u.done})})]})},next:function(e){return e=new Date(e),e.setFullYear(e.getFullYear()+1),e},prev:function(e){return e=new Date(e),e.setFullYear(e.getFullYear()-1),e}},duodecade:{component:({value:e,current:t,onCancel:r,onChange:n,onShift:a,part:o})=>{let i=se(Fg).getRaw().calendar,[s,l]=Wf(t),[c,d]=Wf(e),u=pe(()=>s.getFullYear(),[s]),h=pe(()=>{let{start:e,end:t}=Tg(u),r=[];for(let n=e;n<=t;++n)r.push(n);return r},[u]),p={click:function(e,t){if(e){t.stopPropagation();let r=new Date(s);r.setFullYear(e),l(r),a&&a({current:r})}"normal"===o&&d(new Date(s)),r&&r()}};let m=me(null);return le(()=>{m.current&&rg(m.current,p)},[]),/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be("div",{className:tv+" wx-years",ref:m,children:h.map((e,t)=>/* @__PURE__ */be("div",{className:`wx-1XEF33 wx-year ${u==e?"wx-current":""} ${0===t?"wx-prev-decade":""} ${11===t?"wx-next-decade":""}`,"data-id":e,children:e},t))}),/* @__PURE__ */be("div",{className:tv+" wx-buttons",children:/* @__PURE__ */be(ev,{onClick:function(){let e=new Date(nv(c,o)||s);e.setFullYear(s.getFullYear()),n&&n(e)},children:i.done})})]})},next:function(e){return e=new Date(e),e.setFullYear(e.getFullYear()+10),e},prev:function(e){return e=new Date(e),e.setFullYear(e.getFullYear()-10),e}}};function nv(e,t){let r;if("normal"===t)r=e;else{let{start:n,end:a}=e;r="left"===t?n:("right"==t||n)&&a}return r}var av=["clear","today"];function ov({value:e,current:t,onCurrentChange:r,part:n="normal",markers:a=null,buttons:o,css:i="",onShift:s,onChange:l}){let c=se(Fg).getGroup("calendar"),[d,u]=fe("month"),h=Array.isArray(o)?o:o?av:[],p=e=>{let{diff:n,current:a}=e;if(0!==n){if(n){let e=rv[d];r(n>0?e.next(t):e.prev(t))}else a&&r(a);s&&s()}else"month"===d?u("year"):"year"===d&&u("duodecade")},m=pe(()=>rv[d].component,[d]);/* @__PURE__ */
69
+ return be("div",{className:`wx-2Gr4AS wx-calendar ${"normal"!==n&&"both"!==n?"wx-part":""} ${i}`,children:/* @__PURE__ */xe("div",{className:"wx-2Gr4AS wx-wrap",children:[/* @__PURE__ */be(Qg,{date:t,part:n,type:d,onShift:p}),/* @__PURE__ */xe("div",{children:[/* @__PURE__ */be(m,{value:e,current:t,onCurrentChange:r,part:n,markers:a,onCancel:()=>{"duodecade"===d?u("year"):"year"===d&&u("month")},onChange:e=>{u("month"),l&&l({select:!0,value:e})},onShift:p}),"month"===d&&h.length>0&&/* @__PURE__ */be("div",{className:"wx-2Gr4AS wx-buttons",children:h.map(e=>/* @__PURE__ */be("div",{className:"wx-2Gr4AS wx-button-item",children:/* @__PURE__ */be(ev,{onClick:t=>((e,t)=>{e.preventDefault(),l&&l({value:t})})(t,function(e){return"done"===e?-1:"clear"===e?null:"today"===e?/* @__PURE__ */new Date:void 0}(e)),children:c(e)})},e))})]})]})})}function iv(e){let{words:t=null,optional:r=!1,children:n}=e,a=se(Fg),o=pe(()=>{let e=a;return(!e||!e.extend)&&(e=_g(Pg)),null!==t&&(e=e.extend(t,r)),e},[t,r,a]);/* @__PURE__ */
70
+ return be(Fg.Provider,{value:o,children:n})}function sv(e,t,r,n){if(!e||n){let e=t?new Date(t):/* @__PURE__ */new Date;e.setDate(1),r(e)}else if(1!==e.getDate()){let t=new Date(e);t.setDate(1),r(t)}}var lv=["clear","today"];function cv({value:e,current:t,markers:r=null,buttons:n=lv,css:a="",onChange:o}){let[i,s]=Wf(e),[l,c]=Wf(t);le(()=>{sv(l,i,c,!1)},[i,l]);let d=ie(e=>{let t=e.value;t?(s(new Date(t)),sv(l,new Date(t),c,!0)):s(null),o&&o({value:t?new Date(t):null})},[o,l]),u=ie(e=>{c(e)},[c]);return l?/* @__PURE__ */be(iv,{children:/* @__PURE__ */be(ov,{value:i,current:l,markers:r,buttons:n,css:a,onChange:d,onCurrentChange:u})}):null}function dv(e){return e||={},e.width||(e.width="unset"),e}var uv=["clear","today"];function hv({value:e,id:t,disabled:r=!1,error:n=!1,placeholder:a="",format:o="",buttons:i=uv,css:s="",title:l="",tooltip:c,editable:d=!1,clear:u=!1,onChange:h,dropdown:p={}}){let{calendar:m,formats:f}=(se(Fg)||Kg()).getRaw(),g=o||f?.dateFormat,v="function"==typeof g?g:Ig(g,m),[y,b]=fe(e),[x,w]=fe(!1);function S(){w(!1)}function k(e){let t=e===y||e&&y&&e.valueOf()===y.valueOf()||!e&&!y;b(e),t||h&&h({value:e}),setTimeout(S,1)}le(()=>{b(e)},[e]);let C=pe(()=>y?v(y):"",[y,v]);return le(()=>{let e=S;return window.addEventListener("scroll",e),()=>window.removeEventListener("scroll",e)},[]),/* @__PURE__ */xe("div",{className:"wx-1lKOFG wx-datepicker",onClick:()=>w(!0),children:[/* @__PURE__ */be(Jg,{css:`wx-date-input ${s}`,title:l,tooltip:c,value:C,id:t,readonly:!d,disabled:r,error:n,placeholder:a,onInput:S,onChange:function({value:e,input:t}){if(!d&&!u||t)return;let r="function"==typeof d?d(e):e?new Date(e):null;r=isNaN(r)?y||null:r||null,k(r)},icon:"wxi-calendar",clear:u}),x&&!r&&/* @__PURE__ */be(Wg,{onCancel:S,...dv(p),children:/* @__PURE__ */be(cv,{buttons:i,value:y,onChange:e=>k(e.value)})})]})}function pv({value:e="",options:t=[],textOptions:r=null,placeholder:n="",disabled:a=!1,error:o=!1,title:i="",tooltip:s,textField:l="label",clear:c=!1,css:d="",children:u,onChange:h,dropdown:p={}}){let m=me(null),f=me(null),[g,v]=Wf(e);let y=pe(()=>g||0===g?(r||t).find(e=>e.id===g):null,[g,r,t]),b=ie(({id:e})=>{(e||0===e)&&(v(e),m.current(null),h&&h({value:e}))},[v,h]),x=ie(e=>{e.stopPropagation(),v(""),h&&h({value:""})},[v,h]),w=ie(()=>t.findIndex(e=>e.id===g),[t,g]);/* @__PURE__ */
71
71
  return xe("div",{className:`wx-2YgblL wx-richselect ${d} ${o?"wx-2YgblL wx-error":""} ${a?"wx-2YgblL wx-disabled":""} ${u?"":"wx-2YgblL wx-nowrap"}`,title:i,onClick:()=>m.current(w()),onKeyDown:e=>f.current(e,w()),tabIndex:0,"data-tooltip-text":s,children:[
72
- /* @__PURE__ */be("div",{className:"wx-2YgblL wx-label",children:y?u?u(y):y[l]:n?/* @__PURE__ */be("span",{className:"wx-2YgblL wx-placeholder",children:n}):" "}),/* @__PURE__ */be("i",c&&!a&&g?{className:"wx-2YgblL wx-icon wxi-close",onClick:x}:{className:"wx-2YgblL wx-icon wxi-angle-down"}),!a&&/* @__PURE__ */be(rv,{items:t,onReady:function(e){m.current=e.navigate,f.current=e.keydown},onSelect:b,...p,children:({option:e})=>u?u(e):e[l]})]})}var bv=({options:e=[],value:t="",css:r="",children:n,onChange:a})=>{let[o,i]=fe(t);return le(()=>{i(t)},[t]),/* @__PURE__ */be("div",{className:`wx-0hMO7P wx-segmented ${r}`,children:e.map(e=>/* @__PURE__ */be("button",{className:`wx-0hMO7P wx-segment ${e.css} ${e.id===o?"wx-selected":""}`,title:e.title,onClick:()=>(e=>{i(e),a&&a({value:e})})(e.id),"data-tooltip-text":e.tooltip,children:n?Qf(n,{option:e}):/* @__PURE__ */xe(ye,{children:[e.icon&&/* @__PURE__ */be("i",{className:`wx-0hMO7P wx-icon ${e.icon} ${e.label?"":"wx-only"}`}),e.label&&/* @__PURE__ */be("span",{className:"wx-0hMO7P wx-label",children:e.label})]})},e.id))})};function xv({notice:e={}}){/* @__PURE__ */
73
- return xe("div",{className:`wx-11sNg5 wx-notice wx-${e.type?e.type:""}`,role:"status","aria-live":"polite",children:[/* @__PURE__ */be("div",{className:"wx-11sNg5 wx-text",children:e.text}),/* @__PURE__ */be("div",{className:"wx-11sNg5 wx-button",children:/* @__PURE__ */be("i",{className:"wx-11sNg5 wxi-close",onClick:function(){e.remove&&e.remove()}})})]})}function wv({data:e=[]}){/* @__PURE__ */
74
- return be("div",{className:"wx-3nwoO9 wx-notices",children:e.map(e=>/* @__PURE__ */be(xv,{notice:e},e.id))})}function Sv({title:e="",buttons:t=["cancel","ok"],header:r,children:n,footer:a,css:o="",onConfirm:i,onCancel:s}){let l=(se(jg)||Qg()).getGroup("core"),c=me(null);return le(()=>{c.current?.focus()},[]),/* @__PURE__ */be("div",{className:`wx-1FxkZa wx-modal ${o}`,ref:c,tabIndex:0,onKeyDown:function(e){switch(e.code){case"Enter":{let t=e.target.tagName;if("TEXTAREA"===t||"BUTTON"===t)return;i&&i({event:e});break}case"Escape":s&&s({event:e})}},children:/* @__PURE__ */xe("div",{className:"wx-1FxkZa wx-window",children:[r||(e?/* @__PURE__ */be("div",{className:"wx-1FxkZa wx-header",children:e}):null),
75
- /* @__PURE__ */be("div",{children:n}),a||t&&/* @__PURE__ */be("div",{className:"wx-1FxkZa wx-buttons",children:t.map(e=>/* @__PURE__ */be("div",{className:"wx-1FxkZa wx-button",children:/* @__PURE__ */be(Wg,{type:"block "+("ok"===e?"primary":"secondary"),onClick:t=>function(e,t){let r={event:e,button:t};"cancel"===t?s&&s(r):i&&i(r)}(t,e),children:l(e)})},e))})]})})}var kv=ne(function({children:e},t){let[r,n]=fe(null),[a,o]=fe([]);return de(t,()=>({showModal:e=>{let t={...e};return n(t),new Promise((e,r)=>{t.resolve=t=>{n(null),e(t)},t.reject=e=>{n(null),r(e)}})},showNotice:e=>{(e={...e}).id=e.id||Dg(),e.remove=()=>o(t=>t.filter(t=>t.id!==e.id)),-1!=e.expire&&setTimeout(e.remove,e.expire||5100),o(t=>[...t,e])}}),[]),/* @__PURE__ */xe(ye,{children:[e,r&&/* @__PURE__ */be(Sv,{title:r.title,buttons:r.buttons,onConfirm:r.resolve,onCancel:r.reject,children:r.message}),
76
- /* @__PURE__ */be(wv,{data:a})]})});function Cv(e){let{children:t}=e,r=me(),n=pe(()=>({showNotice:e=>r.current.showNotice(e),showModal:e=>r.current.showModal(e)}),[]);/* @__PURE__ */
77
- return be(Hg.Provider,{value:n,children:/* @__PURE__ */be(kv,{ref:r,children:t})})}var Nv=({value:e=!1,type:t="",icon:r="",disabled:n=!1,iconActive:a="",onClick:o,title:i="",tooltip:s,css:l="",text:c="",textActive:d="",children:u,active:h,onChange:p})=>{let[m,f]=Jf(e),g=pe(()=>(m?"pressed":"")+(t?" "+t:""),[m,t]),v=ie(e=>{let t=!m;o&&o(e),e.defaultPrevented||(f(t),p&&p({value:t}))},[m,o,p]);/* @__PURE__ */
78
- return be(Wg,m&&h?{title:i,tooltip:s,text:m&&d||c,css:l,type:g,icon:m&&a||r,onClick:v,disabled:n,children:Qf(h,{value:m})}:u?{title:i,tooltip:s,text:m&&d||c,css:l,type:g,icon:m&&a||r,onClick:v,disabled:n,children:u}:{title:i,tooltip:s,text:m&&d||c,css:l,type:g,icon:m&&a||r,onClick:v,disabled:n})};og(ag);var Tv={grid:{"Add before":"Add before","Add after":"Add after",Copy:"Copy",Cut:"Cut",Paste:"Paste",Delete:"Delete","New row":"New row","Move up":"Move up","Move down":"Move down",Undo:"Undo",Redo:"Redo",selected:"selected"}};
79
- /* @__PURE__ */(new Date).valueOf();var Av=class{constructor(e){this._nextHandler=null,this._dispatch=e,this.exec=this.exec.bind(this)}async exec(e,t){return this._dispatch(e,t),this._nextHandler&&await this._nextHandler.exec(e,t),t}setNext(e){return this._nextHandler=e}};
80
- /* @__PURE__ */(new Date).valueOf();var Mv=class{constructor(e){let t=/* @__PURE__ */new Map;t.set(0,{id:0,$level:0,data:[],parent:null}),this._pool=t,e&&e.length&&this.parse(e,0)}parse(e,t){let r=this._pool;for(let a=0;a<e.length;a++){let n=e[a];n.parent=n.parent||t,n.data=null,r.set(n.id,n)}for(let a=0;a<e.length;a++){let t=e[a],n=r.get(t.parent);n&&(n.data||=[],n.data.push(t))}let n=r.get(t);this.setLevel(n,n.$level+1,!1)}add(e,t){let r=this._pool.get(e.parent||0);e.$level=r.$level+1,this._pool.set(e.id,e),r.data?-1===t?r.data=[...r.data,e]:Ev(r,t,e):r.data=[e]}addAfter(e,t){if(!t)return this.add(e,-1);let r=this.byId(t),n=this.byId(r.parent),a=Iv(n,r.id)+1;e.parent=n.id,e.$level=n.$level+1,this.add(e,a)}remove(e){let t=this._pool.get(e);this._remove(t);let r=this._pool.get(t.parent);r.data=r.data.filter(t=>t.id!=e),this._clearBranch(r)}_remove(e){e.data&&e.data.forEach(e=>this._remove(e)),this._pool.delete(e.id)}update(e,t){let r=this._pool.get(e),n=this._pool.get(r.parent),a=Iv(n,r.id);r={...r,...t},n&&a>=0&&(n.data[a]=r,n.data=[...n.data]),this._pool.set(r.id,r)}move(e,t,r){let n=this._pool.get(e),a="child"===t,o=this._pool.get(r),i=o.$level+ +!!a;if(!n||!o)return;let s=this._pool.get(n.parent),l=a?o:this._pool.get(o.parent);l.data||=[];let c=Iv(s,n.id);!function(e,t){let r=[...e.data];r.splice(t,1),e.data=r}(s,c);let d=a?l.data.length:Iv(l,o.id)+ +("after"===t);if(Ev(l,d,n),s.id===l.id&&c===d)return null;n.parent=l.id,n.$level!==i&&(n.$level=i,this.setLevel(n,i+1,!0)),this.update(n.id,n),this._clearBranch(s)}_clearBranch(e){e.data&&!e.data.length&&(e.open&&delete e.open,this.update(e.id,{data:null}))}toArray(){let e=[],t=this._pool.get(0).data;return t&&Dv(t,e),e}byId(e){return this._pool.get(e)}getBranch(e){return this._pool.get(e).data}forEach(e){this._pool.forEach((t,r)=>{0!==r&&e(t)})}eachChild(e,t){let r=this.byId(t);!r||!r.data||r.data.forEach((t,r)=>{e(this.byId(t.id),r),this.eachChild(e,t.id)})}setLevel(e,t,r){e.data&&=e.data.map(e=>(r&&(e={...e},this._pool.set(e.id,e)),e.$level=t,e.data&&this.setLevel(e,t+1,r),e))}};function Dv(e,t){e.forEach(e=>{t.push(e),!0===e.open&&Dv(e.data,t)})}function Ev(e,t,r){let n=[...e.data];n.splice(t,0,r),e.data=n}function Iv(e,t){return e?.data.findIndex(e=>e.id===t)}var Rv=class{constructor(e){e&&(this._writable=e.writable,this._async=e.async),this._values={},this._state={}}setState(e,t=0){let r={};return this._wrapProperties(e,this._state,this._values,"",r,t),r}getState(){return this._values}getReactive(){return this._state}_wrapProperties(e,t,r,n,a,o){for(let i in e){let s=t[i],l=r[i],c=e[i];if(s&&(l===c&&"object"!=typeof c||c instanceof Date&&l instanceof Date&&l.getTime()===c.getTime()))continue;let d=n+(n?".":"")+i;s?(s.__parse(c,d,a,o)&&(r[i]=c),2&o?a[d]=s.__trigger:s.__trigger()):(t[i]=c&&c.__reactive?this._wrapNested(c,c,d,a):this._wrapWritable(c),r[i]=c),a[d]=a[d]||null}}_wrapNested(e,t,r,n){let a=this._wrapWritable(e);return this._wrapProperties(e,a,t,r,n,0),a.__parse=(e,r,n,o)=>(this._wrapProperties(e,a,t,r,n,o),!1),a}_wrapWritable(e){let t=[],r=function(){for(let r=0;r<t.length;r++)t[r](e)};return{subscribe:r=>(t.push(r),this._async?setTimeout(r,1,e):r(e),()=>{let e=t.indexOf(r);e>=0&&t.splice(e,1)}),__trigger:()=>{t.length&&(this._async?setTimeout(r,1):r())},__parse:function(t){return e=t,!0}}}};function zv(e,t){return Object.defineProperty(e,"__reactive",{value:!0,enumerable:!1,writable:!1}),e}var _v=class{constructor(e,t,r,n){this._setter="function"==typeof e?e:e.setState.bind(e),this._routes=t,this._parsers=r,this._prev={},this._triggers=/* @__PURE__ */new Map,this._sources=/* @__PURE__ */new Map,this._routes.forEach(e=>{e.in.forEach(t=>{let r=this._triggers.get(t)||[];r.push(e),this._triggers.set(t,r)}),e.out.forEach(t=>{let r=this._sources.get(t)||{};e.in.forEach(e=>r[e]=!0),this._sources.set(t,r)})}),this._routes.forEach(e=>{e.length=Math.max(...e.in.map(e=>Pv(e,this._sources,1)))}),this._bus=n}init(e){let t={};for(let r in e)if(this._prev[r]!==e[r]){let n=this._parsers[r];t[r]=n?n(e[r]):e[r]}this._prev=this._prev?{...this._prev,...e}:{...e},this.setState(t),this._bus&&this._bus.exec("init-state",t)}setStateAsync(e){let t=this._setter(e,2);return this._async?Object.assign(this._async.signals,t):this._async={signals:t,timer:setTimeout(this._applyState.bind(this),1)},t}_applyState(){let e=this._async;if(e){this._async=null,this._triggerUpdates(e.signals,[]);for(let t in e.signals){let r=e.signals[t];r&&r()}}}setState(e,t=[]){let r=this._setter(e);return this._triggerUpdates(r,t),r}_triggerUpdates(e,t){let r=Object.keys(e),n=!t.length;t||=[];for(let a=0;a<r.length;a++){let e=r[a],n=this._triggers.get(e);n&&n.forEach(e=>{-1==t.indexOf(e)&&t.push(e)})}n&&this._execNext(t)}_execNext(e){for(;e.length;){e.sort((e,t)=>e.length<t.length?1:-1);let t=e[e.length-1];e.splice(e.length-1),t.exec(e)}}};function Pv(e,t,r){let n=t.get(e);if(!n)return r;let a=Object.keys(n).map(e=>Pv(e,t,r+1));return Math.max(...a)}var Ov=class{constructor(){this._nextHandler=null,this._handlers={},this._tag=/* @__PURE__ */new WeakMap,this.exec=this.exec.bind(this)}on(e,t,r){let n=this._handlers[e];n?r&&r.intercept?n.unshift(t):n.push(t):n=this._handlers[e]=[t],r&&r.tag&&this._tag.set(t,r.tag)}intercept(e,t,r){this.on(e,t,{...r,intercept:!0})}detach(e){for(let t in this._handlers){let r=this._handlers[t];for(let t=r.length-1;t>=0;t--)this._tag.get(r[t])===e&&r.splice(t,1)}}async exec(e,t){let r=this._handlers[e];if(r)for(let n=0;n<r.length;n++){let e=r[n](t);if(!1===e||e&&e.then&&!1===await e)return}return this._nextHandler&&await this._nextHandler.exec(e,t),t}setNext(e){return this._nextHandler=e}},Lv=1024;function Fv(e){return e<Lv?`${e} B`:e<Lv**2?`${(e/Lv).toFixed(1)} KB`:e<Lv**3?`${(e/Lv**2).toFixed(1)} MB`:`${(e/Lv**3).toFixed(1)} GB`}function Bv(e,t){t||={key:"name",order:"asc"};let r=e.filter(e=>"folder"===e.type),n=e.filter(e=>"folder"!==e.type);return[...r.sort(Hv(t)),...n.sort(Hv(t))]}function Vv(e,t){return"string"==typeof e?e.localeCompare(t,void 0,{numeric:!0}):"object"==typeof e?e.getTime()-t.getTime():(e??0)-(t??0)}function $v(e,t){return"string"==typeof e?-e.localeCompare(t,void 0,{numeric:!0}):"object"==typeof t?t.getTime()-e.getTime():(t??0)-(e??0)}function Hv({key:e,order:t}){let r="asc"===t?Vv:$v;return(t,n)=>r(t[e],n[e])}function jv(e,t){let r="/"===e?1:e.split("/").length;return r>=t.length?null:t[r].id}var qv=class extends Mv{constructor(e){super([{id:"/",name:"My files",open:!0,$level:1,parent:0,ext:"",type:"folder"}]),this.parse(e,"/")}parse(e,t,r){!e||!e.length||(e.forEach(e=>this.parseId(e,r?t:void 0)),super.parse(e,t))}parseId(e,t){if(0===e.parent)return;let r=e.id,n=r.lastIndexOf("/");if(e.parent=t??(0===n?"/":r.slice(0,n)),e.name=r.slice(n+1),e.type=e.type||"file","folder"!==e.type){let t=e.name.lastIndexOf("."),r=-1===t?"":e.name.slice(t+1);e.ext="new"===r?"":r?.toLocaleLowerCase()}}getParents(e){let t=[],r=this.byId(e);if(!r)return t;for(;0!==r.id;)t.push(r),r=this.byId(r.parent);return t.reverse()}findFiles(e,t="/"){let r=[],n=e.toLocaleLowerCase();return this.eachChild(e=>{-1!==e.name.toLowerCase().indexOf(n)&&r.push(e)},t),r}add(e,t){let r=this.byId(e.parent||"/"),n=e.data?[...e.data]:null;e.data=null,super.add(e,t??r.data?r.data.length:0),n&&n.forEach(e=>this.add(e))}renameFiles(e,t,r){let n=this.byId(e),a=this.normalizeFile(n,t),o=[];return a.data?.forEach(e=>o.push(this.renameFiles(e.id,a.id,r))),o.length&&(a.data=o),r[e]=a.id,a}copyFiles(e,t,r){let n={};return e.forEach(e=>{let a=this.renameFiles(e,t,n);this.add(a),r&&this.remove(e),n[e]=a.id}),n}moveFiles(e,t){if(this.byId(e[0]).parent!==t)return this.copyFiles(e,t,!0)}serialize(e="/"){let t=[],r=this.byId(e);return r?(r.data?.forEach(e=>{let{id:r,date:n,type:a,size:o,lazy:i}=e,s={id:r,date:n,type:a??"file"};i&&(s.lazy=i),o&&(s.size=o),t.push(s);let l=this.serialize(r);l.length&&t.push(...l)}),t):null}normalizeFile(e,t){let r=e.name,n=r.lastIndexOf("."),a=-1===n?"":r.slice(n+1),o=a?`.${a}`:"",i=-1===n?r:r.slice(0,n),s=t+("/"===t?"":"/")+i;for(;this.byId(s+o);){let e=".new";s+=e,i+=e}return{...e,id:s+o,name:i+o,parent:t,ext:a.toLocaleLowerCase()}}},Uv=class extends Rv{in;_router;constructor(e){super({writable:e,async:!1});let t=[];for(let a=0;a<2;a++)t.push({in:["data",`panels.${a}.path`],out:[`panels.${a}._crumbs`],exec:e=>{let{data:t,panels:r}=this.getState(),n=[];n[a]={_crumbs:t.getParents(r[a].path)},this.setState({panels:n},e)}}),t.push({in:["data",`panels.${a}.path`,`panels.${a}._sorts`,"search"],out:[`panels.${a}._files`],exec:e=>{let t,{data:r,panels:n,search:o}=this.getState();t=o?r.findFiles(o,n[a].path):r.byId(n[a].path)?.data||[];let{path:i,_sorts:s}=n[a];t=Bv(t,s[i]);let l=[];l[a]={_files:t},this.setState({panels:l},e)}}),t.push({in:["data",`panels.${a}.selected`,`panels.${a}._sorts`],out:[`panels.${a}._selected`],exec:e=>{let{data:t,panels:r}=this.getState(),n=[];r[a].selected.forEach(e=>{let r=t.byId(e);r&&n.push(r)});let{path:o,_sorts:i}=r[a],s=Bv(n,i[o]),l=[];l[a]={_selected:s},this.setState({panels:l},e)}});this._router=new _v(super.setState.bind(this),t,{data:e=>new qv(e)});let r=this.in=new Ov;r.on("select-file",({id:e,toggle:t,range:r,panel:n,type:a})=>{let{panels:o,activePanel:i}=this.getState();typeof n>"u"&&(n=i),e||(t=r=!1);let s=[...o[n].selected];if(t){let t=s.indexOf(e);-1===t?s.push(e):s.splice(t,1)}else if(r&&o[n]._lastSelected){let t=o[n]._files,r=t.findIndex(e=>e.id==o[n]._lastSelected),a=t.findIndex(t=>t.id==e);a<r&&([r,a]=[a,r]);let i=t.slice(r,a+1).map(e=>e.id);s=[.../* @__PURE__ */new Set([...s,...i])]}else s=e?[e]:[];let l=[];l[n]={selected:s,_lastSelected:e,_selectNavigation:"navigation"===a},this.setState({panels:l})}),r.on("set-path",({id:e,panel:t,selected:n})=>{let{data:a,activePanel:o}=this.getState(),i=a.byId(e);if(i){let a=[];typeof t>"u"&&(t=o),a[t]={path:e},this.setState({panels:a}),r.exec("select-file",{panel:t}),n&&n.forEach(e=>r.exec("select-file",{id:e,panel:t,toggle:!0})),i.lazy&&r.exec("request-data",{id:e})}}),r.on("provide-data",({id:e,data:t})=>{let{mode:r,data:n}=this.getState(),a=n.byId(e);a&&(a.lazy||(a.data=[]),a.lazy=!1,n.parse(t,e,"search"===r),this.setState({data:n}))}),r.on("open-tree-folder",({id:e,mode:t})=>{let{data:r}=this.getState();r.update(e,{open:t}),this.setState({data:r})}),r.on("show-preview",({mode:e})=>{this.setState({preview:e})}),r.on("rename-file",e=>{let{id:t,name:r}=e,{data:n,panels:a}=this.getState(),o=n.byId(t);if(o.name!==r){o.name=r;let i=n.normalizeFile(o,o.parent);e.newId=i.id,i.data=null,n.add(i);let s={[t]:i.id};o.data?.forEach(e=>s={...n.moveFiles([e.id],i.id),...s});let l=a.map(e=>({selected:e.selected,_crumbs:e._crumbs,_lastSelected:e._lastSelected,_sorts:e._sorts}));n.remove(t),this._updatePanels(l,s),this.setState({data:n,panels:l})}}),r.on("create-file",e=>{let{file:t,parent:n}=e,{data:a}=this.getState(),o=a.normalizeFile(t,n);o.type=t.type||"file",e.newId=o.id,a.add(o),this.setState({data:a}),r.exec("select-file",{id:o.id})}),r.on("delete-files",({ids:e})=>{let{data:t,panels:r}=this.getState(),n=r.map(e=>({selected:e.selected,_crumbs:e._crumbs,_lastSelected:e._lastSelected,_sorts:e._sorts}));e.forEach(e=>t.remove(e)),this._updatePanels(n,{}),this.setState({data:t,panels:n})}),r.on("copy-files",e=>{let{ids:t,target:n}=e;if(this._isPlacedIntoSelf(t,n))return void(e.skipProvider=!0);let{data:a,panels:o,activePanel:i}=this.getState(),s=a.copyFiles(t,n);e.newIds=t.map(e=>s[e]),this.setState({data:a}),o[i].path==n&&(r.exec("select-file",{}),t.forEach(e=>{r.exec("select-file",{id:s[e],toggle:!0})}))}),r.on("move-files",e=>{let{ids:t,target:n}=e;if(this._isPlacedIntoSelf(t,n))return void(e.skipProvider=!0);let{data:a,panels:o,activePanel:i}=this.getState(),s=a.moveFiles(t,n);if(s){e.newIds=t.map(e=>s[e]);let l=o.map(e=>({selected:e.selected,_crumbs:e._crumbs,_lastSelected:e._lastSelected,_sorts:e._sorts}));this._updatePanels(l,s,!0),this.setState({data:a,panels:l}),o[i].path==n&&(r.exec("select-file",{}),t.forEach(e=>{r.exec("select-file",{id:s[e],toggle:!0})}))}});let n=null;r.on("filter-files",({text:e})=>{if(!e)return void(n&&this.setState({...n}));r.exec("select-file",{});let{panels:t,mode:a}=this.getState();n||={panels:t,mode:a,search:""},this.setState({mode:"search",search:e})}),r.on("set-mode",({mode:e})=>{let{activePanel:t}=this.getState(),r=[];r[t]={_selectNavigation:!1};let a={mode:e,search:"",panels:r};n=null,this.setState(a)}),r.on("set-active-panel",({panel:e})=>{this.setState({activePanel:e})}),r.on("sort-files",({key:e,order:t,panel:r,path:n})=>{let{activePanel:a,panels:o}=this.getState();r??=a,n??=o[r].path;let i=[];i[r]={_sorts:{...o[r]._sorts,[n]:{key:e,order:t}}},this.setState({panels:i})}),this.initOnce()}initOnce(){let e=[];for(let r=0;r<2;r++)e[r]=zv({_crumbs:[],_files:[],_selected:[],_sorts:{},path:"/",selected:[],...e[r]});let t={panels:zv(e),data:[],search:""};this._router.init(t)}init(e){let t={...e};this._router.init(t)}setState(e,t){return this._router.setState(e,t)}getFile(e){let{data:t}=this.getState();return t.byId(e)||null}serialize(e){let{data:t}=this.getState();return t.serialize(e)}_updatePanels(e,t,r){let{data:n}=this.getState();e.forEach(e=>{let a=[];e.selected.forEach(e=>{n.byId(e)?a.push(e):!r&&t[e]&&a.push(t[e])}),e.selected=a,n.byId(e._lastSelected)||(e._lastSelected=r?null:t[e._lastSelected]||null);let o={};Object.keys(e._sorts).forEach(a=>{n.byId(a)?o[a]=e._sorts[a]:t[a]&&!r&&(o[t[a]]=e._sorts[a])}),e._sorts=o;let i=e._crumbs[e._crumbs.length-1];"/"!==i?.id&&(t[i.id]?e.path=t[i.id]:n.byId(i.id)||(e.path="/"))})}_isPlacedIntoSelf(e,t){return e.some(e=>e===t||this.getState().data.getParents(t).some(t=>t.id===e))}};function Gv(e){switch(e){case"body":return[{icon:"wxi-content-paste",text:"Paste",hotkey:"Ctrl+V",id:"paste"}];case"add":return[{icon:"mdi mdi-folder-plus-outline",text:"Add new file",id:"add-file"},{icon:"mdi mdi-file-plus-outline",text:"Add new folder",id:"add-folder"},{icon:"mdi mdi-file-upload-outline",text:"Upload file",id:"upload",comp:"upload"}];case"multiselect":return[{icon:"wxi-content-copy",text:"Copy",hotkey:"Ctrl+C",id:"copy"},{icon:"wxi-content-cut",text:"Cut",hotkey:"Ctrl+X",id:"move"},{comp:"separator"},{icon:"wxi-close",text:"Delete",hotkey:"Delete",id:"delete"}];default:return["folder"===e?null:{icon:"wxi-download",text:"Download",hotkey:"Ctrl+D",id:"download"},{icon:"wxi-content-copy",text:"Copy",hotkey:"Ctrl+C",id:"copy"},{icon:"wxi-content-cut",text:"Cut",hotkey:"Ctrl+X",id:"move"},{icon:"wxi-content-paste",text:"Paste",hotkey:"Ctrl+V",id:"paste"},{comp:"separator"},{icon:"wxi-edit",text:"Rename",hotkey:"Ctrl+R",id:"rename"},{icon:"wxi-close",text:"Delete",hotkey:"Delete",id:"delete"}].filter(e=>null!==e)}}function Wv(e,t="data-id"){let r=function(e,t="data-id"){let r=e;for(!r.tagName&&e.target&&(r=e.target);r;){if(r.getAttribute&&r.getAttribute(t))return r;r=r.parentNode}return null}(e,t);return r?r.getAttribute(t):null}function Kv(e,t="data-id"){let r=e.getAttribute(t);return r?function(e){if(e.startsWith(":"))return e.substring(1);let t=1*e;return isNaN(t)?e:t}(r):null}
81
- /* @__PURE__ */(new Date).valueOf();var Yv={detect:()=>!0,addEvent:function(e,t,r){return e.addEventListener(t,r),()=>e.removeEventListener(t,r)},addGlobalEvent:function(e,t){return document.addEventListener(e,t),()=>document.removeEventListener(e,t)},getTopNode:function(){return window.document.body}};function Xv(e){let[t,r]=fe(e),n=me(e);return le(()=>{if(n.current!==e){if(Array.isArray(n.current)&&Array.isArray(e)&&0===n.current.length&&0===e.length)return;n.current=e,r(e)}},[e]),[t,r]}function Zv(e,t){let r=e.getState();return function(e,t){let[r,n]=fe(()=>t);return le(()=>{if(e)return e.subscribe(e=>{n(()=>e)})},[e]),r}(e.getReactiveState()[t],r[t])}function Jv(e,t){let r=e.getState();return function(e,t){let r=me(t);r.current=t;let[n,a]=fe(1);return le(()=>e.subscribe(e=>{r.current=e,a(e=>e+1)}),[e]),[r.current,n]}(e.getReactiveState()[t],r[t])}function Qv(e){let t={};return e.split(";").forEach(e=>{let[r,n]=e.split(":");if(n){let e=r.trim();e.indexOf("-")&&(e=e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())),t[e]=n.trim()}}),t}function ey(e){let t=e,r=[];return{subscribe:e=>{r.push(e),e(t)},unsubscribe:e=>{r=r.filter(t=>t!==e)},set:e=>{t=e,r.forEach(e=>e(t))},update:e=>{t=e(t),r.forEach(e=>e(t))}}}function ty(e,t,r){return Yv.addEvent(e,r,function(e){let n=function(e,t="data-id"){let r=e;for(!r.tagName&&e.target&&(r=e.target);r;){if(r.getAttribute&&r.getAttribute(t))return r;r=r.parentNode}return null}(e);if(!n)return;let a=Kv(n);if("function"==typeof t)return t(a,e);let o,i=e.target;for(;i!=n;){if(o=i.dataset?i.dataset.action:null,o&&t[o])return void t[o](a,e);i=i.parentNode}t[r]&&t[r](a,e)})}function ry(e,t){return e.map((e,r)=>{let n=t(e,r);return e.data&&e.data.length&&(n.data=ry(e.data,t)),n}).filter(Boolean)}function ny(e,t){let r=[];return e.forEach(e=>{if(e.data){let n=ny(e.data,t);n.length&&r.push({...e,data:n})}else t(e)&&r.push(e)}),r}function ay(e){return ry(e,(t,r)=>{let n={...t,id:t.id||Dg()};return n.type&&(n.comp=n.type),"separator"===n.comp&&"separator"===e[r-1]?.comp?null:n})}
82
- /* @__PURE__ */(new Date).valueOf();var oy={};function iy({onClick:e,onShow:t,option:r}){let n=me(null),a=ie(()=>{t(!!r.data&&r.id,n.current)},[t,r]),o=ie(a=>{if(r.data)return a.stopPropagation(),void t(r.id,n.current);e(a)},[e,t,r]),i=pe(()=>r&&r.comp?function(e){return oy[e]||e}(r.comp):null,[r]);/* @__PURE__ */
83
- return xe("div",{ref:n,className:`wx-cDCz9rZQ wx-option ${r.css||""} ${r.disabled?"wx-disabled":""}`,"data-id":ng(r.id),onMouseEnter:a,onClick:o,children:[r.icon?/* @__PURE__ */be("i",{className:`wx-cDCz9rZQ wx-icon ${r.icon}`}):null,r.comp?i?/* @__PURE__ */be(i,{item:r,option:r}):null:/* @__PURE__ */xe("span",{className:"wx-cDCz9rZQ wx-value",children:[" ",r.text," "]}),r.subtext?/* @__PURE__ */be("span",{className:"wx-cDCz9rZQ wx-subtext",children:r.subtext}):null,r.data?/* @__PURE__ */be("i",{className:"wx-cDCz9rZQ wx-sub-icon wxi-angle-right"}):null]})}function sy({options:e,left:t=0,top:r=0,at:n="bottom",parent:a=null,mount:o=null,context:i=null,css:s="",onClick:l,onCancel:c}){let[d,u]=fe(-1e4),[h,p]=fe(-1e4),[m,f]=fe(20),[g,v]=fe(),y=me(null),[b,x]=fe(!1),[w,S]=fe(null),k=ie(()=>{let e=Tg(y.current,a,n,t,r);e&&(u(e.x),p(e.y),v(e.width));let o=e?.z??20,i=a?function(e){let t=[],r=e,n=ag.getTopNode(e);for(;r&&r!==n&&!r.getAttribute("data-wx-portal-root");)"absolute"===getComputedStyle(r).position&&t.push(r),r=r.parentNode;return t}(a):[],s=0;for(let t of i){let e=parseInt(getComputedStyle(t).zIndex,10);e>s&&(s=e)}s>=o&&(o=s+1),f(o)},[a,n,t,r]);le(()=>{o&&o(k)},[]);let C=ie(()=>{x(!1)},[]),N=ie((e,t)=>{x(e),S(t)},[]),T=pe(()=>ay(e),[e]);le(()=>{k()},[a,k]);let A=me(l),M=me(c),D=me(a);return le(()=>{A.current=l},[l]),le(()=>{M.current=c},[c]),le(()=>{D.current=a},[a]),le(()=>{if(y.current)return fg(y.current,{callback:function(e){M.current?M.current(e):A.current&&A.current({action:null,option:null})},modal:!0,parent:()=>D.current}).destroy},[]),/* @__PURE__ */be("div",{ref:y,"data-wx-menu":"true",className:`wx-XMmAGqVx wx-menu ${s}`,style:{position:"absolute",top:h+"px",left:d+"px",width:g,zIndex:m},onMouseLeave:C,children:T.map(e=>/* @__PURE__ */xe(ee,{children:["separator"===e.comp?/* @__PURE__ */be("div",{className:"wx-XMmAGqVx wx-separator"}):/* @__PURE__ */be(iy,{option:e,onShow:N,onClick:t=>{if(!e.data&&!t.defaultPrevented){let r={context:i,action:e,option:e,event:t};e.handler&&e.handler(r),l&&l(r),t.stopPropagation()}}}),e.data&&b===e.id?/* @__PURE__ */be(sy,{css:s,options:e.data,at:"right-overlap",parent:w,context:i,onClick:l,onCancel:c}):null]},e.id))})}var ly=ne(function(e,t){let{options:r,at:n="bottom",resolver:a=null,dataKey:o="contextId",filter:i=null,css:s="",children:l,onClick:c}=e,[d,u]=fe(null),[h,p]=fe(null),[m,f]=fe(0),[g,v]=fe(0),y=me(null),b=pe(()=>`data-${o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,[o]),x=pe(()=>null!==d&&i?ny(r,e=>i(e,d)):r,[d,i,r]);let w=ie((e,t)=>{if(!e)return void p(null);if(e.defaultPrevented)return;let r=e.target;if(r&&r.dataset&&r.dataset.menuIgnore)return;if(h&&h===r)return p(null),void e.preventDefault();f(e.clientX+1),v(e.clientY+1);let n=typeof t<"u"?t:tg(r,b);a&&(n=a(n,e),!n)||(u(n),p(r),y.current=e.nativeEvent||e,e.preventDefault())},[h,b,a]);return de(t,()=>({show:w}),[w]),/* @__PURE__ */xe(ye,{children:[l?/* @__PURE__ */be("span",{onClick:w,"data-menu-ignore":"true",children:"function"==typeof l?l():l}):null,h?/* @__PURE__ */be(Yg,{children:/* @__PURE__ */be(sy,{css:s,at:n,top:g,left:m,parent:h,context:d,onClick:function(e){p(null),c&&c(e)},onCancel:function(e){y.current!==e?(p(null),c&&c({action:null,option:null})):y.current=null},options:x},h)}):null]})}),cy=ne(function(e,t){let{options:r,at:n="bottom",css:a="",children:o,onClick:i}=e,[s,l]=fe(null),c=me(null);let d=ie(e=>{l(e.target),c.current=e.nativeEvent||e,e.preventDefault()},[]);return de(t,()=>({show:d}),[d]),/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be("span",{onClick:function(e){let t=e.target;for(;!t.dataset.menuIgnore;)l(t),t=t.parentNode},"data-menu-ignore":"true",children:o}),s?/* @__PURE__ */be(Yg,{children:/* @__PURE__ */be(sy,{css:a,at:n,parent:s,options:r,onClick:function(e){l(null),i&&i(e)},onCancel:function(e){c.current!==e?(l(null),i&&i({action:null,option:null})):c.current=null}})}):null]})}),dy=ne(function(e,t){let{options:r,at:n="bottom",resolver:a=null,dataKey:o="contextId",filter:i=null,css:s="",children:l,onClick:c}=e,d=me(null),u=ie((e,t)=>{d.current.show(e,t)},[]);return de(t,()=>({show:u}),[u]),/* @__PURE__ */xe(ye,{children:[l?/* @__PURE__ */be("span",{onContextMenu:u,"data-menu-ignore":"true",children:l}):null,/* @__PURE__ */be(ly,{css:s,at:n,options:r,resolver:a,dataKey:o,filter:i,ref:d,onClick:c})]})}),uy={uploader:{B:"B",KB:"KB",MB:"MB",GB:"GB",TB:"TB",PB:"PB",EB:"EB","Drop files here or":"Drop files here or","select files":"select files"}},hy=class{constructor(e,t,r,n,a){this.setFiles=e,this.setReady=t,this.setSignal=r,this.setDrag=n,a&&a.length&&this.setFiles(a)}open(e){this.setSignal(["click",e||{}])}getState(){let e="server",t=this.files;for(let r=0;r<t.length;r++){if("client"===t[r].status)return"client";"error"===t[r].status&&(e="error")}return e}droparea(e,t){t||={};let r=()=>{t.dragEnter&&t.dragEnter(),this.setDrag(!0)},n=()=>{t.dragLeave&&t.dragLeave(),this.setDrag(!1)},a=e=>{e.preventDefault()},o=e=>{e.preventDefault(),this.setDrag(!1),this.setSignal(["drop",t,e]),t.dragLeave&&t.dragLeave(),t.drop&&t.drop()};return e.addEventListener("dragenter",r),e.addEventListener("dragleave",n),e.addEventListener("dragover",a,!0),e.addEventListener("drop",o,!0),()=>{e.removeEventListener("dragenter",r),e.removeEventListener("dragleave",n),e.removeEventListener("dragover",a,!0),e.removeEventListener("drop",o,!0)}}updateFile(e,t){let r=this.files.findIndex(t=>t.id===e);if(-1===r)return;let n=[...this.files];return n[r]={...n[r],...t},this.files=n,this.setFiles(this.files),this.files[r]}deleteFile(e){this.files=this.files.filter(t=>t.id!==e),this.setFiles(this.files)}addFile(e,t){this.files=t?[...this.files,e]:[e],this.setFiles(this.files)}deleteAll(){this.files=[],this.setFiles(this.files)}};function py(e){let[t,r]=fe(e||[]),[n,a]=fe(Promise.resolve(null)),[o,i]=fe(null),[s,l]=fe(!1),c=me();return c.current||=new hy(r,a,i,l,e),c.current.files=t,c.current.ready=n,c.current.signal=o,c.current.drag=s,c.current}var my=({data:e,accept:t="",multiple:r=!0,folder:n=!1,uploadURL:a="",apiOnly:o=!1,disabled:i=!1,children:s,onChange:l,onUpload:c})=>{let d=me(null),u=me(null),[h,p]=fe({}),m=py(),f=e||m,g=function(e,t){if(e){let r=e.getGroup(t);if(r)return r}return Bg(uy).getGroup(t)}(se(Ug.i18n),"uploader");le(()=>{d.current&&n&&(d.current.webkitdirectory=!0)},[n]),le(()=>{if(!o&&u.current&&!i)return f.droparea(u.current)},[o,i,u]);let v=(e,t)=>{let r=f.updateFile(e,t),n={...r,status:f.getState()};r&&r.uploaded&&r.uploaded(n),c&&c(n),r.temp&&f.deleteFile(r.id)},y=e=>{if(!e)return;let t="function"==typeof a?a(e):(e=>{let t=new FormData;return t.append("upload",e.file),fetch(a,{method:"POST",body:t}).then(e=>e.json()).then(t=>({id:e.id,...t}),()=>({id:e.id,status:"error"})).catch(t=>({id:e.id,status:"error"}))})(e);f.setReady(t.then(t=>{t.status=t.status||"server",v(e.id,t)}).catch(t=>{v(e.id,{status:"error",error:t})}))},b=(e,t)=>{let n={...t||h,id:Math.random().toString(36).substr(2,9),status:"client",name:e.name,file:e};n.selected&&n.selected(n),l&&l(n),f.addFile(n,r),y(n),d.current&&(d.current.value="")},x=(e,t,r)=>{e.isFile?e.file(e=>{b(e,r)}):e.isDirectory&&e.createReader().readEntries(e=>{e.forEach(e=>{x(e,t+e.name+"/",r)})})},w=e=>{Array.from(e.target.files).forEach(e=>b(e))},S=()=>{d.current&&d.current.click()};return le(()=>{if(f.signal){let[e,t,r]=f.signal;p(t),"click"===e?S():"drop"===e&&((e,t)=>{Array.from(e.dataTransfer.items).forEach(e=>{let r=e.webkitGetAsEntry();r&&x(r,"",t)})})(r,t),f.setSignal(null)}},[f.signal]),o?/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be("input",{type:"file",className:"wx-at1A8tb8 wx-input",ref:d,onChange:w,accept:t,multiple:r,disabled:i}),s]}):/* @__PURE__ */xe("div",{className:`wx-at1A8tb8 wx-label ${f.drag?"wx-active":""} ${i?"wx-disabled":""}`,ref:u,children:[/* @__PURE__ */be("input",{type:"file",className:"wx-at1A8tb8 wx-input",ref:d,onChange:w,accept:t,multiple:r,disabled:i}),s||/* @__PURE__ */be("div",{className:"wx-at1A8tb8 wx-dropzone",children:/* @__PURE__ */xe("span",{children:[g("Drop files here or")," ",
84
- /* @__PURE__ */be("span",{className:"wx-at1A8tb8 wx-action",onClick:S,children:g("select files")})]})})]})};function fy(e,t){if("number"==typeof e||"string"==typeof e||"boolean"==typeof e||null===e)return e===t;if(typeof e!=typeof t||(null===e||null===t)&&e!==t||e instanceof Date&&t instanceof Date&&e.getTime()!==t.getTime())return!1;if("object"==typeof e){if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=e.length-1;r>=0;r--)if(!fy(e[r],t[r]))return!1;return!0}return function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in t)if(!fy(e[r],t[r]))return!1;return!0}(e,t)}return e===t}function gy(e){if("object"!=typeof e||!e)return e;if(e instanceof Date)return new Date(e);if(e instanceof Array)return e.map(gy);let t={};for(let r in e)t[r]=gy(e[r]);return t}
85
- /* @__PURE__ */(new Date).valueOf();var vy=class{constructor(e){e&&(this._writable=e.writable,this._async=e.async),this._values={},this._state={}}setState(e,t=0){let r={};return this._wrapProperties(e,this._state,this._values,"",r,t),r}getState(){return this._values}getReactive(){return this._state}_wrapProperties(e,t,r,n,a,o){for(let i in e){let s=t[i],l=r[i],c=e[i];if(s&&(l===c&&"object"!=typeof c||c instanceof Date&&l instanceof Date&&l.getTime()===c.getTime()))continue;let d=n+(n?".":"")+i;s?(s.__parse(c,d,a,o)&&(r[i]=c),2&o?a[d]=s.__trigger:s.__trigger()):(t[i]=c&&c.__reactive?this._wrapNested(c,c,d,a):this._wrapWritable(c),r[i]=c),a[d]=a[d]||null}}_wrapNested(e,t,r,n){let a=this._wrapWritable(e);return this._wrapProperties(e,a,t,r,n,0),a.__parse=(e,r,n,o)=>(this._wrapProperties(e,a,t,r,n,o),!1),a}_wrapWritable(e){let t=[],r=function(){for(let r=0;r<t.length;r++)t[r](e)};return{subscribe:r=>(t.push(r),this._async?setTimeout(r,1,e):r(e),()=>{let e=t.indexOf(r);e>=0&&t.splice(e,1)}),__trigger:()=>{t.length&&(this._async?setTimeout(r,1):r())},__parse:function(t){return e=t,!0}}}},yy=class{constructor(e,t,r,n){this._setter="function"==typeof e?e:e.setState.bind(e),this._routes=t,this._parsers=r,this._prev={},this._triggers=/* @__PURE__ */new Map,this._sources=/* @__PURE__ */new Map,this._routes.forEach(e=>{e.in.forEach(t=>{let r=this._triggers.get(t)||[];r.push(e),this._triggers.set(t,r)}),e.out.forEach(t=>{let r=this._sources.get(t)||{};e.in.forEach(e=>r[e]=!0),this._sources.set(t,r)})}),this._routes.forEach(e=>{e.length=Math.max(...e.in.map(e=>by(e,this._sources,1)))}),this._bus=n}init(e){let t={};for(let r in e)if(this._prev[r]!==e[r]){let n=this._parsers[r];t[r]=n?n(e[r]):e[r]}this._prev=this._prev?{...this._prev,...e}:{...e},this.setState(t),this._bus&&this._bus.exec("init-state",t)}setStateAsync(e){let t=this._setter(e,2);return this._async?Object.assign(this._async.signals,t):this._async={signals:t,timer:setTimeout(this._applyState.bind(this),1)},t}_applyState(){let e=this._async;if(e){this._async=null,this._triggerUpdates(e.signals,[]);for(let t in e.signals){let r=e.signals[t];r&&r()}}}setState(e,t=[]){let r=this._setter(e);return this._triggerUpdates(r,t),r}_triggerUpdates(e,t){let r=Object.keys(e),n=!t.length;t||=[];for(let a=0;a<r.length;a++){let e=r[a],n=this._triggers.get(e);n&&n.forEach(e=>{-1==t.indexOf(e)&&t.push(e)})}n&&this._execNext(t)}_execNext(e){for(;e.length;){e.sort((e,t)=>e.length<t.length?1:-1);let t=e[e.length-1];e.splice(e.length-1),t.exec(e)}}};function by(e,t,r){let n=t.get(e);if(!n)return r;let a=Object.keys(n).map(e=>by(e,t,r+1));return Math.max(...a)}var xy=class{constructor(){this._nextHandler=null,this._handlers={},this._tag=/* @__PURE__ */new WeakMap,this.exec=this.exec.bind(this)}on(e,t,r){let n=this._handlers[e];n?r&&r.intercept?n.unshift(t):n.push(t):n=this._handlers[e]=[t],r&&r.tag&&this._tag.set(t,r.tag)}intercept(e,t,r){this.on(e,t,{...r,intercept:!0})}detach(e){for(let t in this._handlers){let r=this._handlers[t];for(let t=r.length-1;t>=0;t--)this._tag.get(r[t])===e&&r.splice(t,1)}}async exec(e,t){let r=this._handlers[e];if(r)for(let n=0;n<r.length;n++){let e=r[n](t);if(!1===e||e&&e.then&&!1===await e)return}return this._nextHandler&&await this._nextHandler.exec(e,t),t}setNext(e){return this._nextHandler=e}};function wy(e,t){return(t.getter||function(e){return t=>t[e]}(t.id))(e)}function Sy(e,t,r){return(t.setter||function(e){return(t,r)=>t[e]=r}(t.id))(e,r)}function ky(e,t){let r=wy(e,t)??"";return t.template?r=t.template(r,e,t):t.optionsMap&&(r=Array.isArray(r)?r.map(e=>t.optionsMap.get(e)).join(", "):t.optionsMap.get(r)),typeof r>"u"?"":r+""}function Cy(e,t,r,n,a){let o=/\n|"|;|,/;for(let i=0;i<t[0][e].length;i++){let s=[];for(let r=0;r<t.length;r++){let n=(t[r][e][i].text||"")+"";o.test(n)&&(n='"'+n.replace(/"/g,'""')+'"'),s.push(n)}r+=(r?a:"")+s.join(n)}return r}var Ny={a3:{width:11.7,height:16.5},a4:{width:8.27,height:11.7},letter:{width:8.5,height:11}};function Ty(e,t){let r=[],n=[],a=0,o=e.filter(e=>!e.hidden),i=function(e){let{mode:t,ppi:r,paper:n}=e,{width:a,height:o}=Ny[n];return function(e,t){return e*t}("portrait"===t?a:o,r)}(t);return o.forEach((e,t)=>{a+e.width<=i?(a+=e.width,n.push(e)):(n.length&&r.push(n),n=[e],a=e.width),t===o.length-1&&n.length&&r.push(n)}),r}function Ay(e,t,r){let n=[];return e.forEach((a,o)=>{let i=a[t];for(let s=0;s<r.length;s++){n[s]||(n[s]=[]);let a={...i[s]};if(null!==n[s][o]){if(!o&&!a.rowspan&&!a.colspan){let n=1,i=e[o+n][t][s],l=a.width;for(;!i.rowspan&&!i.colspan;)n++,i=e[o+n][t][s],l+=i.width;a.colspan=n,a.width=l,a.height=r[s]}if(n[s].push(a),!a.collapsed&&a.colspan>1){let t=a.colspan-1;if(a.colspan+o>e.length){let r=a.colspan-(a.colspan+o-e.length);a.colspan=r,a.width=e.slice(o,o+t+1).reduce((e,t)=>e+t.width,0),r>1&&(t=r-1)}for(let e=0;e<t;e++)n[s].push(null)}if(a.rowspan>1){let e=a.rowspan;for(let t=1;t<e;t++)n[s+t]||(n[s+t]=[]),n[s+t].push(null)}}}if(a.collapsed)for(let e=0;e<n.length;e++){let t=n[e],r=t[o];if(r&&r.collapsed){if(t[o]=null,!e)break}else{let e=r||t.findLast(e=>e?.colspan>=1);e&&(--e.colspan,e.width-=a.width)}}}),n.map(e=>e.filter(e=>e&&0!==e.colspan))}function My(e,t){return e.flexgrow?`min-width:${t}px;width:auto`:`width:${e.width}px; max-width:${e.width}px; height:${e.height}px`}function Dy(e,t,r){let n=e[r.id];if("richselect"===r.filter.type&&n){let e=r.filter.config?.options||t.find(({id:e})=>e==r.id).options;e&&(n=e.find(({id:e})=>e==n).label)}return n??""}var Ey=["resize-column","hide-column","update-cell"],Iy=["delete-row","update-row","update-cell"],Ry=["move-item"],zy=["resize-column","move-item"],_y=class{undo=[];redo=[];progress={};in;getState;setState;_previousValues={};constructor(e,t,r){this.in=e,this.getState=t,this.setState=r,this.setHandlers(),this.resetStateHistory()}getHandlers(){return{"add-row":{handler:e=>({action:"delete-row",data:{id:e.id},source:{action:"add-row",data:e}})},"delete-row":{handler:e=>{let{id:t}=e,{data:r}=this.getPrev(),n=r.findIndex(e=>e.id===t);return{action:"add-row",data:{id:t,row:r[n],before:n<r.length-1?r[n+1].id:void 0},source:{action:"delete-row",data:e}}}},"update-cell":{handler:e=>{let{id:t,column:r}=e,n=wy(this.getRow(t),this.getColumn(r));return fy(n,e.value)?null:{action:"update-cell",data:{id:t,column:r,value:n},source:{action:"update-cell",data:e}}}},"update-row":{handler:e=>{let{id:t,row:r}=e,n=this.getRow(t);for(let a in r)Object.keys(n).includes(a)||(n[a]=void 0);return{action:"update-row",data:{id:t,row:n},source:{action:"update-row",data:e}}}},"copy-row":{handler:e=>{let{id:t}=e,{data:r}=this.getState(),n=r.findIndex(e=>e.id===t),a=r[n];return{action:"delete-row",data:{id:t},source:{action:"add-row",data:{id:t,row:a,before:n<r.length-1?r[n+1].id:void 0}}}}},"resize-column":{handler:e=>{let{id:t,width:r}=e,n=this.getColumn(t),{_sizes:a}=this.getState();return{action:"resize-column",data:{id:t,width:n.width??a.columnWidth},source:{action:"resize-column",data:{id:t,width:r}}}}},"hide-column":{handler:e=>{let{id:t}=e;return{action:"hide-column",data:{id:t,mode:this.getColumn(t).hidden},source:{action:"hide-column",data:e}}}},"collapse-column":{handler:e=>{let{id:t,row:r,mode:n}=e;return{action:"collapse-column",data:{id:t,row:r,mode:"boolean"==typeof n?!n:n},source:{action:"collapse-column",data:e}}}},"move-item":{handler:e=>{let{id:t,target:r,mode:n}=e,{flatData:a}=this.getPrev(),o=a.findIndex(e=>e.id===t);return{action:"move-item",data:{id:t,target:a[o+(o?-1:1)].id,mode:o?"after":"before"},source:{action:"move-item",data:{id:t,target:r,mode:n}}}}},"open-row":{handler:e=>{let{id:t,nested:r}=e;return{action:"close-row",data:{id:t,nested:r},source:{action:"open-row",data:e}}}},"close-row":{handler:e=>{let{id:t,nested:r}=e;return{action:"open-row",data:{id:t,nested:r},source:{action:"close-row",data:e}}}}}}resetHistory(){this.undo=[],this.redo=[],this.progress={},this.resetStateHistory()}getPrev(){return this._previousValues}setHandlers(){let e=this.getHandlers();for(let t in e)this.in.intercept(t,e=>{if("undo"!==e.eventSource&&"redo"!==e.eventSource&&!e.skipUndo){if(zy.includes(t))return(e.inProgress&&!this.progress[t]||"boolean"!=typeof e.inProgress)&&(Ry.includes(t)&&this.setPrev("flatData"),Ey.includes(t)&&this.setPrev("columns")),void(this.progress[t]=e.inProgress);Iy.includes(t)&&this.setPrev("data"),Ey.includes(t)&&this.setPrev("columns")}}),this.in.on(t,r=>{if("undo"===r.eventSource||"redo"===r.eventSource||r.skipUndo||r.inProgress)return;let n=e[t].handler(r);n&&this.addToHistory(n)})}setPrev(e){this._previousValues[e]=gy(this.getState()[e])}addToHistory(e){this.undo.push(e),this.redo=[],this.setStateHistory()}handleUndo(){if(!this.undo.length)return;let e=this.undo.pop();this.redo.push({...e.source,source:e}),this.in.exec(e.action,{...e.data,eventSource:"undo"}),this.setStateHistory()}handleRedo(){if(!this.redo.length)return;let e=this.redo.pop();this.undo.push({...e.source,source:e}),this.in.exec(e.action,{...e.data,eventSource:"redo"}),this.setStateHistory()}resetStateHistory(){this.setState({history:{undo:0,redo:0}})}setStateHistory(){this.setState({history:{undo:this.undo.length,redo:this.redo.length}})}getRow(e){let{data:t}=this.getPrev();return this.getState().tree?this.getTreeRow(t,e):t.find(t=>t.id===e)}getTreeRow(e,t){for(let r=0;r<e.length;r++){if(e[r].id===t)return e[r];if(e[r].data){let n=this.getTreeRow(e[r].data,t);if(n)return n}}return null}getColumn(e){let{columns:t}=this.getPrev();return t.find(t=>t.id===e)}};function Py(e,t){return typeof e>"u"||null===e?-1:typeof t>"u"||null===t?1:e===t?0:e>t?1:-1}function Oy(e,t){return-Py(e,t)}function Ly(e,t){if(!e||!e.length)return;let r=e.map(e=>{let r=t.find(t=>t.id==e.key);return function(e,t){if("function"==typeof t.sort)return function(r,n){let a=t.sort(r,n);return"asc"===e?a:-a};let r="asc"===e?Py:Oy;return function(e,n){return r(wy(e,t),wy(n,t))}}(e.order,r)});return 1===e.length?r[0]:function(e,t){for(let n=0;n<r.length;n++){let a=r[n](e,t);if(0!==a)return a}return 0}}function Fy(e,t,r,n,a){let o,i,s=document.createElement("div"),l=document.createElement("div"),c=document.body;a=a?`${a}px`:"auto",l.className=t,s.classList.add(`wx-${r}-theme`),s.style.cssText=`height:auto;position:absolute;top:0px;left:100px;overflow:hidden;width=${a};white-space:nowrap;`,s.appendChild(l),c.appendChild(s),"object"!=typeof e&&(e=[e]);for(let d=0;d<e.length;d++){l.innerText=e[d]+"";let t=s.getBoundingClientRect(),r=Math.ceil(t.width)+(n&&n.length?n[d]:0),a=Math.ceil(t.height);o=Math.max(o||0,r),i=Math.max(i||0,a)}return s.remove(),{width:o,height:i}}function By(e,t,r,n,a){let o=[];for(let i=0;i<e.length;i++){let s=e[i][t],l=s.length;for(let e=0;e<l;e++){let{text:i,vertical:l,collapsed:c,rowspan:d,css:u}=s[e];if(!i){o[e]=Math.max(o[e]||0,n);continue}let h=0;if(l&&!c){let l=`wx-measure-cell-${t}`;if(l+=u?` ${u}`:"",h=Fy(i,l,a).width,(d>1||!s[e+1])&&r>e+1){let t=d||r-e,a=o.slice(e,e+t).reduce((e,t)=>e+t,0);if(a<h){let r=Math.ceil((h-a)/t);for(let a=e;a<e+t;a++)o[a]=(o[a]||n)+r}continue}}o[e]=Math.max(o[e]||n,h)}}return o}var Vy={text:(e,t)=>e?-1!==e.toString().toLowerCase().indexOf(t.toLowerCase()):!t,richselect:(e,t)=>"number"!=typeof t&&!t||e==t,datepicker:(e,t)=>!t||e&&function(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}(e,t),multiselect:(e,t)=>!t||0===t?.length||(Array.isArray(e)?e?.some(e=>t.includes(e)):e&&t.includes(e))};function $y(e){return Vy[e]}var Hy=class extends vy{in;_router;_branches;_xlsxWorker;_historyManager;constructor(e){super({writable:e,async:!1});let t={rowHeight:37,columnWidth:160,headerHeight:36,footerHeight:36};this._router=new yy(super.setState.bind(this),[{in:["columns","sizes","_skin"],out:["_columns","_sizes"],exec:e=>{let{columns:t,sizes:r,_skin:n}=this.getState(),a=this.copyColumns(t),o=a.reduce((e,t)=>Math.max(t.header.length,e),0),i=a.reduce((e,t)=>Math.max(t.footer.length,e),0);a.forEach(this.setCollapsibleColumns);let s=this.normalizeSizes(a,r,o,i,n);for(let l=0;l<a.length;l++)this.normalizeColumns(a,l,"header",o,s),this.normalizeColumns(a,l,"footer",i,s);this.setState({_columns:a,_sizes:s},e)}},{in:["data","tree","_filterIds"],out:["flatData","_rowHeightFromData"],exec:e=>{let{data:t,tree:r,dynamic:n,_filterIds:a}=this.getState(),o=a&&new Set(a),i=r?this.flattenRows(t,[],a):o?t.filter(e=>o.has(e.id)):t,s=!n&&i.some(e=>e.rowHeight);this.setState({flatData:i,_rowHeightFromData:s},e)}}],{sizes:e=>({...t,...e})});let r=this.in=new xy;r.on("close-editor",({ignore:e})=>{let{editor:t}=this.getState();t&&(e||r.exec("update-cell",t),this.setState({editor:null}))}),r.on("open-editor",({id:e,column:t})=>{let n=this.getState().editor;n&&r.exec("close-editor",{});let a=this.getRow(e),o=t?this.getColumn(t):this.getNextEditor(a);if(o?.editor){let t=o.editor;if("function"==typeof t&&(t=t(a,o)),!t)return;n={column:o.id,id:e,value:wy(a,o)??"",renderedValue:ky(a,o),type:t.type||t},"object"==typeof t&&t.config&&(n.config=t.config,t.config.options&&(n.options=t.config.options)),o.options&&!n.options&&(n.options=o.options),this.setState({editor:n})}}),r.on("editor",({value:e})=>{let t=this.getState().editor;if(t){t={...t},t.value=e;let r=this.getColumn(t.column),n={...this.getRow(t.id)};Sy(n,r,e),t.renderedValue=ky(n,r),this.setState({editor:t})}}),r.on("add-row",e=>{let t=this.getState(),{data:n}=t,{select:a,_filterIds:o}=t,{row:i,before:s,after:l,select:c}=e;if(e.id=i.id=e.id||i.id||qy(),s||l){let t=s||l,r=n.findIndex(e=>e.id===t);n=[...n],n.splice(r+ +!!l,0,e.row)}else n=[...n,e.row];let d={data:n};o&&(d._filterIds=[...o,e.id]),this.setState(d),("boolean"!=typeof c||c)&&(c||a)&&r.exec("select-row",{id:i.id,show:!0})}),r.on("delete-row",e=>{let{data:t,selectedRows:r,focusCell:n,editor:a}=this.getState(),{id:o}=e,i={data:t.filter(e=>e.id!==o)};this.isSelected(o)&&(i.selectedRows=r.filter(e=>e!==o)),a?.id===o&&(i.editor=null),this.setState(i),n?.row===o&&this.in.exec("focus-cell",{eventSource:"delete-row"})}),r.on("update-cell",e=>{let t=this.getState(),{data:r}=t;r=[...r];let{tree:n}=t,{id:a,column:o,value:i}=e,s=this.getColumn(o);if(n){let e={...this._branches[a]};Sy(e,s,i);let t=this.updateTreeRow(e);0===e.$parent&&(r=t)}else{let e=r.findIndex(e=>e.id===a),t={...r[e]};Sy(t,s,i),r[e]=t}this.setState({data:r})}),r.on("update-row",e=>{let{data:t}=this.getState(),{id:r,row:n}=e,a=t.findIndex(e=>e.id===r);t=[...t],t[a]={...t[a],...n},this.setState({data:t})}),r.on("select-row",({id:e,toggle:t,range:r,mode:n,show:a,column:o})=>{let i=this.getState(),{focusCell:s}=i,{selectedRows:l}=i;if(l.length||(r=t=!1),r){let{data:t}=this.getState(),r=t.findIndex(e=>e.id===l[l.length-1]),n=t.findIndex(t=>t.id===e);r>n&&([r,n]=[n,r]),t.slice(r,n+1).forEach(e=>{this.isSelected(e.id)||l.push(e.id)})}else if(t&&this.isSelected(e)){if(!0===n)return;l=l.filter(t=>t!==e)}else if(t){if(!1===n)return;l.push(e)}else l=[e];this.setState({selectedRows:[...l]}),s?.row!==e&&this.in.exec("focus-cell",{eventSource:"select-row"}),a&&this.in.exec("scroll",{row:e,column:o})}),this.in.on("focus-cell",e=>{let{row:t,column:r,eventSource:n}=e,{_columns:a,split:o}=this.getState();t&&r?(this.setState({focusCell:{row:t,column:r}}),"click"!==n&&((!o.left||a.findIndex(t=>t.id===e.column)>=o.left)&&(!o.right||a.findIndex(t=>t.id===e.column)<a.length-o.right)?this.in.exec("scroll",{row:t,column:r}):this.in.exec("scroll",{row:t}))):this.setState({focusCell:null})}),r.on("resize-column",e=>{let{id:t,auto:r,maxRows:n,inProgress:a}=e;if(!1===a)return;let o=e.width||0,i=[...this.getState().columns],s=this.getColumn(t);if(r){if("data"===r||!0===r){let{flatData:e,_skin:t}=this.getState(),r=e.length;n&&(r=Math.min(n,r)),o=function(e,t,r){let n=[],a=[],o="wx-measure-cell-body";o+=e.css?` ${e.css}`:"";for(let i=0;i<t.length;i++){let r=ky(t[i],e);r&&(n.push(r),e.treetoggle?a.push(28*t[i].$level+(t[i].$count?28:0)+(e.draggable?28:0)):e.draggable&&a.push(28))}return Fy(n,o,r,a).width}(s,e.slice(0,r),t)}if("header"===r||!0===r){let{_skin:e}=this.getState();o=Math.max(function(e,t){let r,n="wx-measure-cell-header",a=e.sort?20:0,o=e.header;if("string"==typeof o)return Fy(o,n,t).width+a;Array.isArray(o)||(o=[o]);for(let i=0;i<o.length;i++){let e=o[i],s=Fy("string"==typeof e?e:e.text,n+("string"==typeof e?"":` ${e.css}`),t).width;i===o.length-1&&(s+=a),r=Math.max(r||0,s)}return r}(s,e),o)}}s.width=Math.max(17,o),delete s.flexgrow,this.setState({columns:i})}),r.on("hide-column",e=>{let{id:t,mode:r}=e,n=[...this.getState().columns],a=this.getColumn(t),o=n.reduce((e,t)=>e+ +!t.hidden,0);!r||o>1?(a.hidden=!a.hidden,this.setState({columns:n})):e.skipUndo=!0}),r.on("sort-rows",e=>{let{key:t,add:r,sort:n}=e,a=this.getState(),{columns:o,data:i,tree:s}=a;if(n){let e=[...i];return e.sort(n),void this.setState({data:e})}let{order:l="asc"}=e,c=a.sortMarks,d=Object.keys(c),u=d.length;!r||!u||1===u&&c[t]?c={[t]:{order:l}}:(1===u&&(c[d[0]]={...c[d[0]],index:0}),c={...c,[t]:{order:l,index:"number"==typeof r?r:c[t]?.index??u}});let h=Object.keys(c).sort((e,t)=>c[e].index-c[t].index).map(e=>({key:e,order:c[e].order}));this.setState({sortMarks:c});let p=Ly(h,o);if(p){let e=[...i];s?this.sortTree(e,p):e.sort(p),this.setState({data:e})}}),r.on("filter-rows",e=>{let{value:t,key:r,filter:n}=e;if(!Object.keys(e).length)return void this.setState({filterValues:{},_filterIds:null});let a=this.getState(),{data:o,tree:i,_columns:s}=a,l=a.filterValues,c={};r&&(l={...l,[r]:t},c.filterValues=l);let d=n??function(e,t){let r=[];for(let n in e){let a=t.find(e=>e.id==n),{config:o,type:i}=a.header.find(e=>e.filter).filter,s=e[n];r.push(e=>{let t=wy(e,a);return o?.handler?o.handler(t,s):$y(i)(t,s)})}return e=>{for(let t=0;t<r.length;t++)if(!r[t](e))return!1;return!0}}(l,s),u=[];i?u=this.filterTree(o,d,u):o.forEach(e=>{d(e)&&u.push(e.id)}),c._filterIds=u,this.setState(c)}),r.on("collapse-column",e=>{let{id:t,row:r,mode:n}=e,a=[...this.getState().columns],o=this.getColumn(t).header,i=Array.isArray(o)?o[r]:o;"object"==typeof i&&(i.collapsed=n??!i.collapsed,this.setState({columns:a}))}),r.on("move-item",e=>{let t,r,{id:n,inProgress:a}=e,{target:o,mode:i="after"}=e,{data:s,flatData:l,tree:c}=this.getState(),d=l.findIndex(e=>e.id===n);if("up"===i||"down"===i){if("up"===i){if(0===d)return;t=d-1,i="before"}else if("down"===i){if(d===l.length-1)return;t=d+1,i="after"}o=l[t]&&l[t].id}else t=l.findIndex(e=>e.id===o);-1!==d&&-1!==t&&!1!==a&&(c||(r=this.moveItem(n,o,s,i)),this.setState({data:c?this.normalizeTreeRows(r):r}))}),r.on("copy-row",e=>{let{id:t,target:r,mode:n="after"}=e,a=this.getState(),{flatData:o,_filterIds:i}=a,{data:s}=a,l=this.getRow(t);if(!l)return;let c={...l,id:qy()};e.id=c.id;let d=o.findIndex(e=>e.id===r);if(-1===d)return;s.splice(d+ +("after"===n),0,c),s=[...s];let u={data:s};i&&(u._filterIds=[...i,c.id]),this.setState(u)}),r.on("open-row",e=>{let{id:t,nested:r}=e;this.toggleBranch(t,!0,r)}),r.on("close-row",e=>{let{id:t,nested:r}=e;this.toggleBranch(t,!1,r)}),r.on("export-data",e=>new Promise((t,r)=>{let n=e.format||"csv",a=`${e.fileName||"data"}.${n}`;if("csv"===n){let r=function(e,t){let r=/\n|"|;|,/,n="",a=t.rows||"\n",o=t.cols||"\t",i=e._columns,s=e.flatData;!1!==t.header&&i[0].header&&(n=Cy("header",i,n,o,a));for(let l=0;l<s.length;l++){let e=[];for(let t=0;t<i.length;t++){let n=ky(s[l],i[t]);r.test(n)&&(n='"'+n.replace(/"/g,'""')+'"'),e.push(n)}n+=(n?a:"")+e.join(o)}return!1!==t.footer&&i[0].footer&&(n=Cy("footer",i,n,o,a)),n}(this.getState(),e.csv||{});!1===e.download?e.result=r:function(e,t){let r=document.createElement("a");r.href=URL.createObjectURL(e),r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r)}(new Blob(["\ufeff"+r],{type:"text/csv"}),a),t(!0)}else r()})),r.on("hotkey",({key:e,event:t,isInput:r})=>{switch(e){case"arrowup":{let{flatData:e,focusCell:n,select:a}=this.getState();if(t.preventDefault(),r)return;let o=n?n.column:this._getFirstVisibleColumn()?.id,i=n?this.getPrevRow(n.row)?.id:e[e.length-1]?.id;o&&i&&(this.in.exec("focus-cell",{row:i,column:o,eventSource:"key"}),a&&this.in.exec("select-row",{id:i}));break}case"arrowdown":{let{flatData:e,focusCell:n,select:a}=this.getState();if(t.preventDefault(),r)return;let o=n?n.column:this._getFirstVisibleColumn()?.id,i=n?this.getNextRow(n.row)?.id:e[0]?.id;o&&i&&(this.in.exec("focus-cell",{row:i,column:o,eventSource:"key"}),a&&this.in.exec("select-row",{id:i}));break}case"arrowright":{let{focusCell:e}=this.getState();if(r)return;if(t.preventDefault(),e){let t=this.getNextColumn(e.column,!0)?.id;t&&this.in.exec("focus-cell",{row:e.row,column:t,eventSource:"key"})}break}case"arrowleft":{let{focusCell:e}=this.getState();if(r)return;if(t.preventDefault(),e){let t=this.getPrevColumn(e.column,!0)?.id;t&&this.in.exec("focus-cell",{row:e.row,column:t,eventSource:"key"})}break}case"tab":{let{editor:e,focusCell:r,select:n}=this.getState();if(e){t.preventDefault();let r=e.column,a=e.id,o=this.getNextEditor(this.getRow(a),this.getColumn(r));if(!o){let e=this.getNextRow(a);e&&(a=e.id,o=this.getNextEditor(e))}o&&(this.in.exec("open-editor",{id:a,column:o.id}),this.in.exec("focus-cell",{row:a,column:o.id,eventSource:"key"}),n&&!this.isSelected(a)&&this.in.exec("select-row",{id:a}))}else r&&this.in.exec("focus-cell",{eventSource:"key"});break}case"shift+tab":{let{editor:e,focusCell:r,select:n}=this.getState();if(e){t.preventDefault();let r=e.column,a=e.id,o=this.getPrevEditor(this.getRow(a),this.getColumn(r));if(!o){let e=this.getPrevRow(a);e&&(a=e.id,o=this.getPrevEditor(e))}o&&(this.in.exec("open-editor",{id:a,column:o.id}),this.in.exec("focus-cell",{row:a,column:o.id,eventSource:"key"}),n&&!this.isSelected(a)&&this.in.exec("select-row",{id:a}))}else r&&this.in.exec("focus-cell",{eventSource:"key"});break}case"escape":{let{editor:e}=this.getState();e&&(this.in.exec("close-editor",{ignore:"multiselect"!=e.type}),this.in.exec("focus-cell",{row:e.id,column:e.column,eventSource:"key"}));break}case"f2":{let{editor:e,focusCell:t}=this.getState();!e&&t&&this.in.exec("open-editor",{id:t.row,column:t.column});break}case"enter":{let{focusCell:e,tree:t}=this.getState();if(!r&&t&&e&&this.getColumn(e.column).treetoggle){let t=this.getRow(e.row);if(!t.data)return;this.in.exec(t.open?"close-row":"open-row",{id:e.row,nested:!0})}break}case"home":{let{editor:e,focusCell:r}=this.getState();if(!e&&r){t.preventDefault();let e=this._getFirstVisibleColumn()?.id;this.in.exec("focus-cell",{row:r.row,column:e,eventSource:"key"})}break}case"ctrl+home":{let{editor:e,focusCell:r,flatData:n,select:a}=this.getState();if(!e&&r){t.preventDefault();let e=n[0]?.id,r=this._getFirstVisibleColumn()?.id;e&&r&&(this.in.exec("focus-cell",{row:e,column:r,eventSource:"key"}),a&&!this.isSelected(e)&&this.in.exec("select-row",{id:e}))}break}case"end":{let{editor:e,focusCell:r}=this.getState();if(!e&&r){t.preventDefault();let e=this._getLastVisibleColumn()?.id,n=r.row;this.in.exec("focus-cell",{row:n,column:e,eventSource:"key"})}break}case"ctrl+end":{let{editor:e,focusCell:r,flatData:n,select:a}=this.getState();if(!e&&r){t.preventDefault();let e=n.at(-1).id,r=this._getLastVisibleColumn()?.id;e&&r&&(this.in.exec("focus-cell",{row:e,column:r,eventSource:"key"}),a&&!this.isSelected(e)&&this.in.exec("select-row",{id:e}))}break}case"ctrl+z":this.in.exec("undo",{});break;case"ctrl+y":this.in.exec("redo",{})}}),r.on("scroll",e=>{let{_columns:t,split:r,_sizes:n,flatData:a,dynamic:o,_rowHeightFromData:i}=this.getState(),s=-1,l=-1,c=0,d=0;if(e.column){s=0;let n=t.findIndex(t=>t.id===e.column);c=t[n].width;for(let e=r.left??0;e<n;e++){let r=t[e];r.hidden||(s+=r.width)}}if(e.row&&!o){let t=a.findIndex(t=>t.id===e.row);t>=0&&(i?(l=a.slice(0,t).reduce((e,t)=>e+(t.rowHeight||n.rowHeight),0),d=a[t].rowHeight):l=n.rowHeight*t)}this.setState({scroll:{top:l,left:s,width:c,height:d||n.rowHeight}})}),r.on("scroll-to",e=>{let t={};void 0!==e.top&&(t.scrollTop=e.top),void 0!==e.left&&(t.scrollLeft=e.left),Object.keys(t).length&&this.setState(t)}),r.on("print",e=>{let t=function(e={}){let{mode:t,ppi:r,paper:n}=e;return{mode:t||"portrait",ppi:r||100,paper:n||"a4"}}(e);this.setState({_print:t}),this.setStateAsync({_print:null})}),r.on("undo",()=>{this._historyManager?.handleUndo()}),r.on("redo",()=>{this._historyManager?.handleRedo()}),this.initOnce()}getXlsxWorker(e){if(!this._xlsxWorker){let t=window.URL.createObjectURL(new Blob([`importScripts('${e}');`],{type:"text/javascript"}));this._xlsxWorker=new Promise(e=>{let r=new Worker(t);r.addEventListener("message",t=>{"init"===t.data.type&&e(r)})})}return this._xlsxWorker}initOnce(){this._router.init({sortMarks:{},_filterIds:null,data:[],filterValues:{},scroll:null,scrollLeft:0,scrollTop:0,editor:null,focusCell:null,_print:null,history:{undo:0,redo:0},search:null})}init(e){e.hasOwnProperty("_skin")&&!e._skin&&(e._skin=function(){if(typeof document>"u")return"willow";let e=document.querySelector('[class^="wx"][class$="theme"]');return e?e.className.substring(3,e.className.length-6):"willow"}()),e.columns&&e.columns.forEach(e=>{e.options&&(e.optionsMap=new Map(e.options.map(e=>[e.id,e.label])))}),fy(this.getState().data,e.data)||(e.data=e.tree?this.normalizeTreeRows(e.data):this.normalizeRows(e.data),this.setState({_filterIds:null,filterValues:{},sortMarks:{},search:null}),this._historyManager&&this._historyManager.resetHistory()),e.tree&&(e.undo=!1,e.reorder=!1),e.split?.right&&(e.split.right=0),e.undo&&!this._historyManager&&(this._historyManager=new _y(this.in,this.getState.bind(this),this.setState.bind(this))),this._router.init({...e})}setState(e,t){return this._router.setState(e,t)}setStateAsync(e){this._router.setStateAsync(e)}getRow(e){let{tree:t}=this.getState();return t?this._branches[e]:this.getState().data.find(t=>t.id===e)}getRowIndex(e,t){return t||=this.getState().flatData,t.findIndex(t=>t.id===e)}getNextRow(e){let t=this.getState().flatData;return t[this.getRowIndex(e,t)+1]}getPrevRow(e){let t=this.getState().flatData;return t[this.getRowIndex(e,t)-1]}getColumn(e){return this.getState().columns.find(t=>t.id===e)}getNextColumn(e,t){let r=this.getState()._columns,n=r.findIndex(t=>t.id===e);return t?this._getFirstVisibleColumn(n+1):r[n+1]}getPrevColumn(e,t){let r=this.getState()._columns,n=r.findIndex(t=>t.id===e);return t?this._getLastVisibleColumn(n-1):r[n-1]}_getFirstVisibleColumn(e){let t=this.getState()._columns,r=e??0;for(;r<t.length&&(t[r]?.hidden||t[r]?.collapsed);)r++;return t[r]}_getLastVisibleColumn(e){let t=this.getState()._columns,r=e??t.length-1;for(;r<t.length&&(t[r]?.hidden||t[r]?.collapsed);)r--;return t[r]}isCellEditable(e,t){let{editor:r,hidden:n}=t;return!(!r||n)&&("function"!=typeof r||r(e,t))}getNextEditor(e,t){let r=this.getState().columns;if(t){let e=r.findIndex(e=>e.id===t.id);r=r.slice(e+1)}return r.find(t=>this.isCellEditable(e,t))}getPrevEditor(e,t){let r=this.getState().columns;if(t){let e=r.findLastIndex(e=>e.id===t.id);r=r.slice(0,e)}return r.findLast(t=>this.isCellEditable(e,t))}toggleBranch(e,t,r){let n=this._branches[e],{data:a}=this.getState();if(a=[...a],0!==e){n={...n,open:t};let e=this.updateTreeRow(n);0===n.$parent&&(a=e)}r&&n.data?.length&&n.data.forEach(n=>{let o=this.toggleKids(n,t,r);0===e&&(a=o)}),this.setState({data:a})}toggleKids(e,t,r){e={...e,open:t};let n=this.updateTreeRow(e);return r&&e.data?.length&&e.data.forEach(e=>{this.toggleKids(e,t,r)}),n}updateTreeRow(e){let t=e.id;this._branches[t]=e;let r=this._branches[e.$parent],n=r.data.findIndex(e=>e.id===t);return r.data=[...r.data],r.data[n]=e,r.data}isSelected(e){return-1!==this.getState().selectedRows.indexOf(e)}findAndRemove(e,t){for(let r=0;r<e.length;r++){if(e[r].id===t)return e.splice(r,1)[0];if(e[r].data){let n=[...e[r].data],a=this.findAndRemove(n,t);if(a)return e[r]={...e[r],data:n},a}}return null}insertItem(e,t,r,n){for(let a=0;a<e.length;a++){if(e[a].id===t){let t=e[a],o="before"===n?a:a+1;if(t.data){if("before"===n){let t=a>0?e[a-1]:null;return t?.data&&t.open?e[a-1]={...t,data:[...t.data,r]}:e.splice(o,0,r),!0}if(t.open)return e[a]={...t,data:[r,...t.data]},!0}return e.splice(o,0,r),!0}if(e[a].data&&(e[a]={...e[a],data:[...e[a].data]},this.insertItem(e[a].data,t,r,n)))return!0}return!1}moveItem(e,t,r,n){let a=[...r],o=this.findAndRemove(a,e);return this.insertItem(a,t,o,n),a}copyColumns(e){let t=[];for(let r=0;r<e.length;r++){let n={...e[r]};this.copyHeaderFooter(n,"header"),this.copyHeaderFooter(n,"footer"),t[r]=n}return t}copyHeaderFooter(e,t){let r=e[t];r=Array.isArray(r)?[...r]:[r],r.forEach((e,t)=>{r[t]="string"==typeof e?{text:e}:{...e}}),e[t]=r}setCollapsibleColumns(e,t,r){let n=e.header;for(let a=0;a<n.length;a++){let o=n[a];if(o.collapsible&&o.collapsed){if("first"!==o.collapsible){e.collapsed=!0,e.width=36,o.vertical=!0;let t=n.length-a;n=n.slice(0,a+1),n[a].rowspan=t}let i=o.colspan;if(i){let e=n[a+1],o=1;e&&e.colspan&&!e.collapsed&&(o=e.colspan);for(let n=o;n<i;n++){let e=r[t+n];e&&(e.hidden=!0)}}}}}normalizeColumns(e,t,r,n,a){let o=e[t];o.width||=o.flexgrow?17:a.columnWidth,o._colindex=t+1;let i=o[r],s=a[`${r}RowHeights`];for(let l=0;l<n;l++){let c=i[l];c.id=o.id,l===i.length-1&&(c.rowspan=c.rowspan?Math.min(c.rowspan,n-l):n-l);for(let n=1;n<c.rowspan;n++){i.splice(l+n,0,{_hidden:!0});for(let a=1;a<c.colspan;a++)e[t+a][r].splice(l+n,0,{})}if(c.rowspan&&(c.height=(c.rowspan===n?s:s.slice(l,c.rowspan+l)).reduce((e,t)=>e+t,0),l+c.rowspan!=n&&c.height--),c.colspan){let r=o.width,n=o.flexgrow||0,i=c.colspan;for(let o=1;o<i;o++){let i=e[t+o];i&&(i.hidden?--c.colspan:i.flexgrow?n+=i.flexgrow:r+=i.width||a.columnWidth),n?c.flexgrow=n:c.width=r}}else c.width=o.width,c.flexgrow=o.flexgrow;"header"===r&&c.filter&&"string"==typeof c.filter&&(c.filter={type:c.filter})}i.length>n&&(i.length=n),o[r]=i}normalizeRows(e){for(let t=0;t<e.length;t++)e[t].id||(e[t].id=qy());return e}normalizeTreeRows(e,t,r){return!t&&!r&&(this._branches={0:{data:e}}),e.forEach(e=>{e.id||=qy(),e.$level=t||0,e.$parent=r||0,this._branches[e.id]=e,e.data&&(e.data.length?(e.$count=e.data.length,this.normalizeTreeRows(e.data,e.$level+1,e.id)):(delete e.data,delete e.$count,delete e.open))}),e}sortTree(e,t){e.sort(t),e.forEach(e=>{e.data&&this.sortTree(e.data,t)})}filterTree(e,t,r){return e.forEach(e=>{t(e)&&r.push(e.id),e.data&&this.filterTree(e.data,t,r)}),r}flattenRows(e,t,r){let n=t;return e.forEach(e=>{(!r||r.includes(e.id))&&n.push(e),e.data?.length&&!1!==e.open&&this.flattenRows(e.data,n,r)}),n}createFilter(e){let{_columns:t}=this.getState(),r=[];for(let n in e){let a=t.find(e=>e.id==n),{config:o,type:i}=a.header.find(e=>e.filter).filter,s=e[n];r.push(e=>{let t=wy(e,a);return o?.handler?o.handler(t,s):$y(i)(t,s)})}return e=>{for(let t=0;t<r.length;t++)if(!r[t](e))return!1;return!0}}searchRows(e,t){e=e.trim().toLowerCase();let r={};if(!e)return r;let{flatData:n,columns:a}=this.getState(),o=t?a.filter(e=>t[e.id]):a;return n.forEach(t=>{let n={};o.forEach(r=>{let a=ky(t,r);String(a).toLowerCase().includes(e)&&(n[r.id]=!0)}),Object.keys(n).length&&(r[t.id]=n)}),r}normalizeSizes(e,t,r,n,a){let o=By(e,"header",r,t.headerHeight,a),i=By(e,"footer",n,t.footerHeight,a),s=o.reduce((e,t)=>e+t,0),l=i.reduce((e,t)=>e+t,0);return{...t,headerRowHeights:o,footerRowHeights:i,headerHeight:s,footerHeight:l}}},jy=/* @__PURE__ */(new Date).valueOf();function qy(){return"temp://"+jy++}
86
- /* @__PURE__ */(new Date).valueOf();var Uy=class{constructor(){this.store=/* @__PURE__ */new Map}configure(e,t){this.node=t;for(let r in e)if(e[r]){let t=r.toLowerCase().replace(/[ ]/g,""),n=e[r];this.store.set(t,n)}}},Gy=[],Wy=e=>{Ky||(Ky=!0,document.addEventListener("keydown",e=>{if(Gy.length&&(e.ctrlKey||e.altKey||e.metaKey||e.shiftKey||e.key.length>1||" "===e.key)){let t=[];e.ctrlKey&&t.push("ctrl"),e.altKey&&t.push("alt"),e.metaKey&&t.push("meta"),e.shiftKey&&t.push("shift");let r=e.code.replace("Key","").toLocaleLowerCase();" "===e.key&&(r="space"),t.push(r);let n=t.join("+");for(let a=Gy.length-1;a>=0;a--){let t=Gy[a],o=t.store.get(n)||t.store.get(r);o&&t.node.contains(e.target)&&o(e,{key:n,evKey:r})}}}));let t=new Uy;return Gy.push(t),e(t),()=>{let e=Gy.findIndex(e=>e===t);e>=0&&Gy.splice(e,1)}},Ky=!1;var Yy={tab:!0,"shift+tab":!0,arrowup:!0,arrowdown:!0,arrowright:!0,arrowleft:!0,enter:!0,escape:!0,f2:!0,home:!0,end:!0,"ctrl+home":!0,"ctrl+end":!0,"ctrl+z":!0,"ctrl+y":!0};var Xy=te(null);function Zy(e){let t=e.getBoundingClientRect(),r=document.body,n=t.top+r.scrollTop-r.clientTop||0,a=t.left+r.scrollLeft-r.clientLeft||0;return{y:Math.round(n),x:Math.round(a),width:e.offsetWidth,height:e.offsetHeight}}function Jy(e,t){let r=Zy(t);return{x:e.clientX-r.x,y:e.clientY-r.y}}function Qy(e,t){let r,n,a=t.current,o=null,i=!1,s=!1,l=document.createElement("DIV");function c(){clearTimeout(r),r=null}function d(t){let r=eg(t);r&&(o={container:l,sourceNode:t.target,from:rg(r),pos:Jy(t,e)},n=o.pos,u(t))}function u(t){if(!o)return;let r=o.pos=Jy(t,e);if(!i){if(!s&&!t?.target?.getAttribute("draggable-data")&&Math.abs(n.x-r.x)<5&&Math.abs(n.y-r.y)<5)return;if(!1===function(t){if(i=!0,a.start){if(!1===a.start(t,o))return!1;e.appendChild(l),document.body.style.cursor="move"}}(t))return w()}if(s){let e=window.scrollX||document.documentElement.scrollLeft||document.body.scrollLeft,r=window.scrollY||document.documentElement.scrollTop||document.body.scrollTop;o.targetNode=document.elementFromPoint(t.pageX-e,t.pageY-r)}else o.targetNode=t.target;a.move&&a.move(t,o),l.style.left=-(o.offset?o.offset.x:0)+"px",l.style.top=o.pos.y+(o.offset?o.offset.y:0)+"px"}function h(e){l.parentNode&&l.parentNode.removeChild(l),l.innerHTML="",i&&a.end&&a.end(e,o),o=n=null,w()}function p(e){a.getReorder&&!a.getReorder()||0===e.button&&(x(e),window.addEventListener("mousemove",m),window.addEventListener("mouseup",f),d(e))}function m(e){u(e)}function f(e){h(e)}function g(t){a.getReorder&&!a.getReorder()||(r=setTimeout(()=>{s=!0,d(t.touches[0])},700),x(t),t.target.addEventListener("touchmove",v),t.target.addEventListener("touchend",function e(){r&&c(),t.target.removeEventListener("touchmove",v),t.target.removeEventListener("touchend",e),h(t)}),e.addEventListener("contextmenu",y))}function v(e){i?(e.preventDefault(),u(e.touches[0])):r&&c()}function y(e){if(i||r)return e.preventDefault(),!1}function b(e){e.preventDefault()}function x(e){if(!a.getDraggableInfo)return;let{hasDraggable:t}=a.getDraggableInfo();(!t||e.target.getAttribute("draggable-data"))&&(document.body.style.userSelect="none",document.body.style.webkitUserSelect="none")}function w(t){i=s=!1,document.body.style.cursor="",document.body.style.userSelect="",document.body.style.webkitUserSelect="",window.removeEventListener("mousemove",m),window.removeEventListener("mouseup",f),t&&(e.removeEventListener("mousedown",p),e.removeEventListener("touchstart",g),e.removeEventListener("dragstart",b))}return l.className="wx-drag-zone",l.setAttribute("tabindex",-1),e.addEventListener("mousedown",p),e.addEventListener("touchstart",g),e.addEventListener("dragstart",b),{destroy(){w(!0)}}}function eb(e,t,r,n){let{node:a,left:o,top:i,bottom:s,sense:l,xScroll:c,yScroll:d}=n,u=Jy(e,a);r.scrollState||={dirX:0,dirY:0,scrollSpeedFactor:1};let h=0,p=0;u.x<o+l?h=-1:u.x>t.width-l&&(h=1),u.y<i+Math.round(l/2)?p=-1:u.y>t.height-s-Math.round(l/2)&&(p=1),(r.scrollState.dirX!==h||r.scrollState.dirY!==p)&&(tb(r),r.scrollState.dirX=h,r.scrollState.dirY=p),(c&&0!==r.scrollState.dirX||d&&0!==r.scrollState.dirY)&&function(e,t,r){e.autoScrollTimer||=setTimeout(()=>{e.activeAutoScroll=setInterval(rb,15,e,t,r)},250)}(r,n,{x:r.scrollState.dirX,y:r.scrollState.dirY})}function tb(e){e.scrollSpeedFactor=1,e.autoScrollTimer&&(e.autoScrollTimer=clearTimeout(e.autoScrollTimer),e.activeAutoScroll=clearInterval(e.activeAutoScroll))}function rb(e,t,r){let{x:n,y:a}=r;e.scrollSpeedFactor+=.004,0!==n&&function(e,t,r){let n=t.node.scrollLeft;nb(n+Math.round(t.sense/3)*e.scrollSpeedFactor*r,"scrollLeft",t)}(e,t,n),0!==a&&function(e,t,r){let n=t.node.scrollTop;nb(n+Math.round(t.sense/3)*e.scrollSpeedFactor*r,"scrollTop",t)}(e,t,a)}function nb(e,t,r){r.node[t]=e}function ab(e,t,r,n,a,o){let i={};return e&&(i.width=`${e}px`,i.minWidth=`${e}px`),t&&(i.flexGrow=t),o&&(i.height=`${o}px`),r&&(i.position="sticky",r.left&&(i.left=`${n}px`),r.right&&(i.right=`${a}px`)),i}function ob(e,t,r){let n="";if(e.fixed)for(let a in e.fixed){let r=-1===e.fixed[a];!r&&e.fixed.leftSize&&t.colspan&&(r=t.colspan+e._colindex-1===e.fixed.leftSize),n+=r?"wx-shadow ":"wx-fixed "}return n+=t.rowspan>1?"wx-rowspan ":"",n+=t.colspan>1?"wx-colspan ":"",n+=t.vertical?"wx-vertical ":"",n+=r?r(e)+" ":"",n}function ib(e){let{row:t,column:r,cellStyle:n=null,columnStyle:a=null,children:o,focusable:i}=e,s=se(Xy),l=Zv(s,"focusCell"),c=Zv(s,"search"),d=Zv(s,"reorder"),u=pe(()=>c?.rows[t.id]&&c.rows[t.id][r.id],[c,t.id,r.id]),h=pe(()=>ab(r.width,r.flexgrow,r.fixed,r.left,r.right),[r.width,r.flexgrow,r.fixed,r.left,r.right]);let p=pe(()=>function(e,n){let a="wx-cell";return a+=r.fixed?" "+(-1===r.fixed?"wx-shadow":"wx-fixed"):"",a+=e?" "+e(r):"",a+=n?" "+n(t,r):"",a+=r.treetoggle?" wx-tree-cell":"",a}(a,n),[a,n,r,t]),m=pe(()=>"function"==typeof r.draggable?!1!==r.draggable(t,r):r.draggable,[r,t]),f=me(null);le(()=>{f.current&&i&&l?.row===t.id&&l?.column===r.id&&f.current.focus()},[l,i,t.id,r.id]);let g=ie(()=>{i&&!l&&s.exec("focus-cell",{row:t.id,column:r.id,eventSource:"focus"})},[s,i,l,t.id,r.id]);let v=pe(()=>{let e=r.fixed&&-1===r.fixed.left||-1===r.fixed.right,t=r.fixed&&r.fixed.right;return[p,e?"wx-shadow":"",t?"wx-fixed-right":""].filter(Boolean).join(" ")},[p,r]),y=r.cell;/* @__PURE__ */
87
- return xe("div",{className:"wx-TSCaXsGV "+v,ref:f,onFocus:g,style:h,"data-row-id":ng(t.id),"data-col-id":ng(r.id),tabIndex:i?"0":"-1",role:"gridcell","aria-colindex":r._colindex,"aria-readonly":!r.editor||void 0,children:[d&&r.draggable?/* @__PURE__ */be("i",m?{"draggable-data":"true",className:"wx-TSCaXsGV wx-draggable wxi-drag"}:{className:"wx-TSCaXsGV wx-draggable-stub"}):null,r.treetoggle?/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be("span",{style:{marginLeft:28*t.$level+"px"}}),t.$count?/* @__PURE__ */be("i",{"data-action":"toggle-row",className:"wx-TSCaXsGV wx-table-tree-toggle wxi-menu-"+(!1===t.open?"right":"down")}):null]}):null,y?/* @__PURE__ */be(y,{api:s,row:t,column:r,onAction:({action:e,data:t})=>s.exec(e,t)}):o?o():u?/* @__PURE__ */be("span",{children:function(e){let t=RegExp(`(${c.value.trim()})`,"gi");return String(e).split(t).map(e=>({text:e,highlight:t.test(e)}))}(ky(t,r)).map(({highlight:e,text:t},r)=>e?/* @__PURE__ */be("mark",{className:"wx-TSCaXsGV wx-search",children:t},r):/* @__PURE__ */be("span",{children:t},r))}):ky(t,r)]})}function sb(e,t){let r,n;function a(n){r=n.clientX,e.style.opacity=1,document.body.style.cursor="ew-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",o),window.addEventListener("mouseup",i),t&&t.down&&t.down(e)}function o(e){n=e.clientX-r,t&&t.move&&t.move(n)}function i(){e.style.opacity="",document.body.style.cursor="",document.body.style.userSelect="",t&&t.up&&t.up(n),window.removeEventListener("mousemove",o),window.removeEventListener("mouseup",i)}return e.addEventListener("mousedown",a),{destroy(){e.removeEventListener("mousedown",a)}}}function lb(e){let{value:t,options:r=[],placeholder:n="",clear:a=!1,text:o=null,template:i=null,cell:s=null,dropdown:l={},autoOpen:c=!1,onChange:d,onAction:u}=e,[h,p]=Xv(t||[]),m=pe(()=>(h||[]).map(e=>r.find(t=>t.id===e)).filter(Boolean),[h,r]),f=me(null),g=me(null),[v,y]=fe(null),b=()=>{let e=h||[];if(!e.length)return 0;let t=r.find(t=>e.includes(t.id));return t?r.indexOf(t):0};return le(()=>{c&&(f.current?.focus(),typeof window<"u"&&window.getSelection&&window.getSelection().removeAllRanges())},[]),/* @__PURE__ */xe("div",{ref:f,className:"wx-multiselect wx-aadNNOwy",onClick:function(){g.current?.(b())},onKeyDown:function(e){v?.(e,b())},tabIndex:0,children:[
72
+ /* @__PURE__ */be("div",{className:"wx-2YgblL wx-label",children:y?u?u(y):y[l]:n?/* @__PURE__ */be("span",{className:"wx-2YgblL wx-placeholder",children:n}):" "}),/* @__PURE__ */be("i",c&&!a&&g?{className:"wx-2YgblL wx-icon wxi-close",onClick:x}:{className:"wx-2YgblL wx-icon wxi-angle-down"}),!a&&/* @__PURE__ */be(Zg,{items:t,onReady:function(e){m.current=e.navigate,f.current=e.keydown},onSelect:b,...p,children:({option:e})=>u?u(e):e[l]})]})}var mv=({options:e=[],value:t="",css:r="",children:n,onChange:a})=>{let[o,i]=fe(t);return le(()=>{i(t)},[t]),/* @__PURE__ */be("div",{className:`wx-0hMO7P wx-segmented ${r}`,children:e.map(e=>/* @__PURE__ */be("button",{className:`wx-0hMO7P wx-segment ${e.css} ${e.id===o?"wx-selected":""}`,title:e.title,onClick:()=>(e=>{i(e),a&&a({value:e})})(e.id),"data-tooltip-text":e.tooltip,children:n?Kf(n,{option:e}):/* @__PURE__ */xe(ye,{children:[e.icon&&/* @__PURE__ */be("i",{className:`wx-0hMO7P wx-icon ${e.icon} ${e.label?"":"wx-only"}`}),e.label&&/* @__PURE__ */be("span",{className:"wx-0hMO7P wx-label",children:e.label})]})},e.id))})};function fv({notice:e={}}){/* @__PURE__ */
73
+ return xe("div",{className:`wx-11sNg5 wx-notice wx-${e.type?e.type:""}`,role:"status","aria-live":"polite",children:[/* @__PURE__ */be("div",{className:"wx-11sNg5 wx-text",children:e.text}),/* @__PURE__ */be("div",{className:"wx-11sNg5 wx-button",children:/* @__PURE__ */be("i",{className:"wx-11sNg5 wxi-close",onClick:function(){e.remove&&e.remove()}})})]})}function gv({data:e=[]}){/* @__PURE__ */
74
+ return be("div",{className:"wx-3nwoO9 wx-notices",children:e.map(e=>/* @__PURE__ */be(fv,{notice:e},e.id))})}function vv({title:e="",buttons:t=["cancel","ok"],header:r,children:n,footer:a,css:o="",onConfirm:i,onCancel:s}){let l=(se(Fg)||Kg()).getGroup("core"),c=me(null);return le(()=>{c.current?.focus()},[]),/* @__PURE__ */be("div",{className:`wx-1FxkZa wx-modal ${o}`,ref:c,tabIndex:0,onKeyDown:function(e){switch(e.code){case"Enter":{let t=e.target.tagName;if("TEXTAREA"===t||"BUTTON"===t)return;i&&i({event:e});break}case"Escape":s&&s({event:e})}},children:/* @__PURE__ */xe("div",{className:"wx-1FxkZa wx-window",children:[r||(e?/* @__PURE__ */be("div",{className:"wx-1FxkZa wx-header",children:e}):null),
75
+ /* @__PURE__ */be("div",{children:n}),a||t&&/* @__PURE__ */be("div",{className:"wx-1FxkZa wx-buttons",children:t.map(e=>/* @__PURE__ */be("div",{className:"wx-1FxkZa wx-button",children:/* @__PURE__ */be(Hg,{type:"block "+("ok"===e?"primary":"secondary"),onClick:t=>function(e,t){let r={event:e,button:t};"cancel"===t?s&&s(r):i&&i(r)}(t,e),children:l(e)})},e))})]})})}var yv=ne(function({children:e},t){let[r,n]=fe(null),[a,o]=fe([]);return de(t,()=>({showModal:e=>{let t={...e};return n(t),new Promise((e,r)=>{t.resolve=t=>{n(null),e(t)},t.reject=e=>{n(null),r(e)}})},showNotice:e=>{(e={...e}).id=e.id||Cg(),e.remove=()=>o(t=>t.filter(t=>t.id!==e.id)),-1!=e.expire&&setTimeout(e.remove,e.expire||5100),o(t=>[...t,e])}}),[]),/* @__PURE__ */xe(ye,{children:[e,r&&/* @__PURE__ */be(vv,{title:r.title,buttons:r.buttons,onConfirm:r.resolve,onCancel:r.reject,children:r.message}),
76
+ /* @__PURE__ */be(gv,{data:a})]})});function bv(e){let{children:t}=e,r=me(),n=pe(()=>({showNotice:e=>r.current.showNotice(e),showModal:e=>r.current.showModal(e)}),[]);/* @__PURE__ */
77
+ return be(Lg.Provider,{value:n,children:/* @__PURE__ */be(yv,{ref:r,children:t})})}var xv=({value:e=!1,type:t="",icon:r="",disabled:n=!1,iconActive:a="",onClick:o,title:i="",tooltip:s,css:l="",text:c="",textActive:d="",children:u,active:h,onChange:p})=>{let[m,f]=Wf(e),g=pe(()=>(m?"pressed":"")+(t?" "+t:""),[m,t]),v=ie(e=>{let t=!m;o&&o(e),e.defaultPrevented||(f(t),p&&p({value:t}))},[m,o,p]);/* @__PURE__ */
78
+ return be(Hg,m&&h?{title:i,tooltip:s,text:m&&d||c,css:l,type:g,icon:m&&a||r,onClick:v,disabled:n,children:Kf(h,{value:m})}:u?{title:i,tooltip:s,text:m&&d||c,css:l,type:g,icon:m&&a||r,onClick:v,disabled:n,children:u}:{title:i,tooltip:s,text:m&&d||c,css:l,type:g,icon:m&&a||r,onClick:v,disabled:n})};eg(Qf);var wv={grid:{"Add before":"Add before","Add after":"Add after",Copy:"Copy",Cut:"Cut",Paste:"Paste",Delete:"Delete","New row":"New row","Move up":"Move up","Move down":"Move down",Undo:"Undo",Redo:"Redo",selected:"selected"}};
79
+ /* @__PURE__ */(new Date).valueOf();var Sv=class{constructor(e){this._nextHandler=null,this._dispatch=e,this.exec=this.exec.bind(this)}async exec(e,t){return this._dispatch(e,t),this._nextHandler&&await this._nextHandler.exec(e,t),t}setNext(e){return this._nextHandler=e}};
80
+ /* @__PURE__ */(new Date).valueOf();var kv=class{constructor(e){let t=/* @__PURE__ */new Map;t.set(0,{id:0,$level:0,data:[],parent:null}),this._pool=t,e&&e.length&&this.parse(e,0)}parse(e,t){let r=this._pool;for(let a=0;a<e.length;a++){let n=e[a];n.parent=n.parent||t,n.data=null,r.set(n.id,n)}for(let a=0;a<e.length;a++){let t=e[a],n=r.get(t.parent);n&&(n.data||=[],n.data.push(t))}let n=r.get(t);this.setLevel(n,n.$level+1,!1)}add(e,t){let r=this._pool.get(e.parent||0);e.$level=r.$level+1,this._pool.set(e.id,e),r.data?-1===t?r.data=[...r.data,e]:Nv(r,t,e):r.data=[e]}addAfter(e,t){if(!t)return this.add(e,-1);let r=this.byId(t),n=this.byId(r.parent),a=Tv(n,r.id)+1;e.parent=n.id,e.$level=n.$level+1,this.add(e,a)}remove(e){let t=this._pool.get(e);this._remove(t);let r=this._pool.get(t.parent);r.data=r.data.filter(t=>t.id!=e),this._clearBranch(r)}_remove(e){e.data&&e.data.forEach(e=>this._remove(e)),this._pool.delete(e.id)}update(e,t){let r=this._pool.get(e),n=this._pool.get(r.parent),a=Tv(n,r.id);r={...r,...t},n&&a>=0&&(n.data[a]=r,n.data=[...n.data]),this._pool.set(r.id,r)}move(e,t,r){let n=this._pool.get(e),a="child"===t,o=this._pool.get(r),i=o.$level+ +!!a;if(!n||!o)return;let s=this._pool.get(n.parent),l=a?o:this._pool.get(o.parent);l.data||=[];let c=Tv(s,n.id);!function(e,t){let r=[...e.data];r.splice(t,1),e.data=r}(s,c);let d=a?l.data.length:Tv(l,o.id)+ +("after"===t);if(Nv(l,d,n),s.id===l.id&&c===d)return null;n.parent=l.id,n.$level!==i&&(n.$level=i,this.setLevel(n,i+1,!0)),this.update(n.id,n),this._clearBranch(s)}_clearBranch(e){e.data&&!e.data.length&&(e.open&&delete e.open,this.update(e.id,{data:null}))}toArray(){let e=[],t=this._pool.get(0).data;return t&&Cv(t,e),e}byId(e){return this._pool.get(e)}getBranch(e){return this._pool.get(e).data}forEach(e){this._pool.forEach((t,r)=>{0!==r&&e(t)})}eachChild(e,t){let r=this.byId(t);!r||!r.data||r.data.forEach((t,r)=>{e(this.byId(t.id),r),this.eachChild(e,t.id)})}setLevel(e,t,r){e.data&&=e.data.map(e=>(r&&(e={...e},this._pool.set(e.id,e)),e.$level=t,e.data&&this.setLevel(e,t+1,r),e))}};function Cv(e,t){e.forEach(e=>{t.push(e),!0===e.open&&Cv(e.data,t)})}function Nv(e,t,r){let n=[...e.data];n.splice(t,0,r),e.data=n}function Tv(e,t){return e?.data.findIndex(e=>e.id===t)}var Av=class{constructor(e){e&&(this._writable=e.writable,this._async=e.async),this._values={},this._state={}}setState(e,t=0){let r={};return this._wrapProperties(e,this._state,this._values,"",r,t),r}getState(){return this._values}getReactive(){return this._state}_wrapProperties(e,t,r,n,a,o){for(let i in e){let s=t[i],l=r[i],c=e[i];if(s&&(l===c&&"object"!=typeof c||c instanceof Date&&l instanceof Date&&l.getTime()===c.getTime()))continue;let d=n+(n?".":"")+i;s?(s.__parse(c,d,a,o)&&(r[i]=c),2&o?a[d]=s.__trigger:s.__trigger()):(t[i]=c&&c.__reactive?this._wrapNested(c,c,d,a):this._wrapWritable(c),r[i]=c),a[d]=a[d]||null}}_wrapNested(e,t,r,n){let a=this._wrapWritable(e);return this._wrapProperties(e,a,t,r,n,0),a.__parse=(e,r,n,o)=>(this._wrapProperties(e,a,t,r,n,o),!1),a}_wrapWritable(e){let t=[],r=function(){for(let r=0;r<t.length;r++)t[r](e)};return{subscribe:r=>(t.push(r),this._async?setTimeout(r,1,e):r(e),()=>{let e=t.indexOf(r);e>=0&&t.splice(e,1)}),__trigger:()=>{t.length&&(this._async?setTimeout(r,1):r())},__parse:function(t){return e=t,!0}}}};function Mv(e,t){return Object.defineProperty(e,"__reactive",{value:!0,enumerable:!1,writable:!1}),e}var Dv=class{constructor(e,t,r,n){this._setter="function"==typeof e?e:e.setState.bind(e),this._routes=t,this._parsers=r,this._prev={},this._triggers=/* @__PURE__ */new Map,this._sources=/* @__PURE__ */new Map,this._routes.forEach(e=>{e.in.forEach(t=>{let r=this._triggers.get(t)||[];r.push(e),this._triggers.set(t,r)}),e.out.forEach(t=>{let r=this._sources.get(t)||{};e.in.forEach(e=>r[e]=!0),this._sources.set(t,r)})}),this._routes.forEach(e=>{e.length=Math.max(...e.in.map(e=>Ev(e,this._sources,1)))}),this._bus=n}init(e){let t={};for(let r in e)if(this._prev[r]!==e[r]){let n=this._parsers[r];t[r]=n?n(e[r]):e[r]}this._prev=this._prev?{...this._prev,...e}:{...e},this.setState(t),this._bus&&this._bus.exec("init-state",t)}setStateAsync(e){let t=this._setter(e,2);return this._async?Object.assign(this._async.signals,t):this._async={signals:t,timer:setTimeout(this._applyState.bind(this),1)},t}_applyState(){let e=this._async;if(e){this._async=null,this._triggerUpdates(e.signals,[]);for(let t in e.signals){let r=e.signals[t];r&&r()}}}setState(e,t=[]){let r=this._setter(e);return this._triggerUpdates(r,t),r}_triggerUpdates(e,t){let r=Object.keys(e),n=!t.length;t||=[];for(let a=0;a<r.length;a++){let e=r[a],n=this._triggers.get(e);n&&n.forEach(e=>{-1==t.indexOf(e)&&t.push(e)})}n&&this._execNext(t)}_execNext(e){for(;e.length;){e.sort((e,t)=>e.length<t.length?1:-1);let t=e[e.length-1];e.splice(e.length-1),t.exec(e)}}};function Ev(e,t,r){let n=t.get(e);if(!n)return r;let a=Object.keys(n).map(e=>Ev(e,t,r+1));return Math.max(...a)}var Iv=class{constructor(){this._nextHandler=null,this._handlers={},this._tag=/* @__PURE__ */new WeakMap,this.exec=this.exec.bind(this)}on(e,t,r){let n=this._handlers[e];n?r&&r.intercept?n.unshift(t):n.push(t):n=this._handlers[e]=[t],r&&r.tag&&this._tag.set(t,r.tag)}intercept(e,t,r){this.on(e,t,{...r,intercept:!0})}detach(e){for(let t in this._handlers){let r=this._handlers[t];for(let t=r.length-1;t>=0;t--)this._tag.get(r[t])===e&&r.splice(t,1)}}async exec(e,t){let r=this._handlers[e];if(r)for(let n=0;n<r.length;n++){let e=r[n](t);if(!1===e||e&&e.then&&!1===await e)return}return this._nextHandler&&await this._nextHandler.exec(e,t),t}setNext(e){return this._nextHandler=e}},Rv=1024;function zv(e){return e<Rv?`${e} B`:e<Rv**2?`${(e/Rv).toFixed(1)} KB`:e<Rv**3?`${(e/Rv**2).toFixed(1)} MB`:`${(e/Rv**3).toFixed(1)} GB`}function _v(e,t){t||={key:"name",order:"asc"};let r=e.filter(e=>"folder"===e.type),n=e.filter(e=>"folder"!==e.type);return[...r.sort(Lv(t)),...n.sort(Lv(t))]}function Pv(e,t){return"string"==typeof e?e.localeCompare(t,void 0,{numeric:!0}):"object"==typeof e?e.getTime()-t.getTime():(e??0)-(t??0)}function Ov(e,t){return"string"==typeof e?-e.localeCompare(t,void 0,{numeric:!0}):"object"==typeof t?t.getTime()-e.getTime():(t??0)-(e??0)}function Lv({key:e,order:t}){let r="asc"===t?Pv:Ov;return(t,n)=>r(t[e],n[e])}function Fv(e,t){let r="/"===e?1:e.split("/").length;return r>=t.length?null:t[r].id}var Bv=class extends kv{constructor(e){super([{id:"/",name:"My files",open:!0,$level:1,parent:0,ext:"",type:"folder"}]),this.parse(e,"/")}parse(e,t,r){!e||!e.length||(e.forEach(e=>this.parseId(e,r?t:void 0)),super.parse(e,t))}parseId(e,t){if(0===e.parent)return;let r=e.id,n=r.lastIndexOf("/");if(e.parent=t??(0===n?"/":r.slice(0,n)),e.name=r.slice(n+1),e.type=e.type||"file","folder"!==e.type){let t=e.name.lastIndexOf("."),r=-1===t?"":e.name.slice(t+1);e.ext="new"===r?"":r?.toLocaleLowerCase()}}getParents(e){let t=[],r=this.byId(e);if(!r)return t;for(;0!==r.id;)t.push(r),r=this.byId(r.parent);return t.reverse()}findFiles(e,t="/"){let r=[],n=e.toLocaleLowerCase();return this.eachChild(e=>{-1!==e.name.toLowerCase().indexOf(n)&&r.push(e)},t),r}add(e,t){let r=this.byId(e.parent||"/"),n=e.data?[...e.data]:null;e.data=null,super.add(e,t??r.data?r.data.length:0),n&&n.forEach(e=>this.add(e))}renameFiles(e,t,r){let n=this.byId(e),a=this.normalizeFile(n,t),o=[];return a.data?.forEach(e=>o.push(this.renameFiles(e.id,a.id,r))),o.length&&(a.data=o),r[e]=a.id,a}copyFiles(e,t,r){let n={};return e.forEach(e=>{let a=this.renameFiles(e,t,n);this.add(a),r&&this.remove(e),n[e]=a.id}),n}moveFiles(e,t){if(this.byId(e[0]).parent!==t)return this.copyFiles(e,t,!0)}serialize(e="/"){let t=[],r=this.byId(e);return r?(r.data?.forEach(e=>{let{id:r,date:n,type:a,size:o,lazy:i}=e,s={id:r,date:n,type:a??"file"};i&&(s.lazy=i),o&&(s.size=o),t.push(s);let l=this.serialize(r);l.length&&t.push(...l)}),t):null}normalizeFile(e,t){let r=e.name,n=r.lastIndexOf("."),a=-1===n?"":r.slice(n+1),o=a?`.${a}`:"",i=-1===n?r:r.slice(0,n),s=t+("/"===t?"":"/")+i;for(;this.byId(s+o);){let e=".new";s+=e,i+=e}return{...e,id:s+o,name:i+o,parent:t,ext:a.toLocaleLowerCase()}}},Vv=class extends Av{in;_router;constructor(e){super({writable:e,async:!1});let t=[];for(let a=0;a<2;a++)t.push({in:["data",`panels.${a}.path`],out:[`panels.${a}._crumbs`],exec:e=>{let{data:t,panels:r}=this.getState(),n=[];n[a]={_crumbs:t.getParents(r[a].path)},this.setState({panels:n},e)}}),t.push({in:["data",`panels.${a}.path`,`panels.${a}._sorts`,"search"],out:[`panels.${a}._files`],exec:e=>{let t,{data:r,panels:n,search:o}=this.getState();t=o?r.findFiles(o,n[a].path):r.byId(n[a].path)?.data||[];let{path:i,_sorts:s}=n[a];t=_v(t,s[i]);let l=[];l[a]={_files:t},this.setState({panels:l},e)}}),t.push({in:["data",`panels.${a}.selected`,`panels.${a}._sorts`],out:[`panels.${a}._selected`],exec:e=>{let{data:t,panels:r}=this.getState(),n=[];r[a].selected.forEach(e=>{let r=t.byId(e);r&&n.push(r)});let{path:o,_sorts:i}=r[a],s=_v(n,i[o]),l=[];l[a]={_selected:s},this.setState({panels:l},e)}});this._router=new Dv(super.setState.bind(this),t,{data:e=>new Bv(e)});let r=this.in=new Iv;r.on("select-file",({id:e,toggle:t,range:r,panel:n,type:a})=>{let{panels:o,activePanel:i}=this.getState();typeof n>"u"&&(n=i),e||(t=r=!1);let s=[...o[n].selected];if(t){let t=s.indexOf(e);-1===t?s.push(e):s.splice(t,1)}else if(r&&o[n]._lastSelected){let t=o[n]._files,r=t.findIndex(e=>e.id==o[n]._lastSelected),a=t.findIndex(t=>t.id==e);a<r&&([r,a]=[a,r]);let i=t.slice(r,a+1).map(e=>e.id);s=[.../* @__PURE__ */new Set([...s,...i])]}else s=e?[e]:[];let l=[];l[n]={selected:s,_lastSelected:e,_selectNavigation:"navigation"===a},this.setState({panels:l})}),r.on("set-path",({id:e,panel:t,selected:n})=>{let{data:a,activePanel:o}=this.getState(),i=a.byId(e);if(i){let a=[];typeof t>"u"&&(t=o),a[t]={path:e},this.setState({panels:a}),r.exec("select-file",{panel:t}),n&&n.forEach(e=>r.exec("select-file",{id:e,panel:t,toggle:!0})),i.lazy&&r.exec("request-data",{id:e})}}),r.on("provide-data",({id:e,data:t})=>{let{mode:r,data:n}=this.getState(),a=n.byId(e);a&&(a.lazy||(a.data=[]),a.lazy=!1,n.parse(t,e,"search"===r),this.setState({data:n}))}),r.on("open-tree-folder",({id:e,mode:t})=>{let{data:r}=this.getState();r.update(e,{open:t}),this.setState({data:r})}),r.on("show-preview",({mode:e})=>{this.setState({preview:e})}),r.on("rename-file",e=>{let{id:t,name:r}=e,{data:n,panels:a}=this.getState(),o=n.byId(t);if(o.name!==r){o.name=r;let i=n.normalizeFile(o,o.parent);e.newId=i.id,i.data=null,n.add(i);let s={[t]:i.id};o.data?.forEach(e=>s={...n.moveFiles([e.id],i.id),...s});let l=a.map(e=>({selected:e.selected,_crumbs:e._crumbs,_lastSelected:e._lastSelected,_sorts:e._sorts}));n.remove(t),this._updatePanels(l,s),this.setState({data:n,panels:l})}}),r.on("create-file",e=>{let{file:t,parent:n}=e,{data:a}=this.getState(),o=a.normalizeFile(t,n);o.type=t.type||"file",e.newId=o.id,a.add(o),this.setState({data:a}),r.exec("select-file",{id:o.id})}),r.on("delete-files",({ids:e})=>{let{data:t,panels:r}=this.getState(),n=r.map(e=>({selected:e.selected,_crumbs:e._crumbs,_lastSelected:e._lastSelected,_sorts:e._sorts}));e.forEach(e=>t.remove(e)),this._updatePanels(n,{}),this.setState({data:t,panels:n})}),r.on("copy-files",e=>{let{ids:t,target:n}=e;if(this._isPlacedIntoSelf(t,n))return void(e.skipProvider=!0);let{data:a,panels:o,activePanel:i}=this.getState(),s=a.copyFiles(t,n);e.newIds=t.map(e=>s[e]),this.setState({data:a}),o[i].path==n&&(r.exec("select-file",{}),t.forEach(e=>{r.exec("select-file",{id:s[e],toggle:!0})}))}),r.on("move-files",e=>{let{ids:t,target:n}=e;if(this._isPlacedIntoSelf(t,n))return void(e.skipProvider=!0);let{data:a,panels:o,activePanel:i}=this.getState(),s=a.moveFiles(t,n);if(s){e.newIds=t.map(e=>s[e]);let l=o.map(e=>({selected:e.selected,_crumbs:e._crumbs,_lastSelected:e._lastSelected,_sorts:e._sorts}));this._updatePanels(l,s,!0),this.setState({data:a,panels:l}),o[i].path==n&&(r.exec("select-file",{}),t.forEach(e=>{r.exec("select-file",{id:s[e],toggle:!0})}))}});let n=null;r.on("filter-files",({text:e})=>{if(!e)return void(n&&this.setState({...n}));r.exec("select-file",{});let{panels:t,mode:a}=this.getState();n||={panels:t,mode:a,search:""},this.setState({mode:"search",search:e})}),r.on("set-mode",({mode:e})=>{let{activePanel:t}=this.getState(),r=[];r[t]={_selectNavigation:!1};let a={mode:e,search:"",panels:r};n=null,this.setState(a)}),r.on("set-active-panel",({panel:e})=>{this.setState({activePanel:e})}),r.on("sort-files",({key:e,order:t,panel:r,path:n})=>{let{activePanel:a,panels:o}=this.getState();r??=a,n??=o[r].path;let i=[];i[r]={_sorts:{...o[r]._sorts,[n]:{key:e,order:t}}},this.setState({panels:i})}),this.initOnce()}initOnce(){let e=[];for(let r=0;r<2;r++)e[r]=Mv({_crumbs:[],_files:[],_selected:[],_sorts:{},path:"/",selected:[],...e[r]});let t={panels:Mv(e),data:[],search:""};this._router.init(t)}init(e){let t={...e};this._router.init(t)}setState(e,t){return this._router.setState(e,t)}getFile(e){let{data:t}=this.getState();return t.byId(e)||null}serialize(e){let{data:t}=this.getState();return t.serialize(e)}_updatePanels(e,t,r){let{data:n}=this.getState();e.forEach(e=>{let a=[];e.selected.forEach(e=>{n.byId(e)?a.push(e):!r&&t[e]&&a.push(t[e])}),e.selected=a,n.byId(e._lastSelected)||(e._lastSelected=r?null:t[e._lastSelected]||null);let o={};Object.keys(e._sorts).forEach(a=>{n.byId(a)?o[a]=e._sorts[a]:t[a]&&!r&&(o[t[a]]=e._sorts[a])}),e._sorts=o;let i=e._crumbs[e._crumbs.length-1];"/"!==i?.id&&(t[i.id]?e.path=t[i.id]:n.byId(i.id)||(e.path="/"))})}_isPlacedIntoSelf(e,t){return e.some(e=>e===t||this.getState().data.getParents(t).some(t=>t.id===e))}};function $v(e){switch(e){case"body":return[{icon:"wxi-content-paste",text:"Paste",hotkey:"Ctrl+V",id:"paste"}];case"add":return[{icon:"mdi mdi-folder-plus-outline",text:"Add new file",id:"add-file"},{icon:"mdi mdi-file-plus-outline",text:"Add new folder",id:"add-folder"},{icon:"mdi mdi-file-upload-outline",text:"Upload file",id:"upload",comp:"upload"}];case"multiselect":return[{icon:"wxi-content-copy",text:"Copy",hotkey:"Ctrl+C",id:"copy"},{icon:"wxi-content-cut",text:"Cut",hotkey:"Ctrl+X",id:"move"},{comp:"separator"},{icon:"wxi-close",text:"Delete",hotkey:"Delete",id:"delete"}];default:return["folder"===e?null:{icon:"wxi-download",text:"Download",hotkey:"Ctrl+D",id:"download"},{icon:"wxi-content-copy",text:"Copy",hotkey:"Ctrl+C",id:"copy"},{icon:"wxi-content-cut",text:"Cut",hotkey:"Ctrl+X",id:"move"},{icon:"wxi-content-paste",text:"Paste",hotkey:"Ctrl+V",id:"paste"},{comp:"separator"},{icon:"wxi-edit",text:"Rename",hotkey:"Ctrl+R",id:"rename"},{icon:"wxi-close",text:"Delete",hotkey:"Delete",id:"delete"}].filter(e=>null!==e)}}function Hv(e,t="data-id"){let r=function(e,t="data-id"){let r=e;for(!r.tagName&&e.target&&(r=e.target);r;){if(r.getAttribute&&r.getAttribute(t))return r;r=r.parentNode}return null}(e,t);return r?r.getAttribute(t):null}function jv(e,t="data-id"){let r=e.getAttribute(t);return r?function(e){if(e.startsWith(":"))return e.substring(1);let t=1*e;return isNaN(t)?e:t}(r):null}
81
+ /* @__PURE__ */(new Date).valueOf();var qv={detect:()=>!0,addEvent:function(e,t,r){return e.addEventListener(t,r),()=>e.removeEventListener(t,r)},addGlobalEvent:function(e,t){return document.addEventListener(e,t),()=>document.removeEventListener(e,t)},getTopNode:function(){return window.document.body}};function Uv(e){let[t,r]=fe(e),n=me(e);return le(()=>{if(n.current!==e){if(Array.isArray(n.current)&&Array.isArray(e)&&0===n.current.length&&0===e.length)return;n.current=e,r(e)}},[e]),[t,r]}function Gv(e,t){let r=e.getState();return function(e,t){let[r,n]=fe(()=>t);return le(()=>{if(e)return e.subscribe(e=>{n(()=>e)})},[e]),r}(e.getReactiveState()[t],r[t])}function Wv(e,t){let r=e.getState();return function(e,t){let r=me(t);r.current=t;let[n,a]=fe(1);return le(()=>e.subscribe(e=>{r.current=e,a(e=>e+1)}),[e]),[r.current,n]}(e.getReactiveState()[t],r[t])}function Kv(e){let t={};return e.split(";").forEach(e=>{let[r,n]=e.split(":");if(n){let e=r.trim();e.indexOf("-")&&(e=e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())),t[e]=n.trim()}}),t}function Yv(e){let t=e,r=[];return{subscribe:e=>{r.push(e),e(t)},unsubscribe:e=>{r=r.filter(t=>t!==e)},set:e=>{t=e,r.forEach(e=>e(t))},update:e=>{t=e(t),r.forEach(e=>e(t))}}}function Xv(e,t,r){return qv.addEvent(e,r,function(e){let n=function(e,t="data-id"){let r=e;for(!r.tagName&&e.target&&(r=e.target);r;){if(r.getAttribute&&r.getAttribute(t))return r;r=r.parentNode}return null}(e);if(!n)return;let a=jv(n);if("function"==typeof t)return t(a,e);let o,i=e.target;for(;i!=n;){if(o=i.dataset?i.dataset.action:null,o&&t[o])return void t[o](a,e);i=i.parentNode}t[r]&&t[r](a,e)})}function Zv(e,t){return e.map((e,r)=>{let n=t(e,r);return e.data&&e.data.length&&(n.data=Zv(e.data,t)),n}).filter(Boolean)}function Jv(e,t){let r=[];return e.forEach(e=>{if(e.data){let n=Jv(e.data,t);n.length&&r.push({...e,data:n})}else t(e)&&r.push(e)}),r}function Qv(e){return Zv(e,(t,r)=>{let n={...t,id:t.id||Cg()};return n.type&&(n.comp=n.type),"separator"===n.comp&&"separator"===e[r-1]?.comp?null:n})}
82
+ /* @__PURE__ */(new Date).valueOf();var ey={};function ty({onClick:e,onShow:t,option:r}){let n=me(null),a=ie(()=>{t(!!r.data&&r.id,n.current)},[t,r]),o=ie(a=>{if(r.data)return a.stopPropagation(),void t(r.id,n.current);e(a)},[e,t,r]),i=pe(()=>r&&r.comp?function(e){return ey[e]||e}(r.comp):null,[r]);/* @__PURE__ */
83
+ return xe("div",{ref:n,className:`wx-cDCz9rZQ wx-option ${r.css||""} ${r.disabled?"wx-disabled":""}`,"data-id":Jf(r.id),onMouseEnter:a,onClick:o,children:[r.icon?/* @__PURE__ */be("i",{className:`wx-cDCz9rZQ wx-icon ${r.icon}`}):null,r.comp?i?/* @__PURE__ */be(i,{item:r,option:r}):null:/* @__PURE__ */xe("span",{className:"wx-cDCz9rZQ wx-value",children:[" ",r.text," "]}),r.subtext?/* @__PURE__ */be("span",{className:"wx-cDCz9rZQ wx-subtext",children:r.subtext}):null,r.data?/* @__PURE__ */be("i",{className:"wx-cDCz9rZQ wx-sub-icon wxi-angle-right"}):null]})}function ry({options:e,left:t=0,top:r=0,at:n="bottom",parent:a=null,mount:o=null,context:i=null,css:s="",onClick:l,onCancel:c}){let[d,u]=fe(-1e4),[h,p]=fe(-1e4),[m,f]=fe(20),[g,v]=fe(),y=me(null),[b,x]=fe(!1),[w,S]=fe(null),k=ie(()=>{let e=wg(y.current,a,n,t,r);e&&(u(e.x),p(e.y),v(e.width));let o=e?.z??20,i=a?function(e){let t=[],r=e,n=Qf.getTopNode(e);for(;r&&r!==n&&!r.getAttribute("data-wx-portal-root");)"absolute"===getComputedStyle(r).position&&t.push(r),r=r.parentNode;return t}(a):[],s=0;for(let t of i){let e=parseInt(getComputedStyle(t).zIndex,10);e>s&&(s=e)}s>=o&&(o=s+1),f(o)},[a,n,t,r]);le(()=>{o&&o(k)},[]);let C=ie(()=>{x(!1)},[]),N=ie((e,t)=>{x(e),S(t)},[]),T=pe(()=>Qv(e),[e]);le(()=>{k()},[a,k]);let A=me(l),M=me(c),D=me(a);return le(()=>{A.current=l},[l]),le(()=>{M.current=c},[c]),le(()=>{D.current=a},[a]),le(()=>{if(y.current)return dg(y.current,{callback:function(e){M.current?M.current(e):A.current&&A.current({action:null,option:null})},modal:!0,parent:()=>D.current}).destroy},[]),/* @__PURE__ */be("div",{ref:y,"data-wx-menu":"true",className:`wx-XMmAGqVx wx-menu ${s}`,style:{position:"absolute",top:h+"px",left:d+"px",width:g,zIndex:m},onMouseLeave:C,children:T.map(e=>/* @__PURE__ */xe(ee,{children:["separator"===e.comp?/* @__PURE__ */be("div",{className:"wx-XMmAGqVx wx-separator"}):/* @__PURE__ */be(ty,{option:e,onShow:N,onClick:t=>{if(!e.data&&!t.defaultPrevented){let r={context:i,action:e,option:e,event:t};e.handler&&e.handler(r),l&&l(r),t.stopPropagation()}}}),e.data&&b===e.id?/* @__PURE__ */be(ry,{css:s,options:e.data,at:"right-overlap",parent:w,context:i,onClick:l,onCancel:c}):null]},e.id))})}var ny=ne(function(e,t){let{options:r,at:n="bottom",resolver:a=null,dataKey:o="contextId",filter:i=null,css:s="",children:l,onClick:c}=e,[d,u]=fe(null),[h,p]=fe(null),[m,f]=fe(0),[g,v]=fe(0),y=me(null),b=pe(()=>`data-${o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,[o]),x=pe(()=>null!==d&&i?Jv(r,e=>i(e,d)):r,[d,i,r]);let w=ie((e,t)=>{if(!e)return void p(null);if(e.defaultPrevented)return;let r=e.target;if(r&&r.dataset&&r.dataset.menuIgnore)return;if(h&&h===r)return p(null),void e.preventDefault();f(e.clientX+1),v(e.clientY+1);let n=typeof t<"u"?t:Xf(r,b);a&&(n=a(n,e),!n)||(u(n),p(r),y.current=e.nativeEvent||e,e.preventDefault())},[h,b,a]);return de(t,()=>({show:w}),[w]),/* @__PURE__ */xe(ye,{children:[l?/* @__PURE__ */be("span",{onClick:w,"data-menu-ignore":"true",children:"function"==typeof l?l():l}):null,h?/* @__PURE__ */be(qg,{children:/* @__PURE__ */be(ry,{css:s,at:n,top:g,left:m,parent:h,context:d,onClick:function(e){p(null),c&&c(e)},onCancel:function(e){y.current!==e?(p(null),c&&c({action:null,option:null})):y.current=null},options:x},h)}):null]})}),ay=ne(function(e,t){let{options:r,at:n="bottom",css:a="",children:o,onClick:i}=e,[s,l]=fe(null),c=me(null);let d=ie(e=>{l(e.target),c.current=e.nativeEvent||e,e.preventDefault()},[]);return de(t,()=>({show:d}),[d]),/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be("span",{onClick:function(e){let t=e.target;for(;!t.dataset.menuIgnore;)l(t),t=t.parentNode},"data-menu-ignore":"true",children:o}),s?/* @__PURE__ */be(qg,{children:/* @__PURE__ */be(ry,{css:a,at:n,parent:s,options:r,onClick:function(e){l(null),i&&i(e)},onCancel:function(e){c.current!==e?(l(null),i&&i({action:null,option:null})):c.current=null}})}):null]})}),oy=ne(function(e,t){let{options:r,at:n="bottom",resolver:a=null,dataKey:o="contextId",filter:i=null,css:s="",children:l,onClick:c}=e,d=me(null),u=ie((e,t)=>{d.current.show(e,t)},[]);return de(t,()=>({show:u}),[u]),/* @__PURE__ */xe(ye,{children:[l?/* @__PURE__ */be("span",{onContextMenu:u,"data-menu-ignore":"true",children:l}):null,/* @__PURE__ */be(ny,{css:s,at:n,options:r,resolver:a,dataKey:o,filter:i,ref:d,onClick:c})]})}),iy={uploader:{B:"B",KB:"KB",MB:"MB",GB:"GB",TB:"TB",PB:"PB",EB:"EB","Drop files here or":"Drop files here or","select files":"select files"}},sy=class{constructor(e,t,r,n,a){this.setFiles=e,this.setReady=t,this.setSignal=r,this.setDrag=n,a&&a.length&&this.setFiles(a)}open(e){this.setSignal(["click",e||{}])}getState(){let e="server",t=this.files;for(let r=0;r<t.length;r++){if("client"===t[r].status)return"client";"error"===t[r].status&&(e="error")}return e}droparea(e,t){t||={};let r=()=>{t.dragEnter&&t.dragEnter(),this.setDrag(!0)},n=()=>{t.dragLeave&&t.dragLeave(),this.setDrag(!1)},a=e=>{e.preventDefault()},o=e=>{e.preventDefault(),this.setDrag(!1),this.setSignal(["drop",t,e]),t.dragLeave&&t.dragLeave(),t.drop&&t.drop()};return e.addEventListener("dragenter",r),e.addEventListener("dragleave",n),e.addEventListener("dragover",a,!0),e.addEventListener("drop",o,!0),()=>{e.removeEventListener("dragenter",r),e.removeEventListener("dragleave",n),e.removeEventListener("dragover",a,!0),e.removeEventListener("drop",o,!0)}}updateFile(e,t){let r=this.files.findIndex(t=>t.id===e);if(-1===r)return;let n=[...this.files];return n[r]={...n[r],...t},this.files=n,this.setFiles(this.files),this.files[r]}deleteFile(e){this.files=this.files.filter(t=>t.id!==e),this.setFiles(this.files)}addFile(e,t){this.files=t?[...this.files,e]:[e],this.setFiles(this.files)}deleteAll(){this.files=[],this.setFiles(this.files)}};function ly(e){let[t,r]=fe(e||[]),[n,a]=fe(Promise.resolve(null)),[o,i]=fe(null),[s,l]=fe(!1),c=me();return c.current||=new sy(r,a,i,l,e),c.current.files=t,c.current.ready=n,c.current.signal=o,c.current.drag=s,c.current}var cy=({data:e,accept:t="",multiple:r=!0,folder:n=!1,uploadURL:a="",apiOnly:o=!1,disabled:i=!1,children:s,onChange:l,onUpload:c})=>{let d=me(null),u=me(null),[h,p]=fe({}),m=ly(),f=e||m,g=function(e,t){if(e){let r=e.getGroup(t);if(r)return r}return _g(iy).getGroup(t)}(se(Vg.i18n),"uploader");le(()=>{d.current&&n&&(d.current.webkitdirectory=!0)},[n]),le(()=>{if(!o&&u.current&&!i)return f.droparea(u.current)},[o,i,u]);let v=(e,t)=>{let r=f.updateFile(e,t),n={...r,status:f.getState()};r&&r.uploaded&&r.uploaded(n),c&&c(n),r.temp&&f.deleteFile(r.id)},y=e=>{if(!e)return;let t="function"==typeof a?a(e):(e=>{let t=new FormData;return t.append("upload",e.file),fetch(a,{method:"POST",body:t}).then(e=>e.json()).then(t=>({id:e.id,...t}),()=>({id:e.id,status:"error"})).catch(t=>({id:e.id,status:"error"}))})(e);f.setReady(t.then(t=>{t.status=t.status||"server",v(e.id,t)}).catch(t=>{v(e.id,{status:"error",error:t})}))},b=(e,t)=>{let n={...t||h,id:Math.random().toString(36).substr(2,9),status:"client",name:e.name,file:e};n.selected&&n.selected(n),l&&l(n),f.addFile(n,r),y(n),d.current&&(d.current.value="")},x=(e,t,r)=>{e.isFile?e.file(e=>{b(e,r)}):e.isDirectory&&e.createReader().readEntries(e=>{e.forEach(e=>{x(e,t+e.name+"/",r)})})},w=e=>{Array.from(e.target.files).forEach(e=>b(e))},S=()=>{d.current&&d.current.click()};return le(()=>{if(f.signal){let[e,t,r]=f.signal;p(t),"click"===e?S():"drop"===e&&((e,t)=>{Array.from(e.dataTransfer.items).forEach(e=>{let r=e.webkitGetAsEntry();r&&x(r,"",t)})})(r,t),f.setSignal(null)}},[f.signal]),o?/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be("input",{type:"file",className:"wx-at1A8tb8 wx-input",ref:d,onChange:w,accept:t,multiple:r,disabled:i}),s]}):/* @__PURE__ */xe("div",{className:`wx-at1A8tb8 wx-label ${f.drag?"wx-active":""} ${i?"wx-disabled":""}`,ref:u,children:[/* @__PURE__ */be("input",{type:"file",className:"wx-at1A8tb8 wx-input",ref:d,onChange:w,accept:t,multiple:r,disabled:i}),s||/* @__PURE__ */be("div",{className:"wx-at1A8tb8 wx-dropzone",children:/* @__PURE__ */xe("span",{children:[g("Drop files here or")," ",
84
+ /* @__PURE__ */be("span",{className:"wx-at1A8tb8 wx-action",onClick:S,children:g("select files")})]})})]})};function dy(e,t){if("number"==typeof e||"string"==typeof e||"boolean"==typeof e||null===e)return e===t;if(typeof e!=typeof t||(null===e||null===t)&&e!==t||e instanceof Date&&t instanceof Date&&e.getTime()!==t.getTime())return!1;if("object"==typeof e){if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=e.length-1;r>=0;r--)if(!dy(e[r],t[r]))return!1;return!0}return function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in t)if(!dy(e[r],t[r]))return!1;return!0}(e,t)}return e===t}function uy(e){if("object"!=typeof e||!e)return e;if(e instanceof Date)return new Date(e);if(e instanceof Array)return e.map(uy);let t={};for(let r in e)t[r]=uy(e[r]);return t}
85
+ /* @__PURE__ */(new Date).valueOf();var hy=class{constructor(e){e&&(this._writable=e.writable,this._async=e.async),this._values={},this._state={}}setState(e,t=0){let r={};return this._wrapProperties(e,this._state,this._values,"",r,t),r}getState(){return this._values}getReactive(){return this._state}_wrapProperties(e,t,r,n,a,o){for(let i in e){let s=t[i],l=r[i],c=e[i];if(s&&(l===c&&"object"!=typeof c||c instanceof Date&&l instanceof Date&&l.getTime()===c.getTime()))continue;let d=n+(n?".":"")+i;s?(s.__parse(c,d,a,o)&&(r[i]=c),2&o?a[d]=s.__trigger:s.__trigger()):(t[i]=c&&c.__reactive?this._wrapNested(c,c,d,a):this._wrapWritable(c),r[i]=c),a[d]=a[d]||null}}_wrapNested(e,t,r,n){let a=this._wrapWritable(e);return this._wrapProperties(e,a,t,r,n,0),a.__parse=(e,r,n,o)=>(this._wrapProperties(e,a,t,r,n,o),!1),a}_wrapWritable(e){let t=[],r=function(){for(let r=0;r<t.length;r++)t[r](e)};return{subscribe:r=>(t.push(r),this._async?setTimeout(r,1,e):r(e),()=>{let e=t.indexOf(r);e>=0&&t.splice(e,1)}),__trigger:()=>{t.length&&(this._async?setTimeout(r,1):r())},__parse:function(t){return e=t,!0}}}},py=class{constructor(e,t,r,n){this._setter="function"==typeof e?e:e.setState.bind(e),this._routes=t,this._parsers=r,this._prev={},this._triggers=/* @__PURE__ */new Map,this._sources=/* @__PURE__ */new Map,this._routes.forEach(e=>{e.in.forEach(t=>{let r=this._triggers.get(t)||[];r.push(e),this._triggers.set(t,r)}),e.out.forEach(t=>{let r=this._sources.get(t)||{};e.in.forEach(e=>r[e]=!0),this._sources.set(t,r)})}),this._routes.forEach(e=>{e.length=Math.max(...e.in.map(e=>my(e,this._sources,1)))}),this._bus=n}init(e){let t={};for(let r in e)if(this._prev[r]!==e[r]){let n=this._parsers[r];t[r]=n?n(e[r]):e[r]}this._prev=this._prev?{...this._prev,...e}:{...e},this.setState(t),this._bus&&this._bus.exec("init-state",t)}setStateAsync(e){let t=this._setter(e,2);return this._async?Object.assign(this._async.signals,t):this._async={signals:t,timer:setTimeout(this._applyState.bind(this),1)},t}_applyState(){let e=this._async;if(e){this._async=null,this._triggerUpdates(e.signals,[]);for(let t in e.signals){let r=e.signals[t];r&&r()}}}setState(e,t=[]){let r=this._setter(e);return this._triggerUpdates(r,t),r}_triggerUpdates(e,t){let r=Object.keys(e),n=!t.length;t||=[];for(let a=0;a<r.length;a++){let e=r[a],n=this._triggers.get(e);n&&n.forEach(e=>{-1==t.indexOf(e)&&t.push(e)})}n&&this._execNext(t)}_execNext(e){for(;e.length;){e.sort((e,t)=>e.length<t.length?1:-1);let t=e[e.length-1];e.splice(e.length-1),t.exec(e)}}};function my(e,t,r){let n=t.get(e);if(!n)return r;let a=Object.keys(n).map(e=>my(e,t,r+1));return Math.max(...a)}var fy=class{constructor(){this._nextHandler=null,this._handlers={},this._tag=/* @__PURE__ */new WeakMap,this.exec=this.exec.bind(this)}on(e,t,r){let n=this._handlers[e];n?r&&r.intercept?n.unshift(t):n.push(t):n=this._handlers[e]=[t],r&&r.tag&&this._tag.set(t,r.tag)}intercept(e,t,r){this.on(e,t,{...r,intercept:!0})}detach(e){for(let t in this._handlers){let r=this._handlers[t];for(let t=r.length-1;t>=0;t--)this._tag.get(r[t])===e&&r.splice(t,1)}}async exec(e,t){let r=this._handlers[e];if(r)for(let n=0;n<r.length;n++){let e=r[n](t);if(!1===e||e&&e.then&&!1===await e)return}return this._nextHandler&&await this._nextHandler.exec(e,t),t}setNext(e){return this._nextHandler=e}};function gy(e,t){return(t.getter||function(e){return t=>t[e]}(t.id))(e)}function vy(e,t,r){return(t.setter||function(e){return(t,r)=>t[e]=r}(t.id))(e,r)}function yy(e,t){let r=gy(e,t)??"";return t.template?r=t.template(r,e,t):t.optionsMap&&(r=Array.isArray(r)?r.map(e=>t.optionsMap.get(e)).join(", "):t.optionsMap.get(r)),typeof r>"u"?"":r+""}function by(e,t,r,n,a){let o=/\n|"|;|,/;for(let i=0;i<t[0][e].length;i++){let s=[];for(let r=0;r<t.length;r++){let n=(t[r][e][i].text||"")+"";o.test(n)&&(n='"'+n.replace(/"/g,'""')+'"'),s.push(n)}r+=(r?a:"")+s.join(n)}return r}var xy={a3:{width:11.7,height:16.5},a4:{width:8.27,height:11.7},letter:{width:8.5,height:11}};function wy(e,t){let r=[],n=[],a=0,o=e.filter(e=>!e.hidden),i=function(e){let{mode:t,ppi:r,paper:n}=e,{width:a,height:o}=xy[n];return function(e,t){return e*t}("portrait"===t?a:o,r)}(t);return o.forEach((e,t)=>{a+e.width<=i?(a+=e.width,n.push(e)):(n.length&&r.push(n),n=[e],a=e.width),t===o.length-1&&n.length&&r.push(n)}),r}function Sy(e,t,r){let n=[];return e.forEach((a,o)=>{let i=a[t];for(let s=0;s<r.length;s++){n[s]||(n[s]=[]);let a={...i[s]};if(null!==n[s][o]){if(!o&&!a.rowspan&&!a.colspan){let n=1,i=e[o+n][t][s],l=a.width;for(;!i.rowspan&&!i.colspan;)n++,i=e[o+n][t][s],l+=i.width;a.colspan=n,a.width=l,a.height=r[s]}if(n[s].push(a),!a.collapsed&&a.colspan>1){let t=a.colspan-1;if(a.colspan+o>e.length){let r=a.colspan-(a.colspan+o-e.length);a.colspan=r,a.width=e.slice(o,o+t+1).reduce((e,t)=>e+t.width,0),r>1&&(t=r-1)}for(let e=0;e<t;e++)n[s].push(null)}if(a.rowspan>1){let e=a.rowspan;for(let t=1;t<e;t++)n[s+t]||(n[s+t]=[]),n[s+t].push(null)}}}if(a.collapsed)for(let e=0;e<n.length;e++){let t=n[e],r=t[o];if(r&&r.collapsed){if(t[o]=null,!e)break}else{let e=r||t.findLast(e=>e?.colspan>=1);e&&(--e.colspan,e.width-=a.width)}}}),n.map(e=>e.filter(e=>e&&0!==e.colspan))}function ky(e,t){return e.flexgrow?`min-width:${t}px;width:auto`:`width:${e.width}px; max-width:${e.width}px; height:${e.height}px`}function Cy(e,t,r){let n=e[r.id];if("richselect"===r.filter.type&&n){let e=r.filter.config?.options||t.find(({id:e})=>e==r.id).options;e&&(n=e.find(({id:e})=>e==n).label)}return n??""}var Ny=["resize-column","hide-column","update-cell"],Ty=["delete-row","update-row","update-cell"],Ay=["move-item"],My=["resize-column","move-item"],Dy=class{undo=[];redo=[];progress={};in;getState;setState;_previousValues={};constructor(e,t,r){this.in=e,this.getState=t,this.setState=r,this.setHandlers(),this.resetStateHistory()}getHandlers(){return{"add-row":{handler:e=>({action:"delete-row",data:{id:e.id},source:{action:"add-row",data:e}})},"delete-row":{handler:e=>{let{id:t}=e,{data:r}=this.getPrev(),n=r.findIndex(e=>e.id===t);return{action:"add-row",data:{id:t,row:r[n],before:n<r.length-1?r[n+1].id:void 0},source:{action:"delete-row",data:e}}}},"update-cell":{handler:e=>{let{id:t,column:r}=e,n=gy(this.getRow(t),this.getColumn(r));return dy(n,e.value)?null:{action:"update-cell",data:{id:t,column:r,value:n},source:{action:"update-cell",data:e}}}},"update-row":{handler:e=>{let{id:t,row:r}=e,n=this.getRow(t);for(let a in r)Object.keys(n).includes(a)||(n[a]=void 0);return{action:"update-row",data:{id:t,row:n},source:{action:"update-row",data:e}}}},"copy-row":{handler:e=>{let{id:t}=e,{data:r}=this.getState(),n=r.findIndex(e=>e.id===t),a=r[n];return{action:"delete-row",data:{id:t},source:{action:"add-row",data:{id:t,row:a,before:n<r.length-1?r[n+1].id:void 0}}}}},"resize-column":{handler:e=>{let{id:t,width:r}=e,n=this.getColumn(t),{_sizes:a}=this.getState();return{action:"resize-column",data:{id:t,width:n.width??a.columnWidth},source:{action:"resize-column",data:{id:t,width:r}}}}},"hide-column":{handler:e=>{let{id:t}=e;return{action:"hide-column",data:{id:t,mode:this.getColumn(t).hidden},source:{action:"hide-column",data:e}}}},"collapse-column":{handler:e=>{let{id:t,row:r,mode:n}=e;return{action:"collapse-column",data:{id:t,row:r,mode:"boolean"==typeof n?!n:n},source:{action:"collapse-column",data:e}}}},"move-item":{handler:e=>{let{id:t,target:r,mode:n}=e,{flatData:a}=this.getPrev(),o=a.findIndex(e=>e.id===t);return{action:"move-item",data:{id:t,target:a[o+(o?-1:1)].id,mode:o?"after":"before"},source:{action:"move-item",data:{id:t,target:r,mode:n}}}}},"open-row":{handler:e=>{let{id:t,nested:r}=e;return{action:"close-row",data:{id:t,nested:r},source:{action:"open-row",data:e}}}},"close-row":{handler:e=>{let{id:t,nested:r}=e;return{action:"open-row",data:{id:t,nested:r},source:{action:"close-row",data:e}}}}}}resetHistory(){this.undo=[],this.redo=[],this.progress={},this.resetStateHistory()}getPrev(){return this._previousValues}setHandlers(){let e=this.getHandlers();for(let t in e)this.in.intercept(t,e=>{if("undo"!==e.eventSource&&"redo"!==e.eventSource&&!e.skipUndo){if(My.includes(t))return(e.inProgress&&!this.progress[t]||"boolean"!=typeof e.inProgress)&&(Ay.includes(t)&&this.setPrev("flatData"),Ny.includes(t)&&this.setPrev("columns")),void(this.progress[t]=e.inProgress);Ty.includes(t)&&this.setPrev("data"),Ny.includes(t)&&this.setPrev("columns")}}),this.in.on(t,r=>{if("undo"===r.eventSource||"redo"===r.eventSource||r.skipUndo||r.inProgress)return;let n=e[t].handler(r);n&&this.addToHistory(n)})}setPrev(e){this._previousValues[e]=uy(this.getState()[e])}addToHistory(e){this.undo.push(e),this.redo=[],this.setStateHistory()}handleUndo(){if(!this.undo.length)return;let e=this.undo.pop();this.redo.push({...e.source,source:e}),this.in.exec(e.action,{...e.data,eventSource:"undo"}),this.setStateHistory()}handleRedo(){if(!this.redo.length)return;let e=this.redo.pop();this.undo.push({...e.source,source:e}),this.in.exec(e.action,{...e.data,eventSource:"redo"}),this.setStateHistory()}resetStateHistory(){this.setState({history:{undo:0,redo:0}})}setStateHistory(){this.setState({history:{undo:this.undo.length,redo:this.redo.length}})}getRow(e){let{data:t}=this.getPrev();return this.getState().tree?this.getTreeRow(t,e):t.find(t=>t.id===e)}getTreeRow(e,t){for(let r=0;r<e.length;r++){if(e[r].id===t)return e[r];if(e[r].data){let n=this.getTreeRow(e[r].data,t);if(n)return n}}return null}getColumn(e){let{columns:t}=this.getPrev();return t.find(t=>t.id===e)}};function Ey(e,t){return typeof e>"u"||null===e?-1:typeof t>"u"||null===t?1:e===t?0:e>t?1:-1}function Iy(e,t){return-Ey(e,t)}function Ry(e,t){if(!e||!e.length)return;let r=e.map(e=>{let r=t.find(t=>t.id==e.key);return function(e,t){if("function"==typeof t.sort)return function(r,n){let a=t.sort(r,n);return"asc"===e?a:-a};let r="asc"===e?Ey:Iy;return function(e,n){return r(gy(e,t),gy(n,t))}}(e.order,r)});return 1===e.length?r[0]:function(e,t){for(let n=0;n<r.length;n++){let a=r[n](e,t);if(0!==a)return a}return 0}}function zy(e,t,r,n,a){let o,i,s=document.createElement("div"),l=document.createElement("div"),c=document.body;a=a?`${a}px`:"auto",l.className=t,s.classList.add(`wx-${r}-theme`),s.style.cssText=`height:auto;position:absolute;top:0px;left:100px;overflow:hidden;width=${a};white-space:nowrap;`,s.appendChild(l),c.appendChild(s),"object"!=typeof e&&(e=[e]);for(let d=0;d<e.length;d++){l.innerText=e[d]+"";let t=s.getBoundingClientRect(),r=Math.ceil(t.width)+(n&&n.length?n[d]:0),a=Math.ceil(t.height);o=Math.max(o||0,r),i=Math.max(i||0,a)}return s.remove(),{width:o,height:i}}function _y(e,t,r,n,a){let o=[];for(let i=0;i<e.length;i++){let s=e[i][t],l=s.length;for(let e=0;e<l;e++){let{text:i,vertical:l,collapsed:c,rowspan:d,css:u}=s[e];if(!i){o[e]=Math.max(o[e]||0,n);continue}let h=0;if(l&&!c){let l=`wx-measure-cell-${t}`;if(l+=u?` ${u}`:"",h=zy(i,l,a).width,(d>1||!s[e+1])&&r>e+1){let t=d||r-e,a=o.slice(e,e+t).reduce((e,t)=>e+t,0);if(a<h){let r=Math.ceil((h-a)/t);for(let a=e;a<e+t;a++)o[a]=(o[a]||n)+r}continue}}o[e]=Math.max(o[e]||n,h)}}return o}var Py={text:(e,t)=>e?-1!==e.toString().toLowerCase().indexOf(t.toLowerCase()):!t,richselect:(e,t)=>"number"!=typeof t&&!t||e==t,datepicker:(e,t)=>!t||e&&function(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}(e,t),multiselect:(e,t)=>!t||0===t?.length||(Array.isArray(e)?e?.some(e=>t.includes(e)):e&&t.includes(e))};function Oy(e){return Py[e]}var Ly=class extends hy{in;_router;_branches;_xlsxWorker;_historyManager;constructor(e){super({writable:e,async:!1});let t={rowHeight:37,columnWidth:160,headerHeight:36,footerHeight:36};this._router=new py(super.setState.bind(this),[{in:["columns","sizes","_skin"],out:["_columns","_sizes"],exec:e=>{let{columns:t,sizes:r,_skin:n}=this.getState(),a=this.copyColumns(t),o=a.reduce((e,t)=>Math.max(t.header.length,e),0),i=a.reduce((e,t)=>Math.max(t.footer.length,e),0);a.forEach(this.setCollapsibleColumns);let s=this.normalizeSizes(a,r,o,i,n);for(let l=0;l<a.length;l++)this.normalizeColumns(a,l,"header",o,s),this.normalizeColumns(a,l,"footer",i,s);this.setState({_columns:a,_sizes:s},e)}},{in:["data","tree","_filterIds"],out:["flatData","_rowHeightFromData"],exec:e=>{let{data:t,tree:r,dynamic:n,_filterIds:a}=this.getState(),o=a&&new Set(a),i=r?this.flattenRows(t,[],a):o?t.filter(e=>o.has(e.id)):t,s=!n&&i.some(e=>e.rowHeight);this.setState({flatData:i,_rowHeightFromData:s},e)}}],{sizes:e=>({...t,...e})});let r=this.in=new fy;r.on("close-editor",({ignore:e})=>{let{editor:t}=this.getState();t&&(e||r.exec("update-cell",t),this.setState({editor:null}))}),r.on("open-editor",({id:e,column:t})=>{let n=this.getState().editor;n&&r.exec("close-editor",{});let a=this.getRow(e),o=t?this.getColumn(t):this.getNextEditor(a);if(o?.editor){let t=o.editor;if("function"==typeof t&&(t=t(a,o)),!t)return;n={column:o.id,id:e,value:gy(a,o)??"",renderedValue:yy(a,o),type:t.type||t},"object"==typeof t&&t.config&&(n.config=t.config,t.config.options&&(n.options=t.config.options)),o.options&&!n.options&&(n.options=o.options),this.setState({editor:n})}}),r.on("editor",({value:e})=>{let t=this.getState().editor;if(t){t={...t},t.value=e;let r=this.getColumn(t.column),n={...this.getRow(t.id)};vy(n,r,e),t.renderedValue=yy(n,r),this.setState({editor:t})}}),r.on("add-row",e=>{let t=this.getState(),{data:n}=t,{select:a,_filterIds:o}=t,{row:i,before:s,after:l,select:c}=e;if(e.id=i.id=e.id||i.id||By(),s||l){let t=s||l,r=n.findIndex(e=>e.id===t);n=[...n],n.splice(r+ +!!l,0,e.row)}else n=[...n,e.row];let d={data:n};o&&(d._filterIds=[...o,e.id]),this.setState(d),("boolean"!=typeof c||c)&&(c||a)&&r.exec("select-row",{id:i.id,show:!0})}),r.on("delete-row",e=>{let{data:t,selectedRows:r,focusCell:n,editor:a}=this.getState(),{id:o}=e,i={data:t.filter(e=>e.id!==o)};this.isSelected(o)&&(i.selectedRows=r.filter(e=>e!==o)),a?.id===o&&(i.editor=null),this.setState(i),n?.row===o&&this.in.exec("focus-cell",{eventSource:"delete-row"})}),r.on("update-cell",e=>{let t=this.getState(),{data:r}=t;r=[...r];let{tree:n}=t,{id:a,column:o,value:i}=e,s=this.getColumn(o);if(n){let e={...this._branches[a]};vy(e,s,i);let t=this.updateTreeRow(e);0===e.$parent&&(r=t)}else{let e=r.findIndex(e=>e.id===a),t={...r[e]};vy(t,s,i),r[e]=t}this.setState({data:r})}),r.on("update-row",e=>{let{data:t}=this.getState(),{id:r,row:n}=e,a=t.findIndex(e=>e.id===r);t=[...t],t[a]={...t[a],...n},this.setState({data:t})}),r.on("select-row",({id:e,toggle:t,range:r,mode:n,show:a,column:o})=>{let i=this.getState(),{focusCell:s}=i,{selectedRows:l}=i;if(l.length||(r=t=!1),r){let{data:t}=this.getState(),r=t.findIndex(e=>e.id===l[l.length-1]),n=t.findIndex(t=>t.id===e);r>n&&([r,n]=[n,r]),t.slice(r,n+1).forEach(e=>{this.isSelected(e.id)||l.push(e.id)})}else if(t&&this.isSelected(e)){if(!0===n)return;l=l.filter(t=>t!==e)}else if(t){if(!1===n)return;l.push(e)}else l=[e];this.setState({selectedRows:[...l]}),s?.row!==e&&this.in.exec("focus-cell",{eventSource:"select-row"}),a&&this.in.exec("scroll",{row:e,column:o})}),this.in.on("focus-cell",e=>{let{row:t,column:r,eventSource:n}=e,{_columns:a,split:o}=this.getState();t&&r?(this.setState({focusCell:{row:t,column:r}}),"click"!==n&&((!o.left||a.findIndex(t=>t.id===e.column)>=o.left)&&(!o.right||a.findIndex(t=>t.id===e.column)<a.length-o.right)?this.in.exec("scroll",{row:t,column:r}):this.in.exec("scroll",{row:t}))):this.setState({focusCell:null})}),r.on("resize-column",e=>{let{id:t,auto:r,maxRows:n,inProgress:a}=e;if(!1===a)return;let o=e.width||0,i=[...this.getState().columns],s=this.getColumn(t);if(r){if("data"===r||!0===r){let{flatData:e,_skin:t}=this.getState(),r=e.length;n&&(r=Math.min(n,r)),o=function(e,t,r){let n=[],a=[],o="wx-measure-cell-body";o+=e.css?` ${e.css}`:"";for(let i=0;i<t.length;i++){let r=yy(t[i],e);r&&(n.push(r),e.treetoggle?a.push(28*t[i].$level+(t[i].$count?28:0)+(e.draggable?28:0)):e.draggable&&a.push(28))}return zy(n,o,r,a).width}(s,e.slice(0,r),t)}if("header"===r||!0===r){let{_skin:e}=this.getState();o=Math.max(function(e,t){let r,n="wx-measure-cell-header",a=e.sort?20:0,o=e.header;if("string"==typeof o)return zy(o,n,t).width+a;Array.isArray(o)||(o=[o]);for(let i=0;i<o.length;i++){let e=o[i],s=zy("string"==typeof e?e:e.text,n+("string"==typeof e?"":` ${e.css}`),t).width;i===o.length-1&&(s+=a),r=Math.max(r||0,s)}return r}(s,e),o)}}s.width=Math.max(17,o),delete s.flexgrow,this.setState({columns:i})}),r.on("hide-column",e=>{let{id:t,mode:r}=e,n=[...this.getState().columns],a=this.getColumn(t),o=n.reduce((e,t)=>e+ +!t.hidden,0);!r||o>1?(a.hidden=!a.hidden,this.setState({columns:n})):e.skipUndo=!0}),r.on("sort-rows",e=>{let{key:t,add:r,sort:n}=e,a=this.getState(),{columns:o,data:i,tree:s}=a;if(n){let e=[...i];return e.sort(n),void this.setState({data:e})}let{order:l="asc"}=e,c=a.sortMarks,d=Object.keys(c),u=d.length;!r||!u||1===u&&c[t]?c={[t]:{order:l}}:(1===u&&(c[d[0]]={...c[d[0]],index:0}),c={...c,[t]:{order:l,index:"number"==typeof r?r:c[t]?.index??u}});let h=Object.keys(c).sort((e,t)=>c[e].index-c[t].index).map(e=>({key:e,order:c[e].order}));this.setState({sortMarks:c});let p=Ry(h,o);if(p){let e=[...i];s?this.sortTree(e,p):e.sort(p),this.setState({data:e})}}),r.on("filter-rows",e=>{let{value:t,key:r,filter:n}=e;if(!Object.keys(e).length)return void this.setState({filterValues:{},_filterIds:null});let a=this.getState(),{data:o,tree:i,_columns:s}=a,l=a.filterValues,c={};r&&(l={...l,[r]:t},c.filterValues=l);let d=n??function(e,t){let r=[];for(let n in e){let a=t.find(e=>e.id==n),{config:o,type:i}=a.header.find(e=>e.filter).filter,s=e[n];r.push(e=>{let t=gy(e,a);return o?.handler?o.handler(t,s):Oy(i)(t,s)})}return e=>{for(let t=0;t<r.length;t++)if(!r[t](e))return!1;return!0}}(l,s),u=[];i?u=this.filterTree(o,d,u):o.forEach(e=>{d(e)&&u.push(e.id)}),c._filterIds=u,this.setState(c)}),r.on("collapse-column",e=>{let{id:t,row:r,mode:n}=e,a=[...this.getState().columns],o=this.getColumn(t).header,i=Array.isArray(o)?o[r]:o;"object"==typeof i&&(i.collapsed=n??!i.collapsed,this.setState({columns:a}))}),r.on("move-item",e=>{let t,r,{id:n,inProgress:a}=e,{target:o,mode:i="after"}=e,{data:s,flatData:l,tree:c}=this.getState(),d=l.findIndex(e=>e.id===n);if("up"===i||"down"===i){if("up"===i){if(0===d)return;t=d-1,i="before"}else if("down"===i){if(d===l.length-1)return;t=d+1,i="after"}o=l[t]&&l[t].id}else t=l.findIndex(e=>e.id===o);-1!==d&&-1!==t&&!1!==a&&(c||(r=this.moveItem(n,o,s,i)),this.setState({data:c?this.normalizeTreeRows(r):r}))}),r.on("copy-row",e=>{let{id:t,target:r,mode:n="after"}=e,a=this.getState(),{flatData:o,_filterIds:i}=a,{data:s}=a,l=this.getRow(t);if(!l)return;let c={...l,id:By()};e.id=c.id;let d=o.findIndex(e=>e.id===r);if(-1===d)return;s.splice(d+ +("after"===n),0,c),s=[...s];let u={data:s};i&&(u._filterIds=[...i,c.id]),this.setState(u)}),r.on("open-row",e=>{let{id:t,nested:r}=e;this.toggleBranch(t,!0,r)}),r.on("close-row",e=>{let{id:t,nested:r}=e;this.toggleBranch(t,!1,r)}),r.on("export-data",e=>new Promise((t,r)=>{let n=e.format||"csv",a=`${e.fileName||"data"}.${n}`;if("csv"===n){let r=function(e,t){let r=/\n|"|;|,/,n="",a=t.rows||"\n",o=t.cols||"\t",i=e._columns,s=e.flatData;!1!==t.header&&i[0].header&&(n=by("header",i,n,o,a));for(let l=0;l<s.length;l++){let e=[];for(let t=0;t<i.length;t++){let n=yy(s[l],i[t]);r.test(n)&&(n='"'+n.replace(/"/g,'""')+'"'),e.push(n)}n+=(n?a:"")+e.join(o)}return!1!==t.footer&&i[0].footer&&(n=by("footer",i,n,o,a)),n}(this.getState(),e.csv||{});!1===e.download?e.result=r:function(e,t){let r=document.createElement("a");r.href=URL.createObjectURL(e),r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r)}(new Blob(["\ufeff"+r],{type:"text/csv"}),a),t(!0)}else r()})),r.on("hotkey",({key:e,event:t,isInput:r})=>{switch(e){case"arrowup":{let{flatData:e,focusCell:n,select:a}=this.getState();if(t.preventDefault(),r)return;let o=n?n.column:this._getFirstVisibleColumn()?.id,i=n?this.getPrevRow(n.row)?.id:e[e.length-1]?.id;o&&i&&(this.in.exec("focus-cell",{row:i,column:o,eventSource:"key"}),a&&this.in.exec("select-row",{id:i}));break}case"arrowdown":{let{flatData:e,focusCell:n,select:a}=this.getState();if(t.preventDefault(),r)return;let o=n?n.column:this._getFirstVisibleColumn()?.id,i=n?this.getNextRow(n.row)?.id:e[0]?.id;o&&i&&(this.in.exec("focus-cell",{row:i,column:o,eventSource:"key"}),a&&this.in.exec("select-row",{id:i}));break}case"arrowright":{let{focusCell:e}=this.getState();if(r)return;if(t.preventDefault(),e){let t=this.getNextColumn(e.column,!0)?.id;t&&this.in.exec("focus-cell",{row:e.row,column:t,eventSource:"key"})}break}case"arrowleft":{let{focusCell:e}=this.getState();if(r)return;if(t.preventDefault(),e){let t=this.getPrevColumn(e.column,!0)?.id;t&&this.in.exec("focus-cell",{row:e.row,column:t,eventSource:"key"})}break}case"tab":{let{editor:e,focusCell:r,select:n}=this.getState();if(e){t.preventDefault();let r=e.column,a=e.id,o=this.getNextEditor(this.getRow(a),this.getColumn(r));if(!o){let e=this.getNextRow(a);e&&(a=e.id,o=this.getNextEditor(e))}o&&(this.in.exec("open-editor",{id:a,column:o.id}),this.in.exec("focus-cell",{row:a,column:o.id,eventSource:"key"}),n&&!this.isSelected(a)&&this.in.exec("select-row",{id:a}))}else r&&this.in.exec("focus-cell",{eventSource:"key"});break}case"shift+tab":{let{editor:e,focusCell:r,select:n}=this.getState();if(e){t.preventDefault();let r=e.column,a=e.id,o=this.getPrevEditor(this.getRow(a),this.getColumn(r));if(!o){let e=this.getPrevRow(a);e&&(a=e.id,o=this.getPrevEditor(e))}o&&(this.in.exec("open-editor",{id:a,column:o.id}),this.in.exec("focus-cell",{row:a,column:o.id,eventSource:"key"}),n&&!this.isSelected(a)&&this.in.exec("select-row",{id:a}))}else r&&this.in.exec("focus-cell",{eventSource:"key"});break}case"escape":{let{editor:e}=this.getState();e&&(this.in.exec("close-editor",{ignore:"multiselect"!=e.type}),this.in.exec("focus-cell",{row:e.id,column:e.column,eventSource:"key"}));break}case"f2":{let{editor:e,focusCell:t}=this.getState();!e&&t&&this.in.exec("open-editor",{id:t.row,column:t.column});break}case"enter":{let{focusCell:e,tree:t}=this.getState();if(!r&&t&&e&&this.getColumn(e.column).treetoggle){let t=this.getRow(e.row);if(!t.data)return;this.in.exec(t.open?"close-row":"open-row",{id:e.row,nested:!0})}break}case"home":{let{editor:e,focusCell:r}=this.getState();if(!e&&r){t.preventDefault();let e=this._getFirstVisibleColumn()?.id;this.in.exec("focus-cell",{row:r.row,column:e,eventSource:"key"})}break}case"ctrl+home":{let{editor:e,focusCell:r,flatData:n,select:a}=this.getState();if(!e&&r){t.preventDefault();let e=n[0]?.id,r=this._getFirstVisibleColumn()?.id;e&&r&&(this.in.exec("focus-cell",{row:e,column:r,eventSource:"key"}),a&&!this.isSelected(e)&&this.in.exec("select-row",{id:e}))}break}case"end":{let{editor:e,focusCell:r}=this.getState();if(!e&&r){t.preventDefault();let e=this._getLastVisibleColumn()?.id,n=r.row;this.in.exec("focus-cell",{row:n,column:e,eventSource:"key"})}break}case"ctrl+end":{let{editor:e,focusCell:r,flatData:n,select:a}=this.getState();if(!e&&r){t.preventDefault();let e=n.at(-1).id,r=this._getLastVisibleColumn()?.id;e&&r&&(this.in.exec("focus-cell",{row:e,column:r,eventSource:"key"}),a&&!this.isSelected(e)&&this.in.exec("select-row",{id:e}))}break}case"ctrl+z":this.in.exec("undo",{});break;case"ctrl+y":this.in.exec("redo",{})}}),r.on("scroll",e=>{let{_columns:t,split:r,_sizes:n,flatData:a,dynamic:o,_rowHeightFromData:i}=this.getState(),s=-1,l=-1,c=0,d=0;if(e.column){s=0;let n=t.findIndex(t=>t.id===e.column);c=t[n].width;for(let e=r.left??0;e<n;e++){let r=t[e];r.hidden||(s+=r.width)}}if(e.row&&!o){let t=a.findIndex(t=>t.id===e.row);t>=0&&(i?(l=a.slice(0,t).reduce((e,t)=>e+(t.rowHeight||n.rowHeight),0),d=a[t].rowHeight):l=n.rowHeight*t)}this.setState({scroll:{top:l,left:s,width:c,height:d||n.rowHeight}})}),r.on("scroll-to",e=>{let t={};void 0!==e.top&&(t.scrollTop=e.top),void 0!==e.left&&(t.scrollLeft=e.left),Object.keys(t).length&&this.setState(t)}),r.on("print",e=>{let t=function(e={}){let{mode:t,ppi:r,paper:n}=e;return{mode:t||"portrait",ppi:r||100,paper:n||"a4"}}(e);this.setState({_print:t}),this.setStateAsync({_print:null})}),r.on("undo",()=>{this._historyManager?.handleUndo()}),r.on("redo",()=>{this._historyManager?.handleRedo()}),this.initOnce()}getXlsxWorker(e){if(!this._xlsxWorker){let t=window.URL.createObjectURL(new Blob([`importScripts('${e}');`],{type:"text/javascript"}));this._xlsxWorker=new Promise(e=>{let r=new Worker(t);r.addEventListener("message",t=>{"init"===t.data.type&&e(r)})})}return this._xlsxWorker}initOnce(){this._router.init({sortMarks:{},_filterIds:null,data:[],filterValues:{},scroll:null,scrollLeft:0,scrollTop:0,editor:null,focusCell:null,_print:null,history:{undo:0,redo:0},search:null})}init(e){e.hasOwnProperty("_skin")&&!e._skin&&(e._skin=function(){if(typeof document>"u")return"willow";let e=document.querySelector('[class^="wx"][class$="theme"]');return e?e.className.substring(3,e.className.length-6):"willow"}()),e.columns&&e.columns.forEach(e=>{e.options&&(e.optionsMap=new Map(e.options.map(e=>[e.id,e.label])))}),dy(this.getState().data,e.data)||(e.data=e.tree?this.normalizeTreeRows(e.data):this.normalizeRows(e.data),this.setState({_filterIds:null,filterValues:{},sortMarks:{},search:null}),this._historyManager&&this._historyManager.resetHistory()),e.tree&&(e.undo=!1,e.reorder=!1),e.split?.right&&(e.split.right=0),e.undo&&!this._historyManager&&(this._historyManager=new Dy(this.in,this.getState.bind(this),this.setState.bind(this))),this._router.init({...e})}setState(e,t){return this._router.setState(e,t)}setStateAsync(e){this._router.setStateAsync(e)}getRow(e){let{tree:t}=this.getState();return t?this._branches[e]:this.getState().data.find(t=>t.id===e)}getRowIndex(e,t){return t||=this.getState().flatData,t.findIndex(t=>t.id===e)}getNextRow(e){let t=this.getState().flatData;return t[this.getRowIndex(e,t)+1]}getPrevRow(e){let t=this.getState().flatData;return t[this.getRowIndex(e,t)-1]}getColumn(e){return this.getState().columns.find(t=>t.id===e)}getNextColumn(e,t){let r=this.getState()._columns,n=r.findIndex(t=>t.id===e);return t?this._getFirstVisibleColumn(n+1):r[n+1]}getPrevColumn(e,t){let r=this.getState()._columns,n=r.findIndex(t=>t.id===e);return t?this._getLastVisibleColumn(n-1):r[n-1]}_getFirstVisibleColumn(e){let t=this.getState()._columns,r=e??0;for(;r<t.length&&(t[r]?.hidden||t[r]?.collapsed);)r++;return t[r]}_getLastVisibleColumn(e){let t=this.getState()._columns,r=e??t.length-1;for(;r<t.length&&(t[r]?.hidden||t[r]?.collapsed);)r--;return t[r]}isCellEditable(e,t){let{editor:r,hidden:n}=t;return!(!r||n)&&("function"!=typeof r||r(e,t))}getNextEditor(e,t){let r=this.getState().columns;if(t){let e=r.findIndex(e=>e.id===t.id);r=r.slice(e+1)}return r.find(t=>this.isCellEditable(e,t))}getPrevEditor(e,t){let r=this.getState().columns;if(t){let e=r.findLastIndex(e=>e.id===t.id);r=r.slice(0,e)}return r.findLast(t=>this.isCellEditable(e,t))}toggleBranch(e,t,r){let n=this._branches[e],{data:a}=this.getState();if(a=[...a],0!==e){n={...n,open:t};let e=this.updateTreeRow(n);0===n.$parent&&(a=e)}r&&n.data?.length&&n.data.forEach(n=>{let o=this.toggleKids(n,t,r);0===e&&(a=o)}),this.setState({data:a})}toggleKids(e,t,r){e={...e,open:t};let n=this.updateTreeRow(e);return r&&e.data?.length&&e.data.forEach(e=>{this.toggleKids(e,t,r)}),n}updateTreeRow(e){let t=e.id;this._branches[t]=e;let r=this._branches[e.$parent],n=r.data.findIndex(e=>e.id===t);return r.data=[...r.data],r.data[n]=e,r.data}isSelected(e){return-1!==this.getState().selectedRows.indexOf(e)}findAndRemove(e,t){for(let r=0;r<e.length;r++){if(e[r].id===t)return e.splice(r,1)[0];if(e[r].data){let n=[...e[r].data],a=this.findAndRemove(n,t);if(a)return e[r]={...e[r],data:n},a}}return null}insertItem(e,t,r,n){for(let a=0;a<e.length;a++){if(e[a].id===t){let t=e[a],o="before"===n?a:a+1;if(t.data){if("before"===n){let t=a>0?e[a-1]:null;return t?.data&&t.open?e[a-1]={...t,data:[...t.data,r]}:e.splice(o,0,r),!0}if(t.open)return e[a]={...t,data:[r,...t.data]},!0}return e.splice(o,0,r),!0}if(e[a].data&&(e[a]={...e[a],data:[...e[a].data]},this.insertItem(e[a].data,t,r,n)))return!0}return!1}moveItem(e,t,r,n){let a=[...r],o=this.findAndRemove(a,e);return this.insertItem(a,t,o,n),a}copyColumns(e){let t=[];for(let r=0;r<e.length;r++){let n={...e[r]};this.copyHeaderFooter(n,"header"),this.copyHeaderFooter(n,"footer"),t[r]=n}return t}copyHeaderFooter(e,t){let r=e[t];r=Array.isArray(r)?[...r]:[r],r.forEach((e,t)=>{r[t]="string"==typeof e?{text:e}:{...e}}),e[t]=r}setCollapsibleColumns(e,t,r){let n=e.header;for(let a=0;a<n.length;a++){let o=n[a];if(o.collapsible&&o.collapsed){if("first"!==o.collapsible){e.collapsed=!0,e.width=36,o.vertical=!0;let t=n.length-a;n=n.slice(0,a+1),n[a].rowspan=t}let i=o.colspan;if(i){let e=n[a+1],o=1;e&&e.colspan&&!e.collapsed&&(o=e.colspan);for(let n=o;n<i;n++){let e=r[t+n];e&&(e.hidden=!0)}}}}}normalizeColumns(e,t,r,n,a){let o=e[t];o.width||=o.flexgrow?17:a.columnWidth,o._colindex=t+1;let i=o[r],s=a[`${r}RowHeights`];for(let l=0;l<n;l++){let c=i[l];c.id=o.id,l===i.length-1&&(c.rowspan=c.rowspan?Math.min(c.rowspan,n-l):n-l);for(let n=1;n<c.rowspan;n++){i.splice(l+n,0,{_hidden:!0});for(let a=1;a<c.colspan;a++)e[t+a][r].splice(l+n,0,{})}if(c.rowspan&&(c.height=(c.rowspan===n?s:s.slice(l,c.rowspan+l)).reduce((e,t)=>e+t,0),l+c.rowspan!=n&&c.height--),c.colspan){let r=o.width,n=o.flexgrow||0,i=c.colspan;for(let o=1;o<i;o++){let i=e[t+o];i&&(i.hidden?--c.colspan:i.flexgrow?n+=i.flexgrow:r+=i.width||a.columnWidth),n?c.flexgrow=n:c.width=r}}else c.width=o.width,c.flexgrow=o.flexgrow;"header"===r&&c.filter&&"string"==typeof c.filter&&(c.filter={type:c.filter})}i.length>n&&(i.length=n),o[r]=i}normalizeRows(e){for(let t=0;t<e.length;t++)e[t].id||(e[t].id=By());return e}normalizeTreeRows(e,t,r){return!t&&!r&&(this._branches={0:{data:e}}),e.forEach(e=>{e.id||=By(),e.$level=t||0,e.$parent=r||0,this._branches[e.id]=e,e.data&&(e.data.length?(e.$count=e.data.length,this.normalizeTreeRows(e.data,e.$level+1,e.id)):(delete e.data,delete e.$count,delete e.open))}),e}sortTree(e,t){e.sort(t),e.forEach(e=>{e.data&&this.sortTree(e.data,t)})}filterTree(e,t,r){return e.forEach(e=>{t(e)&&r.push(e.id),e.data&&this.filterTree(e.data,t,r)}),r}flattenRows(e,t,r){let n=t;return e.forEach(e=>{(!r||r.includes(e.id))&&n.push(e),e.data?.length&&!1!==e.open&&this.flattenRows(e.data,n,r)}),n}createFilter(e){let{_columns:t}=this.getState(),r=[];for(let n in e){let a=t.find(e=>e.id==n),{config:o,type:i}=a.header.find(e=>e.filter).filter,s=e[n];r.push(e=>{let t=gy(e,a);return o?.handler?o.handler(t,s):Oy(i)(t,s)})}return e=>{for(let t=0;t<r.length;t++)if(!r[t](e))return!1;return!0}}searchRows(e,t){e=e.trim().toLowerCase();let r={};if(!e)return r;let{flatData:n,columns:a}=this.getState(),o=t?a.filter(e=>t[e.id]):a;return n.forEach(t=>{let n={};o.forEach(r=>{let a=yy(t,r);String(a).toLowerCase().includes(e)&&(n[r.id]=!0)}),Object.keys(n).length&&(r[t.id]=n)}),r}normalizeSizes(e,t,r,n,a){let o=_y(e,"header",r,t.headerHeight,a),i=_y(e,"footer",n,t.footerHeight,a),s=o.reduce((e,t)=>e+t,0),l=i.reduce((e,t)=>e+t,0);return{...t,headerRowHeights:o,footerRowHeights:i,headerHeight:s,footerHeight:l}}},Fy=/* @__PURE__ */(new Date).valueOf();function By(){return"temp://"+Fy++}
86
+ /* @__PURE__ */(new Date).valueOf();var Vy=class{constructor(){this.store=/* @__PURE__ */new Map}configure(e,t){this.node=t;for(let r in e)if(e[r]){let t=r.toLowerCase().replace(/[ ]/g,""),n=e[r];this.store.set(t,n)}}},$y=[],Hy=e=>{jy||(jy=!0,document.addEventListener("keydown",e=>{if($y.length&&(e.ctrlKey||e.altKey||e.metaKey||e.shiftKey||e.key.length>1||" "===e.key)){let t=[];e.ctrlKey&&t.push("ctrl"),e.altKey&&t.push("alt"),e.metaKey&&t.push("meta"),e.shiftKey&&t.push("shift");let r=e.code.replace("Key","").toLocaleLowerCase();" "===e.key&&(r="space"),t.push(r);let n=t.join("+");for(let a=$y.length-1;a>=0;a--){let t=$y[a],o=t.store.get(n)||t.store.get(r);o&&t.node.contains(e.target)&&o(e,{key:n,evKey:r})}}}));let t=new Vy;return $y.push(t),e(t),()=>{let e=$y.findIndex(e=>e===t);e>=0&&$y.splice(e,1)}},jy=!1;var qy={tab:!0,"shift+tab":!0,arrowup:!0,arrowdown:!0,arrowright:!0,arrowleft:!0,enter:!0,escape:!0,f2:!0,home:!0,end:!0,"ctrl+home":!0,"ctrl+end":!0,"ctrl+z":!0,"ctrl+y":!0};var Uy=te(null);function Gy(e){let t=e.getBoundingClientRect(),r=document.body,n=t.top+r.scrollTop-r.clientTop||0,a=t.left+r.scrollLeft-r.clientLeft||0;return{y:Math.round(n),x:Math.round(a),width:e.offsetWidth,height:e.offsetHeight}}function Wy(e,t){let r=Gy(t);return{x:e.clientX-r.x,y:e.clientY-r.y}}function Ky(e,t){let r,n,a=t.current,o=null,i=!1,s=!1,l=document.createElement("DIV");function c(){clearTimeout(r),r=null}function d(t){let r=Yf(t);r&&(o={container:l,sourceNode:t.target,from:Zf(r),pos:Wy(t,e)},n=o.pos,u(t))}function u(t){if(!o)return;let r=o.pos=Wy(t,e);if(!i){if(!s&&!t?.target?.getAttribute("draggable-data")&&Math.abs(n.x-r.x)<5&&Math.abs(n.y-r.y)<5)return;if(!1===function(t){if(i=!0,a.start){if(!1===a.start(t,o))return!1;e.appendChild(l),document.body.style.cursor="move"}}(t))return w()}if(s){let e=window.scrollX||document.documentElement.scrollLeft||document.body.scrollLeft,r=window.scrollY||document.documentElement.scrollTop||document.body.scrollTop;o.targetNode=document.elementFromPoint(t.pageX-e,t.pageY-r)}else o.targetNode=t.target;a.move&&a.move(t,o),l.style.left=-(o.offset?o.offset.x:0)+"px",l.style.top=o.pos.y+(o.offset?o.offset.y:0)+"px"}function h(e){l.parentNode&&l.parentNode.removeChild(l),l.innerHTML="",i&&a.end&&a.end(e,o),o=n=null,w()}function p(e){a.getReorder&&!a.getReorder()||0===e.button&&(x(e),window.addEventListener("mousemove",m),window.addEventListener("mouseup",f),d(e))}function m(e){u(e)}function f(e){h(e)}function g(t){a.getReorder&&!a.getReorder()||(r=setTimeout(()=>{s=!0,d(t.touches[0])},700),x(t),t.target.addEventListener("touchmove",v),t.target.addEventListener("touchend",function e(){r&&c(),t.target.removeEventListener("touchmove",v),t.target.removeEventListener("touchend",e),h(t)}),e.addEventListener("contextmenu",y))}function v(e){i?(e.preventDefault(),u(e.touches[0])):r&&c()}function y(e){if(i||r)return e.preventDefault(),!1}function b(e){e.preventDefault()}function x(e){if(!a.getDraggableInfo)return;let{hasDraggable:t}=a.getDraggableInfo();(!t||e.target.getAttribute("draggable-data"))&&(document.body.style.userSelect="none",document.body.style.webkitUserSelect="none")}function w(t){i=s=!1,document.body.style.cursor="",document.body.style.userSelect="",document.body.style.webkitUserSelect="",window.removeEventListener("mousemove",m),window.removeEventListener("mouseup",f),t&&(e.removeEventListener("mousedown",p),e.removeEventListener("touchstart",g),e.removeEventListener("dragstart",b))}return l.className="wx-drag-zone",l.setAttribute("tabindex",-1),e.addEventListener("mousedown",p),e.addEventListener("touchstart",g),e.addEventListener("dragstart",b),{destroy(){w(!0)}}}function Yy(e,t,r,n){let{node:a,left:o,top:i,bottom:s,sense:l,xScroll:c,yScroll:d}=n,u=Wy(e,a);r.scrollState||={dirX:0,dirY:0,scrollSpeedFactor:1};let h=0,p=0;u.x<o+l?h=-1:u.x>t.width-l&&(h=1),u.y<i+Math.round(l/2)?p=-1:u.y>t.height-s-Math.round(l/2)&&(p=1),(r.scrollState.dirX!==h||r.scrollState.dirY!==p)&&(Xy(r),r.scrollState.dirX=h,r.scrollState.dirY=p),(c&&0!==r.scrollState.dirX||d&&0!==r.scrollState.dirY)&&function(e,t,r){e.autoScrollTimer||=setTimeout(()=>{e.activeAutoScroll=setInterval(Zy,15,e,t,r)},250)}(r,n,{x:r.scrollState.dirX,y:r.scrollState.dirY})}function Xy(e){e.scrollSpeedFactor=1,e.autoScrollTimer&&(e.autoScrollTimer=clearTimeout(e.autoScrollTimer),e.activeAutoScroll=clearInterval(e.activeAutoScroll))}function Zy(e,t,r){let{x:n,y:a}=r;e.scrollSpeedFactor+=.004,0!==n&&function(e,t,r){let n=t.node.scrollLeft;Jy(n+Math.round(t.sense/3)*e.scrollSpeedFactor*r,"scrollLeft",t)}(e,t,n),0!==a&&function(e,t,r){let n=t.node.scrollTop;Jy(n+Math.round(t.sense/3)*e.scrollSpeedFactor*r,"scrollTop",t)}(e,t,a)}function Jy(e,t,r){r.node[t]=e}function Qy(e,t,r,n,a,o){let i={};return e&&(i.width=`${e}px`,i.minWidth=`${e}px`),t&&(i.flexGrow=t),o&&(i.height=`${o}px`),r&&(i.position="sticky",r.left&&(i.left=`${n}px`),r.right&&(i.right=`${a}px`)),i}function eb(e,t,r){let n="";if(e.fixed)for(let a in e.fixed){let r=-1===e.fixed[a];!r&&e.fixed.leftSize&&t.colspan&&(r=t.colspan+e._colindex-1===e.fixed.leftSize),n+=r?"wx-shadow ":"wx-fixed "}return n+=t.rowspan>1?"wx-rowspan ":"",n+=t.colspan>1?"wx-colspan ":"",n+=t.vertical?"wx-vertical ":"",n+=r?r(e)+" ":"",n}function tb(e){let{row:t,column:r,cellStyle:n=null,columnStyle:a=null,children:o,focusable:i}=e,s=se(Uy),l=Gv(s,"focusCell"),c=Gv(s,"search"),d=Gv(s,"reorder"),u=pe(()=>c?.rows[t.id]&&c.rows[t.id][r.id],[c,t.id,r.id]),h=pe(()=>Qy(r.width,r.flexgrow,r.fixed,r.left,r.right),[r.width,r.flexgrow,r.fixed,r.left,r.right]);let p=pe(()=>function(e,n){let a="wx-cell";return a+=r.fixed?" "+(-1===r.fixed?"wx-shadow":"wx-fixed"):"",a+=e?" "+e(r):"",a+=n?" "+n(t,r):"",a+=r.treetoggle?" wx-tree-cell":"",a}(a,n),[a,n,r,t]),m=pe(()=>"function"==typeof r.draggable?!1!==r.draggable(t,r):r.draggable,[r,t]),f=me(null);le(()=>{f.current&&i&&l?.row===t.id&&l?.column===r.id&&f.current.focus()},[l,i,t.id,r.id]);let g=ie(()=>{i&&!l&&s.exec("focus-cell",{row:t.id,column:r.id,eventSource:"focus"})},[s,i,l,t.id,r.id]);let v=pe(()=>{let e=r.fixed&&-1===r.fixed.left||-1===r.fixed.right,t=r.fixed&&r.fixed.right;return[p,e?"wx-shadow":"",t?"wx-fixed-right":""].filter(Boolean).join(" ")},[p,r]),y=r.cell;/* @__PURE__ */
87
+ return xe("div",{className:"wx-TSCaXsGV "+v,ref:f,onFocus:g,style:h,"data-row-id":Jf(t.id),"data-col-id":Jf(r.id),tabIndex:i?"0":"-1",role:"gridcell","aria-colindex":r._colindex,"aria-readonly":!r.editor||void 0,children:[d&&r.draggable?/* @__PURE__ */be("i",m?{"draggable-data":"true",className:"wx-TSCaXsGV wx-draggable wxi-drag"}:{className:"wx-TSCaXsGV wx-draggable-stub"}):null,r.treetoggle?/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be("span",{style:{marginLeft:28*t.$level+"px"}}),t.$count?/* @__PURE__ */be("i",{"data-action":"toggle-row",className:"wx-TSCaXsGV wx-table-tree-toggle wxi-menu-"+(!1===t.open?"right":"down")}):null]}):null,y?/* @__PURE__ */be(y,{api:s,row:t,column:r,onAction:({action:e,data:t})=>s.exec(e,t)}):o?o():u?/* @__PURE__ */be("span",{children:function(e){let t=RegExp(`(${c.value.trim()})`,"gi");return String(e).split(t).map(e=>({text:e,highlight:t.test(e)}))}(yy(t,r)).map(({highlight:e,text:t},r)=>e?/* @__PURE__ */be("mark",{className:"wx-TSCaXsGV wx-search",children:t},r):/* @__PURE__ */be("span",{children:t},r))}):yy(t,r)]})}function rb(e,t){let r,n;function a(n){r=n.clientX,e.style.opacity=1,document.body.style.cursor="ew-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",o),window.addEventListener("mouseup",i),t&&t.down&&t.down(e)}function o(e){n=e.clientX-r,t&&t.move&&t.move(n)}function i(){e.style.opacity="",document.body.style.cursor="",document.body.style.userSelect="",t&&t.up&&t.up(n),window.removeEventListener("mousemove",o),window.removeEventListener("mouseup",i)}return e.addEventListener("mousedown",a),{destroy(){e.removeEventListener("mousedown",a)}}}function nb(e){let{value:t,options:r=[],placeholder:n="",clear:a=!1,text:o=null,template:i=null,cell:s=null,dropdown:l={},autoOpen:c=!1,onChange:d,onAction:u}=e,[h,p]=Uv(t||[]),m=pe(()=>(h||[]).map(e=>r.find(t=>t.id===e)).filter(Boolean),[h,r]),f=me(null),g=me(null),[v,y]=fe(null),b=()=>{let e=h||[];if(!e.length)return 0;let t=r.find(t=>e.includes(t.id));return t?r.indexOf(t):0};return le(()=>{c&&(f.current?.focus(),typeof window<"u"&&window.getSelection&&window.getSelection().removeAllRanges())},[]),/* @__PURE__ */xe("div",{ref:f,className:"wx-multiselect wx-aadNNOwy",onClick:function(){g.current?.(b())},onKeyDown:function(e){v?.(e,b())},tabIndex:0,children:[
88
88
  /* @__PURE__ */be("div",{className:"wx-label wx-aadNNOwy",children:i?i(m):s?/* @__PURE__ */be(s,{data:m,onAction:u}):o?/* @__PURE__ */be("span",{className:"wx-text wx-aadNNOwy",children:o}):m.length?/* @__PURE__ */be("span",{className:"wx-text wx-aadNNOwy",children:m.map(e=>e.label).join(", ")}):n?/* @__PURE__ */be("span",{className:"wx-placeholder wx-aadNNOwy",children:n}):" "}),/* @__PURE__ */be("i",a&&h?.length?{className:"wx-icon wxi-close wx-aadNNOwy",onClick:function(e){e.stopPropagation(),p([]),d&&d({value:[]})}}:{className:"wx-icon wxi-angle-down wx-aadNNOwy"}),
89
- /* @__PURE__ */be(rv,{items:r,onReady:function(e){g.current=e.navigate,y(()=>e.keydown),c&&e.navigate(b())},onSelect:function({id:e}){p(e),d&&d({value:e})},multiselect:!0,checkboxes:!0,value:h||[],onCancel:function(){g.current?.(null)},...l,children:({option:e})=>/* @__PURE__ */be("div",{className:"wx-option wx-aadNNOwy",children:i?i(e):s?/* @__PURE__ */be(s,{data:e,onAction:u}):e.label})})]})}var cb={text:function({filter:e,column:t,action:r,filterValue:n}){/* @__PURE__ */
90
- return be(nv,{...e.config??{},value:n,onChange:function({value:e}){r({value:e,key:t.id})}})},richselect:function({filter:e,column:t,action:r,filterValue:n}){let a=Zv(se(Xy),"flatData"),o=pe(()=>e?.config?.options||t?.options||function(){let e=[];return a.forEach(r=>{let n=wy(r,t);e.includes(n)||e.push(n)}),e.map(e=>({id:e,label:e}))}(),[e,t,a]),i=pe(()=>e?.config?.template,[e]);/* @__PURE__ */
91
- return be("div",{style:{width:"100%"},onKeyDown:function(e){"Tab"!==e.key&&e.preventDefault()},children:/* @__PURE__ */be(yv,{placeholder:"",clear:!0,...e?.config??{},options:o,value:n,onChange:function({value:e}){r({value:e,key:t.id})},children:e=>i?i(e):e.label})})},datepicker:function({filter:e,column:t,action:r,filterValue:n}){/* @__PURE__ */
92
- return be("div",{className:"wx-aaaK5VYO",style:{width:"100%"},children:/* @__PURE__ */be(vv,{placeholder:"",clear:!0,...e?.config??{},value:n,onChange:function({value:e}){r({value:e,key:t.id})}})})},multiselect:function({filter:e,column:t,action:r,filterValue:n}){let a=se(Ug.i18n)?.getGroup("grid")||Bg(Tv).getGroup("grid"),o=pe(()=>({clear:!0,...e?.config||{}}),[e]),i=pe(()=>o.options||t.options,[o,t]),s=pe(()=>{let e=n?.length;return e?e<3?n.map(e=>t.optionsMap.get(e)).join(", "):e+" "+a("selected"):""},[n,t,a]);/* @__PURE__ */
93
- return be("div",{style:{width:"100%"},onKeyDown:function(e){"Tab"!==e.key&&e.preventDefault()},children:/* @__PURE__ */be(lb,{placeholder:"",...o,options:i,value:n||[],text:s,onChange:function({value:e}){r({value:e,key:t.id})}})})}};function db({filter:e,column:t}){let r=se(Xy),n=Zv(r,"filterValues");let a=pe(()=>cb[e.type],[e.type]);/* @__PURE__ */
94
- return be(a,{filter:e,column:t,action:function(e){r.exec("filter-rows",e)},filterValue:n[t.id]})}function ub(e){let{cell:t,column:r,row:n,lastRow:a,sortRow:o,columnStyle:i,bodyHeight:s,hasSplit:l}=e,c=se(Xy),d=Zv(c,"sortMarks"),u=pe(()=>d?d[r.id]:void 0,[d,r.id]),h=me(),p=ie(e=>{h.current=t.flexgrow?e.parentNode.clientWidth:t.width},[t.flexgrow,t.width]),m=ie((e,r)=>{c.exec("resize-column",{id:t.id,width:Math.max(1,(h.current||0)+e),inProgress:r})},[c,t.id]),f=ie(e=>m(e,!0),[m]),g=ie(e=>m(e,!1),[m]),v=ie(e=>{if(!r.sort||t.filter)return;let n=u?.order;n&&="asc"===n?"desc":"asc",c.exec("sort-rows",{key:t.id,add:e.ctrlKey||e.metaKey,order:n})},[c,t.id,t.filter,r.sort,u?.order]),y=ie(e=>{e&&e.stopPropagation(),c.exec("collapse-column",{id:t.id,row:n})},[c,t.id,n]),b=ie(e=>{"Enter"===e.key&&y()},[y]),x=ie(e=>{"Enter"===e.key&&!t.filter&&v(e)},[v,t.filter]),w=pe(()=>t.collapsed&&r.collapsed,[t.collapsed,r.collapsed]),S=pe(()=>w&&!l&&"header"!==t.collapsible,[w,l,t.collapsible]),k=pe(()=>S?{top:-s/2,position:"absolute"}:{},[S,s]),C=pe(()=>ab(t.width,t.flexgrow,r.fixed,r.left,t.right??r.right,t.height+(w&&S?s:0)),[t.width,t.flexgrow,r.fixed,r.left,t.right,r.right,t.height,w,S,s]),N=pe(()=>ob(r,t,i),[r,t,i]),T=ie(()=>Object.fromEntries(Object.entries(t).filter(([e])=>"cell"!==e)),[t]),A=`wx-cell ${N} ${t.css||""} wx-collapsed`,M=["wx-cell",N,t.css||"",t.filter?"wx-filter":"",r.fixed&&r.fixed.right?"wx-fixed-right":""].filter(Boolean).join(" "),D=me(null);return le(()=>{let e=D.current;if(!e)return;let t=sb(e,{down:p,move:f,up:g});return()=>{"function"==typeof t&&t()}},[p,f,g,sb]),w?/* @__PURE__ */be("div",{className:"wx-RsQD74qC "+A,style:C,role:"button","aria-label":`Expand column ${t.text||""}`,"aria-expanded":!t.collapsed,tabIndex:0,onKeyDown:b,onClick:y,"data-header-id":ng(r.id),children:/* @__PURE__ */be("div",{className:"wx-RsQD74qC wx-text",style:k,children:t.text||""})}):/* @__PURE__ */xe("div",{className:"wx-RsQD74qC "+M,style:C,onClick:v,"data-header-id":ng(r.id),tabIndex:t._hidden||!r.sort||t.filter?void 0:0,role:"columnheader","aria-colindex":r._colindex,"aria-colspan":t.colspan>1?t.colspan:void 0,"aria-rowspan":t.rowspan>1?t.rowspan:void 0,"aria-sort":!u?.order||t.filter?"none":"asc"===u?.order?"ascending":"descending",onKeyDown:x,children:[t.collapsible?/* @__PURE__ */be("div",{className:"wx-RsQD74qC wx-collapse",role:"button","aria-label":t.collapsed?"Expand column":"Collapse column","aria-expanded":!t.collapsed,tabIndex:0,onKeyDown:b,onClick:y,children:/* @__PURE__ */be("i",{className:"wx-RsQD74qC wxi-angle-"+(t.collapsed?"down":"right")})}):null,t.cell?(()=>{let e=t.cell;/* @__PURE__ */
95
- return be(e,{api:c,cell:T(),column:r,row:n,onAction:({action:e,data:t})=>c.exec(e,t)})})():t.filter?/* @__PURE__ */be(db,{filter:t.filter,column:r}):/* @__PURE__ */be("div",{className:"wx-RsQD74qC wx-text",children:t.text||""}),r.resize&&a&&!t._hidden?/* @__PURE__ */be("div",{className:"wx-RsQD74qC wx-grip",role:"presentation","aria-label":"Resize column",ref:D,onClick:e=>e.stopPropagation(),children:/* @__PURE__ */be("div",{})}):null,o?/* @__PURE__ */be("div",{className:"wx-RsQD74qC wx-sort",children:u?/* @__PURE__ */xe(ye,{children:[typeof u.index<"u"?/* @__PURE__ */be("div",{className:"wx-RsQD74qC wx-order",children:u.index+1}):null,/* @__PURE__ */be("i",{className:"wx-RsQD74qC wxi-arrow-"+("asc"===u.order?"up":"down")})]}):null}):null]})}function hb({cell:e,column:t,row:r,columnStyle:n}){let a=se(Xy),o=pe(()=>ab(e?.width,e?.flexgrow,t?.fixed,t?.left,e?.right??t?.right,e?.height),[e?.width,e?.flexgrow,t?.fixed,t?.left,e?.right,t?.right,e?.height]),i=pe(()=>ob(t,e,n),[t,e,n]),s=ie(()=>Object.fromEntries(Object.entries(e||{}).filter(([e])=>"cell"!==e)),[e]),l=`wx-6Sdi3Dfd wx-cell ${i||""} ${e?.css||""}`+(t?.fixed&&t?.fixed.right?" wx-fixed-right":"");/* @__PURE__ */
96
- return be("div",{className:l,style:o,children:t?.collapsed||e?.collapsed?null:e?.cell?Z.createElement(e.cell,{api:a,cell:s(),column:t,row:r,onAction:({action:e,data:t})=>a.exec(e,t)}):/* @__PURE__ */be("div",{className:"wx-6Sdi3Dfd wx-text",children:e?.text||""})})}function pb({deltaLeft:e,contentWidth:t,columns:r,type:n="header",columnStyle:a,bodyHeight:o}){let i=se(Xy),s=Zv(i,"_sizes"),l=Zv(i,"split"),c=pe(()=>s?.[`${n}RowHeights`],[s,n]),d=pe(()=>{let e=[];if(r&&r.length){let t=r[0][n].length;for(let a=0;a<t;a++){let t=0;e.push([]),r.forEach((r,o)=>{let i={...r[n][a]};t||e[a].push(i),i.colspan>1?t=i.colspan-1:t&&t--})}}return e},[r,n]),u=pe(()=>l?.left||l?.right,[l]);function h(e){return r.find(t=>t.id===e)}function p(e,t){let r=t;return e.rowspan&&(r+=e.rowspan-1),r===d.length-1}function m(e,t,r){if(!r.sort)return!1;for(let n=d.length-1;n>=0;n--){let e=r.header[n];if(!e.filter&&!e._hidden)return t===n}return p(e,t)}/* @__PURE__ */
97
- return be("div",{className:`wx-sAsPVaUK wx-${n}`,style:{paddingLeft:`${e}px`,width:`${t}px`},role:"rowgroup",children:d.map((e,t)=>/* @__PURE__ */be("div",{className:"header"===n?"wx-sAsPVaUK wx-h-row":"wx-sAsPVaUK wx-f-row",style:{height:`${c?.[t]}px`,display:"flex"},role:"row",children:e.map(e=>{let r=h(e.id);return"header"===n?/* @__PURE__ */be(ub,{cell:e,columnStyle:a,column:r,row:t,lastRow:p(e,t),bodyHeight:o,sortRow:m(e,t,r),hasSplit:u},e.id):/* @__PURE__ */be(hb,{cell:e,columnStyle:a,column:h(e.id),row:t},e.id)})},t))})}function mb({overlay:e}){let t=se(Xy);let r=e;/* @__PURE__ */
98
- return be("div",{className:"wx-1ty666CQ wx-overlay",children:function(e){return"function"==typeof e}(e)?/* @__PURE__ */be(r,{onAction:({action:e,data:r})=>t.exec(e,r)}):e})}var fb={text:function(e){let{editor:t,onSave:r,onApply:n}=e,[a,o]=fe(t?.value||""),{type:i="text"}=pe(()=>t?.config||{},[t]),s=me(null);return le(()=>{s.current&&s.current.focus()},[]),le(()=>{if(!s.current)return;let e=fg(s.current,()=>r(!0));return()=>e.destroy()},[r]),/* @__PURE__ */be("input",{className:"wx-e7Ao5ejY wx-text",onInput:function(){s.current&&(o(s.current.value),n(s.current.value))},onKeyDown:function({key:e}){"Enter"===e&&r()},ref:s,type:i,value:a})},combo:function({editor:e,onAction:t,onSave:r,onApply:n,onCancel:a}){let[o,i]=fe(e?.value),[s,l]=fe(e?.renderedValue),[c,d]=fe(e?.options||[]),u=pe(()=>e?.config?.template,[e]),h=pe(()=>e?.config?.cell,[e]),p=pe(()=>e?.config?.dropdown||{},[e]),m=pe(()=>({trackScroll:!0,...p}),[p]),f=pe(()=>(c||[]).findIndex(e=>e.id===o),[c,o]),g=me(null),v=me(null),y=ie(e=>{g.current=e.navigate,v.current=e.keydown,g.current(f)},[f,g]),b=ie(t=>{let r=t?.target?.value??"";l(r);let n=r?(e?.options||[]).filter(e=>(e.label||"").toLowerCase().includes(r.toLowerCase())):e?.options||[];d(n),n.length?g.current(-1/0):g.current(null)},[e]),x=me(null);le(()=>{x.current&&x.current.focus()},[]);let w=me(r);le(()=>{w.current=r},[r]),le(()=>{if(!x.current)return;let e=fg(x.current,()=>w.current(!0));return()=>e.destroy()},[]),le(()=>{i(e?.value),l(e?.renderedValue),d(e?.options||[])},[e]);let S=ie(({id:e})=>{n(e),r()},[n,r]);/* @__PURE__ */
99
- return xe(ye,{children:[/* @__PURE__ */be("input",{className:"wx-0UYfSd1x wx-input",ref:x,value:s??"",onChange:b,onKeyDown:e=>v.current?v.current(e,f):void 0}),/* @__PURE__ */be(rv,{items:c,onReady:y,onSelect:S,...m,onCancel:a,children:({option:e})=>u?u(e):h?/* @__PURE__ */be(h,{data:e,onAction:t}):e.label})]})},datepicker:function({editor:e,onAction:t,onSave:r,onApply:n,onCancel:a}){let[o]=fe(()=>e.value||/* @__PURE__ */new Date),{template:i,cell:s,dropdown:l={}}=e?.config||{},c=pe(()=>({trackScroll:!0,width:"auto",...l}),[l]),d=me(null),[u,h]=fe(null);return le(()=>{d.current&&d.current.focus(),typeof window<"u"&&window.getSelection&&window.getSelection().removeAllRanges()},[]),le(()=>{if(!u)return;let e=fg(u,()=>r(!0));return()=>e.destroy()},[u,r]),/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be("div",{className:"wx-lNWNYUb6 wx-value",ref:d,tabIndex:0,onClick:a,onKeyDown:e=>e.preventDefault(),children:i?i(o):s?/* @__PURE__ */be(s,{data:e.value,onAction:t}):/* @__PURE__ */be("span",{className:"wx-lNWNYUb6 wx-text",children:e.renderedValue})}),/* @__PURE__ */be(Jg,{...c,onCancel:a,children:/* @__PURE__ */be("div",{ref:h,className:"wx-lNWNYUb6",children:/* @__PURE__ */be(mv,{value:o,onChange:function({value:e}){n(e),r()},buttons:e.config?.buttons})})})]})},richselect:function(e){let t,{editor:r}=e,n=e.onAction??e.onaction,a=e.onSave??e.onsave,o=e.onApply??e.onapply,i=e.onCancel??e.oncancel,s=r.config||{},{dropdown:l={}}=s,c=pe(()=>({trackScroll:!0,...l}),[l]),[d]=fe(r.options.find(e=>e.id===r.value)),[u]=fe(r.value),[h]=fe(r.options),p=pe(()=>h.findIndex(e=>e.id===u),[h,u]),[m,f]=fe(),g=me(null);return le(()=>{g.current&&g.current.focus(),typeof window<"u"&&window.getSelection&&window.getSelection().removeAllRanges()},[]),le(()=>{if(!g.current)return;let e=fg(g.current,()=>a(!0));return()=>e.destroy()},[a]),/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be("div",{ref:g,className:"wx-ywGRk611 wx-value",tabIndex:0,onClick:i,onKeyDown:e=>{m(e,p),e.preventDefault()},children:s.template?s.template(d):s.cell?(()=>{let e=s.cell;/* @__PURE__ */
100
- return be(e,{data:d,onAction:n})})():/* @__PURE__ */be("span",{className:"wx-ywGRk611 wx-text",children:r.renderedValue})}),/* @__PURE__ */be(rv,{items:h,onReady:function(e){t=e.navigate,f(()=>e.keydown),t(p)},onSelect:function({id:e}){o(e),a()},...c,onCancel:i,children:({option:e})=>s.template?s.template(e):s.cell?(()=>{let t=s.cell;/* @__PURE__ */
101
- return be(t,{data:e,onAction:n})})():e.label})]})},multiselect:function(e){let{editor:t,onAction:r,onSave:n,onApply:a}=e,o=t?.config||{},i=t?.options??[],s=t?.value||[],l=t?.renderedValue,c=pe(()=>({trackScroll:!0,...o.dropdown||{}}),[o]),d=me(null);return le(()=>{if(!d.current)return;let e=fg(d.current,()=>n(!0));return()=>e.destroy()},[n]),/* @__PURE__ */be("div",{ref:d,className:"wx-value wx-aacZ4gNU",onClick:()=>n(!0),children:/* @__PURE__ */be(lb,{value:s,options:i,text:l,template:o.template,cell:o.cell,clear:o.clear,dropdown:c,autoOpen:!0,onChange:function({value:e}){a(e)},onAction:r})})}};function gb({column:e,row:t}){let r=se(Xy),n=Zv(r,"editor"),a=ie((e,t)=>{r.exec("close-editor",{ignore:e}),t&&r.exec("focus-cell",{...t,eventSource:"click"})},[r]),o=ie(e=>{a(!1,e?null:{row:n?.id,column:n?.column})},[n,a]),i=ie(()=>{a(!0,{row:n?.id,column:n?.column})},[n,a]),s=ie(e=>{r.exec("editor",{value:e})},[r]),l=ie(t=>{"Enter"===t.key&&n&&("multiselect"===e.editor.type?s(n.value):i())},[n,e.editor,i,s]),c=pe(()=>ab(e.width,e.flexgrow,e.fixed,e.left,e.right),[e.width,e.flexgrow,e.fixed,e.left,e.right]),d=pe(()=>{let r=e.editor;return"function"==typeof r&&(r=r(t,e)),r?fb["string"==typeof r?r:r.type]:null},[e,t]),u=me(null);le(()=>{u.current&&"string"==typeof c&&u.current.setAttribute("style",c)},[c]);let h=typeof t.$parent<"u"?"gridcell":"cell",p=typeof t.$parent<"u"?!e.editor:void 0;/* @__PURE__ */
102
- return be("div",{className:"wx-8l724t2g wx-cell wx-editor",ref:u,style:"object"==typeof c&&c?c:void 0,role:h,"aria-readonly":p,tabIndex:-1,onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),onKeyDown:l,children:d?/* @__PURE__ */be(d,{editor:n,onSave:o,onApply:s,onCancel:i,onAction:({action:e,data:t})=>r.exec(e,t)}):null})}function vb(e){let{columns:t,type:r,columnStyle:n}=e,a=se(Xy),{filterValues:o,_columns:i,_sizes:s}=a.getState();function l(e){return n?" "+n(e):""}/* @__PURE__ */
89
+ /* @__PURE__ */be(Zg,{items:r,onReady:function(e){g.current=e.navigate,y(()=>e.keydown),c&&e.navigate(b())},onSelect:function({id:e}){p(e),d&&d({value:e})},multiselect:!0,checkboxes:!0,value:h||[],onCancel:function(){g.current?.(null)},...l,children:({option:e})=>/* @__PURE__ */be("div",{className:"wx-option wx-aadNNOwy",children:i?i(e):s?/* @__PURE__ */be(s,{data:e,onAction:u}):e.label})})]})}var ab={text:function({filter:e,column:t,action:r,filterValue:n}){/* @__PURE__ */
90
+ return be(Jg,{...e.config??{},value:n,onChange:function({value:e}){r({value:e,key:t.id})}})},richselect:function({filter:e,column:t,action:r,filterValue:n}){let a=Gv(se(Uy),"flatData"),o=pe(()=>e?.config?.options||t?.options||function(){let e=[];return a.forEach(r=>{let n=gy(r,t);e.includes(n)||e.push(n)}),e.map(e=>({id:e,label:e}))}(),[e,t,a]),i=pe(()=>e?.config?.template,[e]);/* @__PURE__ */
91
+ return be("div",{style:{width:"100%"},onKeyDown:function(e){"Tab"!==e.key&&e.preventDefault()},children:/* @__PURE__ */be(pv,{placeholder:"",clear:!0,...e?.config??{},options:o,value:n,onChange:function({value:e}){r({value:e,key:t.id})},children:e=>i?i(e):e.label})})},datepicker:function({filter:e,column:t,action:r,filterValue:n}){/* @__PURE__ */
92
+ return be("div",{className:"wx-aaaK5VYO",style:{width:"100%"},children:/* @__PURE__ */be(hv,{placeholder:"",clear:!0,...e?.config??{},value:n,onChange:function({value:e}){r({value:e,key:t.id})}})})},multiselect:function({filter:e,column:t,action:r,filterValue:n}){let a=se(Vg.i18n)?.getGroup("grid")||_g(wv).getGroup("grid"),o=pe(()=>({clear:!0,...e?.config||{}}),[e]),i=pe(()=>o.options||t.options,[o,t]),s=pe(()=>{let e=n?.length;return e?e<3?n.map(e=>t.optionsMap.get(e)).join(", "):e+" "+a("selected"):""},[n,t,a]);/* @__PURE__ */
93
+ return be("div",{style:{width:"100%"},onKeyDown:function(e){"Tab"!==e.key&&e.preventDefault()},children:/* @__PURE__ */be(nb,{placeholder:"",...o,options:i,value:n||[],text:s,onChange:function({value:e}){r({value:e,key:t.id})}})})}};function ob({filter:e,column:t}){let r=se(Uy),n=Gv(r,"filterValues");let a=pe(()=>ab[e.type],[e.type]);/* @__PURE__ */
94
+ return be(a,{filter:e,column:t,action:function(e){r.exec("filter-rows",e)},filterValue:n[t.id]})}function ib(e){let{cell:t,column:r,row:n,lastRow:a,sortRow:o,columnStyle:i,bodyHeight:s,hasSplit:l}=e,c=se(Uy),d=Gv(c,"sortMarks"),u=pe(()=>d?d[r.id]:void 0,[d,r.id]),h=me(),p=ie(e=>{h.current=t.flexgrow?e.parentNode.clientWidth:t.width},[t.flexgrow,t.width]),m=ie((e,r)=>{c.exec("resize-column",{id:t.id,width:Math.max(1,(h.current||0)+e),inProgress:r})},[c,t.id]),f=ie(e=>m(e,!0),[m]),g=ie(e=>m(e,!1),[m]),v=ie(e=>{if(!r.sort||t.filter)return;let n=u?.order;n&&="asc"===n?"desc":"asc",c.exec("sort-rows",{key:t.id,add:e.ctrlKey||e.metaKey,order:n})},[c,t.id,t.filter,r.sort,u?.order]),y=ie(e=>{e&&e.stopPropagation(),c.exec("collapse-column",{id:t.id,row:n})},[c,t.id,n]),b=ie(e=>{"Enter"===e.key&&y()},[y]),x=ie(e=>{"Enter"===e.key&&!t.filter&&v(e)},[v,t.filter]),w=pe(()=>t.collapsed&&r.collapsed,[t.collapsed,r.collapsed]),S=pe(()=>w&&!l&&"header"!==t.collapsible,[w,l,t.collapsible]),k=pe(()=>S?{top:-s/2,position:"absolute"}:{},[S,s]),C=pe(()=>Qy(t.width,t.flexgrow,r.fixed,r.left,t.right??r.right,t.height+(w&&S?s:0)),[t.width,t.flexgrow,r.fixed,r.left,t.right,r.right,t.height,w,S,s]),N=pe(()=>eb(r,t,i),[r,t,i]),T=ie(()=>Object.fromEntries(Object.entries(t).filter(([e])=>"cell"!==e)),[t]),A=`wx-cell ${N} ${t.css||""} wx-collapsed`,M=["wx-cell",N,t.css||"",t.filter?"wx-filter":"",r.fixed&&r.fixed.right?"wx-fixed-right":""].filter(Boolean).join(" "),D=me(null);return le(()=>{let e=D.current;if(!e)return;let t=rb(e,{down:p,move:f,up:g});return()=>{"function"==typeof t&&t()}},[p,f,g,rb]),w?/* @__PURE__ */be("div",{className:"wx-RsQD74qC "+A,style:C,role:"button","aria-label":`Expand column ${t.text||""}`,"aria-expanded":!t.collapsed,tabIndex:0,onKeyDown:b,onClick:y,"data-header-id":Jf(r.id),children:/* @__PURE__ */be("div",{className:"wx-RsQD74qC wx-text",style:k,children:t.text||""})}):/* @__PURE__ */xe("div",{className:"wx-RsQD74qC "+M,style:C,onClick:v,"data-header-id":Jf(r.id),tabIndex:t._hidden||!r.sort||t.filter?void 0:0,role:"columnheader","aria-colindex":r._colindex,"aria-colspan":t.colspan>1?t.colspan:void 0,"aria-rowspan":t.rowspan>1?t.rowspan:void 0,"aria-sort":!u?.order||t.filter?"none":"asc"===u?.order?"ascending":"descending",onKeyDown:x,children:[t.collapsible?/* @__PURE__ */be("div",{className:"wx-RsQD74qC wx-collapse",role:"button","aria-label":t.collapsed?"Expand column":"Collapse column","aria-expanded":!t.collapsed,tabIndex:0,onKeyDown:b,onClick:y,children:/* @__PURE__ */be("i",{className:"wx-RsQD74qC wxi-angle-"+(t.collapsed?"down":"right")})}):null,t.cell?(()=>{let e=t.cell;/* @__PURE__ */
95
+ return be(e,{api:c,cell:T(),column:r,row:n,onAction:({action:e,data:t})=>c.exec(e,t)})})():t.filter?/* @__PURE__ */be(ob,{filter:t.filter,column:r}):/* @__PURE__ */be("div",{className:"wx-RsQD74qC wx-text",children:t.text||""}),r.resize&&a&&!t._hidden?/* @__PURE__ */be("div",{className:"wx-RsQD74qC wx-grip",role:"presentation","aria-label":"Resize column",ref:D,onClick:e=>e.stopPropagation(),children:/* @__PURE__ */be("div",{})}):null,o?/* @__PURE__ */be("div",{className:"wx-RsQD74qC wx-sort",children:u?/* @__PURE__ */xe(ye,{children:[typeof u.index<"u"?/* @__PURE__ */be("div",{className:"wx-RsQD74qC wx-order",children:u.index+1}):null,/* @__PURE__ */be("i",{className:"wx-RsQD74qC wxi-arrow-"+("asc"===u.order?"up":"down")})]}):null}):null]})}function sb({cell:e,column:t,row:r,columnStyle:n}){let a=se(Uy),o=pe(()=>Qy(e?.width,e?.flexgrow,t?.fixed,t?.left,e?.right??t?.right,e?.height),[e?.width,e?.flexgrow,t?.fixed,t?.left,e?.right,t?.right,e?.height]),i=pe(()=>eb(t,e,n),[t,e,n]),s=ie(()=>Object.fromEntries(Object.entries(e||{}).filter(([e])=>"cell"!==e)),[e]),l=`wx-6Sdi3Dfd wx-cell ${i||""} ${e?.css||""}`+(t?.fixed&&t?.fixed.right?" wx-fixed-right":"");/* @__PURE__ */
96
+ return be("div",{className:l,style:o,children:t?.collapsed||e?.collapsed?null:e?.cell?Z.createElement(e.cell,{api:a,cell:s(),column:t,row:r,onAction:({action:e,data:t})=>a.exec(e,t)}):/* @__PURE__ */be("div",{className:"wx-6Sdi3Dfd wx-text",children:e?.text||""})})}function lb({deltaLeft:e,contentWidth:t,columns:r,type:n="header",columnStyle:a,bodyHeight:o}){let i=se(Uy),s=Gv(i,"_sizes"),l=Gv(i,"split"),c=pe(()=>s?.[`${n}RowHeights`],[s,n]),d=pe(()=>{let e=[];if(r&&r.length){let t=r[0][n].length;for(let a=0;a<t;a++){let t=0;e.push([]),r.forEach((r,o)=>{let i={...r[n][a]};t||e[a].push(i),i.colspan>1?t=i.colspan-1:t&&t--})}}return e},[r,n]),u=pe(()=>l?.left||l?.right,[l]);function h(e){return r.find(t=>t.id===e)}function p(e,t){let r=t;return e.rowspan&&(r+=e.rowspan-1),r===d.length-1}function m(e,t,r){if(!r.sort)return!1;for(let n=d.length-1;n>=0;n--){let e=r.header[n];if(!e.filter&&!e._hidden)return t===n}return p(e,t)}/* @__PURE__ */
97
+ return be("div",{className:`wx-sAsPVaUK wx-${n}`,style:{paddingLeft:`${e}px`,width:`${t}px`},role:"rowgroup",children:d.map((e,t)=>/* @__PURE__ */be("div",{className:"header"===n?"wx-sAsPVaUK wx-h-row":"wx-sAsPVaUK wx-f-row",style:{height:`${c?.[t]}px`,display:"flex"},role:"row",children:e.map(e=>{let r=h(e.id);return"header"===n?/* @__PURE__ */be(ib,{cell:e,columnStyle:a,column:r,row:t,lastRow:p(e,t),bodyHeight:o,sortRow:m(e,t,r),hasSplit:u},e.id):/* @__PURE__ */be(sb,{cell:e,columnStyle:a,column:h(e.id),row:t},e.id)})},t))})}function cb({overlay:e}){let t=se(Uy);let r=e;/* @__PURE__ */
98
+ return be("div",{className:"wx-1ty666CQ wx-overlay",children:function(e){return"function"==typeof e}(e)?/* @__PURE__ */be(r,{onAction:({action:e,data:r})=>t.exec(e,r)}):e})}var db={text:function(e){let{editor:t,onSave:r,onApply:n}=e,[a,o]=fe(t?.value||""),{type:i="text"}=pe(()=>t?.config||{},[t]),s=me(null);return le(()=>{s.current&&s.current.focus()},[]),le(()=>{if(!s.current)return;let e=dg(s.current,()=>r(!0));return()=>e.destroy()},[r]),/* @__PURE__ */be("input",{className:"wx-e7Ao5ejY wx-text",onInput:function(){s.current&&(o(s.current.value),n(s.current.value))},onKeyDown:function({key:e}){"Enter"===e&&r()},ref:s,type:i,value:a})},combo:function({editor:e,onAction:t,onSave:r,onApply:n,onCancel:a}){let[o,i]=fe(e?.value),[s,l]=fe(e?.renderedValue),[c,d]=fe(e?.options||[]),u=pe(()=>e?.config?.template,[e]),h=pe(()=>e?.config?.cell,[e]),p=pe(()=>e?.config?.dropdown||{},[e]),m=pe(()=>({trackScroll:!0,...p}),[p]),f=pe(()=>(c||[]).findIndex(e=>e.id===o),[c,o]),g=me(null),v=me(null),y=ie(e=>{g.current=e.navigate,v.current=e.keydown,g.current(f)},[f,g]),b=ie(t=>{let r=t?.target?.value??"";l(r);let n=r?(e?.options||[]).filter(e=>(e.label||"").toLowerCase().includes(r.toLowerCase())):e?.options||[];d(n),n.length?g.current(-1/0):g.current(null)},[e]),x=me(null);le(()=>{x.current&&x.current.focus()},[]);let w=me(r);le(()=>{w.current=r},[r]),le(()=>{if(!x.current)return;let e=dg(x.current,()=>w.current(!0));return()=>e.destroy()},[]),le(()=>{i(e?.value),l(e?.renderedValue),d(e?.options||[])},[e]);let S=ie(({id:e})=>{n(e),r()},[n,r]);/* @__PURE__ */
99
+ return xe(ye,{children:[/* @__PURE__ */be("input",{className:"wx-0UYfSd1x wx-input",ref:x,value:s??"",onChange:b,onKeyDown:e=>v.current?v.current(e,f):void 0}),/* @__PURE__ */be(Zg,{items:c,onReady:y,onSelect:S,...m,onCancel:a,children:({option:e})=>u?u(e):h?/* @__PURE__ */be(h,{data:e,onAction:t}):e.label})]})},datepicker:function({editor:e,onAction:t,onSave:r,onApply:n,onCancel:a}){let[o]=fe(()=>e.value||/* @__PURE__ */new Date),{template:i,cell:s,dropdown:l={}}=e?.config||{},c=pe(()=>({trackScroll:!0,width:"auto",...l}),[l]),d=me(null),[u,h]=fe(null);return le(()=>{d.current&&d.current.focus(),typeof window<"u"&&window.getSelection&&window.getSelection().removeAllRanges()},[]),le(()=>{if(!u)return;let e=dg(u,()=>r(!0));return()=>e.destroy()},[u,r]),/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be("div",{className:"wx-lNWNYUb6 wx-value",ref:d,tabIndex:0,onClick:a,onKeyDown:e=>e.preventDefault(),children:i?i(o):s?/* @__PURE__ */be(s,{data:e.value,onAction:t}):/* @__PURE__ */be("span",{className:"wx-lNWNYUb6 wx-text",children:e.renderedValue})}),/* @__PURE__ */be(Wg,{...c,onCancel:a,children:/* @__PURE__ */be("div",{ref:h,className:"wx-lNWNYUb6",children:/* @__PURE__ */be(cv,{value:o,onChange:function({value:e}){n(e),r()},buttons:e.config?.buttons})})})]})},richselect:function(e){let t,{editor:r}=e,n=e.onAction??e.onaction,a=e.onSave??e.onsave,o=e.onApply??e.onapply,i=e.onCancel??e.oncancel,s=r.config||{},{dropdown:l={}}=s,c=pe(()=>({trackScroll:!0,...l}),[l]),[d]=fe(r.options.find(e=>e.id===r.value)),[u]=fe(r.value),[h]=fe(r.options),p=pe(()=>h.findIndex(e=>e.id===u),[h,u]),[m,f]=fe(),g=me(null);return le(()=>{g.current&&g.current.focus(),typeof window<"u"&&window.getSelection&&window.getSelection().removeAllRanges()},[]),le(()=>{if(!g.current)return;let e=dg(g.current,()=>a(!0));return()=>e.destroy()},[a]),/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be("div",{ref:g,className:"wx-ywGRk611 wx-value",tabIndex:0,onClick:i,onKeyDown:e=>{m(e,p),e.preventDefault()},children:s.template?s.template(d):s.cell?(()=>{let e=s.cell;/* @__PURE__ */
100
+ return be(e,{data:d,onAction:n})})():/* @__PURE__ */be("span",{className:"wx-ywGRk611 wx-text",children:r.renderedValue})}),/* @__PURE__ */be(Zg,{items:h,onReady:function(e){t=e.navigate,f(()=>e.keydown),t(p)},onSelect:function({id:e}){o(e),a()},...c,onCancel:i,children:({option:e})=>s.template?s.template(e):s.cell?(()=>{let t=s.cell;/* @__PURE__ */
101
+ return be(t,{data:e,onAction:n})})():e.label})]})},multiselect:function(e){let{editor:t,onAction:r,onSave:n,onApply:a}=e,o=t?.config||{},i=t?.options??[],s=t?.value||[],l=t?.renderedValue,c=pe(()=>({trackScroll:!0,...o.dropdown||{}}),[o]),d=me(null);return le(()=>{if(!d.current)return;let e=dg(d.current,()=>n(!0));return()=>e.destroy()},[n]),/* @__PURE__ */be("div",{ref:d,className:"wx-value wx-aacZ4gNU",onClick:()=>n(!0),children:/* @__PURE__ */be(nb,{value:s,options:i,text:l,template:o.template,cell:o.cell,clear:o.clear,dropdown:c,autoOpen:!0,onChange:function({value:e}){a(e)},onAction:r})})}};function ub({column:e,row:t}){let r=se(Uy),n=Gv(r,"editor"),a=ie((e,t)=>{r.exec("close-editor",{ignore:e}),t&&r.exec("focus-cell",{...t,eventSource:"click"})},[r]),o=ie(e=>{a(!1,e?null:{row:n?.id,column:n?.column})},[n,a]),i=ie(()=>{a(!0,{row:n?.id,column:n?.column})},[n,a]),s=ie(e=>{r.exec("editor",{value:e})},[r]),l=ie(t=>{"Enter"===t.key&&n&&("multiselect"===e.editor.type?s(n.value):i())},[n,e.editor,i,s]),c=pe(()=>Qy(e.width,e.flexgrow,e.fixed,e.left,e.right),[e.width,e.flexgrow,e.fixed,e.left,e.right]),d=pe(()=>{let r=e.editor;return"function"==typeof r&&(r=r(t,e)),r?db["string"==typeof r?r:r.type]:null},[e,t]),u=me(null);le(()=>{u.current&&"string"==typeof c&&u.current.setAttribute("style",c)},[c]);let h=typeof t.$parent<"u"?"gridcell":"cell",p=typeof t.$parent<"u"?!e.editor:void 0;/* @__PURE__ */
102
+ return be("div",{className:"wx-8l724t2g wx-cell wx-editor",ref:u,style:"object"==typeof c&&c?c:void 0,role:h,"aria-readonly":p,tabIndex:-1,onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),onKeyDown:l,children:d?/* @__PURE__ */be(d,{editor:n,onSave:o,onApply:s,onCancel:i,onAction:({action:e,data:t})=>r.exec(e,t)}):null})}function hb(e){let{columns:t,type:r,columnStyle:n}=e,a=se(Uy),{filterValues:o,_columns:i,_sizes:s}=a.getState();function l(e){return n?" "+n(e):""}/* @__PURE__ */
103
103
  return be(ye,{children:t.map((e,t)=>/* @__PURE__ */be("tr",{children:e.map(e=>{let n=i.find(t=>t.id===e.id),c=`wx-print-cell-${r}${l(n)}${e.filter?" wx-print-cell-filter":""}${e.vertical?" wx-vertical":""}`,d=e.cell;/* @__PURE__ */
104
- return be("th",{style:Qv(My(e,s.columnWidth)),className:"wx-Gy81xq2u "+c,rowSpan:e.rowspan,colSpan:e.colspan,children:d?/* @__PURE__ */be(d,{api:a,cell:Object.fromEntries(Object.entries(e).filter(([e])=>"cell"!==e)),column:n,row:t}):e.filter?/* @__PURE__ */be("div",{className:"wx-Gy81xq2u wx-print-filter",children:Dy(o,i,e)}):/* @__PURE__ */be("div",{className:"wx-Gy81xq2u wx-text",children:e.text??""})},e.id)})},t))})}function yb(e){let{columns:t,rowStyle:r,columnStyle:n,cellStyle:a,header:o,footer:i,reorder:s}=e,l=se(Xy),{flatData:c,_sizes:d}=l.getState(),u=o&&Ay(t,"header",d.headerRowHeights),h=i&&Ay(t,"footer",d.footerRowHeights);function p(e,t){let r="";return r+=n?" "+n(t):"",r+=a?" "+a(e,t):"",r}function m(e,t){return"function"==typeof t.draggable?!1!==t.draggable(e,t):t.draggable}/* @__PURE__ */
105
- return xe("table",{className:"wx-8NTMLH0z wx-print-grid "+(t.some(e=>e.flexgrow)?"wx-flex-columns":""),children:[o?/* @__PURE__ */be("thead",{children:/* @__PURE__ */be(vb,{columns:u,type:"header",columnStyle:n})}):null,
106
- /* @__PURE__ */be("tbody",{children:c.map((e,n)=>/* @__PURE__ */be("tr",{className:"wx-8NTMLH0z wx-row"+(r?" "+r(e):""),style:{height:`${e.rowHeight||d.rowHeight}px`},children:t.map(t=>t.collapsed?null:/* @__PURE__ */xe("td",{className:`wx-8NTMLH0z wx-print-cell wx-cell ${p(e,t)}`,style:Qv(My(t,d.columnWidth)),children:[s&&t.draggable?/* @__PURE__ */be("span",{className:"wx-8NTMLH0z wx-print-draggable",children:m(e,t)?/* @__PURE__ */be("i",{className:"wx-8NTMLH0z wxi-drag"}):null}):null,t.treetoggle?/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be("span",{style:{marginLeft:28*e.$level+"px"}}),e.$count?/* @__PURE__ */be("i",{className:"wx-8NTMLH0z wx-print-grid-tree-toggle wxi-menu-"+(!1===e.open?"right":"down")}):null]}):null,t.cell?(()=>{let r=t.cell;/* @__PURE__ */
107
- return be(r,{api:l,row:e,column:t})})():/* @__PURE__ */be("span",{children:ky(e,t)})]},t.id))},n))}),i?/* @__PURE__ */be("tfoot",{children:/* @__PURE__ */be(vb,{columns:h,type:"footer",columnStyle:n})}):null]})}function bb(e){let{config:t,...r}=e,{_skin:n,_columns:a}=se(Xy).getState(),o=pe(()=>Ty(a,t),[]),i=me(null);return le(()=>{let e=document.body;e.classList.add("wx-print");let r=i.current;if(!r)return;let n=r.cloneNode(!0);e.appendChild(n);let a=`@media print { @page { size: ${t.paper} ${t.mode}; }`,o=document.createElement("style");o.setAttribute("type","text/css"),o.setAttribute("media","print"),document.getElementsByTagName("head")[0].appendChild(o),o.appendChild(document.createTextNode(a)),window.print(),o.remove(),e.classList.remove("wx-print"),n.remove()},[]),/* @__PURE__ */be("div",{className:`wx-4zwCKA7C wx-${n}-theme wx-print-container`,ref:i,children:o.map((e,t)=>/* @__PURE__ */be("div",{className:"wx-4zwCKA7C wx-print-grid-wrapper",children:/* @__PURE__ */be(yb,{columns:e,...r})},t))})}function xb(e){let{header:t,footer:r,overlay:n,multiselect:a,onreorder:o,rowStyle:i,columnStyle:s,cellStyle:l,autoRowHeight:c,resize:d,clientWidth:u,clientHeight:h,responsiveLevel:p,hotkeys:m}=e,f=se(Xy),g=Zv(f,"dynamic"),v=Zv(f,"_columns"),y=Zv(f,"flatData"),b=Zv(f,"split"),x=Zv(f,"_sizes"),[w,S]=Jv(f,"selectedRows"),k=Zv(f,"select"),C=Zv(f,"editor"),N=Zv(f,"scrollLeft"),T=Zv(f,"scrollTop"),A=Zv(f,"tree"),M=Zv(f,"focusCell"),D=Zv(f,"_print"),E=Zv(f,"undo"),I=Zv(f,"reorder"),R=Zv(f,"_rowHeightFromData"),[z,_]=fe(0);le(()=>{_(function(){let e=document.createElement("div");e.style.cssText="position:absolute;left:-1000px;width:100px;padding:0px;margin:0px;min-height:100px;overflow-y:scroll;",document.body.appendChild(e);let t=e.offsetWidth-e.clientWidth;return document.body.removeChild(e),t}())},[]);let[P,O]=fe(0),L=pe(()=>(v||[]).some(e=>!e.hidden&&e.flexgrow),[v]),F=pe(()=>x?.rowHeight||0,[x]),B=me(null),[V,$]=fe(null),[H,j]=fe(null),q=pe(()=>{let e=[],t=0;return b&&b.left&&(e=(v||[]).slice(0,b.left).filter(e=>!e.hidden).map(e=>({...e})),e.forEach(e=>{e.fixed={left:1,leftSize:b.left},e.left=t,t+=e.width}),e.length&&(e[e.length-1].fixed.left=-1)),{columns:e,width:t}},[b,v]),U=pe(()=>{let e=[],t=0;if(b&&b.right){e=(v||[]).slice(-1*b.right).filter(e=>!e.hidden).map(e=>({...e}));for(let r=e.length-1;r>=0;r--){let n=e[r];n.fixed={right:1},n.right=t,t+=n.width}e.length&&(e[0].fixed={right:-1})}return{columns:e,width:t}},[b,v]),G=pe(()=>{let e=(v||[]).slice(b?.left||0,(v||[]).length-(b?.right??0)).filter(e=>!e.hidden);return e.forEach(e=>{e.fixed=0}),e},[v,b]),W=pe(()=>(v||[]).reduce((e,t)=>(t.hidden||(e+=t.width),e),0),[v]);function K(e,t,r){let n=t,a=e;if(G.length){let t=G.length;for(let n=e;n>=0;n--)G[n][r].forEach(r=>{r.colspan>1&&n>e-r.colspan&&n<t&&(t=n)});if(t!==G.length&&t<e){for(let r=t;r<e;r++)n-=G[r].width;a=t}}return{index:a,delta:n}}let Y=pe(()=>{let e,t,r,n=N||0,a=(N||0)+(u||0),o=0,i=0,s=0,l=0;G.forEach((e,t)=>{n>s&&(o=t,l=s),s+=e.width,a>s&&(i=t+1)});let c={header:0,footer:0};for(let u=i;u>=o;u--)["header","footer"].forEach(e=>{G[u]&&G[u][e].forEach(t=>{let r=t.colspan;if(r&&r>1){let t=r-(i-u+1);t>0&&(c[e]=Math.max(c[e],t))}})});let d=K(o,l,"header"),h=K(o,l,"footer"),p=d.delta,m=d.index,f=h.delta,g=h.index;return L&&W>(u||0)?e=t=r=[...q.columns,...G,...U.columns]:(e=[...q.columns,...G.slice(o,i+1),...U.columns],t=[...q.columns,...G.slice(m,i+c.header+1),...U.columns],r=[...q.columns,...G.slice(g,i+c.footer+1),...U.columns]),{data:e||[],header:t||[],footer:r||[],d:l,df:f,dh:p}},[G,q,U,N,u,L,W]),X=pe(()=>t&&x?.headerHeight||0,[t,x]),Z=pe(()=>r&&x?.footerHeight||0,[r,x]),J=pe(()=>!(!u||!h)&&W>=u,[u,h,W]),[Q,ee]=fe(!1),te=pe(()=>(h||0)-X-Z-(J?z:0),[h,X,Z,J,z]),re=pe(()=>Math.ceil((te||0)/(F||1))+1,[te,F]),ne=me([]),[ae,oe]=fe(0),[ce,de]=fe(void 0),ue=pe(()=>{let e=0,t=0,r=T||0;if(c){let n=r;for(;n>0;)n-=ne.current[e]||F,e++;t=r-n;for(let r=Math.max(0,e-2-1);r<e;r++)t-=ne.current[e-r]||F;e=Math.max(0,e-2)}else{if(R){let n=0,a=0;for(let e=0;e<(y||[]).length;e++){let t=y[e].rowHeight||F;if(a+t>r){n=e;break}a+=t}e=Math.max(0,n-2);for(let r=0;r<e;r++)t+=y[r].rowHeight||F;let o=0,i=0;for(let e=n+1;e<(y||[]).length;e++){let t=y[e].rowHeight||F;if(o++,i+t>te)break;i+=t}return{d:t,start:e,end:Math.min(g?g.rowCount:(y||[]).length,n+o+2)}}e=Math.floor(r/(F||1)),e=Math.max(0,e-2),t=e*(F||0)}let n=g?g.rowCount:(y||[]).length;return{d:t,start:e,end:Math.min(n,e+(re||0)+2)}},[c,R,T,F,g,y,re,te]),he=pe(()=>{let e=g?g.rowCount:(y||[]).length;if(c)return ae+ue.d+(e-(ce||0))*(F||0);if(!R)return e*(F||0);let t=0;for(let r=0;r<e;r++)t+=y[r]?.rowHeight||F;return t},[g,y,F,c,R,ae,ue.d,ce]),ge=me({});ge.current={clientWidth:u,clientHeight:h,fullHeight:he,headerHeight:X,footerHeight:Z,fullWidth:W,SCROLLSIZE:z};let ve=ie(()=>{let e=ge.current;ee(!(!e.clientWidth||!e.clientHeight)&&e.fullHeight+e.headerHeight+e.footerHeight>=e.clientHeight-(e.fullWidth>=e.clientWidth?e.SCROLLSIZE:0))},[]);le(()=>{let e=requestAnimationFrame(ve);return()=>window.cancelAnimationFrame(e)},[P,ve]),le(()=>{ve()},[h,ve]);let we=pe(()=>L&&W<=(u||0)?(u||0)-0-(Q?z:0):W,[L,W,u,Q,z,J]),Se=pe(()=>L&&W<=(u||0)?u||0:we<(u||0)?W+(Q?z:0):-1,[L,W,u,we,Q,z]),ke=me({});le(()=>{if(g&&(ke.current.start!==ue.start||ke.current.end!==ue.end)){let{start:e,end:t}=ue;ke.current={start:e,end:t},f&&f.exec&&f.exec("request-data",{row:{start:e,end:t}})}},[g,ue,f]);let Ce=pe(()=>g?y||[]:(y||[]).slice(ue.start,ue.end),[g,y,ue]),Ne=pe(()=>(w||[]).filter(e=>(Ce||[]).some(t=>t.id===e)),[S,Ce]),Te=pe(()=>ue.start,[ue.start]),Ae=me({top:T,left:N});Ae.current={top:T,left:N};let Me=ie(e=>{let t=e.target.scrollTop,r=e.target.scrollLeft,n=Ae.current;(t!==n.top||r!==n.left)&&f.exec("scroll-to",{top:t,left:r})},[f]),De=ie(e=>{e.shiftKey&&e.preventDefault(),B.current&&B.current.focus&&B.current.focus()},[]),Ee=ie(()=>!!(v||[]).find(e=>!!e.draggable),[v]),Ie=me(null),Re=me(null),ze=me({dblclick:(e,t)=>{let r={id:e,column:tg(t,"data-col-id")};f.exec("open-editor",r)},click:(e,t)=>{if(t.target.closest("input")||Ie.current)return;let r=tg(t,"data-col-id");if(M?.id!==e&&f.exec("focus-cell",{row:e,column:r,eventSource:"click"}),!1===k)return;let n=a&&(t.ctrlKey||t.metaKey),o=a&&t.shiftKey;(n||w.length>1||!w.includes(e))&&f.exec("select-row",{id:e,toggle:n,range:o})},"toggle-row":e=>{let t=f.getRow(e);f.exec(!1===t.open?"open-row":"close-row",{id:e})},"ignore-click":()=>!1}),_e=pe(()=>({top:X,bottom:Z,left:q.width,xScroll:J,yScroll:Q,sense:c&&H?H.offsetHeight:Math.max(x?.rowHeight||0,40),node:B.current&&B.current.firstElementChild}),[X,Z,q.width,J,Q,c,H,x]);let Pe=pe(()=>Se>0?{width:`${Se}px`}:void 0,[Se]),Oe=me(null);le(()=>{Ce&&c&&Promise.resolve().then(()=>{let e=0,t=Te,r=Oe.current;r&&(Array.from(r.children).forEach((r,n)=>{ne.current[Te+n]=r.offsetHeight,e+=r.offsetHeight,t++}),oe(e),de(t))})},[Ce,c,Te]);let[Le,Fe]=fe();le(()=>{if(!M||k&&Ne.length&&!Ne.includes(M.row))if(Ce.length&&Y.data.length){if(!Le||Ne.length&&!Ne.includes(Le.row)||-1===Ce.findIndex(e=>e.id===Le.row)||-1===Y.data.findIndex(e=>e.id===Le.column&&!e.collapsed)){let e=Ne[0]||Ce[0].id,t=Y.data.findIndex(e=>!e.collapsed);Fe(-1===t?null:{row:e,column:Y.data[t].id})}}else Fe(null);else Fe({...M})},[M]);let Be=me(null);le(()=>{let e=B.current;if(!e)return;let t=function(e,t){let r=new ResizeObserver(e=>{requestAnimationFrame(()=>t(e[0].contentRect))});return r.observe(e.parentNode),{destroy(){r.disconnect()}}}(e,d);return()=>{"function"==typeof t&&t()}},[d]);let Ve=me({});Object.assign(Ve.current,{start:function(e,t){let{container:r,sourceNode:n,from:a}=t;if(Ee()&&!n.getAttribute("draggable-data"))return!1;$(a),A&&f.getRow(a).open&&f.exec("close-row",{id:a,nested:!0});let o=eg(n),i=o.cloneNode(!0);i.classList.remove("wx-selected"),i.querySelectorAll("[tabindex]").forEach(e=>e.setAttribute("tabindex","-1")),r.appendChild(i),j(i);let s=(N||0)-Y.d,l=Q?z:0;r.style.width=Math.min((u||0)-l,L&&W<=(u||0)?we:we-l)+s+"px";let c=Zy(o);t.offset={x:s,y:-Math.round(c.height/2)},Re.current||=e.clientY},move:function(e,t){let{from:r}=t,n=t.pos,a=Zy(B.current);n.x=a.x;let i=_e.top;if(n.y<i)n.y=i;else{let e=a.height-(J&&z>0?z:Math.round(_e.sense/2))-_e.bottom;n.y>e&&(n.y=e)}if(B.current.contains(t.targetNode)){let a=eg(t.targetNode),s=a&&rg(a);if(s&&s!==r){t.to=s;let o=c?H?.offsetHeight:x?.rowHeight;if(H&&(0===(T||0)||n.y>i+o-1)){let t=a.getBoundingClientRect(),n=Zy(H).y>t.y?-1:1,o=1===n?"after":"before",i=f.getState().flatData,l=Math.abs(i.findIndex(e=>e.id===r)-i.findIndex(e=>e.id===s)),c=1===l?o:"before"===o?"after":"before";if(1===l&&(-1===n&&e.clientY>Re.current||1===n&&e.clientY<Re.current))return;Re.current=e.clientY,f.exec("move-item",{id:r,target:s,mode:c,inProgress:!0})}}o&&o({event:e,context:t})}eb(e,a,t,_e)},end:function(e,t){let{from:r,to:n}=t;f.exec("move-item",{id:r,target:n,inProgress:!1}),Ie.current=setTimeout(()=>{Ie.current=0},1),$(null),j(null),Re.current=null,tb(t)},getReorder:()=>I,getDraggableInfo:()=>({hasDraggable:Ee()})}),le(()=>{let e=B.current;return e?Qy(e,Ve).destroy:void 0},[I,B.current]),le(()=>{let e=B.current;return e?function(e,{keys:t,exec:r}){if(!t)return;function n(e){let t=e.target;return"INPUT"===t.tagName||"TEXTAREA"===t.tagName||function(e,t="data-id"){let r=e;for(!r.tagName&&e.target&&(r=e.target);r;){if(r.getAttribute&&r.getAttribute(t))return r;r=r.parentNode}return null}(t,"data-header-id")?.classList.contains("wx-filter")||!!t.closest(".wx-cell.wx-editor")}let a={};for(let i in t){let e=t[i];typeof e<"u"&&("function"==typeof e?a[i]=e:e&&(a[i]=e=>{let t=n(e);r({key:i,event:e,isInput:t})}))}let o=Wy(t=>{t.configure(a,e)});return{destroy:()=>{o()}}}(e,{keys:!1!==m&&{...Yy,"ctrl+z":E,"ctrl+y":E,...m},exec:e=>f.exec("hotkey",e)}).destroy:void 0},[f,E,m]);let $e=me({scroll:f.getReactiveState().scroll,scrollLeft:f.getReactiveState().scrollLeft,scrollTop:f.getReactiveState().scrollTop});$e.current.getWidth=()=>(u||0)-(Q?z:0),$e.current.getHeight=()=>te,$e.current.getScrollMargin=()=>q.width+U.width,le(()=>{!function(e,t){let r=null;t.scroll.subscribe(n=>{if(!n||n===r)return;r=n;let{left:a,top:o,height:i,width:s}=n,l=t.getHeight(),c=t.getWidth(),d=t.getScrollMargin();if(o>=0){let t=e.scrollTop;o<t?e.scrollTop=o:o+i>t+l&&(e.scrollTop=o-l+i)}if(a>=0){let t=e.scrollLeft;a<t?e.scrollLeft=a:a+s>t+c-d&&(e.scrollLeft=a-c+s+d)}}),t.scrollLeft?.subscribe?.(t=>{requestAnimationFrame(()=>{Math.abs(e.scrollLeft-t)>1&&(e.scrollLeft=t)})}),t.scrollTop?.subscribe?.(t=>{requestAnimationFrame(()=>{Math.abs(e.scrollTop-t)>1&&(e.scrollTop=t)})})}(Be.current,$e.current)},[]);let He=me(null);le(()=>{let e=He.current;if(!e)return;let t=[];t.push(fg(e,()=>M&&f.exec("focus-cell",{eventSource:"click"})).destroy),t.push(function(e,t){let r=[ty(e,t,"click")];return t.dblclick&&r.push(ty(e,t.dblclick,"dblclick")),()=>{r.forEach(e=>e())}}(e,ze.current)),O(e.clientHeight);let r=new ResizeObserver(()=>{O(e.clientHeight)});return r.observe(e),t.push(()=>r.disconnect()),()=>t.forEach(e=>e())},[]);let je="wx-grid "+(p?`wx-responsive-${p}`:"");return le(()=>{M&&(Ce.some(e=>e.id===M.row)&&Y.data.some(e=>e.id===M.column&&!e.collapsed)||f.exec("focus-cell",{eventSource:"destroy"}))},[M,Ce,Y.data,f]),/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be("div",{className:"wx-4VuBwK2D "+je,style:{"--header-height":`${X}px`,"--footer-height":`${Z}px`,"--split-left-width":`${q.width}px`,"--split-right-width":`${U.width}px`},children:/* @__PURE__ */be("div",{ref:B,className:"wx-4VuBwK2D wx-table-box",style:Pe,role:A?"treegrid":"grid","aria-colcount":Y.data.length,"aria-rowcount":Ce.length,"aria-multiselectable":!(!A||!a)||void 0,tabIndex:-1,children:/* @__PURE__ */xe("div",{ref:Be,className:"wx-4VuBwK2D wx-scroll",style:{overflowX:J?"scroll":"hidden",overflowY:Q?"scroll":"hidden"},onScroll:Me,children:[t?/* @__PURE__ */be("div",{className:"wx-4VuBwK2D wx-header-wrapper",children:/* @__PURE__ */be(pb,{contentWidth:we,deltaLeft:Y.dh,columns:Y.header,columnStyle:s,bodyHeight:te-+r})}):null,
108
- /* @__PURE__ */xe("div",{ref:He,className:"wx-4VuBwK2D wx-body",style:{width:`${we}px`,height:`${he}px`},onMouseDown:e=>De(e),children:[n?/* @__PURE__ */be(mb,{overlay:n}):null,/* @__PURE__ */be("div",{ref:Oe,className:"wx-4VuBwK2D wx-data",style:{paddingTop:`${ue.d}px`,paddingLeft:`${Y.d}px`},children:Ce.map((e,t)=>{let r=-1!==w.indexOf(e.id),n=V===e.id,a="wx-row"+(c?" wx-autoheight":"")+(i?" "+i(e):"")+(r?" wx-selected":"")+(n?" wx-inactive":""),o=c?{minHeight:`${e.rowHeight||F}px`}:{height:`${e.rowHeight||F}px`};/* @__PURE__ */
109
- return be("div",{className:"wx-4VuBwK2D "+a,"data-id":ng(e.id),"data-context-id":ng(e.id),style:o,role:"row","aria-rowindex":t,"aria-expanded":e.open,"aria-level":A?e.$level+1:void 0,"aria-selected":A?r:void 0,tabIndex:-1,children:Y.data.map(t=>t.collapsed?/* @__PURE__ */be("div",{className:"wx-4VuBwK2D wx-cell wx-collapsed"},t.id):C?.id===e.id&&C.column===t.id?/* @__PURE__ */be(gb,{row:e,column:t},t.id):/* @__PURE__ */be(ib,{row:e,column:t,columnStyle:s,cellStyle:l,reorder:I,focusable:Le?.row===e.id&&Le?.column===t.id},t.id))},e.id)})})]}),r&&(y||[]).length?/* @__PURE__ */be(pb,{type:"footer",contentWidth:we,deltaLeft:Y.df,columns:Y.footer,columnStyle:s}):null]})})}),D?/* @__PURE__ */be(bb,{config:D,rowStyle:i,columnStyle:s,cellStyle:l,header:t,footer:r,reorder:I}):null]})}var wb=ne(function({data:e=[],columns:t=[],rowStyle:r=null,columnStyle:n=null,cellStyle:a=null,selectedRows:o,select:i=!0,multiselect:s=!1,header:l=!0,footer:c=!1,dynamic:d=null,overlay:u=null,reorder:h=!1,onReorder:p=null,autoRowHeight:m=!1,sizes:f,split:g,tree:v=!1,autoConfig:y=!1,init:b=null,responsive:x=null,sortMarks:w,undo:S=!1,hotkeys:k=null,filterValues:C,...N},T){let A=me();A.current=N;let M=pe(()=>new Hy(ey),[]),D=pe(()=>M.in,[M]),E=me(null);null===E.current&&(E.current=new Av((e,t)=>{let r="on"+(e=>e.split("-").map(e=>e?e.charAt(0).toUpperCase()+e.slice(1):"").join(""))(e);A.current&&A.current[r]&&A.current[r](t)}),D.setNext(E.current));let I=pe(()=>({getState:M.getState.bind(M),getReactiveState:M.getReactive.bind(M),getStores:()=>({data:M}),exec:D.exec,setNext:e=>(E.current=E.current.setNext(e),E.current),intercept:D.intercept.bind(D),on:D.on.bind(D),detach:D.detach.bind(D),getRow:M.getRow.bind(M),getColumn:M.getColumn.bind(M)}),[M,D]),[R,z]=fe(0),[_,P]=fe(0),[O,L]=fe(null),[F,B]=fe(null),V=pe(()=>{if(y&&!t.length&&e.length){let t=e[0],r=[];for(let e in t)if("id"!==e&&"$"!==e[0]){let t={id:e,header:e[0].toUpperCase()+e.slice(1)};"object"==typeof y&&(t={...t,...y}),r.push(t)}return r}return(F&&F.columns)??t},[y,t,e,F]),$=pe(()=>(F&&F.sizes)??f,[F,f]),H=ie(e=>{if(z(e.width),P(e.height),x){let t=Object.keys(x).map(Number).sort((e,t)=>e-t).find(t=>e.width<=t)??null;t!==O&&(B(x[t]),L(t))}},[x,O]),j=se(Ug.theme),q=me(0);return le(()=>{if(q.current){let t=M.getState();M.init({data:e,columns:V,split:g||t.split,sizes:$||t.sizes,selectedRows:o||t.selectedRows,dynamic:d,tree:v,sortMarks:w||t.sortMarks,filterValues:C||t.filterValues,undo:S,reorder:h,_skin:j,_select:i})}else b&&b(I);q.current++},[M,e,V,g,$,o,d,v,w,C,S,h,j,i,b,I]),0===q.current&&M.init({data:e,columns:V,split:g||{left:0},sizes:$||{},selectedRows:o||[],dynamic:d,tree:v,sortMarks:w||{},filterValues:C||{},undo:S,reorder:h,_skin:j,select:i}),de(T,()=>({...I}),[I]),/* @__PURE__ */be(Xy.Provider,{value:I,children:/* @__PURE__ */be(uv,{words:Tv,optional:!0,children:/* @__PURE__ */be(xb,{header:l,footer:c,overlay:u,rowStyle:r,columnStyle:n,cellStyle:a,onReorder:p,multiselect:s,autoRowHeight:m,clientWidth:R,clientHeight:_,responsiveLevel:O,resize:H,hotkeys:k})})})});og(ag);var Sb=te(null),kb=te(null),Cb=te(null);function Nb({children:e}){let t=se(Ug.i18n),r=pe(()=>t.getGroup("filemanager"),[t]),n=se(Sb),[a]=Jv(n,"panels"),o=a[Zv(n,"activePanel")].path,[i,s]=fe(null),[l,c]=fe(null),[d,u]=fe(""),[h,p]=fe(""),[m,f]=fe(!1);function g(){s(null),f(null),p(""),u("")}let v=pe(()=>({showPrompt(e){let t=e.item.name||("folder"===e.item.type?r("New folder"):`${r("New file")}.txt`);p(t),u(t),s({...e})},showConfirm(e){c({...e})}}),[r]);/* @__PURE__ */
110
- return xe(kb.Provider,{value:v,children:[
111
- /* @__PURE__ */be(Cv,{children:e}),i?/* @__PURE__ */be(Sv,{title:r(`Enter ${i.item.type} name`),onConfirm:function(){let e=d.trim();e?(i.add?n.exec("create-file",{file:{...i.item,name:e},parent:o}):h!==e&&n.exec("rename-file",{id:i.item.id,name:e}),g()):f(!0)},onCancel:g,children:/* @__PURE__ */be(nv,{error:m,select:!0,focus:!0,value:d,onChange:({value:e})=>u(e)})}):null,l?/* @__PURE__ */be(Sv,{title:r("Are you sure you want to delete these items:"),onConfirm:function(){n.exec("delete-files",{ids:l.selected}),c(null)},onCancel:()=>c(null),children:l.selected?/* @__PURE__ */be("ul",{className:"wx-gq7BMzEP wx-list",children:l.selected.map((e,t)=>/* @__PURE__ */be("li",{children:e},t))}):null}):null]})}var Tb={"7z":!0,rar:!0,zip:!0,css:!0,html:!0,js:!0,php:!0,md:!0,xml:!0,sql:!0,aif:!0,mid:!0,mp3:!0,waw:!0,wma:!0,doc:!0,docx:!0,txt:!0,avi:!0,mov:!0,mp4:!0,mpeg:!0,mpg:!0,pdf:!0,xls:!0,xlsx:!0,gif:!0,jpg:!0,jpeg:!0,png:!0,psd:!0,tiff:!0,svg:!0,folder:!0,file:!0,multiple:!0,search:!0,none:!0};function Ab({item:e}){let t=se(Sb),r=se(Ug.i18n).getGroup("filemanager"),n=se(Sb).templates,[a]=Jv(t,"panels"),o=Zv(t,"activePanel"),i=Zv(t,"mode"),s=a[o].selected,l=pe(()=>n.preview(e,214,163),[n,e]),c=pe(()=>n.icon(e,"big"),[n,e]),[d,u]=pe(()=>function(e){let t=e.lastIndexOf("."),r=t>0&&t<e.length-1?Math.min(10,e.length-t):Math.min(5,e.length);return[e.slice(0,-r),e.slice(-r)]}(e.name),[e.name]);/* @__PURE__ */
112
- return be(ye,{children:"/wx-filemanager-parent-link"===e.id?"search"===i?null:/* @__PURE__ */be("div",{className:"wx-GAOa4kDV wx-back-item",children:/* @__PURE__ */xe("div",{className:"wx-GAOa4kDV wx-back "+(e.navigation?"wx-selected":""),"data-id":ng("/wx-filemanager-parent-link"),children:[/* @__PURE__ */be("i",{className:"wx-GAOa4kDV wxi-arrow-left"}),/* @__PURE__ */be("span",{children:r("Back to parent folder")})]})}):/* @__PURE__ */xe("div",{className:"wx-GAOa4kDV wx-item "+(s?.length&&s.indexOf(e.id)>=0?"wx-selected":""),"data-id":ng(e.id),children:[/* @__PURE__ */be("div",l?{className:"wx-GAOa4kDV wx-preview wx-file-preview",children:/* @__PURE__ */be("img",{className:"wx-GAOa4kDV wx-card-preview",alt:r("A miniature file preview"),src:l})}:c?{className:"wx-GAOa4kDV wx-preview wx-file-icon",children:/* @__PURE__ */be("img",{className:"wx-GAOa4kDV wx-card-preview",alt:"",src:c})}:{className:"wx-GAOa4kDV wx-preview",children:/* @__PURE__ */be("i",{className:`wx-GAOa4kDV wxi-${e.type}`})}),"folder"===e.type?/* @__PURE__ */xe("div",{className:"wx-GAOa4kDV wx-info",children:[/* @__PURE__ */xe("div",{className:"wx-GAOa4kDV wx-folder-name",children:[/* @__PURE__ */be("span",{className:"wx-GAOa4kDV wx-type",children:r("Folder")}),/* @__PURE__ */xe("span",{className:"wx-GAOa4kDV wx-name",children:[/* @__PURE__ */be("span",{children:d}),/* @__PURE__ */be("span",{children:u})]})]}),/* @__PURE__ */be("div",{"data-action-id":ng(e.id),className:"wx-GAOa4kDV wx-more",children:/* @__PURE__ */be("i",{className:"wx-GAOa4kDV wxi-dots-v"})})]}):/* @__PURE__ */xe("div",{className:"wx-GAOa4kDV wx-info",children:[/* @__PURE__ */be("div",{className:"wx-GAOa4kDV wx-file-name",children:/* @__PURE__ */xe("span",{className:"wx-GAOa4kDV wx-name",children:[/* @__PURE__ */be("span",{children:d}),/* @__PURE__ */be("span",{children:u})]})}),/* @__PURE__ */be("div",{"data-action-id":ng(e.id),className:"wx-GAOa4kDV wx-more",children:/* @__PURE__ */be("i",{className:"wx-GAOa4kDV wxi-dots-v"})})]})]})})}function Mb(){let e=se(Sb),t=se(Ug.i18n),r=pe(()=>t.getGroup("filemanager"),[t]),[n]=Jv(e,"panels"),a=Zv(e,"activePanel"),o=Zv(e,"mode"),i=n[a]._files,s=n[a].selected,l=n[a].path,c=n[a]._crumbs,d=n[a]._selectNavigation,u=ie((t,r)=>{let n=r&&(r.ctrlKey||r.metaKey),o=r&&r.shiftKey;if("/wx-filemanager-parent-link"===t){if(s.length&&(n||o))return;return void e.exec("select-file",{type:"navigation"})}let i="body"===t&&r?null:t,l=-1!==r.target.className.indexOf("wx-more")||-1!==r.target.className.indexOf("wxi-dots-v");setTimeout(()=>{e.exec("select-file",{id:i,toggle:n&&!l,range:o&&!l,panel:a})},1)},[e,s,a]),h=ie(()=>{c.length>1&&e.exec("set-path",{id:c[c.length-2].id,panel:a,selected:[c[c.length-1].id]})},[e,c,a]),p=ie(t=>{if("/wx-filemanager-parent-link"===t)return h();"search"===o&&e.exec("filter-files",{text:""});let r=i.find(e=>e.id===t);r&&("folder"==r.type?e.exec("set-path",{id:r.id,panel:a}):e.exec("open-file",{id:r.id}))},[e,h,o,i,a]),m=ie((e,t)=>{(!s?.length||!s.filter(t=>t?.id===e).length>0)&&u(e,t)},[s,u]),f=pe(()=>"/"===l?i:[{id:"/wx-filemanager-parent-link",name:r("Back to parent folder"),navigation:d},...i],[l,r,d,i]),g=me(null),v=me();return le(()=>{g.current&&(v.current?(v.current.click=u,v.current._dblclick=p,v.current.context=m):(v.current={click:u,dblclick:e=>v.current._dblclick(e),_dblclick:p,context:m},sg(g.current,v.current)))},[u,p,m]),"search"!=o||f.length?/* @__PURE__ */be("div",{tabIndex:0,className:"wx-iyjASZCY wx-cards"+("/"!==l&&"search"!==o?" wx-has-back-link":""),"data-id":ng("body"),ref:g,children:f.map(e=>/* @__PURE__ */be(Ab,{item:e},e.id))}):/* @__PURE__ */be("div",{className:"wx-iyjASZCY wx-not-found",children:/* @__PURE__ */be("div",{className:"wx-iyjASZCY wx-not-found-text",children:r("Looks like nothing is here")})})}function Db({name:e="",spin:t=!1,onClick:r}){/* @__PURE__ */
113
- return be("i",{"data-menu-ignore":"true",className:`wx-uwcvNSAG wx-icon wxi-${e} ${t?"wx-spin":""} ${r?"wx-clickable":""}`,onClick:()=>{r&&r()}})}function Eb(){let e=se(Ug.i18n).getGroup("filemanager"),t=se(Sb),r=Zv(t,"activePanel"),[n]=Jv(t,"panels"),a=pe(()=>n[r]._crumbs,[n,r]);/* @__PURE__ */
114
- return xe("div",{className:"wx-GDJvtROw wx-search",children:[/* @__PURE__ */xe("div",{className:"wx-GDJvtROw wx-toolbar",children:[/* @__PURE__ */be("div",{className:"wx-GDJvtROw wx-back-icon",children:/* @__PURE__ */be(Db,{name:"angle-left",onClick:function(){t.exec("filter-files",{text:""})}})}),/* @__PURE__ */xe("div",{className:"wx-GDJvtROw wx-text",children:[e("Search results in")," ",Array.isArray(a)&&a.map((t,r)=>/* @__PURE__ */xe(ee,{children:[r?"/":null,"/"==t.id?e(t.name):t.name]},r))]})]}),/* @__PURE__ */be(Mb,{})]})}function Ib({narrowMode:e,extraInfo:t}){let r=se(Sb),{preview:n,icon:a}=r.templates,o=se(Ug.i18n),i=pe(()=>o.getGroup("filemanager"),[o]),s=pe(()=>Og("%D, %d %F %Y, %H:%i",o.getRaw().calendar),[o]),[l,c]=Jv(r,"panels"),d=Zv(r,"activePanel"),u=Zv(r,"preview"),h=Zv(r,"search"),p=pe(()=>{let e=l&&null!=d&&l[d]?._selected?.length||0;return h&&!e},[h,c,d]),m=pe(()=>{let e=l&&null!=d?l[d]:null;return e?p?e._files:e._selected:[]},[p,c,d]),f=ie((e,t)=>(e?`${e} ${i(e>1?"folders":"folder")} `:"")+(t?`${t} ${i(t>1?"files":"file")}`:""),[i]),g=ie(()=>{r.exec("show-preview",{mode:!u})},[r,u]),v=ie(e=>"folder"===e.type?i("Folder"):e.ext||i("Unknown file"),[i]),y=pe(()=>{let e,t,r,o,s,l,c,d;if(1!==m.length||p){if(t=s=null,e="",m.length){let t,r=0,n=0,a=0,o=[];m.forEach(e=>{typeof e.size>"u"&&(t=!0,r=void 0),t||(r+=e.size),o.push(v(e)),"folder"===e.type?n++:a++});let s=new Set(o);l=s.size>1?i("multiple"):[...s][0],c=f(n,a),d=r,p||(e=i("Multiple files"))}o=a({type:p?"search":m.length?"multiple":"none"},"big"),r=""}else{t=m[0],e=t.name;let i=n(t,400,500);i?(r=i,o=""):(o=a(t,"big"),r=""),s="folder"!==t.type}return{name:e,item:t,previewSrc:r,iconSrc:o,showDownloadIcon:s,type:l,totalCount:c,totalSize:d}},[m,p,n,a,i,v,f]),b=ie(()=>{r.exec("download-file",{id:m[0].id})},[r,m]),x=ie(async e=>{if(!t||!e)return null;try{return await t(e)}catch(e){return null}},[t]),[w,S]=fe(null);return le(()=>{let e=!1;return S(null),Promise.resolve(x(y.item)).then(t=>{e||S(t)}).catch(()=>{e||S(null)}),()=>{e=!0}},[x,y.item]),/* @__PURE__ */be("div",{className:"wx-O0BTtRrH wx-wrapper",children:m&&m.length?/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */xe("div",{className:"wx-O0BTtRrH wx-preview",children:[/* @__PURE__ */xe("div",{className:"wx-O0BTtRrH wx-toolbar",children:[/* @__PURE__ */be("div",{className:"wx-O0BTtRrH wx-name",children:y.name}),/* @__PURE__ */xe("div",{className:"wx-O0BTtRrH wx-icons",children:[y.showDownloadIcon?/* @__PURE__ */be(Db,{name:"download",onClick:b}):null,e?/* @__PURE__ */be(Db,{name:"close",onClick:g}):null]})]}),y.previewSrc?/* @__PURE__ */be("div",{className:"wx-O0BTtRrH wx-img-wrapper",children:/* @__PURE__ */be("img",{src:y.previewSrc,alt:i("A miniature file preview")})}):y.iconSrc?/* @__PURE__ */be("div",{className:"wx-O0BTtRrH wx-icon-wrapper",children:/* @__PURE__ */be("img",{src:y.iconSrc,alt:i("A miniature file preview")})}):/* @__PURE__ */be("div",{className:"wx-O0BTtRrH wx-icon-wrapper",children:y.item?/* @__PURE__ */be("i",{className:`wx-O0BTtRrH wx-icon wxi-${y.item.type}`}):/* @__PURE__ */be("i",{className:"wx-O0BTtRrH wx-icon wxi-"+(p?"search":"file-multiple-outline")})})]}),/* @__PURE__ */xe("div",{className:"wx-O0BTtRrH wx-info-panel",children:[/* @__PURE__ */be("div",{className:"wx-O0BTtRrH wx-title",children:i(p?"Found":"Information")}),/* @__PURE__ */xe("div",{className:"wx-O0BTtRrH wx-list",children:[y.item?/* @__PURE__ */xe(ye,{children:[
104
+ return be("th",{style:Kv(ky(e,s.columnWidth)),className:"wx-Gy81xq2u "+c,rowSpan:e.rowspan,colSpan:e.colspan,children:d?/* @__PURE__ */be(d,{api:a,cell:Object.fromEntries(Object.entries(e).filter(([e])=>"cell"!==e)),column:n,row:t}):e.filter?/* @__PURE__ */be("div",{className:"wx-Gy81xq2u wx-print-filter",children:Cy(o,i,e)}):/* @__PURE__ */be("div",{className:"wx-Gy81xq2u wx-text",children:e.text??""})},e.id)})},t))})}function pb(e){let{columns:t,rowStyle:r,columnStyle:n,cellStyle:a,header:o,footer:i,reorder:s}=e,l=se(Uy),{flatData:c,_sizes:d}=l.getState(),u=o&&Sy(t,"header",d.headerRowHeights),h=i&&Sy(t,"footer",d.footerRowHeights);function p(e,t){let r="";return r+=n?" "+n(t):"",r+=a?" "+a(e,t):"",r}function m(e,t){return"function"==typeof t.draggable?!1!==t.draggable(e,t):t.draggable}/* @__PURE__ */
105
+ return xe("table",{className:"wx-8NTMLH0z wx-print-grid "+(t.some(e=>e.flexgrow)?"wx-flex-columns":""),children:[o?/* @__PURE__ */be("thead",{children:/* @__PURE__ */be(hb,{columns:u,type:"header",columnStyle:n})}):null,
106
+ /* @__PURE__ */be("tbody",{children:c.map((e,n)=>/* @__PURE__ */be("tr",{className:"wx-8NTMLH0z wx-row"+(r?" "+r(e):""),style:{height:`${e.rowHeight||d.rowHeight}px`},children:t.map(t=>t.collapsed?null:/* @__PURE__ */xe("td",{className:`wx-8NTMLH0z wx-print-cell wx-cell ${p(e,t)}`,style:Kv(ky(t,d.columnWidth)),children:[s&&t.draggable?/* @__PURE__ */be("span",{className:"wx-8NTMLH0z wx-print-draggable",children:m(e,t)?/* @__PURE__ */be("i",{className:"wx-8NTMLH0z wxi-drag"}):null}):null,t.treetoggle?/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be("span",{style:{marginLeft:28*e.$level+"px"}}),e.$count?/* @__PURE__ */be("i",{className:"wx-8NTMLH0z wx-print-grid-tree-toggle wxi-menu-"+(!1===e.open?"right":"down")}):null]}):null,t.cell?(()=>{let r=t.cell;/* @__PURE__ */
107
+ return be(r,{api:l,row:e,column:t})})():/* @__PURE__ */be("span",{children:yy(e,t)})]},t.id))},n))}),i?/* @__PURE__ */be("tfoot",{children:/* @__PURE__ */be(hb,{columns:h,type:"footer",columnStyle:n})}):null]})}function mb(e){let{config:t,...r}=e,{_skin:n,_columns:a}=se(Uy).getState(),o=pe(()=>wy(a,t),[]),i=me(null);return le(()=>{let e=document.body;e.classList.add("wx-print");let r=i.current;if(!r)return;let n=r.cloneNode(!0);e.appendChild(n);let a=`@media print { @page { size: ${t.paper} ${t.mode}; }`,o=document.createElement("style");o.setAttribute("type","text/css"),o.setAttribute("media","print"),document.getElementsByTagName("head")[0].appendChild(o),o.appendChild(document.createTextNode(a)),window.print(),o.remove(),e.classList.remove("wx-print"),n.remove()},[]),/* @__PURE__ */be("div",{className:`wx-4zwCKA7C wx-${n}-theme wx-print-container`,ref:i,children:o.map((e,t)=>/* @__PURE__ */be("div",{className:"wx-4zwCKA7C wx-print-grid-wrapper",children:/* @__PURE__ */be(pb,{columns:e,...r})},t))})}function fb(e){let{header:t,footer:r,overlay:n,multiselect:a,onreorder:o,rowStyle:i,columnStyle:s,cellStyle:l,autoRowHeight:c,resize:d,clientWidth:u,clientHeight:h,responsiveLevel:p,hotkeys:m}=e,f=se(Uy),g=Gv(f,"dynamic"),v=Gv(f,"_columns"),y=Gv(f,"flatData"),b=Gv(f,"split"),x=Gv(f,"_sizes"),[w,S]=Wv(f,"selectedRows"),k=Gv(f,"select"),C=Gv(f,"editor"),N=Gv(f,"scrollLeft"),T=Gv(f,"scrollTop"),A=Gv(f,"tree"),M=Gv(f,"focusCell"),D=Gv(f,"_print"),E=Gv(f,"undo"),I=Gv(f,"reorder"),R=Gv(f,"_rowHeightFromData"),[z,_]=fe(0);le(()=>{_(function(){let e=document.createElement("div");e.style.cssText="position:absolute;left:-1000px;width:100px;padding:0px;margin:0px;min-height:100px;overflow-y:scroll;",document.body.appendChild(e);let t=e.offsetWidth-e.clientWidth;return document.body.removeChild(e),t}())},[]);let[P,O]=fe(0),L=pe(()=>(v||[]).some(e=>!e.hidden&&e.flexgrow),[v]),F=pe(()=>x?.rowHeight||0,[x]),B=me(null),[V,$]=fe(null),[H,j]=fe(null),q=pe(()=>{let e=[],t=0;return b&&b.left&&(e=(v||[]).slice(0,b.left).filter(e=>!e.hidden).map(e=>({...e})),e.forEach(e=>{e.fixed={left:1,leftSize:b.left},e.left=t,t+=e.width}),e.length&&(e[e.length-1].fixed.left=-1)),{columns:e,width:t}},[b,v]),U=pe(()=>{let e=[],t=0;if(b&&b.right){e=(v||[]).slice(-1*b.right).filter(e=>!e.hidden).map(e=>({...e}));for(let r=e.length-1;r>=0;r--){let n=e[r];n.fixed={right:1},n.right=t,t+=n.width}e.length&&(e[0].fixed={right:-1})}return{columns:e,width:t}},[b,v]),G=pe(()=>{let e=(v||[]).slice(b?.left||0,(v||[]).length-(b?.right??0)).filter(e=>!e.hidden);return e.forEach(e=>{e.fixed=0}),e},[v,b]),W=pe(()=>(v||[]).reduce((e,t)=>(t.hidden||(e+=t.width),e),0),[v]);function K(e,t,r){let n=t,a=e;if(G.length){let t=G.length;for(let n=e;n>=0;n--)G[n][r].forEach(r=>{r.colspan>1&&n>e-r.colspan&&n<t&&(t=n)});if(t!==G.length&&t<e){for(let r=t;r<e;r++)n-=G[r].width;a=t}}return{index:a,delta:n}}let Y=pe(()=>{let e,t,r,n=N||0,a=(N||0)+(u||0),o=0,i=0,s=0,l=0;G.forEach((e,t)=>{n>s&&(o=t,l=s),s+=e.width,a>s&&(i=t+1)});let c={header:0,footer:0};for(let u=i;u>=o;u--)["header","footer"].forEach(e=>{G[u]&&G[u][e].forEach(t=>{let r=t.colspan;if(r&&r>1){let t=r-(i-u+1);t>0&&(c[e]=Math.max(c[e],t))}})});let d=K(o,l,"header"),h=K(o,l,"footer"),p=d.delta,m=d.index,f=h.delta,g=h.index;return L&&W>(u||0)?e=t=r=[...q.columns,...G,...U.columns]:(e=[...q.columns,...G.slice(o,i+1),...U.columns],t=[...q.columns,...G.slice(m,i+c.header+1),...U.columns],r=[...q.columns,...G.slice(g,i+c.footer+1),...U.columns]),{data:e||[],header:t||[],footer:r||[],d:l,df:f,dh:p}},[G,q,U,N,u,L,W]),X=pe(()=>t&&x?.headerHeight||0,[t,x]),Z=pe(()=>r&&x?.footerHeight||0,[r,x]),J=pe(()=>!(!u||!h)&&W>=u,[u,h,W]),[Q,ee]=fe(!1),te=pe(()=>(h||0)-X-Z-(J?z:0),[h,X,Z,J,z]),re=pe(()=>Math.ceil((te||0)/(F||1))+1,[te,F]),ne=me([]),[ae,oe]=fe(0),[ce,de]=fe(void 0),ue=pe(()=>{let e=0,t=0,r=T||0;if(c){let n=r;for(;n>0;)n-=ne.current[e]||F,e++;t=r-n;for(let r=Math.max(0,e-2-1);r<e;r++)t-=ne.current[e-r]||F;e=Math.max(0,e-2)}else{if(R){let n=0,a=0;for(let e=0;e<(y||[]).length;e++){let t=y[e].rowHeight||F;if(a+t>r){n=e;break}a+=t}e=Math.max(0,n-2);for(let r=0;r<e;r++)t+=y[r].rowHeight||F;let o=0,i=0;for(let e=n+1;e<(y||[]).length;e++){let t=y[e].rowHeight||F;if(o++,i+t>te)break;i+=t}return{d:t,start:e,end:Math.min(g?g.rowCount:(y||[]).length,n+o+2)}}e=Math.floor(r/(F||1)),e=Math.max(0,e-2),t=e*(F||0)}let n=g?g.rowCount:(y||[]).length;return{d:t,start:e,end:Math.min(n,e+(re||0)+2)}},[c,R,T,F,g,y,re,te]),he=pe(()=>{let e=g?g.rowCount:(y||[]).length;if(c)return ae+ue.d+(e-(ce||0))*(F||0);if(!R)return e*(F||0);let t=0;for(let r=0;r<e;r++)t+=y[r]?.rowHeight||F;return t},[g,y,F,c,R,ae,ue.d,ce]),ge=me({});ge.current={clientWidth:u,clientHeight:h,fullHeight:he,headerHeight:X,footerHeight:Z,fullWidth:W,SCROLLSIZE:z};let ve=ie(()=>{let e=ge.current;ee(!(!e.clientWidth||!e.clientHeight)&&e.fullHeight+e.headerHeight+e.footerHeight>=e.clientHeight-(e.fullWidth>=e.clientWidth?e.SCROLLSIZE:0))},[]);le(()=>{let e=requestAnimationFrame(ve);return()=>window.cancelAnimationFrame(e)},[P,ve]),le(()=>{ve()},[h,ve]);let we=pe(()=>L&&W<=(u||0)?(u||0)-0-(Q?z:0):W,[L,W,u,Q,z,J]),Se=pe(()=>L&&W<=(u||0)?u||0:we<(u||0)?W+(Q?z:0):-1,[L,W,u,we,Q,z]),ke=me({});le(()=>{if(g&&(ke.current.start!==ue.start||ke.current.end!==ue.end)){let{start:e,end:t}=ue;ke.current={start:e,end:t},f&&f.exec&&f.exec("request-data",{row:{start:e,end:t}})}},[g,ue,f]);let Ce=pe(()=>g?y||[]:(y||[]).slice(ue.start,ue.end),[g,y,ue]),Ne=pe(()=>(w||[]).filter(e=>(Ce||[]).some(t=>t.id===e)),[S,Ce]),Te=pe(()=>ue.start,[ue.start]),Ae=me({top:T,left:N});Ae.current={top:T,left:N};let Me=ie(e=>{let t=e.target.scrollTop,r=e.target.scrollLeft,n=Ae.current;(t!==n.top||r!==n.left)&&f.exec("scroll-to",{top:t,left:r})},[f]),De=ie(e=>{e.shiftKey&&e.preventDefault(),B.current&&B.current.focus&&B.current.focus()},[]),Ee=ie(()=>!!(v||[]).find(e=>!!e.draggable),[v]),Ie=me(null),Re=me(null),ze=me({dblclick:(e,t)=>{let r={id:e,column:Xf(t,"data-col-id")};f.exec("open-editor",r)},click:(e,t)=>{if(t.target.closest("input")||Ie.current)return;let r=Xf(t,"data-col-id");if(M?.id!==e&&f.exec("focus-cell",{row:e,column:r,eventSource:"click"}),!1===k)return;let n=a&&(t.ctrlKey||t.metaKey),o=a&&t.shiftKey;(n||w.length>1||!w.includes(e))&&f.exec("select-row",{id:e,toggle:n,range:o})},"toggle-row":e=>{let t=f.getRow(e);f.exec(!1===t.open?"open-row":"close-row",{id:e})},"ignore-click":()=>!1}),_e=pe(()=>({top:X,bottom:Z,left:q.width,xScroll:J,yScroll:Q,sense:c&&H?H.offsetHeight:Math.max(x?.rowHeight||0,40),node:B.current&&B.current.firstElementChild}),[X,Z,q.width,J,Q,c,H,x]);let Pe=pe(()=>Se>0?{width:`${Se}px`}:void 0,[Se]),Oe=me(null);le(()=>{Ce&&c&&Promise.resolve().then(()=>{let e=0,t=Te,r=Oe.current;r&&(Array.from(r.children).forEach((r,n)=>{ne.current[Te+n]=r.offsetHeight,e+=r.offsetHeight,t++}),oe(e),de(t))})},[Ce,c,Te]);let[Le,Fe]=fe();le(()=>{if(!M||k&&Ne.length&&!Ne.includes(M.row))if(Ce.length&&Y.data.length){if(!Le||Ne.length&&!Ne.includes(Le.row)||-1===Ce.findIndex(e=>e.id===Le.row)||-1===Y.data.findIndex(e=>e.id===Le.column&&!e.collapsed)){let e=Ne[0]||Ce[0].id,t=Y.data.findIndex(e=>!e.collapsed);Fe(-1===t?null:{row:e,column:Y.data[t].id})}}else Fe(null);else Fe({...M})},[M]);let Be=me(null);le(()=>{let e=B.current;if(!e)return;let t=function(e,t){let r=new ResizeObserver(e=>{requestAnimationFrame(()=>t(e[0].contentRect))});return r.observe(e.parentNode),{destroy(){r.disconnect()}}}(e,d);return()=>{"function"==typeof t&&t()}},[d]);let Ve=me({});Object.assign(Ve.current,{start:function(e,t){let{container:r,sourceNode:n,from:a}=t;if(Ee()&&!n.getAttribute("draggable-data"))return!1;$(a),A&&f.getRow(a).open&&f.exec("close-row",{id:a,nested:!0});let o=Yf(n),i=o.cloneNode(!0);i.classList.remove("wx-selected"),i.querySelectorAll("[tabindex]").forEach(e=>e.setAttribute("tabindex","-1")),r.appendChild(i),j(i);let s=(N||0)-Y.d,l=Q?z:0;r.style.width=Math.min((u||0)-l,L&&W<=(u||0)?we:we-l)+s+"px";let c=Gy(o);t.offset={x:s,y:-Math.round(c.height/2)},Re.current||=e.clientY},move:function(e,t){let{from:r}=t,n=t.pos,a=Gy(B.current);n.x=a.x;let i=_e.top;if(n.y<i)n.y=i;else{let e=a.height-(J&&z>0?z:Math.round(_e.sense/2))-_e.bottom;n.y>e&&(n.y=e)}if(B.current.contains(t.targetNode)){let a=Yf(t.targetNode),s=a&&Zf(a);if(s&&s!==r){t.to=s;let o=c?H?.offsetHeight:x?.rowHeight;if(H&&(0===(T||0)||n.y>i+o-1)){let t=a.getBoundingClientRect(),n=Gy(H).y>t.y?-1:1,o=1===n?"after":"before",i=f.getState().flatData,l=Math.abs(i.findIndex(e=>e.id===r)-i.findIndex(e=>e.id===s)),c=1===l?o:"before"===o?"after":"before";if(1===l&&(-1===n&&e.clientY>Re.current||1===n&&e.clientY<Re.current))return;Re.current=e.clientY,f.exec("move-item",{id:r,target:s,mode:c,inProgress:!0})}}o&&o({event:e,context:t})}Yy(e,a,t,_e)},end:function(e,t){let{from:r,to:n}=t;f.exec("move-item",{id:r,target:n,inProgress:!1}),Ie.current=setTimeout(()=>{Ie.current=0},1),$(null),j(null),Re.current=null,Xy(t)},getReorder:()=>I,getDraggableInfo:()=>({hasDraggable:Ee()})}),le(()=>{let e=B.current;return e?Ky(e,Ve).destroy:void 0},[I,B.current]),le(()=>{let e=B.current;return e?function(e,{keys:t,exec:r}){if(!t)return;function n(e){let t=e.target;return"INPUT"===t.tagName||"TEXTAREA"===t.tagName||function(e,t="data-id"){let r=e;for(!r.tagName&&e.target&&(r=e.target);r;){if(r.getAttribute&&r.getAttribute(t))return r;r=r.parentNode}return null}(t,"data-header-id")?.classList.contains("wx-filter")||!!t.closest(".wx-cell.wx-editor")}let a={};for(let i in t){let e=t[i];typeof e<"u"&&("function"==typeof e?a[i]=e:e&&(a[i]=e=>{let t=n(e);r({key:i,event:e,isInput:t})}))}let o=Hy(t=>{t.configure(a,e)});return{destroy:()=>{o()}}}(e,{keys:!1!==m&&{...qy,"ctrl+z":E,"ctrl+y":E,...m},exec:e=>f.exec("hotkey",e)}).destroy:void 0},[f,E,m]);let $e=me({scroll:f.getReactiveState().scroll,scrollLeft:f.getReactiveState().scrollLeft,scrollTop:f.getReactiveState().scrollTop});$e.current.getWidth=()=>(u||0)-(Q?z:0),$e.current.getHeight=()=>te,$e.current.getScrollMargin=()=>q.width+U.width,le(()=>{!function(e,t){let r=null;t.scroll.subscribe(n=>{if(!n||n===r)return;r=n;let{left:a,top:o,height:i,width:s}=n,l=t.getHeight(),c=t.getWidth(),d=t.getScrollMargin();if(o>=0){let t=e.scrollTop;o<t?e.scrollTop=o:o+i>t+l&&(e.scrollTop=o-l+i)}if(a>=0){let t=e.scrollLeft;a<t?e.scrollLeft=a:a+s>t+c-d&&(e.scrollLeft=a-c+s+d)}}),t.scrollLeft?.subscribe?.(t=>{requestAnimationFrame(()=>{Math.abs(e.scrollLeft-t)>1&&(e.scrollLeft=t)})}),t.scrollTop?.subscribe?.(t=>{requestAnimationFrame(()=>{Math.abs(e.scrollTop-t)>1&&(e.scrollTop=t)})})}(Be.current,$e.current)},[]);let He=me(null);le(()=>{let e=He.current;if(!e)return;let t=[];t.push(dg(e,()=>M&&f.exec("focus-cell",{eventSource:"click"})).destroy),t.push(function(e,t){let r=[Xv(e,t,"click")];return t.dblclick&&r.push(Xv(e,t.dblclick,"dblclick")),()=>{r.forEach(e=>e())}}(e,ze.current)),O(e.clientHeight);let r=new ResizeObserver(()=>{O(e.clientHeight)});return r.observe(e),t.push(()=>r.disconnect()),()=>t.forEach(e=>e())},[]);let je="wx-grid "+(p?`wx-responsive-${p}`:"");return le(()=>{M&&(Ce.some(e=>e.id===M.row)&&Y.data.some(e=>e.id===M.column&&!e.collapsed)||f.exec("focus-cell",{eventSource:"destroy"}))},[M,Ce,Y.data,f]),/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be("div",{className:"wx-4VuBwK2D "+je,style:{"--header-height":`${X}px`,"--footer-height":`${Z}px`,"--split-left-width":`${q.width}px`,"--split-right-width":`${U.width}px`},children:/* @__PURE__ */be("div",{ref:B,className:"wx-4VuBwK2D wx-table-box",style:Pe,role:A?"treegrid":"grid","aria-colcount":Y.data.length,"aria-rowcount":Ce.length,"aria-multiselectable":!(!A||!a)||void 0,tabIndex:-1,children:/* @__PURE__ */xe("div",{ref:Be,className:"wx-4VuBwK2D wx-scroll",style:{overflowX:J?"scroll":"hidden",overflowY:Q?"scroll":"hidden"},onScroll:Me,children:[t?/* @__PURE__ */be("div",{className:"wx-4VuBwK2D wx-header-wrapper",children:/* @__PURE__ */be(lb,{contentWidth:we,deltaLeft:Y.dh,columns:Y.header,columnStyle:s,bodyHeight:te-+r})}):null,
108
+ /* @__PURE__ */xe("div",{ref:He,className:"wx-4VuBwK2D wx-body",style:{width:`${we}px`,height:`${he}px`},onMouseDown:e=>De(e),children:[n?/* @__PURE__ */be(cb,{overlay:n}):null,/* @__PURE__ */be("div",{ref:Oe,className:"wx-4VuBwK2D wx-data",style:{paddingTop:`${ue.d}px`,paddingLeft:`${Y.d}px`},children:Ce.map((e,t)=>{let r=-1!==w.indexOf(e.id),n=V===e.id,a="wx-row"+(c?" wx-autoheight":"")+(i?" "+i(e):"")+(r?" wx-selected":"")+(n?" wx-inactive":""),o=c?{minHeight:`${e.rowHeight||F}px`}:{height:`${e.rowHeight||F}px`};/* @__PURE__ */
109
+ return be("div",{className:"wx-4VuBwK2D "+a,"data-id":Jf(e.id),"data-context-id":Jf(e.id),style:o,role:"row","aria-rowindex":t,"aria-expanded":e.open,"aria-level":A?e.$level+1:void 0,"aria-selected":A?r:void 0,tabIndex:-1,children:Y.data.map(t=>t.collapsed?/* @__PURE__ */be("div",{className:"wx-4VuBwK2D wx-cell wx-collapsed"},t.id):C?.id===e.id&&C.column===t.id?/* @__PURE__ */be(ub,{row:e,column:t},t.id):/* @__PURE__ */be(tb,{row:e,column:t,columnStyle:s,cellStyle:l,reorder:I,focusable:Le?.row===e.id&&Le?.column===t.id},t.id))},e.id)})})]}),r&&(y||[]).length?/* @__PURE__ */be(lb,{type:"footer",contentWidth:we,deltaLeft:Y.df,columns:Y.footer,columnStyle:s}):null]})})}),D?/* @__PURE__ */be(mb,{config:D,rowStyle:i,columnStyle:s,cellStyle:l,header:t,footer:r,reorder:I}):null]})}var gb=ne(function({data:e=[],columns:t=[],rowStyle:r=null,columnStyle:n=null,cellStyle:a=null,selectedRows:o,select:i=!0,multiselect:s=!1,header:l=!0,footer:c=!1,dynamic:d=null,overlay:u=null,reorder:h=!1,onReorder:p=null,autoRowHeight:m=!1,sizes:f,split:g,tree:v=!1,autoConfig:y=!1,init:b=null,responsive:x=null,sortMarks:w,undo:S=!1,hotkeys:k=null,filterValues:C,...N},T){let A=me();A.current=N;let M=pe(()=>new Ly(Yv),[]),D=pe(()=>M.in,[M]),E=me(null);null===E.current&&(E.current=new Sv((e,t)=>{let r="on"+(e=>e.split("-").map(e=>e?e.charAt(0).toUpperCase()+e.slice(1):"").join(""))(e);A.current&&A.current[r]&&A.current[r](t)}),D.setNext(E.current));let I=pe(()=>({getState:M.getState.bind(M),getReactiveState:M.getReactive.bind(M),getStores:()=>({data:M}),exec:D.exec,setNext:e=>(E.current=E.current.setNext(e),E.current),intercept:D.intercept.bind(D),on:D.on.bind(D),detach:D.detach.bind(D),getRow:M.getRow.bind(M),getColumn:M.getColumn.bind(M)}),[M,D]),[R,z]=fe(0),[_,P]=fe(0),[O,L]=fe(null),[F,B]=fe(null),V=pe(()=>{if(y&&!t.length&&e.length){let t=e[0],r=[];for(let e in t)if("id"!==e&&"$"!==e[0]){let t={id:e,header:e[0].toUpperCase()+e.slice(1)};"object"==typeof y&&(t={...t,...y}),r.push(t)}return r}return(F&&F.columns)??t},[y,t,e,F]),$=pe(()=>(F&&F.sizes)??f,[F,f]),H=ie(e=>{if(z(e.width),P(e.height),x){let t=Object.keys(x).map(Number).sort((e,t)=>e-t).find(t=>e.width<=t)??null;t!==O&&(B(x[t]),L(t))}},[x,O]),j=se(Vg.theme),q=me(0);return le(()=>{if(q.current){let t=M.getState();M.init({data:e,columns:V,split:g||t.split,sizes:$||t.sizes,selectedRows:o||t.selectedRows,dynamic:d,tree:v,sortMarks:w||t.sortMarks,filterValues:C||t.filterValues,undo:S,reorder:h,_skin:j,_select:i})}else b&&b(I);q.current++},[M,e,V,g,$,o,d,v,w,C,S,h,j,i,b,I]),0===q.current&&M.init({data:e,columns:V,split:g||{left:0},sizes:$||{},selectedRows:o||[],dynamic:d,tree:v,sortMarks:w||{},filterValues:C||{},undo:S,reorder:h,_skin:j,select:i}),de(T,()=>({...I}),[I]),/* @__PURE__ */be(Uy.Provider,{value:I,children:/* @__PURE__ */be(iv,{words:wv,optional:!0,children:/* @__PURE__ */be(fb,{header:l,footer:c,overlay:u,rowStyle:r,columnStyle:n,cellStyle:a,onReorder:p,multiselect:s,autoRowHeight:m,clientWidth:R,clientHeight:_,responsiveLevel:O,resize:H,hotkeys:k})})})});eg(Qf);var vb=te(null),yb=te(null),bb=te(null);function xb({children:e}){let t=se(Vg.i18n),r=pe(()=>t.getGroup("filemanager"),[t]),n=se(vb),[a]=Wv(n,"panels"),o=a[Gv(n,"activePanel")].path,[i,s]=fe(null),[l,c]=fe(null),[d,u]=fe(""),[h,p]=fe(""),[m,f]=fe(!1);function g(){s(null),f(null),p(""),u("")}let v=pe(()=>({showPrompt(e){let t=e.item.name||("folder"===e.item.type?r("New folder"):`${r("New file")}.txt`);p(t),u(t),s({...e})},showConfirm(e){c({...e})}}),[r]);/* @__PURE__ */
110
+ return xe(yb.Provider,{value:v,children:[
111
+ /* @__PURE__ */be(bv,{children:e}),i?/* @__PURE__ */be(vv,{title:r(`Enter ${i.item.type} name`),onConfirm:function(){let e=d.trim();e?(i.add?n.exec("create-file",{file:{...i.item,name:e},parent:o}):h!==e&&n.exec("rename-file",{id:i.item.id,name:e}),g()):f(!0)},onCancel:g,children:/* @__PURE__ */be(Jg,{error:m,select:!0,focus:!0,value:d,onChange:({value:e})=>u(e)})}):null,l?/* @__PURE__ */be(vv,{title:r("Are you sure you want to delete these items:"),onConfirm:function(){n.exec("delete-files",{ids:l.selected}),c(null)},onCancel:()=>c(null),children:l.selected?/* @__PURE__ */be("ul",{className:"wx-gq7BMzEP wx-list",children:l.selected.map((e,t)=>/* @__PURE__ */be("li",{children:e},t))}):null}):null]})}var wb={"7z":!0,rar:!0,zip:!0,css:!0,html:!0,js:!0,php:!0,md:!0,xml:!0,sql:!0,aif:!0,mid:!0,mp3:!0,waw:!0,wma:!0,doc:!0,docx:!0,txt:!0,avi:!0,mov:!0,mp4:!0,mpeg:!0,mpg:!0,pdf:!0,xls:!0,xlsx:!0,gif:!0,jpg:!0,jpeg:!0,png:!0,psd:!0,tiff:!0,svg:!0,folder:!0,file:!0,multiple:!0,search:!0,none:!0};function Sb({item:e}){let t=se(vb),r=se(Vg.i18n).getGroup("filemanager"),n=se(vb).templates,[a]=Wv(t,"panels"),o=Gv(t,"activePanel"),i=Gv(t,"mode"),s=a[o].selected,l=pe(()=>n.preview(e,214,163),[n,e]),c=pe(()=>n.icon(e,"big"),[n,e]),[d,u]=pe(()=>function(e){let t=e.lastIndexOf("."),r=t>0&&t<e.length-1?Math.min(10,e.length-t):Math.min(5,e.length);return[e.slice(0,-r),e.slice(-r)]}(e.name),[e.name]);/* @__PURE__ */
112
+ return be(ye,{children:"/wx-filemanager-parent-link"===e.id?"search"===i?null:/* @__PURE__ */be("div",{className:"wx-GAOa4kDV wx-back-item",children:/* @__PURE__ */xe("div",{className:"wx-GAOa4kDV wx-back "+(e.navigation?"wx-selected":""),"data-id":Jf("/wx-filemanager-parent-link"),children:[/* @__PURE__ */be("i",{className:"wx-GAOa4kDV wxi-arrow-left"}),/* @__PURE__ */be("span",{children:r("Back to parent folder")})]})}):/* @__PURE__ */xe("div",{className:"wx-GAOa4kDV wx-item "+(s?.length&&s.indexOf(e.id)>=0?"wx-selected":""),"data-id":Jf(e.id),children:[/* @__PURE__ */be("div",l?{className:"wx-GAOa4kDV wx-preview wx-file-preview",children:/* @__PURE__ */be("img",{className:"wx-GAOa4kDV wx-card-preview",alt:r("A miniature file preview"),src:l})}:c?{className:"wx-GAOa4kDV wx-preview wx-file-icon",children:/* @__PURE__ */be("img",{className:"wx-GAOa4kDV wx-card-preview",alt:"",src:c})}:{className:"wx-GAOa4kDV wx-preview",children:/* @__PURE__ */be("i",{className:`wx-GAOa4kDV wxi-${e.type}`})}),"folder"===e.type?/* @__PURE__ */xe("div",{className:"wx-GAOa4kDV wx-info",children:[/* @__PURE__ */xe("div",{className:"wx-GAOa4kDV wx-folder-name",children:[/* @__PURE__ */be("span",{className:"wx-GAOa4kDV wx-type",children:r("Folder")}),/* @__PURE__ */xe("span",{className:"wx-GAOa4kDV wx-name",children:[/* @__PURE__ */be("span",{children:d}),/* @__PURE__ */be("span",{children:u})]})]}),/* @__PURE__ */be("div",{"data-action-id":Jf(e.id),className:"wx-GAOa4kDV wx-more",children:/* @__PURE__ */be("i",{className:"wx-GAOa4kDV wxi-dots-v"})})]}):/* @__PURE__ */xe("div",{className:"wx-GAOa4kDV wx-info",children:[/* @__PURE__ */be("div",{className:"wx-GAOa4kDV wx-file-name",children:/* @__PURE__ */xe("span",{className:"wx-GAOa4kDV wx-name",children:[/* @__PURE__ */be("span",{children:d}),/* @__PURE__ */be("span",{children:u})]})}),/* @__PURE__ */be("div",{"data-action-id":Jf(e.id),className:"wx-GAOa4kDV wx-more",children:/* @__PURE__ */be("i",{className:"wx-GAOa4kDV wxi-dots-v"})})]})]})})}function kb(){let e=se(vb),t=se(Vg.i18n),r=pe(()=>t.getGroup("filemanager"),[t]),[n]=Wv(e,"panels"),a=Gv(e,"activePanel"),o=Gv(e,"mode"),i=n[a]._files,s=n[a].selected,l=n[a].path,c=n[a]._crumbs,d=n[a]._selectNavigation,u=ie((t,r)=>{let n=r&&(r.ctrlKey||r.metaKey),o=r&&r.shiftKey;if("/wx-filemanager-parent-link"===t){if(s.length&&(n||o))return;return void e.exec("select-file",{type:"navigation"})}let i="body"===t&&r?null:t,l=-1!==r.target.className.indexOf("wx-more")||-1!==r.target.className.indexOf("wxi-dots-v");setTimeout(()=>{e.exec("select-file",{id:i,toggle:n&&!l,range:o&&!l,panel:a})},1)},[e,s,a]),h=ie(()=>{c.length>1&&e.exec("set-path",{id:c[c.length-2].id,panel:a,selected:[c[c.length-1].id]})},[e,c,a]),p=ie(t=>{if("/wx-filemanager-parent-link"===t)return h();"search"===o&&e.exec("filter-files",{text:""});let r=i.find(e=>e.id===t);r&&("folder"==r.type?e.exec("set-path",{id:r.id,panel:a}):e.exec("open-file",{id:r.id}))},[e,h,o,i,a]),m=ie((e,t)=>{(!s?.length||!s.filter(t=>t?.id===e).length>0)&&u(e,t)},[s,u]),f=pe(()=>"/"===l?i:[{id:"/wx-filemanager-parent-link",name:r("Back to parent folder"),navigation:d},...i],[l,r,d,i]),g=me(null),v=me();return le(()=>{g.current&&(v.current?(v.current.click=u,v.current._dblclick=p,v.current.context=m):(v.current={click:u,dblclick:e=>v.current._dblclick(e),_dblclick:p,context:m},rg(g.current,v.current)))},[u,p,m]),"search"!=o||f.length?/* @__PURE__ */be("div",{tabIndex:0,className:"wx-iyjASZCY wx-cards"+("/"!==l&&"search"!==o?" wx-has-back-link":""),"data-id":Jf("body"),ref:g,children:f.map(e=>/* @__PURE__ */be(Sb,{item:e},e.id))}):/* @__PURE__ */be("div",{className:"wx-iyjASZCY wx-not-found",children:/* @__PURE__ */be("div",{className:"wx-iyjASZCY wx-not-found-text",children:r("Looks like nothing is here")})})}function Cb({name:e="",spin:t=!1,onClick:r}){/* @__PURE__ */
113
+ return be("i",{"data-menu-ignore":"true",className:`wx-uwcvNSAG wx-icon wxi-${e} ${t?"wx-spin":""} ${r?"wx-clickable":""}`,onClick:()=>{r&&r()}})}function Nb(){let e=se(Vg.i18n).getGroup("filemanager"),t=se(vb),r=Gv(t,"activePanel"),[n]=Wv(t,"panels"),a=pe(()=>n[r]._crumbs,[n,r]);/* @__PURE__ */
114
+ return xe("div",{className:"wx-GDJvtROw wx-search",children:[/* @__PURE__ */xe("div",{className:"wx-GDJvtROw wx-toolbar",children:[/* @__PURE__ */be("div",{className:"wx-GDJvtROw wx-back-icon",children:/* @__PURE__ */be(Cb,{name:"angle-left",onClick:function(){t.exec("filter-files",{text:""})}})}),/* @__PURE__ */xe("div",{className:"wx-GDJvtROw wx-text",children:[e("Search results in")," ",Array.isArray(a)&&a.map((t,r)=>/* @__PURE__ */xe(ee,{children:[r?"/":null,"/"==t.id?e(t.name):t.name]},r))]})]}),/* @__PURE__ */be(kb,{})]})}function Tb({narrowMode:e,extraInfo:t}){let r=se(vb),{preview:n,icon:a}=r.templates,o=se(Vg.i18n),i=pe(()=>o.getGroup("filemanager"),[o]),s=pe(()=>Ig("%D, %d %F %Y, %H:%i",o.getRaw().calendar),[o]),[l,c]=Wv(r,"panels"),d=Gv(r,"activePanel"),u=Gv(r,"preview"),h=Gv(r,"search"),p=pe(()=>{let e=l&&null!=d&&l[d]?._selected?.length||0;return h&&!e},[h,c,d]),m=pe(()=>{let e=l&&null!=d?l[d]:null;return e?p?e._files:e._selected:[]},[p,c,d]),f=ie((e,t)=>(e?`${e} ${i(e>1?"folders":"folder")} `:"")+(t?`${t} ${i(t>1?"files":"file")}`:""),[i]),g=ie(()=>{r.exec("show-preview",{mode:!u})},[r,u]),v=ie(e=>"folder"===e.type?i("Folder"):e.ext||i("Unknown file"),[i]),y=pe(()=>{let e,t,r,o,s,l,c,d;if(1!==m.length||p){if(t=s=null,e="",m.length){let t,r=0,n=0,a=0,o=[];m.forEach(e=>{typeof e.size>"u"&&(t=!0,r=void 0),t||(r+=e.size),o.push(v(e)),"folder"===e.type?n++:a++});let s=new Set(o);l=s.size>1?i("multiple"):[...s][0],c=f(n,a),d=r,p||(e=i("Multiple files"))}o=a({type:p?"search":m.length?"multiple":"none"},"big"),r=""}else{t=m[0],e=t.name;let i=n(t,400,500);i?(r=i,o=""):(o=a(t,"big"),r=""),s="folder"!==t.type}return{name:e,item:t,previewSrc:r,iconSrc:o,showDownloadIcon:s,type:l,totalCount:c,totalSize:d}},[m,p,n,a,i,v,f]),b=ie(()=>{r.exec("download-file",{id:m[0].id})},[r,m]),x=ie(async e=>{if(!t||!e)return null;try{return await t(e)}catch(e){return null}},[t]),[w,S]=fe(null);return le(()=>{let e=!1;return S(null),Promise.resolve(x(y.item)).then(t=>{e||S(t)}).catch(()=>{e||S(null)}),()=>{e=!0}},[x,y.item]),/* @__PURE__ */be("div",{className:"wx-O0BTtRrH wx-wrapper",children:m&&m.length?/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */xe("div",{className:"wx-O0BTtRrH wx-preview",children:[/* @__PURE__ */xe("div",{className:"wx-O0BTtRrH wx-toolbar",children:[/* @__PURE__ */be("div",{className:"wx-O0BTtRrH wx-name",children:y.name}),/* @__PURE__ */xe("div",{className:"wx-O0BTtRrH wx-icons",children:[y.showDownloadIcon?/* @__PURE__ */be(Cb,{name:"download",onClick:b}):null,e?/* @__PURE__ */be(Cb,{name:"close",onClick:g}):null]})]}),y.previewSrc?/* @__PURE__ */be("div",{className:"wx-O0BTtRrH wx-img-wrapper",children:/* @__PURE__ */be("img",{src:y.previewSrc,alt:i("A miniature file preview")})}):y.iconSrc?/* @__PURE__ */be("div",{className:"wx-O0BTtRrH wx-icon-wrapper",children:/* @__PURE__ */be("img",{src:y.iconSrc,alt:i("A miniature file preview")})}):/* @__PURE__ */be("div",{className:"wx-O0BTtRrH wx-icon-wrapper",children:y.item?/* @__PURE__ */be("i",{className:`wx-O0BTtRrH wx-icon wxi-${y.item.type}`}):/* @__PURE__ */be("i",{className:"wx-O0BTtRrH wx-icon wxi-"+(p?"search":"file-multiple-outline")})})]}),/* @__PURE__ */xe("div",{className:"wx-O0BTtRrH wx-info-panel",children:[/* @__PURE__ */be("div",{className:"wx-O0BTtRrH wx-title",children:i(p?"Found":"Information")}),/* @__PURE__ */xe("div",{className:"wx-O0BTtRrH wx-list",children:[y.item?/* @__PURE__ */xe(ye,{children:[
115
115
  /* @__PURE__ */be("span",{className:"wx-O0BTtRrH wx-name",children:i("Type")}),
116
- /* @__PURE__ */be("span",{className:"wx-O0BTtRrH wx-value",children:v(y.item)}),typeof y.item.size<"u"?/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be("span",{className:"wx-O0BTtRrH wx-name",children:i("Size")}),/* @__PURE__ */be("span",{className:"wx-O0BTtRrH wx-value",children:Fv(y.item.size)})]}):null,
116
+ /* @__PURE__ */be("span",{className:"wx-O0BTtRrH wx-value",children:v(y.item)}),typeof y.item.size<"u"?/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be("span",{className:"wx-O0BTtRrH wx-name",children:i("Size")}),/* @__PURE__ */be("span",{className:"wx-O0BTtRrH wx-value",children:zv(y.item.size)})]}):null,
117
117
  /* @__PURE__ */be("span",{className:"wx-O0BTtRrH wx-name",children:i("Date")}),
118
118
  /* @__PURE__ */xe("span",{className:"wx-O0BTtRrH wx-value",children:[s(y.item.date)," "]})]}):/* @__PURE__ */xe(ye,{children:[
119
119
  /* @__PURE__ */be("span",{className:"wx-O0BTtRrH wx-name",children:i("Count")}),
120
120
  /* @__PURE__ */be("span",{className:"wx-O0BTtRrH wx-value",children:y.totalCount}),
121
121
  /* @__PURE__ */be("span",{className:"wx-O0BTtRrH wx-name",children:i("Type")}),
122
- /* @__PURE__ */be("span",{className:"wx-O0BTtRrH wx-value",children:y.type}),typeof y.totalSize<"u"?/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be("span",{className:"wx-O0BTtRrH wx-name",children:i("Size")}),/* @__PURE__ */be("span",{className:"wx-O0BTtRrH wx-value",children:Fv(y.totalSize)})]}):null]}),w?Object.entries(w).map(([e,t])=>/* @__PURE__ */xe(Z.Fragment,{children:[/* @__PURE__ */be("span",{className:"wx-O0BTtRrH wx-name",children:e}),/* @__PURE__ */be("span",{className:"wx-O0BTtRrH wx-value",children:t})]},e)):null]})]})]}):/* @__PURE__ */xe("div",{className:"wx-O0BTtRrH wx-no-info-panel",children:[/* @__PURE__ */xe("div",{className:"wx-O0BTtRrH wx-toolbar",children:[/* @__PURE__ */be("div",{className:"wx-O0BTtRrH wx-name",children:y.name}),/* @__PURE__ */be("div",{className:"wx-O0BTtRrH wx-icons",children:e?/* @__PURE__ */be(Db,{name:"close",onClick:g}):null})]}),/* @__PURE__ */be("div",{className:"wx-O0BTtRrH wx-no-info-wrapper",children:/* @__PURE__ */xe("div",{className:"wx-O0BTtRrH wx-no-info",children:[y.previewSrc?/* @__PURE__ */be("div",{className:"wx-O0BTtRrH wx-img-wrapper",children:/* @__PURE__ */be("img",{src:y.previewSrc,alt:i("A miniature file preview")})}):y.iconSrc?/* @__PURE__ */be("div",{className:"wx-O0BTtRrH wx-icon-wrapper",children:/* @__PURE__ */be("img",{src:y.iconSrc,alt:i("A miniature file preview")})}):/* @__PURE__ */be("div",{className:"wx-O0BTtRrH wx-icon-wrapper",children:/* @__PURE__ */be("i",{className:"wx-O0BTtRrH wx-icon wxi-"+(p?"search":"message-question-outline")})}),/* @__PURE__ */be("span",{className:"wx-O0BTtRrH wx-text",children:p?"":i("Select file or folder to view details")})]})})]})})}function Rb({panel:e}){let t=se(Sb),r=se(Ug.i18n),n=pe(()=>r.getGroup("filemanager"),[r]),[a,o]=Jv(t,"panels"),i=pe(()=>a[e]._files,[o,e]),s=pe(()=>a[e]._crumbs||[],[o,e]);function l(r){let n=jv(r,s);t.exec("set-path",{id:r,panel:e,...n&&{selected:[n]}})}let[c,d]=fe(null);le(()=>{i&&d(null)},[i]);let u=me(null),h=me();return le(()=>{h.current?h.current.click=l:(h.current={click:l},sg(u.current,h.current))},[l]),/* @__PURE__ */xe("div",{className:"wx-SNY5LTYx wx-breadcrumbs","data-menu-ignore":"true",ref:u,children:[/* @__PURE__ */be("div",{className:"wx-SNY5LTYx wx-refresh-icon",children:/* @__PURE__ */be(Db,{name:"refresh",spin:!!c,onClick:function(){d(!0),t.exec("request-data",{id:s[s.length-1].id}),setTimeout(()=>{d(null)},5e3)}})}),s.map((e,t)=>/* @__PURE__ */xe(Z.Fragment,{children:[t?/* @__PURE__ */be(Db,{name:"angle-right"}):null,/* @__PURE__ */be("div",{className:"wx-SNY5LTYx wx-item","data-id":ng(e.id),"data-menu-ignore":"true",children:"/"==e.id?n(e.name):e.name})]},t))]})}function zb({row:e}){let t=se(Ug.i18n),[r]=fe(()=>t.getGroup("filemanager")),n=se(Sb).templates,[a]=fe(()=>n.icon(e,"small"));/* @__PURE__ */
123
- return be("div",{className:"wx-qgAqG6sL wx-name-cell",children:"/wx-filemanager-parent-link"===e.id?/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be("i",{className:"wx-qgAqG6sL wxi-arrow-left"}),/* @__PURE__ */xe("span",{className:"wx-qgAqG6sL wx-name",children:[" ",r("Back to parent folder")]})]}):/* @__PURE__ */xe(ye,{children:[a?/* @__PURE__ */be("img",{className:"wx-qgAqG6sL wx-icon",alt:"",src:a,height:"24px",width:"24px"}):/* @__PURE__ */be("i",{className:`wx-qgAqG6sL wxi-${e.type}`}),/* @__PURE__ */xe("span",{className:"wx-qgAqG6sL wx-name",children:[" ",e.name," "]})]})})}function _b({children:e}){let t=se(Sb),r=Zv(t,"activePanel"),n=se(Cb),a=me(null),o=me({});return o.current.drop=()=>{let e=function(e,t="data-id"){let r=eg(e,t);return r?r.getAttribute(t):null}(a.current,"data-panel");e&&e!=r&&t.exec("set-active-panel",{panel:1*e})},o.current.dragEnter=()=>{let e=a.current;e&&e.classList.toggle("wx-active")},o.current.dragLeave=()=>{let e=a.current;e&&e.classList.toggle("wx-active")},le(()=>{let e=a.current;return n.droparea(e,o.current)},[]),/* @__PURE__ */be("div",{className:"wx-LT9X7tb7 wx-upload-area",ref:a,children:e})}function Pb({panel:e,active:t=!1,onClick:r,onContextMenu:n}){let a=se(Sb),o=se(Ug.i18n),i=pe(()=>o.getGroup("filemanager"),[o]),s=pe(()=>Og("%d %M %Y",o.getRaw().calendar),[o]),[l]=Jv(a,"panels"),c=l[e].selected,d=l[e].path,u=l[e]._crumbs,h=l[e]._sorts,p=l[e]._selectNavigation,m=l[e]._files,f=pe(()=>[{id:"name",header:i("Name"),flexgrow:3,sort:!0,resize:!0,cell:zb},{id:"size",header:i("Size"),width:100,sort:!0,resize:!0,template:e=>"number"==typeof e?Fv(e):""},{id:"date",header:i("Date"),width:120,sort:!0,resize:!0,template:e=>e?s(e):""}],[i,s]),g=me(null),v=me(null),y=pe(()=>p?["/wx-filemanager-parent-link"]:[...c],[p,c]);function b(t,r){if(r&&r.target&&r.target.className&&-1!==r.target.className.indexOf("wx-grip"))return;let n=r&&(r.ctrlKey||r.metaKey),o=r&&r.shiftKey;if("/wx-filemanager-parent-link"===t){if(c.length&&(n||o))return;return void a.exec("select-file",{type:"navigation"})}let i="body"===t&&r?null:t;g.current||v.current?(g.current=null,v.current=null):a.exec("select-file",{id:i,toggle:n,range:o,panel:e})}function x(t){if("/wx-filemanager-parent-link"===t)return void(u.length>1&&a.exec("set-path",{id:u[u.length-2].id,panel:e,selected:[u[u.length-1].id]}));let r=m.find(e=>e.id===t);r&&("folder"===r.type?a.exec("set-path",{id:r.id,panel:e}):a.exec("open-file",{id:r.id}))}function w(t){let r=t.key,n=h[d],o=n?"asc":"desc";n&&n.key===r&&(o="asc"===n.order?"desc":"asc"),a.exec("sort-files",{key:r,order:o,panel:e,path:d})}let S=pe(()=>"/"===d?m:[{id:"/wx-filemanager-parent-link",name:i("Back to parent folder")},...m],[d,m,i]),k=pe(()=>{if(S&&h&&h[d]){let{key:e,order:t}=h[d];return{[e]:{order:t}}}},[S,h,d]),C=me(null),N=me();return le(()=>{N.current?(N.current.click=b,N.current._dblclick=x):(N.current={click:b,dblclick:e=>N.current._dblclick(e),_dblclick:x},sg(C.current,N.current))},[b,x]),/* @__PURE__ */xe("div",{onClick:r,onContextMenu:n,className:"wx-SSaVhET7 wx-wrapper",children:[/* @__PURE__ */be(Rb,{panel:e}),/* @__PURE__ */be("div",{"data-id":ng("body"),className:"wx-SSaVhET7 wx-list "+(t?"wx-active":""),ref:C,children:/* @__PURE__ */be(_b,{children:/* @__PURE__ */be(wb,{init:function(e){e.intercept("sort-rows",e=>(g.current=!0,w(e),!1)),e.intercept("select-row",()=>!1),e.on("resize-column",()=>v.current=!0),e.intercept("hotkey",()=>!1)},data:S,columns:f,selectedRows:y,columnStyle:()=>"wx-SSaVhET7 wx-each-cell",sizes:{rowHeight:42,headerHeight:42},sortMarks:k})})})]})}function Ob(){let e=se(Sb),t=Zv(e,"activePanel");function r(t){e.exec("set-active-panel",{panel:t})}/* @__PURE__ */
124
- return xe("div",{className:"wx-L55BfJa2 wx-panels","data-id":ng("body"),children:[/* @__PURE__ */be("div",{className:"wx-L55BfJa2 wx-item","data-panel":0,children:/* @__PURE__ */be(Pb,{panel:0,active:0==t,onClick:()=>r(0),onContextMenu:()=>r(0)})}),/* @__PURE__ */be("div",{className:"wx-L55BfJa2 wx-item","data-panel":1,children:/* @__PURE__ */be(Pb,{panel:1,active:1==t,onClick:()=>r(1),onContextMenu:()=>r(1)})})]})}function Lb({folderIcon:e=!1,folder:t={}}){let r=se(Sb),[n,a]=Jv(r,"panels"),o=Zv(r,"activePanel"),i=pe(()=>n[o].path,[a,o]),s=se(Ug.i18n),l=pe(()=>s.getGroup("filemanager"),[s]),c=pe(()=>!!t.data?.find(e=>"folder"===e.type),[t]),d=pe(()=>"/"==t.id?l(t.name):t.name,[t,l]),u=pe(()=>t.$level>1?20*(t.$level-1):0,[t]),h=t.open;/* @__PURE__ */
125
- return xe(ye,{children:[/* @__PURE__ */xe("li",{"data-id":ng(t.id),className:"wx-NYfhvGIt wx-folder"+(i===t.id?" wx-selected":""),style:{paddingLeft:`${u}px`},children:[c?/* @__PURE__ */be("i",{className:"wx-NYfhvGIt wx-toggle wxi-"+(h?"angle-down":"angle-right"),"data-action":"toggle"}):/* @__PURE__ */be("span",{className:"wx-NYfhvGIt wx-toggle-placeholder"}),
122
+ /* @__PURE__ */be("span",{className:"wx-O0BTtRrH wx-value",children:y.type}),typeof y.totalSize<"u"?/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be("span",{className:"wx-O0BTtRrH wx-name",children:i("Size")}),/* @__PURE__ */be("span",{className:"wx-O0BTtRrH wx-value",children:zv(y.totalSize)})]}):null]}),w?Object.entries(w).map(([e,t])=>/* @__PURE__ */xe(Z.Fragment,{children:[/* @__PURE__ */be("span",{className:"wx-O0BTtRrH wx-name",children:e}),/* @__PURE__ */be("span",{className:"wx-O0BTtRrH wx-value",children:t})]},e)):null]})]})]}):/* @__PURE__ */xe("div",{className:"wx-O0BTtRrH wx-no-info-panel",children:[/* @__PURE__ */xe("div",{className:"wx-O0BTtRrH wx-toolbar",children:[/* @__PURE__ */be("div",{className:"wx-O0BTtRrH wx-name",children:y.name}),/* @__PURE__ */be("div",{className:"wx-O0BTtRrH wx-icons",children:e?/* @__PURE__ */be(Cb,{name:"close",onClick:g}):null})]}),/* @__PURE__ */be("div",{className:"wx-O0BTtRrH wx-no-info-wrapper",children:/* @__PURE__ */xe("div",{className:"wx-O0BTtRrH wx-no-info",children:[y.previewSrc?/* @__PURE__ */be("div",{className:"wx-O0BTtRrH wx-img-wrapper",children:/* @__PURE__ */be("img",{src:y.previewSrc,alt:i("A miniature file preview")})}):y.iconSrc?/* @__PURE__ */be("div",{className:"wx-O0BTtRrH wx-icon-wrapper",children:/* @__PURE__ */be("img",{src:y.iconSrc,alt:i("A miniature file preview")})}):/* @__PURE__ */be("div",{className:"wx-O0BTtRrH wx-icon-wrapper",children:/* @__PURE__ */be("i",{className:"wx-O0BTtRrH wx-icon wxi-"+(p?"search":"message-question-outline")})}),/* @__PURE__ */be("span",{className:"wx-O0BTtRrH wx-text",children:p?"":i("Select file or folder to view details")})]})})]})})}function Ab({panel:e}){let t=se(vb),r=se(Vg.i18n),n=pe(()=>r.getGroup("filemanager"),[r]),[a,o]=Wv(t,"panels"),i=pe(()=>a[e]._files,[o,e]),s=pe(()=>a[e]._crumbs||[],[o,e]);function l(r){let n=Fv(r,s);t.exec("set-path",{id:r,panel:e,...n&&{selected:[n]}})}let[c,d]=fe(null);le(()=>{i&&d(null)},[i]);let u=me(null),h=me();return le(()=>{h.current?h.current.click=l:(h.current={click:l},rg(u.current,h.current))},[l]),/* @__PURE__ */xe("div",{className:"wx-SNY5LTYx wx-breadcrumbs","data-menu-ignore":"true",ref:u,children:[/* @__PURE__ */be("div",{className:"wx-SNY5LTYx wx-refresh-icon",children:/* @__PURE__ */be(Cb,{name:"refresh",spin:!!c,onClick:function(){d(!0),t.exec("request-data",{id:s[s.length-1].id}),setTimeout(()=>{d(null)},5e3)}})}),s.map((e,t)=>/* @__PURE__ */xe(Z.Fragment,{children:[t?/* @__PURE__ */be(Cb,{name:"angle-right"}):null,/* @__PURE__ */be("div",{className:"wx-SNY5LTYx wx-item","data-id":Jf(e.id),"data-menu-ignore":"true",children:"/"==e.id?n(e.name):e.name})]},t))]})}function Mb({row:e}){let t=se(Vg.i18n),[r]=fe(()=>t.getGroup("filemanager")),n=se(vb).templates,[a]=fe(()=>n.icon(e,"small"));/* @__PURE__ */
123
+ return be("div",{className:"wx-qgAqG6sL wx-name-cell",children:"/wx-filemanager-parent-link"===e.id?/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be("i",{className:"wx-qgAqG6sL wxi-arrow-left"}),/* @__PURE__ */xe("span",{className:"wx-qgAqG6sL wx-name",children:[" ",r("Back to parent folder")]})]}):/* @__PURE__ */xe(ye,{children:[a?/* @__PURE__ */be("img",{className:"wx-qgAqG6sL wx-icon",alt:"",src:a,height:"24px",width:"24px"}):/* @__PURE__ */be("i",{className:`wx-qgAqG6sL wxi-${e.type}`}),/* @__PURE__ */xe("span",{className:"wx-qgAqG6sL wx-name",children:[" ",e.name," "]})]})})}function Db({children:e}){let t=se(vb),r=Gv(t,"activePanel"),n=se(bb),a=me(null),o=me({});return o.current.drop=()=>{let e=function(e,t="data-id"){let r=Yf(e,t);return r?r.getAttribute(t):null}(a.current,"data-panel");e&&e!=r&&t.exec("set-active-panel",{panel:1*e})},o.current.dragEnter=()=>{let e=a.current;e&&e.classList.toggle("wx-active")},o.current.dragLeave=()=>{let e=a.current;e&&e.classList.toggle("wx-active")},le(()=>{let e=a.current;return n.droparea(e,o.current)},[]),/* @__PURE__ */be("div",{className:"wx-LT9X7tb7 wx-upload-area",ref:a,children:e})}function Eb({panel:e,active:t=!1,onClick:r,onContextMenu:n}){let a=se(vb),o=se(Vg.i18n),i=pe(()=>o.getGroup("filemanager"),[o]),s=pe(()=>Ig("%d %M %Y",o.getRaw().calendar),[o]),[l]=Wv(a,"panels"),c=l[e].selected,d=l[e].path,u=l[e]._crumbs,h=l[e]._sorts,p=l[e]._selectNavigation,m=l[e]._files,f=pe(()=>[{id:"name",header:i("Name"),flexgrow:3,sort:!0,resize:!0,cell:Mb},{id:"size",header:i("Size"),width:100,sort:!0,resize:!0,template:e=>"number"==typeof e?zv(e):""},{id:"date",header:i("Date"),width:120,sort:!0,resize:!0,template:e=>e?s(e):""}],[i,s]),g=me(null),v=me(null),y=pe(()=>p?["/wx-filemanager-parent-link"]:[...c],[p,c]);function b(t,r){if(r&&r.target&&r.target.className&&-1!==r.target.className.indexOf("wx-grip"))return;let n=r&&(r.ctrlKey||r.metaKey),o=r&&r.shiftKey;if("/wx-filemanager-parent-link"===t){if(c.length&&(n||o))return;return void a.exec("select-file",{type:"navigation"})}let i="body"===t&&r?null:t;g.current||v.current?(g.current=null,v.current=null):a.exec("select-file",{id:i,toggle:n,range:o,panel:e})}function x(t){if("/wx-filemanager-parent-link"===t)return void(u.length>1&&a.exec("set-path",{id:u[u.length-2].id,panel:e,selected:[u[u.length-1].id]}));let r=m.find(e=>e.id===t);r&&("folder"===r.type?a.exec("set-path",{id:r.id,panel:e}):a.exec("open-file",{id:r.id}))}function w(t){let r=t.key,n=h[d],o=n?"asc":"desc";n&&n.key===r&&(o="asc"===n.order?"desc":"asc"),a.exec("sort-files",{key:r,order:o,panel:e,path:d})}let S=pe(()=>"/"===d?m:[{id:"/wx-filemanager-parent-link",name:i("Back to parent folder")},...m],[d,m,i]),k=pe(()=>{if(S&&h&&h[d]){let{key:e,order:t}=h[d];return{[e]:{order:t}}}},[S,h,d]),C=me(null),N=me();return le(()=>{N.current?(N.current.click=b,N.current._dblclick=x):(N.current={click:b,dblclick:e=>N.current._dblclick(e),_dblclick:x},rg(C.current,N.current))},[b,x]),/* @__PURE__ */xe("div",{onClick:r,onContextMenu:n,className:"wx-SSaVhET7 wx-wrapper",children:[/* @__PURE__ */be(Ab,{panel:e}),/* @__PURE__ */be("div",{"data-id":Jf("body"),className:"wx-SSaVhET7 wx-list "+(t?"wx-active":""),ref:C,children:/* @__PURE__ */be(Db,{children:/* @__PURE__ */be(gb,{init:function(e){e.intercept("sort-rows",e=>(g.current=!0,w(e),!1)),e.intercept("select-row",()=>!1),e.on("resize-column",()=>v.current=!0),e.intercept("hotkey",()=>!1)},data:S,columns:f,selectedRows:y,columnStyle:()=>"wx-SSaVhET7 wx-each-cell",sizes:{rowHeight:42,headerHeight:42},sortMarks:k})})})]})}function Ib(){let e=se(vb),t=Gv(e,"activePanel");function r(t){e.exec("set-active-panel",{panel:t})}/* @__PURE__ */
124
+ return xe("div",{className:"wx-L55BfJa2 wx-panels","data-id":Jf("body"),children:[/* @__PURE__ */be("div",{className:"wx-L55BfJa2 wx-item","data-panel":0,children:/* @__PURE__ */be(Eb,{panel:0,active:0==t,onClick:()=>r(0),onContextMenu:()=>r(0)})}),/* @__PURE__ */be("div",{className:"wx-L55BfJa2 wx-item","data-panel":1,children:/* @__PURE__ */be(Eb,{panel:1,active:1==t,onClick:()=>r(1),onContextMenu:()=>r(1)})})]})}function Rb({folderIcon:e=!1,folder:t={}}){let r=se(vb),[n,a]=Wv(r,"panels"),o=Gv(r,"activePanel"),i=pe(()=>n[o].path,[a,o]),s=se(Vg.i18n),l=pe(()=>s.getGroup("filemanager"),[s]),c=pe(()=>!!t.data?.find(e=>"folder"===e.type),[t]),d=pe(()=>"/"==t.id?l(t.name):t.name,[t,l]),u=pe(()=>t.$level>1?20*(t.$level-1):0,[t]),h=t.open;/* @__PURE__ */
125
+ return xe(ye,{children:[/* @__PURE__ */xe("li",{"data-id":Jf(t.id),className:"wx-NYfhvGIt wx-folder"+(i===t.id?" wx-selected":""),style:{paddingLeft:`${u}px`},children:[c?/* @__PURE__ */be("i",{className:"wx-NYfhvGIt wx-toggle wxi-"+(h?"angle-down":"angle-right"),"data-action":"toggle"}):/* @__PURE__ */be("span",{className:"wx-NYfhvGIt wx-toggle-placeholder"}),
126
126
  /* @__PURE__ */be("i",{className:"wx-NYfhvGIt "+(e||"wxi-folder")}),
127
- /* @__PURE__ */xe("span",{className:"wx-NYfhvGIt wx-name",children:[" ",d," "]})]}),h&&t.data&&t.data.length&&c?/* @__PURE__ */be(ye,{children:t.data.map(e=>"folder"===e.type?/* @__PURE__ */be(Lb,{folder:e},e.id):null)}):null]})}function Fb(){let e=se(Sb),[t,r]=Jv(e,"data"),[n,a]=Jv(e,"panels"),o=Zv(e,"activePanel"),i=pe(()=>n[o]._crumbs,[a,o]),s=ie(r=>{e.exec("open-tree-folder",{id:r,mode:!t.byId(r).open})},[e,r]),l=ie(t=>{let r=jv(t,i);e.exec("set-path",{id:t,panel:o,...r&&{selected:[r]}})},[e,i,o]),[c,d]=fe([]);le(()=>{d(t.byId(0).data)},[r]);let u=me(null),h=me();return le(()=>{h.current?(h.current.click=l,h.current.toggle=s):(h.current={click:l,toggle:s},sg(u.current,h.current))},[l,s]),/* @__PURE__ */be("ul",{ref:u,className:"wx-LyHJ6R6A",children:c.map(e=>"folder"===e.type?/* @__PURE__ */be(Lb,{folder:e},e.id):null)})}function Bb(){let e=se(Sb),t=se(Ug.i18n),r=pe(()=>t.getGroup("filemanager"),[t]),n=Zv(e,"drive"),a=n?n.used:"",o=n?n.total:"";return a&&o?/* @__PURE__ */xe("div",{className:"wx-DetSyKGG wx-drive",children:[/* @__PURE__ */be("progress",{value:a,max:o,className:"wx-DetSyKGG wx-progress"}),/* @__PURE__ */xe("p",{children:[Fv(a)," ",r("of")," ",Fv(o)," ",r("used")]})]}):null}function Vb({option:e}){let t=se(Ug.i18n).getGroup("filemanager"),r=se(Cb),n=ie(()=>{r.open({})},[r]);/* @__PURE__ */
128
- return be("div",{className:"wx-9XiKcxq5 wx-upload-button",onClick:n,children:/* @__PURE__ */be("span",{children:t(e.text)})})}function $b({readonly:e,menuOptions:t}){let r=se(Ug.i18n).getGroup("filemanager"),{showPrompt:n}=se(kb);le(()=>{!function(e,t){oy[e]=t}("upload",Vb)},[]);let a=pe(()=>t("add").map(e=>(e.text=r(e.text),e)),[t,r]);/* @__PURE__ */
129
- return xe("div",{className:"wx-FlucfALM wx-wrapper",children:[!e&&/* @__PURE__ */be("div",{className:"wx-FlucfALM wx-button",children:/* @__PURE__ */be(cy,{options:a,at:"bottom-fit",onClick:function({action:e}){e&&("add-file"===e.id?n({item:{type:"file",size:0,date:/* @__PURE__ */new Date},add:!0}):"add-folder"===e.id&&n({item:{type:"folder",date:/* @__PURE__ */new Date},add:!0}))},children:/* @__PURE__ */be(Wg,{type:"primary block",children:r("Add New")})})}),
130
- /* @__PURE__ */be("div",{className:"wx-FlucfALM wx-tree",children:/* @__PURE__ */be(Fb,{})}),
131
- /* @__PURE__ */be(Bb,{})]})}function Hb({value:e="",onSearch:t}){let[r,n]=Xv(e),a=se(Ug.i18n).getGroup("filemanager"),o=me(null),i=pe(()=>""===r?"wxi-search":"wxi-close",[r]);/* @__PURE__ */
132
- return xe("div",{className:"wx-lUZMtgT1 wx-search-input",children:[/* @__PURE__ */be("i",{className:`wx-lUZMtgT1 wx-icon ${i}`,onClick:function(){n(""),o.current&&o.current.focus(),t&&t({value:""})}}),/* @__PURE__ */be("input",{type:"text",className:"wx-lUZMtgT1 wx-text",ref:o,value:r,onInput:function(e){let r=e.target.value;n(r),t&&t({value:r})},placeholder:a("Search")})]})}function jb({narrowMode:e=!1,onShowTree:t}){let r=se(Sb),n=se(Ug.i18n).getGroup("filemanager"),a=Zv(r,"mode"),o=Zv(r,"preview"),i=Zv(r,"search");/* @__PURE__ */
133
- return xe("div",{className:"wx-5PZQQztG wx-toolbar",children:[/* @__PURE__ */xe("div",{className:"wx-5PZQQztG wx-left "+(e?"wx-left-narrow":""),children:[e?"panels"===a||"search"===a?null:/* @__PURE__ */be("div",{className:"wx-5PZQQztG wx-sidebar-icon","data-id":ng("toggle-tree"),children:/* @__PURE__ */be(Db,{onClick:()=>t&&t(),name:"subtask"})}):/* @__PURE__ */be("div",{className:"wx-5PZQQztG wx-name",children:n("Files")}),/* @__PURE__ */be(Hb,{onSearch:function(e){r.exec("filter-files",{text:e.value})},value:i})]}),/* @__PURE__ */xe("div",{className:"wx-5PZQQztG wx-right",children:[e?null:/* @__PURE__ */be("div",{className:"wx-5PZQQztG wx-preview-icon",children:/* @__PURE__ */be(Nv,{onClick:function(e){e.preventDefault(),r.exec("show-preview",{mode:!o})},value:o,children:/* @__PURE__ */be("i",{className:"wx-5PZQQztG wxi-eye"})})}),/* @__PURE__ */be("div",{className:"wx-5PZQQztG wx-modes",children:/* @__PURE__ */be(bv,{value:a,options:[{icon:"wxi-view-sequential",id:"table"},{icon:"wxi-view-grid",id:"cards"},{icon:"wxi-view-column",id:"panels"}],onChange:function({value:e}){r.exec("set-mode",{mode:e})}})})]})]})}function qb(){let e=Zv(se(Sb),"activePanel");/* @__PURE__ */
134
- return xe("div",{className:"wx-NwohNJzN wx-wrapper",children:[/* @__PURE__ */be(Rb,{panel:e}),/* @__PURE__ */be(_b,{children:/* @__PURE__ */be(Mb,{})})]})}function Ub({readonly:e=!1,menuOptions:t,extraInfo:r}){let n=me(null),a=me(null),[o,i]=fe(void 0),[s,l]=fe(void 0),[c,d]=fe(!1),u=py(),h=se(Sb),{showPrompt:p,showConfirm:m}=se(kb),f=se(Ug.i18n),g=pe(()=>f.getGroup("filemanager"),[f]),v=Zv(h,"mode"),y=Zv(h,"preview"),b=Zv(h,"activePanel"),[x,w]=Jv(h,"panels"),S=pe(()=>(x&&null!=b?x[b]:null)?.selected??[],[w,b]),k=pe(()=>(x&&null!=b?x[b]:null)?.path,[w,b]),[C,N]=fe([]);le(()=>{let e=n.current;if(!e)return;let t=new ResizeObserver(e=>{let t=e[0]?.borderBoxSize?.[0]?.inlineSize;"number"==typeof t&&l(t<768)});return t.observe(e),()=>{t.disconnect()}},[]);let T=ie(()=>{d(e=>!e)},[]),A=ie(e=>{s&&"toggle-tree"!==tg(e)&&d(!1)},[s]);le(()=>{let e=a.current;if(e)return fg(e,A).destroy},[A]),le(()=>{let e=a.current;if(!e)return;let t=new ResizeObserver(()=>{e&&i(e.clientWidth)});return t.observe(e),e&&i(e.clientWidth),()=>{t.disconnect()}},[]);let M=pe(()=>({icon:"wxi-eye",text:"Preview",id:"preview"}),[]),D=ie(e=>{let r=s?[M]:[];return"file"===e&&(r=[...r,...t().filter(e=>"download"===e.id)]),r},[s,M,t]),E=me(null),I=ie((e,t,r)=>{let n=r?[t.id]:S;switch(e){case"download":h.exec("download-file",{id:t.id});break;case"copy":case"move":E.current={action:e,ids:n};break;case"paste":E.current&&h.exec("copy"===E.current.action?"copy-files":"move-files",{ids:E.current.ids,target:"folder"===t?.type?t.id:k});break;case"rename":p({item:t});break;case"delete":m({selected:n});break;case"preview":h.exec("show-preview",{mode:!y})}},[h,S,k,p,m,y]),R=ie(()=>x?.[b],[x,b]);le(()=>{let r=n.current;if(!r)return;let a=function(e,t){let{api:r}=t;function n(e,n){let a,o=t.getPanel(),i=o.selected,s=n.ctrlKey||n.metaKey,l=n.shiftKey,c=i?.[0]?r.getFile(i[0]):null;a=i?.length?i.length>1?t.menuOptions("multiselect"):t.menuOptions(c.type,c):t.menuOptions("body");let d=`${s?"ctrl+":""}${l?"shift+":""}${e}`,u=!!a&&a.find(e=>e.hotkey?.toLowerCase()===d),h=t.performAction;if(u)switch(d){case"ctrl+c":h("copy");break;case"ctrl+x":h("move");break;case"ctrl+v":h("paste",c);break;case"delete":h("delete");break;case"ctrl+r":n.preventDefault(),h("rename",c);break;case"ctrl+d":n.preventDefault(),h("download",c);break;default:u.handler?.({context:c})}switch(e){case"enter":{if(s||l)break;let{_crumbs:e,_selectNavigation:t}=o;if(t){let t=function(e){return e.length>1?e[e.length-2].id:null}(e);if(t){let n=jv(t,e);r.exec("set-path",{id:t,selected:[n]})}}else if(1===i.length){let e=r.getFile(i[0]);e&&r.exec("folder"===e.type?"set-path":"open-file",{id:e.id})}break}case"arrowup":case"arrowleft":{let e,{_files:t,_selected:n,path:a,_selectNavigation:i}=o;if(n.length){let o=n.at(0).id,i=t.findIndex(e=>e.id===o);if(-1!==i){let n=i-1;t[n]?e=t[n].id:"/"!==a&&!s&&!l&&r.exec("select-file",{type:"navigation"})}}else{if(i)break;if("/"!==a){r.exec("select-file",{type:"navigation"});break}e=t.at(0)?.id}e&&r.exec("select-file",{id:e,toggle:s,range:l});break}case"arrowdown":case"arrowright":{let e,{_files:t,_selected:n,path:a,_selectNavigation:i}=o;if(n.length){let r=n.at(-1).id,a=t.findIndex(e=>e.id===r);if(-1!==a){let r=a+1;t[r]&&(e=t[r].id)}}else{if("/"!==a&&!i){r.exec("select-file",{type:"navigation"});break}e=t.at(0)?.id}e&&r.exec("select-file",{id:e,toggle:s,range:l});break}}}function a(e){let t=e.code.replace("Key","").toLowerCase();n(t,e),"tab"==t&&setTimeout(()=>{let e=document.activeElement;-1!=e.className.indexOf("table")&&r.exec("set-active-panel",{panel:+Wv(e,"data-panel")})})}return e.addEventListener("keydown",a),{destroy:()=>{e.removeEventListener("keydown",a)}}}(r,{api:h,menuOptions:e?D:t,performAction:I,getPanel:R});return()=>{"function"==typeof a?a():a&&"function"==typeof a.destroy&&a.destroy()}},[h,e,D,t,I,R]);let z=ie((r,n)=>{let a,o=r?h.getFile(r):null,i=n.target.closest(".tree-item.folder");if(e)a=D(o?.type);else{if("body"===r)a=t(r);else if(o)if(!i&&S.length>1)a=s?[M,...t("multiselect")]:t("multiselect");else if("/"===r)a=t("folder",o).filter(e=>"paste"===e.id);else{let e=t(o.type,o);e&&(a=s?[M,...e]:e)}"search"===v&&(a=a?.filter(e=>"paste"!==e.id))}if(o?.id&&(!S.length||!S.some(e=>e===o.id))&&!i&&h.exec("select-file",{id:o.id}),a?.length)return a.forEach(e=>{i&&(e.hotkey=""),e.text&&=g(e.text),e.hotkey&&(e.subtext=e.hotkey)}),N(a),o||{}},[h,e,D,t,S,s,M,v,g]),_=ie(e=>{let{action:t,context:r}=e;t&&I(t.id,r,!t.hotkey)},[I]);/* @__PURE__ */
135
- return be("div",{className:"wx-RJbNonjJ wx-filemanager wx-flex",ref:n,"data-menu-ignore":"false",children:s&&y?/* @__PURE__ */be("div",{className:"wx-RJbNonjJ wx-info-narrow",children:/* @__PURE__ */be(Ib,{narrowMode:s,extraInfo:r})}):/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be(jb,{narrowMode:s,onShowTree:T}),/* @__PURE__ */be(dy,{dataKey:"id",at:"point",options:C,resolver:z,onClick:_,children:/* @__PURE__ */xe(ly,{dataKey:"actionId",options:C,resolver:z,onClick:_,children:[/* @__PURE__ */be(my,{data:u,apiOnly:!0,uploadURL:async function(e){await Promise.resolve();let{name:t,size:r}=e.file;h.exec("create-file",{file:{name:t,size:r,date:/* @__PURE__ */new Date,file:e.file},parent:k})}}),/* @__PURE__ */be(Cb.Provider,{value:u,children:/* @__PURE__ */be("div",{className:"wx-RJbNonjJ wx-content-wrapper wx-flex",children:/* @__PURE__ */xe(ye,"panels"!==v&&"search"!==v?{children:[/* @__PURE__ */be("div",{className:"wx-RJbNonjJ "+["wx-sidebar",s?"wx-sidebar-narrow":"",c?"wx-sidebar-visible":""].filter(Boolean).join(" "),ref:a,children:/* @__PURE__ */be($b,{readonly:e,menuOptions:t})}),/* @__PURE__ */xe("div",{className:"wx-RJbNonjJ wx-content",style:{width:`calc(100% - ${o||0}px - 10px)`},children:[/* @__PURE__ */be("div",{className:"wx-RJbNonjJ wx-content-item"+(y?"":"-fit"),"data-id":ng("body"),children:"table"===v?/* @__PURE__ */be(Pb,{panel:b}):/* @__PURE__ */be(qb,{})}),y?/* @__PURE__ */be("div",{className:"wx-RJbNonjJ wx-info",children:/* @__PURE__ */be(Ib,{extraInfo:r})}):null]})]}:{children:[/* @__PURE__ */be("div",{className:"wx-RJbNonjJ wx-content-item"+(y?"":"-fit"),children:be("panels"===v?Ob:Eb,{})}),y?/* @__PURE__ */be("div",{className:"wx-RJbNonjJ wx-info",children:/* @__PURE__ */be(Ib,{extraInfo:r})}):null]})})})]})})]})})}function Gb(e,t){let r,{type:n,ext:a}=e;return"folder"!==n&&(r=n&&"file"!==n&&Tb[n]?n:a?Tb[a]?a:"file":"unknown",`https://cdn.svar.dev/icons/filemanager/vivid/${t}/${r}.svg`)}ne(function(e,t){let{data:r=[],mode:n="cards",drive:a=null,preview:o=!1,panels:i=null,activePanel:s=0,readonly:l=!1,menuOptions:c=Gv,extraInfo:d=null,init:u=null,icons:h=Gb,previews:p=null,...m}=e,f=me();f.current=m;let g=pe(()=>new Uv(ey),[]),v=pe(()=>g.in,[g]),y=me(null);null===y.current&&(y.current=new Av((e,t)=>{let r="on"+(e=>e.split("-").map(e=>e?e.charAt(0).toUpperCase()+e.slice(1):"").join(""))(e);f.current&&f.current[r]&&f.current[r](t)}),v.setNext(y.current));let b=pe(()=>({getState:g.getState.bind(g),getReactiveState:g.getReactive.bind(g),getStores:()=>({data:g}),exec:v.exec,setNext:e=>(y.current=y.current.setNext(e),y.current),intercept:v.intercept.bind(v),on:v.on.bind(v),detach:v.detach.bind(v),getFile:g.getFile.bind(g),serialize:g.serialize.bind(g),templates:{preview:p||(()=>null),icon:"simple"===h?()=>null:h}}),[g,v]),x=me(0);return le(()=>{if(x.current){let e=g.getState();g.init({data:r,mode:n,drive:a,preview:o,panels:i||e.panels||[],activePanel:s})}else u&&u(b);x.current++},[g,r,n,a,o,i,s,u,b]),0===x.current&&g.init({data:r,mode:n,drive:a,preview:o,panels:i||[],activePanel:s}),de(t,()=>({...b}),[b]),/* @__PURE__ */be(Sb.Provider,{value:b,children:/* @__PURE__ */be(uv,{words:Tv,optional:!0,children:/* @__PURE__ */be(Nb,{children:/* @__PURE__ */be(Ub,{readonly:l,menuOptions:c,extraInfo:d})})})})});og(ag);var Wb=[{id:"1",title:"Welcome to REASON",content:'<h1>Welcome to REASON</h1><p>A powerful note-taking app with nested documents.</p><h2>Features</h2><ul><li><p><strong>Rich text editing</strong> with WYSIWYG editor</p></li><li><p><strong>Nested documents</strong> for better organization</p></li><li><p><strong>Full-text search</strong> to find notes quickly</p></li><li><p><strong>Drag and drop</strong> to reorganize notes</p></li><li><p><strong>Right-click menus</strong> for quick actions</p></li><li><p><strong>Document outline</strong> view</p></li><li><p><strong>Local storage</strong> - your notes stay private</p></li><li><p><strong>Mobile-friendly</strong> with responsive drawer navigation</p></li></ul><h2>Getting Started</h2><p>On mobile, tap the menu icon to access your notes.</p><p>Click the "New Note" button to create your first note, or select this note to start editing.</p><p>You can also create child notes by right-clicking a note.</p><h3>Drag and Drop</h3><p>Drag notes to reorder them or move them under different parent notes.</p><h3>Outline View</h3><p>Click the outline icon to see all headings in the current document.</p><p>Press the search icon (or Ctrl+K) to quickly find any note.</p>',parentId:null,children:[],isExpanded:!0,tags:[]},{id:"2",title:"Projects",content:"",parentId:null,children:[],isExpanded:!0,isFolder:!0,tags:[]},{id:"3",title:"Website Redesign",content:"<h1>Website Redesign</h1><p>Planning for the new website design.</p><h2>Goals</h2><ul><li><p>Modern, clean interface</p></li><li><p>Mobile-first approach</p></li><li><p>Improved accessibility</p></li></ul>",parentId:"2",children:[],isExpanded:!1,tags:["design","web"]},{id:"4",title:"API Integration",content:"<h1>API Integration</h1><p>Notes on integrating the new REST API.</p><h2>Endpoints</h2><ul><li><p>GET /api/documents</p></li><li><p>POST /api/documents</p></li><li><p>PUT /api/documents/:id</p></li></ul>",parentId:"2",children:[],isExpanded:!1,tags:["development","api"]},{id:"5",title:"Research",content:"",parentId:null,children:[],isExpanded:!0,isFolder:!0,tags:[]},{id:"6",title:"Market Analysis",content:"<h1>Market Analysis</h1><p>Research findings on market trends.</p><h2>Key Insights</h2><ul><li><p>Growing demand for productivity tools</p></li><li><p>Users prefer cloud-based solutions</p></li><li><p>Mobile access is essential</p></li></ul>",parentId:"5",children:[],isExpanded:!1,tags:["research","business"]},{id:"7",title:"Competitor Review",content:"<h1>Competitor Review</h1><p>Analysis of competitor products.</p><h2>Top Competitors</h2><ul><li><p>Notion - Versatile but complex</p></li><li><p>Obsidian - Great for developers</p></li><li><p>Roam Research - Powerful linking</p></li></ul>",parentId:"5",children:[],isExpanded:!1,tags:["research","competition"]},{id:"8",title:"Meeting Notes",content:"<h1>Meeting Notes</h1><p>Quick notes from today's team meeting.</p><h2>Action Items</h2><ul><li><p>Review PRs by EOD</p></li><li><p>Update documentation</p></li><li><p>Schedule next sprint planning</p></li></ul>",parentId:null,children:[],isExpanded:!1,tags:["meetings"]}],Kb=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,Yb=Sm,Xb=(e,t)=>r=>{if(null==t?.variants)return Yb(e,r?.class,r?.className);let{variants:n,defaultVariants:a}=t,o=Object.keys(n).map(e=>{let t=r?.[e],o=a?.[e];if(null===t)return null;let i=Kb(t)||Kb(o);return n[e][i]}),i=r&&Object.entries(r).reduce((e,t)=>{let[r,n]=t;return void 0===n||(e[r]=n),e},{});return Yb(e,o,t?.compoundVariants?.reduce((e,t)=>{let{class:r,className:n,...o}=t;return Object.entries(o).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...a,...i}[t]):{...a,...i}[t]===r})?[...e,r,n]:e},[]),r?.class,r?.className)},Zb=Xb("inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-2xl text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border-[1.5px] bg-background hover:bg-accent hover:text-accent-foreground dark:bg-card dark:hover:bg-card/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}}),Jb=["top","right","bottom","left"],Qb=Math.min,ex=Math.max,tx=Math.round,rx=Math.floor,nx=e=>({x:e,y:e}),ax={left:"right",right:"left",bottom:"top",top:"bottom"};function ox(e,t,r){return ex(e,Qb(t,r))}function ix(e,t){return"function"==typeof e?e(t):e}function sx(e){return e.split("-")[0]}function lx(e){return e.split("-")[1]}function cx(e){return"x"===e?"y":"x"}function dx(e){return"y"===e?"height":"width"}function ux(e){let t=e[0];return"t"===t||"b"===t?"y":"x"}function hx(e){return cx(ux(e))}function px(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}var mx=["left","right"],fx=["right","left"],gx=["top","bottom"],vx=["bottom","top"];function yx(e,t,r,n){let a=lx(e),o=function(e,t,r){switch(e){case"top":case"bottom":return r?t?fx:mx:t?mx:fx;case"left":case"right":return t?gx:vx;default:return[]}}(sx(e),"start"===r,n);return a&&(o=o.map(e=>e+"-"+a),t&&(o=o.concat(o.map(px)))),o}function bx(e){let t=sx(e);return ax[t]+e.slice(t.length)}function xx(e){return"number"==typeof e?{top:e,right:e,bottom:e,left:e}:function(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}(e)}function wx(e){let{x:t,y:r,width:n,height:a}=e;return{width:n,height:a,top:r,left:t,right:t+n,bottom:r+a,x:t,y:r}}function Sx(e,t,r){let n,{reference:a,floating:o}=e,i=ux(t),s=hx(t),l=dx(s),c=sx(t),d="y"===i,u=a.x+a.width/2-o.width/2,h=a.y+a.height/2-o.height/2,p=a[l]/2-o[l]/2;switch(c){case"top":n={x:u,y:a.y-o.height};break;case"bottom":n={x:u,y:a.y+a.height};break;case"right":n={x:a.x+a.width,y:h};break;case"left":n={x:a.x-o.width,y:h};break;default:n={x:a.x,y:a.y}}let m=lx(t);return m&&(n[s]+=p*("end"===m?1:-1)*(r&&d?-1:1)),n}async function kx(e,t){void 0===t&&(t={});let{x:r,y:n,platform:a,rects:o,elements:i,strategy:s}=e,{boundary:l="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:u=!1,padding:h=0}=ix(t,e),p=xx(h),m=i[u?"floating"===d?"reference":"floating":d],f=wx(await a.getClippingRect({element:await(null==a.isElement?void 0:a.isElement(m))??!0?m:m.contextElement||await(null==a.getDocumentElement?void 0:a.getDocumentElement(i.floating)),boundary:l,rootBoundary:c,strategy:s})),g="floating"===d?{x:r,y:n,width:o.floating.width,height:o.floating.height}:o.reference,v=await(null==a.getOffsetParent?void 0:a.getOffsetParent(i.floating)),y=await(null==a.isElement?void 0:a.isElement(v))&&await(null==a.getScale?void 0:a.getScale(v))||{x:1,y:1},b=wx(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:g,offsetParent:v,strategy:s}):g);return{top:(f.top-b.top+p.top)/y.y,bottom:(b.bottom-f.bottom+p.bottom)/y.y,left:(f.left-b.left+p.left)/y.x,right:(b.right-f.right+p.right)/y.x}}function Cx(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Nx(e){return Jb.some(t=>e[t]>=0)}var Tx=/*#__PURE__*/new Set(["left","top"]);function Ax(){return typeof window<"u"}function Mx(e){return Ix(e)?(e.nodeName||"").toLowerCase():"#document"}function Dx(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Ex(e){return((Ix(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Ix(e){return!!Ax()&&(e instanceof Node||e instanceof Dx(e).Node)}function Rx(e){return!!Ax()&&(e instanceof Element||e instanceof Dx(e).Element)}function zx(e){return!!Ax()&&(e instanceof HTMLElement||e instanceof Dx(e).HTMLElement)}function _x(e){return!(!Ax()||typeof ShadowRoot>"u")&&(e instanceof ShadowRoot||e instanceof Dx(e).ShadowRoot)}function Px(e){let{overflow:t,overflowX:r,overflowY:n,display:a}=Ux(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&"inline"!==a&&"contents"!==a}function Ox(e){return/^(table|td|th)$/.test(Mx(e))}function Lx(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}var Fx,Bx=/transform|translate|scale|rotate|perspective|filter/,Vx=/paint|layout|strict|content/,$x=e=>!!e&&"none"!==e;function Hx(e){let t=Rx(e)?Ux(e):e;return $x(t.transform)||$x(t.translate)||$x(t.scale)||$x(t.rotate)||$x(t.perspective)||!jx()&&($x(t.backdropFilter)||$x(t.filter))||Bx.test(t.willChange||"")||Vx.test(t.contain||"")}function jx(){return Fx??=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none"),Fx}function qx(e){return/^(html|body|#document)$/.test(Mx(e))}function Ux(e){return Dx(e).getComputedStyle(e)}function Gx(e){return Rx(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Wx(e){if("html"===Mx(e))return e;let t=e.assignedSlot||e.parentNode||_x(e)&&e.host||Ex(e);return _x(t)?t.host:t}function Kx(e){let t=Wx(e);return qx(t)?(e.ownerDocument||e).body:zx(t)&&Px(t)?t:Kx(t)}function Yx(e,t,r){void 0===t&&(t=[]),void 0===r&&(r=!0);let n=Kx(e),a=n===e.ownerDocument?.body,o=Dx(n);if(a){let e=Xx(o);return t.concat(o,o.visualViewport||[],Px(n)?n:[],e&&r?Yx(e):[])}return t.concat(n,Yx(n,[],r))}function Xx(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Zx(e){let t=Ux(e),r=parseFloat(t.width)||0,n=parseFloat(t.height)||0,a=zx(e),o=a?e.offsetWidth:r,i=a?e.offsetHeight:n,s=tx(r)!==o||tx(n)!==i;return s&&(r=o,n=i),{width:r,height:n,$:s}}function Jx(e){return Rx(e)?e:e.contextElement}function Qx(e){let t=Jx(e);if(!zx(t))return nx(1);let r=t.getBoundingClientRect(),{width:n,height:a,$:o}=Zx(t),i=(o?tx(r.width):r.width)/n,s=(o?tx(r.height):r.height)/a;return(!i||!Number.isFinite(i))&&(i=1),(!s||!Number.isFinite(s))&&(s=1),{x:i,y:s}}var ew=/*#__PURE__*/nx(0);function tw(e){let t=Dx(e);return jx()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:ew}function rw(e,t,r,n){void 0===t&&(t=!1),void 0===r&&(r=!1);let a=e.getBoundingClientRect(),o=Jx(e),i=nx(1);t&&(n?Rx(n)&&(i=Qx(n)):i=Qx(e));let s=function(e,t,r){return void 0===t&&(t=!1),!!r&&t&&r===Dx(e)}(o,r,n)?tw(o):nx(0),l=(a.left+s.x)/i.x,c=(a.top+s.y)/i.y,d=a.width/i.x,u=a.height/i.y;if(o&&n){let e=Dx(o),t=Rx(n)?Dx(n):n,r=e,a=Xx(r);for(;a&&t!==r;){let e=Qx(a),t=a.getBoundingClientRect(),n=Ux(a),o=t.left+(a.clientLeft+parseFloat(n.paddingLeft))*e.x,i=t.top+(a.clientTop+parseFloat(n.paddingTop))*e.y;l*=e.x,c*=e.y,d*=e.x,u*=e.y,l+=o,c+=i,r=Dx(a),a=Xx(r)}}return wx({width:d,height:u,x:l,y:c})}function nw(e,t){let r=Gx(e).scrollLeft;return t?t.left+r:rw(Ex(e)).left+r}function aw(e,t){let r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-nw(e,r),y:r.top+t.scrollTop}}function ow(e,t,r){let n;if("viewport"===t||"layoutViewport"===t)n=function(e,t,r){void 0===r&&(r="viewport");let n="layoutViewport"===r,a=Dx(e),o=Ex(e),i=a.visualViewport,s=o.clientWidth,l=o.clientHeight,c=0,d=0;if(i){let e=!jx()||"fixed"===t;n?e||(c=-i.offsetLeft,d=-i.offsetTop):(s=i.width,l=i.height,e&&(c=i.offsetLeft,d=i.offsetTop))}if(nw(o)<=0){let e=o.ownerDocument,t=e.body,r=getComputedStyle(t),n="CSS1Compat"===e.compatMode&&parseFloat(r.marginLeft)+parseFloat(r.marginRight)||0,a=Math.abs(o.clientWidth-t.clientWidth-n),i="stable both-edges"===getComputedStyle(o).scrollbarGutter?a/2:a;i<=25&&(s-=i)}return{width:s,height:l,x:c,y:d}}(e,r,t);else if("document"===t)n=function(e){let t=Gx(e),r=e.ownerDocument.body,n=ex(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),a=ex(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight),o=-t.scrollLeft+nw(e),i=-t.scrollTop;return"rtl"===Ux(r).direction&&(o+=ex(e.clientWidth,r.clientWidth)-n),{width:n,height:a,x:o,y:i}}(Ex(e));else if(Rx(t))n=function(e,t){let r=rw(e,!0,"fixed"===t),n=r.top+e.clientTop,a=r.left+e.clientLeft,o=Qx(e);return{width:e.clientWidth*o.x,height:e.clientHeight*o.y,x:a*o.x,y:n*o.y}}(t,r);else{let r=tw(e);n={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return wx(n)}function iw(e,t){let r=t.get(e);if(r)return r;let n=Yx(e,[],!1).filter(e=>Rx(e)&&"body"!==Mx(e)),a=null,o="fixed"===Ux(e).position,i=o?Wx(e):e;for(;Rx(i)&&!qx(i);){let e=Ux(i),t=Hx(i),r=a?a.position:o?"fixed":"";t||"fixed"!==r&&("absolute"!==r||"static"!==e.position)?a=e:n=n.filter(e=>e!==i),i=Wx(i)}return t.set(e,n),n}function sw(e,t,r){let n=zx(t),a=Ex(t),o="fixed"===r,i=rw(e,!0,o,t),s={scrollLeft:0,scrollTop:0},l=nx(0);if((n||!o)&&(("body"!==Mx(t)||Px(a))&&(s=Gx(t)),n)){let e=rw(t,!0,o,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}!n&&a&&(l.x=nw(a));let c=!a||n||o?nx(0):aw(a,s);return{x:i.left+s.scrollLeft-l.x-c.x,y:i.top+s.scrollTop-l.y-c.y,width:i.width,height:i.height}}function lw(e){return"static"===Ux(e).position}function cw(e,t){if(!zx(e)||"fixed"===Ux(e).position)return null;if(t)return t(e);let r=e.offsetParent;return Ex(e)===r&&(r=r.ownerDocument.body),r}function dw(e,t){let r=Dx(e);if(Lx(e))return r;if(!zx(e)){let t=Wx(e);for(;t&&!qx(t);){if(Rx(t)&&!lw(t))return t;t=Wx(t)}return r}let n=cw(e,t);for(;n&&Ox(n)&&lw(n);)n=cw(n,t);return n&&qx(n)&&lw(n)&&!Hx(n)?r:n||function(e){let t=Wx(e);for(;zx(t)&&!qx(t);){if(Hx(t))return t;if(Lx(t))return null;t=Wx(t)}return null}(e)||r}var uw={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e,o="fixed"===a,i=Ex(n),s=!!t&&Lx(t.floating);if(n===i||s&&o)return r;let l={scrollLeft:0,scrollTop:0},c=nx(1),d=nx(0),u=zx(n);if((u||!o)&&(("body"!==Mx(n)||Px(i))&&(l=Gx(n)),u)){let e=rw(n);c=Qx(n),d.x=e.x+n.clientLeft,d.y=e.y+n.clientTop}let h=!i||u||o?nx(0):aw(i,l);return{width:r.width*c.x,height:r.height*c.y,x:r.x*c.x-l.scrollLeft*c.x+d.x+h.x,y:r.y*c.y-l.scrollTop*c.y+d.y+h.y}},getDocumentElement:Ex,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e,o=[..."clippingAncestors"===r?Lx(t)?[]:iw(t,this._c):[].concat(r),n],i=ow(t,o[0],a),s=i.top,l=i.right,c=i.bottom,d=i.left;for(let u=1;u<o.length;u++){let e=ow(t,o[u],a);s=ex(e.top,s),l=Qb(e.right,l),c=Qb(e.bottom,c),d=ex(e.left,d)}return{width:l-d,height:c-s,x:d,y:s}},getOffsetParent:dw,getElementRects:async function(e){let t=this.getOffsetParent||dw,r=this.getDimensions,n=await r(e.floating);return{reference:sw(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}},getClientRects:function(e){return e.getClientRects?Array.from(e.getClientRects()):[]},getDimensions:function(e){let{width:t,height:r}=Zx(e);return{width:t,height:r}},getScale:Qx,isElement:Rx,isRTL:function(e){return"rtl"===Ux(e).direction}};function hw(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function pw(e,t,r,n){void 0===n&&(n={});let{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:i="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:l=!1}=n,c=Jx(e),d=a||o?[...c?Yx(c):[],...t?Yx(t):[]]:[];d.forEach(e=>{a&&e.addEventListener("scroll",r),o&&e.addEventListener("resize",r)});let u=c&&s?function(e,t,r){let n,a=null,o=Ex(e);function i(){var e;clearTimeout(n),null==(e=a)||e.disconnect(),a=null}function s(r,l){void 0===r&&(r=!1),void 0===l&&(l=1),i();let c=e.getBoundingClientRect(),{left:d,top:u,width:h,height:p}=c;if(r||t(),!h||!p)return;let m={rootMargin:-rx(u)+"px "+-rx(o.clientWidth-(d+h))+"px "+-rx(o.clientHeight-(u+p))+"px "+-rx(d)+"px",threshold:ex(0,Qb(1,l))||1},f=!0;function g(t){let r=t[0].intersectionRatio;if(!hw(c,e.getBoundingClientRect()))return s();if(r!==l){if(!f)return s();r?s(!1,r):n=setTimeout(()=>{s(!1,1e-7)},1e3)}f=!1}try{a=new IntersectionObserver(g,{...m,root:o.ownerDocument})}catch{a=new IntersectionObserver(g,m)}a.observe(e)}let l=Dx(e),c=()=>s(r);return l.addEventListener("resize",c),s(!0),()=>{l.removeEventListener("resize",c),i()}}(c,r,o):null,h=-1,p=null;i&&(p=new ResizeObserver(e=>{let[n]=e;n&&n.target===c&&p&&t&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var e;null==(e=p)||e.observe(t)})),r()}),c&&!l&&p.observe(c),t&&p.observe(t));let m,f=l?rw(e):null;return l&&function t(){let n=rw(e);f&&!hw(f,n)&&r(),f=n,m=requestAnimationFrame(t)}(),r(),()=>{var e;d.forEach(e=>{a&&e.removeEventListener("scroll",r),o&&e.removeEventListener("resize",r)}),u?.(),null==(e=p)||e.disconnect(),p=null,l&&cancelAnimationFrame(m)}}var mw=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var r;let{x:n,y:a,placement:o,middlewareData:i}=t,s=await async function(e,t){let{placement:r,platform:n,elements:a}=e,o=await(null==n.isRTL?void 0:n.isRTL(a.floating)),i=sx(r),s=lx(r),l="y"===ux(r),c=Tx.has(i)?-1:1,d=o&&l?-1:1,u=ix(t,e),{mainAxis:h,crossAxis:p,alignmentAxis:m}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return s&&"number"==typeof m&&(p="end"===s?-1*m:m),l?{x:p*d,y:h*c}:{x:h*c,y:p*d}}(t,e);return o===i.offset?.placement&&null!=(r=i.arrow)&&r.alignmentOffset?{}:{x:n+s.x,y:a+s.y,data:{...s,placement:o}}}}},fw=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){let{x:r,y:n,placement:a,platform:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:l={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...c}=ix(e,t),d={x:r,y:n},u=await o.detectOverflow(t,c),h=ux(a),p=cx(h),m=d[p],f=d[h],g=(e,t)=>ox(t+u["y"===e?"top":"left"],t,t-u["y"===e?"bottom":"right"]);i&&(m=g(p,m)),s&&(f=g(h,f));let v=l.fn({...t,[p]:m,[h]:f});return{...v,data:{x:v.x-r,y:v.y-n,enabled:{[p]:i,[h]:s}}}}}},gw=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var r;let{placement:n,middlewareData:a,rects:o,initialPlacement:i,platform:s,elements:l}=t,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:u,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...f}=ix(e,t);if(null!=(r=a.arrow)&&r.alignmentOffset)return{};let g=sx(n),v=ux(i),y=sx(i)===i,b=await(null==s.isRTL?void 0:s.isRTL(l.floating)),x=u||(y||!m?[bx(i)]:function(e){let t=bx(e);return[px(e),t,px(t)]}(i)),w="none"!==p;!u&&w&&x.push(...yx(i,m,p,b));let S=[i,...x],k=await s.detectOverflow(t,f),C=[],N=a.flip?.overflows||[];if(c&&C.push(k[g]),d){let e=function(e,t,r){void 0===r&&(r=!1);let n=lx(e),a=hx(e),o=dx(a),i="x"===a?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=bx(i)),[i,bx(i)]}(n,o,b);C.push(k[e[0]],k[e[1]])}if(N=[...N,{placement:n,overflows:C}],!C.every(e=>e<=0)){let e=(a.flip?.index||0)+1,t=S[e];if(t&&("alignment"!==d||v===ux(t)||N.every(e=>ux(e.placement)!==v||e.overflows[0]>0)))return{data:{index:e,overflows:N},reset:{placement:t}};let r=N.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!r)switch(h){case"bestFit":{let e=N.filter(e=>{if(w){let t=ux(e.placement);return t===v||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(r=e);break}case"initialPlacement":r=i}if(n!==r)return{reset:{placement:r}}}return{}}}},vw=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){let r,n,{placement:a,rects:o,platform:i,elements:s}=t,{apply:l=()=>{},...c}=ix(e,t),d=await i.detectOverflow(t,c),u=sx(a),h=lx(a),p="y"===ux(a),{width:m,height:f}=o.floating;"top"===u||"bottom"===u?(r=u,n=h===(await(null==i.isRTL?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(n=u,r="end"===h?"top":"bottom");let g=f-d.top-d.bottom,v=m-d.left-d.right,y=Qb(f-d[r],g),b=Qb(m-d[n],v),x=t.middlewareData.shift,w=!x,S=y,k=b;null!=x&&x.enabled.x&&(k=v),null!=x&&x.enabled.y&&(S=g),w&&!h&&(p?k=m-2*ex(d.left,d.right):S=f-2*ex(d.top,d.bottom)),await l({...t,availableWidth:k,availableHeight:S});let C=await i.getDimensions(s.floating);return m!==C.width||f!==C.height?{reset:{rects:!0}}:{}}}},yw=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){let{rects:r,platform:n}=t,{strategy:a="referenceHidden",...o}=ix(e,t);switch(a){case"referenceHidden":{let e=Cx(await n.detectOverflow(t,{...o,elementContext:"reference"}),r.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Nx(e)}}}case"escaped":{let e=Cx(await n.detectOverflow(t,{...o,altBoundary:!0}),r.floating);return{data:{escapedOffsets:e,escaped:Nx(e)}}}default:return{}}}}},bw=e=>({name:"arrow",options:e,async fn(t){let{x:r,y:n,placement:a,rects:o,platform:i,elements:s,middlewareData:l}=t,{element:c,padding:d=0}=ix(e,t)||{};if(null==c)return{};let u=xx(d),h={x:r,y:n},p=hx(a),m=dx(p),f=await i.getDimensions(c),g="y"===p,v=g?"top":"left",y=g?"bottom":"right",b=g?"clientHeight":"clientWidth",x=o.reference[m]+o.reference[p]-h[p]-o.floating[m],w=h[p]-o.reference[p],S=await(null==i.getOffsetParent?void 0:i.getOffsetParent(c)),k=S?S[b]:0;(!k||!(await(null==i.isElement?void 0:i.isElement(S))))&&(k=s.floating[b]||o.floating[m]);let C=x/2-w/2,N=k/2-f[m]/2-1,T=Qb(u[v],N),A=Qb(u[y],N),M=k-f[m]-A,D=k/2-f[m]/2+C,E=ox(T,D,M),I=!l.arrow&&null!=lx(a)&&D!==E&&o.reference[m]/2-(D<T?T:A)-f[m]/2<0,R=I?D<T?D-T:D-M:0;return{[p]:h[p]+R,data:{[p]:E,centerOffset:D-E-R,...I&&{alignmentOffset:R}},reset:I}}}),xw=function(e){return void 0===e&&(e={}),{options:e,fn(t){let{x:r,y:n,placement:a,rects:o,middlewareData:i}=t,{offset:s=0,mainAxis:l=!0,crossAxis:c=!0}=ix(e,t),d={x:r,y:n},u=ux(a),h=cx(u),p=d[h],m=d[u],f=ix(s,t),g="number"==typeof f?{mainAxis:f,crossAxis:0}:{mainAxis:f.mainAxis??0,crossAxis:f.crossAxis??0};if(l){let e="y"===h?"height":"width",t=o.reference[h]-o.floating[e]+g.mainAxis,r=o.reference[h]+o.reference[e]-g.mainAxis;p<t?p=t:p>r&&(p=r)}if(c){let e="y"===h?"width":"height",t=Tx.has(sx(a)),r=o.reference[u]-o.floating[e]+(t&&i.offset?.[u]||0)+(t?0:g.crossAxis),n=o.reference[u]+o.reference[e]+(t?0:i.offset?.[u]||0)-(t?g.crossAxis:0);m<r?m=r:m>n&&(m=n)}return{[h]:p,[u]:m}}}},ww=(e,t,r)=>{let n=/* @__PURE__ */new Map,a=r??{},o={...uw,...a.platform,_c:n};return(async(e,t,r)=>{let{placement:n="bottom",strategy:a="absolute",middleware:o=[],platform:i}=r,s=i.detectOverflow?i:{...i,detectOverflow:kx},l=await(null==i.isRTL?void 0:i.isRTL(t)),c=await i.getElementRects({reference:e,floating:t,strategy:a}),{x:d,y:u}=Sx(c,n,l),h=n,p=0,m={};for(let f=0;f<o.length;f++){let r=o[f];if(!r)continue;let{name:g,fn:v}=r,{x:y,y:b,data:x,reset:w}=await v({x:d,y:u,initialPlacement:n,placement:h,strategy:a,middlewareData:m,rects:c,platform:s,elements:{reference:e,floating:t}});d=y??d,u=b??u,m[g]={...m[g],...x},w&&p<50&&(p++,"object"==typeof w&&(w.placement&&(h=w.placement),w.rects&&(c=!0===w.rects?await i.getElementRects({reference:e,floating:t,strategy:a}):w.rects),({x:d,y:u}=Sx(c,h,l))),f=-1)}return{x:d,y:u,placement:h,strategy:a,middlewareData:m}})(e,t,{...a,platform:o})},Sw=typeof document<"u"?he:function(){};function kw(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let r,n,a;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;0!==n--;)if(!kw(e[n],t[n]))return!1;return!0}if(a=Object.keys(e),r=a.length,r!==Object.keys(t).length)return!1;for(n=r;0!==n--;)if(!{}.hasOwnProperty.call(t,a[n]))return!1;for(n=r;0!==n--;){let r=a[n];if(!("_owner"===r&&e.$$typeof||kw(e[r],t[r])))return!1}return!0}return e!=e&&t!=t}function Cw(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Nw(e,t){let r=Cw(e);return Math.round(t*r)/r}function Tw(e){let t=X.useRef(e);return Sw(()=>{t.current=e}),t}function Aw(e){void 0===e&&(e={});let{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:a,elements:{reference:o,floating:i}={},transform:s=!0,whileElementsMounted:l,open:c}=e,[d,u]=X.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=X.useState(n);kw(h,n)||p(n);let[m,f]=X.useState(null),[g,v]=X.useState(null),y=X.useCallback(e=>{e!==S.current&&(S.current=e,f(e))},[]),b=X.useCallback(e=>{e!==k.current&&(k.current=e,v(e))},[]),x=o||m,w=i||g,S=X.useRef(null),k=X.useRef(null),C=X.useRef(d),N=null!=l,T=Tw(l),A=Tw(a),M=Tw(c),D=X.useCallback(()=>{if(!S.current||!k.current)return;let e={placement:t,strategy:r,middleware:h};A.current&&(e.platform=A.current),ww(S.current,k.current,e).then(e=>{let t={...e,isPositioned:!1!==M.current};E.current&&!kw(C.current,t)&&(C.current=t,ft.flushSync(()=>{u(t)}))})},[h,t,r,A,M]);Sw(()=>{!1===c&&C.current.isPositioned&&(C.current.isPositioned=!1,u(e=>({...e,isPositioned:!1})))},[c]);let E=X.useRef(!1);Sw(()=>(E.current=!0,()=>{E.current=!1}),[]),Sw(()=>{if(x&&(S.current=x),w&&(k.current=w),x&&w){if(T.current)return T.current(x,w,D);D()}},[x,w,D,T,N]);let I=X.useMemo(()=>({reference:S,floating:k,setReference:y,setFloating:b}),[y,b]),R=X.useMemo(()=>({reference:x,floating:w}),[x,w]),z=X.useMemo(()=>{let e={position:r,left:0,top:0};if(!R.floating)return e;let t=Nw(R.floating,d.x),n=Nw(R.floating,d.y);return s?{...e,transform:"translate("+t+"px, "+n+"px)",...Cw(R.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,s,R.floating,d.x,d.y]);return X.useMemo(()=>({...d,update:D,refs:I,elements:R,floatingStyles:z}),[d,D,I,R,z])}var Mw=(e,t)=>{let r=mw(e);return{name:r.name,fn:r.fn,options:[e,t]}},Dw=(e,t)=>{let r=fw(e);return{name:r.name,fn:r.fn,options:[e,t]}},Ew=(e,t)=>({fn:xw(e).fn,options:[e,t]}),Iw=(e,t)=>{let r=gw(e);return{name:r.name,fn:r.fn,options:[e,t]}},Rw=(e,t)=>{let r=vw(e);return{name:r.name,fn:r.fn,options:[e,t]}},zw=(e,t)=>{let r=yw(e);return{name:r.name,fn:r.fn,options:[e,t]}},_w=(e,t)=>{let r=(e=>({name:"arrow",options:e,fn(t){let{element:r,padding:n}="function"==typeof e?e(t):e;return r&&function(e){return{}.hasOwnProperty.call(e,"current")}(r)?null==r.current?{}:bw({element:r.current,padding:n}).fn(t):r?bw({element:r,padding:n}).fn(t):{}}}))(e);return{name:r.name,fn:r.fn,options:[e,t]}},Pw=(Object.defineProperty,Object.defineProperty);function Ow(e){let[t,r]=X.useState(void 0);return sd(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let n,a,o=t[0];if("borderBoxSize"in o){let e=o.borderBoxSize,t=Array.isArray(e)?e[0]:e;n=t.inlineSize,a=t.blockSize}else n=e.offsetWidth,a=e.offsetHeight;r({width:n,height:a})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)},[e]),t}((e,t)=>{Pw(e,"name",{value:t,configurable:!0})})(Ow,"useSize");var Lw=Object.defineProperty,Fw=(e,t)=>Lw(e,"name",{value:t,configurable:!0}),Bw="Popper",[Vw,$w]=/* @__PURE__ */od(Bw),[Hw,jw]=Vw(Bw),qw=/* @__PURE__ */Fw(e=>{let{__scopePopper:t,children:r}=e,[n,a]=X.useState(null),[o,i]=X.useState(void 0);/* @__PURE__ */
136
- return be(Hw,{scope:t,anchor:n,onAnchorChange:a,placementState:o,setPlacementState:i,children:r})},"Popper"),Uw=/* @__PURE__ */X.forwardRef(/* @__PURE__ */Fw(function(e,t){let{__scopePopper:r,virtualRef:n,...a}=e,o=jw("PopperAnchor",r),i=X.useRef(null),s=o.onAnchorChange,l=rd(t,X.useCallback(e=>{i.current=e,e&&s(e)},[s])),c=X.useRef(null);X.useEffect(()=>{if(!n)return;let e=c.current;c.current=n.current,e!==c.current&&s(c.current)});let d=o.placementState&&Jw(o.placementState),u=d?.[0],h=d?.[1];return n?null:/* @__PURE__ */be(Vd.div,{"data-radix-popper-side":u,"data-radix-popper-align":h,...a,ref:l})},"PopperAnchor")),Gw="PopperContent",[Ww,Kw]=Vw(Gw),Yw=/* @__PURE__ */X.forwardRef(/* @__PURE__ */Fw(function(e,t){let{__scopePopper:r,side:n="bottom",sideOffset:a=0,align:o="center",alignOffset:i=0,arrowPadding:s=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:d=0,sticky:u="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:m,...f}=e,g=jw(Gw,r),[v,y]=X.useState(null),b=rd(t,y),[x,w]=X.useState(null),S=Ow(x),k=S?.width??0,C=S?.height??0,N=n+("center"===o?"":"-"+o),T="number"==typeof d?d:{top:0,right:0,bottom:0,left:0,...d},A=Array.isArray(c)?c:[c],M=A.length>0,D={padding:T,boundary:A.filter(Xw),altBoundary:M},{refs:E,floatingStyles:I,placement:R,isPositioned:z,middlewareData:_}=Aw({strategy:"fixed",placement:N,whileElementsMounted:/* @__PURE__ */Fw((...e)=>pw(...e,{animationFrame:"always"===p}),"whileElementsMounted"),elements:{reference:g.anchor},middleware:[Mw({mainAxis:a+C,alignmentAxis:i}),l&&Dw({mainAxis:!0,crossAxis:!1,limiter:"partial"===u?Ew():void 0,...D}),l&&Iw({...D}),Rw({...D,apply:/* @__PURE__ */Fw(({elements:e,rects:t,availableWidth:r,availableHeight:n})=>{let{width:a,height:o}=t.reference,i=e.floating.style;i.setProperty("--radix-popper-available-width",`${r}px`),i.setProperty("--radix-popper-available-height",`${n}px`),i.setProperty("--radix-popper-anchor-width",`${a}px`),i.setProperty("--radix-popper-anchor-height",`${o}px`)},"apply")}),x&&_w({element:x,padding:s}),Zw({arrowWidth:k,arrowHeight:C}),h&&zw({strategy:"referenceHidden",...D,boundary:M?D.boundary:void 0})]}),P=g.setPlacementState;sd(()=>(P(R),()=>{P(void 0)}),[R,P]);let[O,L]=Jw(R),F=jd(m);sd(()=>{z&&F?.()},[z,F]);let B=_.arrow?.x,V=_.arrow?.y,$=0!==_.arrow?.centerOffset,[H,j]=X.useState();return sd(()=>{v&&j(window.getComputedStyle(v).zIndex)},[v]),/* @__PURE__ */be("div",{ref:E.setFloating,"data-radix-popper-content-wrapper":"",style:{...I,transform:z?I.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:H,"--radix-popper-transform-origin":[_.transformOrigin?.x,_.transformOrigin?.y].join(" "),..._.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:/* @__PURE__ */be(Ww,{scope:r,placedSide:O,placedAlign:L,onArrowChange:w,arrowX:B,arrowY:V,shouldHideArrow:$,children:/* @__PURE__ */be(Vd.div,{"data-side":O,"data-align":L,...f,ref:b,style:{...f.style,animation:z?f.style?.animation:"none"}})})})},"PopperContent"));function Xw(e){return null!==e}Fw(Xw,"isNotNull");var Zw=/* @__PURE__ */Fw(e=>({name:"transformOrigin",options:e,fn(t){let{placement:r,rects:n,middlewareData:a}=t,o=0!==a.arrow?.centerOffset,i=o?0:e.arrowWidth,s=o?0:e.arrowHeight,[l,c]=Jw(r),d={start:"0%",center:"50%",end:"100%"}[c],u=(a.arrow?.x??0)+i/2,h=(a.arrow?.y??0)+s/2,p="",m="";return"bottom"===l?(p=o?d:`${u}px`,m=-s+"px"):"top"===l?(p=o?d:`${u}px`,m=`${n.floating.height+s}px`):"right"===l?(p=-s+"px",m=o?d:`${h}px`):"left"===l&&(p=`${n.floating.width+s}px`,m=o?d:`${h}px`),{data:{x:p,y:m}}}}),"transformOrigin");function Jw(e){let[t,r="center"]=e.split("-");return[t,r]}Fw(Jw,"getSideAndAlignFromPlacement");var Qw=qw,eS=Uw,tS=Yw,rS=(Object.defineProperty,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"}),Object.defineProperty),nS=(e,t)=>rS(e,"name",{value:t,configurable:!0}),[aS,oS]=/* @__PURE__ */od("Tooltip",[$w]),[iS,sS]=($w(),aS("TooltipProvider")),lS="Tooltip",[cS,dS]=aS(lS),uS="TooltipPortal",[hS,pS]=aS(uS,{forceMount:void 0});function mS(e,t){let r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(r,n,a,o)){case o:return"left";case a:return"right";case r:return"top";case n:return"bottom";default:throw Error("unreachable")}}function fS(e,t,r=5){let n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r})}return n}function gS(e){let{top:t,right:r,bottom:n,left:a}=e;return[{x:a,y:t},{x:r,y:t},{x:r,y:n},{x:a,y:n}]}function vS(e,t){let{x:r,y:n}=e,a=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){let e=t[o],s=t[i],l=e.x,c=e.y,d=s.x,u=s.y;c>n!=u>n&&r<(d-l)*(n-c)/(u-c)+l&&(a=!a)}return a}function yS(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),bS(t)}function bS(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if(!((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x)))break;t.pop()}t.push(r)}t.pop();let r=[];for(let n=e.length-1;n>=0;n--){let t=e[n];for(;r.length>=2;){let e=r[r.length-1],n=r[r.length-2];if(!((e.x-n.x)*(t.y-n.y)>=(e.y-n.y)*(t.x-n.x)))break;r.pop()}r.push(t)}return r.pop(),1===t.length&&1===r.length&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}nS(mS,"getExitSideFromRect"),nS(fS,"getPaddedExitPoints"),nS(gS,"getPointsFromRect"),nS(vS,"isPointInPolygon"),nS(yS,"getHull"),nS(bS,"getHullPresorted");var xS=Object.defineProperty,wS=(e,t)=>xS(e,"name",{value:t,configurable:!0});function SS(e){let t=e+"CollectionProvider",[r,n]=/* @__PURE__ */od(t),[a,o]=r(t,{collectionRef:{current:null},itemMap:/* @__PURE__ */new Map}),i=/* @__PURE__ */wS(e=>{let{scope:t,children:r}=e,n=X.useRef(null),o=X.useRef(/* @__PURE__ */new Map).current;/* @__PURE__ */
127
+ /* @__PURE__ */xe("span",{className:"wx-NYfhvGIt wx-name",children:[" ",d," "]})]}),h&&t.data&&t.data.length&&c?/* @__PURE__ */be(ye,{children:t.data.map(e=>"folder"===e.type?/* @__PURE__ */be(Rb,{folder:e},e.id):null)}):null]})}function zb(){let e=se(vb),[t,r]=Wv(e,"data"),[n,a]=Wv(e,"panels"),o=Gv(e,"activePanel"),i=pe(()=>n[o]._crumbs,[a,o]),s=ie(r=>{e.exec("open-tree-folder",{id:r,mode:!t.byId(r).open})},[e,r]),l=ie(t=>{let r=Fv(t,i);e.exec("set-path",{id:t,panel:o,...r&&{selected:[r]}})},[e,i,o]),[c,d]=fe([]);le(()=>{d(t.byId(0).data)},[r]);let u=me(null),h=me();return le(()=>{h.current?(h.current.click=l,h.current.toggle=s):(h.current={click:l,toggle:s},rg(u.current,h.current))},[l,s]),/* @__PURE__ */be("ul",{ref:u,className:"wx-LyHJ6R6A",children:c.map(e=>"folder"===e.type?/* @__PURE__ */be(Rb,{folder:e},e.id):null)})}function _b(){let e=se(vb),t=se(Vg.i18n),r=pe(()=>t.getGroup("filemanager"),[t]),n=Gv(e,"drive"),a=n?n.used:"",o=n?n.total:"";return a&&o?/* @__PURE__ */xe("div",{className:"wx-DetSyKGG wx-drive",children:[/* @__PURE__ */be("progress",{value:a,max:o,className:"wx-DetSyKGG wx-progress"}),/* @__PURE__ */xe("p",{children:[zv(a)," ",r("of")," ",zv(o)," ",r("used")]})]}):null}function Pb({option:e}){let t=se(Vg.i18n).getGroup("filemanager"),r=se(bb),n=ie(()=>{r.open({})},[r]);/* @__PURE__ */
128
+ return be("div",{className:"wx-9XiKcxq5 wx-upload-button",onClick:n,children:/* @__PURE__ */be("span",{children:t(e.text)})})}function Ob({readonly:e,menuOptions:t}){let r=se(Vg.i18n).getGroup("filemanager"),{showPrompt:n}=se(yb);le(()=>{!function(e,t){ey[e]=t}("upload",Pb)},[]);let a=pe(()=>t("add").map(e=>(e.text=r(e.text),e)),[t,r]);/* @__PURE__ */
129
+ return xe("div",{className:"wx-FlucfALM wx-wrapper",children:[!e&&/* @__PURE__ */be("div",{className:"wx-FlucfALM wx-button",children:/* @__PURE__ */be(ay,{options:a,at:"bottom-fit",onClick:function({action:e}){e&&("add-file"===e.id?n({item:{type:"file",size:0,date:/* @__PURE__ */new Date},add:!0}):"add-folder"===e.id&&n({item:{type:"folder",date:/* @__PURE__ */new Date},add:!0}))},children:/* @__PURE__ */be(Hg,{type:"primary block",children:r("Add New")})})}),
130
+ /* @__PURE__ */be("div",{className:"wx-FlucfALM wx-tree",children:/* @__PURE__ */be(zb,{})}),
131
+ /* @__PURE__ */be(_b,{})]})}function Lb({value:e="",onSearch:t}){let[r,n]=Uv(e),a=se(Vg.i18n).getGroup("filemanager"),o=me(null),i=pe(()=>""===r?"wxi-search":"wxi-close",[r]);/* @__PURE__ */
132
+ return xe("div",{className:"wx-lUZMtgT1 wx-search-input",children:[/* @__PURE__ */be("i",{className:`wx-lUZMtgT1 wx-icon ${i}`,onClick:function(){n(""),o.current&&o.current.focus(),t&&t({value:""})}}),/* @__PURE__ */be("input",{type:"text",className:"wx-lUZMtgT1 wx-text",ref:o,value:r,onInput:function(e){let r=e.target.value;n(r),t&&t({value:r})},placeholder:a("Search")})]})}function Fb({narrowMode:e=!1,onShowTree:t}){let r=se(vb),n=se(Vg.i18n).getGroup("filemanager"),a=Gv(r,"mode"),o=Gv(r,"preview"),i=Gv(r,"search");/* @__PURE__ */
133
+ return xe("div",{className:"wx-5PZQQztG wx-toolbar",children:[/* @__PURE__ */xe("div",{className:"wx-5PZQQztG wx-left "+(e?"wx-left-narrow":""),children:[e?"panels"===a||"search"===a?null:/* @__PURE__ */be("div",{className:"wx-5PZQQztG wx-sidebar-icon","data-id":Jf("toggle-tree"),children:/* @__PURE__ */be(Cb,{onClick:()=>t&&t(),name:"subtask"})}):/* @__PURE__ */be("div",{className:"wx-5PZQQztG wx-name",children:n("Files")}),/* @__PURE__ */be(Lb,{onSearch:function(e){r.exec("filter-files",{text:e.value})},value:i})]}),/* @__PURE__ */xe("div",{className:"wx-5PZQQztG wx-right",children:[e?null:/* @__PURE__ */be("div",{className:"wx-5PZQQztG wx-preview-icon",children:/* @__PURE__ */be(xv,{onClick:function(e){e.preventDefault(),r.exec("show-preview",{mode:!o})},value:o,children:/* @__PURE__ */be("i",{className:"wx-5PZQQztG wxi-eye"})})}),/* @__PURE__ */be("div",{className:"wx-5PZQQztG wx-modes",children:/* @__PURE__ */be(mv,{value:a,options:[{icon:"wxi-view-sequential",id:"table"},{icon:"wxi-view-grid",id:"cards"},{icon:"wxi-view-column",id:"panels"}],onChange:function({value:e}){r.exec("set-mode",{mode:e})}})})]})]})}function Bb(){let e=Gv(se(vb),"activePanel");/* @__PURE__ */
134
+ return xe("div",{className:"wx-NwohNJzN wx-wrapper",children:[/* @__PURE__ */be(Ab,{panel:e}),/* @__PURE__ */be(Db,{children:/* @__PURE__ */be(kb,{})})]})}function Vb({readonly:e=!1,menuOptions:t,extraInfo:r}){let n=me(null),a=me(null),[o,i]=fe(void 0),[s,l]=fe(void 0),[c,d]=fe(!1),u=ly(),h=se(vb),{showPrompt:p,showConfirm:m}=se(yb),f=se(Vg.i18n),g=pe(()=>f.getGroup("filemanager"),[f]),v=Gv(h,"mode"),y=Gv(h,"preview"),b=Gv(h,"activePanel"),[x,w]=Wv(h,"panels"),S=pe(()=>(x&&null!=b?x[b]:null)?.selected??[],[w,b]),k=pe(()=>(x&&null!=b?x[b]:null)?.path,[w,b]),[C,N]=fe([]);le(()=>{let e=n.current;if(!e)return;let t=new ResizeObserver(e=>{let t=e[0]?.borderBoxSize?.[0]?.inlineSize;"number"==typeof t&&l(t<768)});return t.observe(e),()=>{t.disconnect()}},[]);let T=ie(()=>{d(e=>!e)},[]),A=ie(e=>{s&&"toggle-tree"!==Xf(e)&&d(!1)},[s]);le(()=>{let e=a.current;if(e)return dg(e,A).destroy},[A]),le(()=>{let e=a.current;if(!e)return;let t=new ResizeObserver(()=>{e&&i(e.clientWidth)});return t.observe(e),e&&i(e.clientWidth),()=>{t.disconnect()}},[]);let M=pe(()=>({icon:"wxi-eye",text:"Preview",id:"preview"}),[]),D=ie(e=>{let r=s?[M]:[];return"file"===e&&(r=[...r,...t().filter(e=>"download"===e.id)]),r},[s,M,t]),E=me(null),I=ie((e,t,r)=>{let n=r?[t.id]:S;switch(e){case"download":h.exec("download-file",{id:t.id});break;case"copy":case"move":E.current={action:e,ids:n};break;case"paste":E.current&&h.exec("copy"===E.current.action?"copy-files":"move-files",{ids:E.current.ids,target:"folder"===t?.type?t.id:k});break;case"rename":p({item:t});break;case"delete":m({selected:n});break;case"preview":h.exec("show-preview",{mode:!y})}},[h,S,k,p,m,y]),R=ie(()=>x?.[b],[x,b]);le(()=>{let r=n.current;if(!r)return;let a=function(e,t){let{api:r}=t;function n(e,n){let a,o=t.getPanel(),i=o.selected,s=n.ctrlKey||n.metaKey,l=n.shiftKey,c=i?.[0]?r.getFile(i[0]):null;a=i?.length?i.length>1?t.menuOptions("multiselect"):t.menuOptions(c.type,c):t.menuOptions("body");let d=`${s?"ctrl+":""}${l?"shift+":""}${e}`,u=!!a&&a.find(e=>e.hotkey?.toLowerCase()===d),h=t.performAction;if(u)switch(d){case"ctrl+c":h("copy");break;case"ctrl+x":h("move");break;case"ctrl+v":h("paste",c);break;case"delete":h("delete");break;case"ctrl+r":n.preventDefault(),h("rename",c);break;case"ctrl+d":n.preventDefault(),h("download",c);break;default:u.handler?.({context:c})}switch(e){case"enter":{if(s||l)break;let{_crumbs:e,_selectNavigation:t}=o;if(t){let t=function(e){return e.length>1?e[e.length-2].id:null}(e);if(t){let n=Fv(t,e);r.exec("set-path",{id:t,selected:[n]})}}else if(1===i.length){let e=r.getFile(i[0]);e&&r.exec("folder"===e.type?"set-path":"open-file",{id:e.id})}break}case"arrowup":case"arrowleft":{let e,{_files:t,_selected:n,path:a,_selectNavigation:i}=o;if(n.length){let o=n.at(0).id,i=t.findIndex(e=>e.id===o);if(-1!==i){let n=i-1;t[n]?e=t[n].id:"/"!==a&&!s&&!l&&r.exec("select-file",{type:"navigation"})}}else{if(i)break;if("/"!==a){r.exec("select-file",{type:"navigation"});break}e=t.at(0)?.id}e&&r.exec("select-file",{id:e,toggle:s,range:l});break}case"arrowdown":case"arrowright":{let e,{_files:t,_selected:n,path:a,_selectNavigation:i}=o;if(n.length){let r=n.at(-1).id,a=t.findIndex(e=>e.id===r);if(-1!==a){let r=a+1;t[r]&&(e=t[r].id)}}else{if("/"!==a&&!i){r.exec("select-file",{type:"navigation"});break}e=t.at(0)?.id}e&&r.exec("select-file",{id:e,toggle:s,range:l});break}}}function a(e){let t=e.code.replace("Key","").toLowerCase();n(t,e),"tab"==t&&setTimeout(()=>{let e=document.activeElement;-1!=e.className.indexOf("table")&&r.exec("set-active-panel",{panel:+Hv(e,"data-panel")})})}return e.addEventListener("keydown",a),{destroy:()=>{e.removeEventListener("keydown",a)}}}(r,{api:h,menuOptions:e?D:t,performAction:I,getPanel:R});return()=>{"function"==typeof a?a():a&&"function"==typeof a.destroy&&a.destroy()}},[h,e,D,t,I,R]);let z=ie((r,n)=>{let a,o=r?h.getFile(r):null,i=n.target.closest(".tree-item.folder");if(e)a=D(o?.type);else{if("body"===r)a=t(r);else if(o)if(!i&&S.length>1)a=s?[M,...t("multiselect")]:t("multiselect");else if("/"===r)a=t("folder",o).filter(e=>"paste"===e.id);else{let e=t(o.type,o);e&&(a=s?[M,...e]:e)}"search"===v&&(a=a?.filter(e=>"paste"!==e.id))}if(o?.id&&(!S.length||!S.some(e=>e===o.id))&&!i&&h.exec("select-file",{id:o.id}),a?.length)return a.forEach(e=>{i&&(e.hotkey=""),e.text&&=g(e.text),e.hotkey&&(e.subtext=e.hotkey)}),N(a),o||{}},[h,e,D,t,S,s,M,v,g]),_=ie(e=>{let{action:t,context:r}=e;t&&I(t.id,r,!t.hotkey)},[I]);/* @__PURE__ */
135
+ return be("div",{className:"wx-RJbNonjJ wx-filemanager wx-flex",ref:n,"data-menu-ignore":"false",children:s&&y?/* @__PURE__ */be("div",{className:"wx-RJbNonjJ wx-info-narrow",children:/* @__PURE__ */be(Tb,{narrowMode:s,extraInfo:r})}):/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be(Fb,{narrowMode:s,onShowTree:T}),/* @__PURE__ */be(oy,{dataKey:"id",at:"point",options:C,resolver:z,onClick:_,children:/* @__PURE__ */xe(ny,{dataKey:"actionId",options:C,resolver:z,onClick:_,children:[/* @__PURE__ */be(cy,{data:u,apiOnly:!0,uploadURL:async function(e){await Promise.resolve();let{name:t,size:r}=e.file;h.exec("create-file",{file:{name:t,size:r,date:/* @__PURE__ */new Date,file:e.file},parent:k})}}),/* @__PURE__ */be(bb.Provider,{value:u,children:/* @__PURE__ */be("div",{className:"wx-RJbNonjJ wx-content-wrapper wx-flex",children:/* @__PURE__ */xe(ye,"panels"!==v&&"search"!==v?{children:[/* @__PURE__ */be("div",{className:"wx-RJbNonjJ "+["wx-sidebar",s?"wx-sidebar-narrow":"",c?"wx-sidebar-visible":""].filter(Boolean).join(" "),ref:a,children:/* @__PURE__ */be(Ob,{readonly:e,menuOptions:t})}),/* @__PURE__ */xe("div",{className:"wx-RJbNonjJ wx-content",style:{width:`calc(100% - ${o||0}px - 10px)`},children:[/* @__PURE__ */be("div",{className:"wx-RJbNonjJ wx-content-item"+(y?"":"-fit"),"data-id":Jf("body"),children:"table"===v?/* @__PURE__ */be(Eb,{panel:b}):/* @__PURE__ */be(Bb,{})}),y?/* @__PURE__ */be("div",{className:"wx-RJbNonjJ wx-info",children:/* @__PURE__ */be(Tb,{extraInfo:r})}):null]})]}:{children:[/* @__PURE__ */be("div",{className:"wx-RJbNonjJ wx-content-item"+(y?"":"-fit"),children:be("panels"===v?Ib:Nb,{})}),y?/* @__PURE__ */be("div",{className:"wx-RJbNonjJ wx-info",children:/* @__PURE__ */be(Tb,{extraInfo:r})}):null]})})})]})})]})})}function $b(e,t){let r,{type:n,ext:a}=e;return"folder"!==n&&(r=n&&"file"!==n&&wb[n]?n:a?wb[a]?a:"file":"unknown",`https://cdn.svar.dev/icons/filemanager/vivid/${t}/${r}.svg`)}ne(function(e,t){let{data:r=[],mode:n="cards",drive:a=null,preview:o=!1,panels:i=null,activePanel:s=0,readonly:l=!1,menuOptions:c=$v,extraInfo:d=null,init:u=null,icons:h=$b,previews:p=null,...m}=e,f=me();f.current=m;let g=pe(()=>new Vv(Yv),[]),v=pe(()=>g.in,[g]),y=me(null);null===y.current&&(y.current=new Sv((e,t)=>{let r="on"+(e=>e.split("-").map(e=>e?e.charAt(0).toUpperCase()+e.slice(1):"").join(""))(e);f.current&&f.current[r]&&f.current[r](t)}),v.setNext(y.current));let b=pe(()=>({getState:g.getState.bind(g),getReactiveState:g.getReactive.bind(g),getStores:()=>({data:g}),exec:v.exec,setNext:e=>(y.current=y.current.setNext(e),y.current),intercept:v.intercept.bind(v),on:v.on.bind(v),detach:v.detach.bind(v),getFile:g.getFile.bind(g),serialize:g.serialize.bind(g),templates:{preview:p||(()=>null),icon:"simple"===h?()=>null:h}}),[g,v]),x=me(0);return le(()=>{if(x.current){let e=g.getState();g.init({data:r,mode:n,drive:a,preview:o,panels:i||e.panels||[],activePanel:s})}else u&&u(b);x.current++},[g,r,n,a,o,i,s,u,b]),0===x.current&&g.init({data:r,mode:n,drive:a,preview:o,panels:i||[],activePanel:s}),de(t,()=>({...b}),[b]),/* @__PURE__ */be(vb.Provider,{value:b,children:/* @__PURE__ */be(iv,{words:wv,optional:!0,children:/* @__PURE__ */be(xb,{children:/* @__PURE__ */be(Vb,{readonly:l,menuOptions:c,extraInfo:d})})})})});eg(Qf);var Hb=[{id:"1",title:"Welcome to REASON",content:'<h1>Welcome to REASON</h1><p>A powerful note-taking app with nested documents.</p><h2>Features</h2><ul><li><p><strong>Rich text editing</strong> with WYSIWYG editor</p></li><li><p><strong>Nested documents</strong> for better organization</p></li><li><p><strong>Full-text search</strong> to find notes quickly</p></li><li><p><strong>Drag and drop</strong> to reorganize notes</p></li><li><p><strong>Right-click menus</strong> for quick actions</p></li><li><p><strong>Document outline</strong> view</p></li><li><p><strong>Local storage</strong> - your notes stay private</p></li><li><p><strong>Mobile-friendly</strong> with responsive drawer navigation</p></li></ul><h2>Getting Started</h2><p>On mobile, tap the menu icon to access your notes.</p><p>Click the "New Note" button to create your first note, or select this note to start editing.</p><p>You can also create child notes by right-clicking a note.</p><h3>Drag and Drop</h3><p>Drag notes to reorder them or move them under different parent notes.</p><h3>Outline View</h3><p>Click the outline icon to see all headings in the current document.</p><p>Press the search icon (or Ctrl+K) to quickly find any note.</p>',parentId:null,children:[],isExpanded:!0,tags:[]},{id:"2",title:"Projects",content:"",parentId:null,children:[],isExpanded:!0,isFolder:!0,tags:[]},{id:"3",title:"Website Redesign",content:"<h1>Website Redesign</h1><p>Planning for the new website design.</p><h2>Goals</h2><ul><li><p>Modern, clean interface</p></li><li><p>Mobile-first approach</p></li><li><p>Improved accessibility</p></li></ul>",parentId:"2",children:[],isExpanded:!1,tags:["design","web"]},{id:"4",title:"API Integration",content:"<h1>API Integration</h1><p>Notes on integrating the new REST API.</p><h2>Endpoints</h2><ul><li><p>GET /api/documents</p></li><li><p>POST /api/documents</p></li><li><p>PUT /api/documents/:id</p></li></ul>",parentId:"2",children:[],isExpanded:!1,tags:["development","api"]},{id:"5",title:"Research",content:"",parentId:null,children:[],isExpanded:!0,isFolder:!0,tags:[]},{id:"6",title:"Market Analysis",content:"<h1>Market Analysis</h1><p>Research findings on market trends.</p><h2>Key Insights</h2><ul><li><p>Growing demand for productivity tools</p></li><li><p>Users prefer cloud-based solutions</p></li><li><p>Mobile access is essential</p></li></ul>",parentId:"5",children:[],isExpanded:!1,tags:["research","business"]},{id:"7",title:"Competitor Review",content:"<h1>Competitor Review</h1><p>Analysis of competitor products.</p><h2>Top Competitors</h2><ul><li><p>Notion - Versatile but complex</p></li><li><p>Obsidian - Great for developers</p></li><li><p>Roam Research - Powerful linking</p></li></ul>",parentId:"5",children:[],isExpanded:!1,tags:["research","competition"]},{id:"8",title:"Meeting Notes",content:"<h1>Meeting Notes</h1><p>Quick notes from today's team meeting.</p><h2>Action Items</h2><ul><li><p>Review PRs by EOD</p></li><li><p>Update documentation</p></li><li><p>Schedule next sprint planning</p></li></ul>",parentId:null,children:[],isExpanded:!1,tags:["meetings"]}],jb=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,qb=vm,Ub=(e,t)=>r=>{if(null==t?.variants)return qb(e,r?.class,r?.className);let{variants:n,defaultVariants:a}=t,o=Object.keys(n).map(e=>{let t=r?.[e],o=a?.[e];if(null===t)return null;let i=jb(t)||jb(o);return n[e][i]}),i=r&&Object.entries(r).reduce((e,t)=>{let[r,n]=t;return void 0===n||(e[r]=n),e},{});return qb(e,o,t?.compoundVariants?.reduce((e,t)=>{let{class:r,className:n,...o}=t;return Object.entries(o).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...a,...i}[t]):{...a,...i}[t]===r})?[...e,r,n]:e},[]),r?.class,r?.className)},Gb=Ub("inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-2xl text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border-[1.5px] bg-background hover:bg-accent hover:text-accent-foreground dark:bg-card dark:hover:bg-card/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}}),Wb=["top","right","bottom","left"],Kb=Math.min,Yb=Math.max,Xb=Math.round,Zb=Math.floor,Jb=e=>({x:e,y:e}),Qb={left:"right",right:"left",bottom:"top",top:"bottom"};function ex(e,t,r){return Yb(e,Kb(t,r))}function tx(e,t){return"function"==typeof e?e(t):e}function rx(e){return e.split("-")[0]}function nx(e){return e.split("-")[1]}function ax(e){return"x"===e?"y":"x"}function ox(e){return"y"===e?"height":"width"}function ix(e){let t=e[0];return"t"===t||"b"===t?"y":"x"}function sx(e){return ax(ix(e))}function lx(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}var cx=["left","right"],dx=["right","left"],ux=["top","bottom"],hx=["bottom","top"];function px(e,t,r,n){let a=nx(e),o=function(e,t,r){switch(e){case"top":case"bottom":return r?t?dx:cx:t?cx:dx;case"left":case"right":return t?ux:hx;default:return[]}}(rx(e),"start"===r,n);return a&&(o=o.map(e=>e+"-"+a),t&&(o=o.concat(o.map(lx)))),o}function mx(e){let t=rx(e);return Qb[t]+e.slice(t.length)}function fx(e){return"number"==typeof e?{top:e,right:e,bottom:e,left:e}:function(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}(e)}function gx(e){let{x:t,y:r,width:n,height:a}=e;return{width:n,height:a,top:r,left:t,right:t+n,bottom:r+a,x:t,y:r}}function vx(e,t,r){let n,{reference:a,floating:o}=e,i=ix(t),s=sx(t),l=ox(s),c=rx(t),d="y"===i,u=a.x+a.width/2-o.width/2,h=a.y+a.height/2-o.height/2,p=a[l]/2-o[l]/2;switch(c){case"top":n={x:u,y:a.y-o.height};break;case"bottom":n={x:u,y:a.y+a.height};break;case"right":n={x:a.x+a.width,y:h};break;case"left":n={x:a.x-o.width,y:h};break;default:n={x:a.x,y:a.y}}let m=nx(t);return m&&(n[s]+=p*("end"===m?1:-1)*(r&&d?-1:1)),n}async function yx(e,t){void 0===t&&(t={});let{x:r,y:n,platform:a,rects:o,elements:i,strategy:s}=e,{boundary:l="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:u=!1,padding:h=0}=tx(t,e),p=fx(h),m=i[u?"floating"===d?"reference":"floating":d],f=gx(await a.getClippingRect({element:await(null==a.isElement?void 0:a.isElement(m))??!0?m:m.contextElement||await(null==a.getDocumentElement?void 0:a.getDocumentElement(i.floating)),boundary:l,rootBoundary:c,strategy:s})),g="floating"===d?{x:r,y:n,width:o.floating.width,height:o.floating.height}:o.reference,v=await(null==a.getOffsetParent?void 0:a.getOffsetParent(i.floating)),y=await(null==a.isElement?void 0:a.isElement(v))&&await(null==a.getScale?void 0:a.getScale(v))||{x:1,y:1},b=gx(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:g,offsetParent:v,strategy:s}):g);return{top:(f.top-b.top+p.top)/y.y,bottom:(b.bottom-f.bottom+p.bottom)/y.y,left:(f.left-b.left+p.left)/y.x,right:(b.right-f.right+p.right)/y.x}}function bx(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function xx(e){return Wb.some(t=>e[t]>=0)}var wx=/*#__PURE__*/new Set(["left","top"]);function Sx(){return typeof window<"u"}function kx(e){return Tx(e)?(e.nodeName||"").toLowerCase():"#document"}function Cx(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Nx(e){return((Tx(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Tx(e){return!!Sx()&&(e instanceof Node||e instanceof Cx(e).Node)}function Ax(e){return!!Sx()&&(e instanceof Element||e instanceof Cx(e).Element)}function Mx(e){return!!Sx()&&(e instanceof HTMLElement||e instanceof Cx(e).HTMLElement)}function Dx(e){return!(!Sx()||typeof ShadowRoot>"u")&&(e instanceof ShadowRoot||e instanceof Cx(e).ShadowRoot)}function Ex(e){let{overflow:t,overflowX:r,overflowY:n,display:a}=Vx(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&"inline"!==a&&"contents"!==a}function Ix(e){return/^(table|td|th)$/.test(kx(e))}function Rx(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}var zx,_x=/transform|translate|scale|rotate|perspective|filter/,Px=/paint|layout|strict|content/,Ox=e=>!!e&&"none"!==e;function Lx(e){let t=Ax(e)?Vx(e):e;return Ox(t.transform)||Ox(t.translate)||Ox(t.scale)||Ox(t.rotate)||Ox(t.perspective)||!Fx()&&(Ox(t.backdropFilter)||Ox(t.filter))||_x.test(t.willChange||"")||Px.test(t.contain||"")}function Fx(){return zx??=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none"),zx}function Bx(e){return/^(html|body|#document)$/.test(kx(e))}function Vx(e){return Cx(e).getComputedStyle(e)}function $x(e){return Ax(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Hx(e){if("html"===kx(e))return e;let t=e.assignedSlot||e.parentNode||Dx(e)&&e.host||Nx(e);return Dx(t)?t.host:t}function jx(e){let t=Hx(e);return Bx(t)?(e.ownerDocument||e).body:Mx(t)&&Ex(t)?t:jx(t)}function qx(e,t,r){void 0===t&&(t=[]),void 0===r&&(r=!0);let n=jx(e),a=n===e.ownerDocument?.body,o=Cx(n);if(a){let e=Ux(o);return t.concat(o,o.visualViewport||[],Ex(n)?n:[],e&&r?qx(e):[])}return t.concat(n,qx(n,[],r))}function Ux(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Gx(e){let t=Vx(e),r=parseFloat(t.width)||0,n=parseFloat(t.height)||0,a=Mx(e),o=a?e.offsetWidth:r,i=a?e.offsetHeight:n,s=Xb(r)!==o||Xb(n)!==i;return s&&(r=o,n=i),{width:r,height:n,$:s}}function Wx(e){return Ax(e)?e:e.contextElement}function Kx(e){let t=Wx(e);if(!Mx(t))return Jb(1);let r=t.getBoundingClientRect(),{width:n,height:a,$:o}=Gx(t),i=(o?Xb(r.width):r.width)/n,s=(o?Xb(r.height):r.height)/a;return(!i||!Number.isFinite(i))&&(i=1),(!s||!Number.isFinite(s))&&(s=1),{x:i,y:s}}var Yx=/*#__PURE__*/Jb(0);function Xx(e){let t=Cx(e);return Fx()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Yx}function Zx(e,t,r,n){void 0===t&&(t=!1),void 0===r&&(r=!1);let a=e.getBoundingClientRect(),o=Wx(e),i=Jb(1);t&&(n?Ax(n)&&(i=Kx(n)):i=Kx(e));let s=function(e,t,r){return void 0===t&&(t=!1),!!r&&t&&r===Cx(e)}(o,r,n)?Xx(o):Jb(0),l=(a.left+s.x)/i.x,c=(a.top+s.y)/i.y,d=a.width/i.x,u=a.height/i.y;if(o&&n){let e=Cx(o),t=Ax(n)?Cx(n):n,r=e,a=Ux(r);for(;a&&t!==r;){let e=Kx(a),t=a.getBoundingClientRect(),n=Vx(a),o=t.left+(a.clientLeft+parseFloat(n.paddingLeft))*e.x,i=t.top+(a.clientTop+parseFloat(n.paddingTop))*e.y;l*=e.x,c*=e.y,d*=e.x,u*=e.y,l+=o,c+=i,r=Cx(a),a=Ux(r)}}return gx({width:d,height:u,x:l,y:c})}function Jx(e,t){let r=$x(e).scrollLeft;return t?t.left+r:Zx(Nx(e)).left+r}function Qx(e,t){let r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-Jx(e,r),y:r.top+t.scrollTop}}function ew(e,t,r){let n;if("viewport"===t||"layoutViewport"===t)n=function(e,t,r){void 0===r&&(r="viewport");let n="layoutViewport"===r,a=Cx(e),o=Nx(e),i=a.visualViewport,s=o.clientWidth,l=o.clientHeight,c=0,d=0;if(i){let e=!Fx()||"fixed"===t;n?e||(c=-i.offsetLeft,d=-i.offsetTop):(s=i.width,l=i.height,e&&(c=i.offsetLeft,d=i.offsetTop))}if(Jx(o)<=0){let e=o.ownerDocument,t=e.body,r=getComputedStyle(t),n="CSS1Compat"===e.compatMode&&parseFloat(r.marginLeft)+parseFloat(r.marginRight)||0,a=Math.abs(o.clientWidth-t.clientWidth-n),i="stable both-edges"===getComputedStyle(o).scrollbarGutter?a/2:a;i<=25&&(s-=i)}return{width:s,height:l,x:c,y:d}}(e,r,t);else if("document"===t)n=function(e){let t=$x(e),r=e.ownerDocument.body,n=Yb(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),a=Yb(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight),o=-t.scrollLeft+Jx(e),i=-t.scrollTop;return"rtl"===Vx(r).direction&&(o+=Yb(e.clientWidth,r.clientWidth)-n),{width:n,height:a,x:o,y:i}}(Nx(e));else if(Ax(t))n=function(e,t){let r=Zx(e,!0,"fixed"===t),n=r.top+e.clientTop,a=r.left+e.clientLeft,o=Kx(e);return{width:e.clientWidth*o.x,height:e.clientHeight*o.y,x:a*o.x,y:n*o.y}}(t,r);else{let r=Xx(e);n={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return gx(n)}function tw(e,t){let r=t.get(e);if(r)return r;let n=qx(e,[],!1).filter(e=>Ax(e)&&"body"!==kx(e)),a=null,o="fixed"===Vx(e).position,i=o?Hx(e):e;for(;Ax(i)&&!Bx(i);){let e=Vx(i),t=Lx(i),r=a?a.position:o?"fixed":"";t||"fixed"!==r&&("absolute"!==r||"static"!==e.position)?a=e:n=n.filter(e=>e!==i),i=Hx(i)}return t.set(e,n),n}function rw(e,t,r){let n=Mx(t),a=Nx(t),o="fixed"===r,i=Zx(e,!0,o,t),s={scrollLeft:0,scrollTop:0},l=Jb(0);if((n||!o)&&(("body"!==kx(t)||Ex(a))&&(s=$x(t)),n)){let e=Zx(t,!0,o,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}!n&&a&&(l.x=Jx(a));let c=!a||n||o?Jb(0):Qx(a,s);return{x:i.left+s.scrollLeft-l.x-c.x,y:i.top+s.scrollTop-l.y-c.y,width:i.width,height:i.height}}function nw(e){return"static"===Vx(e).position}function aw(e,t){if(!Mx(e)||"fixed"===Vx(e).position)return null;if(t)return t(e);let r=e.offsetParent;return Nx(e)===r&&(r=r.ownerDocument.body),r}function ow(e,t){let r=Cx(e);if(Rx(e))return r;if(!Mx(e)){let t=Hx(e);for(;t&&!Bx(t);){if(Ax(t)&&!nw(t))return t;t=Hx(t)}return r}let n=aw(e,t);for(;n&&Ix(n)&&nw(n);)n=aw(n,t);return n&&Bx(n)&&nw(n)&&!Lx(n)?r:n||function(e){let t=Hx(e);for(;Mx(t)&&!Bx(t);){if(Lx(t))return t;if(Rx(t))return null;t=Hx(t)}return null}(e)||r}var iw={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e,o="fixed"===a,i=Nx(n),s=!!t&&Rx(t.floating);if(n===i||s&&o)return r;let l={scrollLeft:0,scrollTop:0},c=Jb(1),d=Jb(0),u=Mx(n);if((u||!o)&&(("body"!==kx(n)||Ex(i))&&(l=$x(n)),u)){let e=Zx(n);c=Kx(n),d.x=e.x+n.clientLeft,d.y=e.y+n.clientTop}let h=!i||u||o?Jb(0):Qx(i,l);return{width:r.width*c.x,height:r.height*c.y,x:r.x*c.x-l.scrollLeft*c.x+d.x+h.x,y:r.y*c.y-l.scrollTop*c.y+d.y+h.y}},getDocumentElement:Nx,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e,o=[..."clippingAncestors"===r?Rx(t)?[]:tw(t,this._c):[].concat(r),n],i=ew(t,o[0],a),s=i.top,l=i.right,c=i.bottom,d=i.left;for(let u=1;u<o.length;u++){let e=ew(t,o[u],a);s=Yb(e.top,s),l=Kb(e.right,l),c=Kb(e.bottom,c),d=Yb(e.left,d)}return{width:l-d,height:c-s,x:d,y:s}},getOffsetParent:ow,getElementRects:async function(e){let t=this.getOffsetParent||ow,r=this.getDimensions,n=await r(e.floating);return{reference:rw(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}},getClientRects:function(e){return e.getClientRects?Array.from(e.getClientRects()):[]},getDimensions:function(e){let{width:t,height:r}=Gx(e);return{width:t,height:r}},getScale:Kx,isElement:Ax,isRTL:function(e){return"rtl"===Vx(e).direction}};function sw(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function lw(e,t,r,n){void 0===n&&(n={});let{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:i="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:l=!1}=n,c=Wx(e),d=a||o?[...c?qx(c):[],...t?qx(t):[]]:[];d.forEach(e=>{a&&e.addEventListener("scroll",r),o&&e.addEventListener("resize",r)});let u=c&&s?function(e,t,r){let n,a=null,o=Nx(e);function i(){var e;clearTimeout(n),null==(e=a)||e.disconnect(),a=null}function s(r,l){void 0===r&&(r=!1),void 0===l&&(l=1),i();let c=e.getBoundingClientRect(),{left:d,top:u,width:h,height:p}=c;if(r||t(),!h||!p)return;let m={rootMargin:-Zb(u)+"px "+-Zb(o.clientWidth-(d+h))+"px "+-Zb(o.clientHeight-(u+p))+"px "+-Zb(d)+"px",threshold:Yb(0,Kb(1,l))||1},f=!0;function g(t){let r=t[0].intersectionRatio;if(!sw(c,e.getBoundingClientRect()))return s();if(r!==l){if(!f)return s();r?s(!1,r):n=setTimeout(()=>{s(!1,1e-7)},1e3)}f=!1}try{a=new IntersectionObserver(g,{...m,root:o.ownerDocument})}catch{a=new IntersectionObserver(g,m)}a.observe(e)}let l=Cx(e),c=()=>s(r);return l.addEventListener("resize",c),s(!0),()=>{l.removeEventListener("resize",c),i()}}(c,r,o):null,h=-1,p=null;i&&(p=new ResizeObserver(e=>{let[n]=e;n&&n.target===c&&p&&t&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var e;null==(e=p)||e.observe(t)})),r()}),c&&!l&&p.observe(c),t&&p.observe(t));let m,f=l?Zx(e):null;return l&&function t(){let n=Zx(e);f&&!sw(f,n)&&r(),f=n,m=requestAnimationFrame(t)}(),r(),()=>{var e;d.forEach(e=>{a&&e.removeEventListener("scroll",r),o&&e.removeEventListener("resize",r)}),u?.(),null==(e=p)||e.disconnect(),p=null,l&&cancelAnimationFrame(m)}}var cw=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var r;let{x:n,y:a,placement:o,middlewareData:i}=t,s=await async function(e,t){let{placement:r,platform:n,elements:a}=e,o=await(null==n.isRTL?void 0:n.isRTL(a.floating)),i=rx(r),s=nx(r),l="y"===ix(r),c=wx.has(i)?-1:1,d=o&&l?-1:1,u=tx(t,e),{mainAxis:h,crossAxis:p,alignmentAxis:m}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return s&&"number"==typeof m&&(p="end"===s?-1*m:m),l?{x:p*d,y:h*c}:{x:h*c,y:p*d}}(t,e);return o===i.offset?.placement&&null!=(r=i.arrow)&&r.alignmentOffset?{}:{x:n+s.x,y:a+s.y,data:{...s,placement:o}}}}},dw=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){let{x:r,y:n,placement:a,platform:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:l={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...c}=tx(e,t),d={x:r,y:n},u=await o.detectOverflow(t,c),h=ix(a),p=ax(h),m=d[p],f=d[h],g=(e,t)=>ex(t+u["y"===e?"top":"left"],t,t-u["y"===e?"bottom":"right"]);i&&(m=g(p,m)),s&&(f=g(h,f));let v=l.fn({...t,[p]:m,[h]:f});return{...v,data:{x:v.x-r,y:v.y-n,enabled:{[p]:i,[h]:s}}}}}},uw=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var r;let{placement:n,middlewareData:a,rects:o,initialPlacement:i,platform:s,elements:l}=t,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:u,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...f}=tx(e,t);if(null!=(r=a.arrow)&&r.alignmentOffset)return{};let g=rx(n),v=ix(i),y=rx(i)===i,b=await(null==s.isRTL?void 0:s.isRTL(l.floating)),x=u||(y||!m?[mx(i)]:function(e){let t=mx(e);return[lx(e),t,lx(t)]}(i)),w="none"!==p;!u&&w&&x.push(...px(i,m,p,b));let S=[i,...x],k=await s.detectOverflow(t,f),C=[],N=a.flip?.overflows||[];if(c&&C.push(k[g]),d){let e=function(e,t,r){void 0===r&&(r=!1);let n=nx(e),a=sx(e),o=ox(a),i="x"===a?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=mx(i)),[i,mx(i)]}(n,o,b);C.push(k[e[0]],k[e[1]])}if(N=[...N,{placement:n,overflows:C}],!C.every(e=>e<=0)){let e=(a.flip?.index||0)+1,t=S[e];if(t&&("alignment"!==d||v===ix(t)||N.every(e=>ix(e.placement)!==v||e.overflows[0]>0)))return{data:{index:e,overflows:N},reset:{placement:t}};let r=N.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!r)switch(h){case"bestFit":{let e=N.filter(e=>{if(w){let t=ix(e.placement);return t===v||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(r=e);break}case"initialPlacement":r=i}if(n!==r)return{reset:{placement:r}}}return{}}}},hw=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){let r,n,{placement:a,rects:o,platform:i,elements:s}=t,{apply:l=()=>{},...c}=tx(e,t),d=await i.detectOverflow(t,c),u=rx(a),h=nx(a),p="y"===ix(a),{width:m,height:f}=o.floating;"top"===u||"bottom"===u?(r=u,n=h===(await(null==i.isRTL?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(n=u,r="end"===h?"top":"bottom");let g=f-d.top-d.bottom,v=m-d.left-d.right,y=Kb(f-d[r],g),b=Kb(m-d[n],v),x=t.middlewareData.shift,w=!x,S=y,k=b;null!=x&&x.enabled.x&&(k=v),null!=x&&x.enabled.y&&(S=g),w&&!h&&(p?k=m-2*Yb(d.left,d.right):S=f-2*Yb(d.top,d.bottom)),await l({...t,availableWidth:k,availableHeight:S});let C=await i.getDimensions(s.floating);return m!==C.width||f!==C.height?{reset:{rects:!0}}:{}}}},pw=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){let{rects:r,platform:n}=t,{strategy:a="referenceHidden",...o}=tx(e,t);switch(a){case"referenceHidden":{let e=bx(await n.detectOverflow(t,{...o,elementContext:"reference"}),r.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:xx(e)}}}case"escaped":{let e=bx(await n.detectOverflow(t,{...o,altBoundary:!0}),r.floating);return{data:{escapedOffsets:e,escaped:xx(e)}}}default:return{}}}}},mw=e=>({name:"arrow",options:e,async fn(t){let{x:r,y:n,placement:a,rects:o,platform:i,elements:s,middlewareData:l}=t,{element:c,padding:d=0}=tx(e,t)||{};if(null==c)return{};let u=fx(d),h={x:r,y:n},p=sx(a),m=ox(p),f=await i.getDimensions(c),g="y"===p,v=g?"top":"left",y=g?"bottom":"right",b=g?"clientHeight":"clientWidth",x=o.reference[m]+o.reference[p]-h[p]-o.floating[m],w=h[p]-o.reference[p],S=await(null==i.getOffsetParent?void 0:i.getOffsetParent(c)),k=S?S[b]:0;(!k||!(await(null==i.isElement?void 0:i.isElement(S))))&&(k=s.floating[b]||o.floating[m]);let C=x/2-w/2,N=k/2-f[m]/2-1,T=Kb(u[v],N),A=Kb(u[y],N),M=k-f[m]-A,D=k/2-f[m]/2+C,E=ex(T,D,M),I=!l.arrow&&null!=nx(a)&&D!==E&&o.reference[m]/2-(D<T?T:A)-f[m]/2<0,R=I?D<T?D-T:D-M:0;return{[p]:h[p]+R,data:{[p]:E,centerOffset:D-E-R,...I&&{alignmentOffset:R}},reset:I}}}),fw=function(e){return void 0===e&&(e={}),{options:e,fn(t){let{x:r,y:n,placement:a,rects:o,middlewareData:i}=t,{offset:s=0,mainAxis:l=!0,crossAxis:c=!0}=tx(e,t),d={x:r,y:n},u=ix(a),h=ax(u),p=d[h],m=d[u],f=tx(s,t),g="number"==typeof f?{mainAxis:f,crossAxis:0}:{mainAxis:f.mainAxis??0,crossAxis:f.crossAxis??0};if(l){let e="y"===h?"height":"width",t=o.reference[h]-o.floating[e]+g.mainAxis,r=o.reference[h]+o.reference[e]-g.mainAxis;p<t?p=t:p>r&&(p=r)}if(c){let e="y"===h?"width":"height",t=wx.has(rx(a)),r=o.reference[u]-o.floating[e]+(t&&i.offset?.[u]||0)+(t?0:g.crossAxis),n=o.reference[u]+o.reference[e]+(t?0:i.offset?.[u]||0)-(t?g.crossAxis:0);m<r?m=r:m>n&&(m=n)}return{[h]:p,[u]:m}}}},gw=(e,t,r)=>{let n=/* @__PURE__ */new Map,a=r??{},o={...iw,...a.platform,_c:n};return(async(e,t,r)=>{let{placement:n="bottom",strategy:a="absolute",middleware:o=[],platform:i}=r,s=i.detectOverflow?i:{...i,detectOverflow:yx},l=await(null==i.isRTL?void 0:i.isRTL(t)),c=await i.getElementRects({reference:e,floating:t,strategy:a}),{x:d,y:u}=vx(c,n,l),h=n,p=0,m={};for(let f=0;f<o.length;f++){let r=o[f];if(!r)continue;let{name:g,fn:v}=r,{x:y,y:b,data:x,reset:w}=await v({x:d,y:u,initialPlacement:n,placement:h,strategy:a,middlewareData:m,rects:c,platform:s,elements:{reference:e,floating:t}});d=y??d,u=b??u,m[g]={...m[g],...x},w&&p<50&&(p++,"object"==typeof w&&(w.placement&&(h=w.placement),w.rects&&(c=!0===w.rects?await i.getElementRects({reference:e,floating:t,strategy:a}):w.rects),({x:d,y:u}=vx(c,h,l))),f=-1)}return{x:d,y:u,placement:h,strategy:a,middlewareData:m}})(e,t,{...a,platform:o})},vw=typeof document<"u"?he:function(){};function yw(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let r,n,a;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;0!==n--;)if(!yw(e[n],t[n]))return!1;return!0}if(a=Object.keys(e),r=a.length,r!==Object.keys(t).length)return!1;for(n=r;0!==n--;)if(!{}.hasOwnProperty.call(t,a[n]))return!1;for(n=r;0!==n--;){let r=a[n];if(!("_owner"===r&&e.$$typeof||yw(e[r],t[r])))return!1}return!0}return e!=e&&t!=t}function bw(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function xw(e,t){let r=bw(e);return Math.round(t*r)/r}function ww(e){let t=X.useRef(e);return vw(()=>{t.current=e}),t}function Sw(e){void 0===e&&(e={});let{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:a,elements:{reference:o,floating:i}={},transform:s=!0,whileElementsMounted:l,open:c}=e,[d,u]=X.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=X.useState(n);yw(h,n)||p(n);let[m,f]=X.useState(null),[g,v]=X.useState(null),y=X.useCallback(e=>{e!==S.current&&(S.current=e,f(e))},[]),b=X.useCallback(e=>{e!==k.current&&(k.current=e,v(e))},[]),x=o||m,w=i||g,S=X.useRef(null),k=X.useRef(null),C=X.useRef(d),N=null!=l,T=ww(l),A=ww(a),M=ww(c),D=X.useCallback(()=>{if(!S.current||!k.current)return;let e={placement:t,strategy:r,middleware:h};A.current&&(e.platform=A.current),gw(S.current,k.current,e).then(e=>{let t={...e,isPositioned:!1!==M.current};E.current&&!yw(C.current,t)&&(C.current=t,ft.flushSync(()=>{u(t)}))})},[h,t,r,A,M]);vw(()=>{!1===c&&C.current.isPositioned&&(C.current.isPositioned=!1,u(e=>({...e,isPositioned:!1})))},[c]);let E=X.useRef(!1);vw(()=>(E.current=!0,()=>{E.current=!1}),[]),vw(()=>{if(x&&(S.current=x),w&&(k.current=w),x&&w){if(T.current)return T.current(x,w,D);D()}},[x,w,D,T,N]);let I=X.useMemo(()=>({reference:S,floating:k,setReference:y,setFloating:b}),[y,b]),R=X.useMemo(()=>({reference:x,floating:w}),[x,w]),z=X.useMemo(()=>{let e={position:r,left:0,top:0};if(!R.floating)return e;let t=xw(R.floating,d.x),n=xw(R.floating,d.y);return s?{...e,transform:"translate("+t+"px, "+n+"px)",...bw(R.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,s,R.floating,d.x,d.y]);return X.useMemo(()=>({...d,update:D,refs:I,elements:R,floatingStyles:z}),[d,D,I,R,z])}var kw=(e,t)=>{let r=cw(e);return{name:r.name,fn:r.fn,options:[e,t]}},Cw=(e,t)=>{let r=dw(e);return{name:r.name,fn:r.fn,options:[e,t]}},Nw=(e,t)=>({fn:fw(e).fn,options:[e,t]}),Tw=(e,t)=>{let r=uw(e);return{name:r.name,fn:r.fn,options:[e,t]}},Aw=(e,t)=>{let r=hw(e);return{name:r.name,fn:r.fn,options:[e,t]}},Mw=(e,t)=>{let r=pw(e);return{name:r.name,fn:r.fn,options:[e,t]}},Dw=(e,t)=>{let r=(e=>({name:"arrow",options:e,fn(t){let{element:r,padding:n}="function"==typeof e?e(t):e;return r&&function(e){return{}.hasOwnProperty.call(e,"current")}(r)?null==r.current?{}:mw({element:r.current,padding:n}).fn(t):r?mw({element:r,padding:n}).fn(t):{}}}))(e);return{name:r.name,fn:r.fn,options:[e,t]}},Ew=(Object.defineProperty,Object.defineProperty);function Iw(e){let[t,r]=X.useState(void 0);return sd(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let n,a,o=t[0];if("borderBoxSize"in o){let e=o.borderBoxSize,t=Array.isArray(e)?e[0]:e;n=t.inlineSize,a=t.blockSize}else n=e.offsetWidth,a=e.offsetHeight;r({width:n,height:a})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)},[e]),t}((e,t)=>{Ew(e,"name",{value:t,configurable:!0})})(Iw,"useSize");var Rw=Object.defineProperty,zw=(e,t)=>Rw(e,"name",{value:t,configurable:!0}),_w="Popper",[Pw,Ow]=/* @__PURE__ */od(_w),[Lw,Fw]=Pw(_w),Bw=/* @__PURE__ */zw(e=>{let{__scopePopper:t,children:r}=e,[n,a]=X.useState(null),[o,i]=X.useState(void 0);/* @__PURE__ */
136
+ return be(Lw,{scope:t,anchor:n,onAnchorChange:a,placementState:o,setPlacementState:i,children:r})},"Popper"),Vw=/* @__PURE__ */X.forwardRef(/* @__PURE__ */zw(function(e,t){let{__scopePopper:r,virtualRef:n,...a}=e,o=Fw("PopperAnchor",r),i=X.useRef(null),s=o.onAnchorChange,l=rd(t,X.useCallback(e=>{i.current=e,e&&s(e)},[s])),c=X.useRef(null);X.useEffect(()=>{if(!n)return;let e=c.current;c.current=n.current,e!==c.current&&s(c.current)});let d=o.placementState&&Ww(o.placementState),u=d?.[0],h=d?.[1];return n?null:/* @__PURE__ */be(Vd.div,{"data-radix-popper-side":u,"data-radix-popper-align":h,...a,ref:l})},"PopperAnchor")),$w="PopperContent",[Hw,jw]=Pw($w),qw=/* @__PURE__ */X.forwardRef(/* @__PURE__ */zw(function(e,t){let{__scopePopper:r,side:n="bottom",sideOffset:a=0,align:o="center",alignOffset:i=0,arrowPadding:s=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:d=0,sticky:u="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:m,...f}=e,g=Fw($w,r),[v,y]=X.useState(null),b=rd(t,y),[x,w]=X.useState(null),S=Iw(x),k=S?.width??0,C=S?.height??0,N=n+("center"===o?"":"-"+o),T="number"==typeof d?d:{top:0,right:0,bottom:0,left:0,...d},A=Array.isArray(c)?c:[c],M=A.length>0,D={padding:T,boundary:A.filter(Uw),altBoundary:M},{refs:E,floatingStyles:I,placement:R,isPositioned:z,middlewareData:_}=Sw({strategy:"fixed",placement:N,whileElementsMounted:/* @__PURE__ */zw((...e)=>lw(...e,{animationFrame:"always"===p}),"whileElementsMounted"),elements:{reference:g.anchor},middleware:[kw({mainAxis:a+C,alignmentAxis:i}),l&&Cw({mainAxis:!0,crossAxis:!1,limiter:"partial"===u?Nw():void 0,...D}),l&&Tw({...D}),Aw({...D,apply:/* @__PURE__ */zw(({elements:e,rects:t,availableWidth:r,availableHeight:n})=>{let{width:a,height:o}=t.reference,i=e.floating.style;i.setProperty("--radix-popper-available-width",`${r}px`),i.setProperty("--radix-popper-available-height",`${n}px`),i.setProperty("--radix-popper-anchor-width",`${a}px`),i.setProperty("--radix-popper-anchor-height",`${o}px`)},"apply")}),x&&Dw({element:x,padding:s}),Gw({arrowWidth:k,arrowHeight:C}),h&&Mw({strategy:"referenceHidden",...D,boundary:M?D.boundary:void 0})]}),P=g.setPlacementState;sd(()=>(P(R),()=>{P(void 0)}),[R,P]);let[O,L]=Ww(R),F=jd(m);sd(()=>{z&&F?.()},[z,F]);let B=_.arrow?.x,V=_.arrow?.y,$=0!==_.arrow?.centerOffset,[H,j]=X.useState();return sd(()=>{v&&j(window.getComputedStyle(v).zIndex)},[v]),/* @__PURE__ */be("div",{ref:E.setFloating,"data-radix-popper-content-wrapper":"",style:{...I,transform:z?I.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:H,"--radix-popper-transform-origin":[_.transformOrigin?.x,_.transformOrigin?.y].join(" "),..._.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:/* @__PURE__ */be(Hw,{scope:r,placedSide:O,placedAlign:L,onArrowChange:w,arrowX:B,arrowY:V,shouldHideArrow:$,children:/* @__PURE__ */be(Vd.div,{"data-side":O,"data-align":L,...f,ref:b,style:{...f.style,animation:z?f.style?.animation:"none"}})})})},"PopperContent"));function Uw(e){return null!==e}zw(Uw,"isNotNull");var Gw=/* @__PURE__ */zw(e=>({name:"transformOrigin",options:e,fn(t){let{placement:r,rects:n,middlewareData:a}=t,o=0!==a.arrow?.centerOffset,i=o?0:e.arrowWidth,s=o?0:e.arrowHeight,[l,c]=Ww(r),d={start:"0%",center:"50%",end:"100%"}[c],u=(a.arrow?.x??0)+i/2,h=(a.arrow?.y??0)+s/2,p="",m="";return"bottom"===l?(p=o?d:`${u}px`,m=-s+"px"):"top"===l?(p=o?d:`${u}px`,m=`${n.floating.height+s}px`):"right"===l?(p=-s+"px",m=o?d:`${h}px`):"left"===l&&(p=`${n.floating.width+s}px`,m=o?d:`${h}px`),{data:{x:p,y:m}}}}),"transformOrigin");function Ww(e){let[t,r="center"]=e.split("-");return[t,r]}zw(Ww,"getSideAndAlignFromPlacement");var Kw=Bw,Yw=Vw,Xw=qw,Zw=(Object.defineProperty,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"}),Object.defineProperty),Jw=(e,t)=>Zw(e,"name",{value:t,configurable:!0}),[Qw,eS]=/* @__PURE__ */od("Tooltip",[Ow]),[tS,rS]=(Ow(),Qw("TooltipProvider")),nS="Tooltip",[aS,oS]=Qw(nS),iS="TooltipPortal",[sS,lS]=Qw(iS,{forceMount:void 0});function cS(e,t){let r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(r,n,a,o)){case o:return"left";case a:return"right";case r:return"top";case n:return"bottom";default:throw Error("unreachable")}}function dS(e,t,r=5){let n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r})}return n}function uS(e){let{top:t,right:r,bottom:n,left:a}=e;return[{x:a,y:t},{x:r,y:t},{x:r,y:n},{x:a,y:n}]}function hS(e,t){let{x:r,y:n}=e,a=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){let e=t[o],s=t[i],l=e.x,c=e.y,d=s.x,u=s.y;c>n!=u>n&&r<(d-l)*(n-c)/(u-c)+l&&(a=!a)}return a}function pS(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),mS(t)}function mS(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if(!((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x)))break;t.pop()}t.push(r)}t.pop();let r=[];for(let n=e.length-1;n>=0;n--){let t=e[n];for(;r.length>=2;){let e=r[r.length-1],n=r[r.length-2];if(!((e.x-n.x)*(t.y-n.y)>=(e.y-n.y)*(t.x-n.x)))break;r.pop()}r.push(t)}return r.pop(),1===t.length&&1===r.length&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}Jw(cS,"getExitSideFromRect"),Jw(dS,"getPaddedExitPoints"),Jw(uS,"getPointsFromRect"),Jw(hS,"isPointInPolygon"),Jw(pS,"getHull"),Jw(mS,"getHullPresorted");var fS=Object.defineProperty,gS=(e,t)=>fS(e,"name",{value:t,configurable:!0});function vS(e){let t=e+"CollectionProvider",[r,n]=/* @__PURE__ */od(t),[a,o]=r(t,{collectionRef:{current:null},itemMap:/* @__PURE__ */new Map}),i=/* @__PURE__ */gS(e=>{let{scope:t,children:r}=e,n=X.useRef(null),o=X.useRef(/* @__PURE__ */new Map).current;/* @__PURE__ */
137
137
  return be(a,{scope:t,itemMap:o,collectionRef:n,children:r})},"CollectionProvider");i.displayName=t;let s=e+"CollectionSlot",l=/* @__PURE__ */Nd(s),c=X.forwardRef((e,t)=>{let{scope:r,children:n}=e,a=rd(t,o(s,r).collectionRef);/* @__PURE__ */
138
- return be(l,{ref:a,children:n})});c.displayName=s;let d=e+"CollectionItemSlot",u="data-radix-collection-item",h=/* @__PURE__ */Nd(d),p=X.forwardRef((e,t)=>{let{scope:r,children:n,...a}=e,i=X.useRef(null),s=rd(t,i),l=o(d,r);return X.useEffect(()=>(l.itemMap.set(i,{ref:i,...a}),()=>{l.itemMap.delete(i);/* @__PURE__ */})),be(h,{[u]:"",ref:s,children:n})});function m(t){let r=o(e+"CollectionConsumer",t);return X.useCallback(()=>{let e=r.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${u}]`));return Array.from(r.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current))},[r.collectionRef,r.itemMap])}return p.displayName=d,wS(m,"useCollection"),[{Provider:i,Slot:c,ItemSlot:p},m,n]}wS(SS,"createCollection");var kS=/* @__PURE__ */new WeakMap,CS=class e extends Map{static{wS(this,"OrderedDict")}#e;constructor(e){super(e),this.#e=[...super.keys()],kS.set(this,!0)}set(e,t){return kS.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,r){let n=this.has(t),a=this.#e.length,o=AS(e),i=o>=0?o:a+o,s=i<0||i>=a?-1:i;if(s===this.size||n&&s===this.size-1||-1===s)return this.set(t,r),this;let l=this.size+ +!n;o<0&&i++;let c,d=[...this.#e],u=!1;for(let h=i;h<l;h++)if(i===h){let e=d[h];d[h]===t&&(e=d[h+1]),n&&this.delete(t),c=this.get(e),this.set(t,r)}else{!u&&d[h-1]===t&&(u=!0);let e=d[u?h:h-1],r=c;c=this.get(e),this.delete(e),this.set(e,r)}return this}with(t,r,n){let a=new e(this);return a.insert(t,r,n),a}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,r){let n=this.#e.indexOf(e);return-1===n?this:this.insert(n,t,r)}after(e){let t=this.#e.indexOf(e);if(t=-1===t||t===this.size-1?-1:t+1,-1!==t)return this.entryAt(t)}setAfter(e,t,r){let n=this.#e.indexOf(e);return-1===n?this:this.insert(n+1,t,r)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return void 0!==t&&this.delete(t)}at(e){let t=NS(this.#e,e);if(void 0!==t)return this.get(t)}entryAt(e){let t=NS(this.#e,e);if(void 0!==t)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return NS(this.#e,e)}from(e,t){let r=this.indexOf(e);if(-1===r)return;let n=r+t;return n<0&&(n=0),n>=this.size&&(n=this.size-1),this.at(n)}keyFrom(e,t){let r=this.indexOf(e);if(-1===r)return;let n=r+t;return n<0&&(n=0),n>=this.size&&(n=this.size-1),this.keyAt(n)}find(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return n;r++}}findIndex(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return r;r++}return-1}filter(t,r){let n=[],a=0;for(let e of this)Reflect.apply(t,r,[e,a,this])&&n.push(e),a++;return new e(n)}map(t,r){let n=[],a=0;for(let e of this)n.push([e[0],Reflect.apply(t,r,[e,a,this])]),a++;return new e(n)}reduce(...e){let[t,r]=e,n=0,a=r??this.at(0);for(let o of this)a=0===n&&1===e.length?o:Reflect.apply(t,this,[a,o,n,this]),n++;return a}reduceRight(...e){let[t,r]=e,n=r??this.at(-1);for(let a=this.size-1;a>=0;a--){let r=this.at(a);n=a===this.size-1&&1===e.length?r:Reflect.apply(t,this,[n,r,a,this])}return n}toSorted(t){let r=[...this.entries()].sort(t);return new e(r)}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let r=this.keyAt(e),n=this.get(r);t.set(r,n)}return t}toSpliced(...t){let r=[...this.entries()];return r.splice(...t),new e(r)}slice(t,r){let n=new e,a=this.size-1;if(void 0===t)return n;t<0&&(t+=this.size),void 0!==r&&r>0&&(a=r-1);for(let e=t;e<=a;e++){let t=this.keyAt(e),r=this.get(t);n.set(t,r)}return n}every(e,t){let r=0;for(let n of this){if(!Reflect.apply(e,t,[n,r,this]))return!1;r++}return!0}some(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return!0;r++}return!1}};function NS(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);let r=TS(e,t);return-1===r?void 0:e[r]}function TS(e,t){let r=e.length,n=AS(t),a=n>=0?n:r+n;return a<0||a>=r?-1:a}function AS(e){return e!=e||0===e?0:Math.trunc(e)}function MS(e,t){if(e===t)return!0;if("object"!=typeof e||"object"!=typeof t||null==e||null==t)return!1;let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let a of r)if(!Object.prototype.hasOwnProperty.call(t,a)||e[a]!==t[a])return!1;return!0}function DS(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function ES(e,t){return e[1].element&&t[1].element?DS(e[1].element,t[1].element)?-1:1:0}function IS(e){return new MutationObserver(t=>{for(let r of t)if("childList"===r.type)return void e()})}wS(NS,"at"),wS(TS,"toSafeIndex"),wS(AS,"toSafeInteger"),wS(function(e){let t=e+"CollectionProvider",[r,n]=/* @__PURE__ */od(t),[a,o]=r(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new CS,setItemMap:/* @__PURE__ */wS(()=>{},"setItemMap")}),i=/* @__PURE__ */wS(({state:e,...t})=>e?/* @__PURE__ */be(l,{...t,state:e}):/* @__PURE__ */be(s,{...t}),"CollectionProvider");i.displayName=t;let s=/* @__PURE__ */wS(e=>{let t=f();/* @__PURE__ */
139
- return be(l,{...e,state:t})},"CollectionInit");s.displayName=t+"Init";let l=/* @__PURE__ */wS(e=>{let{scope:t,children:r,state:n}=e,o=X.useRef(null),[i,s]=X.useState(null),l=rd(o,s),[c,d]=n;return X.useEffect(()=>{if(!i)return;let e=IS(()=>{});return e.observe(i,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[i]),/* @__PURE__ */be(a,{scope:t,itemMap:c,setItemMap:d,collectionRef:l,collectionRefObject:o,collectionElement:i,children:r})},"CollectionProviderImpl");l.displayName=t+"Impl";let c=e+"CollectionSlot",d=/* @__PURE__ */Nd(c),u=X.forwardRef((e,t)=>{let{scope:r,children:n}=e,a=rd(t,o(c,r).collectionRef);/* @__PURE__ */
140
- return be(d,{ref:a,children:n})});u.displayName=c;let h=e+"CollectionItemSlot",p=/* @__PURE__ */Nd(h),m=X.forwardRef((e,t)=>{let{scope:r,children:n,...a}=e,i=X.useRef(null),[s,l]=X.useState(null),c=rd(t,i,l),{setItemMap:d}=o(h,r),u=X.useRef(a);MS(u.current,a)||(u.current=a);let m=u.current;return X.useEffect(()=>{let e=m;return d(t=>s?t.has(s)?t.set(s,{...e,element:s}).toSorted(ES):(t.set(s,{...e,element:s}),t.toSorted(ES)):t),()=>{d(e=>s&&e.has(s)?(e.delete(s),new CS(e)):e)}},[s,m,d]),/* @__PURE__ */be(p,{"data-radix-collection-item":"",ref:c,children:n})});function f(){return X.useState(new CS)}function g(t){let{itemMap:r}=o(e+"CollectionConsumer",t);return r}return m.displayName=h,wS(f,"useInitCollection"),wS(g,"useCollection"),[{Provider:i,Slot:u,ItemSlot:m},{createCollectionScope:n,useCollection:g,useInitCollection:f}]},"createCollection"),wS(MS,"shallowEqual"),wS(DS,"isElementPreceding"),wS(ES,"sortByDocumentPosition"),wS(IS,"getChildListObserver");var RS=Object.defineProperty,zS=X.createContext(void 0);function _S(e){let t=X.useContext(zS);return e||t||"ltr"}((e,t)=>{RS(e,"name",{value:t,configurable:!0})})(_S,"useDirection");var PS=Object.defineProperty,OS=(e,t)=>PS(e,"name",{value:t,configurable:!0}),LS=!1;function FS(){let[e,t]=X.useState(LS);return X.useEffect(()=>{LS||(LS=!0,t(!0))},[]),e}OS(FS,"useIsHydrated");var BS=X.useSyncExternalStore;function VS(){return()=>{}}function $S(){return BS(VS,()=>!0,()=>!1)}OS(VS,"subscribe"),OS($S,"useIsHydratedModern");var HS="function"==typeof BS?$S:FS,jS=Object.defineProperty,qS=(e,t)=>jS(e,"name",{value:t,configurable:!0}),US="rovingFocusGroup.onEntryFocus",GS={bubbles:!1,cancelable:!0},WS="RovingFocusGroup",[KS,YS,XS]=/* @__PURE__ */SS(WS),[ZS,JS]=/* @__PURE__ */od(WS,[XS]),[QS,ek]=ZS(WS),tk=/* @__PURE__ */X.forwardRef(/* @__PURE__ */qS(function(e,t){/* @__PURE__ */
141
- return be(KS.Provider,{scope:e.__scopeRovingFocusGroup,children:/* @__PURE__ */be(KS.Slot,{scope:e.__scopeRovingFocusGroup,children:/* @__PURE__ */be(rk,{...e,ref:t})})})},"RovingFocusGroup")),rk=/* @__PURE__ */X.forwardRef(/* @__PURE__ */qS(function(e,t){let{__scopeRovingFocusGroup:r,orientation:n,loop:a=!1,dir:o,currentTabStopId:i,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:d=!1,...u}=e,h=X.useRef(null),p=rd(t,h),m=_S(o),[f,g]=bd({prop:i,defaultProp:s??null,onChange:l,caller:WS}),[v,y]=X.useState(!1),b=jd(c),x=YS(r),w=X.useRef(!1),[S,k]=X.useState(0);return X.useEffect(()=>{let e=h.current;if(e)return e.addEventListener(US,b),()=>e.removeEventListener(US,b)},[b]),/* @__PURE__ */be(QS,{scope:r,orientation:n,dir:m,loop:a,currentTabStopId:f,onItemFocus:X.useCallback(e=>g(e),[g]),onItemShiftTab:X.useCallback(()=>y(!0),[]),onFocusableItemAdd:X.useCallback(()=>k(e=>e+1),[]),onFocusableItemRemove:X.useCallback(()=>k(e=>e-1),[]),children:/* @__PURE__ */be(Vd.div,{tabIndex:v||0===S?-1:0,"data-orientation":n,...u,ref:p,style:{outline:"none",...e.style},onMouseDown:Yc(e.onMouseDown,()=>{w.current=!0}),onFocus:Yc(e.onFocus,e=>{let t=!w.current;if(e.target===e.currentTarget&&t&&!v){let t=new CustomEvent(US,GS);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);sk([e.find(e=>e.active),e.find(e=>e.id===f),...e].filter(Boolean).map(e=>e.ref.current),d)}}w.current=!1}),onBlur:Yc(e.onBlur,()=>y(!1))})})},"RovingFocusGroupImpl")),nk=/* @__PURE__ */X.forwardRef(/* @__PURE__ */qS(function(e,t){let{__scopeRovingFocusGroup:r,focusable:n=!0,active:a=!1,tabStopId:o,children:i,...s}=e,l=ud(),c=o||l,d=ek("RovingFocusGroupItem",r),u=d.currentTabStopId===c,h=YS(r),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:f}=d,g=HS();return sd(()=>{if(g&&n)return p(),()=>m()},[g,n,p,m]),X.useEffect(()=>{if(!g&&n)return p(),()=>m()},[g,n,p,m]),/* @__PURE__ */be(KS.ItemSlot,{scope:r,id:c,focusable:n,active:a,children:/* @__PURE__ */be(Vd.span,{tabIndex:u?0:-1,"data-orientation":d.orientation,...s,ref:t,onMouseDown:Yc(e.onMouseDown,e=>{n?d.onItemFocus(c):e.preventDefault()}),onFocus:Yc(e.onFocus,()=>d.onItemFocus(c)),onKeyDown:Yc(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void d.onItemShiftTab();if(e.target!==e.currentTarget)return;let t=ik(e,d.orientation,d.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let r=h().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)r.reverse();else if("prev"===t||"next"===t){"prev"===t&&r.reverse();let n=r.indexOf(e.currentTarget);r=d.loop?lk(r,n+1):r.slice(n+1)}setTimeout(()=>sk(r))}}),children:"function"==typeof i?i({isCurrentTabStop:u,hasTabStop:null!=f}):i})})},"RovingFocusGroupItem")),ak={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function ok(e,t){return"rtl"===t?"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e:e}function ik(e,t,r){let n=ok(e.key,r);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(n)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(n)))return ak[n]}function sk(e,t=!1){let r=document.activeElement;for(let n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function lk(e,t){return e.map((r,n)=>e[(t+n)%e.length])}qS(ok,"getDirectionAwareKey"),qS(ik,"getFocusIntent"),qS(sk,"focusFirst"),qS(lk,"wrapArray");var ck=tk,dk=nk,uk=Object.defineProperty,hk=(e,t)=>uk(e,"name",{value:t,configurable:!0}),pk=["Enter"," "],mk=["ArrowUp","PageDown","End"],fk=["ArrowDown","PageUp","Home",...mk],gk={ltr:[...pk,"ArrowRight"],rtl:[...pk,"ArrowLeft"]},vk={ltr:["ArrowLeft"],rtl:["ArrowRight"]},yk="Menu",[bk,xk,wk]=/* @__PURE__ */SS(yk),[Sk,kk]=/* @__PURE__ */od(yk,[wk,$w,JS]),Ck=$w(),Nk=JS(),[Tk,Ak]=Sk(yk),[Mk,Dk]=Sk(yk),Ek=/* @__PURE__ */hk(e=>{let{__scopeMenu:t,open:r=!1,children:n,dir:a,onOpenChange:o,modal:i=!0}=e,s=Ck(t),[l,c]=X.useState(null),d=X.useRef(!1),u=jd(o),h=_S(a);return X.useEffect(()=>{let e=/* @__PURE__ */hk(()=>{d.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},"handleKeyDown"),t=/* @__PURE__ */hk(()=>d.current=!1,"handlePointer");return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}},[]),X.useEffect(()=>{if(!r)return;let e=/* @__PURE__ */hk(()=>u(!1),"handleBlur");return window.addEventListener("blur",e),()=>window.removeEventListener("blur",e)},[r,u]),/* @__PURE__ */be(Qw,{...s,children:/* @__PURE__ */be(Tk,{scope:t,open:r,onOpenChange:u,content:l,onContentChange:c,children:/* @__PURE__ */be(Mk,{scope:t,onClose:X.useCallback(()=>u(!1),[u]),isUsingKeyboardRef:d,dir:h,modal:i,children:n})})})},"Menu"),Ik=/* @__PURE__ */X.forwardRef(/* @__PURE__ */hk(function(e,t){let{__scopeMenu:r,...n}=e,a=Ck(r);/* @__PURE__ */
142
- return be(eS,{...a,...n,ref:t})},"MenuAnchor")),Rk="MenuPortal",[zk,_k]=Sk(Rk,{forceMount:void 0}),Pk=/* @__PURE__ */hk(e=>{let{__scopeMenu:t,forceMount:r,children:n,container:a}=e,o=Ak(Rk,t);/* @__PURE__ */
143
- return be(zk,{scope:t,forceMount:r,children:/* @__PURE__ */be(Cu,{present:r||o.open,children:/* @__PURE__ */be(xu,{asChild:!0,container:a,children:n})})})},"MenuPortal"),Ok="MenuContent",[Lk,Fk]=Sk(Ok),Bk=/* @__PURE__ */X.forwardRef(/* @__PURE__ */hk(function(e,t){let r=_k(Ok,e.__scopeMenu),{forceMount:n=r.forceMount,...a}=e,o=Ak(Ok,e.__scopeMenu),i=Dk(Ok,e.__scopeMenu);/* @__PURE__ */
144
- return be(bk.Provider,{scope:e.__scopeMenu,children:/* @__PURE__ */be(Cu,{present:n||o.open,children:/* @__PURE__ */be(bk.Slot,{scope:e.__scopeMenu,children:i.modal?/* @__PURE__ */be(Vk,{...a,ref:t}):/* @__PURE__ */be($k,{...a,ref:t})})})})},"MenuContent")),Vk=/* @__PURE__ */X.forwardRef(/* @__PURE__ */hk(function(e,t){let r=Ak(Ok,e.__scopeMenu),n=X.useRef(null),a=rd(t,n);return X.useEffect(()=>{let e=n.current;if(e)return Mh(e)},[]),/* @__PURE__ */be(jk,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Yc(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentModal")),$k=/* @__PURE__ */X.forwardRef(/* @__PURE__ */hk(function(e,t){let r=Ak(Ok,e.__scopeMenu);/* @__PURE__ */
145
- return be(jk,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentNonModal")),Hk=/* @__PURE__ */Nd("MenuContent.ScrollLock"),jk=/* @__PURE__ */X.forwardRef(/* @__PURE__ */hk(function(e,t){let{__scopeMenu:r,loop:n=!1,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:u,onInteractOutside:h,onDismiss:p,disableOutsideScroll:m,...f}=e,g=Ak(Ok,r),v=Dk(Ok,r),y=Ck(r),b=Nk(r),x=xk(r),[w,S]=X.useState(null),k=X.useRef(null),C=rd(t,k,g.onContentChange),N=X.useRef(0),T=X.useRef(""),A=X.useRef(0),M=X.useRef(null),D=X.useRef("right"),E=X.useRef(0),I=m?wh:X.Fragment,R=m?{as:Hk,allowPinchZoom:!0}:void 0,z=/* @__PURE__ */hk(e=>{let t=T.current+e,r=x().filter(e=>!e.disabled),n=document.activeElement,a=r.find(e=>e.ref.current===n)?.textValue,o=gC(r.map(e=>e.textValue),t,a),i=r.find(e=>e.textValue===o)?.ref.current;
146
- /* @__PURE__ */hk(function e(t){T.current=t,window.clearTimeout(N.current),""!==t&&(N.current=window.setTimeout(()=>e(""),1e3))},"updateSearch")(t),i&&setTimeout(()=>i.focus())},"handleTypeaheadSearch");X.useEffect(()=>()=>window.clearTimeout(N.current),[]),_u();let _=X.useCallback(e=>D.current===M.current?.side&&yC(e,M.current?.area),[]);/* @__PURE__ */
147
- return be(Lk,{scope:r,searchRef:T,onItemEnter:X.useCallback(e=>{_(e)&&e.preventDefault()},[_]),onItemLeave:X.useCallback(e=>{_(e)||(k.current?.focus(),S(null))},[_]),onTriggerLeave:X.useCallback(e=>{_(e)&&e.preventDefault()},[_]),pointerGraceTimerRef:A,onPointerGraceIntentChange:X.useCallback(e=>{M.current=e},[]),children:/* @__PURE__ */be(I,{...R,children:/* @__PURE__ */be(su,{asChild:!0,trapped:a,onMountAutoFocus:Yc(o,e=>{e.preventDefault(),k.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:/* @__PURE__ */be(Yd,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:u,onInteractOutside:h,onDismiss:p,children:/* @__PURE__ */be(ck,{asChild:!0,...b,dir:v.dir,orientation:"vertical",loop:n,currentTabStopId:w,onCurrentTabStopIdChange:S,onEntryFocus:Yc(l,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:/* @__PURE__ */be(tS,{role:"menu","aria-orientation":"vertical","data-state":uC(g.open),"data-radix-menu-content":"",dir:v.dir,...y,...f,ref:C,style:{outline:"none",...f.style},onKeyDown:Yc(f.onKeyDown,e=>{let t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,r=e.ctrlKey||e.altKey||e.metaKey,n=1===e.key.length;t&&("Tab"===e.key&&e.preventDefault(),!r&&n&&z(e.key));let a=k.current;if(e.target!==a||!fk.includes(e.key))return;e.preventDefault();let o=x().filter(e=>!e.disabled).map(e=>e.ref.current);mk.includes(e.key)&&o.reverse(),mC(o)}),onBlur:Yc(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(N.current),T.current="")}),onPointerMove:Yc(e.onPointerMove,bC(e=>{let t=e.target,r=E.current!==e.clientX;if(e.currentTarget.contains(t)&&r){let t=e.clientX>E.current?"right":"left";D.current=t,E.current=e.clientX}}))})})})})})})},"MenuContentImpl")),qk=/* @__PURE__ */X.forwardRef(/* @__PURE__ */hk(function(e,t){let{__scopeMenu:r,...n}=e;/* @__PURE__ */
148
- return be(Vd.div,{...n,ref:t})},"MenuLabel")),Uk="MenuItem",Gk="menu.itemSelect",Wk=/* @__PURE__ */X.forwardRef(/* @__PURE__ */hk(function(e,t){let{disabled:r=!1,onSelect:n,...a}=e,o=X.useRef(null),i=Dk(Uk,e.__scopeMenu),s=Fk(Uk,e.__scopeMenu),l=rd(t,o),c=X.useRef(!1),d=/* @__PURE__ */hk(()=>{let e=o.current;if(!r&&e){let t=new CustomEvent(Gk,{bubbles:!0,cancelable:!0});e.addEventListener(Gk,e=>n?.(e),{once:!0}),$d(e,t),t.defaultPrevented?c.current=!1:i.onClose()}},"handleSelect");/* @__PURE__ */
149
- return be(Kk,{...a,ref:l,disabled:r,onClick:Yc(e.onClick,d),onPointerDown:t=>{e.onPointerDown?.(t),c.current=!0},onPointerUp:Yc(e.onPointerUp,e=>{c.current||e.currentTarget?.click()}),onKeyDown:Yc(e.onKeyDown,e=>{r||e.target!==e.currentTarget||(""===s.searchRef.current||" "!==e.key)&&pk.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},"MenuItem")),Kk=/* @__PURE__ */X.forwardRef(/* @__PURE__ */hk(function(e,t){let{__scopeMenu:r,disabled:n=!1,textValue:a,...o}=e,i=Fk(Uk,r),s=Nk(r),l=X.useRef(null),c=rd(t,l),[d,u]=X.useState(!1),[h,p]=X.useState("");return X.useEffect(()=>{let e=l.current;e&&p((e.textContent??"").trim())},[o.children]),/* @__PURE__ */be(bk.ItemSlot,{scope:r,disabled:n,textValue:a??h,children:/* @__PURE__ */be(dk,{asChild:!0,...s,focusable:!n,children:/* @__PURE__ */be(Vd.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...o,ref:c,onPointerMove:Yc(e.onPointerMove,bC(e=>{n?i.onItemLeave(e):(i.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Yc(e.onPointerLeave,bC(e=>i.onItemLeave(e))),onFocus:Yc(e.onFocus,()=>u(!0)),onBlur:Yc(e.onBlur,()=>u(!1))})})})},"MenuItemImpl")),Yk=/* @__PURE__ */X.forwardRef(/* @__PURE__ */hk(function(e,t){let{checked:r=!1,onCheckedChange:n,...a}=e;/* @__PURE__ */
150
- return be(eC,{scope:e.__scopeMenu,checked:r,children:/* @__PURE__ */be(Wk,{role:"menuitemcheckbox","aria-checked":hC(r)?"mixed":r,...a,ref:t,"data-state":pC(r),onSelect:Yc(a.onSelect,()=>n?.(!!hC(r)||!r),{checkForDefaultPrevented:!1})})})},"MenuCheckboxItem")),[Xk,Zk]=Sk("MenuRadioGroup",{value:void 0,onValueChange:/* @__PURE__ */hk(()=>{},"onValueChange")}),Jk=/* @__PURE__ */X.forwardRef(/* @__PURE__ */hk(function(e,t){let{value:r,...n}=e,a=Zk("MenuRadioItem",e.__scopeMenu),o=r===a.value;/* @__PURE__ */
151
- return be(eC,{scope:e.__scopeMenu,checked:o,children:/* @__PURE__ */be(Wk,{role:"menuitemradio","aria-checked":o,...n,ref:t,"data-state":pC(o),onSelect:Yc(n.onSelect,()=>a.onValueChange?.(r),{checkForDefaultPrevented:!1})})})},"MenuRadioItem")),Qk="MenuItemIndicator",[eC,tC]=Sk(Qk,{checked:!1}),rC=/* @__PURE__ */X.forwardRef(/* @__PURE__ */hk(function(e,t){let{__scopeMenu:r,forceMount:n,...a}=e,o=tC(Qk,r);/* @__PURE__ */
152
- return be(Cu,{present:n||hC(o.checked)||!0===o.checked,children:/* @__PURE__ */be(Vd.span,{...a,ref:t,"data-state":pC(o.checked)})})},"MenuItemIndicator")),nC=/* @__PURE__ */X.forwardRef(/* @__PURE__ */hk(function(e,t){let{__scopeMenu:r,...n}=e;/* @__PURE__ */
153
- return be(Vd.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})},"MenuSeparator")),aC="MenuSub",[oC,iC]=Sk(aC),sC=/* @__PURE__ */hk(e=>{let{__scopeMenu:t,children:r,open:n=!1,onOpenChange:a}=e,o=Ak(aC,t),i=Ck(t),[s,l]=X.useState(null),[c,d]=X.useState(null),u=jd(a);return X.useEffect(()=>(!1===o.open&&u(!1),()=>u(!1)),[o.open,u]),/* @__PURE__ */be(Qw,{...i,children:/* @__PURE__ */be(Tk,{scope:t,open:n,onOpenChange:u,content:c,onContentChange:d,children:/* @__PURE__ */be(oC,{scope:t,contentId:ud(),triggerId:ud(),trigger:s,onTriggerChange:l,children:r})})})},"MenuSub"),lC="MenuSubTrigger",cC=/* @__PURE__ */X.forwardRef(/* @__PURE__ */hk(function(e,t){let r=Ak(lC,e.__scopeMenu),n=Dk(lC,e.__scopeMenu),a=iC(lC,e.__scopeMenu),o=Fk(lC,e.__scopeMenu),i=X.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:l}=o,c={__scopeMenu:e.__scopeMenu},d=X.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);X.useEffect(()=>d,[d]),X.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),l(null)}},[s,l]);let u=rd(t,a.onTriggerChange);/* @__PURE__ */
154
- return be(Ik,{asChild:!0,...c,children:/* @__PURE__ */be(Kk,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?a.contentId:void 0,"data-state":uC(r.open),...e,ref:u,onClick:t=>{e.onClick?.(t),!e.disabled&&!t.defaultPrevented&&(t.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:Yc(e.onPointerMove,bC(t=>{o.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!r.open&&!i.current&&(o.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{r.onOpenChange(!0),d()},100))})),onPointerLeave:Yc(e.onPointerLeave,bC(e=>{d();let t=r.content?.getBoundingClientRect();if(t){let n=r.content?.dataset.side,a="right"===n,i=a?-5:5,l=t[a?"left":"right"],c=t[a?"right":"left"];o.onPointerGraceIntentChange({area:[{x:e.clientX+i,y:e.clientY},{x:l,y:t.top},{x:c,y:t.top},{x:c,y:t.bottom},{x:l,y:t.bottom}],side:n}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(e),e.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:Yc(e.onKeyDown,t=>{e.disabled||t.target!==t.currentTarget||(""===o.searchRef.current||" "!==t.key)&&gk[n.dir].includes(t.key)&&(r.onOpenChange(!0),r.content?.focus(),t.preventDefault())})})})},"MenuSubTrigger")),dC=/* @__PURE__ */X.forwardRef(/* @__PURE__ */hk(function(e,t){let r=_k(Ok,e.__scopeMenu),{forceMount:n=r.forceMount,align:a="start",...o}=e,i=Ak(Ok,e.__scopeMenu),s=Dk(Ok,e.__scopeMenu),l=iC("MenuSubContent",e.__scopeMenu),c=X.useRef(null),d=rd(t,c);/* @__PURE__ */
155
- return be(bk.Provider,{scope:e.__scopeMenu,children:/* @__PURE__ */be(Cu,{present:n||i.open,children:/* @__PURE__ */be(bk.Slot,{scope:e.__scopeMenu,children:/* @__PURE__ */be(jk,{id:l.contentId,"aria-labelledby":l.triggerId,...o,ref:d,align:a,side:"rtl"===s.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{s.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:Yc(e.onFocusOutside,e=>{e.target!==l.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Yc(e.onEscapeKeyDown,e=>{s.onClose(),e.preventDefault()}),onKeyDown:Yc(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),r=vk[s.dir].includes(e.key);t&&r&&(i.onOpenChange(!1),l.trigger?.focus(),e.preventDefault())})})})})})},"MenuSubContent"));function uC(e){return e?"open":"closed"}function hC(e){return"indeterminate"===e}function pC(e){return hC(e)?"indeterminate":e?"checked":"unchecked"}function mC(e){let t=document.activeElement;for(let r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function fC(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function gC(e,t,r){let n=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,a=r?e.indexOf(r):-1,o=fC(e,Math.max(a,0));1===n.length&&(o=o.filter(e=>e!==r));let i=o.find(e=>e.toLowerCase().startsWith(n.toLowerCase()));return i===r?void 0:i}function vC(e,t){let{x:r,y:n}=e,a=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){let e=t[o],s=t[i],l=e.x,c=e.y,d=s.x,u=s.y;c>n!=u>n&&r<(d-l)*(n-c)/(u-c)+l&&(a=!a)}return a}function yC(e,t){return!!t&&vC({x:e.clientX,y:e.clientY},t)}function bC(e){return t=>"mouse"===t.pointerType?e(t):void 0}hk(uC,"getOpenState"),hk(hC,"isIndeterminate"),hk(pC,"getCheckedState"),hk(mC,"focusFirst"),hk(fC,"wrapArray"),hk(gC,"getNextMatch"),hk(vC,"isPointInPolygon"),hk(yC,"isPointerInGraceArea"),hk(bC,"whenMouse");var xC=Ek,wC=Ik,SC=Pk,kC=Bk,CC=qk,NC=Wk,TC=Yk,AC=Jk,MC=rC,DC=nC,EC=sC,IC=cC,RC=dC,zC=(Object.defineProperty,"DropdownMenu"),[_C,PC]=/* @__PURE__ */od(zC,[kk]),[OC,LC]=(kk(),_C(zC)),FC=/* @__PURE__ */Vc(e=>{var t="function"==typeof Symbol&&Symbol.for,r=t?Symbol.for("react.element"):60103,n=t?Symbol.for("react.portal"):60106,a=t?Symbol.for("react.fragment"):60107,o=t?Symbol.for("react.strict_mode"):60108,i=t?Symbol.for("react.profiler"):60114,s=t?Symbol.for("react.provider"):60109,l=t?Symbol.for("react.context"):60110,c=t?Symbol.for("react.async_mode"):60111,d=t?Symbol.for("react.concurrent_mode"):60111,u=t?Symbol.for("react.forward_ref"):60112,h=t?Symbol.for("react.suspense"):60113,p=t?Symbol.for("react.suspense_list"):60120,m=t?Symbol.for("react.memo"):60115,f=t?Symbol.for("react.lazy"):60116,g=t?Symbol.for("react.block"):60121,v=t?Symbol.for("react.fundamental"):60117,y=t?Symbol.for("react.responder"):60118,b=t?Symbol.for("react.scope"):60119;function x(e){if("object"==typeof e&&e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case c:case d:case a:case i:case o:case h:return e;default:switch(e&&=e.$$typeof,e){case l:case u:case f:case m:case s:return e;default:return t}}case n:return t}}}function w(e){return x(e)===d}e.AsyncMode=c,e.ConcurrentMode=d,e.ContextConsumer=l,e.ContextProvider=s,e.Element=r,e.ForwardRef=u,e.Fragment=a,e.Lazy=f,e.Memo=m,e.Portal=n,e.Profiler=i,e.StrictMode=o,e.Suspense=h,e.isAsyncMode=function(e){return w(e)||x(e)===c},e.isConcurrentMode=w,e.isContextConsumer=function(e){return x(e)===l},e.isContextProvider=function(e){return x(e)===s},e.isElement=function(e){return"object"==typeof e&&!!e&&e.$$typeof===r},e.isForwardRef=function(e){return x(e)===u},e.isFragment=function(e){return x(e)===a},e.isLazy=function(e){return x(e)===f},e.isMemo=function(e){return x(e)===m},e.isPortal=function(e){return x(e)===n},e.isProfiler=function(e){return x(e)===i},e.isStrictMode=function(e){return x(e)===o},e.isSuspense=function(e){return x(e)===h},e.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===d||e===i||e===o||e===h||e===p||"object"==typeof e&&!!e&&(e.$$typeof===f||e.$$typeof===m||e.$$typeof===s||e.$$typeof===l||e.$$typeof===u||e.$$typeof===v||e.$$typeof===y||e.$$typeof===b||e.$$typeof===g)},e.typeOf=x}),BC=/* @__PURE__ */Vc(e=>{"production"!==process.env.NODE_ENV&&function(){var t="function"==typeof Symbol&&Symbol.for,r=t?Symbol.for("react.element"):60103,n=t?Symbol.for("react.portal"):60106,a=t?Symbol.for("react.fragment"):60107,o=t?Symbol.for("react.strict_mode"):60108,i=t?Symbol.for("react.profiler"):60114,s=t?Symbol.for("react.provider"):60109,l=t?Symbol.for("react.context"):60110,c=t?Symbol.for("react.async_mode"):60111,d=t?Symbol.for("react.concurrent_mode"):60111,u=t?Symbol.for("react.forward_ref"):60112,h=t?Symbol.for("react.suspense"):60113,p=t?Symbol.for("react.suspense_list"):60120,m=t?Symbol.for("react.memo"):60115,f=t?Symbol.for("react.lazy"):60116,g=t?Symbol.for("react.block"):60121,v=t?Symbol.for("react.fundamental"):60117,y=t?Symbol.for("react.responder"):60118,b=t?Symbol.for("react.scope"):60119;function x(e){if("object"==typeof e&&e){var t=e.$$typeof;switch(t){case r:var p=e.type;switch(p){case c:case d:case a:case i:case o:case h:return p;default:var g=p&&p.$$typeof;switch(g){case l:case u:case f:case m:case s:return g;default:return t}}case n:return t}}}var w=c,S=d,k=l,C=s,N=r,T=u,A=a,M=f,D=m,E=n,I=i,R=o,z=h,_=!1;function P(e){return x(e)===d}e.AsyncMode=w,e.ConcurrentMode=S,e.ContextConsumer=k,e.ContextProvider=C,e.Element=N,e.ForwardRef=T,e.Fragment=A,e.Lazy=M,e.Memo=D,e.Portal=E,e.Profiler=I,e.StrictMode=R,e.Suspense=z,e.isAsyncMode=function(e){return _||(_=!0),P(e)||x(e)===c},e.isConcurrentMode=P,e.isContextConsumer=function(e){return x(e)===l},e.isContextProvider=function(e){return x(e)===s},e.isElement=function(e){return"object"==typeof e&&!!e&&e.$$typeof===r},e.isForwardRef=function(e){return x(e)===u},e.isFragment=function(e){return x(e)===a},e.isLazy=function(e){return x(e)===f},e.isMemo=function(e){return x(e)===m},e.isPortal=function(e){return x(e)===n},e.isProfiler=function(e){return x(e)===i},e.isStrictMode=function(e){return x(e)===o},e.isSuspense=function(e){return x(e)===h},e.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===d||e===i||e===o||e===h||e===p||"object"==typeof e&&!!e&&(e.$$typeof===f||e.$$typeof===m||e.$$typeof===s||e.$$typeof===l||e.$$typeof===u||e.$$typeof===v||e.$$typeof===y||e.$$typeof===b||e.$$typeof===g)},e.typeOf=x}()}),VC=/* @__PURE__ */Vc((e,t)=>{t.exports="production"===process.env.NODE_ENV?FC():BC()}),$C=/* @__PURE__ */Vc((e,t)=>{var r=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var e=/* @__PURE__ */new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(e){n[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch{return!1}}()?Object.assign:function(e,t){for(var o,i,s=function(e){if(null==e)throw TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),l=1;l<arguments.length;l++){for(var c in o=Object(arguments[l]))n.call(o,c)&&(s[c]=o[c]);if(r){i=r(o);for(var d=0;d<i.length;d++)a.call(o,i[d])&&(s[i[d]]=o[i[d]])}}return s}}),HC=/* @__PURE__ */Vc((e,t)=>{t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}),jC=/* @__PURE__ */Vc((e,t)=>{t.exports=Function.call.bind(Object.prototype.hasOwnProperty)}),qC=/* @__PURE__ */Vc((e,t)=>{var r=function(){};if("production"!==process.env.NODE_ENV){var n=HC(),a={},o=jC();r=function(e){var t="Warning: "+e;try{throw Error(t)}catch{}}}function i(e,t,i,s,l){if("production"!==process.env.NODE_ENV)for(var c in e)if(o(e,c)){var d;try{if("function"!=typeof e[c]){var u=Error((s||"React class")+": "+i+" type `"+c+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[c]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw u.name="Invariant Violation",u}d=e[c](t,c,s,i,null,n)}catch(e){d=e}if(d&&!(d instanceof Error)&&r((s||"React class")+": type specification of "+i+" `"+c+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof d+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),d instanceof Error&&!(d.message in a)){a[d.message]=!0;var h=l?l():"";r("Failed "+i+" type: "+d.message+(h??""))}}}i.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(a={})},t.exports=i}),UC=/* @__PURE__ */Vc((e,t)=>{var r=VC(),n=$C(),a=HC(),o=jC(),i=qC(),s=function(){};function l(){return null}"production"!==process.env.NODE_ENV&&(s=function(e){var t="Warning: "+e;try{throw Error(t)}catch{}}),t.exports=function(e,t){var c="function"==typeof Symbol&&Symbol.iterator;var d="<<anonymous>>",u={array:f("array"),bigint:f("bigint"),bool:f("boolean"),func:f("function"),number:f("number"),object:f("object"),string:f("string"),symbol:f("symbol"),any:m(l),arrayOf:function(e){return m(function(t,r,n,o,i){if("function"!=typeof e)return new p("Property `"+i+"` of component `"+n+"` has invalid PropType notation inside arrayOf.");var s=t[r];if(!Array.isArray(s))return new p("Invalid "+o+" `"+i+"` of type `"+y(s)+"` supplied to `"+n+"`, expected an array.");for(var l=0;l<s.length;l++){var c=e(s,l,n,o,i+"["+l+"]",a);if(c instanceof Error)return c}return null})},element:m(function(t,r,n,a,o){var i=t[r];return e(i)?null:new p("Invalid "+a+" `"+o+"` of type `"+y(i)+"` supplied to `"+n+"`, expected a single ReactElement.")}),elementType:m(function(e,t,n,a,o){var i=e[t];return r.isValidElementType(i)?null:new p("Invalid "+a+" `"+o+"` of type `"+y(i)+"` supplied to `"+n+"`, expected a single ReactElement type.")}),instanceOf:function(e){return m(function(t,r,n,a,o){if(!(t[r]instanceof e)){var i=e.name||d,s=function(e){return e.constructor&&e.constructor.name?e.constructor.name:d}(t[r]);return new p("Invalid "+a+" `"+o+"` of type `"+s+"` supplied to `"+n+"`, expected instance of `"+i+"`.")}return null})},node:m(function(e,t,r,n,a){return v(e[t])?null:new p("Invalid "+n+" `"+a+"` supplied to `"+r+"`, expected a ReactNode.")}),objectOf:function(e){return m(function(t,r,n,i,s){if("function"!=typeof e)return new p("Property `"+s+"` of component `"+n+"` has invalid PropType notation inside objectOf.");var l=t[r],c=y(l);if("object"!==c)return new p("Invalid "+i+" `"+s+"` of type `"+c+"` supplied to `"+n+"`, expected an object.");for(var d in l)if(o(l,d)){var u=e(l,d,n,i,s+"."+d,a);if(u instanceof Error)return u}return null})},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&s(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),l;return m(function(t,r,n,a,o){for(var i=t[r],s=0;s<e.length;s++)if(h(i,e[s]))return null;var l=JSON.stringify(e,function(e,t){return"symbol"===b(t)?String(t):t});return new p("Invalid "+a+" `"+o+"` of value `"+String(i)+"` supplied to `"+n+"`, expected one of "+l+".")})},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&s("Invalid argument supplied to oneOfType, expected an instance of array."),l;for(var t=0;t<e.length;t++){var r=e[t];if("function"!=typeof r)return s("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+x(r)+" at index "+t+"."),l}return m(function(t,r,n,i,s){for(var l=[],c=0;c<e.length;c++){var d=(0,e[c])(t,r,n,i,s,a);if(null==d)return null;d.data&&o(d.data,"expectedType")&&l.push(d.data.expectedType)}return new p("Invalid "+i+" `"+s+"` supplied to `"+n+"`"+(l.length>0?", expected one of type ["+l.join(", ")+"]":"")+".")})},shape:function(e){return m(function(t,r,n,o,i){var s=t[r],l=y(s);if("object"!==l)return new p("Invalid "+o+" `"+i+"` of type `"+l+"` supplied to `"+n+"`, expected `object`.");for(var c in e){var d=e[c];if("function"!=typeof d)return g(n,o,i,c,b(d));var u=d(s,c,n,o,i+"."+c,a);if(u)return u}return null})},exact:function(e){return m(function(t,r,i,s,l){var c=t[r],d=y(c);if("object"!==d)return new p("Invalid "+s+" `"+l+"` of type `"+d+"` supplied to `"+i+"`, expected `object`.");for(var u in n({},t[r],e)){var h=e[u];if(o(e,u)&&"function"!=typeof h)return g(i,s,l,u,b(h));if(!h)return new p("Invalid "+s+" `"+l+"` key `"+u+"` supplied to `"+i+"`.\nBad object: "+JSON.stringify(t[r],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var m=h(c,u,i,s,l+"."+u,a);if(m)return m}return null})}};function h(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function p(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function m(e){if("production"!==process.env.NODE_ENV)var r={},n=0;function o(o,i,l,c,u,h,m){if(c||=d,h||=l,m!==a){if(t){var f=/* @__PURE__ */Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}if("production"!==process.env.NODE_ENV&&typeof console<"u"){var g=c+":"+l;!r[g]&&n<3&&(s("You are manually calling a React.PropTypes validation function for the `"+h+"` prop on `"+c+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),r[g]=!0,n++)}}return null==i[l]?o?null===i[l]?new p("The "+u+" `"+h+"` is marked as required in `"+c+"`, but its value is `null`."):new p("The "+u+" `"+h+"` is marked as required in `"+c+"`, but its value is `undefined`."):null:e(i,l,c,u,h)}var i=o.bind(null,!1);return i.isRequired=o.bind(null,!0),i}function f(e){return m(function(t,r,n,a,o,i){var s=t[r];return y(s)!==e?new p("Invalid "+a+" `"+o+"` of type `"+b(s)+"` supplied to `"+n+"`, expected `"+e+"`.",{expectedType:e}):null})}function g(e,t,r,n,a){return new p((e||"React class")+": "+t+" type `"+r+"."+n+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+a+"`.")}function v(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(v);if(null===t||e(t))return!0;var r=function(e){var t=e&&(c&&e[c]||e["@@iterator"]);if("function"==typeof t)return t}(t);if(!r)return!1;var n,a=r.call(t);if(r!==t.entries){for(;!(n=a.next()).done;)if(!v(n.value))return!1}else for(;!(n=a.next()).done;){var o=n.value;if(o&&!v(o[1]))return!1}return!0;default:return!1}}function y(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function b(e){if(null==e)return""+e;var t=y(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function x(e){var t=b(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return p.prototype=Error.prototype,u.checkPropTypes=i,u.resetWarningCache=i.resetWarningCache,u.PropTypes=u,u}}),GC=/* @__PURE__ */Vc((e,t)=>{var r=HC();function n(){}function a(){}a.resetWarningCache=n,t.exports=function(){function e(e,t,n,a,o,i){if(i!==r){var s=/* @__PURE__ */Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var o={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:n};return o.PropTypes=o,o}}),WC=/* @__PURE__ */$c(/* @__PURE__ */Vc((e,t)=>{if("production"!==process.env.NODE_ENV){var r=VC();t.exports=UC()(r.isElement,!0)}else t.exports=GC()()})()),KC={grad:.9,turn:360,rad:360/(2*Math.PI)},YC=function(e){return"string"==typeof e?e.length>0:"number"==typeof e},XC=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=10**t),Math.round(r*e)/r+0},ZC=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=1),e>r?r:e>t?e:t},JC=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},QC=function(e){return{r:ZC(e.r,0,255),g:ZC(e.g,0,255),b:ZC(e.b,0,255),a:ZC(e.a)}},eN=function(e){return{r:XC(e.r),g:XC(e.g),b:XC(e.b),a:XC(e.a,3)}},tN=/^#([0-9a-f]{3,8})$/i,rN=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},nN=function(e){var t=e.r,r=e.g,n=e.b,a=e.a,o=Math.max(t,r,n),i=o-Math.min(t,r,n),s=i?o===t?(r-n)/i:o===r?2+(n-t)/i:4+(t-r)/i:0;return{h:60*(s<0?s+6:s),s:o?i/o*100:0,v:o/255*100,a:a}},aN=function(e){var t=e.h,r=e.s,n=e.v,a=e.a;t=t/360*6,r/=100,n/=100;var o=Math.floor(t),i=n*(1-r),s=n*(1-(t-o)*r),l=n*(1-(1-t+o)*r),c=o%6;return{r:255*[n,s,i,i,l,n][c],g:255*[l,n,n,s,i,i][c],b:255*[i,i,l,n,n,s][c],a:a}},oN=function(e){return{h:JC(e.h),s:ZC(e.s,0,100),l:ZC(e.l,0,100),a:ZC(e.a)}},iN=function(e){return{h:XC(e.h),s:XC(e.s),l:XC(e.l),a:XC(e.a,3)}},sN=function(e){return aN((r=(t=e).s,{h:t.h,s:(r*=((n=t.l)<50?n:100-n)/100)>0?2*r/(n+r)*100:0,v:n+r,a:t.a}));var t,r,n},lN=function(e){return{h:(t=nN(e)).h,s:(a=(200-(r=t.s))*(n=t.v)/100)>0&&a<200?r*n/100/(a<=100?a:200-a)*100:0,l:a/2,a:t.a};var t,r,n,a},cN=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,dN=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,uN=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,hN=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,pN={string:[[function(e){var t=tN.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?XC(parseInt(e[3]+e[3],16)/255,2):1}:6===e.length||8===e.length?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:8===e.length?XC(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=uN.exec(e)||hN.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:QC({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t,r,n=cN.exec(e)||dN.exec(e);return n?sN(oN({h:(t=n[1],r=n[2],void 0===r&&(r="deg"),Number(t)*(KC[r]||1)),s:Number(n[3]),l:Number(n[4]),a:void 0===n[5]?1:Number(n[5])/(n[6]?100:1)})):null},"hsl"]],object:[[function(e){var t=e.r,r=e.g,n=e.b,a=e.a,o=void 0===a?1:a;return YC(t)&&YC(r)&&YC(n)?QC({r:Number(t),g:Number(r),b:Number(n),a:Number(o)}):null},"rgb"],[function(e){var t=e.h,r=e.s,n=e.l,a=e.a,o=void 0===a?1:a;return YC(t)&&YC(r)&&YC(n)?sN(oN({h:Number(t),s:Number(r),l:Number(n),a:Number(o)})):null},"hsl"],[function(e){var t=e.h,r=e.s,n=e.v,a=e.a,o=void 0===a?1:a;return YC(t)&&YC(r)&&YC(n)?aN(function(e){return{h:JC(e.h),s:ZC(e.s,0,100),v:ZC(e.v,0,100),a:ZC(e.a)}}({h:Number(t),s:Number(r),v:Number(n),a:Number(o)})):null},"hsv"]]},mN=function(e,t){for(var r=0;r<t.length;r++){var n=t[r][0](e);if(n)return[n,t[r][1]]}return[null,void 0]},fN=function(e,t){var r=lN(e);return{h:r.h,s:ZC(r.s+100*t,0,100),l:r.l,a:r.a}},gN=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},vN=function(e,t){var r=lN(e);return{h:r.h,s:r.s,l:ZC(r.l+100*t,0,100),a:r.a}},yN=function(){function e(e){this.parsed=function(e){return"string"==typeof e?mN(e.trim(),pN.string):"object"==typeof e&&e?mN(e,pN.object):[null,void 0]}(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return null!==this.parsed},e.prototype.brightness=function(){return XC(gN(this.rgba),2)},e.prototype.isDark=function(){return gN(this.rgba)<.5},e.prototype.isLight=function(){return gN(this.rgba)>=.5},e.prototype.toHex=function(){return t=(e=eN(this.rgba)).r,r=e.g,n=e.b,o=(a=e.a)<1?rN(XC(255*a)):"","#"+rN(t)+rN(r)+rN(n)+o;var e,t,r,n,a,o},e.prototype.toRgb=function(){return eN(this.rgba)},e.prototype.toRgbString=function(){return t=(e=eN(this.rgba)).r,r=e.g,n=e.b,(a=e.a)<1?"rgba("+t+", "+r+", "+n+", "+a+")":"rgb("+t+", "+r+", "+n+")";var e,t,r,n,a},e.prototype.toHsl=function(){return iN(lN(this.rgba))},e.prototype.toHslString=function(){return t=(e=iN(lN(this.rgba))).h,r=e.s,n=e.l,(a=e.a)<1?"hsla("+t+", "+r+"%, "+n+"%, "+a+")":"hsl("+t+", "+r+"%, "+n+"%)";var e,t,r,n,a},e.prototype.toHsv=function(){return e=nN(this.rgba),{h:XC(e.h),s:XC(e.s),v:XC(e.v),a:XC(e.a,3)};var e},e.prototype.invert=function(){return bN({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},e.prototype.saturate=function(e){return void 0===e&&(e=.1),bN(fN(this.rgba,e))},e.prototype.desaturate=function(e){return void 0===e&&(e=.1),bN(fN(this.rgba,-e))},e.prototype.grayscale=function(){return bN(fN(this.rgba,-1))},e.prototype.lighten=function(e){return void 0===e&&(e=.1),bN(vN(this.rgba,e))},e.prototype.darken=function(e){return void 0===e&&(e=.1),bN(vN(this.rgba,-e))},e.prototype.rotate=function(e){return void 0===e&&(e=15),this.hue(this.hue()+e)},e.prototype.alpha=function(e){return"number"==typeof e?bN({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):XC(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=lN(this.rgba);return"number"==typeof e?bN({h:e,s:t.s,l:t.l,a:t.a}):XC(t.h)},e.prototype.isEqual=function(e){return this.toHex()===bN(e).toHex()},e}(),bN=function(e){return e instanceof yN?e:new yN(e)},xN=[];var wN={"3d":/*#__PURE__*/Z.createElement("path",{d:"M18 14.625V3.375L9 0 0 3.375v11.25L9 18l9-3.375zM9 2.136l5.918 2.22-5.98 2.242-5.919-2.22L9 2.137zM2 13.239V5.065l6.438 2.414v8.174L2 13.24zM9.438 15.7L16 13.239V5.018l-6.563 2.46V15.7z",transform:"translate(15 10)",fillRule:"evenodd"}),acrobat:/*#__PURE__*/Z.createElement("path",{d:"M10.15 1.095C9.938.33 9.42-.051 8.984.005c-.528.068-1.09.382-1.314.876-.63 1.416.685 5.582.887 6.279-1.28 3.863-5.66 11.5-7.806 12.017-.045-.505.225-1.965 3.055-3.785.146-.157.315-.348.393-.472-2.392 1.168-5.492 3.044-3.628 4.448.102.079.259.146.439.213 1.426.528 3.425-1.201 5.435-5.121 2.213-.73 3.999-1.28 6.526-1.662 2.762 1.875 4.616 2.257 5.874 1.774.348-.135.898-.573 1.055-1.145-1.022 1.258-3.414.382-5.323-.82 1.763-.191 3.582-.303 4.369-.056 1 .314.965.808.954.876.079-.27.191-.708-.022-1.056-.842-1.37-4.706-.573-6.11-.427-2.212-1.336-3.74-3.717-4.358-5.436.573-2.212 1.19-3.818.742-5.413zm-.954 4.638C8.826 4.42 8.309 1.5 9.14.556c1.628.932.618 3.144.056 5.177zm3.044 6.514c-2.134.393-3.583.944-5.66 1.764.617-1.202 1.785-4.268 2.346-6.29.787 1.573 1.741 3.111 3.314 4.526z",transform:"translate(14 9)",fillRule:"evenodd"}),android:/*#__PURE__*/Z.createElement("path",{d:"M17.6,9.48l1.84-3.18c0.16-0.31,0.04-0.69-0.26-0.85c-0.29-0.15-0.65-0.06-0.83,0.22l-1.88,3.24 c-2.86-1.21-6.08-1.21-8.94,0L5.65,5.67c-0.19-0.29-0.58-0.38-0.87-0.2C4.5,5.65,4.41,6.01,4.56,6.3L6.4,9.48 C3.3,11.25,1.28,14.44,1,18h22C22.72,14.44,20.7,11.25,17.6,9.48z M7,15.25c-0.69,0-1.25-0.56-1.25-1.25 c0-0.69,0.56-1.25,1.25-1.25S8.25,13.31,8.25,14C8.25,14.69,7.69,15.25,7,15.25z M17,15.25c-0.69,0-1.25-0.56-1.25-1.25 c0-0.69,0.56-1.25,1.25-1.25s1.25,0.56,1.25,1.25C18.25,14.69,17.69,15.25,17,15.25z",transform:"translate(12 8)"}),audio:/*#__PURE__*/Z.createElement("path",{d:"M.25 4.75v4.5h3L7 13V1L3.25 4.75h-3zM10.375 7A3.375 3.375 0 0 0 8.5 3.977v6.037A3.355 3.355 0 0 0 10.375 7zM8.5.421v1.545A5.254 5.254 0 0 1 12.25 7a5.254 5.254 0 0 1-3.75 5.032v1.545A6.747 6.747 0 0 0 13.75 7 6.747 6.747 0 0 0 8.5.421z",transform:"translate(17 12)",fillRule:"evenodd"}),binary:/*#__PURE__*/Z.createElement("path",{d:"M2.338 6.112c1.192 0 1.928-1.072 1.928-2.68 0-1.56-.576-2.504-1.8-2.504C1.274.928.538 2 .538 3.608c0 1.56.576 2.504 1.8 2.504zM1.61 3.408c0-1.008.24-1.568.776-1.568.376 0 .616.336.728.888l-1.504.776v-.096zM2.418 5.2c-.368 0-.608-.32-.72-.856l1.496-.768v.056c0 1.008-.24 1.568-.776 1.568zm7.03.8l.088-.944H8.36V.896L7.272.984v.592l-1.184.112.024.824h1.16v2.544h-1.32V6zm5.199 0l.088-.944h-1.176V.896L12.47.984v.592l-1.184.112.024.824h1.16v2.544h-1.32V6zM4.25 14l.088-.944H3.162v-4.16l-1.088.088v.592L.89 9.688l.024.824h1.16v2.544H.754V14zm5.198 0l.088-.944H8.36v-4.16l-1.088.088v.592l-1.184.112.024.824h1.16v2.544h-1.32V14zm3.287.112c1.192 0 1.928-1.072 1.928-2.68 0-1.56-.576-2.504-1.8-2.504-1.192 0-1.928 1.072-1.928 2.68 0 1.56.576 2.504 1.8 2.504zm-.728-2.704c0-1.008.24-1.568.776-1.568.376 0 .616.336.728.888l-1.504.776v-.096zm.808 1.792c-.368 0-.608-.32-.72-.856l1.496-.768v.056c0 1.008-.24 1.568-.776 1.568z",transform:"translate(16 11)",fillRule:"evenodd"}),code:/*#__PURE__*/Z.createElement("path",{d:"M4.078 13.67c-1.875-.527-2.812-1.738-2.812-3.634V9.49C1.266 8.437.844 7.911 0 7.911V6.138c.844 0 1.266-.529 1.266-1.586v-.64c.015-.938.257-1.696.726-2.274C2.466 1.06 3.162.64 4.078.38l.492 1.375c-.656.25-.997.95-1.023 2.102v.695c0 1.167-.482 1.99-1.445 2.469.963.479 1.445 1.304 1.445 2.476v.688c.026 1.15.367 1.851 1.023 2.101l-.492 1.383zm7.844 0c1.875-.527 2.812-1.738 2.812-3.634V9.49c0-1.052.422-1.578 1.266-1.578V6.138c-.844 0-1.266-.529-1.266-1.586v-.64c-.015-.938-.257-1.696-.726-2.274-.474-.578-1.17-.998-2.086-1.258l-.492 1.375c.656.25.997.95 1.023 2.102v.695c0 1.167.482 1.99 1.445 2.469-.963.479-1.445 1.304-1.445 2.476v.688c-.026 1.15-.367 1.851-1.023 2.101l.492 1.383z",transform:"translate(16 13)",fillRule:"evenodd"}),code2:/*#__PURE__*/Z.createElement("path",{d:"M7.4 10.6L2.8 6l4.6-4.6L6 0 0 6l6 6 1.4-1.4zm5.2 0L17.2 6l-4.6-4.6L14 0l6 6-6 6-1.4-1.4z",transform:"translate(14 14)",fillRule:"evenodd"}),compressed:/*#__PURE__*/Z.createElement("path",{d:"M.25 0A.25.25 0 0 0 0 .25v1.5c0 .138.112.25.25.25h1.5A.25.25 0 0 0 2 1.75V.25A.25.25 0 0 0 1.75 0H.25zM1 17a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-6a1 1 0 0 0-1-1H1zm0 4v3h2v-3H1zM2 2.25A.25.25 0 0 1 2.25 2h1.5a.25.25 0 0 1 .25.25v1.5a.25.25 0 0 1-.25.25h-1.5A.25.25 0 0 1 2 3.75v-1.5zM.25 4a.25.25 0 0 0-.25.25v1.5c0 .138.112.25.25.25h1.5A.25.25 0 0 0 2 5.75v-1.5A.25.25 0 0 0 1.75 4H.25zM2 6.25A.25.25 0 0 1 2.25 6h1.5a.25.25 0 0 1 .25.25v1.5a.25.25 0 0 1-.25.25h-1.5A.25.25 0 0 1 2 7.75v-1.5zM.25 8a.25.25 0 0 0-.25.25v1.5c0 .138.112.25.25.25h1.5A.25.25 0 0 0 2 9.75v-1.5A.25.25 0 0 0 1.75 8H.25zM2 10.25a.25.25 0 0 1 .25-.25h1.5a.25.25 0 0 1 .25.25v1.5a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25v-1.5zM.25 12a.25.25 0 0 0-.25.25v1.5c0 .138.112.25.25.25h1.5a.25.25 0 0 0 .25-.25v-1.5a.25.25 0 0 0-.25-.25H.25zM2 14.25a.25.25 0 0 1 .25-.25h1.5a.25.25 0 0 1 .25.25v1.5a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25v-1.5z",transform:"translate(15 1)",fillRule:"evenodd"}),document:/*#__PURE__*/Z.createElement("path",{d:"M12 4H0v2h12V4zM0 10h18V8H0v2zM0 0v2h18V0H0z",transform:"translate(15 15)",fillRule:"evenodd"}),drive:/*#__PURE__*/Z.createElement("path",{d:"M2.199.289A.5.5 0 0 1 2.652 0h8.696a.5.5 0 0 1 .453.289l1.867 4a.5.5 0 0 1-.453.711H.785a.5.5 0 0 1-.453-.711l1.867-4zM13 6H1a.752.752 0 0 0-.75.75v4.5c0 .412.338.75.75.75h12c.412 0 .75-.338.75-.75v-4.5A.752.752 0 0 0 13 6zm-9.75 4.5c-.825 0-1.5-.675-1.5-1.5s.675-1.5 1.5-1.5 1.5.675 1.5 1.5-.675 1.5-1.5 1.5z",transform:"translate(17 13)",fillRule:"evenodd"}),font:/*#__PURE__*/Z.createElement("path",{d:"M3.722 8.702l-.686 1.89c-.053.14-.094.28-.123.421-.03.135-.044.252-.044.352 0 .304.097.527.29.668.2.14.501.21.905.21h.414V13H.083v-.756h.343c.176 0 .325-.018.448-.053a.81.81 0 0 0 .334-.22c.1-.105.193-.249.281-.43.094-.182.197-.416.308-.704L5.787.15h1.406l4.07 11.136c.07.187.14.343.21.466.077.123.165.222.264.298.1.07.214.12.343.15.129.03.281.044.457.044h.237V13H7.826v-.756h.413c.72 0 1.081-.287 1.081-.862 0-.1-.014-.202-.044-.307a3.274 3.274 0 0 0-.105-.36l-.72-2.013H3.72zM7.009 4.65c-.188-.533-.36-1.031-.519-1.494a15.92 15.92 0 0 1-.378-1.354 7.12 7.12 0 0 1-.15.633 16.95 16.95 0 0 1-.395 1.283c-.082.229-.175.484-.28.765L4.063 7.796h4.061L7.009 4.65zm8.411 5.74c0 .562.117.984.351 1.265.24.275.61.413 1.108.413.363 0 .691-.059.984-.176.3-.117.551-.284.756-.5.211-.218.372-.481.483-.792.112-.31.168-.656.168-1.037V8.104l-1.152.053c-.51.023-.937.088-1.283.193-.34.1-.615.243-.826.43a1.546 1.546 0 0 0-.457.678c-.088.27-.132.58-.132.931zm2.18-6.32c-.346 0-.627.05-.844.15a1.182 1.182 0 0 0-.501.404 1.594 1.594 0 0 0-.237.624c-.041.24-.062.5-.062.782-.498 0-.879-.085-1.143-.255-.257-.17-.386-.463-.386-.879 0-.31.085-.574.255-.79.17-.218.401-.393.694-.528.299-.14.644-.243 1.037-.308a7.76 7.76 0 0 1 1.257-.097c.55 0 1.031.056 1.441.167.41.106.753.282 1.029.528.275.246.48.568.615.967.14.392.21.876.21 1.45v4.667c0 .252.021.46.062.624a.928.928 0 0 0 .194.395c.088.1.202.17.343.211.146.041.319.062.518.062h.053V13H19.7l-.281-1.547h-.15c-.187.252-.369.483-.544.694-.176.211-.37.393-.58.545-.211.152-.452.27-.721.352a3.053 3.053 0 0 1-.958.131c-.399 0-.77-.058-1.116-.175a2.369 2.369 0 0 1-.888-.519 2.516 2.516 0 0 1-.58-.896c-.14-.364-.211-.791-.211-1.284 0-.955.34-1.664 1.02-2.127.68-.462 1.707-.714 3.084-.755l1.495-.053V6.285a6.93 6.93 0 0 0-.053-.888 1.778 1.778 0 0 0-.229-.703 1.14 1.14 0 0 0-.51-.457c-.216-.111-.51-.167-.878-.167z",transform:"translate(13 12)",fillRule:"evenodd"}),image:/*#__PURE__*/Z.createElement("path",{d:"M13 0L9.25 5l2.85 3.8-1.6 1.2C8.81 7.75 6 4 6 4l-6 8h22L13 0z",transform:"translate(13 14)",fillRule:"evenodd"}),presentation:/*#__PURE__*/Z.createElement("path",{d:"M2 4H0v10c0 1.1.9 2 2 2h14v-2H2V4zm16-4H6C4.9 0 4 .9 4 2v8c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V2c0-1.1-.9-2-2-2zm0 10H6V2h12v8z",transform:"matrix(-1 0 0 1 34 12)",fillRule:"evenodd"}),settings:/*#__PURE__*/Z.createElement("path",{d:"M13.572 8.735c.03-.24.053-.48.053-.735s-.023-.495-.053-.735l1.583-1.237a.378.378 0 0 0 .09-.48l-1.5-2.595a.377.377 0 0 0-.457-.165l-1.868.75a5.48 5.48 0 0 0-1.268-.735L9.868.815A.366.366 0 0 0 9.5.5h-3a.366.366 0 0 0-.367.315l-.285 1.988a5.762 5.762 0 0 0-1.268.735l-1.868-.75a.366.366 0 0 0-.457.165l-1.5 2.595a.37.37 0 0 0 .09.48l1.583 1.237c-.03.24-.053.488-.053.735 0 .248.022.495.053.735L.845 9.973a.378.378 0 0 0-.09.48l1.5 2.595c.09.165.292.225.458.165l1.867-.75c.39.3.81.547 1.268.735l.285 1.987c.022.18.18.315.367.315h3a.366.366 0 0 0 .367-.315l.285-1.988a5.762 5.762 0 0 0 1.268-.734l1.867.75c.173.067.368 0 .458-.165l1.5-2.595a.378.378 0 0 0-.09-.48l-1.582-1.238zM8 10.625A2.628 2.628 0 0 1 5.375 8 2.628 2.628 0 0 1 8 5.375 2.628 2.628 0 0 1 10.625 8 2.628 2.628 0 0 1 8 10.625z",transform:"translate(16 11)",fillRule:"evenodd"}),spreadsheet:/*#__PURE__*/Z.createElement("path",{d:"M0 8h6V5H0v3zm0 5h6v-3H0v3zM0 3h6V0H0v3zm8 5h12V5H8v3zm0 5h12v-3H8v3zM8 0v3h12V0H8z",transform:"translate(14 14)",fillRule:"evenodd"}),vector:/*#__PURE__*/Z.createElement("path",{d:"M14.5 2V1a1 1 0 0 0-1-1h-3a1 1 0 0 0-1 1v1H3.937a2 2 0 1 0 0 1h3.936A9 9 0 0 0 3 11v1h2v-1a7.003 7.003 0 0 1 4.594-6.576A1 1 0 0 0 10.5 5h3a1 1 0 0 0 .906-.576A7.003 7.003 0 0 1 19 11v1h2v-1a9 9 0 0 0-4.873-8h3.936a2 2 0 1 0 0-1H14.5zm-1-1h-3v3h3V1zM2 1.5a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm19 1a1 1 0 1 0 2 0 1 1 0 0 0-2 0z",transform:"translate(12 14)",fillRule:"evenodd"}),video:/*#__PURE__*/Z.createElement("path",{d:"M10.75 3.875V1.25A.752.752 0 0 0 10 .5H1a.752.752 0 0 0-.75.75v7.5c0 .412.338.75.75.75h9c.412 0 .75-.338.75-.75V6.125l3 3V.875l-3 3z",transform:"translate(17 14)"})};!function(e){e.forEach(function(e){xN.indexOf(e)<0&&(e(yN,pN),xN.push(e))})}([function(e,t){var r={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},n={};for(var a in r)n[r[a]]=a;var o={};e.prototype.toName=function(t){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,i,s=n[this.toHex()];if(s)return s;if(t?.closest){var l=this.toRgb(),c=1/0,d="black";if(!o.length)for(var u in r)o[u]=new e(r[u]).toRgb();for(var h in r){var p=(a=l,i=o[h],(a.r-i.r)**2+(a.g-i.g)**2+(a.b-i.b)**2);p<c&&(c=p,d=h)}return d}},t.string.push([function(t){var n=t.toLowerCase(),a="transparent"===n?"#0000":r[n];return a?new e(a).toRgb():null},"name"])}]);var SN={color:WC.default.string,extension:WC.default.string,fold:WC.default.bool,foldColor:WC.default.string,glyphColor:WC.default.string,gradientColor:WC.default.string,gradientOpacity:WC.default.number,labelColor:WC.default.string,labelTextColor:WC.default.string,labelUppercase:WC.default.bool,radius:WC.default.number,type:WC.default.oneOf(["3d","acrobat","android","audio","binary","code","code2","compressed","document","drive","font","image","presentation","settings","spreadsheet","vector","video"])},kN=40,CN=48,NN={WIDTH:kN,HEIGHT:CN,X_OFFSET:0},TN=12,AN=Z.useId||function(){var e=0;return function(){return e++}}(),MN=function(e){var t=e.color,r=void 0===t?"whitesmoke":t,n=e.extension,a=e.fold,o=void 0===a||a,i=e.foldColor,s=e.glyphColor,l=e.gradientColor,c=void 0===l?"white":l,d=e.gradientOpacity,u=void 0===d?.25:d,h=e.labelColor,p=e.labelTextColor,m=void 0===p?"white":p,f=e.labelUppercase,g=void 0!==f&&f,v=e.radius,y=void 0===v?4:v,b=e.type,x=AN(),w=typeof jest>"u"?x:"";/*#__PURE__*/
156
- return Z.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 "+kN+" "+CN,width:"100%",style:{maxWidth:"100%"}},/*#__PURE__*/Z.createElement("defs",null,/*#__PURE__*/Z.createElement("clipPath",{id:"pageRadius"+w},/*#__PURE__*/Z.createElement("rect",{x:NN.X_OFFSET,y:"0",rx:y,ry:y,width:NN.WIDTH,height:NN.HEIGHT})),/*#__PURE__*/Z.createElement("clipPath",{id:"foldCrop"+w},/*#__PURE__*/Z.createElement("rect",{width:NN.WIDTH,height:TN,transform:"rotate(-45 0 "+TN+")"})),/*#__PURE__*/Z.createElement("linearGradient",{x1:"100%",y1:"0%",y2:"100%",id:"pageGradient"+w},/*#__PURE__*/Z.createElement("stop",{stopColor:c,stopOpacity:u,offset:"0%"}),/*#__PURE__*/Z.createElement("stop",{stopColor:c,stopOpacity:"0",offset:"66.67%"}))),/*#__PURE__*/Z.createElement("g",{id:"file",clipPath:"url(#pageRadius"+w+")"},o?/*#__PURE__*/Z.createElement(Z.Fragment,null,/*#__PURE__*/Z.createElement("path",{d:"M"+NN.X_OFFSET+" 0 h "+(NN.WIDTH-TN)+" L "+(NN.WIDTH+NN.X_OFFSET)+" "+TN+" v "+(NN.HEIGHT-TN)+" H "+NN.X_OFFSET+" Z",fill:r}),/*#__PURE__*/Z.createElement("path",{d:"M"+NN.X_OFFSET+" 0 h "+(NN.WIDTH-TN)+" L "+(NN.WIDTH+NN.X_OFFSET)+" "+TN+" v "+(NN.HEIGHT-TN)+" H "+NN.X_OFFSET+" Z",fill:"url(#pageGradient"+w+")"})):/*#__PURE__*/Z.createElement(Z.Fragment,null,/*#__PURE__*/Z.createElement("rect",{x:NN.X_OFFSET,y:"0",width:NN.WIDTH,height:NN.HEIGHT,fill:r}),/*#__PURE__*/Z.createElement("rect",{x:NN.X_OFFSET,y:"0",width:NN.WIDTH,height:NN.HEIGHT,fill:"url(#pageGradient"+w+")"}))),o&&/*#__PURE__*/Z.createElement("g",{transform:"translate(28 "+TN+") rotate(-90)"},/*#__PURE__*/Z.createElement("rect",{width:NN.WIDTH,height:NN.HEIGHT,fill:i||bN(r).darken(.1).toHex(),rx:y,ry:y,clipPath:"url(#foldCrop"+w+")"})),n&&/*#__PURE__*/Z.createElement(Z.Fragment,null,/*#__PURE__*/Z.createElement("g",{id:"label"+w},/*#__PURE__*/Z.createElement("rect",{fill:h||bN(r).darken(.3).toHex(),x:NN.X_OFFSET,y:NN.HEIGHT-14,width:NN.WIDTH,height:14,clipPath:"url(#pageRadius"+w+")"})),/*#__PURE__*/Z.createElement("g",{id:"labelText"+w,transform:"translate("+NN.X_OFFSET+" 34)"},/*#__PURE__*/Z.createElement("text",{x:NN.WIDTH/2,y:"10",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif",fontSize:"9",fill:m,textAnchor:"middle",style:{fontWeight:"bold",textAlign:"center",pointerEvents:"none",textTransform:g?"uppercase":"none",userSelect:"none"}},n))),b&&/*#__PURE__*/Z.createElement("g",{transform:"translate(-4 "+(n?0:6)+")",fill:s||bN(r).darken(.15).toHex()},wN[b]))};MN.propTypes=SN;var DN={"3dm":{labelColor:"#8D1A11",type:"3d"},"3ds":{labelColor:"#5FB9AD",type:"3d"},"3g2":{type:"video"},"3gp":{type:"video"},"7zip":{type:"compressed"},aab:{type:"android",labelColor:"#3DDC84"},aac:{type:"audio"},aep:{type:"video"},ai:{color:"#423325",gradientOpacity:0,labelColor:"#423325",labelTextColor:"#FF7F18",labelUppercase:!0,foldColor:"#FF7F18",radius:2},aif:{type:"audio"},aiff:{type:"audio"},apk:{type:"android",labelColor:"#3DDC84"},apkm:{type:"android",labelColor:"#3DDC84"},apks:{type:"android",labelColor:"#3DDC84"},asf:{type:"video"},asp:{type:"code"},aspx:{type:"code"},avi:{type:"video"},bin:{type:"binary"},bmp:{type:"image"},c:{type:"code"},cpp:{type:"code"},cs:{type:"code"},css:{type:"code"},csv:{type:"spreadsheet"},cue:{type:"document"},dll:{type:"settings"},dmg:{type:"drive"},doc:{color:"#2C5898",foldColor:"#254A80",glyphColor:"rgba(255,255,255,0.4)",labelColor:"#2C5898",labelUppercase:!0,type:"document"},docx:{color:"#2C5898",foldColor:"#254A80",glyphColor:"rgba(255,255,255,0.4)",labelColor:"#2C5898",labelUppercase:!0,type:"document"},dwg:{type:"vector"},dxf:{type:"vector"},eot:{type:"font"},eps:{type:"vector"},exe:{type:"settings"},flac:{type:"audio"},flv:{type:"video"},fnt:{type:"font"},fodp:{type:"presentation"},fods:{type:"spreadsheet"},fodt:{type:"document"},fon:{type:"font"},gif:{type:"image"},gz:{type:"compressed"},heic:{type:"image"},htm:{type:"code"},html:{type:"code"},indd:{color:"#4B2B36",gradientOpacity:0,labelColor:"#4B2B36",labelTextColor:"#FF408C",labelUppercase:!0,foldColor:"#FF408C",radius:2},ini:{type:"settings"},java:{type:"code"},jpeg:{type:"image"},jpg:{type:"image"},js:{labelColor:"#F7DF1E",type:"code"},json:{type:"code"},jsx:{labelColor:"#00D8FF",type:"code"},m4a:{type:"audio"},m4v:{type:"video"},max:{labelColor:"#5FB9AD",type:"3d"},md:{type:"document"},mid:{type:"audio"},mkv:{type:"video"},mov:{type:"video"},mp3:{type:"audio"},mp4:{type:"video"},mpeg:{type:"video"},mpg:{type:"video"},obj:{type:"3d"},odp:{type:"presentation"},ods:{type:"spreadsheet"},odt:{type:"document"},ogg:{type:"audio"},ogv:{type:"video"},otf:{type:"font"},pdf:{labelColor:"#D93831",type:"acrobat"},php:{labelColor:"#8892BE",type:"code"},pkg:{type:"3d"},plist:{type:"settings"},png:{type:"image"},ppt:{color:"#D14423",foldColor:"#AB381D",glyphColor:"rgba(255,255,255,0.4)",labelColor:"#D14423",labelUppercase:!0,type:"presentation"},pptx:{color:"#D14423",foldColor:"#AB381D",glyphColor:"rgba(255,255,255,0.4)",labelColor:"#D14423",labelUppercase:!0,type:"presentation"},pr:{type:"video"},ps:{type:"vector"},psd:{color:"#34364E",gradientOpacity:0,labelColor:"#34364E",labelTextColor:"#31C5F0",labelUppercase:!0,foldColor:"#31C5F0",radius:2},py:{labelColor:"#FFDE57",type:"code"},rar:{type:"compressed"},rb:{labelColor:"#BB271A",type:"code"},rm:{type:"video"},rtf:{type:"document"},scss:{labelColor:"#C16A98",type:"code"},sitx:{type:"compressed"},skp:{type:"3d"},svg:{type:"vector"},swf:{type:"video"},sys:{type:"settings"},tar:{type:"compressed"},tex:{type:"document"},tif:{type:"image"},tiff:{type:"image"},ts:{labelColor:"#3478C7",type:"code"},ttf:{type:"font"},txt:{type:"document"},wav:{type:"audio"},webm:{type:"video"},wmv:{type:"video"},woff:{type:"font"},wpd:{type:"document"},wps:{type:"document"},xapk:{type:"android",labelColor:"#3DDC84"},xlr:{type:"spreadsheet"},xls:{color:"#1A754C",foldColor:"#16613F",glyphColor:"rgba(255,255,255,0.4)",labelColor:"#1A754C",labelUppercase:!0,type:"spreadsheet"},xlsx:{color:"#1A754C",foldColor:"#16613F",glyphColor:"rgba(255,255,255,0.4)",labelColor:"#1A754C",labelUppercase:!0,type:"spreadsheet"},yml:{type:"code"},zip:{type:"compressed"},zipx:{type:"compressed"}},EN={sm:14,md:18,lg:24};function IN({filename:e,size:t="sm"}){let r=function(e){let t=e.lastIndexOf(".");return-1===t?"":e.slice(t+1).toLowerCase()}(e),n="number"==typeof t?t:EN[t];/* @__PURE__ */
157
- return be("span",{className:"shrink-0 inline-flex",style:{width:n,height:n},"aria-hidden":!0,children:/* @__PURE__ */be(MN,{extension:r||void 0,...r?DN[r]??{}:{}})})}var RN=[{type:"openTabs",label:"Open Tabs",icon:Gp},{type:"files",label:"Files",icon:_p},{type:"outline",label:"Outline",icon:fm},{type:"related",label:"Related",icon:Yp},{type:"ai",label:"AI",icon:dm}],zN=Object.defineProperty,_N=Object.defineProperties,PN=Object.getOwnPropertyDescriptors,ON=Object.getOwnPropertySymbols,LN=Object.prototype.hasOwnProperty,FN=Object.prototype.propertyIsEnumerable,BN=(e,t,r)=>t in e?zN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,VN=(e,t)=>{for(var r in t||={})LN.call(t,r)&&BN(e,r,t[r]);if(ON)for(var r of ON(t))FN.call(t,r)&&BN(e,r,t[r]);return e},$N=(e,t)=>_N(e,PN(t)),HN=(e,t,r)=>new Promise((n,a)=>{var o=e=>{try{s(r.next(e))}catch(e){a(e)}},i=e=>{try{s(r.throw(e))}catch(e){a(e)}},s=e=>e.done?n(e.value):Promise.resolve(e.value).then(o,i);s((r=r.apply(e,t)).next())});function jN(e,t){return"function"==typeof e?e(t):e}function qN(e,t){return r=>{t.setState(t=>$N(VN({},t),{[e]:jN(r,t[e])}))}}var UN=(e,t=100,r=1e3)=>new Promise(n=>{let a,o=setInterval(()=>{e()&&(n(),clearInterval(o),clearTimeout(a))},t);a=setTimeout(()=>{clearInterval(o),n()},r)}),GN=e=>Error("Headless Tree: "+e),WN={key:"tree",getInitialState:e=>VN({expandedItems:[],focusedItem:null},e),getDefaultConfig:(e,t)=>VN({setExpandedItems:qN("expandedItems",t),setFocusedItem:qN("focusedItem",t)},e),stateHandlerNames:{expandedItems:"setExpandedItems",focusedItem:"setFocusedItem"},treeInstance:{getItemsMeta:({tree:e})=>{let{rootItemId:t}=e.getConfig(),{expandedItems:r}=e.getState(),n=[],a=new Set(r),o=(t,r,i,s,l)=>{if(r.includes(t))r.join(".");else if(n.push({itemId:t,level:i,index:n.length,parentId:r.at(-1),setSize:s,posInSet:l}),a.has(t)){let n=e.retrieveChildrenIds(t)??[],a=0;for(let e of n)o(e,r.concat(t),i+1,n.length,a++)}},i=e.retrieveChildrenIds(t),s=0;for(let l of i)o(l,[t],0,i.length,s++);return n},getFocusedItem:({tree:e})=>{let t=e.getState().focusedItem;return(null===t?null:e.getItemInstance(t))??e.getItems()[0]},getRootItem:({tree:e})=>{let{rootItemId:t}=e.getConfig();return e.getItemInstance(t)},focusNextItem:({tree:e})=>{var t;let r=e.getFocusedItem().getItemMeta();if(!r)return;let n=Math.min(r.index+1,e.getItems().length-1);null==(t=e.getItems()[n])||t.setFocused()},focusPreviousItem:({tree:e})=>{var t;let r=e.getFocusedItem().getItemMeta();if(!r)return;let n=Math.max(r.index-1,0);null==(t=e.getItems()[n])||t.setFocused()},updateDomFocus:({tree:e})=>{setTimeout(()=>HN(null,null,function*(){var t,r,n,a;let o=e.getFocusedItem();null==(r=(t=e.getConfig()).scrollToItem)||r.call(t,o),yield UN(()=>null!==o.getElement(),20,500);let i=o.getElement();if(!i)return null==(n=e.getItems()[0])||n.setFocused(),void(null==(a=e.getItems()[0]?.getElement())||a.focus());i.focus()}))},getContainerProps:({prev:e,tree:t},r)=>$N(VN({},e?.()),{role:"tree","aria-label":r??"",ref:t.registerElement}),isSearchOpen:()=>!1},itemInstance:{scrollTo:(e,t)=>HN(null,[e,t],function*({tree:e,item:t},r){var n,a,o;null==(a=(n=e.getConfig()).scrollToItem)||a.call(n,t),yield UN(()=>null!==t.getElement(),20),null==(o=t.getElement())||o.scrollIntoView(r)}),getId:({itemId:e})=>e,getKey:({itemId:e})=>e,getProps:({item:e,prev:t})=>{let r=e.getItemMeta();return $N(VN({},t?.()),{ref:e.registerElement,role:"treeitem","aria-setsize":r.setSize,"aria-posinset":r.posInSet+1,"aria-selected":"false","aria-label":e.getItemName(),"aria-level":r.level+1,"aria-expanded":e.isFolder()?e.isExpanded():void 0,tabIndex:e.isFocused()?0:-1,onClick:t=>{e.setFocused(),e.primaryAction(),!(t.ctrlKey||t.shiftKey||t.metaKey)&&e.isFolder()&&(e.isExpanded()?e.collapse():e.expand())}})},expand:({tree:e,item:t,itemId:r})=>{t.isFolder()&&(e.getState().loadingItemChildrens?.includes(r)||(e.applySubStateUpdate("expandedItems",e=>[...e,r]),e.rebuildTree()))},collapse:({tree:e,item:t,itemId:r})=>{t.isFolder()&&(e.applySubStateUpdate("expandedItems",e=>e.filter(e=>e!==r)),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)=>{let r=e.getParent();return!(r?.getId()!==t&&!r?.isDescendentOf(t))},isFocused:({tree:e,item:t,itemId:r})=>e.getState().focusedItem===r||null===e.getState().focusedItem&&0===t.getItemMeta().index,isFolder:({tree:e,item:t,itemId:r})=>r===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 r;return(r=e.getConfig()).onPrimaryAction?.call(r,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(t=>e.getItemInstance(t)),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=>!e.isSearchOpen?.call(e)&&!e.getState().dnd,handler:(e,t)=>{t.focusNextItem(),t.updateDomFocus()}},focusPreviousItem:{hotkey:"ArrowUp",canRepeat:!0,preventDefault:!0,isEnabled:e=>!e.isSearchOpen?.call(e)&&!e.getState().dnd,handler:(e,t)=>{t.focusPreviousItem(),t.updateDomFocus()}},expandOrDown:{hotkey:"ArrowRight",canRepeat:!0,handler:(e,t)=>{let r=t.getFocusedItem();r.isExpanded()||!r.isFolder()?(t.focusNextItem(),t.updateDomFocus()):r.expand()}},collapseOrUp:{hotkey:"ArrowLeft",canRepeat:!0,handler:(e,t)=>{var r;let n=t.getFocusedItem();n.isExpanded()&&n.isFolder()||0===n.getItemMeta().level?n.collapse():(null==(r=n.getParent())||r.setFocused(),t.updateDomFocus())}},focusFirstItem:{hotkey:"Home",handler:(e,t)=>{var r;null==(r=t.getItems()[0])||r.setFocused(),t.updateDomFocus()}},focusLastItem:{hotkey:"End",handler:(e,t)=>{var r;null==(r=t.getItems()[t.getItems().length-1])||r.setFocused(),t.updateDomFocus()}}}},KN=(e,t,r)=>{let n={};return[n,()=>{let a=r(n);for(let r=0;r<e.length;r++){let o=e[r][t];if(o)e:for(let[e,t]of Object.entries(o)){if(!t)continue e;let r=n[e];n[e]=(...e)=>t($N(VN({},a),{prev:r}),...e)}}}]},YN=(e=[])=>((e,t)=>{let r=e.length;for(let n=0;n<r;n++)for(let a=n+1;a<r;a++)t(e[a],e[n])<0&&([e[n],e[a]]=[e[a],e[n]]);return e})(e,(e=>(t,r)=>r.key&&t.overwrites?.includes(r.key)?1:t.key&&r.overwrites?.includes(t.key)?-1:e.indexOf(t)-e.indexOf(r))(e)),XN=e=>{let t=e.instanceBuilder??KN,r=[WN,...YN(e.features)];(e=>{let t=e?.map(e=>e.key);for(let r of e??[]){let e=r.deps?.find(e=>!t?.includes(e));if(e)throw GN(`${r.key} needs ${e}`)}})(r);let n,a=[...r],[o,i]=t(a,"treeInstance",e=>({tree:e})),s=r.reduce((e,t)=>t.getInitialState?.call(t,e,o)??e,e.initialState??e.state??{}),l=r.reduce((e,t)=>t.getDefaultConfig?.call(t,e,o)??e,e),c=r.reduce((e,t)=>VN(VN({},e),t.stateHandlerNames),{}),d={current:{}},u=!1,h={},p=[],m={},f={},g={},v={},y=()=>{p=[],g={};let[e,r]=t(a,"itemInstance",e=>({item:e,tree:o,itemId:l.rootItemId}));r(),h[l.rootItemId]=e,g[l.rootItemId]={itemId:l.rootItemId,index:-1,parentId:null,level:-1,posInSet:0,setSize:1};for(let n of o.getItemsMeta())if(g[n.itemId]=n,h[n.itemId])p.push(h[n.itemId]);else{let[e,r]=t(a,"itemInstance",e=>({item:e,tree:o,itemId:n.itemId}));r(),h[n.itemId]=e,p.push(e)}u=!1},b=e=>{for(let t of r)e(t)};a.unshift({key:"main",treeInstance:{getState:()=>s,setState:({},e)=>{var t;null==(t=l.setState)||t.call(l,s)},setMounted:({},e)=>{var t;let r=d.current;r.isMounted=e,e&&(null==(t=r.waitingForMount)||t.forEach(e=>e()),r.waitingForMount=[])},applySubStateUpdate:({},e,t)=>{let r=()=>{s[e]="function"==typeof t?t(s[e]):t;let r=l[c[e]];r?.(s[e])},n=d.current;n.isMounted?r():(n.waitingForMount??=[],n.waitingForMount.push(r))},rebuildTree:()=>{var e;let t=d.current;t.isMounted?(y(),null==(e=l.setState)||e.call(l,s)):(t.waitingForMount??=[],t.waitingForMount.push(()=>{var e;y(),null==(e=l.setState)||e.call(l,s)}))},scheduleRebuildTree:()=>{u=!0},getConfig:()=>l,setConfig:(e,t)=>{var r;let n="function"==typeof t?t(l):t,a=n.state?.expandedItems&&n.state?.expandedItems!==s.expandedItems;l=n,n.state&&(s=VN(VN({},s),n.state)),a&&(y(),null==(r=l.setState)||r.call(l,s))},getItemInstance:({},e)=>{let r=h[e];if(!r){let[r,n]=t(a,"itemInstance",t=>({item:t,tree:o,itemId:e}));return n(),r}return r},getItems:()=>(u&&y(),p),registerElement:({},e)=>{n!==e&&(n&&!e?b(e=>e.onTreeUnmount?.call(e,o,n)):!n&&e&&b(t=>t.onTreeMount?.call(t,o,e)),n=e)},getElement:()=>n,getDataRef:()=>d,getHotkeyPresets:()=>v},itemInstance:{registerElement:({itemId:e,item:t},r)=>{if(m[e]===r)return;let n=m[e];n&&!r?b(e=>e.onItemUnmount?.call(e,t,n,o)):!n&&r&&b(e=>e.onItemMount?.call(e,t,r,o)),m[e]=r},getElement:({itemId:e})=>m[e],getDataRef:({itemId:e})=>f[e]??(f[e]={current:{}}),getItemMeta:({itemId:e})=>g[e]??{itemId:e,parentId:null,level:-1,index:-1,posInSet:0,setSize:1}}});for(let x of a)Object.assign(v,x.hotkeys??{});return i(),o},ZN=/* @__PURE__ */(e=>(e[e.None=0]="None",e[e.Started=1]="Started",e[e.Dragging=2]="Dragging",e[e.Completed=3]="Completed",e[e.Aborted=4]="Aborted",e))(ZN||{}),JN={key:"selection",getInitialState:e=>VN({selectedItems:[]},e),getDefaultConfig:(e,t)=>VN({setSelectedItems:qN("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})=>{let{selectedItems:r}=e.getState();e.setSelectedItems(r.includes(t)?r:[...r,t])},deselect:({tree:e,itemId:t})=>{let{selectedItems:r}=e.getState();e.setSelectedItems(r.filter(e=>e!==t))},isSelected:({tree:e,itemId:t})=>{let{selectedItems:r}=e.getState();return r.includes(t)},selectUpTo:({tree:e,item:t,itemId:r},n)=>{let a=t.getItemMeta().index,o=e.getDataRef();if(!o.current.selectUpToAnchorId)return o.current.selectUpToAnchorId=r,void e.setSelectedItems([r]);let i=e.getItemInstance(o.current.selectUpToAnchorId).getItemMeta().index,[s,l]=a<i?[a,i]:[i,a],c=e.getItems().slice(s,l+1).map(e=>e.getItemMeta().itemId);if(!n)return void e.setSelectedItems(c);let{selectedItems:d}=e.getState(),u=[.../* @__PURE__ */new Set([...d,...c])];e.setSelectedItems(u)},toggleSelect:({item:e})=>{e.isSelected()?e.deselect():e.select()},getProps:({tree:e,item:t,itemId:r,prev:n})=>$N(VN({},n?.()),{"aria-selected":t.isSelected()?"true":"false",onClick:a=>{var o,i;a.shiftKey?t.selectUpTo(a.ctrlKey||a.metaKey):a.ctrlKey||a.metaKey?t.toggleSelect():e.setSelectedItems([r]),a.shiftKey||(e.getDataRef().current.selectUpToAnchorId=r),null==(i=(o=n?.())?.onClick)||i.call(o,a)}})},hotkeys:{toggleSelectedItem:{hotkey:"Control+Space",preventDefault:!0,handler:(e,t)=>{t.getFocusedItem().toggleSelect()}},selectUpwards:{hotkey:"Shift+ArrowUp",handler:(e,t)=>{let r=t.getFocusedItem(),n=r.getItemAbove();n&&(r.isSelected()&&n.isSelected()?r.deselect():n.select(),n.setFocused(),t.updateDomFocus())}},selectDownwards:{hotkey:"Shift+ArrowDown",handler:(e,t)=>{let r=t.getFocusedItem(),n=r.getItemBelow();n&&(r.isSelected()&&n.isSelected()?r.deselect():n.select(),n.setFocused(),t.updateDomFocus())}},selectAll:{hotkey:"Control+KeyA",preventDefault:!0,handler:(e,t)=>{t.setSelectedItems(t.getItems().map(e=>e.getId()))}}}},QN=e=>""!==e.code&&"Unidentified"!==e.code?e.code:e.key,eT={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)$/},tT=/* @__PURE__ */new Set(["MetaLeft","MetaRight","Meta","ControlLeft","ControlRight","Control","AltLeft","AltRight","Alt","ShiftLeft","ShiftRight","Shift"]),rT=(e,t,r,n)=>Object.entries(VN(VN({},r),n)).find(([,r])=>((e,t,r)=>{let n=r.hotkey.toLowerCase().split("+"),a=n.every(t=>{if(t in eT)return[...e].some(e=>eT[t].test(e));let r=[...e].map(e=>e.toLowerCase());return r.includes(t.toLowerCase())||r.includes(`key${t.toLowerCase()}`)}),o=!r.isEnabled||r.isEnabled(t);return a&&o&&e.size===n.length})(e,t,r))?.[0],nT=e=>{e.current.pressedKeys=/* @__PURE__ */new Set},aT=(e,t,r,n={})=>{var a,o;let{isInputFocused:i=!1,releaseAfterDispatch:s=!1}=n,{ignoreHotkeysOnInputs:l,onTreeHotkey:c,hotkeys:d}=e.getConfig();if(i&&l)return;let u=QN({code:r.code??"",key:r.key??""});(a=t.current).pressedKeys??(a.pressedKeys=/* @__PURE__ */new Set);let h=!t.current.pressedKeys.has(u);u&&t.current.pressedKeys.add(u);let p=rT(t.current.pressedKeys,e,e.getHotkeyPresets(),d);if(s&&u&&t.current.pressedKeys.delete(u),!p)return;let m=VN(VN({},e.getHotkeyPresets()[p]),d?.[p]);m&&(m.allowWhenInputFocused||!i)&&(m.canRepeat||h)&&(m.preventDefault&&(null==(o=r.preventDefault)||o.call(r)),m.handler(r,e),c?.(p,r))},oT=(e,t)=>{var r;let n=QN({code:t.code??"",key:t.key??""});n&&((r=e.current).pressedKeys??(r.pressedKeys=/* @__PURE__ */new Set),tT.has(n)&&(e.current.pressedKeys=new Set([...e.current.pressedKeys].filter(e=>tT.has(e)))),e.current.pressedKeys.delete(n))},iT={key:"hotkeys-core",onTreeMount:(e,t)=>{let r=e.getDataRef(),n=t=>{let n=t.target instanceof HTMLInputElement;aT(e,r,t,{isInputFocused:n,releaseAfterDispatch:n})},a=e=>{oT(r,e)},o=()=>{nT(r)};t.addEventListener("keydown",n),document.addEventListener("keyup",a),window.addEventListener("focus",o),r.current.keydownHandler=n,r.current.keyupHandler=a,r.current.resetHandler=o},onTreeUnmount:(e,t)=>{let r=e.getDataRef();r.current.keyupHandler&&(document.removeEventListener("keyup",r.current.keyupHandler),delete r.current.keyupHandler),r.current.keydownHandler&&(t.removeEventListener("keydown",r.current.keydownHandler),delete r.current.keydownHandler),r.current.resetHandler&&(window.removeEventListener("focus",r.current.resetHandler),delete r.current.resetHandler)}},sT=e=>{if(!e)throw GN("sync dataLoader returned undefined");if("object"==typeof e&&"then"in e)throw GN("sync dataLoader returned promise");return e},lT={key:"sync-data-loader",getInitialState:e=>VN({loadingItemData:[],loadingItemChildrens:[]},e),getDefaultConfig:(e,t)=>VN({setLoadingItemData:qN("loadingItemData",t),setLoadingItemChildrens:qN("loadingItemChildrens",t)},e),stateHandlerNames:{loadingItemData:"setLoadingItemData",loadingItemChildrens:"setLoadingItemChildrens"},treeInstance:{waitForItemDataLoaded:()=>HN(null,null,function*(){}),waitForItemChildrenLoaded:()=>HN(null,null,function*(){}),retrieveItemData:({tree:e},t)=>sT(e.getConfig().dataLoader.getItem(t)),retrieveChildrenIds:({tree:e},t)=>{let{dataLoader:r}=e.getConfig();return"getChildren"in r?sT(r.getChildren(t)):sT(r.getChildrenWithData(t)).map(e=>e.data)},loadItemData:({tree:e},t)=>e.retrieveItemData(t),loadChildrenIds:({tree:e},t)=>e.retrieveChildrenIds(t)},itemInstance:{isLoading:()=>!1,hasLoadedData:()=>!0}},cT=e=>"childIndex"in e,dT=(e,t,r)=>{let n=r.getState().dnd?.draggedItems,a=r.getConfig();return!(n&&!(a.canDrop?.call(a,n,t)??!0)||n&&n.some(e=>t.item.getId()===e.getId()||t.item.isDescendentOf(e.getId()))||!n&&e&&a.canDropForeignDragObject&&!a.canDropForeignDragObject(e,t))},uT=e=>e.isExpanded()?1:e.getParent()&&e.getIndexInParent()===e.getItemMeta().setSize-1?2:0,hT=(e,t,r)=>t-(e.slice(0,t).reduce((e,t)=>t&&r?.some(e=>e.getId()===t.getId())?++e:e,0)??0),pT=(e,t,r,n)=>{let a=r.getConfig();if(!a.canReorder)return n?{type:2}:{type:1};let o=t.getElement()?.getBoundingClientRect(),i=o?(e.clientY-o.top)/o.height:.5,s=o?e.clientX-o.left:0,l=uT(t),c=n?a.reorderAreaPercentage??.3:.5,d=a.indent??20,u=n?2:1;if(1===l)return i<c?{type:0}:{type:u};if(2===l&&s<t.getItemMeta().level*d){if(i<.5)return{type:0};let e=t.getItemBelow()?.getItemMeta().level??0;return{type:3,reparentLevel:Math.max(e,Math.floor(s/d))}}return i<c?{type:0}:i>1-c?{type:1}:{type:u}},mT=(e,t)=>t===e.getItemMeta().level?e:mT(e.getParent(),t),fT=(e,t,r)=>{let n=e.getItemMeta(),a=mT(e,t-1),o=mT(e,t).getIndexInParent()+1;return{item:a,childIndex:o,insertionIndex:hT(a.getChildren(),o,r),dragLineIndex:n.index+1,dragLineLevel:t}},gT=(e,t,r,n,a=r.getConfig().canReorder)=>{let o=n?e.dataTransfer:null,i=r.getState().dnd?.draggedItems,s=t.getItemMeta(),l=t.getParent(),c={item:t},d=l?{item:l}:null,u=d&&dT(o,d,r),h=pT(e,t,r,dT(o,c,r));if(!a&&l&&u&&2!==h.type)return i?.some(e=>e.isDescendentOf(l.getId()))?c:d;if(2===h.type)return c;if(!a&&l&&!u)return gT(e,l,r,n,!1);if(!l)return c;if(!u)return gT(e,l,r,n,!1);if(3===h.type)return fT(t,h.reparentLevel,i);let p=0===h.type?0:1,m=t.getIndexInParent()+p;return{item:l,dragLineIndex:s.index+p,dragLineLevel:s.level,childIndex:m,insertionIndex:hT(l.getChildren(),m,i)}},vT=()=>!1,yT={key:"drag-and-drop",getDefaultConfig:(e,t)=>VN({canDrop:(e,t)=>t.item.isFolder(),canDropForeignDragObject:vT,canDragForeignDragObjectOver:e.canDropForeignDragObject===vT?()=>!1:e=>"none"!==e.effectAllowed,setDndState:qN("dnd",t),canReorder:!0,openOnDropDelay:800,draggedItemOverwritesSelection:!0},e),stateHandlerNames:{dnd:"setDndState"},onTreeMount:e=>{let t=()=>{e.applySubStateUpdate("dnd",null)};e.getDataRef().current.windowDragEndListener=t,window.addEventListener("dragend",t)},onTreeUnmount:e=>{let{windowDragEndListener:t}=e.getDataRef().current;t&&window.removeEventListener("dragend",t)},treeInstance:{getDragTarget:({tree:e})=>e.getState().dnd?.dragTarget??null,getDragLineData:({tree:e})=>{let t=e.getDragTarget(),r=(t?.item.getItemMeta().level??0)+1,n=e.getElement()?.getBoundingClientRect();if(!t||!n||!cT(t))return null;let a=t.dragLineLevel*(e.getConfig().indent??1),o=e.getItems()[t.dragLineIndex];if(!o){let o=(e.getItems()[t.dragLineIndex-1]?.getElement())?.getBoundingClientRect();if(o)return{indent:r,top:o.bottom-n.top,left:o.left+a-n.left,width:o.width-a}}let i=(o?.getElement())?.getBoundingClientRect();return i?{indent:r,top:i.top-n.top,left:i.left+a-n.left,width:i.width-a}:null},getDragLineStyle:({tree:e},t=-1,r=-8)=>{let n=e.getDragLineData();return n?{position:"absolute",top:`${n.top+t}px`,left:`${n.left+r}px`,width:n.width-r+"px",pointerEvents:"none"}:{display:"none"}},getContainerProps:({prev:e,tree:t},r)=>{let n=e?.(r);return $N(VN({},n),{onDragOver:e=>{e.preventDefault()},onDrop:e=>HN(null,null,function*(){let r=t.getDataRef(),n={item:t.getRootItem()};if(!dT(e.dataTransfer,n,t))return;e.preventDefault();let a=t.getConfig(),o=t.getState().dnd?.draggedItems;r.current.lastDragCode=void 0,o?yield a.onDrop?.call(a,o,n):e.dataTransfer&&(yield a.onDropForeignDragObject?.call(a,e.dataTransfer,n))}),style:$N(VN({},n?.style),{position:"relative"})})}},itemInstance:{getProps:({tree:e,item:t,prev:r})=>$N(VN(VN({},r?.()),e.getConfig().seperateDragHandle?{}:t.getDragHandleProps()),{onDragEnter:e=>e.preventDefault(),onDragOver:r=>{var n;r.stopPropagation();let a=e.getDataRef(),o=pT(r,t,e,!0),i=((e,t)=>[e.getId(),t.type,3===t.type?t.reparentLevel:0].join("__"))(t,o);if(i===a.current.lastDragCode)return void(a.current.lastAllowDrop&&r.preventDefault());a.current.lastDragCode=i,a.current.lastDragEnter=Date.now(),((e,t,r,n)=>{let{openOnDropDelay:a}=t.getConfig(),o=e.current.lastDragCode;a&&r.isFolder()&&!r.isExpanded()&&2===n.type&&(clearTimeout(e.current.autoExpandTimeout),e.current.autoExpandTimeout=setTimeout(()=>{o===e.current.lastDragCode&&e.current.lastAllowDrop&&r.expand()},a))})(a,e,t,o);let s=gT(r,t,e,!1);(e.getState().dnd?.draggedItems||r.dataTransfer&&(n=e.getConfig()).canDragForeignDragObjectOver?.call(n,r.dataTransfer,s))&&dT(null,s,e)?(e.applySubStateUpdate("dnd",e=>$N(VN({},e),{dragTarget:s,draggingOverItem:t})),a.current.lastAllowDrop=!0,r.preventDefault()):a.current.lastAllowDrop=!1},onDragLeave:()=>{setTimeout(()=>{let t=e.getDataRef();(t.current.lastDragEnter??0)+100>=Date.now()||(t.current.lastDragCode="no-drag",e.applySubStateUpdate("dnd",e=>$N(VN({},e),{draggingOverItem:void 0,dragTarget:void 0})))},100)},onDrop:r=>HN(null,null,function*(){r.stopPropagation();let n=e.getDataRef(),a=gT(r,t,e,!0),o=e.getState().dnd?.draggedItems,i=dT(r.dataTransfer,a,e);if(e.applySubStateUpdate("dnd",{draggedItems:void 0,draggingOverItem:void 0,dragTarget:void 0}),!i)return;r.preventDefault();let s=e.getConfig();n.current.lastDragCode=void 0,o?(yield s.onDrop?.call(s,o,a),o[0].setFocused()):r.dataTransfer&&(yield s.onDropForeignDragObject?.call(s,r.dataTransfer,a)),e.applySubStateUpdate("dnd",null),e.updateDomFocus()})}),getDragHandleProps:({tree:e,item:t,prev:r})=>$N(VN({},r?.()),{draggable:!0,onDragStart:r=>{var n,a;let{draggedItemOverwritesSelection:o}=e.getConfig(),i=e.getSelectedItems?e.getSelectedItems():[e.getFocusedItem()],s=!i.includes(t)&&o,l=s?[t]:i,c=e.getConfig();if(s&&(null==(n=e.setSelectedItems)||n.call(e,[t.getItemMeta().itemId])),c.canDrag?.call(c,l)??!0){if(c.setDragImage){let{imgElement:e,xOffset:t,yOffset:n}=c.setDragImage(l);null==(a=r.dataTransfer)||a.setDragImage(e,t??0,n??0)}if(c.createForeignDragObject&&r.dataTransfer){let{format:e,data:t,dropEffect:n,effectAllowed:a}=c.createForeignDragObject(l);r.dataTransfer.setData(e,t),n&&(r.dataTransfer.dropEffect=n),a&&(r.dataTransfer.effectAllowed=a)}e.applySubStateUpdate("dnd",{draggedItems:l,draggingOverItem:e.getFocusedItem()})}else r.preventDefault()},onDragEnd:r=>{let{onCompleteForeignDrop:n,canDragForeignDragObjectOver:a}=e.getConfig(),o=e.getState().dnd?.draggedItems;if("none"===r.dataTransfer?.dropEffect||!o)return;let i=gT(r,t,e,!1);a&&r.dataTransfer&&!a(r.dataTransfer,i)||n?.(o)}}),isDragTarget:({tree:e,item:t})=>{let r=e.getDragTarget();return!!r&&r.item.getId()===t.getId()},isUnorderedDragTarget:({tree:e,item:t})=>{let r=e.getDragTarget();return!!r&&(!cT(r)&&r.item.getId()===t.getId())},isDragTargetAbove:({tree:e,item:t})=>{let r=e.getDragTarget();return!(!r||!cT(r)||r.item!==t.getParent())&&r.childIndex===t.getItemMeta().posInSet},isDragTargetBelow:({tree:e,item:t})=>{let r=e.getDragTarget();return!(!r||!cT(r)||r.item!==t.getParent())&&r.childIndex-1===t.getItemMeta().posInSet},isDraggingOver:({tree:e,item:t})=>(e.getState().dnd?.draggingOverItem)?.getId()===t.getId()}},bT=(e,t,r=(()=>e.getState().dnd?.dragTarget)())=>{if(!r)return;let n=((e,t,r)=>{let n=+!t,a=e.getState().dnd?.draggedItems;if(cT(r)){let o=r.item.getParent(),i=e.getItems()[r.dragLineIndex-1],s=i?uT(i):0,l=i?.getItemMeta().level??0,c=(i?.getItemBelow())?.getItemMeta().level??0;if(2===s){if(t&&r.dragLineLevel<l)return fT(i,r.dragLineLevel+1,a);if(!t&&r.dragLineLevel>c&&o)return fT(i,r.dragLineLevel-1,a)}let d=r.dragLineIndex-1+n,u=e.getItems()[d];return u?{item:u}:void 0}if(1===uT(r.item)&&!t)return{item:r.item,childIndex:0,insertionIndex:hT(r.item.getChildren(),0,a),dragLineIndex:r.item.getItemMeta().index+n,dragLineLevel:r.item.getItemMeta().level+1};let o=r.item.getIndexInParent()+n;return{item:r.item.getParent(),childIndex:o,insertionIndex:hT(r.item.getParent().getChildren(),o,a),dragLineIndex:r.item.getItemMeta().index+n,dragLineLevel:r.item.getItemMeta().level}})(e,t,r),a=e.getDataRef().current.kDndDataTransfer??null;return n?dT(a,n,e)?n:bT(e,t,n):void 0},xT=e=>{let t=e.getState().dnd;t?.dragTarget&&!cT(t.dragTarget)&&t.dragTarget.item.scrollTo({block:"nearest",inline:"nearest"})},wT=(e,t,r)=>{var n,a;let o=e.getFocusedItem(),{canDrag:i}=e.getConfig();if(t&&i&&!i(t))return;t?(e.applySubStateUpdate("dnd",{draggedItems:t}),null==(a=(n=e.getConfig()).onStartKeyboardDrag)||a.call(n,t)):r&&(e.getDataRef().current.kDndDataTransfer=r);let s=bT(e,!1,{item:o});s&&(e.applySubStateUpdate("dnd",{draggedItems:t,dragTarget:s}),e.applySubStateUpdate("assistiveDndState",1),xT(e))},ST=(e,t)=>{let r=bT(e,t);r&&(e.applySubStateUpdate("dnd",{draggedItems:e.getState().dnd?.draggedItems,dragTarget:r}),e.applySubStateUpdate("assistiveDndState",2),cT(r)||r.item.setFocused(),xT(e))},kT={key:"keyboard-drag-and-drop",deps:["drag-and-drop"],getDefaultConfig:(e,t)=>VN({setAssistiveDndState:qN("assistiveDndState",t)},e),stateHandlerNames:{assistiveDndState:"setAssistiveDndState"},treeInstance:{startKeyboardDrag:({tree:e},t)=>{wT(e,t,void 0)},startKeyboardDragOnForeignObject:({tree:e},t)=>{wT(e,void 0,t)},stopKeyboardDrag:({tree:e})=>{e.getDataRef().current.kDndDataTransfer=void 0,e.applySubStateUpdate("dnd",null),e.applySubStateUpdate("assistiveDndState",0)}},hotkeys:{startDrag:{hotkey:"Control+Shift+KeyD",preventDefault:!0,isEnabled:e=>!e.getState().dnd,handler:(e,t)=>{let r=t.getSelectedItems?.call(t)??[t.getFocusedItem()],n=t.getFocusedItem();t.startKeyboardDrag(r.includes(n)?r:r.concat(n))}},dragUp:{hotkey:"ArrowUp",preventDefault:!0,isEnabled:e=>!!e.getState().dnd,handler:(e,t)=>{ST(t,!0)}},dragDown:{hotkey:"ArrowDown",preventDefault:!0,isEnabled:e=>!!e.getState().dnd,handler:(e,t)=>{ST(t,!1)}},cancelDrag:{hotkey:"Escape",isEnabled:e=>!!e.getState().dnd,handler:(e,t)=>{t.stopKeyboardDrag()}},completeDrag:{hotkey:"Enter",preventDefault:!0,isEnabled:e=>!!e.getState().dnd,handler:(e,t)=>HN(null,null,function*(){e.stopPropagation();let r=t.getDataRef(),n=t.getDragTarget(),a=r.current.kDndDataTransfer??null;if(!n||!dT(a,n,t))return;let o=t.getConfig(),i=t.getState().dnd?.draggedItems;r.current.lastDragCode=void 0,t.applySubStateUpdate("dnd",null),i?(yield o.onDrop?.call(o,i,n),t.getItemInstance(i[0].getId()).setFocused()):a&&(yield o.onDropForeignDragObject?.call(o,a,n)),t.updateDomFocus(),t.applySubStateUpdate("assistiveDndState",3)})}}},CT={key:"renaming",overwrites:["drag-and-drop"],getDefaultConfig:(e,t)=>VN({setRenamingItem:qN("renamingItem",t),setRenamingValue:qN("renamingValue",t),canRename:()=>!0},e),stateHandlerNames:{renamingItem:"setRenamingItem",renamingValue:"setRenamingValue"},treeInstance:{getRenamingItem:({tree:e})=>{let t=e.getState().renamingItem;return t?e.getItemInstance(t):null},getRenamingValue:({tree:e})=>e.getState().renamingValue||"",abortRenaming:({tree:e})=>{e.applySubStateUpdate("renamingItem",null),e.updateDomFocus()},completeRenaming:({tree:e})=>{var t;let r=e.getConfig(),n=e.getRenamingItem();n&&(null==(t=r.onRename)||t.call(r,n,e.getState().renamingValue||"")),e.applySubStateUpdate("renamingItem",null),e.updateDomFocus()},isRenamingItem:({tree:e})=>!!e.getState().renamingItem},itemInstance:{startRenaming:({tree:e,item:t,itemId:r})=>{t.canRename()&&(e.applySubStateUpdate("renamingItem",r),e.applySubStateUpdate("renamingValue",t.getItemName()))},getRenameInputProps:({tree:e})=>({ref:e=>e?.focus(),onBlur:()=>e.abortRenaming(),value:e.getRenamingValue(),onChange:t=>{e.applySubStateUpdate("renamingValue",t.target?.value)}}),canRename:({tree:e,item:t})=>{var r;return(r=e.getConfig()).canRename?.call(r,t)??!0},isRenaming:({tree:e,item:t})=>t.getId()===e.getState().renamingItem,getProps:({prev:e,item:t})=>{let r=t.isRenaming(),n=e?.()??{};return r?$N(VN({},n),{draggable:!1,onDragStart:()=>{}}):n}},hotkeys:{renameItem:{hotkey:"F2",handler:(e,t)=>{t.getFocusedItem().startRenaming()}},abortRenaming:{hotkey:"Escape",allowWhenInputFocused:!0,isEnabled:e=>e.isRenamingItem(),handler:(e,t)=>{t.abortRenaming()}},completeRenaming:{hotkey:"Enter",allowWhenInputFocused:!0,isEnabled:e=>e.isRenamingItem(),handler:(e,t)=>{t.completeRenaming()}}}},NT=Object.defineProperty,TT=Object.defineProperties,AT=Object.getOwnPropertyDescriptors,MT=Object.getOwnPropertySymbols,DT=Object.prototype.hasOwnProperty,ET=Object.prototype.propertyIsEnumerable,IT=(e,t,r)=>t in e?NT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,RT=(e,t)=>{for(var r in t||={})DT.call(t,r)&&IT(e,r,t[r]);if(MT)for(var r of MT(t))ET.call(t,r)&&IT(e,r,t[r]);return e},zT=(e,t)=>TT(e,AT(t)),_T={position:"absolute",margin:"-1px",width:"1px",height:"1px",overflow:"hidden",clip:"rect(0 0 0 0)"},PT=(e,t,r)=>{if(!r.startDrag)return"";let n=(e?.draggedItems)?.map(e=>e.getItemName()).join(", ")??"",a=e?.dragTarget?"childIndex"in e.dragTarget?`${e.dragTarget.childIndex} of ${e.dragTarget.item.getChildren().length} in ${e.dragTarget.item.getItemName()}`:`in ${e.dragTarget.item.getItemName()}`:"None",o=`Press ${r.dragUp?.hotkey} and ${r.dragDown?.hotkey} to move up or down, ${r.completeDrag?.hotkey} to drop, ${r.cancelDrag?.hotkey} to abort.`;switch(t){case ZN.Started:return n?`Dragging ${n}. Current position: ${a}. ${o}`:`Current position: ${a}. ${o}`;case ZN.Dragging:return n?`${n}, ${a}`:a;case ZN.Completed:return`Drag completed. Press ${r.startDrag?.hotkey} to move selected items`;case ZN.Aborted:return`Drag cancelled. Press ${r.startDrag?.hotkey} to move selected items`;case ZN.None:default:return`Press ${r.startDrag?.hotkey} to move selected items`}},OT=e=>{var t=e,{tree:r,getLabel:n=PT}=t,a=((e,t)=>{var r={};for(var n in e)DT.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&MT)for(var n of MT(e))t.indexOf(n)<0&&ET.call(e,n)&&(r[n]=e[n]);return r})(t,["tree","getLabel"]);let o=r.getState();/* @__PURE__ */
158
- return Z.createElement("span",zT(RT({"aria-live":"assertive"},a),{style:RT(RT({},_T),a.style)}),n(o.dnd,o.assistiveDndState??ZN.None,r.getHotkeyPresets()))},LT=X.createContext({currentItem:void 0,indent:20,tree:void 0});function FT(){return X.useContext(LT)}function BT({indent:e=20,tree:t,className:r,...n}){let a=t&&"function"==typeof t.getContainerProps?t.getContainerProps():{},{style:o,...i}={...n,...a},s={...o,"--tree-indent":`${e}px`};/* @__PURE__ */
159
- return be(LT.Provider,{value:{indent:e,tree:t},children:/* @__PURE__ */be("div",{className:qf("flex flex-col",r),"data-slot":"tree",style:s,...i})})}function VT({item:e,className:t,asChild:r,children:n,...a}){let{indent:o}=FT(),i="function"==typeof e.getProps?e.getProps():{},{style:s,...l}={...a,...i},c={...s,"--tree-padding":e.getItemMeta().level*o+"px"},d=r?Td:"button";/* @__PURE__ */
160
- return be(LT.Provider,{value:{currentItem:e,indent:o},children:/* @__PURE__ */be(d,{"aria-expanded":e.isExpanded(),className:qf("z-10 select-none ps-(--tree-padding) not-last:pb-0.5 outline-hidden focus:z-20 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),"data-drag-target":"function"==typeof e.isDragTarget?e.isDragTarget()||!1:void 0,"data-focus":"function"==typeof e.isFocused?e.isFocused()||!1:void 0,"data-folder":"function"==typeof e.isFolder?e.isFolder()||!1:void 0,"data-search-match":"function"==typeof e.isMatchingSearch?e.isMatchingSearch()||!1:void 0,"data-selected":"function"==typeof e.isSelected?e.isSelected()||!1:void 0,"data-slot":"tree-item",style:c,...l,children:n})})}function $T({item:e,children:t,className:r,...n}){let{currentItem:a}=FT(),o=e||a;return o?/* @__PURE__ */xe("span",{className:qf("flex items-center gap-2 rounded-sm bg-transparent in-data-[drag-target=true]:bg-accent in-data-[search-match=true]:bg-blue-400/20! in-data-[selected=true]:bg-accent px-2 py-1.5 in-data-[selected=true]:text-accent-foreground text-sm in-focus-visible:ring-[3px] in-focus-visible:ring-ring/50 transition-colors hover:bg-accent [&_svg]:pointer-events-none [&_svg]:shrink-0",r),"data-slot":"tree-item-label",...n,children:[o.isFolder()?/* @__PURE__ */be(pp,{className:"in-aria-[expanded=false]:-rotate-90 size-4 shrink-0 text-muted-foreground"}):/* @__PURE__ */be("span",{className:"size-4 shrink-0","aria-hidden":!0}),t||("function"==typeof o.getItemName?o.getItemName():null)]}):null}function HT({className:e,...t}){let{tree:r}=FT();if(!r||"function"!=typeof r.getDragLineStyle)return null;let n=r.getDragLineStyle();/* @__PURE__ */
161
- return be("div",{className:qf("-mt-px before:-top-[3px] absolute z-30 h-0.5 w-[unset] bg-primary before:absolute before:left-0 before:size-2 before:rounded-full before:border-2 before:border-primary before:bg-background",e),style:n,...t})}var jT=Object.defineProperty,qT=(e,t)=>jT(e,"name",{value:t,configurable:!0}),[UT,GT]=/* @__PURE__ */od("AlertDialog",[zh]),WT=zh(),KT=/* @__PURE__ */qT(e=>{let{__scopeAlertDialog:t,...r}=e,n=WT(t);/* @__PURE__ */
162
- return be(Oh,{...n,...r,modal:!0})},"AlertDialog");X.forwardRef(/* @__PURE__ */qT(function(e,t){let{__scopeAlertDialog:r,...n}=e,a=WT(r);/* @__PURE__ */
163
- return be(Lh,{...a,...n,ref:t})},"AlertDialogTrigger"));var YT=/* @__PURE__ */qT(e=>{let{__scopeAlertDialog:t,...r}=e,n=WT(t);/* @__PURE__ */
164
- return be($h,{...n,...r})},"AlertDialogPortal"),XT=X.forwardRef(/* @__PURE__ */qT(function(e,t){let{__scopeAlertDialog:r,...n}=e,a=WT(r);/* @__PURE__ */
165
- return be(jh,{...a,...n,ref:t})},"AlertDialogOverlay")),[ZT,JT]=UT("AlertDialogContent"),QT=X.forwardRef(/* @__PURE__ */qT(function(e,t){let{__scopeAlertDialog:r,children:n,...a}=e,o=WT(r),i=rd(t,X.useRef(null)),s=X.useRef(null);/* @__PURE__ */
166
- return be(ZT,{scope:r,cancelRef:s,children:/* @__PURE__ */be(Wh,{role:"alertdialog",...o,...a,ref:i,onOpenAutoFocus:Yc(a.onOpenAutoFocus,e=>{e.preventDefault(),s.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:n})})},"AlertDialogContent")),eA=X.forwardRef(/* @__PURE__ */qT(function(e,t){let{__scopeAlertDialog:r,...n}=e,a=WT(r);/* @__PURE__ */
167
- return be(Zh,{...a,...n,ref:t})},"AlertDialogTitle")),tA=X.forwardRef(/* @__PURE__ */qT(function(e,t){let{__scopeAlertDialog:r,...n}=e,a=WT(r);/* @__PURE__ */
168
- return be(Jh,{...a,...n,ref:t})},"AlertDialogDescription")),rA=X.forwardRef(/* @__PURE__ */qT(function(e,t){let{__scopeAlertDialog:r,...n}=e,a=WT(r);/* @__PURE__ */
169
- return be(Qh,{...a,...n,ref:t})},"AlertDialogAction")),nA=X.forwardRef(/* @__PURE__ */qT(function(e,t){let{__scopeAlertDialog:r,...n}=e,{cancelRef:a}=JT("AlertDialogCancel",r),o=WT(r),i=rd(t,a);/* @__PURE__ */
170
- return be(Qh,{...o,...n,ref:i})},"AlertDialogCancel")),aA=KT,oA=YT,iA=XT,sA=QT,lA=rA,cA=nA,dA=eA,uA=tA;function hA({...e}){/* @__PURE__ */
171
- return be(aA,{"data-slot":"alert-dialog",...e})}function pA({...e}){/* @__PURE__ */
172
- return be(oA,{"data-slot":"alert-dialog-portal",...e})}function mA({className:e,...t}){/* @__PURE__ */
173
- return be(iA,{"data-slot":"alert-dialog-overlay",className:qf("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50 backdrop-blur-xs",e),...t})}function fA({className:e,...t}){/* @__PURE__ */
174
- return xe(pA,{children:[/* @__PURE__ */be(mA,{}),/* @__PURE__ */be(sA,{"data-slot":"alert-dialog-content",className:qf("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-2xl border p-6 shadow-lg duration-200 sm:max-w-lg",e),...t})]})}function gA({className:e,...t}){/* @__PURE__ */
175
- return be("div",{"data-slot":"alert-dialog-header",className:qf("flex flex-col gap-2 text-center sm:text-left",e),...t})}function vA({className:e,...t}){/* @__PURE__ */
176
- return be("div",{"data-slot":"alert-dialog-footer",className:qf("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function yA({className:e,...t}){/* @__PURE__ */
177
- return be(dA,{"data-slot":"alert-dialog-title",className:qf("text-lg font-semibold",e),...t})}function bA({className:e,...t}){/* @__PURE__ */
178
- return be(uA,{"data-slot":"alert-dialog-description",className:qf("text-muted-foreground text-sm",e),...t})}function xA({className:e,...t}){/* @__PURE__ */
179
- return be(lA,{className:qf(Zb(),e),...t})}function wA({className:e,...t}){/* @__PURE__ */
180
- return be(cA,{className:qf(Zb({variant:"outline"}),e),...t})}var SA=Object.defineProperty,kA=(e,t)=>SA(e,"name",{value:t,configurable:!0}),CA="ContextMenu",[NA,TA]=/* @__PURE__ */od(CA,[kk]),AA=kk(),[MA,DA]=NA(CA),EA=/* @__PURE__ */kA(e=>{let{__scopeContextMenu:t,children:r,onOpenChange:n,open:a,dir:o,modal:i=!0}=e,s=X.useRef(!1),[l,c]=bd({prop:a,defaultProp:!1,onChange:n,caller:CA}),d=AA(t);/* @__PURE__ */
181
- return be(MA,{scope:t,open:l,onOpenChange:c,modal:i,hasInteractedRef:s,children:/* @__PURE__ */be(xC,{...d,dir:o,open:l,onOpenChange:c,modal:i,children:r})})},"ContextMenu"),IA=/* @__PURE__ */X.forwardRef(/* @__PURE__ */kA(function(e,t){let{__scopeContextMenu:r,disabled:n=!1,...a}=e,o=DA("ContextMenuTrigger",r),i=AA(r),[s,l]=X.useState({x:0,y:0}),c=X.useMemo(()=>({current:{getBoundingClientRect:/* @__PURE__ */kA(()=>DOMRect.fromRect({width:0,height:0,...s}),"getBoundingClientRect")}}),[s]),d=X.useRef(0),u=X.useCallback(()=>window.clearTimeout(d.current),[]),h=/* @__PURE__ */kA(e=>{o.hasInteractedRef.current=!0,l({x:e.clientX,y:e.clientY}),o.onOpenChange(!0)},"handleOpen");return X.useEffect(()=>u,[u]),X.useEffect(()=>{n&&u()},[n,u]),/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be(wC,{...i,virtualRef:c}),/* @__PURE__ */be(Vd.span,{"data-state":o.open?"open":"closed","data-disabled":n?"":void 0,...a,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:n?e.onContextMenu:Yc(e.onContextMenu,e=>{u(),h(e),e.preventDefault()}),onPointerDown:n?e.onPointerDown:Yc(e.onPointerDown,jA(e=>{u(),o.open&&o.onOpenChange(!1),d.current=window.setTimeout(()=>h(e),700)})),onPointerMove:n?e.onPointerMove:Yc(e.onPointerMove,jA(u)),onPointerCancel:n?e.onPointerCancel:Yc(e.onPointerCancel,jA(u)),onPointerUp:n?e.onPointerUp:Yc(e.onPointerUp,jA(u))})]})},"ContextMenuTrigger")),RA=/* @__PURE__ */kA(e=>{let{__scopeContextMenu:t,...r}=e,n=AA(t);/* @__PURE__ */
182
- return be(SC,{...n,...r})},"ContextMenuPortal"),zA=/* @__PURE__ */X.forwardRef(/* @__PURE__ */kA(function(e,t){let{__scopeContextMenu:r,...n}=e,a=DA("ContextMenuContent",r),o=AA(r),i=X.useRef(!1);/* @__PURE__ */
183
- return be(kC,{...o,...n,ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),!t.defaultPrevented&&i.current&&t.preventDefault(),i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),!t.defaultPrevented&&!a.modal&&(i.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"ContextMenuContent")),_A=/* @__PURE__ */X.forwardRef(/* @__PURE__ */kA(function(e,t){let{__scopeContextMenu:r,...n}=e,a=AA(r);/* @__PURE__ */
184
- return be(CC,{...a,...n,ref:t})},"ContextMenuLabel")),PA=/* @__PURE__ */X.forwardRef(/* @__PURE__ */kA(function(e,t){let{__scopeContextMenu:r,...n}=e,a=AA(r);/* @__PURE__ */
185
- return be(NC,{...a,...n,ref:t})},"ContextMenuItem")),OA=/* @__PURE__ */X.forwardRef(/* @__PURE__ */kA(function(e,t){let{__scopeContextMenu:r,...n}=e,a=AA(r);/* @__PURE__ */
186
- return be(TC,{...a,...n,ref:t})},"ContextMenuCheckboxItem")),LA=/* @__PURE__ */X.forwardRef(/* @__PURE__ */kA(function(e,t){let{__scopeContextMenu:r,...n}=e,a=AA(r);/* @__PURE__ */
187
- return be(AC,{...a,...n,ref:t})},"ContextMenuRadioItem")),FA=/* @__PURE__ */X.forwardRef(/* @__PURE__ */kA(function(e,t){let{__scopeContextMenu:r,...n}=e,a=AA(r);/* @__PURE__ */
188
- return be(MC,{...a,...n,ref:t})},"ContextMenuItemIndicator")),BA=/* @__PURE__ */X.forwardRef(/* @__PURE__ */kA(function(e,t){let{__scopeContextMenu:r,...n}=e,a=AA(r);/* @__PURE__ */
189
- return be(DC,{...a,...n,ref:t})},"ContextMenuSeparator")),VA=/* @__PURE__ */kA(e=>{let{__scopeContextMenu:t,children:r,onOpenChange:n,open:a,defaultOpen:o}=e,i=AA(t),[s,l]=bd({prop:a,defaultProp:o??!1,onChange:n,caller:"ContextMenuSub"});/* @__PURE__ */
190
- return be(EC,{...i,open:s,onOpenChange:l,children:r})},"ContextMenuSub"),$A=/* @__PURE__ */X.forwardRef(/* @__PURE__ */kA(function(e,t){let{__scopeContextMenu:r,...n}=e,a=AA(r);/* @__PURE__ */
191
- return be(IC,{...a,...n,ref:t})},"ContextMenuSubTrigger")),HA=/* @__PURE__ */X.forwardRef(/* @__PURE__ */kA(function(e,t){let{__scopeContextMenu:r,...n}=e,a=AA(r);/* @__PURE__ */
192
- return be(RC,{...a,...n,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"ContextMenuSubContent"));function jA(e){return t=>"mouse"===t.pointerType?void 0:e(t)}kA(jA,"whenTouchOrPen");var qA=RA,UA=zA,GA=_A,WA=PA,KA=OA,YA=LA,XA=FA,ZA=BA,JA=$A,QA=HA,eM=EA,tM=IA,rM=VA,nM=X.forwardRef(({className:e,inset:t,children:r,...n},a)=>/* @__PURE__ */xe(JA,{ref:a,className:qf("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[state=open]:bg-accent data-[state=open]:text-accent-foreground focus:bg-accent focus:text-accent-foreground",t&&"pl-8",e),...n,children:[r,/* @__PURE__ */be(fp,{className:"ml-auto h-4 w-4"})]}));nM.displayName=JA.displayName;var aM=X.forwardRef(({className:e,...t},r)=>/* @__PURE__ */be(QA,{ref:r,className:qf("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-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",e),...t}));aM.displayName=QA.displayName;var oM=X.forwardRef(({className:e,...t},r)=>/* @__PURE__ */be(qA,{children:/* @__PURE__ */be(UA,{ref:r,className:qf("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-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",e),...t})}));oM.displayName=UA.displayName;var iM=X.forwardRef(({className:e,inset:t,...r},n)=>/* @__PURE__ */be(WA,{ref:n,className:qf("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t&&"pl-8",e),...r}));iM.displayName=WA.displayName;var sM=X.forwardRef(({className:e,children:t,checked:r,...n},a)=>/* @__PURE__ */xe(KA,{ref:a,className:qf("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),checked:r,...n,children:[/* @__PURE__ */be("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:/* @__PURE__ */be(XA,{children:/* @__PURE__ */be(up,{className:"h-4 w-4"})})}),t]}));sM.displayName=KA.displayName;var lM=X.forwardRef(({className:e,children:t,...r},n)=>/* @__PURE__ */xe(YA,{ref:n,className:qf("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),...r,children:[/* @__PURE__ */be("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:/* @__PURE__ */be(XA,{children:/* @__PURE__ */be(xp,{className:"h-2 w-2 fill-current"})})}),t]}));lM.displayName=YA.displayName;var cM=X.forwardRef(({className:e,inset:t,...r},n)=>/* @__PURE__ */be(GA,{ref:n,className:qf("px-2 py-1.5 text-sm font-semibold text-foreground",t&&"pl-8",e),...r}));cM.displayName=GA.displayName;var dM=X.forwardRef(({className:e,...t},r)=>/* @__PURE__ */be(ZA,{ref:r,className:qf("-mx-1 my-1 h-px bg-border",e),...t}));dM.displayName=ZA.displayName;var uM=({className:e,...t})=>/* @__PURE__ */be("span",{className:qf("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});uM.displayName="ContextMenuShortcut";var hM=({children:e,itemId:t,isFolder:r,hasCopiedItem:n,onAddChild:a,onAddChildFolder:o,onAddSibling:i,onAddSiblingFolder:s,onRename:l,onDuplicate:c,onCopy:d,onPaste:u,onDelete:h,onManageTags:p})=>{let m=me(null),f=me(null),g=()=>{m.current&&=(clearTimeout(m.current),null)};/* @__PURE__ */
193
- return xe(eM,{children:[/* @__PURE__ */be(tM,{asChild:!0,children:/* @__PURE__ */be("div",{className:"contents",onTouchStart:e=>{let t=e.touches[0];f.current={x:t.clientX,y:t.clientY};let r=e.currentTarget,n=t.clientX,a=t.clientY;m.current=setTimeout(()=>{r.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,clientX:n,clientY:a}))},500)},onTouchEnd:g,onTouchCancel:g,onTouchMove:e=>{if(!f.current)return;let t=e.touches[0],r=Math.abs(t.clientX-f.current.x),n=Math.abs(t.clientY-f.current.y);(r>10||n>10)&&g()},children:e})}),/* @__PURE__ */xe(oM,{className:"w-56",onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:[
194
- /* @__PURE__ */xe(iM,{onClick:()=>r?a?.(t):i?.(t),disabled:r?!a:!i,children:[/* @__PURE__ */be(_p,{className:"mr-2 h-4 w-4"}),"Add Note"]}),
195
- /* @__PURE__ */xe(iM,{onClick:()=>r?o?.(t):s?.(t),disabled:r?!o:!s,children:[/* @__PURE__ */be(Bp,{className:"mr-2 h-4 w-4"}),"Add Folder"]}),
196
- /* @__PURE__ */xe(iM,{onClick:()=>l?.(t),disabled:!l,children:[
197
- /* @__PURE__ */be(am,{className:"mr-2 h-4 w-4"}),"Rename",
198
- /* @__PURE__ */be(uM,{children:"F2"})]}),
199
- /* @__PURE__ */xe(iM,{onClick:()=>c?.(t),disabled:!c,children:[
138
+ return be(l,{ref:a,children:n})});c.displayName=s;let d=e+"CollectionItemSlot",u="data-radix-collection-item",h=/* @__PURE__ */Nd(d),p=X.forwardRef((e,t)=>{let{scope:r,children:n,...a}=e,i=X.useRef(null),s=rd(t,i),l=o(d,r);return X.useEffect(()=>(l.itemMap.set(i,{ref:i,...a}),()=>{l.itemMap.delete(i);/* @__PURE__ */})),be(h,{[u]:"",ref:s,children:n})});function m(t){let r=o(e+"CollectionConsumer",t);return X.useCallback(()=>{let e=r.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${u}]`));return Array.from(r.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current))},[r.collectionRef,r.itemMap])}return p.displayName=d,gS(m,"useCollection"),[{Provider:i,Slot:c,ItemSlot:p},m,n]}gS(vS,"createCollection");var yS=/* @__PURE__ */new WeakMap,bS=class e extends Map{static{gS(this,"OrderedDict")}#e;constructor(e){super(e),this.#e=[...super.keys()],yS.set(this,!0)}set(e,t){return yS.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,r){let n=this.has(t),a=this.#e.length,o=SS(e),i=o>=0?o:a+o,s=i<0||i>=a?-1:i;if(s===this.size||n&&s===this.size-1||-1===s)return this.set(t,r),this;let l=this.size+ +!n;o<0&&i++;let c,d=[...this.#e],u=!1;for(let h=i;h<l;h++)if(i===h){let e=d[h];d[h]===t&&(e=d[h+1]),n&&this.delete(t),c=this.get(e),this.set(t,r)}else{!u&&d[h-1]===t&&(u=!0);let e=d[u?h:h-1],r=c;c=this.get(e),this.delete(e),this.set(e,r)}return this}with(t,r,n){let a=new e(this);return a.insert(t,r,n),a}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,r){let n=this.#e.indexOf(e);return-1===n?this:this.insert(n,t,r)}after(e){let t=this.#e.indexOf(e);if(t=-1===t||t===this.size-1?-1:t+1,-1!==t)return this.entryAt(t)}setAfter(e,t,r){let n=this.#e.indexOf(e);return-1===n?this:this.insert(n+1,t,r)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return void 0!==t&&this.delete(t)}at(e){let t=xS(this.#e,e);if(void 0!==t)return this.get(t)}entryAt(e){let t=xS(this.#e,e);if(void 0!==t)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return xS(this.#e,e)}from(e,t){let r=this.indexOf(e);if(-1===r)return;let n=r+t;return n<0&&(n=0),n>=this.size&&(n=this.size-1),this.at(n)}keyFrom(e,t){let r=this.indexOf(e);if(-1===r)return;let n=r+t;return n<0&&(n=0),n>=this.size&&(n=this.size-1),this.keyAt(n)}find(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return n;r++}}findIndex(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return r;r++}return-1}filter(t,r){let n=[],a=0;for(let e of this)Reflect.apply(t,r,[e,a,this])&&n.push(e),a++;return new e(n)}map(t,r){let n=[],a=0;for(let e of this)n.push([e[0],Reflect.apply(t,r,[e,a,this])]),a++;return new e(n)}reduce(...e){let[t,r]=e,n=0,a=r??this.at(0);for(let o of this)a=0===n&&1===e.length?o:Reflect.apply(t,this,[a,o,n,this]),n++;return a}reduceRight(...e){let[t,r]=e,n=r??this.at(-1);for(let a=this.size-1;a>=0;a--){let r=this.at(a);n=a===this.size-1&&1===e.length?r:Reflect.apply(t,this,[n,r,a,this])}return n}toSorted(t){let r=[...this.entries()].sort(t);return new e(r)}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let r=this.keyAt(e),n=this.get(r);t.set(r,n)}return t}toSpliced(...t){let r=[...this.entries()];return r.splice(...t),new e(r)}slice(t,r){let n=new e,a=this.size-1;if(void 0===t)return n;t<0&&(t+=this.size),void 0!==r&&r>0&&(a=r-1);for(let e=t;e<=a;e++){let t=this.keyAt(e),r=this.get(t);n.set(t,r)}return n}every(e,t){let r=0;for(let n of this){if(!Reflect.apply(e,t,[n,r,this]))return!1;r++}return!0}some(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return!0;r++}return!1}};function xS(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);let r=wS(e,t);return-1===r?void 0:e[r]}function wS(e,t){let r=e.length,n=SS(t),a=n>=0?n:r+n;return a<0||a>=r?-1:a}function SS(e){return e!=e||0===e?0:Math.trunc(e)}function kS(e,t){if(e===t)return!0;if("object"!=typeof e||"object"!=typeof t||null==e||null==t)return!1;let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let a of r)if(!Object.prototype.hasOwnProperty.call(t,a)||e[a]!==t[a])return!1;return!0}function CS(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function NS(e,t){return e[1].element&&t[1].element?CS(e[1].element,t[1].element)?-1:1:0}function TS(e){return new MutationObserver(t=>{for(let r of t)if("childList"===r.type)return void e()})}gS(xS,"at"),gS(wS,"toSafeIndex"),gS(SS,"toSafeInteger"),gS(function(e){let t=e+"CollectionProvider",[r,n]=/* @__PURE__ */od(t),[a,o]=r(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new bS,setItemMap:/* @__PURE__ */gS(()=>{},"setItemMap")}),i=/* @__PURE__ */gS(({state:e,...t})=>e?/* @__PURE__ */be(l,{...t,state:e}):/* @__PURE__ */be(s,{...t}),"CollectionProvider");i.displayName=t;let s=/* @__PURE__ */gS(e=>{let t=f();/* @__PURE__ */
139
+ return be(l,{...e,state:t})},"CollectionInit");s.displayName=t+"Init";let l=/* @__PURE__ */gS(e=>{let{scope:t,children:r,state:n}=e,o=X.useRef(null),[i,s]=X.useState(null),l=rd(o,s),[c,d]=n;return X.useEffect(()=>{if(!i)return;let e=TS(()=>{});return e.observe(i,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[i]),/* @__PURE__ */be(a,{scope:t,itemMap:c,setItemMap:d,collectionRef:l,collectionRefObject:o,collectionElement:i,children:r})},"CollectionProviderImpl");l.displayName=t+"Impl";let c=e+"CollectionSlot",d=/* @__PURE__ */Nd(c),u=X.forwardRef((e,t)=>{let{scope:r,children:n}=e,a=rd(t,o(c,r).collectionRef);/* @__PURE__ */
140
+ return be(d,{ref:a,children:n})});u.displayName=c;let h=e+"CollectionItemSlot",p=/* @__PURE__ */Nd(h),m=X.forwardRef((e,t)=>{let{scope:r,children:n,...a}=e,i=X.useRef(null),[s,l]=X.useState(null),c=rd(t,i,l),{setItemMap:d}=o(h,r),u=X.useRef(a);kS(u.current,a)||(u.current=a);let m=u.current;return X.useEffect(()=>{let e=m;return d(t=>s?t.has(s)?t.set(s,{...e,element:s}).toSorted(NS):(t.set(s,{...e,element:s}),t.toSorted(NS)):t),()=>{d(e=>s&&e.has(s)?(e.delete(s),new bS(e)):e)}},[s,m,d]),/* @__PURE__ */be(p,{"data-radix-collection-item":"",ref:c,children:n})});function f(){return X.useState(new bS)}function g(t){let{itemMap:r}=o(e+"CollectionConsumer",t);return r}return m.displayName=h,gS(f,"useInitCollection"),gS(g,"useCollection"),[{Provider:i,Slot:u,ItemSlot:m},{createCollectionScope:n,useCollection:g,useInitCollection:f}]},"createCollection"),gS(kS,"shallowEqual"),gS(CS,"isElementPreceding"),gS(NS,"sortByDocumentPosition"),gS(TS,"getChildListObserver");var AS=Object.defineProperty,MS=X.createContext(void 0);function DS(e){let t=X.useContext(MS);return e||t||"ltr"}((e,t)=>{AS(e,"name",{value:t,configurable:!0})})(DS,"useDirection");var ES=Object.defineProperty,IS=(e,t)=>ES(e,"name",{value:t,configurable:!0}),RS=!1;function zS(){let[e,t]=X.useState(RS);return X.useEffect(()=>{RS||(RS=!0,t(!0))},[]),e}IS(zS,"useIsHydrated");var _S=X.useSyncExternalStore;function PS(){return()=>{}}function OS(){return _S(PS,()=>!0,()=>!1)}IS(PS,"subscribe"),IS(OS,"useIsHydratedModern");var LS="function"==typeof _S?OS:zS,FS=Object.defineProperty,BS=(e,t)=>FS(e,"name",{value:t,configurable:!0}),VS="rovingFocusGroup.onEntryFocus",$S={bubbles:!1,cancelable:!0},HS="RovingFocusGroup",[jS,qS,US]=/* @__PURE__ */vS(HS),[GS,WS]=/* @__PURE__ */od(HS,[US]),[KS,YS]=GS(HS),XS=/* @__PURE__ */X.forwardRef(/* @__PURE__ */BS(function(e,t){/* @__PURE__ */
141
+ return be(jS.Provider,{scope:e.__scopeRovingFocusGroup,children:/* @__PURE__ */be(jS.Slot,{scope:e.__scopeRovingFocusGroup,children:/* @__PURE__ */be(ZS,{...e,ref:t})})})},"RovingFocusGroup")),ZS=/* @__PURE__ */X.forwardRef(/* @__PURE__ */BS(function(e,t){let{__scopeRovingFocusGroup:r,orientation:n,loop:a=!1,dir:o,currentTabStopId:i,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:d=!1,...u}=e,h=X.useRef(null),p=rd(t,h),m=DS(o),[f,g]=bd({prop:i,defaultProp:s??null,onChange:l,caller:HS}),[v,y]=X.useState(!1),b=jd(c),x=qS(r),w=X.useRef(!1),[S,k]=X.useState(0);return X.useEffect(()=>{let e=h.current;if(e)return e.addEventListener(VS,b),()=>e.removeEventListener(VS,b)},[b]),/* @__PURE__ */be(KS,{scope:r,orientation:n,dir:m,loop:a,currentTabStopId:f,onItemFocus:X.useCallback(e=>g(e),[g]),onItemShiftTab:X.useCallback(()=>y(!0),[]),onFocusableItemAdd:X.useCallback(()=>k(e=>e+1),[]),onFocusableItemRemove:X.useCallback(()=>k(e=>e-1),[]),children:/* @__PURE__ */be(Vd.div,{tabIndex:v||0===S?-1:0,"data-orientation":n,...u,ref:p,style:{outline:"none",...e.style},onMouseDown:Yc(e.onMouseDown,()=>{w.current=!0}),onFocus:Yc(e.onFocus,e=>{let t=!w.current;if(e.target===e.currentTarget&&t&&!v){let t=new CustomEvent(VS,$S);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);rk([e.find(e=>e.active),e.find(e=>e.id===f),...e].filter(Boolean).map(e=>e.ref.current),d)}}w.current=!1}),onBlur:Yc(e.onBlur,()=>y(!1))})})},"RovingFocusGroupImpl")),JS=/* @__PURE__ */X.forwardRef(/* @__PURE__ */BS(function(e,t){let{__scopeRovingFocusGroup:r,focusable:n=!0,active:a=!1,tabStopId:o,children:i,...s}=e,l=ud(),c=o||l,d=YS("RovingFocusGroupItem",r),u=d.currentTabStopId===c,h=qS(r),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:f}=d,g=LS();return sd(()=>{if(g&&n)return p(),()=>m()},[g,n,p,m]),X.useEffect(()=>{if(!g&&n)return p(),()=>m()},[g,n,p,m]),/* @__PURE__ */be(jS.ItemSlot,{scope:r,id:c,focusable:n,active:a,children:/* @__PURE__ */be(Vd.span,{tabIndex:u?0:-1,"data-orientation":d.orientation,...s,ref:t,onMouseDown:Yc(e.onMouseDown,e=>{n?d.onItemFocus(c):e.preventDefault()}),onFocus:Yc(e.onFocus,()=>d.onItemFocus(c)),onKeyDown:Yc(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void d.onItemShiftTab();if(e.target!==e.currentTarget)return;let t=tk(e,d.orientation,d.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let r=h().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)r.reverse();else if("prev"===t||"next"===t){"prev"===t&&r.reverse();let n=r.indexOf(e.currentTarget);r=d.loop?nk(r,n+1):r.slice(n+1)}setTimeout(()=>rk(r))}}),children:"function"==typeof i?i({isCurrentTabStop:u,hasTabStop:null!=f}):i})})},"RovingFocusGroupItem")),QS={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function ek(e,t){return"rtl"===t?"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e:e}function tk(e,t,r){let n=ek(e.key,r);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(n)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(n)))return QS[n]}function rk(e,t=!1){let r=document.activeElement;for(let n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function nk(e,t){return e.map((r,n)=>e[(t+n)%e.length])}BS(ek,"getDirectionAwareKey"),BS(tk,"getFocusIntent"),BS(rk,"focusFirst"),BS(nk,"wrapArray");var ak=XS,ok=JS,ik=Object.defineProperty,sk=(e,t)=>ik(e,"name",{value:t,configurable:!0}),lk=["Enter"," "],ck=["ArrowUp","PageDown","End"],dk=["ArrowDown","PageUp","Home",...ck],uk={ltr:[...lk,"ArrowRight"],rtl:[...lk,"ArrowLeft"]},hk={ltr:["ArrowLeft"],rtl:["ArrowRight"]},pk="Menu",[mk,fk,gk]=/* @__PURE__ */vS(pk),[vk,yk]=/* @__PURE__ */od(pk,[gk,Ow,WS]),bk=Ow(),xk=WS(),[wk,Sk]=vk(pk),[kk,Ck]=vk(pk),Nk=/* @__PURE__ */sk(e=>{let{__scopeMenu:t,open:r=!1,children:n,dir:a,onOpenChange:o,modal:i=!0}=e,s=bk(t),[l,c]=X.useState(null),d=X.useRef(!1),u=jd(o),h=DS(a);return X.useEffect(()=>{let e=/* @__PURE__ */sk(()=>{d.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},"handleKeyDown"),t=/* @__PURE__ */sk(()=>d.current=!1,"handlePointer");return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}},[]),X.useEffect(()=>{if(!r)return;let e=/* @__PURE__ */sk(()=>u(!1),"handleBlur");return window.addEventListener("blur",e),()=>window.removeEventListener("blur",e)},[r,u]),/* @__PURE__ */be(Kw,{...s,children:/* @__PURE__ */be(wk,{scope:t,open:r,onOpenChange:u,content:l,onContentChange:c,children:/* @__PURE__ */be(kk,{scope:t,onClose:X.useCallback(()=>u(!1),[u]),isUsingKeyboardRef:d,dir:h,modal:i,children:n})})})},"Menu"),Tk=/* @__PURE__ */X.forwardRef(/* @__PURE__ */sk(function(e,t){let{__scopeMenu:r,...n}=e,a=bk(r);/* @__PURE__ */
142
+ return be(Yw,{...a,...n,ref:t})},"MenuAnchor")),Ak="MenuPortal",[Mk,Dk]=vk(Ak,{forceMount:void 0}),Ek=/* @__PURE__ */sk(e=>{let{__scopeMenu:t,forceMount:r,children:n,container:a}=e,o=Sk(Ak,t);/* @__PURE__ */
143
+ return be(Mk,{scope:t,forceMount:r,children:/* @__PURE__ */be(Cu,{present:r||o.open,children:/* @__PURE__ */be(xu,{asChild:!0,container:a,children:n})})})},"MenuPortal"),Ik="MenuContent",[Rk,zk]=vk(Ik),_k=/* @__PURE__ */X.forwardRef(/* @__PURE__ */sk(function(e,t){let r=Dk(Ik,e.__scopeMenu),{forceMount:n=r.forceMount,...a}=e,o=Sk(Ik,e.__scopeMenu),i=Ck(Ik,e.__scopeMenu);/* @__PURE__ */
144
+ return be(mk.Provider,{scope:e.__scopeMenu,children:/* @__PURE__ */be(Cu,{present:n||o.open,children:/* @__PURE__ */be(mk.Slot,{scope:e.__scopeMenu,children:i.modal?/* @__PURE__ */be(Pk,{...a,ref:t}):/* @__PURE__ */be(Ok,{...a,ref:t})})})})},"MenuContent")),Pk=/* @__PURE__ */X.forwardRef(/* @__PURE__ */sk(function(e,t){let r=Sk(Ik,e.__scopeMenu),n=X.useRef(null),a=rd(t,n);return X.useEffect(()=>{let e=n.current;if(e)return Mh(e)},[]),/* @__PURE__ */be(Fk,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Yc(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentModal")),Ok=/* @__PURE__ */X.forwardRef(/* @__PURE__ */sk(function(e,t){let r=Sk(Ik,e.__scopeMenu);/* @__PURE__ */
145
+ return be(Fk,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentNonModal")),Lk=/* @__PURE__ */Nd("MenuContent.ScrollLock"),Fk=/* @__PURE__ */X.forwardRef(/* @__PURE__ */sk(function(e,t){let{__scopeMenu:r,loop:n=!1,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:u,onInteractOutside:h,onDismiss:p,disableOutsideScroll:m,...f}=e,g=Sk(Ik,r),v=Ck(Ik,r),y=bk(r),b=xk(r),x=fk(r),[w,S]=X.useState(null),k=X.useRef(null),C=rd(t,k,g.onContentChange),N=X.useRef(0),T=X.useRef(""),A=X.useRef(0),M=X.useRef(null),D=X.useRef("right"),E=X.useRef(0),I=m?wh:X.Fragment,R=m?{as:Lk,allowPinchZoom:!0}:void 0,z=/* @__PURE__ */sk(e=>{let t=T.current+e,r=x().filter(e=>!e.disabled),n=document.activeElement,a=r.find(e=>e.ref.current===n)?.textValue,o=uC(r.map(e=>e.textValue),t,a),i=r.find(e=>e.textValue===o)?.ref.current;
146
+ /* @__PURE__ */sk(function e(t){T.current=t,window.clearTimeout(N.current),""!==t&&(N.current=window.setTimeout(()=>e(""),1e3))},"updateSearch")(t),i&&setTimeout(()=>i.focus())},"handleTypeaheadSearch");X.useEffect(()=>()=>window.clearTimeout(N.current),[]),_u();let _=X.useCallback(e=>D.current===M.current?.side&&pC(e,M.current?.area),[]);/* @__PURE__ */
147
+ return be(Rk,{scope:r,searchRef:T,onItemEnter:X.useCallback(e=>{_(e)&&e.preventDefault()},[_]),onItemLeave:X.useCallback(e=>{_(e)||(k.current?.focus(),S(null))},[_]),onTriggerLeave:X.useCallback(e=>{_(e)&&e.preventDefault()},[_]),pointerGraceTimerRef:A,onPointerGraceIntentChange:X.useCallback(e=>{M.current=e},[]),children:/* @__PURE__ */be(I,{...R,children:/* @__PURE__ */be(su,{asChild:!0,trapped:a,onMountAutoFocus:Yc(o,e=>{e.preventDefault(),k.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:/* @__PURE__ */be(Yd,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:u,onInteractOutside:h,onDismiss:p,children:/* @__PURE__ */be(ak,{asChild:!0,...b,dir:v.dir,orientation:"vertical",loop:n,currentTabStopId:w,onCurrentTabStopIdChange:S,onEntryFocus:Yc(l,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:/* @__PURE__ */be(Xw,{role:"menu","aria-orientation":"vertical","data-state":iC(g.open),"data-radix-menu-content":"",dir:v.dir,...y,...f,ref:C,style:{outline:"none",...f.style},onKeyDown:Yc(f.onKeyDown,e=>{let t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,r=e.ctrlKey||e.altKey||e.metaKey,n=1===e.key.length;t&&("Tab"===e.key&&e.preventDefault(),!r&&n&&z(e.key));let a=k.current;if(e.target!==a||!dk.includes(e.key))return;e.preventDefault();let o=x().filter(e=>!e.disabled).map(e=>e.ref.current);ck.includes(e.key)&&o.reverse(),cC(o)}),onBlur:Yc(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(N.current),T.current="")}),onPointerMove:Yc(e.onPointerMove,mC(e=>{let t=e.target,r=E.current!==e.clientX;if(e.currentTarget.contains(t)&&r){let t=e.clientX>E.current?"right":"left";D.current=t,E.current=e.clientX}}))})})})})})})},"MenuContentImpl")),Bk=/* @__PURE__ */X.forwardRef(/* @__PURE__ */sk(function(e,t){let{__scopeMenu:r,...n}=e;/* @__PURE__ */
148
+ return be(Vd.div,{...n,ref:t})},"MenuLabel")),Vk="MenuItem",$k="menu.itemSelect",Hk=/* @__PURE__ */X.forwardRef(/* @__PURE__ */sk(function(e,t){let{disabled:r=!1,onSelect:n,...a}=e,o=X.useRef(null),i=Ck(Vk,e.__scopeMenu),s=zk(Vk,e.__scopeMenu),l=rd(t,o),c=X.useRef(!1),d=/* @__PURE__ */sk(()=>{let e=o.current;if(!r&&e){let t=new CustomEvent($k,{bubbles:!0,cancelable:!0});e.addEventListener($k,e=>n?.(e),{once:!0}),$d(e,t),t.defaultPrevented?c.current=!1:i.onClose()}},"handleSelect");/* @__PURE__ */
149
+ return be(jk,{...a,ref:l,disabled:r,onClick:Yc(e.onClick,d),onPointerDown:t=>{e.onPointerDown?.(t),c.current=!0},onPointerUp:Yc(e.onPointerUp,e=>{c.current||e.currentTarget?.click()}),onKeyDown:Yc(e.onKeyDown,e=>{r||e.target!==e.currentTarget||(""===s.searchRef.current||" "!==e.key)&&lk.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},"MenuItem")),jk=/* @__PURE__ */X.forwardRef(/* @__PURE__ */sk(function(e,t){let{__scopeMenu:r,disabled:n=!1,textValue:a,...o}=e,i=zk(Vk,r),s=xk(r),l=X.useRef(null),c=rd(t,l),[d,u]=X.useState(!1),[h,p]=X.useState("");return X.useEffect(()=>{let e=l.current;e&&p((e.textContent??"").trim())},[o.children]),/* @__PURE__ */be(mk.ItemSlot,{scope:r,disabled:n,textValue:a??h,children:/* @__PURE__ */be(ok,{asChild:!0,...s,focusable:!n,children:/* @__PURE__ */be(Vd.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...o,ref:c,onPointerMove:Yc(e.onPointerMove,mC(e=>{n?i.onItemLeave(e):(i.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Yc(e.onPointerLeave,mC(e=>i.onItemLeave(e))),onFocus:Yc(e.onFocus,()=>u(!0)),onBlur:Yc(e.onBlur,()=>u(!1))})})})},"MenuItemImpl")),qk=/* @__PURE__ */X.forwardRef(/* @__PURE__ */sk(function(e,t){let{checked:r=!1,onCheckedChange:n,...a}=e;/* @__PURE__ */
150
+ return be(Yk,{scope:e.__scopeMenu,checked:r,children:/* @__PURE__ */be(Hk,{role:"menuitemcheckbox","aria-checked":sC(r)?"mixed":r,...a,ref:t,"data-state":lC(r),onSelect:Yc(a.onSelect,()=>n?.(!!sC(r)||!r),{checkForDefaultPrevented:!1})})})},"MenuCheckboxItem")),[Uk,Gk]=vk("MenuRadioGroup",{value:void 0,onValueChange:/* @__PURE__ */sk(()=>{},"onValueChange")}),Wk=/* @__PURE__ */X.forwardRef(/* @__PURE__ */sk(function(e,t){let{value:r,...n}=e,a=Gk("MenuRadioItem",e.__scopeMenu),o=r===a.value;/* @__PURE__ */
151
+ return be(Yk,{scope:e.__scopeMenu,checked:o,children:/* @__PURE__ */be(Hk,{role:"menuitemradio","aria-checked":o,...n,ref:t,"data-state":lC(o),onSelect:Yc(n.onSelect,()=>a.onValueChange?.(r),{checkForDefaultPrevented:!1})})})},"MenuRadioItem")),Kk="MenuItemIndicator",[Yk,Xk]=vk(Kk,{checked:!1}),Zk=/* @__PURE__ */X.forwardRef(/* @__PURE__ */sk(function(e,t){let{__scopeMenu:r,forceMount:n,...a}=e,o=Xk(Kk,r);/* @__PURE__ */
152
+ return be(Cu,{present:n||sC(o.checked)||!0===o.checked,children:/* @__PURE__ */be(Vd.span,{...a,ref:t,"data-state":lC(o.checked)})})},"MenuItemIndicator")),Jk=/* @__PURE__ */X.forwardRef(/* @__PURE__ */sk(function(e,t){let{__scopeMenu:r,...n}=e;/* @__PURE__ */
153
+ return be(Vd.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})},"MenuSeparator")),Qk="MenuSub",[eC,tC]=vk(Qk),rC=/* @__PURE__ */sk(e=>{let{__scopeMenu:t,children:r,open:n=!1,onOpenChange:a}=e,o=Sk(Qk,t),i=bk(t),[s,l]=X.useState(null),[c,d]=X.useState(null),u=jd(a);return X.useEffect(()=>(!1===o.open&&u(!1),()=>u(!1)),[o.open,u]),/* @__PURE__ */be(Kw,{...i,children:/* @__PURE__ */be(wk,{scope:t,open:n,onOpenChange:u,content:c,onContentChange:d,children:/* @__PURE__ */be(eC,{scope:t,contentId:ud(),triggerId:ud(),trigger:s,onTriggerChange:l,children:r})})})},"MenuSub"),nC="MenuSubTrigger",aC=/* @__PURE__ */X.forwardRef(/* @__PURE__ */sk(function(e,t){let r=Sk(nC,e.__scopeMenu),n=Ck(nC,e.__scopeMenu),a=tC(nC,e.__scopeMenu),o=zk(nC,e.__scopeMenu),i=X.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:l}=o,c={__scopeMenu:e.__scopeMenu},d=X.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);X.useEffect(()=>d,[d]),X.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),l(null)}},[s,l]);let u=rd(t,a.onTriggerChange);/* @__PURE__ */
154
+ return be(Tk,{asChild:!0,...c,children:/* @__PURE__ */be(jk,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?a.contentId:void 0,"data-state":iC(r.open),...e,ref:u,onClick:t=>{e.onClick?.(t),!e.disabled&&!t.defaultPrevented&&(t.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:Yc(e.onPointerMove,mC(t=>{o.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!r.open&&!i.current&&(o.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{r.onOpenChange(!0),d()},100))})),onPointerLeave:Yc(e.onPointerLeave,mC(e=>{d();let t=r.content?.getBoundingClientRect();if(t){let n=r.content?.dataset.side,a="right"===n,i=a?-5:5,l=t[a?"left":"right"],c=t[a?"right":"left"];o.onPointerGraceIntentChange({area:[{x:e.clientX+i,y:e.clientY},{x:l,y:t.top},{x:c,y:t.top},{x:c,y:t.bottom},{x:l,y:t.bottom}],side:n}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(e),e.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:Yc(e.onKeyDown,t=>{e.disabled||t.target!==t.currentTarget||(""===o.searchRef.current||" "!==t.key)&&uk[n.dir].includes(t.key)&&(r.onOpenChange(!0),r.content?.focus(),t.preventDefault())})})})},"MenuSubTrigger")),oC=/* @__PURE__ */X.forwardRef(/* @__PURE__ */sk(function(e,t){let r=Dk(Ik,e.__scopeMenu),{forceMount:n=r.forceMount,align:a="start",...o}=e,i=Sk(Ik,e.__scopeMenu),s=Ck(Ik,e.__scopeMenu),l=tC("MenuSubContent",e.__scopeMenu),c=X.useRef(null),d=rd(t,c);/* @__PURE__ */
155
+ return be(mk.Provider,{scope:e.__scopeMenu,children:/* @__PURE__ */be(Cu,{present:n||i.open,children:/* @__PURE__ */be(mk.Slot,{scope:e.__scopeMenu,children:/* @__PURE__ */be(Fk,{id:l.contentId,"aria-labelledby":l.triggerId,...o,ref:d,align:a,side:"rtl"===s.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{s.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:Yc(e.onFocusOutside,e=>{e.target!==l.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Yc(e.onEscapeKeyDown,e=>{s.onClose(),e.preventDefault()}),onKeyDown:Yc(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),r=hk[s.dir].includes(e.key);t&&r&&(i.onOpenChange(!1),l.trigger?.focus(),e.preventDefault())})})})})})},"MenuSubContent"));function iC(e){return e?"open":"closed"}function sC(e){return"indeterminate"===e}function lC(e){return sC(e)?"indeterminate":e?"checked":"unchecked"}function cC(e){let t=document.activeElement;for(let r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function dC(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function uC(e,t,r){let n=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,a=r?e.indexOf(r):-1,o=dC(e,Math.max(a,0));1===n.length&&(o=o.filter(e=>e!==r));let i=o.find(e=>e.toLowerCase().startsWith(n.toLowerCase()));return i===r?void 0:i}function hC(e,t){let{x:r,y:n}=e,a=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){let e=t[o],s=t[i],l=e.x,c=e.y,d=s.x,u=s.y;c>n!=u>n&&r<(d-l)*(n-c)/(u-c)+l&&(a=!a)}return a}function pC(e,t){return!!t&&hC({x:e.clientX,y:e.clientY},t)}function mC(e){return t=>"mouse"===t.pointerType?e(t):void 0}sk(iC,"getOpenState"),sk(sC,"isIndeterminate"),sk(lC,"getCheckedState"),sk(cC,"focusFirst"),sk(dC,"wrapArray"),sk(uC,"getNextMatch"),sk(hC,"isPointInPolygon"),sk(pC,"isPointerInGraceArea"),sk(mC,"whenMouse");var fC=Nk,gC=Tk,vC=Ek,yC=_k,bC=Bk,xC=Hk,wC=qk,SC=Wk,kC=Zk,CC=Jk,NC=rC,TC=aC,AC=oC,MC=(Object.defineProperty,"DropdownMenu"),[DC,EC]=/* @__PURE__ */od(MC,[yk]),[IC,RC]=(yk(),DC(MC)),zC=/* @__PURE__ */Vc(e=>{var t="function"==typeof Symbol&&Symbol.for,r=t?Symbol.for("react.element"):60103,n=t?Symbol.for("react.portal"):60106,a=t?Symbol.for("react.fragment"):60107,o=t?Symbol.for("react.strict_mode"):60108,i=t?Symbol.for("react.profiler"):60114,s=t?Symbol.for("react.provider"):60109,l=t?Symbol.for("react.context"):60110,c=t?Symbol.for("react.async_mode"):60111,d=t?Symbol.for("react.concurrent_mode"):60111,u=t?Symbol.for("react.forward_ref"):60112,h=t?Symbol.for("react.suspense"):60113,p=t?Symbol.for("react.suspense_list"):60120,m=t?Symbol.for("react.memo"):60115,f=t?Symbol.for("react.lazy"):60116,g=t?Symbol.for("react.block"):60121,v=t?Symbol.for("react.fundamental"):60117,y=t?Symbol.for("react.responder"):60118,b=t?Symbol.for("react.scope"):60119;function x(e){if("object"==typeof e&&e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case c:case d:case a:case i:case o:case h:return e;default:switch(e&&=e.$$typeof,e){case l:case u:case f:case m:case s:return e;default:return t}}case n:return t}}}function w(e){return x(e)===d}e.AsyncMode=c,e.ConcurrentMode=d,e.ContextConsumer=l,e.ContextProvider=s,e.Element=r,e.ForwardRef=u,e.Fragment=a,e.Lazy=f,e.Memo=m,e.Portal=n,e.Profiler=i,e.StrictMode=o,e.Suspense=h,e.isAsyncMode=function(e){return w(e)||x(e)===c},e.isConcurrentMode=w,e.isContextConsumer=function(e){return x(e)===l},e.isContextProvider=function(e){return x(e)===s},e.isElement=function(e){return"object"==typeof e&&!!e&&e.$$typeof===r},e.isForwardRef=function(e){return x(e)===u},e.isFragment=function(e){return x(e)===a},e.isLazy=function(e){return x(e)===f},e.isMemo=function(e){return x(e)===m},e.isPortal=function(e){return x(e)===n},e.isProfiler=function(e){return x(e)===i},e.isStrictMode=function(e){return x(e)===o},e.isSuspense=function(e){return x(e)===h},e.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===d||e===i||e===o||e===h||e===p||"object"==typeof e&&!!e&&(e.$$typeof===f||e.$$typeof===m||e.$$typeof===s||e.$$typeof===l||e.$$typeof===u||e.$$typeof===v||e.$$typeof===y||e.$$typeof===b||e.$$typeof===g)},e.typeOf=x}),_C=/* @__PURE__ */Vc(e=>{"production"!==process.env.NODE_ENV&&function(){var t="function"==typeof Symbol&&Symbol.for,r=t?Symbol.for("react.element"):60103,n=t?Symbol.for("react.portal"):60106,a=t?Symbol.for("react.fragment"):60107,o=t?Symbol.for("react.strict_mode"):60108,i=t?Symbol.for("react.profiler"):60114,s=t?Symbol.for("react.provider"):60109,l=t?Symbol.for("react.context"):60110,c=t?Symbol.for("react.async_mode"):60111,d=t?Symbol.for("react.concurrent_mode"):60111,u=t?Symbol.for("react.forward_ref"):60112,h=t?Symbol.for("react.suspense"):60113,p=t?Symbol.for("react.suspense_list"):60120,m=t?Symbol.for("react.memo"):60115,f=t?Symbol.for("react.lazy"):60116,g=t?Symbol.for("react.block"):60121,v=t?Symbol.for("react.fundamental"):60117,y=t?Symbol.for("react.responder"):60118,b=t?Symbol.for("react.scope"):60119;function x(e){if("object"==typeof e&&e){var t=e.$$typeof;switch(t){case r:var p=e.type;switch(p){case c:case d:case a:case i:case o:case h:return p;default:var g=p&&p.$$typeof;switch(g){case l:case u:case f:case m:case s:return g;default:return t}}case n:return t}}}var w=c,S=d,k=l,C=s,N=r,T=u,A=a,M=f,D=m,E=n,I=i,R=o,z=h,_=!1;function P(e){return x(e)===d}e.AsyncMode=w,e.ConcurrentMode=S,e.ContextConsumer=k,e.ContextProvider=C,e.Element=N,e.ForwardRef=T,e.Fragment=A,e.Lazy=M,e.Memo=D,e.Portal=E,e.Profiler=I,e.StrictMode=R,e.Suspense=z,e.isAsyncMode=function(e){return _||(_=!0),P(e)||x(e)===c},e.isConcurrentMode=P,e.isContextConsumer=function(e){return x(e)===l},e.isContextProvider=function(e){return x(e)===s},e.isElement=function(e){return"object"==typeof e&&!!e&&e.$$typeof===r},e.isForwardRef=function(e){return x(e)===u},e.isFragment=function(e){return x(e)===a},e.isLazy=function(e){return x(e)===f},e.isMemo=function(e){return x(e)===m},e.isPortal=function(e){return x(e)===n},e.isProfiler=function(e){return x(e)===i},e.isStrictMode=function(e){return x(e)===o},e.isSuspense=function(e){return x(e)===h},e.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===d||e===i||e===o||e===h||e===p||"object"==typeof e&&!!e&&(e.$$typeof===f||e.$$typeof===m||e.$$typeof===s||e.$$typeof===l||e.$$typeof===u||e.$$typeof===v||e.$$typeof===y||e.$$typeof===b||e.$$typeof===g)},e.typeOf=x}()}),PC=/* @__PURE__ */Vc((e,t)=>{t.exports="production"===process.env.NODE_ENV?zC():_C()}),OC=/* @__PURE__ */Vc((e,t)=>{var r=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var e=/* @__PURE__ */new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(e){n[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch{return!1}}()?Object.assign:function(e,t){for(var o,i,s=function(e){if(null==e)throw TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),l=1;l<arguments.length;l++){for(var c in o=Object(arguments[l]))n.call(o,c)&&(s[c]=o[c]);if(r){i=r(o);for(var d=0;d<i.length;d++)a.call(o,i[d])&&(s[i[d]]=o[i[d]])}}return s}}),LC=/* @__PURE__ */Vc((e,t)=>{t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}),FC=/* @__PURE__ */Vc((e,t)=>{t.exports=Function.call.bind(Object.prototype.hasOwnProperty)}),BC=/* @__PURE__ */Vc((e,t)=>{var r=function(){};if("production"!==process.env.NODE_ENV){var n=LC(),a={},o=FC();r=function(e){var t="Warning: "+e;try{throw Error(t)}catch{}}}function i(e,t,i,s,l){if("production"!==process.env.NODE_ENV)for(var c in e)if(o(e,c)){var d;try{if("function"!=typeof e[c]){var u=Error((s||"React class")+": "+i+" type `"+c+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[c]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw u.name="Invariant Violation",u}d=e[c](t,c,s,i,null,n)}catch(e){d=e}if(d&&!(d instanceof Error)&&r((s||"React class")+": type specification of "+i+" `"+c+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof d+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),d instanceof Error&&!(d.message in a)){a[d.message]=!0;var h=l?l():"";r("Failed "+i+" type: "+d.message+(h??""))}}}i.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(a={})},t.exports=i}),VC=/* @__PURE__ */Vc((e,t)=>{var r=PC(),n=OC(),a=LC(),o=FC(),i=BC(),s=function(){};function l(){return null}"production"!==process.env.NODE_ENV&&(s=function(e){var t="Warning: "+e;try{throw Error(t)}catch{}}),t.exports=function(e,t){var c="function"==typeof Symbol&&Symbol.iterator;var d="<<anonymous>>",u={array:f("array"),bigint:f("bigint"),bool:f("boolean"),func:f("function"),number:f("number"),object:f("object"),string:f("string"),symbol:f("symbol"),any:m(l),arrayOf:function(e){return m(function(t,r,n,o,i){if("function"!=typeof e)return new p("Property `"+i+"` of component `"+n+"` has invalid PropType notation inside arrayOf.");var s=t[r];if(!Array.isArray(s))return new p("Invalid "+o+" `"+i+"` of type `"+y(s)+"` supplied to `"+n+"`, expected an array.");for(var l=0;l<s.length;l++){var c=e(s,l,n,o,i+"["+l+"]",a);if(c instanceof Error)return c}return null})},element:m(function(t,r,n,a,o){var i=t[r];return e(i)?null:new p("Invalid "+a+" `"+o+"` of type `"+y(i)+"` supplied to `"+n+"`, expected a single ReactElement.")}),elementType:m(function(e,t,n,a,o){var i=e[t];return r.isValidElementType(i)?null:new p("Invalid "+a+" `"+o+"` of type `"+y(i)+"` supplied to `"+n+"`, expected a single ReactElement type.")}),instanceOf:function(e){return m(function(t,r,n,a,o){if(!(t[r]instanceof e)){var i=e.name||d,s=function(e){return e.constructor&&e.constructor.name?e.constructor.name:d}(t[r]);return new p("Invalid "+a+" `"+o+"` of type `"+s+"` supplied to `"+n+"`, expected instance of `"+i+"`.")}return null})},node:m(function(e,t,r,n,a){return v(e[t])?null:new p("Invalid "+n+" `"+a+"` supplied to `"+r+"`, expected a ReactNode.")}),objectOf:function(e){return m(function(t,r,n,i,s){if("function"!=typeof e)return new p("Property `"+s+"` of component `"+n+"` has invalid PropType notation inside objectOf.");var l=t[r],c=y(l);if("object"!==c)return new p("Invalid "+i+" `"+s+"` of type `"+c+"` supplied to `"+n+"`, expected an object.");for(var d in l)if(o(l,d)){var u=e(l,d,n,i,s+"."+d,a);if(u instanceof Error)return u}return null})},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&s(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),l;return m(function(t,r,n,a,o){for(var i=t[r],s=0;s<e.length;s++)if(h(i,e[s]))return null;var l=JSON.stringify(e,function(e,t){return"symbol"===b(t)?String(t):t});return new p("Invalid "+a+" `"+o+"` of value `"+String(i)+"` supplied to `"+n+"`, expected one of "+l+".")})},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&s("Invalid argument supplied to oneOfType, expected an instance of array."),l;for(var t=0;t<e.length;t++){var r=e[t];if("function"!=typeof r)return s("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+x(r)+" at index "+t+"."),l}return m(function(t,r,n,i,s){for(var l=[],c=0;c<e.length;c++){var d=(0,e[c])(t,r,n,i,s,a);if(null==d)return null;d.data&&o(d.data,"expectedType")&&l.push(d.data.expectedType)}return new p("Invalid "+i+" `"+s+"` supplied to `"+n+"`"+(l.length>0?", expected one of type ["+l.join(", ")+"]":"")+".")})},shape:function(e){return m(function(t,r,n,o,i){var s=t[r],l=y(s);if("object"!==l)return new p("Invalid "+o+" `"+i+"` of type `"+l+"` supplied to `"+n+"`, expected `object`.");for(var c in e){var d=e[c];if("function"!=typeof d)return g(n,o,i,c,b(d));var u=d(s,c,n,o,i+"."+c,a);if(u)return u}return null})},exact:function(e){return m(function(t,r,i,s,l){var c=t[r],d=y(c);if("object"!==d)return new p("Invalid "+s+" `"+l+"` of type `"+d+"` supplied to `"+i+"`, expected `object`.");for(var u in n({},t[r],e)){var h=e[u];if(o(e,u)&&"function"!=typeof h)return g(i,s,l,u,b(h));if(!h)return new p("Invalid "+s+" `"+l+"` key `"+u+"` supplied to `"+i+"`.\nBad object: "+JSON.stringify(t[r],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var m=h(c,u,i,s,l+"."+u,a);if(m)return m}return null})}};function h(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function p(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function m(e){if("production"!==process.env.NODE_ENV)var r={},n=0;function o(o,i,l,c,u,h,m){if(c||=d,h||=l,m!==a){if(t){var f=/* @__PURE__ */Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}if("production"!==process.env.NODE_ENV&&typeof console<"u"){var g=c+":"+l;!r[g]&&n<3&&(s("You are manually calling a React.PropTypes validation function for the `"+h+"` prop on `"+c+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),r[g]=!0,n++)}}return null==i[l]?o?null===i[l]?new p("The "+u+" `"+h+"` is marked as required in `"+c+"`, but its value is `null`."):new p("The "+u+" `"+h+"` is marked as required in `"+c+"`, but its value is `undefined`."):null:e(i,l,c,u,h)}var i=o.bind(null,!1);return i.isRequired=o.bind(null,!0),i}function f(e){return m(function(t,r,n,a,o,i){var s=t[r];return y(s)!==e?new p("Invalid "+a+" `"+o+"` of type `"+b(s)+"` supplied to `"+n+"`, expected `"+e+"`.",{expectedType:e}):null})}function g(e,t,r,n,a){return new p((e||"React class")+": "+t+" type `"+r+"."+n+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+a+"`.")}function v(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(v);if(null===t||e(t))return!0;var r=function(e){var t=e&&(c&&e[c]||e["@@iterator"]);if("function"==typeof t)return t}(t);if(!r)return!1;var n,a=r.call(t);if(r!==t.entries){for(;!(n=a.next()).done;)if(!v(n.value))return!1}else for(;!(n=a.next()).done;){var o=n.value;if(o&&!v(o[1]))return!1}return!0;default:return!1}}function y(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function b(e){if(null==e)return""+e;var t=y(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function x(e){var t=b(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return p.prototype=Error.prototype,u.checkPropTypes=i,u.resetWarningCache=i.resetWarningCache,u.PropTypes=u,u}}),$C=/* @__PURE__ */Vc((e,t)=>{var r=LC();function n(){}function a(){}a.resetWarningCache=n,t.exports=function(){function e(e,t,n,a,o,i){if(i!==r){var s=/* @__PURE__ */Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var o={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:n};return o.PropTypes=o,o}}),HC=/* @__PURE__ */$c(/* @__PURE__ */Vc((e,t)=>{if("production"!==process.env.NODE_ENV){var r=PC();t.exports=VC()(r.isElement,!0)}else t.exports=$C()()})()),jC={grad:.9,turn:360,rad:360/(2*Math.PI)},qC=function(e){return"string"==typeof e?e.length>0:"number"==typeof e},UC=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=10**t),Math.round(r*e)/r+0},GC=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=1),e>r?r:e>t?e:t},WC=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},KC=function(e){return{r:GC(e.r,0,255),g:GC(e.g,0,255),b:GC(e.b,0,255),a:GC(e.a)}},YC=function(e){return{r:UC(e.r),g:UC(e.g),b:UC(e.b),a:UC(e.a,3)}},XC=/^#([0-9a-f]{3,8})$/i,ZC=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},JC=function(e){var t=e.r,r=e.g,n=e.b,a=e.a,o=Math.max(t,r,n),i=o-Math.min(t,r,n),s=i?o===t?(r-n)/i:o===r?2+(n-t)/i:4+(t-r)/i:0;return{h:60*(s<0?s+6:s),s:o?i/o*100:0,v:o/255*100,a:a}},QC=function(e){var t=e.h,r=e.s,n=e.v,a=e.a;t=t/360*6,r/=100,n/=100;var o=Math.floor(t),i=n*(1-r),s=n*(1-(t-o)*r),l=n*(1-(1-t+o)*r),c=o%6;return{r:255*[n,s,i,i,l,n][c],g:255*[l,n,n,s,i,i][c],b:255*[i,i,l,n,n,s][c],a:a}},eN=function(e){return{h:WC(e.h),s:GC(e.s,0,100),l:GC(e.l,0,100),a:GC(e.a)}},tN=function(e){return{h:UC(e.h),s:UC(e.s),l:UC(e.l),a:UC(e.a,3)}},rN=function(e){return QC((r=(t=e).s,{h:t.h,s:(r*=((n=t.l)<50?n:100-n)/100)>0?2*r/(n+r)*100:0,v:n+r,a:t.a}));var t,r,n},nN=function(e){return{h:(t=JC(e)).h,s:(a=(200-(r=t.s))*(n=t.v)/100)>0&&a<200?r*n/100/(a<=100?a:200-a)*100:0,l:a/2,a:t.a};var t,r,n,a},aN=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,oN=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,iN=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,sN=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,lN={string:[[function(e){var t=XC.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?UC(parseInt(e[3]+e[3],16)/255,2):1}:6===e.length||8===e.length?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:8===e.length?UC(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=iN.exec(e)||sN.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:KC({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t,r,n=aN.exec(e)||oN.exec(e);return n?rN(eN({h:(t=n[1],r=n[2],void 0===r&&(r="deg"),Number(t)*(jC[r]||1)),s:Number(n[3]),l:Number(n[4]),a:void 0===n[5]?1:Number(n[5])/(n[6]?100:1)})):null},"hsl"]],object:[[function(e){var t=e.r,r=e.g,n=e.b,a=e.a,o=void 0===a?1:a;return qC(t)&&qC(r)&&qC(n)?KC({r:Number(t),g:Number(r),b:Number(n),a:Number(o)}):null},"rgb"],[function(e){var t=e.h,r=e.s,n=e.l,a=e.a,o=void 0===a?1:a;return qC(t)&&qC(r)&&qC(n)?rN(eN({h:Number(t),s:Number(r),l:Number(n),a:Number(o)})):null},"hsl"],[function(e){var t=e.h,r=e.s,n=e.v,a=e.a,o=void 0===a?1:a;return qC(t)&&qC(r)&&qC(n)?QC(function(e){return{h:WC(e.h),s:GC(e.s,0,100),v:GC(e.v,0,100),a:GC(e.a)}}({h:Number(t),s:Number(r),v:Number(n),a:Number(o)})):null},"hsv"]]},cN=function(e,t){for(var r=0;r<t.length;r++){var n=t[r][0](e);if(n)return[n,t[r][1]]}return[null,void 0]},dN=function(e,t){var r=nN(e);return{h:r.h,s:GC(r.s+100*t,0,100),l:r.l,a:r.a}},uN=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},hN=function(e,t){var r=nN(e);return{h:r.h,s:r.s,l:GC(r.l+100*t,0,100),a:r.a}},pN=function(){function e(e){this.parsed=function(e){return"string"==typeof e?cN(e.trim(),lN.string):"object"==typeof e&&e?cN(e,lN.object):[null,void 0]}(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return null!==this.parsed},e.prototype.brightness=function(){return UC(uN(this.rgba),2)},e.prototype.isDark=function(){return uN(this.rgba)<.5},e.prototype.isLight=function(){return uN(this.rgba)>=.5},e.prototype.toHex=function(){return t=(e=YC(this.rgba)).r,r=e.g,n=e.b,o=(a=e.a)<1?ZC(UC(255*a)):"","#"+ZC(t)+ZC(r)+ZC(n)+o;var e,t,r,n,a,o},e.prototype.toRgb=function(){return YC(this.rgba)},e.prototype.toRgbString=function(){return t=(e=YC(this.rgba)).r,r=e.g,n=e.b,(a=e.a)<1?"rgba("+t+", "+r+", "+n+", "+a+")":"rgb("+t+", "+r+", "+n+")";var e,t,r,n,a},e.prototype.toHsl=function(){return tN(nN(this.rgba))},e.prototype.toHslString=function(){return t=(e=tN(nN(this.rgba))).h,r=e.s,n=e.l,(a=e.a)<1?"hsla("+t+", "+r+"%, "+n+"%, "+a+")":"hsl("+t+", "+r+"%, "+n+"%)";var e,t,r,n,a},e.prototype.toHsv=function(){return e=JC(this.rgba),{h:UC(e.h),s:UC(e.s),v:UC(e.v),a:UC(e.a,3)};var e},e.prototype.invert=function(){return mN({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},e.prototype.saturate=function(e){return void 0===e&&(e=.1),mN(dN(this.rgba,e))},e.prototype.desaturate=function(e){return void 0===e&&(e=.1),mN(dN(this.rgba,-e))},e.prototype.grayscale=function(){return mN(dN(this.rgba,-1))},e.prototype.lighten=function(e){return void 0===e&&(e=.1),mN(hN(this.rgba,e))},e.prototype.darken=function(e){return void 0===e&&(e=.1),mN(hN(this.rgba,-e))},e.prototype.rotate=function(e){return void 0===e&&(e=15),this.hue(this.hue()+e)},e.prototype.alpha=function(e){return"number"==typeof e?mN({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):UC(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=nN(this.rgba);return"number"==typeof e?mN({h:e,s:t.s,l:t.l,a:t.a}):UC(t.h)},e.prototype.isEqual=function(e){return this.toHex()===mN(e).toHex()},e}(),mN=function(e){return e instanceof pN?e:new pN(e)},fN=[];var gN={"3d":/*#__PURE__*/Z.createElement("path",{d:"M18 14.625V3.375L9 0 0 3.375v11.25L9 18l9-3.375zM9 2.136l5.918 2.22-5.98 2.242-5.919-2.22L9 2.137zM2 13.239V5.065l6.438 2.414v8.174L2 13.24zM9.438 15.7L16 13.239V5.018l-6.563 2.46V15.7z",transform:"translate(15 10)",fillRule:"evenodd"}),acrobat:/*#__PURE__*/Z.createElement("path",{d:"M10.15 1.095C9.938.33 9.42-.051 8.984.005c-.528.068-1.09.382-1.314.876-.63 1.416.685 5.582.887 6.279-1.28 3.863-5.66 11.5-7.806 12.017-.045-.505.225-1.965 3.055-3.785.146-.157.315-.348.393-.472-2.392 1.168-5.492 3.044-3.628 4.448.102.079.259.146.439.213 1.426.528 3.425-1.201 5.435-5.121 2.213-.73 3.999-1.28 6.526-1.662 2.762 1.875 4.616 2.257 5.874 1.774.348-.135.898-.573 1.055-1.145-1.022 1.258-3.414.382-5.323-.82 1.763-.191 3.582-.303 4.369-.056 1 .314.965.808.954.876.079-.27.191-.708-.022-1.056-.842-1.37-4.706-.573-6.11-.427-2.212-1.336-3.74-3.717-4.358-5.436.573-2.212 1.19-3.818.742-5.413zm-.954 4.638C8.826 4.42 8.309 1.5 9.14.556c1.628.932.618 3.144.056 5.177zm3.044 6.514c-2.134.393-3.583.944-5.66 1.764.617-1.202 1.785-4.268 2.346-6.29.787 1.573 1.741 3.111 3.314 4.526z",transform:"translate(14 9)",fillRule:"evenodd"}),android:/*#__PURE__*/Z.createElement("path",{d:"M17.6,9.48l1.84-3.18c0.16-0.31,0.04-0.69-0.26-0.85c-0.29-0.15-0.65-0.06-0.83,0.22l-1.88,3.24 c-2.86-1.21-6.08-1.21-8.94,0L5.65,5.67c-0.19-0.29-0.58-0.38-0.87-0.2C4.5,5.65,4.41,6.01,4.56,6.3L6.4,9.48 C3.3,11.25,1.28,14.44,1,18h22C22.72,14.44,20.7,11.25,17.6,9.48z M7,15.25c-0.69,0-1.25-0.56-1.25-1.25 c0-0.69,0.56-1.25,1.25-1.25S8.25,13.31,8.25,14C8.25,14.69,7.69,15.25,7,15.25z M17,15.25c-0.69,0-1.25-0.56-1.25-1.25 c0-0.69,0.56-1.25,1.25-1.25s1.25,0.56,1.25,1.25C18.25,14.69,17.69,15.25,17,15.25z",transform:"translate(12 8)"}),audio:/*#__PURE__*/Z.createElement("path",{d:"M.25 4.75v4.5h3L7 13V1L3.25 4.75h-3zM10.375 7A3.375 3.375 0 0 0 8.5 3.977v6.037A3.355 3.355 0 0 0 10.375 7zM8.5.421v1.545A5.254 5.254 0 0 1 12.25 7a5.254 5.254 0 0 1-3.75 5.032v1.545A6.747 6.747 0 0 0 13.75 7 6.747 6.747 0 0 0 8.5.421z",transform:"translate(17 12)",fillRule:"evenodd"}),binary:/*#__PURE__*/Z.createElement("path",{d:"M2.338 6.112c1.192 0 1.928-1.072 1.928-2.68 0-1.56-.576-2.504-1.8-2.504C1.274.928.538 2 .538 3.608c0 1.56.576 2.504 1.8 2.504zM1.61 3.408c0-1.008.24-1.568.776-1.568.376 0 .616.336.728.888l-1.504.776v-.096zM2.418 5.2c-.368 0-.608-.32-.72-.856l1.496-.768v.056c0 1.008-.24 1.568-.776 1.568zm7.03.8l.088-.944H8.36V.896L7.272.984v.592l-1.184.112.024.824h1.16v2.544h-1.32V6zm5.199 0l.088-.944h-1.176V.896L12.47.984v.592l-1.184.112.024.824h1.16v2.544h-1.32V6zM4.25 14l.088-.944H3.162v-4.16l-1.088.088v.592L.89 9.688l.024.824h1.16v2.544H.754V14zm5.198 0l.088-.944H8.36v-4.16l-1.088.088v.592l-1.184.112.024.824h1.16v2.544h-1.32V14zm3.287.112c1.192 0 1.928-1.072 1.928-2.68 0-1.56-.576-2.504-1.8-2.504-1.192 0-1.928 1.072-1.928 2.68 0 1.56.576 2.504 1.8 2.504zm-.728-2.704c0-1.008.24-1.568.776-1.568.376 0 .616.336.728.888l-1.504.776v-.096zm.808 1.792c-.368 0-.608-.32-.72-.856l1.496-.768v.056c0 1.008-.24 1.568-.776 1.568z",transform:"translate(16 11)",fillRule:"evenodd"}),code:/*#__PURE__*/Z.createElement("path",{d:"M4.078 13.67c-1.875-.527-2.812-1.738-2.812-3.634V9.49C1.266 8.437.844 7.911 0 7.911V6.138c.844 0 1.266-.529 1.266-1.586v-.64c.015-.938.257-1.696.726-2.274C2.466 1.06 3.162.64 4.078.38l.492 1.375c-.656.25-.997.95-1.023 2.102v.695c0 1.167-.482 1.99-1.445 2.469.963.479 1.445 1.304 1.445 2.476v.688c.026 1.15.367 1.851 1.023 2.101l-.492 1.383zm7.844 0c1.875-.527 2.812-1.738 2.812-3.634V9.49c0-1.052.422-1.578 1.266-1.578V6.138c-.844 0-1.266-.529-1.266-1.586v-.64c-.015-.938-.257-1.696-.726-2.274-.474-.578-1.17-.998-2.086-1.258l-.492 1.375c.656.25.997.95 1.023 2.102v.695c0 1.167.482 1.99 1.445 2.469-.963.479-1.445 1.304-1.445 2.476v.688c-.026 1.15-.367 1.851-1.023 2.101l.492 1.383z",transform:"translate(16 13)",fillRule:"evenodd"}),code2:/*#__PURE__*/Z.createElement("path",{d:"M7.4 10.6L2.8 6l4.6-4.6L6 0 0 6l6 6 1.4-1.4zm5.2 0L17.2 6l-4.6-4.6L14 0l6 6-6 6-1.4-1.4z",transform:"translate(14 14)",fillRule:"evenodd"}),compressed:/*#__PURE__*/Z.createElement("path",{d:"M.25 0A.25.25 0 0 0 0 .25v1.5c0 .138.112.25.25.25h1.5A.25.25 0 0 0 2 1.75V.25A.25.25 0 0 0 1.75 0H.25zM1 17a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-6a1 1 0 0 0-1-1H1zm0 4v3h2v-3H1zM2 2.25A.25.25 0 0 1 2.25 2h1.5a.25.25 0 0 1 .25.25v1.5a.25.25 0 0 1-.25.25h-1.5A.25.25 0 0 1 2 3.75v-1.5zM.25 4a.25.25 0 0 0-.25.25v1.5c0 .138.112.25.25.25h1.5A.25.25 0 0 0 2 5.75v-1.5A.25.25 0 0 0 1.75 4H.25zM2 6.25A.25.25 0 0 1 2.25 6h1.5a.25.25 0 0 1 .25.25v1.5a.25.25 0 0 1-.25.25h-1.5A.25.25 0 0 1 2 7.75v-1.5zM.25 8a.25.25 0 0 0-.25.25v1.5c0 .138.112.25.25.25h1.5A.25.25 0 0 0 2 9.75v-1.5A.25.25 0 0 0 1.75 8H.25zM2 10.25a.25.25 0 0 1 .25-.25h1.5a.25.25 0 0 1 .25.25v1.5a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25v-1.5zM.25 12a.25.25 0 0 0-.25.25v1.5c0 .138.112.25.25.25h1.5a.25.25 0 0 0 .25-.25v-1.5a.25.25 0 0 0-.25-.25H.25zM2 14.25a.25.25 0 0 1 .25-.25h1.5a.25.25 0 0 1 .25.25v1.5a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25v-1.5z",transform:"translate(15 1)",fillRule:"evenodd"}),document:/*#__PURE__*/Z.createElement("path",{d:"M12 4H0v2h12V4zM0 10h18V8H0v2zM0 0v2h18V0H0z",transform:"translate(15 15)",fillRule:"evenodd"}),drive:/*#__PURE__*/Z.createElement("path",{d:"M2.199.289A.5.5 0 0 1 2.652 0h8.696a.5.5 0 0 1 .453.289l1.867 4a.5.5 0 0 1-.453.711H.785a.5.5 0 0 1-.453-.711l1.867-4zM13 6H1a.752.752 0 0 0-.75.75v4.5c0 .412.338.75.75.75h12c.412 0 .75-.338.75-.75v-4.5A.752.752 0 0 0 13 6zm-9.75 4.5c-.825 0-1.5-.675-1.5-1.5s.675-1.5 1.5-1.5 1.5.675 1.5 1.5-.675 1.5-1.5 1.5z",transform:"translate(17 13)",fillRule:"evenodd"}),font:/*#__PURE__*/Z.createElement("path",{d:"M3.722 8.702l-.686 1.89c-.053.14-.094.28-.123.421-.03.135-.044.252-.044.352 0 .304.097.527.29.668.2.14.501.21.905.21h.414V13H.083v-.756h.343c.176 0 .325-.018.448-.053a.81.81 0 0 0 .334-.22c.1-.105.193-.249.281-.43.094-.182.197-.416.308-.704L5.787.15h1.406l4.07 11.136c.07.187.14.343.21.466.077.123.165.222.264.298.1.07.214.12.343.15.129.03.281.044.457.044h.237V13H7.826v-.756h.413c.72 0 1.081-.287 1.081-.862 0-.1-.014-.202-.044-.307a3.274 3.274 0 0 0-.105-.36l-.72-2.013H3.72zM7.009 4.65c-.188-.533-.36-1.031-.519-1.494a15.92 15.92 0 0 1-.378-1.354 7.12 7.12 0 0 1-.15.633 16.95 16.95 0 0 1-.395 1.283c-.082.229-.175.484-.28.765L4.063 7.796h4.061L7.009 4.65zm8.411 5.74c0 .562.117.984.351 1.265.24.275.61.413 1.108.413.363 0 .691-.059.984-.176.3-.117.551-.284.756-.5.211-.218.372-.481.483-.792.112-.31.168-.656.168-1.037V8.104l-1.152.053c-.51.023-.937.088-1.283.193-.34.1-.615.243-.826.43a1.546 1.546 0 0 0-.457.678c-.088.27-.132.58-.132.931zm2.18-6.32c-.346 0-.627.05-.844.15a1.182 1.182 0 0 0-.501.404 1.594 1.594 0 0 0-.237.624c-.041.24-.062.5-.062.782-.498 0-.879-.085-1.143-.255-.257-.17-.386-.463-.386-.879 0-.31.085-.574.255-.79.17-.218.401-.393.694-.528.299-.14.644-.243 1.037-.308a7.76 7.76 0 0 1 1.257-.097c.55 0 1.031.056 1.441.167.41.106.753.282 1.029.528.275.246.48.568.615.967.14.392.21.876.21 1.45v4.667c0 .252.021.46.062.624a.928.928 0 0 0 .194.395c.088.1.202.17.343.211.146.041.319.062.518.062h.053V13H19.7l-.281-1.547h-.15c-.187.252-.369.483-.544.694-.176.211-.37.393-.58.545-.211.152-.452.27-.721.352a3.053 3.053 0 0 1-.958.131c-.399 0-.77-.058-1.116-.175a2.369 2.369 0 0 1-.888-.519 2.516 2.516 0 0 1-.58-.896c-.14-.364-.211-.791-.211-1.284 0-.955.34-1.664 1.02-2.127.68-.462 1.707-.714 3.084-.755l1.495-.053V6.285a6.93 6.93 0 0 0-.053-.888 1.778 1.778 0 0 0-.229-.703 1.14 1.14 0 0 0-.51-.457c-.216-.111-.51-.167-.878-.167z",transform:"translate(13 12)",fillRule:"evenodd"}),image:/*#__PURE__*/Z.createElement("path",{d:"M13 0L9.25 5l2.85 3.8-1.6 1.2C8.81 7.75 6 4 6 4l-6 8h22L13 0z",transform:"translate(13 14)",fillRule:"evenodd"}),presentation:/*#__PURE__*/Z.createElement("path",{d:"M2 4H0v10c0 1.1.9 2 2 2h14v-2H2V4zm16-4H6C4.9 0 4 .9 4 2v8c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V2c0-1.1-.9-2-2-2zm0 10H6V2h12v8z",transform:"matrix(-1 0 0 1 34 12)",fillRule:"evenodd"}),settings:/*#__PURE__*/Z.createElement("path",{d:"M13.572 8.735c.03-.24.053-.48.053-.735s-.023-.495-.053-.735l1.583-1.237a.378.378 0 0 0 .09-.48l-1.5-2.595a.377.377 0 0 0-.457-.165l-1.868.75a5.48 5.48 0 0 0-1.268-.735L9.868.815A.366.366 0 0 0 9.5.5h-3a.366.366 0 0 0-.367.315l-.285 1.988a5.762 5.762 0 0 0-1.268.735l-1.868-.75a.366.366 0 0 0-.457.165l-1.5 2.595a.37.37 0 0 0 .09.48l1.583 1.237c-.03.24-.053.488-.053.735 0 .248.022.495.053.735L.845 9.973a.378.378 0 0 0-.09.48l1.5 2.595c.09.165.292.225.458.165l1.867-.75c.39.3.81.547 1.268.735l.285 1.987c.022.18.18.315.367.315h3a.366.366 0 0 0 .367-.315l.285-1.988a5.762 5.762 0 0 0 1.268-.734l1.867.75c.173.067.368 0 .458-.165l1.5-2.595a.378.378 0 0 0-.09-.48l-1.582-1.238zM8 10.625A2.628 2.628 0 0 1 5.375 8 2.628 2.628 0 0 1 8 5.375 2.628 2.628 0 0 1 10.625 8 2.628 2.628 0 0 1 8 10.625z",transform:"translate(16 11)",fillRule:"evenodd"}),spreadsheet:/*#__PURE__*/Z.createElement("path",{d:"M0 8h6V5H0v3zm0 5h6v-3H0v3zM0 3h6V0H0v3zm8 5h12V5H8v3zm0 5h12v-3H8v3zM8 0v3h12V0H8z",transform:"translate(14 14)",fillRule:"evenodd"}),vector:/*#__PURE__*/Z.createElement("path",{d:"M14.5 2V1a1 1 0 0 0-1-1h-3a1 1 0 0 0-1 1v1H3.937a2 2 0 1 0 0 1h3.936A9 9 0 0 0 3 11v1h2v-1a7.003 7.003 0 0 1 4.594-6.576A1 1 0 0 0 10.5 5h3a1 1 0 0 0 .906-.576A7.003 7.003 0 0 1 19 11v1h2v-1a9 9 0 0 0-4.873-8h3.936a2 2 0 1 0 0-1H14.5zm-1-1h-3v3h3V1zM2 1.5a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm19 1a1 1 0 1 0 2 0 1 1 0 0 0-2 0z",transform:"translate(12 14)",fillRule:"evenodd"}),video:/*#__PURE__*/Z.createElement("path",{d:"M10.75 3.875V1.25A.752.752 0 0 0 10 .5H1a.752.752 0 0 0-.75.75v7.5c0 .412.338.75.75.75h9c.412 0 .75-.338.75-.75V6.125l3 3V.875l-3 3z",transform:"translate(17 14)"})};!function(e){e.forEach(function(e){fN.indexOf(e)<0&&(e(pN,lN),fN.push(e))})}([function(e,t){var r={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},n={};for(var a in r)n[r[a]]=a;var o={};e.prototype.toName=function(t){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,i,s=n[this.toHex()];if(s)return s;if(t?.closest){var l=this.toRgb(),c=1/0,d="black";if(!o.length)for(var u in r)o[u]=new e(r[u]).toRgb();for(var h in r){var p=(a=l,i=o[h],(a.r-i.r)**2+(a.g-i.g)**2+(a.b-i.b)**2);p<c&&(c=p,d=h)}return d}},t.string.push([function(t){var n=t.toLowerCase(),a="transparent"===n?"#0000":r[n];return a?new e(a).toRgb():null},"name"])}]);var vN={color:HC.default.string,extension:HC.default.string,fold:HC.default.bool,foldColor:HC.default.string,glyphColor:HC.default.string,gradientColor:HC.default.string,gradientOpacity:HC.default.number,labelColor:HC.default.string,labelTextColor:HC.default.string,labelUppercase:HC.default.bool,radius:HC.default.number,type:HC.default.oneOf(["3d","acrobat","android","audio","binary","code","code2","compressed","document","drive","font","image","presentation","settings","spreadsheet","vector","video"])},yN=40,bN=48,xN={WIDTH:yN,HEIGHT:bN,X_OFFSET:0},wN=12,SN=Z.useId||function(){var e=0;return function(){return e++}}(),kN=function(e){var t=e.color,r=void 0===t?"whitesmoke":t,n=e.extension,a=e.fold,o=void 0===a||a,i=e.foldColor,s=e.glyphColor,l=e.gradientColor,c=void 0===l?"white":l,d=e.gradientOpacity,u=void 0===d?.25:d,h=e.labelColor,p=e.labelTextColor,m=void 0===p?"white":p,f=e.labelUppercase,g=void 0!==f&&f,v=e.radius,y=void 0===v?4:v,b=e.type,x=SN(),w=typeof jest>"u"?x:"";/*#__PURE__*/
156
+ return Z.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 "+yN+" "+bN,width:"100%",style:{maxWidth:"100%"}},/*#__PURE__*/Z.createElement("defs",null,/*#__PURE__*/Z.createElement("clipPath",{id:"pageRadius"+w},/*#__PURE__*/Z.createElement("rect",{x:xN.X_OFFSET,y:"0",rx:y,ry:y,width:xN.WIDTH,height:xN.HEIGHT})),/*#__PURE__*/Z.createElement("clipPath",{id:"foldCrop"+w},/*#__PURE__*/Z.createElement("rect",{width:xN.WIDTH,height:wN,transform:"rotate(-45 0 "+wN+")"})),/*#__PURE__*/Z.createElement("linearGradient",{x1:"100%",y1:"0%",y2:"100%",id:"pageGradient"+w},/*#__PURE__*/Z.createElement("stop",{stopColor:c,stopOpacity:u,offset:"0%"}),/*#__PURE__*/Z.createElement("stop",{stopColor:c,stopOpacity:"0",offset:"66.67%"}))),/*#__PURE__*/Z.createElement("g",{id:"file",clipPath:"url(#pageRadius"+w+")"},o?/*#__PURE__*/Z.createElement(Z.Fragment,null,/*#__PURE__*/Z.createElement("path",{d:"M"+xN.X_OFFSET+" 0 h "+(xN.WIDTH-wN)+" L "+(xN.WIDTH+xN.X_OFFSET)+" "+wN+" v "+(xN.HEIGHT-wN)+" H "+xN.X_OFFSET+" Z",fill:r}),/*#__PURE__*/Z.createElement("path",{d:"M"+xN.X_OFFSET+" 0 h "+(xN.WIDTH-wN)+" L "+(xN.WIDTH+xN.X_OFFSET)+" "+wN+" v "+(xN.HEIGHT-wN)+" H "+xN.X_OFFSET+" Z",fill:"url(#pageGradient"+w+")"})):/*#__PURE__*/Z.createElement(Z.Fragment,null,/*#__PURE__*/Z.createElement("rect",{x:xN.X_OFFSET,y:"0",width:xN.WIDTH,height:xN.HEIGHT,fill:r}),/*#__PURE__*/Z.createElement("rect",{x:xN.X_OFFSET,y:"0",width:xN.WIDTH,height:xN.HEIGHT,fill:"url(#pageGradient"+w+")"}))),o&&/*#__PURE__*/Z.createElement("g",{transform:"translate(28 "+wN+") rotate(-90)"},/*#__PURE__*/Z.createElement("rect",{width:xN.WIDTH,height:xN.HEIGHT,fill:i||mN(r).darken(.1).toHex(),rx:y,ry:y,clipPath:"url(#foldCrop"+w+")"})),n&&/*#__PURE__*/Z.createElement(Z.Fragment,null,/*#__PURE__*/Z.createElement("g",{id:"label"+w},/*#__PURE__*/Z.createElement("rect",{fill:h||mN(r).darken(.3).toHex(),x:xN.X_OFFSET,y:xN.HEIGHT-14,width:xN.WIDTH,height:14,clipPath:"url(#pageRadius"+w+")"})),/*#__PURE__*/Z.createElement("g",{id:"labelText"+w,transform:"translate("+xN.X_OFFSET+" 34)"},/*#__PURE__*/Z.createElement("text",{x:xN.WIDTH/2,y:"10",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif",fontSize:"9",fill:m,textAnchor:"middle",style:{fontWeight:"bold",textAlign:"center",pointerEvents:"none",textTransform:g?"uppercase":"none",userSelect:"none"}},n))),b&&/*#__PURE__*/Z.createElement("g",{transform:"translate(-4 "+(n?0:6)+")",fill:s||mN(r).darken(.15).toHex()},gN[b]))};kN.propTypes=vN;var CN={"3dm":{labelColor:"#8D1A11",type:"3d"},"3ds":{labelColor:"#5FB9AD",type:"3d"},"3g2":{type:"video"},"3gp":{type:"video"},"7zip":{type:"compressed"},aab:{type:"android",labelColor:"#3DDC84"},aac:{type:"audio"},aep:{type:"video"},ai:{color:"#423325",gradientOpacity:0,labelColor:"#423325",labelTextColor:"#FF7F18",labelUppercase:!0,foldColor:"#FF7F18",radius:2},aif:{type:"audio"},aiff:{type:"audio"},apk:{type:"android",labelColor:"#3DDC84"},apkm:{type:"android",labelColor:"#3DDC84"},apks:{type:"android",labelColor:"#3DDC84"},asf:{type:"video"},asp:{type:"code"},aspx:{type:"code"},avi:{type:"video"},bin:{type:"binary"},bmp:{type:"image"},c:{type:"code"},cpp:{type:"code"},cs:{type:"code"},css:{type:"code"},csv:{type:"spreadsheet"},cue:{type:"document"},dll:{type:"settings"},dmg:{type:"drive"},doc:{color:"#2C5898",foldColor:"#254A80",glyphColor:"rgba(255,255,255,0.4)",labelColor:"#2C5898",labelUppercase:!0,type:"document"},docx:{color:"#2C5898",foldColor:"#254A80",glyphColor:"rgba(255,255,255,0.4)",labelColor:"#2C5898",labelUppercase:!0,type:"document"},dwg:{type:"vector"},dxf:{type:"vector"},eot:{type:"font"},eps:{type:"vector"},exe:{type:"settings"},flac:{type:"audio"},flv:{type:"video"},fnt:{type:"font"},fodp:{type:"presentation"},fods:{type:"spreadsheet"},fodt:{type:"document"},fon:{type:"font"},gif:{type:"image"},gz:{type:"compressed"},heic:{type:"image"},htm:{type:"code"},html:{type:"code"},indd:{color:"#4B2B36",gradientOpacity:0,labelColor:"#4B2B36",labelTextColor:"#FF408C",labelUppercase:!0,foldColor:"#FF408C",radius:2},ini:{type:"settings"},java:{type:"code"},jpeg:{type:"image"},jpg:{type:"image"},js:{labelColor:"#F7DF1E",type:"code"},json:{type:"code"},jsx:{labelColor:"#00D8FF",type:"code"},m4a:{type:"audio"},m4v:{type:"video"},max:{labelColor:"#5FB9AD",type:"3d"},md:{type:"document"},mid:{type:"audio"},mkv:{type:"video"},mov:{type:"video"},mp3:{type:"audio"},mp4:{type:"video"},mpeg:{type:"video"},mpg:{type:"video"},obj:{type:"3d"},odp:{type:"presentation"},ods:{type:"spreadsheet"},odt:{type:"document"},ogg:{type:"audio"},ogv:{type:"video"},otf:{type:"font"},pdf:{labelColor:"#D93831",type:"acrobat"},php:{labelColor:"#8892BE",type:"code"},pkg:{type:"3d"},plist:{type:"settings"},png:{type:"image"},ppt:{color:"#D14423",foldColor:"#AB381D",glyphColor:"rgba(255,255,255,0.4)",labelColor:"#D14423",labelUppercase:!0,type:"presentation"},pptx:{color:"#D14423",foldColor:"#AB381D",glyphColor:"rgba(255,255,255,0.4)",labelColor:"#D14423",labelUppercase:!0,type:"presentation"},pr:{type:"video"},ps:{type:"vector"},psd:{color:"#34364E",gradientOpacity:0,labelColor:"#34364E",labelTextColor:"#31C5F0",labelUppercase:!0,foldColor:"#31C5F0",radius:2},py:{labelColor:"#FFDE57",type:"code"},rar:{type:"compressed"},rb:{labelColor:"#BB271A",type:"code"},rm:{type:"video"},rtf:{type:"document"},scss:{labelColor:"#C16A98",type:"code"},sitx:{type:"compressed"},skp:{type:"3d"},svg:{type:"vector"},swf:{type:"video"},sys:{type:"settings"},tar:{type:"compressed"},tex:{type:"document"},tif:{type:"image"},tiff:{type:"image"},ts:{labelColor:"#3478C7",type:"code"},ttf:{type:"font"},txt:{type:"document"},wav:{type:"audio"},webm:{type:"video"},wmv:{type:"video"},woff:{type:"font"},wpd:{type:"document"},wps:{type:"document"},xapk:{type:"android",labelColor:"#3DDC84"},xlr:{type:"spreadsheet"},xls:{color:"#1A754C",foldColor:"#16613F",glyphColor:"rgba(255,255,255,0.4)",labelColor:"#1A754C",labelUppercase:!0,type:"spreadsheet"},xlsx:{color:"#1A754C",foldColor:"#16613F",glyphColor:"rgba(255,255,255,0.4)",labelColor:"#1A754C",labelUppercase:!0,type:"spreadsheet"},yml:{type:"code"},zip:{type:"compressed"},zipx:{type:"compressed"}},NN={sm:14,md:18,lg:24};function TN({filename:e,size:t="sm"}){let r=function(e){let t=e.lastIndexOf(".");return-1===t?"":e.slice(t+1).toLowerCase()}(e),n="number"==typeof t?t:NN[t];/* @__PURE__ */
157
+ return be("span",{className:"shrink-0 inline-flex",style:{width:n,height:n},"aria-hidden":!0,children:/* @__PURE__ */be(kN,{extension:r||void 0,...r?CN[r]??{}:{}})})}var AN=[{type:"openTabs",label:"Open Tabs",icon:Up},{type:"files",label:"Files",icon:_p},{type:"outline",label:"Outline",icon:um},{type:"related",label:"Related",icon:Kp},{type:"ai",label:"AI",icon:im}],MN=Object.defineProperty,DN=Object.defineProperties,EN=Object.getOwnPropertyDescriptors,IN=Object.getOwnPropertySymbols,RN=Object.prototype.hasOwnProperty,zN=Object.prototype.propertyIsEnumerable,_N=(e,t,r)=>t in e?MN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,PN=(e,t)=>{for(var r in t||={})RN.call(t,r)&&_N(e,r,t[r]);if(IN)for(var r of IN(t))zN.call(t,r)&&_N(e,r,t[r]);return e},ON=(e,t)=>DN(e,EN(t)),LN=(e,t,r)=>new Promise((n,a)=>{var o=e=>{try{s(r.next(e))}catch(e){a(e)}},i=e=>{try{s(r.throw(e))}catch(e){a(e)}},s=e=>e.done?n(e.value):Promise.resolve(e.value).then(o,i);s((r=r.apply(e,t)).next())});function FN(e,t){return"function"==typeof e?e(t):e}function BN(e,t){return r=>{t.setState(t=>ON(PN({},t),{[e]:FN(r,t[e])}))}}var VN=(e,t=100,r=1e3)=>new Promise(n=>{let a,o=setInterval(()=>{e()&&(n(),clearInterval(o),clearTimeout(a))},t);a=setTimeout(()=>{clearInterval(o),n()},r)}),$N=e=>Error("Headless Tree: "+e),HN={key:"tree",getInitialState:e=>PN({expandedItems:[],focusedItem:null},e),getDefaultConfig:(e,t)=>PN({setExpandedItems:BN("expandedItems",t),setFocusedItem:BN("focusedItem",t)},e),stateHandlerNames:{expandedItems:"setExpandedItems",focusedItem:"setFocusedItem"},treeInstance:{getItemsMeta:({tree:e})=>{let{rootItemId:t}=e.getConfig(),{expandedItems:r}=e.getState(),n=[],a=new Set(r),o=(t,r,i,s,l)=>{if(r.includes(t))r.join(".");else if(n.push({itemId:t,level:i,index:n.length,parentId:r.at(-1),setSize:s,posInSet:l}),a.has(t)){let n=e.retrieveChildrenIds(t)??[],a=0;for(let e of n)o(e,r.concat(t),i+1,n.length,a++)}},i=e.retrieveChildrenIds(t),s=0;for(let l of i)o(l,[t],0,i.length,s++);return n},getFocusedItem:({tree:e})=>{let t=e.getState().focusedItem;return(null===t?null:e.getItemInstance(t))??e.getItems()[0]},getRootItem:({tree:e})=>{let{rootItemId:t}=e.getConfig();return e.getItemInstance(t)},focusNextItem:({tree:e})=>{var t;let r=e.getFocusedItem().getItemMeta();if(!r)return;let n=Math.min(r.index+1,e.getItems().length-1);null==(t=e.getItems()[n])||t.setFocused()},focusPreviousItem:({tree:e})=>{var t;let r=e.getFocusedItem().getItemMeta();if(!r)return;let n=Math.max(r.index-1,0);null==(t=e.getItems()[n])||t.setFocused()},updateDomFocus:({tree:e})=>{setTimeout(()=>LN(null,null,function*(){var t,r,n,a;let o=e.getFocusedItem();null==(r=(t=e.getConfig()).scrollToItem)||r.call(t,o),yield VN(()=>null!==o.getElement(),20,500);let i=o.getElement();if(!i)return null==(n=e.getItems()[0])||n.setFocused(),void(null==(a=e.getItems()[0]?.getElement())||a.focus());i.focus()}))},getContainerProps:({prev:e,tree:t},r)=>ON(PN({},e?.()),{role:"tree","aria-label":r??"",ref:t.registerElement}),isSearchOpen:()=>!1},itemInstance:{scrollTo:(e,t)=>LN(null,[e,t],function*({tree:e,item:t},r){var n,a,o;null==(a=(n=e.getConfig()).scrollToItem)||a.call(n,t),yield VN(()=>null!==t.getElement(),20),null==(o=t.getElement())||o.scrollIntoView(r)}),getId:({itemId:e})=>e,getKey:({itemId:e})=>e,getProps:({item:e,prev:t})=>{let r=e.getItemMeta();return ON(PN({},t?.()),{ref:e.registerElement,role:"treeitem","aria-setsize":r.setSize,"aria-posinset":r.posInSet+1,"aria-selected":"false","aria-label":e.getItemName(),"aria-level":r.level+1,"aria-expanded":e.isFolder()?e.isExpanded():void 0,tabIndex:e.isFocused()?0:-1,onClick:t=>{e.setFocused(),e.primaryAction(),!(t.ctrlKey||t.shiftKey||t.metaKey)&&e.isFolder()&&(e.isExpanded()?e.collapse():e.expand())}})},expand:({tree:e,item:t,itemId:r})=>{t.isFolder()&&(e.getState().loadingItemChildrens?.includes(r)||(e.applySubStateUpdate("expandedItems",e=>[...e,r]),e.rebuildTree()))},collapse:({tree:e,item:t,itemId:r})=>{t.isFolder()&&(e.applySubStateUpdate("expandedItems",e=>e.filter(e=>e!==r)),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)=>{let r=e.getParent();return!(r?.getId()!==t&&!r?.isDescendentOf(t))},isFocused:({tree:e,item:t,itemId:r})=>e.getState().focusedItem===r||null===e.getState().focusedItem&&0===t.getItemMeta().index,isFolder:({tree:e,item:t,itemId:r})=>r===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 r;return(r=e.getConfig()).onPrimaryAction?.call(r,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(t=>e.getItemInstance(t)),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=>!e.isSearchOpen?.call(e)&&!e.getState().dnd,handler:(e,t)=>{t.focusNextItem(),t.updateDomFocus()}},focusPreviousItem:{hotkey:"ArrowUp",canRepeat:!0,preventDefault:!0,isEnabled:e=>!e.isSearchOpen?.call(e)&&!e.getState().dnd,handler:(e,t)=>{t.focusPreviousItem(),t.updateDomFocus()}},expandOrDown:{hotkey:"ArrowRight",canRepeat:!0,handler:(e,t)=>{let r=t.getFocusedItem();r.isExpanded()||!r.isFolder()?(t.focusNextItem(),t.updateDomFocus()):r.expand()}},collapseOrUp:{hotkey:"ArrowLeft",canRepeat:!0,handler:(e,t)=>{var r;let n=t.getFocusedItem();n.isExpanded()&&n.isFolder()||0===n.getItemMeta().level?n.collapse():(null==(r=n.getParent())||r.setFocused(),t.updateDomFocus())}},focusFirstItem:{hotkey:"Home",handler:(e,t)=>{var r;null==(r=t.getItems()[0])||r.setFocused(),t.updateDomFocus()}},focusLastItem:{hotkey:"End",handler:(e,t)=>{var r;null==(r=t.getItems()[t.getItems().length-1])||r.setFocused(),t.updateDomFocus()}}}},jN=(e,t,r)=>{let n={};return[n,()=>{let a=r(n);for(let r=0;r<e.length;r++){let o=e[r][t];if(o)e:for(let[e,t]of Object.entries(o)){if(!t)continue e;let r=n[e];n[e]=(...e)=>t(ON(PN({},a),{prev:r}),...e)}}}]},qN=(e=[])=>((e,t)=>{let r=e.length;for(let n=0;n<r;n++)for(let a=n+1;a<r;a++)t(e[a],e[n])<0&&([e[n],e[a]]=[e[a],e[n]]);return e})(e,(e=>(t,r)=>r.key&&t.overwrites?.includes(r.key)?1:t.key&&r.overwrites?.includes(t.key)?-1:e.indexOf(t)-e.indexOf(r))(e)),UN=e=>{let t=e.instanceBuilder??jN,r=[HN,...qN(e.features)];(e=>{let t=e?.map(e=>e.key);for(let r of e??[]){let e=r.deps?.find(e=>!t?.includes(e));if(e)throw $N(`${r.key} needs ${e}`)}})(r);let n,a=[...r],[o,i]=t(a,"treeInstance",e=>({tree:e})),s=r.reduce((e,t)=>t.getInitialState?.call(t,e,o)??e,e.initialState??e.state??{}),l=r.reduce((e,t)=>t.getDefaultConfig?.call(t,e,o)??e,e),c=r.reduce((e,t)=>PN(PN({},e),t.stateHandlerNames),{}),d={current:{}},u=!1,h={},p=[],m={},f={},g={},v={},y=()=>{p=[],g={};let[e,r]=t(a,"itemInstance",e=>({item:e,tree:o,itemId:l.rootItemId}));r(),h[l.rootItemId]=e,g[l.rootItemId]={itemId:l.rootItemId,index:-1,parentId:null,level:-1,posInSet:0,setSize:1};for(let n of o.getItemsMeta())if(g[n.itemId]=n,h[n.itemId])p.push(h[n.itemId]);else{let[e,r]=t(a,"itemInstance",e=>({item:e,tree:o,itemId:n.itemId}));r(),h[n.itemId]=e,p.push(e)}u=!1},b=e=>{for(let t of r)e(t)};a.unshift({key:"main",treeInstance:{getState:()=>s,setState:({},e)=>{var t;null==(t=l.setState)||t.call(l,s)},setMounted:({},e)=>{var t;let r=d.current;r.isMounted=e,e&&(null==(t=r.waitingForMount)||t.forEach(e=>e()),r.waitingForMount=[])},applySubStateUpdate:({},e,t)=>{let r=()=>{s[e]="function"==typeof t?t(s[e]):t;let r=l[c[e]];r?.(s[e])},n=d.current;n.isMounted?r():(n.waitingForMount??=[],n.waitingForMount.push(r))},rebuildTree:()=>{var e;let t=d.current;t.isMounted?(y(),null==(e=l.setState)||e.call(l,s)):(t.waitingForMount??=[],t.waitingForMount.push(()=>{var e;y(),null==(e=l.setState)||e.call(l,s)}))},scheduleRebuildTree:()=>{u=!0},getConfig:()=>l,setConfig:(e,t)=>{var r;let n="function"==typeof t?t(l):t,a=n.state?.expandedItems&&n.state?.expandedItems!==s.expandedItems;l=n,n.state&&(s=PN(PN({},s),n.state)),a&&(y(),null==(r=l.setState)||r.call(l,s))},getItemInstance:({},e)=>{let r=h[e];if(!r){let[r,n]=t(a,"itemInstance",t=>({item:t,tree:o,itemId:e}));return n(),r}return r},getItems:()=>(u&&y(),p),registerElement:({},e)=>{n!==e&&(n&&!e?b(e=>e.onTreeUnmount?.call(e,o,n)):!n&&e&&b(t=>t.onTreeMount?.call(t,o,e)),n=e)},getElement:()=>n,getDataRef:()=>d,getHotkeyPresets:()=>v},itemInstance:{registerElement:({itemId:e,item:t},r)=>{if(m[e]===r)return;let n=m[e];n&&!r?b(e=>e.onItemUnmount?.call(e,t,n,o)):!n&&r&&b(e=>e.onItemMount?.call(e,t,r,o)),m[e]=r},getElement:({itemId:e})=>m[e],getDataRef:({itemId:e})=>f[e]??(f[e]={current:{}}),getItemMeta:({itemId:e})=>g[e]??{itemId:e,parentId:null,level:-1,index:-1,posInSet:0,setSize:1}}});for(let x of a)Object.assign(v,x.hotkeys??{});return i(),o},GN=/* @__PURE__ */(e=>(e[e.None=0]="None",e[e.Started=1]="Started",e[e.Dragging=2]="Dragging",e[e.Completed=3]="Completed",e[e.Aborted=4]="Aborted",e))(GN||{}),WN={key:"selection",getInitialState:e=>PN({selectedItems:[]},e),getDefaultConfig:(e,t)=>PN({setSelectedItems:BN("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})=>{let{selectedItems:r}=e.getState();e.setSelectedItems(r.includes(t)?r:[...r,t])},deselect:({tree:e,itemId:t})=>{let{selectedItems:r}=e.getState();e.setSelectedItems(r.filter(e=>e!==t))},isSelected:({tree:e,itemId:t})=>{let{selectedItems:r}=e.getState();return r.includes(t)},selectUpTo:({tree:e,item:t,itemId:r},n)=>{let a=t.getItemMeta().index,o=e.getDataRef();if(!o.current.selectUpToAnchorId)return o.current.selectUpToAnchorId=r,void e.setSelectedItems([r]);let i=e.getItemInstance(o.current.selectUpToAnchorId).getItemMeta().index,[s,l]=a<i?[a,i]:[i,a],c=e.getItems().slice(s,l+1).map(e=>e.getItemMeta().itemId);if(!n)return void e.setSelectedItems(c);let{selectedItems:d}=e.getState(),u=[.../* @__PURE__ */new Set([...d,...c])];e.setSelectedItems(u)},toggleSelect:({item:e})=>{e.isSelected()?e.deselect():e.select()},getProps:({tree:e,item:t,itemId:r,prev:n})=>ON(PN({},n?.()),{"aria-selected":t.isSelected()?"true":"false",onClick:a=>{var o,i;a.shiftKey?t.selectUpTo(a.ctrlKey||a.metaKey):a.ctrlKey||a.metaKey?t.toggleSelect():e.setSelectedItems([r]),a.shiftKey||(e.getDataRef().current.selectUpToAnchorId=r),null==(i=(o=n?.())?.onClick)||i.call(o,a)}})},hotkeys:{toggleSelectedItem:{hotkey:"Control+Space",preventDefault:!0,handler:(e,t)=>{t.getFocusedItem().toggleSelect()}},selectUpwards:{hotkey:"Shift+ArrowUp",handler:(e,t)=>{let r=t.getFocusedItem(),n=r.getItemAbove();n&&(r.isSelected()&&n.isSelected()?r.deselect():n.select(),n.setFocused(),t.updateDomFocus())}},selectDownwards:{hotkey:"Shift+ArrowDown",handler:(e,t)=>{let r=t.getFocusedItem(),n=r.getItemBelow();n&&(r.isSelected()&&n.isSelected()?r.deselect():n.select(),n.setFocused(),t.updateDomFocus())}},selectAll:{hotkey:"Control+KeyA",preventDefault:!0,handler:(e,t)=>{t.setSelectedItems(t.getItems().map(e=>e.getId()))}}}},KN=e=>""!==e.code&&"Unidentified"!==e.code?e.code:e.key,YN={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)$/},XN=/* @__PURE__ */new Set(["MetaLeft","MetaRight","Meta","ControlLeft","ControlRight","Control","AltLeft","AltRight","Alt","ShiftLeft","ShiftRight","Shift"]),ZN=(e,t,r,n)=>Object.entries(PN(PN({},r),n)).find(([,r])=>((e,t,r)=>{let n=r.hotkey.toLowerCase().split("+"),a=n.every(t=>{if(t in YN)return[...e].some(e=>YN[t].test(e));let r=[...e].map(e=>e.toLowerCase());return r.includes(t.toLowerCase())||r.includes(`key${t.toLowerCase()}`)}),o=!r.isEnabled||r.isEnabled(t);return a&&o&&e.size===n.length})(e,t,r))?.[0],JN=e=>{e.current.pressedKeys=/* @__PURE__ */new Set},QN=(e,t,r,n={})=>{var a,o;let{isInputFocused:i=!1,releaseAfterDispatch:s=!1}=n,{ignoreHotkeysOnInputs:l,onTreeHotkey:c,hotkeys:d}=e.getConfig();if(i&&l)return;let u=KN({code:r.code??"",key:r.key??""});(a=t.current).pressedKeys??(a.pressedKeys=/* @__PURE__ */new Set);let h=!t.current.pressedKeys.has(u);u&&t.current.pressedKeys.add(u);let p=ZN(t.current.pressedKeys,e,e.getHotkeyPresets(),d);if(s&&u&&t.current.pressedKeys.delete(u),!p)return;let m=PN(PN({},e.getHotkeyPresets()[p]),d?.[p]);m&&(m.allowWhenInputFocused||!i)&&(m.canRepeat||h)&&(m.preventDefault&&(null==(o=r.preventDefault)||o.call(r)),m.handler(r,e),c?.(p,r))},eT=(e,t)=>{var r;let n=KN({code:t.code??"",key:t.key??""});n&&((r=e.current).pressedKeys??(r.pressedKeys=/* @__PURE__ */new Set),XN.has(n)&&(e.current.pressedKeys=new Set([...e.current.pressedKeys].filter(e=>XN.has(e)))),e.current.pressedKeys.delete(n))},tT={key:"hotkeys-core",onTreeMount:(e,t)=>{let r=e.getDataRef(),n=t=>{let n=t.target instanceof HTMLInputElement;QN(e,r,t,{isInputFocused:n,releaseAfterDispatch:n})},a=e=>{eT(r,e)},o=()=>{JN(r)};t.addEventListener("keydown",n),document.addEventListener("keyup",a),window.addEventListener("focus",o),r.current.keydownHandler=n,r.current.keyupHandler=a,r.current.resetHandler=o},onTreeUnmount:(e,t)=>{let r=e.getDataRef();r.current.keyupHandler&&(document.removeEventListener("keyup",r.current.keyupHandler),delete r.current.keyupHandler),r.current.keydownHandler&&(t.removeEventListener("keydown",r.current.keydownHandler),delete r.current.keydownHandler),r.current.resetHandler&&(window.removeEventListener("focus",r.current.resetHandler),delete r.current.resetHandler)}},rT=e=>{if(!e)throw $N("sync dataLoader returned undefined");if("object"==typeof e&&"then"in e)throw $N("sync dataLoader returned promise");return e},nT={key:"sync-data-loader",getInitialState:e=>PN({loadingItemData:[],loadingItemChildrens:[]},e),getDefaultConfig:(e,t)=>PN({setLoadingItemData:BN("loadingItemData",t),setLoadingItemChildrens:BN("loadingItemChildrens",t)},e),stateHandlerNames:{loadingItemData:"setLoadingItemData",loadingItemChildrens:"setLoadingItemChildrens"},treeInstance:{waitForItemDataLoaded:()=>LN(null,null,function*(){}),waitForItemChildrenLoaded:()=>LN(null,null,function*(){}),retrieveItemData:({tree:e},t)=>rT(e.getConfig().dataLoader.getItem(t)),retrieveChildrenIds:({tree:e},t)=>{let{dataLoader:r}=e.getConfig();return"getChildren"in r?rT(r.getChildren(t)):rT(r.getChildrenWithData(t)).map(e=>e.data)},loadItemData:({tree:e},t)=>e.retrieveItemData(t),loadChildrenIds:({tree:e},t)=>e.retrieveChildrenIds(t)},itemInstance:{isLoading:()=>!1,hasLoadedData:()=>!0}},aT=e=>"childIndex"in e,oT=(e,t,r)=>{let n=r.getState().dnd?.draggedItems,a=r.getConfig();return!(n&&!(a.canDrop?.call(a,n,t)??!0)||n&&n.some(e=>t.item.getId()===e.getId()||t.item.isDescendentOf(e.getId()))||!n&&e&&a.canDropForeignDragObject&&!a.canDropForeignDragObject(e,t))},iT=e=>e.isExpanded()?1:e.getParent()&&e.getIndexInParent()===e.getItemMeta().setSize-1?2:0,sT=(e,t,r)=>t-(e.slice(0,t).reduce((e,t)=>t&&r?.some(e=>e.getId()===t.getId())?++e:e,0)??0),lT=(e,t,r,n)=>{let a=r.getConfig();if(!a.canReorder)return n?{type:2}:{type:1};let o=t.getElement()?.getBoundingClientRect(),i=o?(e.clientY-o.top)/o.height:.5,s=o?e.clientX-o.left:0,l=iT(t),c=n?a.reorderAreaPercentage??.3:.5,d=a.indent??20,u=n?2:1;if(1===l)return i<c?{type:0}:{type:u};if(2===l&&s<t.getItemMeta().level*d){if(i<.5)return{type:0};let e=t.getItemBelow()?.getItemMeta().level??0;return{type:3,reparentLevel:Math.max(e,Math.floor(s/d))}}return i<c?{type:0}:i>1-c?{type:1}:{type:u}},cT=(e,t)=>t===e.getItemMeta().level?e:cT(e.getParent(),t),dT=(e,t,r)=>{let n=e.getItemMeta(),a=cT(e,t-1),o=cT(e,t).getIndexInParent()+1;return{item:a,childIndex:o,insertionIndex:sT(a.getChildren(),o,r),dragLineIndex:n.index+1,dragLineLevel:t}},uT=(e,t,r,n,a=r.getConfig().canReorder)=>{let o=n?e.dataTransfer:null,i=r.getState().dnd?.draggedItems,s=t.getItemMeta(),l=t.getParent(),c={item:t},d=l?{item:l}:null,u=d&&oT(o,d,r),h=lT(e,t,r,oT(o,c,r));if(!a&&l&&u&&2!==h.type)return i?.some(e=>e.isDescendentOf(l.getId()))?c:d;if(2===h.type)return c;if(!a&&l&&!u)return uT(e,l,r,n,!1);if(!l)return c;if(!u)return uT(e,l,r,n,!1);if(3===h.type)return dT(t,h.reparentLevel,i);let p=0===h.type?0:1,m=t.getIndexInParent()+p;return{item:l,dragLineIndex:s.index+p,dragLineLevel:s.level,childIndex:m,insertionIndex:sT(l.getChildren(),m,i)}},hT=()=>!1,pT={key:"drag-and-drop",getDefaultConfig:(e,t)=>PN({canDrop:(e,t)=>t.item.isFolder(),canDropForeignDragObject:hT,canDragForeignDragObjectOver:e.canDropForeignDragObject===hT?()=>!1:e=>"none"!==e.effectAllowed,setDndState:BN("dnd",t),canReorder:!0,openOnDropDelay:800,draggedItemOverwritesSelection:!0},e),stateHandlerNames:{dnd:"setDndState"},onTreeMount:e=>{let t=()=>{e.applySubStateUpdate("dnd",null)};e.getDataRef().current.windowDragEndListener=t,window.addEventListener("dragend",t)},onTreeUnmount:e=>{let{windowDragEndListener:t}=e.getDataRef().current;t&&window.removeEventListener("dragend",t)},treeInstance:{getDragTarget:({tree:e})=>e.getState().dnd?.dragTarget??null,getDragLineData:({tree:e})=>{let t=e.getDragTarget(),r=(t?.item.getItemMeta().level??0)+1,n=e.getElement()?.getBoundingClientRect();if(!t||!n||!aT(t))return null;let a=t.dragLineLevel*(e.getConfig().indent??1),o=e.getItems()[t.dragLineIndex];if(!o){let o=(e.getItems()[t.dragLineIndex-1]?.getElement())?.getBoundingClientRect();if(o)return{indent:r,top:o.bottom-n.top,left:o.left+a-n.left,width:o.width-a}}let i=(o?.getElement())?.getBoundingClientRect();return i?{indent:r,top:i.top-n.top,left:i.left+a-n.left,width:i.width-a}:null},getDragLineStyle:({tree:e},t=-1,r=-8)=>{let n=e.getDragLineData();return n?{position:"absolute",top:`${n.top+t}px`,left:`${n.left+r}px`,width:n.width-r+"px",pointerEvents:"none"}:{display:"none"}},getContainerProps:({prev:e,tree:t},r)=>{let n=e?.(r);return ON(PN({},n),{onDragOver:e=>{e.preventDefault()},onDrop:e=>LN(null,null,function*(){let r=t.getDataRef(),n={item:t.getRootItem()};if(!oT(e.dataTransfer,n,t))return;e.preventDefault();let a=t.getConfig(),o=t.getState().dnd?.draggedItems;r.current.lastDragCode=void 0,o?yield a.onDrop?.call(a,o,n):e.dataTransfer&&(yield a.onDropForeignDragObject?.call(a,e.dataTransfer,n))}),style:ON(PN({},n?.style),{position:"relative"})})}},itemInstance:{getProps:({tree:e,item:t,prev:r})=>ON(PN(PN({},r?.()),e.getConfig().seperateDragHandle?{}:t.getDragHandleProps()),{onDragEnter:e=>e.preventDefault(),onDragOver:r=>{var n;r.stopPropagation();let a=e.getDataRef(),o=lT(r,t,e,!0),i=((e,t)=>[e.getId(),t.type,3===t.type?t.reparentLevel:0].join("__"))(t,o);if(i===a.current.lastDragCode)return void(a.current.lastAllowDrop&&r.preventDefault());a.current.lastDragCode=i,a.current.lastDragEnter=Date.now(),((e,t,r,n)=>{let{openOnDropDelay:a}=t.getConfig(),o=e.current.lastDragCode;a&&r.isFolder()&&!r.isExpanded()&&2===n.type&&(clearTimeout(e.current.autoExpandTimeout),e.current.autoExpandTimeout=setTimeout(()=>{o===e.current.lastDragCode&&e.current.lastAllowDrop&&r.expand()},a))})(a,e,t,o);let s=uT(r,t,e,!1);(e.getState().dnd?.draggedItems||r.dataTransfer&&(n=e.getConfig()).canDragForeignDragObjectOver?.call(n,r.dataTransfer,s))&&oT(null,s,e)?(e.applySubStateUpdate("dnd",e=>ON(PN({},e),{dragTarget:s,draggingOverItem:t})),a.current.lastAllowDrop=!0,r.preventDefault()):a.current.lastAllowDrop=!1},onDragLeave:()=>{setTimeout(()=>{let t=e.getDataRef();(t.current.lastDragEnter??0)+100>=Date.now()||(t.current.lastDragCode="no-drag",e.applySubStateUpdate("dnd",e=>ON(PN({},e),{draggingOverItem:void 0,dragTarget:void 0})))},100)},onDrop:r=>LN(null,null,function*(){r.stopPropagation();let n=e.getDataRef(),a=uT(r,t,e,!0),o=e.getState().dnd?.draggedItems,i=oT(r.dataTransfer,a,e);if(e.applySubStateUpdate("dnd",{draggedItems:void 0,draggingOverItem:void 0,dragTarget:void 0}),!i)return;r.preventDefault();let s=e.getConfig();n.current.lastDragCode=void 0,o?(yield s.onDrop?.call(s,o,a),o[0].setFocused()):r.dataTransfer&&(yield s.onDropForeignDragObject?.call(s,r.dataTransfer,a)),e.applySubStateUpdate("dnd",null),e.updateDomFocus()})}),getDragHandleProps:({tree:e,item:t,prev:r})=>ON(PN({},r?.()),{draggable:!0,onDragStart:r=>{var n,a;let{draggedItemOverwritesSelection:o}=e.getConfig(),i=e.getSelectedItems?e.getSelectedItems():[e.getFocusedItem()],s=!i.includes(t)&&o,l=s?[t]:i,c=e.getConfig();if(s&&(null==(n=e.setSelectedItems)||n.call(e,[t.getItemMeta().itemId])),c.canDrag?.call(c,l)??!0){if(c.setDragImage){let{imgElement:e,xOffset:t,yOffset:n}=c.setDragImage(l);null==(a=r.dataTransfer)||a.setDragImage(e,t??0,n??0)}if(c.createForeignDragObject&&r.dataTransfer){let{format:e,data:t,dropEffect:n,effectAllowed:a}=c.createForeignDragObject(l);r.dataTransfer.setData(e,t),n&&(r.dataTransfer.dropEffect=n),a&&(r.dataTransfer.effectAllowed=a)}e.applySubStateUpdate("dnd",{draggedItems:l,draggingOverItem:e.getFocusedItem()})}else r.preventDefault()},onDragEnd:r=>{let{onCompleteForeignDrop:n,canDragForeignDragObjectOver:a}=e.getConfig(),o=e.getState().dnd?.draggedItems;if("none"===r.dataTransfer?.dropEffect||!o)return;let i=uT(r,t,e,!1);a&&r.dataTransfer&&!a(r.dataTransfer,i)||n?.(o)}}),isDragTarget:({tree:e,item:t})=>{let r=e.getDragTarget();return!!r&&r.item.getId()===t.getId()},isUnorderedDragTarget:({tree:e,item:t})=>{let r=e.getDragTarget();return!!r&&(!aT(r)&&r.item.getId()===t.getId())},isDragTargetAbove:({tree:e,item:t})=>{let r=e.getDragTarget();return!(!r||!aT(r)||r.item!==t.getParent())&&r.childIndex===t.getItemMeta().posInSet},isDragTargetBelow:({tree:e,item:t})=>{let r=e.getDragTarget();return!(!r||!aT(r)||r.item!==t.getParent())&&r.childIndex-1===t.getItemMeta().posInSet},isDraggingOver:({tree:e,item:t})=>(e.getState().dnd?.draggingOverItem)?.getId()===t.getId()}},mT=(e,t,r=(()=>e.getState().dnd?.dragTarget)())=>{if(!r)return;let n=((e,t,r)=>{let n=+!t,a=e.getState().dnd?.draggedItems;if(aT(r)){let o=r.item.getParent(),i=e.getItems()[r.dragLineIndex-1],s=i?iT(i):0,l=i?.getItemMeta().level??0,c=(i?.getItemBelow())?.getItemMeta().level??0;if(2===s){if(t&&r.dragLineLevel<l)return dT(i,r.dragLineLevel+1,a);if(!t&&r.dragLineLevel>c&&o)return dT(i,r.dragLineLevel-1,a)}let d=r.dragLineIndex-1+n,u=e.getItems()[d];return u?{item:u}:void 0}if(1===iT(r.item)&&!t)return{item:r.item,childIndex:0,insertionIndex:sT(r.item.getChildren(),0,a),dragLineIndex:r.item.getItemMeta().index+n,dragLineLevel:r.item.getItemMeta().level+1};let o=r.item.getIndexInParent()+n;return{item:r.item.getParent(),childIndex:o,insertionIndex:sT(r.item.getParent().getChildren(),o,a),dragLineIndex:r.item.getItemMeta().index+n,dragLineLevel:r.item.getItemMeta().level}})(e,t,r),a=e.getDataRef().current.kDndDataTransfer??null;return n?oT(a,n,e)?n:mT(e,t,n):void 0},fT=e=>{let t=e.getState().dnd;t?.dragTarget&&!aT(t.dragTarget)&&t.dragTarget.item.scrollTo({block:"nearest",inline:"nearest"})},gT=(e,t,r)=>{var n,a;let o=e.getFocusedItem(),{canDrag:i}=e.getConfig();if(t&&i&&!i(t))return;t?(e.applySubStateUpdate("dnd",{draggedItems:t}),null==(a=(n=e.getConfig()).onStartKeyboardDrag)||a.call(n,t)):r&&(e.getDataRef().current.kDndDataTransfer=r);let s=mT(e,!1,{item:o});s&&(e.applySubStateUpdate("dnd",{draggedItems:t,dragTarget:s}),e.applySubStateUpdate("assistiveDndState",1),fT(e))},vT=(e,t)=>{let r=mT(e,t);r&&(e.applySubStateUpdate("dnd",{draggedItems:e.getState().dnd?.draggedItems,dragTarget:r}),e.applySubStateUpdate("assistiveDndState",2),aT(r)||r.item.setFocused(),fT(e))},yT={key:"keyboard-drag-and-drop",deps:["drag-and-drop"],getDefaultConfig:(e,t)=>PN({setAssistiveDndState:BN("assistiveDndState",t)},e),stateHandlerNames:{assistiveDndState:"setAssistiveDndState"},treeInstance:{startKeyboardDrag:({tree:e},t)=>{gT(e,t,void 0)},startKeyboardDragOnForeignObject:({tree:e},t)=>{gT(e,void 0,t)},stopKeyboardDrag:({tree:e})=>{e.getDataRef().current.kDndDataTransfer=void 0,e.applySubStateUpdate("dnd",null),e.applySubStateUpdate("assistiveDndState",0)}},hotkeys:{startDrag:{hotkey:"Control+Shift+KeyD",preventDefault:!0,isEnabled:e=>!e.getState().dnd,handler:(e,t)=>{let r=t.getSelectedItems?.call(t)??[t.getFocusedItem()],n=t.getFocusedItem();t.startKeyboardDrag(r.includes(n)?r:r.concat(n))}},dragUp:{hotkey:"ArrowUp",preventDefault:!0,isEnabled:e=>!!e.getState().dnd,handler:(e,t)=>{vT(t,!0)}},dragDown:{hotkey:"ArrowDown",preventDefault:!0,isEnabled:e=>!!e.getState().dnd,handler:(e,t)=>{vT(t,!1)}},cancelDrag:{hotkey:"Escape",isEnabled:e=>!!e.getState().dnd,handler:(e,t)=>{t.stopKeyboardDrag()}},completeDrag:{hotkey:"Enter",preventDefault:!0,isEnabled:e=>!!e.getState().dnd,handler:(e,t)=>LN(null,null,function*(){e.stopPropagation();let r=t.getDataRef(),n=t.getDragTarget(),a=r.current.kDndDataTransfer??null;if(!n||!oT(a,n,t))return;let o=t.getConfig(),i=t.getState().dnd?.draggedItems;r.current.lastDragCode=void 0,t.applySubStateUpdate("dnd",null),i?(yield o.onDrop?.call(o,i,n),t.getItemInstance(i[0].getId()).setFocused()):a&&(yield o.onDropForeignDragObject?.call(o,a,n)),t.updateDomFocus(),t.applySubStateUpdate("assistiveDndState",3)})}}},bT={key:"renaming",overwrites:["drag-and-drop"],getDefaultConfig:(e,t)=>PN({setRenamingItem:BN("renamingItem",t),setRenamingValue:BN("renamingValue",t),canRename:()=>!0},e),stateHandlerNames:{renamingItem:"setRenamingItem",renamingValue:"setRenamingValue"},treeInstance:{getRenamingItem:({tree:e})=>{let t=e.getState().renamingItem;return t?e.getItemInstance(t):null},getRenamingValue:({tree:e})=>e.getState().renamingValue||"",abortRenaming:({tree:e})=>{e.applySubStateUpdate("renamingItem",null),e.updateDomFocus()},completeRenaming:({tree:e})=>{var t;let r=e.getConfig(),n=e.getRenamingItem();n&&(null==(t=r.onRename)||t.call(r,n,e.getState().renamingValue||"")),e.applySubStateUpdate("renamingItem",null),e.updateDomFocus()},isRenamingItem:({tree:e})=>!!e.getState().renamingItem},itemInstance:{startRenaming:({tree:e,item:t,itemId:r})=>{t.canRename()&&(e.applySubStateUpdate("renamingItem",r),e.applySubStateUpdate("renamingValue",t.getItemName()))},getRenameInputProps:({tree:e})=>({ref:e=>e?.focus(),onBlur:()=>e.abortRenaming(),value:e.getRenamingValue(),onChange:t=>{e.applySubStateUpdate("renamingValue",t.target?.value)}}),canRename:({tree:e,item:t})=>{var r;return(r=e.getConfig()).canRename?.call(r,t)??!0},isRenaming:({tree:e,item:t})=>t.getId()===e.getState().renamingItem,getProps:({prev:e,item:t})=>{let r=t.isRenaming(),n=e?.()??{};return r?ON(PN({},n),{draggable:!1,onDragStart:()=>{}}):n}},hotkeys:{renameItem:{hotkey:"F2",handler:(e,t)=>{t.getFocusedItem().startRenaming()}},abortRenaming:{hotkey:"Escape",allowWhenInputFocused:!0,isEnabled:e=>e.isRenamingItem(),handler:(e,t)=>{t.abortRenaming()}},completeRenaming:{hotkey:"Enter",allowWhenInputFocused:!0,isEnabled:e=>e.isRenamingItem(),handler:(e,t)=>{t.completeRenaming()}}}},xT=Object.defineProperty,wT=Object.defineProperties,ST=Object.getOwnPropertyDescriptors,kT=Object.getOwnPropertySymbols,CT=Object.prototype.hasOwnProperty,NT=Object.prototype.propertyIsEnumerable,TT=(e,t,r)=>t in e?xT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,AT=(e,t)=>{for(var r in t||={})CT.call(t,r)&&TT(e,r,t[r]);if(kT)for(var r of kT(t))NT.call(t,r)&&TT(e,r,t[r]);return e},MT=(e,t)=>wT(e,ST(t)),DT={position:"absolute",margin:"-1px",width:"1px",height:"1px",overflow:"hidden",clip:"rect(0 0 0 0)"},ET=(e,t,r)=>{if(!r.startDrag)return"";let n=(e?.draggedItems)?.map(e=>e.getItemName()).join(", ")??"",a=e?.dragTarget?"childIndex"in e.dragTarget?`${e.dragTarget.childIndex} of ${e.dragTarget.item.getChildren().length} in ${e.dragTarget.item.getItemName()}`:`in ${e.dragTarget.item.getItemName()}`:"None",o=`Press ${r.dragUp?.hotkey} and ${r.dragDown?.hotkey} to move up or down, ${r.completeDrag?.hotkey} to drop, ${r.cancelDrag?.hotkey} to abort.`;switch(t){case GN.Started:return n?`Dragging ${n}. Current position: ${a}. ${o}`:`Current position: ${a}. ${o}`;case GN.Dragging:return n?`${n}, ${a}`:a;case GN.Completed:return`Drag completed. Press ${r.startDrag?.hotkey} to move selected items`;case GN.Aborted:return`Drag cancelled. Press ${r.startDrag?.hotkey} to move selected items`;case GN.None:default:return`Press ${r.startDrag?.hotkey} to move selected items`}},IT=e=>{var t=e,{tree:r,getLabel:n=ET}=t,a=((e,t)=>{var r={};for(var n in e)CT.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&kT)for(var n of kT(e))t.indexOf(n)<0&&NT.call(e,n)&&(r[n]=e[n]);return r})(t,["tree","getLabel"]);let o=r.getState();/* @__PURE__ */
158
+ return Z.createElement("span",MT(AT({"aria-live":"assertive"},a),{style:AT(AT({},DT),a.style)}),n(o.dnd,o.assistiveDndState??GN.None,r.getHotkeyPresets()))},RT=X.createContext({currentItem:void 0,indent:20,tree:void 0});function zT(){return X.useContext(RT)}function _T({indent:e=20,tree:t,className:r,...n}){let a=t&&"function"==typeof t.getContainerProps?t.getContainerProps():{},{style:o,...i}={...n,...a},s={...o,"--tree-indent":`${e}px`};/* @__PURE__ */
159
+ return be(RT.Provider,{value:{indent:e,tree:t},children:/* @__PURE__ */be("div",{className:Bf("flex flex-col",r),"data-slot":"tree",style:s,...i})})}function PT({item:e,className:t,asChild:r,children:n,...a}){let{indent:o}=zT(),i="function"==typeof e.getProps?e.getProps():{},{style:s,...l}={...a,...i},c={...s,"--tree-padding":e.getItemMeta().level*o+"px"},d=r?Td:"button";/* @__PURE__ */
160
+ return be(RT.Provider,{value:{currentItem:e,indent:o},children:/* @__PURE__ */be(d,{"aria-expanded":e.isExpanded(),className:Bf("z-10 select-none ps-(--tree-padding) not-last:pb-0.5 outline-hidden focus:z-20 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),"data-drag-target":"function"==typeof e.isDragTarget?e.isDragTarget()||!1:void 0,"data-focus":"function"==typeof e.isFocused?e.isFocused()||!1:void 0,"data-folder":"function"==typeof e.isFolder?e.isFolder()||!1:void 0,"data-search-match":"function"==typeof e.isMatchingSearch?e.isMatchingSearch()||!1:void 0,"data-selected":"function"==typeof e.isSelected?e.isSelected()||!1:void 0,"data-slot":"tree-item",style:c,...l,children:n})})}function OT({item:e,children:t,className:r,...n}){let{currentItem:a}=zT(),o=e||a;return o?/* @__PURE__ */xe("span",{className:Bf("flex items-center gap-2 rounded-sm bg-transparent in-data-[drag-target=true]:bg-accent in-data-[search-match=true]:bg-blue-400/20! in-data-[selected=true]:bg-accent px-2 py-1.5 in-data-[selected=true]:text-accent-foreground text-sm in-focus-visible:ring-[3px] in-focus-visible:ring-ring/50 transition-colors hover:bg-accent [&_svg]:pointer-events-none [&_svg]:shrink-0",r),"data-slot":"tree-item-label",...n,children:[o.isFolder()?/* @__PURE__ */be(pp,{className:"in-aria-[expanded=false]:-rotate-90 size-4 shrink-0 text-muted-foreground"}):/* @__PURE__ */be("span",{className:"size-4 shrink-0","aria-hidden":!0}),t||("function"==typeof o.getItemName?o.getItemName():null)]}):null}function LT({className:e,...t}){let{tree:r}=zT();if(!r||"function"!=typeof r.getDragLineStyle)return null;let n=r.getDragLineStyle();/* @__PURE__ */
161
+ return be("div",{className:Bf("-mt-px before:-top-[3px] absolute z-30 h-0.5 w-[unset] bg-primary before:absolute before:left-0 before:size-2 before:rounded-full before:border-2 before:border-primary before:bg-background",e),style:n,...t})}var FT=Object.defineProperty,BT=(e,t)=>FT(e,"name",{value:t,configurable:!0}),[VT,$T]=/* @__PURE__ */od("AlertDialog",[zh]),HT=zh(),jT=/* @__PURE__ */BT(e=>{let{__scopeAlertDialog:t,...r}=e,n=HT(t);/* @__PURE__ */
162
+ return be(Oh,{...n,...r,modal:!0})},"AlertDialog");X.forwardRef(/* @__PURE__ */BT(function(e,t){let{__scopeAlertDialog:r,...n}=e,a=HT(r);/* @__PURE__ */
163
+ return be(Lh,{...a,...n,ref:t})},"AlertDialogTrigger"));var qT=/* @__PURE__ */BT(e=>{let{__scopeAlertDialog:t,...r}=e,n=HT(t);/* @__PURE__ */
164
+ return be($h,{...n,...r})},"AlertDialogPortal"),UT=X.forwardRef(/* @__PURE__ */BT(function(e,t){let{__scopeAlertDialog:r,...n}=e,a=HT(r);/* @__PURE__ */
165
+ return be(jh,{...a,...n,ref:t})},"AlertDialogOverlay")),[GT,WT]=VT("AlertDialogContent"),KT=X.forwardRef(/* @__PURE__ */BT(function(e,t){let{__scopeAlertDialog:r,children:n,...a}=e,o=HT(r),i=rd(t,X.useRef(null)),s=X.useRef(null);/* @__PURE__ */
166
+ return be(GT,{scope:r,cancelRef:s,children:/* @__PURE__ */be(Wh,{role:"alertdialog",...o,...a,ref:i,onOpenAutoFocus:Yc(a.onOpenAutoFocus,e=>{e.preventDefault(),s.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:n})})},"AlertDialogContent")),YT=X.forwardRef(/* @__PURE__ */BT(function(e,t){let{__scopeAlertDialog:r,...n}=e,a=HT(r);/* @__PURE__ */
167
+ return be(Zh,{...a,...n,ref:t})},"AlertDialogTitle")),XT=X.forwardRef(/* @__PURE__ */BT(function(e,t){let{__scopeAlertDialog:r,...n}=e,a=HT(r);/* @__PURE__ */
168
+ return be(Jh,{...a,...n,ref:t})},"AlertDialogDescription")),ZT=X.forwardRef(/* @__PURE__ */BT(function(e,t){let{__scopeAlertDialog:r,...n}=e,a=HT(r);/* @__PURE__ */
169
+ return be(Qh,{...a,...n,ref:t})},"AlertDialogAction")),JT=X.forwardRef(/* @__PURE__ */BT(function(e,t){let{__scopeAlertDialog:r,...n}=e,{cancelRef:a}=WT("AlertDialogCancel",r),o=HT(r),i=rd(t,a);/* @__PURE__ */
170
+ return be(Qh,{...o,...n,ref:i})},"AlertDialogCancel")),QT=jT,eA=qT,tA=UT,rA=KT,nA=ZT,aA=JT,oA=YT,iA=XT;function sA({...e}){/* @__PURE__ */
171
+ return be(QT,{"data-slot":"alert-dialog",...e})}function lA({...e}){/* @__PURE__ */
172
+ return be(eA,{"data-slot":"alert-dialog-portal",...e})}function cA({className:e,...t}){/* @__PURE__ */
173
+ return be(tA,{"data-slot":"alert-dialog-overlay",className:Bf("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50 backdrop-blur-xs",e),...t})}function dA({className:e,...t}){/* @__PURE__ */
174
+ return xe(lA,{children:[/* @__PURE__ */be(cA,{}),/* @__PURE__ */be(rA,{"data-slot":"alert-dialog-content",className:Bf("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-2xl border p-6 shadow-lg duration-200 sm:max-w-lg",e),...t})]})}function uA({className:e,...t}){/* @__PURE__ */
175
+ return be("div",{"data-slot":"alert-dialog-header",className:Bf("flex flex-col gap-2 text-center sm:text-left",e),...t})}function hA({className:e,...t}){/* @__PURE__ */
176
+ return be("div",{"data-slot":"alert-dialog-footer",className:Bf("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function pA({className:e,...t}){/* @__PURE__ */
177
+ return be(oA,{"data-slot":"alert-dialog-title",className:Bf("text-lg font-semibold",e),...t})}function mA({className:e,...t}){/* @__PURE__ */
178
+ return be(iA,{"data-slot":"alert-dialog-description",className:Bf("text-muted-foreground text-sm",e),...t})}function fA({className:e,...t}){/* @__PURE__ */
179
+ return be(nA,{className:Bf(Gb(),e),...t})}function gA({className:e,...t}){/* @__PURE__ */
180
+ return be(aA,{className:Bf(Gb({variant:"outline"}),e),...t})}var vA=Object.defineProperty,yA=(e,t)=>vA(e,"name",{value:t,configurable:!0}),bA="ContextMenu",[xA,wA]=/* @__PURE__ */od(bA,[yk]),SA=yk(),[kA,CA]=xA(bA),NA=/* @__PURE__ */yA(e=>{let{__scopeContextMenu:t,children:r,onOpenChange:n,open:a,dir:o,modal:i=!0}=e,s=X.useRef(!1),[l,c]=bd({prop:a,defaultProp:!1,onChange:n,caller:bA}),d=SA(t);/* @__PURE__ */
181
+ return be(kA,{scope:t,open:l,onOpenChange:c,modal:i,hasInteractedRef:s,children:/* @__PURE__ */be(fC,{...d,dir:o,open:l,onOpenChange:c,modal:i,children:r})})},"ContextMenu"),TA=/* @__PURE__ */X.forwardRef(/* @__PURE__ */yA(function(e,t){let{__scopeContextMenu:r,disabled:n=!1,...a}=e,o=CA("ContextMenuTrigger",r),i=SA(r),[s,l]=X.useState({x:0,y:0}),c=X.useMemo(()=>({current:{getBoundingClientRect:/* @__PURE__ */yA(()=>DOMRect.fromRect({width:0,height:0,...s}),"getBoundingClientRect")}}),[s]),d=X.useRef(0),u=X.useCallback(()=>window.clearTimeout(d.current),[]),h=/* @__PURE__ */yA(e=>{o.hasInteractedRef.current=!0,l({x:e.clientX,y:e.clientY}),o.onOpenChange(!0)},"handleOpen");return X.useEffect(()=>u,[u]),X.useEffect(()=>{n&&u()},[n,u]),/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be(gC,{...i,virtualRef:c}),/* @__PURE__ */be(Vd.span,{"data-state":o.open?"open":"closed","data-disabled":n?"":void 0,...a,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:n?e.onContextMenu:Yc(e.onContextMenu,e=>{u(),h(e),e.preventDefault()}),onPointerDown:n?e.onPointerDown:Yc(e.onPointerDown,FA(e=>{u(),o.open&&o.onOpenChange(!1),d.current=window.setTimeout(()=>h(e),700)})),onPointerMove:n?e.onPointerMove:Yc(e.onPointerMove,FA(u)),onPointerCancel:n?e.onPointerCancel:Yc(e.onPointerCancel,FA(u)),onPointerUp:n?e.onPointerUp:Yc(e.onPointerUp,FA(u))})]})},"ContextMenuTrigger")),AA=/* @__PURE__ */yA(e=>{let{__scopeContextMenu:t,...r}=e,n=SA(t);/* @__PURE__ */
182
+ return be(vC,{...n,...r})},"ContextMenuPortal"),MA=/* @__PURE__ */X.forwardRef(/* @__PURE__ */yA(function(e,t){let{__scopeContextMenu:r,...n}=e,a=CA("ContextMenuContent",r),o=SA(r),i=X.useRef(!1);/* @__PURE__ */
183
+ return be(yC,{...o,...n,ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),!t.defaultPrevented&&i.current&&t.preventDefault(),i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),!t.defaultPrevented&&!a.modal&&(i.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"ContextMenuContent")),DA=/* @__PURE__ */X.forwardRef(/* @__PURE__ */yA(function(e,t){let{__scopeContextMenu:r,...n}=e,a=SA(r);/* @__PURE__ */
184
+ return be(bC,{...a,...n,ref:t})},"ContextMenuLabel")),EA=/* @__PURE__ */X.forwardRef(/* @__PURE__ */yA(function(e,t){let{__scopeContextMenu:r,...n}=e,a=SA(r);/* @__PURE__ */
185
+ return be(xC,{...a,...n,ref:t})},"ContextMenuItem")),IA=/* @__PURE__ */X.forwardRef(/* @__PURE__ */yA(function(e,t){let{__scopeContextMenu:r,...n}=e,a=SA(r);/* @__PURE__ */
186
+ return be(wC,{...a,...n,ref:t})},"ContextMenuCheckboxItem")),RA=/* @__PURE__ */X.forwardRef(/* @__PURE__ */yA(function(e,t){let{__scopeContextMenu:r,...n}=e,a=SA(r);/* @__PURE__ */
187
+ return be(SC,{...a,...n,ref:t})},"ContextMenuRadioItem")),zA=/* @__PURE__ */X.forwardRef(/* @__PURE__ */yA(function(e,t){let{__scopeContextMenu:r,...n}=e,a=SA(r);/* @__PURE__ */
188
+ return be(kC,{...a,...n,ref:t})},"ContextMenuItemIndicator")),_A=/* @__PURE__ */X.forwardRef(/* @__PURE__ */yA(function(e,t){let{__scopeContextMenu:r,...n}=e,a=SA(r);/* @__PURE__ */
189
+ return be(CC,{...a,...n,ref:t})},"ContextMenuSeparator")),PA=/* @__PURE__ */yA(e=>{let{__scopeContextMenu:t,children:r,onOpenChange:n,open:a,defaultOpen:o}=e,i=SA(t),[s,l]=bd({prop:a,defaultProp:o??!1,onChange:n,caller:"ContextMenuSub"});/* @__PURE__ */
190
+ return be(NC,{...i,open:s,onOpenChange:l,children:r})},"ContextMenuSub"),OA=/* @__PURE__ */X.forwardRef(/* @__PURE__ */yA(function(e,t){let{__scopeContextMenu:r,...n}=e,a=SA(r);/* @__PURE__ */
191
+ return be(TC,{...a,...n,ref:t})},"ContextMenuSubTrigger")),LA=/* @__PURE__ */X.forwardRef(/* @__PURE__ */yA(function(e,t){let{__scopeContextMenu:r,...n}=e,a=SA(r);/* @__PURE__ */
192
+ return be(AC,{...a,...n,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"ContextMenuSubContent"));function FA(e){return t=>"mouse"===t.pointerType?void 0:e(t)}yA(FA,"whenTouchOrPen");var BA=AA,VA=MA,$A=DA,HA=EA,jA=IA,qA=RA,UA=zA,GA=_A,WA=OA,KA=LA,YA=NA,XA=TA,ZA=PA,JA=X.forwardRef(({className:e,inset:t,children:r,...n},a)=>/* @__PURE__ */xe(WA,{ref:a,className:Bf("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[state=open]:bg-accent data-[state=open]:text-accent-foreground focus:bg-accent focus:text-accent-foreground",t&&"pl-8",e),...n,children:[r,/* @__PURE__ */be(fp,{className:"ml-auto h-4 w-4"})]}));JA.displayName=WA.displayName;var QA=X.forwardRef(({className:e,...t},r)=>/* @__PURE__ */be(KA,{ref:r,className:Bf("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-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",e),...t}));QA.displayName=KA.displayName;var eM=X.forwardRef(({className:e,...t},r)=>/* @__PURE__ */be(BA,{children:/* @__PURE__ */be(VA,{ref:r,className:Bf("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-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",e),...t})}));eM.displayName=VA.displayName;var tM=X.forwardRef(({className:e,inset:t,...r},n)=>/* @__PURE__ */be(HA,{ref:n,className:Bf("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t&&"pl-8",e),...r}));tM.displayName=HA.displayName;var rM=X.forwardRef(({className:e,children:t,checked:r,...n},a)=>/* @__PURE__ */xe(jA,{ref:a,className:Bf("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),checked:r,...n,children:[/* @__PURE__ */be("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:/* @__PURE__ */be(UA,{children:/* @__PURE__ */be(up,{className:"h-4 w-4"})})}),t]}));rM.displayName=jA.displayName;var nM=X.forwardRef(({className:e,children:t,...r},n)=>/* @__PURE__ */xe(qA,{ref:n,className:Bf("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),...r,children:[/* @__PURE__ */be("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:/* @__PURE__ */be(UA,{children:/* @__PURE__ */be(xp,{className:"h-2 w-2 fill-current"})})}),t]}));nM.displayName=qA.displayName;var aM=X.forwardRef(({className:e,inset:t,...r},n)=>/* @__PURE__ */be($A,{ref:n,className:Bf("px-2 py-1.5 text-sm font-semibold text-foreground",t&&"pl-8",e),...r}));aM.displayName=$A.displayName;var oM=X.forwardRef(({className:e,...t},r)=>/* @__PURE__ */be(GA,{ref:r,className:Bf("-mx-1 my-1 h-px bg-border",e),...t}));oM.displayName=GA.displayName;var iM=({className:e,...t})=>/* @__PURE__ */be("span",{className:Bf("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});iM.displayName="ContextMenuShortcut";var sM=({children:e,itemId:t,isFolder:r,hasCopiedItem:n,onAddChild:a,onAddChildFolder:o,onAddSibling:i,onAddSiblingFolder:s,onRename:l,onDuplicate:c,onCopy:d,onPaste:u,onDelete:h,onManageTags:p})=>{let m=me(null),f=me(null),g=()=>{m.current&&=(clearTimeout(m.current),null)};/* @__PURE__ */
193
+ return xe(YA,{children:[/* @__PURE__ */be(XA,{asChild:!0,children:/* @__PURE__ */be("div",{className:"contents",onTouchStart:e=>{let t=e.touches[0];f.current={x:t.clientX,y:t.clientY};let r=e.currentTarget,n=t.clientX,a=t.clientY;m.current=setTimeout(()=>{r.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,clientX:n,clientY:a}))},500)},onTouchEnd:g,onTouchCancel:g,onTouchMove:e=>{if(!f.current)return;let t=e.touches[0],r=Math.abs(t.clientX-f.current.x),n=Math.abs(t.clientY-f.current.y);(r>10||n>10)&&g()},children:e})}),/* @__PURE__ */xe(eM,{className:"w-56",onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:[
194
+ /* @__PURE__ */xe(tM,{onClick:()=>r?a?.(t):i?.(t),disabled:r?!a:!i,children:[/* @__PURE__ */be(_p,{className:"mr-2 h-4 w-4"}),"Add Note"]}),
195
+ /* @__PURE__ */xe(tM,{onClick:()=>r?o?.(t):s?.(t),disabled:r?!o:!s,children:[/* @__PURE__ */be(Bp,{className:"mr-2 h-4 w-4"}),"Add Folder"]}),
196
+ /* @__PURE__ */xe(tM,{onClick:()=>l?.(t),disabled:!l,children:[
197
+ /* @__PURE__ */be(em,{className:"mr-2 h-4 w-4"}),"Rename",
198
+ /* @__PURE__ */be(iM,{children:"F2"})]}),
199
+ /* @__PURE__ */xe(tM,{onClick:()=>c?.(t),disabled:!c,children:[
200
200
  /* @__PURE__ */be(Mp,{className:"mr-2 h-4 w-4"}),"Duplicate",
201
- /* @__PURE__ */be(uM,{children:"⌘D"})]}),
202
- /* @__PURE__ */be(dM,{}),
203
- /* @__PURE__ */xe(iM,{onClick:()=>d?.(t),disabled:!d,children:[
201
+ /* @__PURE__ */be(iM,{children:"⌘D"})]}),
202
+ /* @__PURE__ */be(oM,{}),
203
+ /* @__PURE__ */xe(tM,{onClick:()=>d?.(t),disabled:!d,children:[
204
204
  /* @__PURE__ */be(Cp,{className:"mr-2 h-4 w-4"}),"Copy",
205
- /* @__PURE__ */be(uM,{children:"⌘C"})]}),
206
- /* @__PURE__ */xe(iM,{onClick:()=>{u?.(r?t:null)},disabled:!n||!u,children:[
205
+ /* @__PURE__ */be(iM,{children:"⌘C"})]}),
206
+ /* @__PURE__ */xe(tM,{onClick:()=>{u?.(r?t:null)},disabled:!n||!u,children:[
207
207
  /* @__PURE__ */be(Sp,{className:"mr-2 h-4 w-4"}),"Paste",
208
- /* @__PURE__ */be(uM,{children:"⌘V"})]}),
209
- /* @__PURE__ */xe(iM,{onClick:()=>p?.(t),disabled:!p,children:[/* @__PURE__ */be(pm,{className:"mr-2 h-4 w-4"}),"Manage Tags"]}),
210
- /* @__PURE__ */be(dM,{}),
211
- /* @__PURE__ */xe(iM,{onClick:()=>h?.(t),disabled:!h,className:"text-destructive focus:text-destructive",children:[
212
- /* @__PURE__ */be(vm,{className:"mr-2 h-4 w-4"}),"Delete",
213
- /* @__PURE__ */be(uM,{children:"Del"})]})]})]})},pM="__root__";var mM=ne(({activeId:e,documents:t,onMove:r,onRename:n,onSelect:a,onDelete:o,onDuplicate:i,onAddChild:s,onAddChildFolder:l,onAddSibling:c,onAddSiblingFolder:d,onCopy:u,onPaste:h,onNewFile:p,onNewFolder:m,onManageTags:f,onExpandStateChange:g,onExpandedFoldersChange:v},y)=>{let b=pe(()=>function(e){let t={[pM]:{children:[],documentId:pM,isFolder:!0,name:"Root"}};for(let r of e)t[r.id]={children:[],documentId:r.id,isFolder:!!r.isFolder,name:r.title||"Untitled"};for(let r of e){let e=r.parentId&&t[r.parentId]?r.parentId:pM;t[e].children=[...t[e].children??[],r.id]}for(let r of Object.keys(t))r!==pM&&(t[r].children?.length??0)>0&&(t[r].isFolder=!0);return t}(t),[t]),x=pe(()=>t.filter(e=>b[e.id]?.isFolder&&e.isExpanded).map(e=>e.id),[t,b]),[w,S]=fe({expandedItems:x,selectedItems:e?[e]:[]}),[k,C]=fe(null),[N,T]=fe(null),A=(e=>{let[t]=fe(()=>({current:XN(e)})),[r,n]=fe(()=>t.current.getState());return le(()=>(t.current.setMounted(!0),t.current.rebuildTree(),()=>{t.current.setMounted(!1)}),[t]),t.current.setConfig(t=>zT(RT(RT({},t),e),{state:RT(RT({},r),e.state),setState:t=>{var r;n(t),null==(r=e.setState)||r.call(e,t)}})),t.current})({canReorder:!0,dataLoader:{getChildren:e=>{let t=b[e];return t?t.children??[]:[]},getItem:e=>b[e]||{children:[],documentId:e,isFolder:!1,name:"Deleted Item"}},features:[lT,JN,iT,CT,yT,kT],getItemName:e=>e.getItemData().name,onRename:(e,t)=>{let r=t.trim()||"Untitled";n?.(e.getId(),r)},indent:20,isItemFolder:e=>e.getItemData()?.isFolder??!1,onDrop:(e,t)=>{let n=e.map(e=>e.getId()).filter(e=>e!==pM);if(0===n.length)return;let a=[...n].reverse();if("childIndex"in t){let e=t.item.getId()===pM?null:t.item.getId(),o=function(e,t,r,n){let a=e.filter(e=>!t.includes(e)),o=a[r];if(o)return{targetId:o,position:"before"};let i=a[r-1];return i?{targetId:i,position:"after"}:{targetId:n,position:"child"}}(b[t.item.getId()]?.children??[],n,t.insertionIndex,e);for(let t of a)r(t,o.targetId,o.position);return}(e=>{for(let t of a)r(t,e,"child")})(t.item.getId()===pM?null:t.item.getId())},rootItemId:pM,setState:S,state:w});le(()=>{S(t=>({...t,selectedItems:e&&b[e]?[e]:[]}))},[e,b]);let M=x.join("\n");le(()=>{S(e=>({...e,expandedItems:x}))},[M]);let D=pe(()=>jc(b,pM),[b]),E=pe(()=>Uc(b,pM,w.expandedItems??[]),[b,w.expandedItems]),I=me(g);le(()=>{I.current=g},[g]),le(()=>{I.current?.({level:E,maxLevel:D})},[E,D]),le(()=>()=>I.current?.({level:0,maxLevel:0}),[]);let R=w.expandedItems??[],z=me(v);le(()=>{z.current=v},[v]);let _=R.join("\n");le(()=>{z.current?.(R)},[_]),de(y,()=>({collapseAll:()=>{S(e=>({...e,expandedItems:[]}))},edit:e=>{n&&A.getItemInstance(e).startRenaming()},expandAll:()=>{let e=qc(b,pM,D);S(t=>({...t,expandedItems:e}))},expandToLevel:e=>{let t=qc(b,pM,Math.min(e,D));S(e=>({...e,expandedItems:t}))},getExpandLevel:()=>E,getMaxExpandLevel:()=>D}));let P=N?b[N]?.name:"",O=me(null);O.current!==b&&(O.current=b,A.scheduleRebuildTree());let L=A.getItems();/* @__PURE__ */
214
- return xe(ye,{children:[/* @__PURE__ */be("div",{className:"flex h-full flex-col gap-2 overflow-auto",children:/* @__PURE__ */xe(BT,{indent:20,tree:A,children:[
215
- /* @__PURE__ */be(OT,{tree:A}),L.map(t=>{let r=t.getId();return r===pM?null:/* @__PURE__ */be(VT,{item:t,children:/* @__PURE__ */be(hM,{itemId:r,isFolder:t.isFolder(),hasCopiedItem:!!k,onAddChild:s,onAddChildFolder:l,onAddSibling:c,onAddSiblingFolder:d,onRename:n?()=>t.startRenaming():void 0,onDuplicate:i,onCopy:u?e=>{C(e),u(e)}:void 0,onPaste:h?()=>{k&&h(t.isFolder()?r:null)}:void 0,onDelete:o?()=>T(r):void 0,onManageTags:f,children:t.isRenaming()?/* @__PURE__ */be($T,{className:"w-full text-left",onClick:e=>e.stopPropagation(),children:/* @__PURE__ */be("input",{...t.getRenameInputProps(),className:"flex-1 w-full rounded border bg-background px-1 text-sm outline-none focus:ring-2 focus:ring-ring"})}):/* @__PURE__ */be($T,{className:qf("w-full text-left",e===r&&"bg-accent text-accent-foreground"),onClick:()=>a(r),onDoubleClick:()=>n&&t.startRenaming(),children:/* @__PURE__ */xe("span",{className:"flex items-center gap-2 w-full min-w-0",children:[t.isFolder()?t.isExpanded()?/* @__PURE__ */be(Op,{className:"pointer-events-none size-4 shrink-0 text-muted-foreground"}):/* @__PURE__ */be(Bp,{className:"pointer-events-none size-4 shrink-0 text-muted-foreground"}):/* @__PURE__ */be(IN,{filename:t.getItemName(),size:16}),/* @__PURE__ */be("span",{className:"flex-1 truncate",children:t.getItemName()})]})})})},r)}),
216
- /* @__PURE__ */be(HT,{})]})}),/* @__PURE__ */be(hA,{open:!!N,onOpenChange:e=>!e&&T(null),children:/* @__PURE__ */xe(fA,{children:[/* @__PURE__ */xe(gA,{children:[/* @__PURE__ */be(yA,{children:"Move to Trash?"}),/* @__PURE__ */xe(bA,{children:['Are you sure you want to move "',P,'" to trash? You can restore it later from the trash.']})]}),/* @__PURE__ */xe(vA,{children:[/* @__PURE__ */be(wA,{children:"Cancel"}),/* @__PURE__ */be(xA,{onClick:()=>{N&&o&&(o(N),T(null),S(e=>({...e,selectedItems:e.selectedItems?.filter(e=>e!==N)??[]})))},children:"Move to Trash"})]})]})})]})});mM.displayName="FileTree";var fM="outline-collapse-preferences";ne(({headings:e=[],onNavigate:t,onReorder:r,searchQuery:n="",editorRef:a},o)=>{let[i,s]=fe(/* @__PURE__ */new Set),[l,c]=fe(null),d=function(e,t){let[r,n]=fe(null),a=me(null);return le(()=>{if(!t?.current||0===e.length)return void n(null);let r=e=>t.current?.getElementByKey(e)??null,o=r(e[0][0]);if(a.current=null,o){let e=o.parentElement;for(;e;){let t=window.getComputedStyle(e);if("auto"===t.overflowY||"scroll"===t.overflowY){a.current=e;break}e=e.parentElement}}let i=()=>{let t=a.current,o=t?t.clientHeight:window.innerHeight,i=t?t.getBoundingClientRect().top:0,s=.3*o,l=[];for(let[n]of e){let e=r(n);if(!e)continue;let t=e.getBoundingClientRect();l.push({key:n,top:t.top-i})}n(function(e,t){let r=null;for(let{key:n,top:a}of e){if(!(a<=t))break;r=n}return!r&&e.length>0&&(r=e[0].key),r}(l,s))},s=a.current??window;return s.addEventListener("scroll",i,{passive:!0}),i(),()=>s.removeEventListener("scroll",i)},[e,t]),r}(e,a),u=me(null),h=me(/* @__PURE__ */new Map);le(()=>{if(!d)return;let e=u.current,t=h.current.get(d);if(!e||!t)return;let r=function(e,t){if(t.offsetTop<e.scrollTop)return t.offsetTop;let r=t.offsetTop+t.offsetHeight;return r>e.scrollTop+e.clientHeight?r-e.clientHeight:null}(e,t);null!==r&&(e.scrollTop=r)},[d]);let p=pe(()=>e.map(([e,t,r],n)=>({id:e,level:parseInt(r[1],10),text:t,line:n})),[e]),m=pe(()=>{let e=/* @__PURE__ */new Map;return p.forEach((t,r)=>e.set(t.id,r)),e},[p]);de(o,()=>({expandAll:()=>{s(/* @__PURE__ */new Set)},collapseAll:()=>{let e=/* @__PURE__ */new Set;p.forEach(t=>{1===t.level&&e.add(t.id)}),s(e)}})),le(()=>{try{let e=localStorage.getItem(fM);if(e){let t=JSON.parse(e);c(t.defaultCollapseLevel||null),t.defaultCollapseLevel&&y(t.defaultCollapseLevel)}}catch(e){}},[]);let f=e=>{try{localStorage.setItem(fM,JSON.stringify({defaultCollapseLevel:e})),c(e)}catch(e){}},g=pe(()=>{if(!n.trim())return p;let e=n.toLowerCase();return p.filter(t=>t.text.toLowerCase().includes(e))},[p,n]),v=e=>{s(t=>{let r=new Set(t);return r.has(e)?(r.delete(e),(e=>{let t=p.findIndex(t=>t.id===e);if(-1===t)return[];let r=p[t].level,n=[];for(let a=t+1;a<p.length&&!(p[a].level<=r);a++)n.push(p[a].id);return n})(e).forEach(e=>r.delete(e))):r.add(e),r})},y=e=>{let t=/* @__PURE__ */new Set;p.forEach(r=>{r.level===e&&t.add(r.id)}),s(t)};return 0===p.length?/* @__PURE__ */be("div",{className:"flex h-full items-center justify-center p-6 text-center",children:/* @__PURE__ */xe("div",{children:[
208
+ /* @__PURE__ */be(iM,{children:"⌘V"})]}),
209
+ /* @__PURE__ */xe(tM,{onClick:()=>p?.(t),disabled:!p,children:[/* @__PURE__ */be(cm,{className:"mr-2 h-4 w-4"}),"Manage Tags"]}),
210
+ /* @__PURE__ */be(oM,{}),
211
+ /* @__PURE__ */xe(tM,{onClick:()=>h?.(t),disabled:!h,className:"text-destructive focus:text-destructive",children:[
212
+ /* @__PURE__ */be(pm,{className:"mr-2 h-4 w-4"}),"Delete",
213
+ /* @__PURE__ */be(iM,{children:"Del"})]})]})]})},lM="__root__";var cM=ne(({activeId:e,documents:t,onMove:r,onRename:n,onSelect:a,onDelete:o,onDuplicate:i,onAddChild:s,onAddChildFolder:l,onAddSibling:c,onAddSiblingFolder:d,onCopy:u,onPaste:h,onNewFile:p,onNewFolder:m,onManageTags:f,onExpandStateChange:g,onExpandedFoldersChange:v},y)=>{let b=pe(()=>function(e){let t={[lM]:{children:[],documentId:lM,isFolder:!0,name:"Root"}};for(let r of e)t[r.id]={children:[],documentId:r.id,isFolder:!!r.isFolder,name:r.title||"Untitled"};for(let r of e){let e=r.parentId&&t[r.parentId]?r.parentId:lM;t[e].children=[...t[e].children??[],r.id]}for(let r of Object.keys(t))r!==lM&&(t[r].children?.length??0)>0&&(t[r].isFolder=!0);return t}(t),[t]),x=pe(()=>t.filter(e=>b[e.id]?.isFolder&&e.isExpanded).map(e=>e.id),[t,b]),[w,S]=fe({expandedItems:x,selectedItems:e?[e]:[]}),[k,C]=fe(null),[N,T]=fe(null),A=(e=>{let[t]=fe(()=>({current:UN(e)})),[r,n]=fe(()=>t.current.getState());return le(()=>(t.current.setMounted(!0),t.current.rebuildTree(),()=>{t.current.setMounted(!1)}),[t]),t.current.setConfig(t=>MT(AT(AT({},t),e),{state:AT(AT({},r),e.state),setState:t=>{var r;n(t),null==(r=e.setState)||r.call(e,t)}})),t.current})({canReorder:!0,dataLoader:{getChildren:e=>{let t=b[e];return t?t.children??[]:[]},getItem:e=>b[e]||{children:[],documentId:e,isFolder:!1,name:"Deleted Item"}},features:[nT,WN,tT,bT,pT,yT],getItemName:e=>e.getItemData().name,onRename:(e,t)=>{let r=t.trim()||"Untitled";n?.(e.getId(),r)},indent:20,isItemFolder:e=>e.getItemData()?.isFolder??!1,onDrop:(e,t)=>{let n=e.map(e=>e.getId()).filter(e=>e!==lM);if(0===n.length)return;let a=[...n].reverse();if("childIndex"in t){let e=t.item.getId()===lM?null:t.item.getId(),o=function(e,t,r,n){let a=e.filter(e=>!t.includes(e)),o=a[r];if(o)return{targetId:o,position:"before"};let i=a[r-1];return i?{targetId:i,position:"after"}:{targetId:n,position:"child"}}(b[t.item.getId()]?.children??[],n,t.insertionIndex,e);for(let t of a)r(t,o.targetId,o.position);return}(e=>{for(let t of a)r(t,e,"child")})(t.item.getId()===lM?null:t.item.getId())},rootItemId:lM,setState:S,state:w});le(()=>{S(t=>({...t,selectedItems:e&&b[e]?[e]:[]}))},[e,b]);let M=x.join("\n");le(()=>{S(e=>({...e,expandedItems:x}))},[M]);let D=pe(()=>jc(b,lM),[b]),E=pe(()=>Uc(b,lM,w.expandedItems??[]),[b,w.expandedItems]),I=me(g);le(()=>{I.current=g},[g]),le(()=>{I.current?.({level:E,maxLevel:D})},[E,D]),le(()=>()=>I.current?.({level:0,maxLevel:0}),[]);let R=w.expandedItems??[],z=me(v);le(()=>{z.current=v},[v]);let _=R.join("\n");le(()=>{z.current?.(R)},[_]),de(y,()=>({collapseAll:()=>{S(e=>({...e,expandedItems:[]}))},edit:e=>{n&&A.getItemInstance(e).startRenaming()},expandAll:()=>{let e=qc(b,lM,D);S(t=>({...t,expandedItems:e}))},expandToLevel:e=>{let t=qc(b,lM,Math.min(e,D));S(e=>({...e,expandedItems:t}))},getExpandLevel:()=>E,getMaxExpandLevel:()=>D}));let P=N?b[N]?.name:"",O=me(null);O.current!==b&&(O.current=b,A.scheduleRebuildTree());let L=A.getItems();/* @__PURE__ */
214
+ return xe(ye,{children:[/* @__PURE__ */be("div",{className:"flex h-full flex-col gap-2 overflow-auto",children:/* @__PURE__ */xe(_T,{indent:20,tree:A,children:[
215
+ /* @__PURE__ */be(IT,{tree:A}),L.map(t=>{let r=t.getId();return r===lM?null:/* @__PURE__ */be(PT,{item:t,children:/* @__PURE__ */be(sM,{itemId:r,isFolder:t.isFolder(),hasCopiedItem:!!k,onAddChild:s,onAddChildFolder:l,onAddSibling:c,onAddSiblingFolder:d,onRename:n?()=>t.startRenaming():void 0,onDuplicate:i,onCopy:u?e=>{C(e),u(e)}:void 0,onPaste:h?()=>{k&&h(t.isFolder()?r:null)}:void 0,onDelete:o?()=>T(r):void 0,onManageTags:f,children:t.isRenaming()?/* @__PURE__ */be(OT,{className:"w-full text-left",onClick:e=>e.stopPropagation(),children:/* @__PURE__ */be("input",{...t.getRenameInputProps(),className:"flex-1 w-full rounded border bg-background px-1 text-sm outline-none focus:ring-2 focus:ring-ring"})}):/* @__PURE__ */be(OT,{className:Bf("w-full text-left",e===r&&"bg-accent text-accent-foreground"),onClick:()=>a(r),onDoubleClick:()=>n&&t.startRenaming(),children:/* @__PURE__ */xe("span",{className:"flex items-center gap-2 w-full min-w-0",children:[t.isFolder()?t.isExpanded()?/* @__PURE__ */be(Op,{className:"pointer-events-none size-4 shrink-0 text-muted-foreground"}):/* @__PURE__ */be(Bp,{className:"pointer-events-none size-4 shrink-0 text-muted-foreground"}):/* @__PURE__ */be(TN,{filename:t.getItemName(),size:16}),/* @__PURE__ */be("span",{className:"flex-1 truncate",children:t.getItemName()})]})})})},r)}),
216
+ /* @__PURE__ */be(LT,{})]})}),/* @__PURE__ */be(sA,{open:!!N,onOpenChange:e=>!e&&T(null),children:/* @__PURE__ */xe(dA,{children:[/* @__PURE__ */xe(uA,{children:[/* @__PURE__ */be(pA,{children:"Move to Trash?"}),/* @__PURE__ */xe(mA,{children:['Are you sure you want to move "',P,'" to trash? You can restore it later from the trash.']})]}),/* @__PURE__ */xe(hA,{children:[/* @__PURE__ */be(gA,{children:"Cancel"}),/* @__PURE__ */be(fA,{onClick:()=>{N&&o&&(o(N),T(null),S(e=>({...e,selectedItems:e.selectedItems?.filter(e=>e!==N)??[]})))},children:"Move to Trash"})]})]})})]})});cM.displayName="FileTree";var dM="outline-collapse-preferences";ne(({headings:e=[],onNavigate:t,onReorder:r,searchQuery:n="",editorRef:a},o)=>{let[i,s]=fe(/* @__PURE__ */new Set),[l,c]=fe(null),d=function(e,t){let[r,n]=fe(null),a=me(null);return le(()=>{if(!t?.current||0===e.length)return void n(null);let r=e=>t.current?.getElementByKey(e)??null,o=r(e[0][0]);if(a.current=null,o){let e=o.parentElement;for(;e;){let t=window.getComputedStyle(e);if("auto"===t.overflowY||"scroll"===t.overflowY){a.current=e;break}e=e.parentElement}}let i=()=>{let t=a.current,o=t?t.clientHeight:window.innerHeight,i=t?t.getBoundingClientRect().top:0,s=.3*o,l=[];for(let[n]of e){let e=r(n);if(!e)continue;let t=e.getBoundingClientRect();l.push({key:n,top:t.top-i})}n(function(e,t){let r=null;for(let{key:n,top:a}of e){if(!(a<=t))break;r=n}return!r&&e.length>0&&(r=e[0].key),r}(l,s))},s=a.current??window;return s.addEventListener("scroll",i,{passive:!0}),i(),()=>s.removeEventListener("scroll",i)},[e,t]),r}(e,a),u=me(null),h=me(/* @__PURE__ */new Map);le(()=>{if(!d)return;let e=u.current,t=h.current.get(d);if(!e||!t)return;let r=function(e,t){if(t.offsetTop<e.scrollTop)return t.offsetTop;let r=t.offsetTop+t.offsetHeight;return r>e.scrollTop+e.clientHeight?r-e.clientHeight:null}(e,t);null!==r&&(e.scrollTop=r)},[d]);let p=pe(()=>e.map(([e,t,r],n)=>({id:e,level:parseInt(r[1],10),text:t,line:n})),[e]),m=pe(()=>{let e=/* @__PURE__ */new Map;return p.forEach((t,r)=>e.set(t.id,r)),e},[p]);de(o,()=>({expandAll:()=>{s(/* @__PURE__ */new Set)},collapseAll:()=>{let e=/* @__PURE__ */new Set;p.forEach(t=>{1===t.level&&e.add(t.id)}),s(e)}})),le(()=>{try{let e=localStorage.getItem(dM);if(e){let t=JSON.parse(e);c(t.defaultCollapseLevel||null),t.defaultCollapseLevel&&y(t.defaultCollapseLevel)}}catch(e){}},[]);let f=e=>{try{localStorage.setItem(dM,JSON.stringify({defaultCollapseLevel:e})),c(e)}catch(e){}},g=pe(()=>{if(!n.trim())return p;let e=n.toLowerCase();return p.filter(t=>t.text.toLowerCase().includes(e))},[p,n]),v=e=>{s(t=>{let r=new Set(t);return r.has(e)?(r.delete(e),(e=>{let t=p.findIndex(t=>t.id===e);if(-1===t)return[];let r=p[t].level,n=[];for(let a=t+1;a<p.length&&!(p[a].level<=r);a++)n.push(p[a].id);return n})(e).forEach(e=>r.delete(e))):r.add(e),r})},y=e=>{let t=/* @__PURE__ */new Set;p.forEach(r=>{r.level===e&&t.add(r.id)}),s(t)};return 0===p.length?/* @__PURE__ */be("div",{className:"flex h-full items-center justify-center p-6 text-center",children:/* @__PURE__ */xe("div",{children:[
217
217
  /* @__PURE__ */be(jp,{className:"mx-auto h-12 w-12 text-muted-foreground opacity-50 mb-3"}),
218
218
  /* @__PURE__ */be("p",{className:"text-sm text-muted-foreground",children:"No headings found in this document"}),
219
- /* @__PURE__ */be("p",{className:"text-xs text-muted-foreground mt-1",children:"Use the heading buttons in the toolbar"})]})}):/* @__PURE__ */be("div",{ref:u,className:"flex h-full flex-col overflow-auto",children:g.map(e=>{let r=m.get(e.id),n=p[r+1],a=n&&n.level>e.level,o=i.has(e.id),c=e.id===d;return(e=>{let t=p[e].level;for(let r=e-1;r>=0;r--)if(p[r].level<t){if(i.has(p[r].id))return!0;if(1===p[r].level)break}return!1})(r)?null:/* @__PURE__ */xe(eM,{children:[/* @__PURE__ */be(tM,{children:/* @__PURE__ */xe("div",{ref:t=>{t?h.current.set(e.id,t):h.current.delete(e.id)},"data-active":c||void 0,className:qf("flex items-center gap-1 rounded-md cursor-pointer transition-colors hover:bg-sidebar-accent",1===e.level&&"py-1.5 mt-0.5",2===e.level&&"py-1",e.level>=3&&"py-0.5",c&&"bg-sidebar-accent"),style:{paddingLeft:12*(e.level-1)+4+"px",paddingRight:"4px"},onClick:()=>t?.(e.id),children:[
220
- /* @__PURE__ */be("button",{className:qf("h-4 w-4 p-0 shrink-0 flex items-center justify-center hover:bg-transparent",!a&&"invisible"),onClick:t=>{t.stopPropagation(),v(e.id)},children:/* @__PURE__ */be(fp,{className:qf("h-3 w-3 transition-transform text-muted-foreground",!o&&"rotate-90")})}),
221
- /* @__PURE__ */be(jp,{className:qf("shrink-0",1===e.level&&"h-3.5 w-3.5 text-blue-500",2===e.level&&"h-3 w-3 text-indigo-400",e.level>=3&&"h-2.5 w-2.5 text-muted-foreground")}),
222
- /* @__PURE__ */be("span",{className:qf("flex-1 truncate",1===e.level&&"text-sm font-semibold text-foreground",2===e.level&&"text-sm font-medium text-foreground/90",3===e.level&&"text-xs text-foreground/80",e.level>=4&&"text-xs text-muted-foreground",c&&"font-medium text-foreground"),children:e.text})]})}),/* @__PURE__ */xe(oM,{children:[
223
- /* @__PURE__ */xe(rM,{children:[/* @__PURE__ */be(nM,{children:"Collapse to..."}),/* @__PURE__ */xe(aM,{children:[
224
- /* @__PURE__ */be(iM,{onClick:()=>y(1),children:"Heading 1"}),
225
- /* @__PURE__ */be(iM,{onClick:()=>y(2),children:"Heading 2"}),
226
- /* @__PURE__ */be(iM,{onClick:()=>y(3),children:"Heading 3"}),
227
- /* @__PURE__ */be(iM,{onClick:()=>y(4),children:"Heading 4"}),
228
- /* @__PURE__ */be(iM,{onClick:()=>s(/* @__PURE__ */new Set),children:"Expand All"})]})]}),
229
- /* @__PURE__ */be(dM,{}),
230
- /* @__PURE__ */be(sM,{checked:null!==l,onCheckedChange:e=>{if(e){let e=p.find(e=>i.has(e.id));e&&f(e.level)}else f(null)},children:"Keep this collapse level as default"})]})]},e.id)})})}),Xb("inline-flex items-center justify-center rounded-2xl border px-3 py-1.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-gray-100 text-gray-700 [a&]:hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:[a&]:hover:bg-gray-700",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",new:"text-purple-600 dark:text-purple-300 bg-purple-600/30 dark:bg-purple-600/30",beta:"text-blue-600 dark:text-blue-300 bg-blue-600/30 dark:bg-blue-600/30",highlight:"text-green-800 dark:text-green-300 bg-green-600/30 dark:bg-green-600/30"}},defaultVariants:{variant:"default"}});var gM=[{id:"clarity",name:"Clarity",prompt:"Rewrite this paragraph for maximum clarity and straightforwardness, keeping all original meaning but removing ambiguity and simplifying complex sentences:",color:"blue"},{id:"concise",name:"Concise",prompt:"Rewrite this text to be more concise, removing redundancy and filler while preserving all key points and tone. Aim for about 50% of the original length:",color:"purple"},{id:"summarize",name:"Summarize",prompt:"Summarize the following text into a shorter paragraph, keeping the main ideas and overall tone but removing details and repetition:",color:"green"},{id:"rephrase",name:"Rephrase",prompt:"Rephrase this paragraph with fresh wording and more engaging style, varying sentence structure and word choice while preserving the core message:",color:"orange"},{id:"expand",name:"Expand",prompt:"Keep the original paragraph as-is, then expand it by adding one additional paragraph that elaborates on the main idea, gives an example, or adds helpful context for the reader:",color:"pink"}],vM="REASON-rewrite-modes",yM=()=>{try{let e=localStorage.getItem(vM);if(e)return JSON.parse(e)}catch(e){}return gM},bM=e=>{try{localStorage.setItem(vM,JSON.stringify(e))}catch(e){}};typeof window>"u"||window.localStorage;ne(function(e,t){let{className:r,style:n,children:a,defaultSize:o,size:i,minSize:s,maxSize:l,...c}=e,d={position:"relative",outline:"none",overflow:"auto",flex:"none",...n},u=function(...e){return e.filter(Boolean).join(" ")}("split-pane-pane",r);return be("div",{ref:t,className:u,style:d,"data-pane":"true",...c,children:a})});function xM({...e}){/* @__PURE__ */
231
- return be(pt.Root,{"data-slot":"sheet",...e})}function wM({...e}){/* @__PURE__ */
232
- return be(pt.Portal,{"data-slot":"sheet-portal",...e})}function SM({className:e,...t}){/* @__PURE__ */
233
- return be(pt.Overlay,{"data-slot":"sheet-overlay",className:ec("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function kM({className:e,children:t,side:r="right",...n}){/* @__PURE__ */
234
- return xe(wM,{children:[/* @__PURE__ */be(SM,{}),/* @__PURE__ */xe(pt.Content,{"data-slot":"sheet-content",className:ec("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500","right"===r&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm","left"===r&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm","top"===r&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b","bottom"===r&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",e),...n,children:[t,/* @__PURE__ */xe(pt.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[/* @__PURE__ */be(ht,{className:"size-4"}),/* @__PURE__ */be("span",{className:"sr-only",children:"Close"})]})]})]})}function CM({className:e,...t}){/* @__PURE__ */
235
- return be("div",{"data-slot":"sheet-header",className:ec("flex flex-col gap-1.5 p-4",e),...t})}function NM({className:e,...t}){/* @__PURE__ */
236
- return be(pt.Title,{"data-slot":"sheet-title",className:ec("text-foreground font-semibold",e),...t})}function TM({className:e,...t}){/* @__PURE__ */
237
- return be(pt.Description,{"data-slot":"sheet-description",className:ec("text-muted-foreground text-sm",e),...t})}var AM="bg-white/10 dark:bg-black/20 backdrop-blur-md border-white/15 dark:border-white/10",MM={top:!1,right:!1,bottom:!1,left:!0,topRight:!1,bottomRight:!1,bottomLeft:!1,topLeft:!1},DM=Object.fromEntries(RN.map(({type:e,label:t})=>[e,t]));function EM({SidebarContentComponent:e,panels:t,documents:r,activeId:n,activeDocument:a,onSelect:o,onAdd:i,onDelete:s,onDuplicate:l,onSetExpandedFolders:c,onMove:d,onManageTags:u,onRename:h,headings:p,onNavigate:m,openTabs:f,activeTab:g,onTabChange:v,onTabClose:y,onTabsClose:b,onTabRename:x,onSplitRight:w,onReopenLastClosed:S,canReopenLastClosed:k,outlineRef:C,editorRef:N,tabItems:T,onNewChat:A,aiProps:M,tipsProps:D,topicsProps:E,onClose:I,isMobile:R,isOpen:z,onOpenChange:_}){const[P,O]=fe(320),L=1===t.length?DM[t[0]]:"Right Panel",F=/* @__PURE__ */xe("div",{className:"h-full overflow-hidden flex flex-col",children:[/* @__PURE__ */xe("div",{className:"px-3 py-2 border-b border-sidebar-border/60 flex items-center justify-between select-none shrink-0",children:[/* @__PURE__ */be("h3",{className:"text-sm font-semibold text-sidebar-foreground",children:L}),/* @__PURE__ */be(oc,{variant:"ghost",size:"sm",className:"h-7 px-2",onClick:I,children:/* @__PURE__ */be(ut,{className:"h-4 w-4"})})]}),/* @__PURE__ */be("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */be(e,{panels:t,persistenceKey:"right",activeDocuments:r,activeId:n,activeDocument:a,headings:p,onSelect:o,onAdd:i,onDelete:s,onDuplicate:l,onSetExpandedFolders:c,onMove:d,onManageTags:u,onRename:h,outlineRef:C,editorRef:N,openTabs:f,activeTab:g,onTabChange:v,onTabClose:y,onTabsClose:b,onTabRename:x,onSplitRight:w,onReopenLastClosed:S,canReopenLastClosed:k,onNavigate:m,tabItems:T,onNewChat:A,aiProps:M,tipsProps:D,topicsProps:E})})]});return R?/* @__PURE__ */be(xM,{open:z,onOpenChange:_,children:/* @__PURE__ */be(kM,{side:"right",className:ec("w-80 p-0",AM),children:/* @__PURE__ */be("aside",{className:"h-full flex flex-col",children:F})})}):/* @__PURE__ */be(Tt,{size:{width:P,height:"100%"},onResizeStop:(e,t,r)=>O(r.offsetWidth),minWidth:260,maxWidth:640,enable:MM,className:ec("h-full flex flex-col border-l shrink-0",AM),children:F})}function IM({...e}){/* @__PURE__ */
238
- return be(pt.Root,{"data-slot":"dialog",...e})}function RM({...e}){/* @__PURE__ */
239
- return be(pt.Portal,{"data-slot":"dialog-portal",...e})}function zM({className:e,...t}){/* @__PURE__ */
240
- return be(pt.Overlay,{"data-slot":"dialog-overlay",className:ec("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50 backdrop-blur-xs",e),...t})}function _M({className:e,children:t,hideCloseButton:r=!1,...n}){/* @__PURE__ */
241
- return xe(RM,{"data-slot":"dialog-portal",children:[/* @__PURE__ */be(zM,{}),/* @__PURE__ */xe(pt.Content,{"data-slot":"dialog-content","aria-describedby":n["aria-describedby"]??void 0,className:ec("z-[9999] bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-2xl border p-6 shadow-lg duration-200",e),...n,children:[t,!r&&/* @__PURE__ */xe(pt.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[/* @__PURE__ */be(ht,{}),/* @__PURE__ */be("span",{className:"sr-only",children:"Close"})]})]})]})}function PM({className:e,...t}){/* @__PURE__ */
242
- return be("div",{"data-slot":"dialog-header",className:ec("flex flex-col gap-2 text-center sm:text-left",e),...t})}function OM({className:e,...t}){/* @__PURE__ */
243
- return be("div",{"data-slot":"dialog-footer",className:ec("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function LM({className:e,...t}){/* @__PURE__ */
244
- return be(pt.Title,{"data-slot":"dialog-title",className:ec("text-lg leading-none font-semibold",e),...t})}function FM({className:e,...t}){/* @__PURE__ */
245
- return be(pt.Description,{"data-slot":"dialog-description",className:ec("text-muted-foreground text-sm",e),...t})}function BM({className:e,type:t,...r}){/* @__PURE__ */
246
- return be("input",{type:t,"data-slot":"input",className:ec("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground flex h-11 w-full min-w-0 rounded-2xl border bg-card px-3 py-1 text-sm font-medium transition-[color] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50","focus:outline-none focus:ring-2 focus:ring-primary/50","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...r})}function VM({className:e,children:t,...r}){/* @__PURE__ */
219
+ /* @__PURE__ */be("p",{className:"text-xs text-muted-foreground mt-1",children:"Use the heading buttons in the toolbar"})]})}):/* @__PURE__ */be("div",{ref:u,className:"flex h-full flex-col overflow-auto",children:g.map(e=>{let r=m.get(e.id),n=p[r+1],a=n&&n.level>e.level,o=i.has(e.id),c=e.id===d;return(e=>{let t=p[e].level;for(let r=e-1;r>=0;r--)if(p[r].level<t){if(i.has(p[r].id))return!0;if(1===p[r].level)break}return!1})(r)?null:/* @__PURE__ */xe(YA,{children:[/* @__PURE__ */be(XA,{children:/* @__PURE__ */xe("div",{ref:t=>{t?h.current.set(e.id,t):h.current.delete(e.id)},"data-active":c||void 0,className:Bf("flex items-center gap-1 rounded-md cursor-pointer transition-colors hover:bg-sidebar-accent",1===e.level&&"py-1.5 mt-0.5",2===e.level&&"py-1",e.level>=3&&"py-0.5",c&&"bg-sidebar-accent"),style:{paddingLeft:12*(e.level-1)+4+"px",paddingRight:"4px"},onClick:()=>t?.(e.id),children:[
220
+ /* @__PURE__ */be("button",{className:Bf("h-4 w-4 p-0 shrink-0 flex items-center justify-center hover:bg-transparent",!a&&"invisible"),onClick:t=>{t.stopPropagation(),v(e.id)},children:/* @__PURE__ */be(fp,{className:Bf("h-3 w-3 transition-transform text-muted-foreground",!o&&"rotate-90")})}),
221
+ /* @__PURE__ */be(jp,{className:Bf("shrink-0",1===e.level&&"h-3.5 w-3.5 text-blue-500",2===e.level&&"h-3 w-3 text-indigo-400",e.level>=3&&"h-2.5 w-2.5 text-muted-foreground")}),
222
+ /* @__PURE__ */be("span",{className:Bf("flex-1 truncate",1===e.level&&"text-sm font-semibold text-foreground",2===e.level&&"text-sm font-medium text-foreground/90",3===e.level&&"text-xs text-foreground/80",e.level>=4&&"text-xs text-muted-foreground",c&&"font-medium text-foreground"),children:e.text})]})}),/* @__PURE__ */xe(eM,{children:[
223
+ /* @__PURE__ */xe(ZA,{children:[/* @__PURE__ */be(JA,{children:"Collapse to..."}),/* @__PURE__ */xe(QA,{children:[
224
+ /* @__PURE__ */be(tM,{onClick:()=>y(1),children:"Heading 1"}),
225
+ /* @__PURE__ */be(tM,{onClick:()=>y(2),children:"Heading 2"}),
226
+ /* @__PURE__ */be(tM,{onClick:()=>y(3),children:"Heading 3"}),
227
+ /* @__PURE__ */be(tM,{onClick:()=>y(4),children:"Heading 4"}),
228
+ /* @__PURE__ */be(tM,{onClick:()=>s(/* @__PURE__ */new Set),children:"Expand All"})]})]}),
229
+ /* @__PURE__ */be(oM,{}),
230
+ /* @__PURE__ */be(rM,{checked:null!==l,onCheckedChange:e=>{if(e){let e=p.find(e=>i.has(e.id));e&&f(e.level)}else f(null)},children:"Keep this collapse level as default"})]})]},e.id)})})}),Ub("inline-flex items-center justify-center rounded-2xl border px-3 py-1.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-gray-100 text-gray-700 [a&]:hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:[a&]:hover:bg-gray-700",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",new:"text-purple-600 dark:text-purple-300 bg-purple-600/30 dark:bg-purple-600/30",beta:"text-blue-600 dark:text-blue-300 bg-blue-600/30 dark:bg-blue-600/30",highlight:"text-green-800 dark:text-green-300 bg-green-600/30 dark:bg-green-600/30"}},defaultVariants:{variant:"default"}});var uM=[{id:"clarity",name:"Clarity",prompt:"Rewrite this paragraph for maximum clarity and straightforwardness, keeping all original meaning but removing ambiguity and simplifying complex sentences:",color:"blue"},{id:"concise",name:"Concise",prompt:"Rewrite this text to be more concise, removing redundancy and filler while preserving all key points and tone. Aim for about 50% of the original length:",color:"purple"},{id:"summarize",name:"Summarize",prompt:"Summarize the following text into a shorter paragraph, keeping the main ideas and overall tone but removing details and repetition:",color:"green"},{id:"rephrase",name:"Rephrase",prompt:"Rephrase this paragraph with fresh wording and more engaging style, varying sentence structure and word choice while preserving the core message:",color:"orange"},{id:"expand",name:"Expand",prompt:"Keep the original paragraph as-is, then expand it by adding one additional paragraph that elaborates on the main idea, gives an example, or adds helpful context for the reader:",color:"pink"}],hM="REASON-rewrite-modes",pM=()=>{try{let e=localStorage.getItem(hM);if(e)return JSON.parse(e)}catch(e){}return uM},mM=e=>{try{localStorage.setItem(hM,JSON.stringify(e))}catch(e){}};typeof window>"u"||window.localStorage;ne(function(e,t){let{className:r,style:n,children:a,defaultSize:o,size:i,minSize:s,maxSize:l,...c}=e,d={position:"relative",outline:"none",overflow:"auto",flex:"none",...n},u=function(...e){return e.filter(Boolean).join(" ")}("split-pane-pane",r);return be("div",{ref:t,className:u,style:d,"data-pane":"true",...c,children:a})});function fM({...e}){/* @__PURE__ */
231
+ return be(pt.Root,{"data-slot":"sheet",...e})}function gM({...e}){/* @__PURE__ */
232
+ return be(pt.Portal,{"data-slot":"sheet-portal",...e})}function vM({className:e,...t}){/* @__PURE__ */
233
+ return be(pt.Overlay,{"data-slot":"sheet-overlay",className:ec("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function yM({className:e,children:t,side:r="right",...n}){/* @__PURE__ */
234
+ return xe(gM,{children:[/* @__PURE__ */be(vM,{}),/* @__PURE__ */xe(pt.Content,{"data-slot":"sheet-content",className:ec("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500","right"===r&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm","left"===r&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm","top"===r&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b","bottom"===r&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",e),...n,children:[t,/* @__PURE__ */xe(pt.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[/* @__PURE__ */be(ht,{className:"size-4"}),/* @__PURE__ */be("span",{className:"sr-only",children:"Close"})]})]})]})}function bM({className:e,...t}){/* @__PURE__ */
235
+ return be("div",{"data-slot":"sheet-header",className:ec("flex flex-col gap-1.5 p-4",e),...t})}function xM({className:e,...t}){/* @__PURE__ */
236
+ return be(pt.Title,{"data-slot":"sheet-title",className:ec("text-foreground font-semibold",e),...t})}function wM({className:e,...t}){/* @__PURE__ */
237
+ return be(pt.Description,{"data-slot":"sheet-description",className:ec("text-muted-foreground text-sm",e),...t})}var SM="bg-white/10 dark:bg-black/20 backdrop-blur-md border-white/15 dark:border-white/10",kM={top:!1,right:!1,bottom:!1,left:!0,topRight:!1,bottomRight:!1,bottomLeft:!1,topLeft:!1},CM=Object.fromEntries(AN.map(({type:e,label:t})=>[e,t]));function NM({SidebarContentComponent:e,panels:t,documents:r,activeId:n,activeDocument:a,onSelect:o,onAdd:i,onDelete:s,onDuplicate:l,onSetExpandedFolders:c,onMove:d,onManageTags:u,onRename:h,headings:p,onNavigate:m,openTabs:f,activeTab:g,onTabChange:v,onTabClose:y,onTabsClose:b,onTabRename:x,onSplitRight:w,onReopenLastClosed:S,canReopenLastClosed:k,outlineRef:C,editorRef:N,tabItems:T,onNewChat:A,aiProps:M,tipsProps:D,topicsProps:E,onClose:I,isMobile:R,isOpen:z,onOpenChange:_}){const[P,O]=fe(320),L=1===t.length?CM[t[0]]:"Right Panel",F=/* @__PURE__ */xe("div",{className:"h-full overflow-hidden flex flex-col",children:[/* @__PURE__ */xe("div",{className:"px-3 py-2 border-b border-sidebar-border/60 flex items-center justify-between select-none shrink-0",children:[/* @__PURE__ */be("h3",{className:"text-sm font-semibold text-sidebar-foreground",children:L}),/* @__PURE__ */be(oc,{variant:"ghost",size:"sm",className:"h-7 px-2",onClick:I,children:/* @__PURE__ */be(ut,{className:"h-4 w-4"})})]}),/* @__PURE__ */be("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */be(e,{panels:t,persistenceKey:"right",activeDocuments:r,activeId:n,activeDocument:a,headings:p,onSelect:o,onAdd:i,onDelete:s,onDuplicate:l,onSetExpandedFolders:c,onMove:d,onManageTags:u,onRename:h,outlineRef:C,editorRef:N,openTabs:f,activeTab:g,onTabChange:v,onTabClose:y,onTabsClose:b,onTabRename:x,onSplitRight:w,onReopenLastClosed:S,canReopenLastClosed:k,onNavigate:m,tabItems:T,onNewChat:A,aiProps:M,tipsProps:D,topicsProps:E})})]});return R?/* @__PURE__ */be(fM,{open:z,onOpenChange:_,children:/* @__PURE__ */be(yM,{side:"right",className:ec("w-80 p-0",SM),children:/* @__PURE__ */be("aside",{className:"h-full flex flex-col",children:F})})}):/* @__PURE__ */be(Tt,{size:{width:P,height:"100%"},onResizeStop:(e,t,r)=>O(r.offsetWidth),minWidth:260,maxWidth:640,enable:kM,className:ec("h-full flex flex-col border-l shrink-0",SM),children:F})}function TM({...e}){/* @__PURE__ */
238
+ return be(pt.Root,{"data-slot":"dialog",...e})}function AM({...e}){/* @__PURE__ */
239
+ return be(pt.Portal,{"data-slot":"dialog-portal",...e})}function MM({className:e,...t}){/* @__PURE__ */
240
+ return be(pt.Overlay,{"data-slot":"dialog-overlay",className:ec("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50 backdrop-blur-xs",e),...t})}function DM({className:e,children:t,hideCloseButton:r=!1,...n}){/* @__PURE__ */
241
+ return xe(AM,{"data-slot":"dialog-portal",children:[/* @__PURE__ */be(MM,{}),/* @__PURE__ */xe(pt.Content,{"data-slot":"dialog-content","aria-describedby":n["aria-describedby"]??void 0,className:ec("z-[9999] bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-2xl border p-6 shadow-lg duration-200",e),...n,children:[t,!r&&/* @__PURE__ */xe(pt.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[/* @__PURE__ */be(ht,{}),/* @__PURE__ */be("span",{className:"sr-only",children:"Close"})]})]})]})}function EM({className:e,...t}){/* @__PURE__ */
242
+ return be("div",{"data-slot":"dialog-header",className:ec("flex flex-col gap-2 text-center sm:text-left",e),...t})}function IM({className:e,...t}){/* @__PURE__ */
243
+ return be("div",{"data-slot":"dialog-footer",className:ec("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function RM({className:e,...t}){/* @__PURE__ */
244
+ return be(pt.Title,{"data-slot":"dialog-title",className:ec("text-lg leading-none font-semibold",e),...t})}function zM({className:e,...t}){/* @__PURE__ */
245
+ return be(pt.Description,{"data-slot":"dialog-description",className:ec("text-muted-foreground text-sm",e),...t})}function _M({className:e,type:t,...r}){/* @__PURE__ */
246
+ return be("input",{type:t,"data-slot":"input",className:ec("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground flex h-11 w-full min-w-0 rounded-2xl border bg-card px-3 py-1 text-sm font-medium transition-[color] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50","focus:outline-none focus:ring-2 focus:ring-primary/50","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...r})}function PM({className:e,children:t,...r}){/* @__PURE__ */
247
247
  return xe(xn,{"data-slot":"scroll-area",className:ec("relative",e),...r,children:[
248
248
  /* @__PURE__ */be(wn,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1 [&>div]:!block",children:t}),
249
- /* @__PURE__ */be($M,{}),
250
- /* @__PURE__ */be($M,{orientation:"horizontal"}),
251
- /* @__PURE__ */be(Sn,{})]})}function $M({className:e,orientation:t="vertical",...r}){/* @__PURE__ */
252
- return be(Wr,{"data-slot":"scroll-area-scrollbar",orientation:t,className:ec("flex touch-none p-px transition-colors select-none","vertical"===t&&"h-full w-2.5 border-l border-l-transparent","horizontal"===t&&"h-2.5 flex-col border-t border-t-transparent",e),...r,children:/* @__PURE__ */be(an,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}var HM=X.forwardRef(({className:e,...t},r)=>/* @__PURE__ */be("span",{ref:r,className:ec("absolute w-px h-px p-0 -m-px overflow-hidden whitespace-nowrap border-0",e),style:{clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)"},...t}));HM.displayName="VisuallyHidden";var jM={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'","&nbsp;":" "};function qM(e){return e.replace(/<[^>]*>/g," ").replace(/&(?:amp|lt|gt|quot|#39|nbsp);/g,e=>jM[e]??e).replace(/\s+/g," ").trim()}function UM(e,t){if(!t)return 0;let r=0,n=e.indexOf(t);for(;-1!==n;)r++,n=e.indexOf(t,n+t.length);return r}var GM=({open:e,onOpenChange:t,documents:r,onSelectDocument:n,onOpenSettings:a,onOpenTeams:o,onToggleTheme:i,currentTheme:s="light"})=>{const[l,c]=fe(""),d=me(null),u=pe(()=>{const e=[];return a&&e.push({id:"settings",label:"Open Settings",icon:/* @__PURE__ */be(nt,{className:"h-4 w-4"}),action:()=>{a(),t(!1)},keywords:["settings","preferences","config"]}),o&&e.push({id:"teams",label:"Manage Teams",icon:/* @__PURE__ */be(lt,{className:"h-4 w-4"}),action:()=>{o(),t(!1)},keywords:["teams","organization","members","collaborate"]}),i&&e.push({id:"theme",label:"dark"===s?"Switch to Light Mode":"Switch to Dark Mode",icon:/* @__PURE__ */be("dark"===s?ot:Xe,{className:"h-4 w-4"}),action:()=>{i()},keywords:["theme","dark","light","mode","appearance"]}),e},[a,o,i,s,t]),h=pe(()=>function(e,t){const r=t.trim();if(!r)return[];const n=r.toLowerCase(),a=[];for(const o of e){const e=qM(o.content),t=e.toLowerCase(),i=UM(t,n);if(o.title.toLowerCase().includes(n))a.push({document:o,matchType:"title",matchCount:i,preview:e?e.slice(0,120)+(e.length>120?"...":""):void 0});else if(i>0){const s=t.indexOf(n),l=Math.max(0,s-40),c=Math.min(e.length,s+r.length+40);a.push({document:o,matchType:"content",matchCount:i,preview:(l>0?"...":"")+e.slice(l,c)+(c<e.length?"...":"")})}}return a}(r,l),[l,r]),p=pe(()=>{if(!l.trim())return u;const e=l.toLowerCase();return u.filter(t=>{const r=t.label.toLowerCase().includes(e),n=t.keywords?.some(t=>t.toLowerCase().includes(e));return r||n})},[l,u]);le(()=>{e?setTimeout(()=>d.current?.focus(),100):c("")},[e]),le(()=>{const r=r=>{e&&"Escape"===r.key&&t(!1)};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[e,t]);const m=p.length>0,f=h.length>0,g=""!==l.trim()&&!m&&!f;/* @__PURE__ */
253
- return be(IM,{open:e,onOpenChange:t,children:/* @__PURE__ */xe(_M,{className:"max-w-2xl w-[95vw] sm:w-full p-0 gap-0 max-h-[90vh] sm:max-h-[85vh]",children:[
254
- /* @__PURE__ */be(HM,{children:/* @__PURE__ */be(LM,{children:"Search notes and commands"})}),
255
- /* @__PURE__ */be(PM,{className:"px-4 py-4 border-b border-border",children:/* @__PURE__ */xe("div",{className:"relative",children:[
249
+ /* @__PURE__ */be(OM,{}),
250
+ /* @__PURE__ */be(OM,{orientation:"horizontal"}),
251
+ /* @__PURE__ */be(Sn,{})]})}function OM({className:e,orientation:t="vertical",...r}){/* @__PURE__ */
252
+ return be(Wr,{"data-slot":"scroll-area-scrollbar",orientation:t,className:ec("flex touch-none p-px transition-colors select-none","vertical"===t&&"h-full w-2.5 border-l border-l-transparent","horizontal"===t&&"h-2.5 flex-col border-t border-t-transparent",e),...r,children:/* @__PURE__ */be(an,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}var LM=X.forwardRef(({className:e,...t},r)=>/* @__PURE__ */be("span",{ref:r,className:ec("absolute w-px h-px p-0 -m-px overflow-hidden whitespace-nowrap border-0",e),style:{clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)"},...t}));LM.displayName="VisuallyHidden";var FM={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'","&nbsp;":" "};function BM(e){return e.replace(/<[^>]*>/g," ").replace(/&(?:amp|lt|gt|quot|#39|nbsp);/g,e=>FM[e]??e).replace(/\s+/g," ").trim()}function VM(e,t){if(!t)return 0;let r=0,n=e.indexOf(t);for(;-1!==n;)r++,n=e.indexOf(t,n+t.length);return r}var $M=({open:e,onOpenChange:t,documents:r,onSelectDocument:n,onOpenSettings:a,onOpenTeams:o,onToggleTheme:i,currentTheme:s="light"})=>{const[l,c]=fe(""),d=me(null),u=pe(()=>{const e=[];return a&&e.push({id:"settings",label:"Open Settings",icon:/* @__PURE__ */be(nt,{className:"h-4 w-4"}),action:()=>{a(),t(!1)},keywords:["settings","preferences","config"]}),o&&e.push({id:"teams",label:"Manage Teams",icon:/* @__PURE__ */be(lt,{className:"h-4 w-4"}),action:()=>{o(),t(!1)},keywords:["teams","organization","members","collaborate"]}),i&&e.push({id:"theme",label:"dark"===s?"Switch to Light Mode":"Switch to Dark Mode",icon:/* @__PURE__ */be("dark"===s?ot:Xe,{className:"h-4 w-4"}),action:()=>{i()},keywords:["theme","dark","light","mode","appearance"]}),e},[a,o,i,s,t]),h=pe(()=>function(e,t){const r=t.trim();if(!r)return[];const n=r.toLowerCase(),a=[];for(const o of e){const e=BM(o.content),t=e.toLowerCase(),i=VM(t,n);if(o.title.toLowerCase().includes(n))a.push({document:o,matchType:"title",matchCount:i,preview:e?e.slice(0,120)+(e.length>120?"...":""):void 0});else if(i>0){const s=t.indexOf(n),l=Math.max(0,s-40),c=Math.min(e.length,s+r.length+40);a.push({document:o,matchType:"content",matchCount:i,preview:(l>0?"...":"")+e.slice(l,c)+(c<e.length?"...":"")})}}return a}(r,l),[l,r]),p=pe(()=>{if(!l.trim())return u;const e=l.toLowerCase();return u.filter(t=>{const r=t.label.toLowerCase().includes(e),n=t.keywords?.some(t=>t.toLowerCase().includes(e));return r||n})},[l,u]);le(()=>{e?setTimeout(()=>d.current?.focus(),100):c("")},[e]),le(()=>{const r=r=>{e&&"Escape"===r.key&&t(!1)};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[e,t]);const m=p.length>0,f=h.length>0,g=""!==l.trim()&&!m&&!f;/* @__PURE__ */
253
+ return be(TM,{open:e,onOpenChange:t,children:/* @__PURE__ */xe(DM,{className:"max-w-2xl w-[95vw] sm:w-full p-0 gap-0 max-h-[90vh] sm:max-h-[85vh]",children:[
254
+ /* @__PURE__ */be(LM,{children:/* @__PURE__ */be(RM,{children:"Search notes and commands"})}),
255
+ /* @__PURE__ */be(EM,{className:"px-4 py-4 border-b border-border",children:/* @__PURE__ */xe("div",{className:"relative",children:[
256
256
  /* @__PURE__ */be(Ee,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),
257
- /* @__PURE__ */be(BM,{ref:d,type:"text",placeholder:"Search notes or type a command...",value:l,onChange:e=>c(e.target.value),className:"pl-9 pr-9 border-none shadow-none focus-visible:ring-0 text-sm sm:text-base"}),l&&/* @__PURE__ */be("button",{onClick:()=>c(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:/* @__PURE__ */be(ut,{className:"h-4 w-4"})})]})}),
258
- /* @__PURE__ */be(VM,{className:"max-h-[50vh] sm:max-h-[60vh]",children:""===l.trim()?/* @__PURE__ */xe("div",{className:"py-2",children:[u.length>0&&/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be("div",{className:"px-4 py-2",children:/* @__PURE__ */be("h3",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Quick Actions"})}),u.map(e=>/* @__PURE__ */be("button",{onClick:e.action,className:"w-full px-4 py-3 text-left hover:bg-muted/50 transition-colors border-b border-border last:border-0",children:/* @__PURE__ */xe("div",{className:"flex items-center gap-3",children:[/* @__PURE__ */be("div",{className:"flex-shrink-0 text-muted-foreground",children:e.icon}),/* @__PURE__ */be("span",{className:"text-sm font-medium",children:e.label})]})},e.id))]}),/* @__PURE__ */xe("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[/* @__PURE__ */be(tt,{className:"h-12 w-12 text-muted-foreground mb-4 opacity-50"}),/* @__PURE__ */be("p",{className:"text-sm text-muted-foreground",children:"Type to search across all your notes"})]})]}):/* @__PURE__ */xe("div",g?{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[/* @__PURE__ */be(Oe,{className:"h-12 w-12 text-muted-foreground mb-4 opacity-50"}),/* @__PURE__ */xe("p",{className:"text-sm text-muted-foreground",children:['No results found for "',l,'"']})]}:{className:"py-2",children:[m&&/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be("div",{className:"px-4 py-2",children:/* @__PURE__ */be("h3",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Commands"})}),p.map(e=>/* @__PURE__ */be("button",{onClick:e.action,className:"w-full px-4 py-3 text-left hover:bg-muted/50 transition-colors border-b border-border",children:/* @__PURE__ */xe("div",{className:"flex items-center gap-3",children:[/* @__PURE__ */be("div",{className:"flex-shrink-0 text-muted-foreground",children:e.icon}),/* @__PURE__ */be("span",{className:"text-sm font-medium",children:e.label})]})},e.id))]}),f&&/* @__PURE__ */xe(ye,{children:[m&&/* @__PURE__ */be("div",{className:"px-4 py-2 mt-2",children:/* @__PURE__ */be("h3",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Notes"})}),h.map(e=>/* @__PURE__ */be("button",{onClick:()=>(e=>{n(e),t(!1),c("")})(e.document.id),className:"w-full px-4 py-3 text-left hover:bg-muted/50 transition-colors border-b border-border last:border-0",children:/* @__PURE__ */xe("div",{className:"flex items-start gap-3",children:[/* @__PURE__ */be(Oe,{className:"h-4 w-4 mt-1 flex-shrink-0 text-muted-foreground"}),/* @__PURE__ */xe("div",{className:"flex-1 min-w-0",children:[/* @__PURE__ */xe("div",{className:"flex items-center gap-2 mb-1",children:[/* @__PURE__ */be("h3",{className:"font-medium text-sm truncate",children:e.document.title||"Untitled"}),"content"===e.matchType&&e.matchCount>1&&/* @__PURE__ */xe("span",{className:"flex-shrink-0 text-xs text-muted-foreground tabular-nums",children:[e.matchCount," matches"]})]}),e.preview&&/* @__PURE__ */be("p",{className:"text-xs text-muted-foreground line-clamp-2",children:e.preview})]})]})},e.document.id))]})]})}),
257
+ /* @__PURE__ */be(_M,{ref:d,type:"text",placeholder:"Search notes or type a command...",value:l,onChange:e=>c(e.target.value),className:"pl-9 pr-9 border-none shadow-none focus-visible:ring-0 text-sm sm:text-base"}),l&&/* @__PURE__ */be("button",{onClick:()=>c(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:/* @__PURE__ */be(ut,{className:"h-4 w-4"})})]})}),
258
+ /* @__PURE__ */be(PM,{className:"max-h-[50vh] sm:max-h-[60vh]",children:""===l.trim()?/* @__PURE__ */xe("div",{className:"py-2",children:[u.length>0&&/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be("div",{className:"px-4 py-2",children:/* @__PURE__ */be("h3",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Quick Actions"})}),u.map(e=>/* @__PURE__ */be("button",{onClick:e.action,className:"w-full px-4 py-3 text-left hover:bg-muted/50 transition-colors border-b border-border last:border-0",children:/* @__PURE__ */xe("div",{className:"flex items-center gap-3",children:[/* @__PURE__ */be("div",{className:"flex-shrink-0 text-muted-foreground",children:e.icon}),/* @__PURE__ */be("span",{className:"text-sm font-medium",children:e.label})]})},e.id))]}),/* @__PURE__ */xe("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[/* @__PURE__ */be(tt,{className:"h-12 w-12 text-muted-foreground mb-4 opacity-50"}),/* @__PURE__ */be("p",{className:"text-sm text-muted-foreground",children:"Type to search across all your notes"})]})]}):/* @__PURE__ */xe("div",g?{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[/* @__PURE__ */be(Oe,{className:"h-12 w-12 text-muted-foreground mb-4 opacity-50"}),/* @__PURE__ */xe("p",{className:"text-sm text-muted-foreground",children:['No results found for "',l,'"']})]}:{className:"py-2",children:[m&&/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be("div",{className:"px-4 py-2",children:/* @__PURE__ */be("h3",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Commands"})}),p.map(e=>/* @__PURE__ */be("button",{onClick:e.action,className:"w-full px-4 py-3 text-left hover:bg-muted/50 transition-colors border-b border-border",children:/* @__PURE__ */xe("div",{className:"flex items-center gap-3",children:[/* @__PURE__ */be("div",{className:"flex-shrink-0 text-muted-foreground",children:e.icon}),/* @__PURE__ */be("span",{className:"text-sm font-medium",children:e.label})]})},e.id))]}),f&&/* @__PURE__ */xe(ye,{children:[m&&/* @__PURE__ */be("div",{className:"px-4 py-2 mt-2",children:/* @__PURE__ */be("h3",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Notes"})}),h.map(e=>/* @__PURE__ */be("button",{onClick:()=>(e=>{n(e),t(!1),c("")})(e.document.id),className:"w-full px-4 py-3 text-left hover:bg-muted/50 transition-colors border-b border-border last:border-0",children:/* @__PURE__ */xe("div",{className:"flex items-start gap-3",children:[/* @__PURE__ */be(Oe,{className:"h-4 w-4 mt-1 flex-shrink-0 text-muted-foreground"}),/* @__PURE__ */xe("div",{className:"flex-1 min-w-0",children:[/* @__PURE__ */xe("div",{className:"flex items-center gap-2 mb-1",children:[/* @__PURE__ */be("h3",{className:"font-medium text-sm truncate",children:e.document.title||"Untitled"}),"content"===e.matchType&&e.matchCount>1&&/* @__PURE__ */xe("span",{className:"flex-shrink-0 text-xs text-muted-foreground tabular-nums",children:[e.matchCount," matches"]})]}),e.preview&&/* @__PURE__ */be("p",{className:"text-xs text-muted-foreground line-clamp-2",children:e.preview})]})]})},e.document.id))]})]})}),
259
259
  /* @__PURE__ */xe("div",{className:"px-4 py-3 border-t border-border bg-muted/30",children:[/* @__PURE__ */xe("p",{className:"text-xs text-muted-foreground text-center hidden sm:block",children:["Press ",
260
260
  /* @__PURE__ */be("kbd",{className:"px-1.5 py-0.5 rounded bg-background border border-border",children:"⌘K"})," or ",
261
261
  /* @__PURE__ */be("kbd",{className:"px-1.5 py-0.5 rounded bg-background border border-border",children:"Ctrl+K"})," to open • ",
262
262
  /* @__PURE__ */be("kbd",{className:"px-1.5 py-0.5 rounded bg-background border border-border",children:"ESC"})," to close"]}),/* @__PURE__ */xe("p",{className:"text-xs text-muted-foreground text-center sm:hidden",children:["Tap ",
263
- /* @__PURE__ */be("kbd",{className:"px-1.5 py-0.5 rounded bg-background border border-border",children:"ESC"})," to close"]})]})]})})};function WM({...e}){/* @__PURE__ */
264
- return be("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",...e})}function KM({className:e,...t}){/* @__PURE__ */
265
- return be("ol",{"data-slot":"breadcrumb-list",className:ec("text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",e),...t})}function YM({className:e,...t}){/* @__PURE__ */
266
- return be("li",{"data-slot":"breadcrumb-item",className:ec("inline-flex items-center gap-1.5",e),...t})}function XM({asChild:e,className:t,...r}){/* @__PURE__ */
267
- return be(e?ge:"a",{"data-slot":"breadcrumb-link",className:ec("hover:text-foreground transition-colors",t),...r})}function ZM({className:e,...t}){/* @__PURE__ */
268
- return be("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:ec("text-foreground font-normal",e),...t})}function JM({children:e,className:t,...r}){/* @__PURE__ */
269
- return be("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:ec("[&>svg]:size-3.5",t),...r,children:e??/* @__PURE__ */be(Ne,{})})}function QM(){const[e,t]=X.useState(void 0);return X.useEffect(()=>{const e=window.matchMedia("(max-width: 1023px)"),r=()=>{t(window.innerWidth<1024)};return e.addEventListener("change",r),t(window.innerWidth<1024),()=>e.removeEventListener("change",r)},[]),!!e}function eD({className:e,orientation:t="horizontal",decorative:r=!0,...n}){/* @__PURE__ */
270
- return be(wt.Root,{"data-slot":"separator",decorative:r,orientation:t,className:ec("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...n})}function tD({delayDuration:e=0,...t}){/* @__PURE__ */
271
- return be(St.Provider,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function rD({...e}){/* @__PURE__ */
272
- return be(tD,{children:/* @__PURE__ */be(St.Root,{"data-slot":"tooltip",...e})})}function nD({...e}){/* @__PURE__ */
273
- return be(St.Trigger,{"data-slot":"tooltip-trigger",...e})}function aD({className:e,sideOffset:t=0,children:r,...n}){/* @__PURE__ */
274
- return be(St.Portal,{children:/* @__PURE__ */xe(St.Content,{"data-slot":"tooltip-content","data-richtext-portal":!0,sideOffset:t,className:ec("bg-popover text-popover-foreground border border-border shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-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 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-2xl px-3 py-1.5 text-xs text-balance",e),...n,children:[r,/* @__PURE__ */be(St.Arrow,{className:"bg-popover fill-popover z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}var oD=X.createContext(null);function iD(){const e=X.useContext(oD);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function sD({defaultOpen:e=!0,open:t,onOpenChange:r,className:n,style:a,children:o,...i}){const s=QM(),[l,c]=X.useState(!1),[d,u]=X.useState(e),h=t??d,p=X.useCallback(e=>{const t="function"==typeof e?e(h):e;r?r(t):u(t),document.cookie=`sidebar_state=${t}; path=/; max-age=604800`},[r,h]),m=X.useCallback(()=>s?c(e=>!e):p(e=>!e),[s,p,c]);X.useEffect(()=>{const e=e=>{const t=document.activeElement;if(t){const e=t.tagName.toLowerCase();if("input"===e||"textarea"===e||"true"===t.getAttribute("contenteditable")||t.closest(".cm-editor")||t.closest(".ProseMirror"))return}"b"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),m())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[m,null]);const f=h?"expanded":"collapsed",g=X.useMemo(()=>({state:f,open:h,setOpen:p,isMobile:s,openMobile:l,setOpenMobile:c,toggleSidebar:m}),[f,h,p,s,l,c,m]);/* @__PURE__ */
275
- return be(oD.Provider,{value:g,children:/* @__PURE__ */be(tD,{delayDuration:0,children:/* @__PURE__ */be("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":"420px","--sidebar-width-icon":"5.2875rem",...a},className:ec("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",n),...i,children:o})})})}function lD({side:e="left",variant:t="sidebar",collapsible:r="offcanvas",className:n,children:a,...o}){const{isMobile:i,state:s,openMobile:l,setOpenMobile:c}=iD();return"none"===r?/* @__PURE__ */be("div",{"data-slot":"sidebar",className:ec("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",n),...o,children:a}):i?/* @__PURE__ */be(xM,{open:l,onOpenChange:c,...o,children:/* @__PURE__ */xe(kM,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",style:{"--sidebar-width":"16.2rem"},side:e,children:[/* @__PURE__ */xe(CM,{className:"sr-only",children:[/* @__PURE__ */be(NM,{children:"Sidebar"}),/* @__PURE__ */be(TM,{children:"Displays the mobile sidebar."})]}),/* @__PURE__ */be("div",{className:"flex h-full w-full flex-col",children:a})]})}):/* @__PURE__ */xe("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":s,"data-collapsible":"collapsed"===s?r:"","data-variant":t,"data-side":e,"data-slot":"sidebar",children:[/* @__PURE__ */be("div",{"data-slot":"sidebar-gap",className:ec("relative w-[var(--sidebar-width)] bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180","floating"===t||"inset"===t?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+var(--spacing-4))]":"group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)]")}),/* @__PURE__ */be("div",{"data-slot":"sidebar-container",className:ec("fixed inset-y-0 z-10 hidden h-svh w-[var(--sidebar-width)] transition-[left,right,width] duration-200 ease-linear md:flex","left"===e?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]","floating"===t||"inset"===t?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+var(--spacing-4)+2px)]":"group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)] group-data-[side=left]:border-r group-data-[side=right]:border-l",n),...o,children:/* @__PURE__ */be("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",children:a})})]})}function cD({className:e,...t}){/* @__PURE__ */
276
- return be("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:ec("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t})}function dD({className:e,...t}){/* @__PURE__ */
277
- return be("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:ec("relative flex w-full min-w-0 flex-col p-2",e),...t})}function uD({className:e,...t}){/* @__PURE__ */
278
- return be("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:ec("w-full text-sm",e),...t})}function hD({className:e,...t}){/* @__PURE__ */
279
- return be("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:ec("flex w-full min-w-0 flex-col gap-1",e),...t})}function pD({className:e,...t}){/* @__PURE__ */
280
- return be("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:ec("group/menu-item relative",e),...t})}var mD=t("cursor-pointer peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-2xl p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] 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 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1.5px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1.5px_hsl(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 fD({asChild:e=!1,isActive:t=!1,variant:r="default",size:n="default",tooltip:a,className:o,...i}){const s=e?ge:"button",{isMobile:l,state:c}=iD(),d=/* @__PURE__ */be(s,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":n,"data-active":t,className:ec(mD({variant:r,size:n}),o),...i});return a?("string"==typeof a&&(a={children:a}),/* @__PURE__ */xe(rD,{children:[/* @__PURE__ */be(nD,{asChild:!0,children:d}),/* @__PURE__ */be(aD,{side:"right",align:"center",hidden:"collapsed"!==c||l,...a})]})):d}var gD=(e,t,r,n,a,o,i,s)=>{let l=document.documentElement,c=["light","dark"];function d(t){(Array.isArray(e)?e:[e]).forEach(e=>{let r="class"===e,n=r&&o?a.map(e=>o[e]||e):a;r?(l.classList.remove(...n),l.classList.add(o&&o[t]?o[t]:t)):l.setAttribute(e,t)}),function(e){s&&c.includes(e)&&(l.style.colorScheme=e)}(t)}if(n)d(n);else try{let e=localStorage.getItem(t)||r;d(i&&"system"===e?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e)}catch(u){}},vD=X.createContext(void 0),yD={setTheme:e=>{},themes:[]},bD=()=>{var e;return null!=(e=X.useContext(vD))?e:yD};X.memo(({forcedTheme:e,storageKey:t,attribute:r,enableSystem:n,enableColorScheme:a,defaultTheme:o,value:i,themes:s,nonce:l,scriptProps:c})=>{let d=JSON.stringify([r,t,o,e,s,i,n,a]).slice(1,-1);return X.createElement("script",{...c,suppressHydrationWarning:!0,nonce:"undefined"==typeof window?l:"",dangerouslySetInnerHTML:{__html:`(${gD.toString()})(${d})`}})});function xD({className:e,...t}){/* @__PURE__ */
281
- return be(bt.Root,{"data-slot":"label",className:ec("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})}function wD({className:e,...t}){/* @__PURE__ */
282
- return be(Ar,{"data-slot":"radio-group",className:ec("grid gap-3",e),...t})}function SD({className:e,...t}){/* @__PURE__ */
283
- return be(Er,{"data-slot":"radio-group-item",className:ec("border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:/* @__PURE__ */be(Rr,{"data-slot":"radio-group-indicator",className:"relative flex items-center justify-center",children:/* @__PURE__ */be(Me,{className:"fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2"})})})}function kD({...e}){/* @__PURE__ */
284
- return be(yt.Root,{"data-slot":"dropdown-menu",...e})}function CD({...e}){/* @__PURE__ */
285
- return be(yt.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function ND({className:e,sideOffset:t=4,...r}){/* @__PURE__ */
286
- return be(yt.Portal,{children:/* @__PURE__ */be(yt.Content,{collisionPadding:8,"data-richtext-menu":!0,"data-slot":"dropdown-menu-content",sideOffset:t,className:ec("bg-card text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-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 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-2xl border p-1 shadow-md",e),...r})})}function TD({className:e,inset:t,variant:r="default",...n}){/* @__PURE__ */
287
- return be(yt.Item,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":r,className:ec("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-2xl px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...n})}function AD({className:e,inset:t,...r}){/* @__PURE__ */
288
- return be(yt.Label,{"data-slot":"dropdown-menu-label","data-inset":t,className:ec("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...r})}function MD({className:e,...t}){/* @__PURE__ */
289
- return be(yt.Separator,{"data-slot":"dropdown-menu-separator",className:ec("bg-border -mx-1 my-1 h-px",e),...t})}var DD=["modern-minimal","elegant-luxury","cyberpunk","twitter","mocha-mousse","amethyst-haze","notebook","doom-64","catppuccin","graphite","perpetuity","kodama-grove","cosmic-night","tangerine","nature","bold-tech","amber-minimal","supabase","neo-brutalism","quantum-rose","solar-dusk","bubblegum","pink-lemonade","claymorphism","pastel-dreams"],ED={"modern-minimal":{primary:"#3b82f6",secondary:"#f3f4f6"},"elegant-luxury":{primary:"#9b2c2c",secondary:"#fdf2d6"},cyberpunk:{primary:"#ff00c8",secondary:"#f0f0ff"},twitter:{primary:"#1e9df1",secondary:"#0f1419"},"mocha-mousse":{primary:"#A37764",secondary:"#BAAB92"},bubblegum:{primary:"#d04f99",secondary:"#8acfd1"},"amethyst-haze":{primary:"#8a79ab",secondary:"#dfd9ec"},"pink-lemonade":{primary:"#a84370",secondary:"#f1c4e6"},notebook:{primary:"#606060",secondary:"#dedede"},"doom-64":{primary:"#b71c1c",secondary:"#556b2f"},catppuccin:{primary:"#8839ef",secondary:"#ccd0da"},graphite:{primary:"#606060",secondary:"#e0e0e0"},perpetuity:{primary:"#06858e",secondary:"#d9eaea"},"kodama-grove":{primary:"#8d9d4f",secondary:"#decea0"},"cosmic-night":{primary:"#6e56cf",secondary:"#e4dfff"},tangerine:{primary:"#e05d38",secondary:"#f3f4f6"},"quantum-rose":{primary:"#e6067a",secondary:"#ffd6ff"},nature:{primary:"#2e7d32",secondary:"#e8f5e9"},"bold-tech":{primary:"#8b5cf6",secondary:"#f3f0ff"},"amber-minimal":{primary:"#f59e0b",secondary:"#f3f4f6"},supabase:{primary:"#72e3ad",secondary:"#fdfdfd"},"neo-brutalism":{primary:"#ff3333",secondary:"#ffff00"},"solar-dusk":{primary:"#B45309",secondary:"#E4C090"},claymorphism:{primary:"#6366f1",secondary:"#d6d3d1"},"pastel-dreams":{primary:"#a78bfa",secondary:"#e9d8fd"}};function ID(){const{theme:e,setTheme:t}=bD(),[r,n]=fe("modern-minimal"),[a,o]=fe(!1),[i,s]=fe(null);le(()=>{o(!0);const e=localStorage.getItem("color-theme");e&&DD.includes(e)&&n(e)},[]);const l=()=>{i&&(DD.forEach(e=>document.documentElement.classList.remove(`theme-${e}`)),document.documentElement.classList.add(`theme-${r}`),s(null))};return a?/* @__PURE__ */xe(kD,{onOpenChange:e=>!e&&l(),children:[/* @__PURE__ */be(CD,{asChild:!0,children:/* @__PURE__ */be(oc,{variant:"ghost",size:"icon",className:"relative",children:/* @__PURE__ */be(b,{name:"icon-themes",className:"h-5 w-5"})})}),/* @__PURE__ */xe(ND,{align:"end",className:"w-56 max-h-[400px] overflow-y-auto",children:[
290
- /* @__PURE__ */xe(AD,{className:"flex items-center justify-between",children:[/* @__PURE__ */be("span",{children:"Theme"}),/* @__PURE__ */be(oc,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:r=>{r.stopPropagation(),t("dark"===e?"light":"dark")},children:/* @__PURE__ */be("dark"===e?Xe:ot,{className:"h-4 w-4"})})]}),
291
- /* @__PURE__ */be(MD,{}),DD.map(e=>{const t=ED[e];/* @__PURE__ */
292
- return be(TD,{onClick:()=>{return n(t=e),localStorage.setItem("color-theme",t),document.cookie=`color-theme=${t}; path=/; max-age=31536000`,DD.forEach(e=>document.documentElement.classList.remove(`theme-${e}`)),document.documentElement.classList.add(`theme-${t}`),void s(null);var t},onMouseEnter:()=>(e=>{s(e),DD.forEach(e=>document.documentElement.classList.remove(`theme-${e}`)),document.documentElement.classList.add(`theme-${e}`)})(e),onMouseLeave:l,className:"cursor-pointer "+(r===e?"bg-accent":""),children:/* @__PURE__ */xe("div",{className:"flex items-center justify-between w-full",children:[/* @__PURE__ */xe("div",{className:"flex items-center gap-2",children:[t&&/* @__PURE__ */xe("div",{className:"flex items-center gap-1",children:[/* @__PURE__ */be("div",{className:"w-3 h-3 rounded-full border border-border",style:{backgroundColor:t.primary}}),/* @__PURE__ */be("div",{className:"w-3 h-3 rounded-full border border-border",style:{backgroundColor:t.secondary}})]}),/* @__PURE__ */be("span",{children:(a=e,a.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "))})]}),r===e&&/* @__PURE__ */be("span",{className:"text-xs",children:"✓"})]})},e);var a})]})]}):null}var RD=[{value:"light",label:"Light",icon:/* @__PURE__ */be(ot,{className:"h-4 w-4"}),description:"Clean and bright interface"},{value:"dark",label:"Dark",icon:/* @__PURE__ */be(Xe,{className:"h-4 w-4"}),description:"Easy on the eyes in low light"},{value:"system",label:"System",icon:/* @__PURE__ */be(Ye,{className:"h-4 w-4"}),description:"Sync with your system preferences"}],zD=({defaultSidebarView:e,onDefaultSidebarViewChange:t})=>{const{theme:r,setTheme:n}=bD();/* @__PURE__ */
263
+ /* @__PURE__ */be("kbd",{className:"px-1.5 py-0.5 rounded bg-background border border-border",children:"ESC"})," to close"]})]})]})})};function HM({...e}){/* @__PURE__ */
264
+ return be("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",...e})}function jM({className:e,...t}){/* @__PURE__ */
265
+ return be("ol",{"data-slot":"breadcrumb-list",className:ec("text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",e),...t})}function qM({className:e,...t}){/* @__PURE__ */
266
+ return be("li",{"data-slot":"breadcrumb-item",className:ec("inline-flex items-center gap-1.5",e),...t})}function UM({asChild:e,className:t,...r}){/* @__PURE__ */
267
+ return be(e?ge:"a",{"data-slot":"breadcrumb-link",className:ec("hover:text-foreground transition-colors",t),...r})}function GM({className:e,...t}){/* @__PURE__ */
268
+ return be("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:ec("text-foreground font-normal",e),...t})}function WM({children:e,className:t,...r}){/* @__PURE__ */
269
+ return be("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:ec("[&>svg]:size-3.5",t),...r,children:e??/* @__PURE__ */be(Ne,{})})}function KM(){const[e,t]=X.useState(void 0);return X.useEffect(()=>{const e=window.matchMedia("(max-width: 1023px)"),r=()=>{t(window.innerWidth<1024)};return e.addEventListener("change",r),t(window.innerWidth<1024),()=>e.removeEventListener("change",r)},[]),!!e}function YM({className:e,orientation:t="horizontal",decorative:r=!0,...n}){/* @__PURE__ */
270
+ return be(wt.Root,{"data-slot":"separator",decorative:r,orientation:t,className:ec("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...n})}function XM({delayDuration:e=0,...t}){/* @__PURE__ */
271
+ return be(St.Provider,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function ZM({...e}){/* @__PURE__ */
272
+ return be(XM,{children:/* @__PURE__ */be(St.Root,{"data-slot":"tooltip",...e})})}function JM({...e}){/* @__PURE__ */
273
+ return be(St.Trigger,{"data-slot":"tooltip-trigger",...e})}function QM({className:e,sideOffset:t=0,children:r,...n}){/* @__PURE__ */
274
+ return be(St.Portal,{children:/* @__PURE__ */xe(St.Content,{"data-slot":"tooltip-content","data-richtext-portal":!0,sideOffset:t,className:ec("bg-popover text-popover-foreground border border-border shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-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 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-2xl px-3 py-1.5 text-xs text-balance",e),...n,children:[r,/* @__PURE__ */be(St.Arrow,{className:"bg-popover fill-popover z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}var eD=X.createContext(null);function tD(){const e=X.useContext(eD);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function rD({defaultOpen:e=!0,open:t,onOpenChange:r,className:n,style:a,children:o,...i}){const s=KM(),[l,c]=X.useState(!1),[d,u]=X.useState(e),h=t??d,p=X.useCallback(e=>{const t="function"==typeof e?e(h):e;r?r(t):u(t),document.cookie=`sidebar_state=${t}; path=/; max-age=604800`},[r,h]),m=X.useCallback(()=>s?c(e=>!e):p(e=>!e),[s,p,c]);X.useEffect(()=>{const e=e=>{const t=document.activeElement;if(t){const e=t.tagName.toLowerCase();if("input"===e||"textarea"===e||"true"===t.getAttribute("contenteditable")||t.closest(".cm-editor")||t.closest(".ProseMirror"))return}"b"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),m())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[m,null]);const f=h?"expanded":"collapsed",g=X.useMemo(()=>({state:f,open:h,setOpen:p,isMobile:s,openMobile:l,setOpenMobile:c,toggleSidebar:m}),[f,h,p,s,l,c,m]);/* @__PURE__ */
275
+ return be(eD.Provider,{value:g,children:/* @__PURE__ */be(XM,{delayDuration:0,children:/* @__PURE__ */be("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":"420px","--sidebar-width-icon":"5.2875rem",...a},className:ec("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",n),...i,children:o})})})}function nD({side:e="left",variant:t="sidebar",collapsible:r="offcanvas",className:n,children:a,...o}){const{isMobile:i,state:s,openMobile:l,setOpenMobile:c}=tD();return"none"===r?/* @__PURE__ */be("div",{"data-slot":"sidebar",className:ec("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",n),...o,children:a}):i?/* @__PURE__ */be(fM,{open:l,onOpenChange:c,...o,children:/* @__PURE__ */xe(yM,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",style:{"--sidebar-width":"16.2rem"},side:e,children:[/* @__PURE__ */xe(bM,{className:"sr-only",children:[/* @__PURE__ */be(xM,{children:"Sidebar"}),/* @__PURE__ */be(wM,{children:"Displays the mobile sidebar."})]}),/* @__PURE__ */be("div",{className:"flex h-full w-full flex-col",children:a})]})}):/* @__PURE__ */xe("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":s,"data-collapsible":"collapsed"===s?r:"","data-variant":t,"data-side":e,"data-slot":"sidebar",children:[/* @__PURE__ */be("div",{"data-slot":"sidebar-gap",className:ec("relative w-[var(--sidebar-width)] bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180","floating"===t||"inset"===t?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+var(--spacing-4))]":"group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)]")}),/* @__PURE__ */be("div",{"data-slot":"sidebar-container",className:ec("fixed inset-y-0 z-10 hidden h-svh w-[var(--sidebar-width)] transition-[left,right,width] duration-200 ease-linear md:flex","left"===e?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]","floating"===t||"inset"===t?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+var(--spacing-4)+2px)]":"group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)] group-data-[side=left]:border-r group-data-[side=right]:border-l",n),...o,children:/* @__PURE__ */be("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",children:a})})]})}function aD({className:e,...t}){/* @__PURE__ */
276
+ return be("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:ec("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t})}function oD({className:e,...t}){/* @__PURE__ */
277
+ return be("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:ec("relative flex w-full min-w-0 flex-col p-2",e),...t})}function iD({className:e,...t}){/* @__PURE__ */
278
+ return be("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:ec("w-full text-sm",e),...t})}function sD({className:e,...t}){/* @__PURE__ */
279
+ return be("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:ec("flex w-full min-w-0 flex-col gap-1",e),...t})}function lD({className:e,...t}){/* @__PURE__ */
280
+ return be("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:ec("group/menu-item relative",e),...t})}var cD=t("cursor-pointer peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-2xl p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] 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 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1.5px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1.5px_hsl(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 dD({asChild:e=!1,isActive:t=!1,variant:r="default",size:n="default",tooltip:a,className:o,...i}){const s=e?ge:"button",{isMobile:l,state:c}=tD(),d=/* @__PURE__ */be(s,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":n,"data-active":t,className:ec(cD({variant:r,size:n}),o),...i});return a?("string"==typeof a&&(a={children:a}),/* @__PURE__ */xe(ZM,{children:[/* @__PURE__ */be(JM,{asChild:!0,children:d}),/* @__PURE__ */be(QM,{side:"right",align:"center",hidden:"collapsed"!==c||l,...a})]})):d}var uD=(e,t,r,n,a,o,i,s)=>{let l=document.documentElement,c=["light","dark"];function d(t){(Array.isArray(e)?e:[e]).forEach(e=>{let r="class"===e,n=r&&o?a.map(e=>o[e]||e):a;r?(l.classList.remove(...n),l.classList.add(o&&o[t]?o[t]:t)):l.setAttribute(e,t)}),function(e){s&&c.includes(e)&&(l.style.colorScheme=e)}(t)}if(n)d(n);else try{let e=localStorage.getItem(t)||r;d(i&&"system"===e?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e)}catch(u){}},hD=X.createContext(void 0),pD={setTheme:e=>{},themes:[]},mD=()=>{var e;return null!=(e=X.useContext(hD))?e:pD};X.memo(({forcedTheme:e,storageKey:t,attribute:r,enableSystem:n,enableColorScheme:a,defaultTheme:o,value:i,themes:s,nonce:l,scriptProps:c})=>{let d=JSON.stringify([r,t,o,e,s,i,n,a]).slice(1,-1);return X.createElement("script",{...c,suppressHydrationWarning:!0,nonce:"undefined"==typeof window?l:"",dangerouslySetInnerHTML:{__html:`(${uD.toString()})(${d})`}})});function fD({className:e,...t}){/* @__PURE__ */
281
+ return be(bt.Root,{"data-slot":"label",className:ec("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})}function gD({className:e,...t}){/* @__PURE__ */
282
+ return be(Ar,{"data-slot":"radio-group",className:ec("grid gap-3",e),...t})}function vD({className:e,...t}){/* @__PURE__ */
283
+ return be(Er,{"data-slot":"radio-group-item",className:ec("border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:/* @__PURE__ */be(Rr,{"data-slot":"radio-group-indicator",className:"relative flex items-center justify-center",children:/* @__PURE__ */be(Me,{className:"fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2"})})})}function yD({...e}){/* @__PURE__ */
284
+ return be(yt.Root,{"data-slot":"dropdown-menu",...e})}function bD({...e}){/* @__PURE__ */
285
+ return be(yt.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function xD({className:e,sideOffset:t=4,...r}){/* @__PURE__ */
286
+ return be(yt.Portal,{children:/* @__PURE__ */be(yt.Content,{collisionPadding:8,"data-richtext-menu":!0,"data-slot":"dropdown-menu-content",sideOffset:t,className:ec("bg-card text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-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 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-2xl border p-1 shadow-md",e),...r})})}function wD({className:e,inset:t,variant:r="default",...n}){/* @__PURE__ */
287
+ return be(yt.Item,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":r,className:ec("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-2xl px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...n})}function SD({className:e,inset:t,...r}){/* @__PURE__ */
288
+ return be(yt.Label,{"data-slot":"dropdown-menu-label","data-inset":t,className:ec("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...r})}function kD({className:e,...t}){/* @__PURE__ */
289
+ return be(yt.Separator,{"data-slot":"dropdown-menu-separator",className:ec("bg-border -mx-1 my-1 h-px",e),...t})}var CD=["modern-minimal","elegant-luxury","cyberpunk","twitter","mocha-mousse","amethyst-haze","notebook","doom-64","catppuccin","graphite","perpetuity","kodama-grove","cosmic-night","tangerine","nature","bold-tech","amber-minimal","supabase","neo-brutalism","quantum-rose","solar-dusk","bubblegum","pink-lemonade","claymorphism","pastel-dreams"],ND={"modern-minimal":{primary:"#3b82f6",secondary:"#f3f4f6"},"elegant-luxury":{primary:"#9b2c2c",secondary:"#fdf2d6"},cyberpunk:{primary:"#ff00c8",secondary:"#f0f0ff"},twitter:{primary:"#1e9df1",secondary:"#0f1419"},"mocha-mousse":{primary:"#A37764",secondary:"#BAAB92"},bubblegum:{primary:"#d04f99",secondary:"#8acfd1"},"amethyst-haze":{primary:"#8a79ab",secondary:"#dfd9ec"},"pink-lemonade":{primary:"#a84370",secondary:"#f1c4e6"},notebook:{primary:"#606060",secondary:"#dedede"},"doom-64":{primary:"#b71c1c",secondary:"#556b2f"},catppuccin:{primary:"#8839ef",secondary:"#ccd0da"},graphite:{primary:"#606060",secondary:"#e0e0e0"},perpetuity:{primary:"#06858e",secondary:"#d9eaea"},"kodama-grove":{primary:"#8d9d4f",secondary:"#decea0"},"cosmic-night":{primary:"#6e56cf",secondary:"#e4dfff"},tangerine:{primary:"#e05d38",secondary:"#f3f4f6"},"quantum-rose":{primary:"#e6067a",secondary:"#ffd6ff"},nature:{primary:"#2e7d32",secondary:"#e8f5e9"},"bold-tech":{primary:"#8b5cf6",secondary:"#f3f0ff"},"amber-minimal":{primary:"#f59e0b",secondary:"#f3f4f6"},supabase:{primary:"#72e3ad",secondary:"#fdfdfd"},"neo-brutalism":{primary:"#ff3333",secondary:"#ffff00"},"solar-dusk":{primary:"#B45309",secondary:"#E4C090"},claymorphism:{primary:"#6366f1",secondary:"#d6d3d1"},"pastel-dreams":{primary:"#a78bfa",secondary:"#e9d8fd"}};function TD(){const{theme:e,setTheme:t}=mD(),[r,n]=fe("modern-minimal"),[a,o]=fe(!1),[i,s]=fe(null);le(()=>{o(!0);const e=localStorage.getItem("color-theme");e&&CD.includes(e)&&n(e)},[]);const l=()=>{i&&(CD.forEach(e=>document.documentElement.classList.remove(`theme-${e}`)),document.documentElement.classList.add(`theme-${r}`),s(null))};return a?/* @__PURE__ */xe(yD,{onOpenChange:e=>!e&&l(),children:[/* @__PURE__ */be(bD,{asChild:!0,children:/* @__PURE__ */be(oc,{variant:"ghost",size:"icon",className:"relative",children:/* @__PURE__ */be(b,{name:"icon-themes",className:"h-5 w-5"})})}),/* @__PURE__ */xe(xD,{align:"end",className:"w-56 max-h-[400px] overflow-y-auto",children:[
290
+ /* @__PURE__ */xe(SD,{className:"flex items-center justify-between",children:[/* @__PURE__ */be("span",{children:"Theme"}),/* @__PURE__ */be(oc,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:r=>{r.stopPropagation(),t("dark"===e?"light":"dark")},children:/* @__PURE__ */be("dark"===e?Xe:ot,{className:"h-4 w-4"})})]}),
291
+ /* @__PURE__ */be(kD,{}),CD.map(e=>{const t=ND[e];/* @__PURE__ */
292
+ return be(wD,{onClick:()=>{return n(t=e),localStorage.setItem("color-theme",t),document.cookie=`color-theme=${t}; path=/; max-age=31536000`,CD.forEach(e=>document.documentElement.classList.remove(`theme-${e}`)),document.documentElement.classList.add(`theme-${t}`),void s(null);var t},onMouseEnter:()=>(e=>{s(e),CD.forEach(e=>document.documentElement.classList.remove(`theme-${e}`)),document.documentElement.classList.add(`theme-${e}`)})(e),onMouseLeave:l,className:"cursor-pointer "+(r===e?"bg-accent":""),children:/* @__PURE__ */xe("div",{className:"flex items-center justify-between w-full",children:[/* @__PURE__ */xe("div",{className:"flex items-center gap-2",children:[t&&/* @__PURE__ */xe("div",{className:"flex items-center gap-1",children:[/* @__PURE__ */be("div",{className:"w-3 h-3 rounded-full border border-border",style:{backgroundColor:t.primary}}),/* @__PURE__ */be("div",{className:"w-3 h-3 rounded-full border border-border",style:{backgroundColor:t.secondary}})]}),/* @__PURE__ */be("span",{children:(a=e,a.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "))})]}),r===e&&/* @__PURE__ */be("span",{className:"text-xs",children:"✓"})]})},e);var a})]})]}):null}var AD=[{value:"light",label:"Light",icon:/* @__PURE__ */be(ot,{className:"h-4 w-4"}),description:"Clean and bright interface"},{value:"dark",label:"Dark",icon:/* @__PURE__ */be(Xe,{className:"h-4 w-4"}),description:"Easy on the eyes in low light"},{value:"system",label:"System",icon:/* @__PURE__ */be(Ye,{className:"h-4 w-4"}),description:"Sync with your system preferences"}],MD=({defaultSidebarView:e,onDefaultSidebarViewChange:t})=>{const{theme:r,setTheme:n}=mD();/* @__PURE__ */
293
293
  return xe("div",{className:"space-y-6",children:[
294
294
  /* @__PURE__ */xe("div",{children:[/* @__PURE__ */be("h2",{className:"text-xl font-semibold mb-2",children:"Appearance"}),/* @__PURE__ */be("p",{className:"text-sm text-muted-foreground",children:"Choose how REASON looks to you"})]}),
295
- /* @__PURE__ */be(eD,{}),
296
- /* @__PURE__ */xe("div",{className:"space-y-4",children:[/* @__PURE__ */be(xD,{className:"text-base",children:"Theme"}),/* @__PURE__ */be(wD,{value:r,onValueChange:n,className:"space-y-3",children:RD.map(e=>/* @__PURE__ */xe("div",{className:"flex items-start space-x-3",children:[/* @__PURE__ */be(SD,{value:e.value,id:e.value,className:"mt-1"}),/* @__PURE__ */xe("label",{htmlFor:e.value,className:"flex-1 cursor-pointer",children:[/* @__PURE__ */xe("div",{className:"flex items-center gap-2 mb-1",children:[/* @__PURE__ */be("div",{className:"text-muted-foreground",children:e.icon}),/* @__PURE__ */be("span",{className:"font-medium",children:e.label})]}),/* @__PURE__ */be("p",{className:"text-sm text-muted-foreground",children:e.description})]})]},e.value))})]}),
295
+ /* @__PURE__ */be(YM,{}),
296
+ /* @__PURE__ */xe("div",{className:"space-y-4",children:[/* @__PURE__ */be(fD,{className:"text-base",children:"Theme"}),/* @__PURE__ */be(gD,{value:r,onValueChange:n,className:"space-y-3",children:AD.map(e=>/* @__PURE__ */xe("div",{className:"flex items-start space-x-3",children:[/* @__PURE__ */be(vD,{value:e.value,id:e.value,className:"mt-1"}),/* @__PURE__ */xe("label",{htmlFor:e.value,className:"flex-1 cursor-pointer",children:[/* @__PURE__ */xe("div",{className:"flex items-center gap-2 mb-1",children:[/* @__PURE__ */be("div",{className:"text-muted-foreground",children:e.icon}),/* @__PURE__ */be("span",{className:"font-medium",children:e.label})]}),/* @__PURE__ */be("p",{className:"text-sm text-muted-foreground",children:e.description})]})]},e.value))})]}),
297
297
  /* @__PURE__ */xe("div",{className:"space-y-4",children:[
298
- /* @__PURE__ */be(xD,{className:"text-base",children:"Color Theme"}),
298
+ /* @__PURE__ */be(fD,{className:"text-base",children:"Color Theme"}),
299
299
  /* @__PURE__ */be("p",{className:"text-sm text-muted-foreground mb-2",children:"Choose from various color themes to customize your interface"}),
300
- /* @__PURE__ */be("div",{className:"flex items-center",children:/* @__PURE__ */be(ID,{})})]}),
301
- /* @__PURE__ */be(eD,{}),
300
+ /* @__PURE__ */be("div",{className:"flex items-center",children:/* @__PURE__ */be(TD,{})})]}),
301
+ /* @__PURE__ */be(YM,{}),
302
302
  /* @__PURE__ */xe("div",{className:"space-y-4",children:[
303
- /* @__PURE__ */be(xD,{className:"text-base",children:"Default Sidebar View"}),
303
+ /* @__PURE__ */be(fD,{className:"text-base",children:"Default Sidebar View"}),
304
304
  /* @__PURE__ */be("p",{className:"text-sm text-muted-foreground mb-2",children:"Choose the default view when opening the application"}),
305
- /* @__PURE__ */be(wD,{value:e,onValueChange:e=>t?.(e),className:"space-y-3",children:[{value:"tree",label:"Documents Tree",desc:"Show only the document tree"},{value:"outline",label:"Outline Only",desc:"Show only the headings outline"},{value:"split",label:"Split View",desc:"Show both tree and outline side by side"},{value:"last-used",label:"Remember Last Used",desc:"Use the view you had open last time"}].map(e=>/* @__PURE__ */xe("div",{className:"flex items-start space-x-3",children:[/* @__PURE__ */be(SD,{value:e.value,id:e.value,className:"mt-1"}),/* @__PURE__ */xe("label",{htmlFor:e.value,className:"flex-1 cursor-pointer",children:[/* @__PURE__ */be("div",{className:"flex items-center gap-2 mb-1",children:/* @__PURE__ */be("span",{className:"font-medium",children:e.label})}),/* @__PURE__ */be("p",{className:"text-sm text-muted-foreground",children:e.desc})]})]},e.value))})]})]})};Array(12).fill(0);var _D=1,PD=e=>{var t;return"number"==typeof(null==e?void 0:e.id)||(null==e||null==(t=e.id)?void 0:t.length)>0?e.id:_D++},OD=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),this.getActiveToasts().forEach(t=>e(t)),()=>{const t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e],this.trimHistory()},this.trimHistory=()=>{let e=this.toasts.length-100;e<=0||(this.toasts=this.toasts.filter(t=>!(e>0&&this.dismissedToasts.has(t.id))||(this.dismissedToasts.delete(t.id),e--,!1)))},this.create=e=>{const{message:t,...r}=e,n=PD(e),a=this.pendingDismissals.get(n);void 0!==a&&(cancelAnimationFrame(a),this.pendingDismissals.delete(n),this.dismissedToasts.delete(n));const o=this.dismissedToasts.has(n),i=void 0===e.dismissible||e.dismissible;return o&&(this.dismissedToasts.delete(n),this.toasts=this.toasts.filter(e=>e.id!==n)),(o?void 0:this.toasts.find(e=>e.id===n))?this.toasts=this.toasts.map(r=>r.id===n?(this.publish({...r,...e,id:n,title:t}),{...r,...e,id:n,dismissible:i,title:t}):r):this.addToast({title:t,...r,dismissible:i,id:n}),n},this.dismiss=e=>{if(null==e)return this.getActiveToasts().forEach(e=>{this.dismissedToasts.add(e.id),this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e;this.dismissedToasts.add(e);const t=this.pendingDismissals.get(e);return void 0!==t&&cancelAnimationFrame(t),this.pendingDismissals.set(e,requestAnimationFrame(()=>{this.pendingDismissals.delete(e),this.subscribers.forEach(t=>t({id:e,dismiss:!0}))})),e},this.message=(e,t)=>this.create({...t,message:e,type:void 0}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let r;void 0!==t.loading&&(r=this.create({...t,promise:e,type:"loading",message:t.loading,description:"function"!=typeof t.description?t.description:void 0}));const n=Promise.resolve(e instanceof Function?e():e);let a,o=void 0!==r;const i=n.then(async e=>{if(a=["resolve",e],Z.isValidElement(e))o=!1,this.create({id:r,type:"default",message:e});else if(LD(e)&&!e.ok){o=!1;const n="function"==typeof t.error?await t.error(`HTTP error! status: ${e.status}`):t.error,a="function"==typeof t.description?await t.description(`HTTP error! status: ${e.status}`):t.description,i="object"!=typeof n||Z.isValidElement(n)?{message:n}:n;this.create({id:r,type:"error",description:a,...i})}else if(e instanceof Error){o=!1;const n="function"==typeof t.error?await t.error(e):t.error,a="function"==typeof t.description?await t.description(e):t.description,i="object"!=typeof n||Z.isValidElement(n)?{message:n}:n;this.create({id:r,type:"error",description:a,...i})}else if(void 0!==t.success){o=!1;const n="function"==typeof t.success?await t.success(e):t.success,a="function"==typeof t.description?await t.description(e):t.description,i="object"!=typeof n||Z.isValidElement(n)?{message:n}:n;this.create({id:r,type:"success",description:a,...i})}}).catch(async e=>{if(a=["reject",e],void 0!==t.error){o=!1;const n="function"==typeof t.error?await t.error(e):t.error,a="function"==typeof t.description?await t.description(e):t.description,i="object"!=typeof n||Z.isValidElement(n)?{message:n}:n;this.create({id:r,type:"error",description:a,...i})}}).finally(()=>{o&&(this.dismiss(r),r=void 0),null==t.finally||t.finally.call(t)}),s=()=>new Promise((e,t)=>i.then(()=>"reject"===a[0]?t(a[1]):e(a[1])).catch(t));return"string"!=typeof r&&"number"!=typeof r?{unwrap:s}:Object.assign(r,{unwrap:s})},this.custom=(e,t)=>{const r=PD(t);return this.create({...t,jsx:e(r),id:r,type:void 0}),r},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=/* @__PURE__ */new Set,this.pendingDismissals=/* @__PURE__ */new Map}},LD=e=>e&&"object"==typeof e&&"ok"in e&&"boolean"==typeof e.ok&&"status"in e&&"number"==typeof e.status,FD=(e,t)=>OD.message(e,t),BD=Object.assign(FD,{success:OD.success,info:OD.info,warning:OD.warning,error:OD.error,custom:OD.custom,message:OD.message,promise:OD.promise,dismiss:OD.dismiss,loading:OD.loading},{getHistory:()=>OD.toasts,getToasts:()=>OD.getActiveToasts()});!function(e){if(!e||"undefined"==typeof document)return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");var VD={name:"",type:"local",credentials:{}},$D=({open:e,enableDatabaseSync:t=!1,onEnableDatabaseSyncChange:r})=>{const[n,a]=fe([]),[o,i]=fe(null),[s,l]=fe(VD);le(()=>{e&&a(Kf())},[e]);const c=()=>{s.name.trim()?(o&&"new"!==o?(!function(e,t){Yf(Kf().map(r=>r.id===e?{...r,...t,updatedAt:/* @__PURE__ */(new Date).toISOString()}:r))}(o,{name:s.name,credentials:"local"!==s.type?s.credentials:void 0}),BD.success("Source updated")):(!function(e){let t={...e,id:`${e.type}-${Date.now()}`,createdAt:/* @__PURE__ */(new Date).toISOString(),updatedAt:/* @__PURE__ */(new Date).toISOString()};Yf([...Kf(),t])}({name:s.name,type:s.type,credentials:"local"!==s.type?s.credentials:void 0}),BD.success("Source added")),a(Kf()),i(null),l(VD)):BD.error("Please enter a source name")},d=e=>{!function(e){"local-default"!==e&&(Yf(Kf().filter(t=>t.id!==e)),Xf()===e&&Zf("local-default"))}(e),a(Kf()),BD.success("Source deleted")},u=()=>{i(null),l(VD)},h=e=>s.credentials[e],p=e=>l(t=>({...t,credentials:{...t.credentials,...e}})),m=({type:e})=>"local"===e?/* @__PURE__ */be(Fe,{className:"h-4 w-4"}):"ssh"===e?/* @__PURE__ */be(rt,{className:"h-4 w-4"}):"s3"===e||"b2"===e?/* @__PURE__ */be(De,{className:"h-4 w-4"}):"r2"===e?/* @__PURE__ */be(Re,{className:"h-4 w-4"}):"gdocs"===e?/* @__PURE__ */be(Oe,{className:"h-4 w-4"}):"turso"===e?/* @__PURE__ */be(dt,{className:"h-4 w-4"}):null,f=e=>"ssh"===e?/* @__PURE__ */xe(ye,{children:[
306
- /* @__PURE__ */be(HD,{label:"Host",children:/* @__PURE__ */be(BM,{value:h("host")||"",onChange:e=>p({host:e.target.value}),placeholder:"example.com"})}),
307
- /* @__PURE__ */xe("div",{className:"grid grid-cols-2 gap-2",children:[/* @__PURE__ */be(HD,{label:"Port",children:/* @__PURE__ */be(BM,{type:"number",value:h("port")||22,onChange:e=>p({port:parseInt(e.target.value)}),placeholder:"22"})}),/* @__PURE__ */be(HD,{label:"Username",children:/* @__PURE__ */be(BM,{value:h("username")||"",onChange:e=>p({username:e.target.value}),placeholder:"user"})})]}),
308
- /* @__PURE__ */be(HD,{label:"Password (Optional)",children:/* @__PURE__ */be(BM,{type:"password",value:h("password")||"",onChange:e=>p({password:e.target.value}),placeholder:"••••••••"})}),
309
- /* @__PURE__ */be(HD,{label:"Base Path (Optional)",children:/* @__PURE__ */be(BM,{value:h("basePath")||"",onChange:e=>p({basePath:e.target.value}),placeholder:"/home/user/documents"})})]}):"s3"===e?/* @__PURE__ */xe(ye,{children:[
310
- /* @__PURE__ */be(HD,{label:"Access Key ID",children:/* @__PURE__ */be(BM,{value:h("accessKeyId")||"",onChange:e=>p({accessKeyId:e.target.value}),placeholder:"AKIAIOSFODNN7EXAMPLE"})}),
311
- /* @__PURE__ */be(HD,{label:"Secret Access Key",children:/* @__PURE__ */be(BM,{type:"password",value:h("secretAccessKey")||"",onChange:e=>p({secretAccessKey:e.target.value}),placeholder:"••••••••"})}),
312
- /* @__PURE__ */xe("div",{className:"grid grid-cols-2 gap-2",children:[/* @__PURE__ */be(HD,{label:"Region",children:/* @__PURE__ */be(BM,{value:h("region")||"",onChange:e=>p({region:e.target.value}),placeholder:"us-east-1"})}),/* @__PURE__ */be(HD,{label:"Bucket",children:/* @__PURE__ */be(BM,{value:h("bucket")||"",onChange:e=>p({bucket:e.target.value}),placeholder:"my-bucket"})})]})]}):"r2"===e?/* @__PURE__ */xe(ye,{children:[
313
- /* @__PURE__ */be(HD,{label:"Account ID",children:/* @__PURE__ */be(BM,{value:h("accountId")||"",onChange:e=>p({accountId:e.target.value}),placeholder:"your-account-id"})}),
314
- /* @__PURE__ */be(HD,{label:"Access Key ID",children:/* @__PURE__ */be(BM,{value:h("accessKeyId")||"",onChange:e=>p({accessKeyId:e.target.value}),placeholder:"your-access-key-id"})}),
315
- /* @__PURE__ */be(HD,{label:"Secret Access Key",children:/* @__PURE__ */be(BM,{type:"password",value:h("secretAccessKey")||"",onChange:e=>p({secretAccessKey:e.target.value}),placeholder:"••••••••"})}),
316
- /* @__PURE__ */be(HD,{label:"Bucket",children:/* @__PURE__ */be(BM,{value:h("bucket")||"",onChange:e=>p({bucket:e.target.value}),placeholder:"my-bucket"})})]}):"b2"===e?/* @__PURE__ */xe(ye,{children:[
317
- /* @__PURE__ */be(HD,{label:"Access Key ID",children:/* @__PURE__ */be(BM,{value:h("accessKeyId")||"",onChange:e=>p({accessKeyId:e.target.value}),placeholder:"your-key-id"})}),
318
- /* @__PURE__ */be(HD,{label:"Secret Access Key",children:/* @__PURE__ */be(BM,{type:"password",value:h("secretAccessKey")||"",onChange:e=>p({secretAccessKey:e.target.value}),placeholder:"••••••••"})}),
319
- /* @__PURE__ */be(HD,{label:"Bucket",children:/* @__PURE__ */be(BM,{value:h("bucket")||"",onChange:e=>p({bucket:e.target.value}),placeholder:"my-bucket"})}),
320
- /* @__PURE__ */be(HD,{label:"Endpoint (Optional)",children:/* @__PURE__ */be(BM,{value:h("endpoint")||"",onChange:e=>p({endpoint:e.target.value}),placeholder:"https://s3.us-west-004.backblazeb2.com"})})]}):"gdocs"===e?/* @__PURE__ */xe(ye,{children:[
321
- /* @__PURE__ */be(HD,{label:"Email",children:/* @__PURE__ */be(BM,{value:h("email")||"",onChange:e=>p({email:e.target.value}),placeholder:"user@gmail.com",disabled:!0})}),
322
- /* @__PURE__ */xe(HD,{label:"Folder IDs (comma-separated)",children:[/* @__PURE__ */be(ic,{value:h("folderIds")?.join(", ")||"",onChange:e=>p({folderIds:e.target.value.split(",").map(e=>e.trim()).filter(Boolean)}),placeholder:"folder-id-1, folder-id-2",rows:3}),/* @__PURE__ */be("p",{className:"text-xs text-muted-foreground",children:"Enter Google Drive folder IDs to sync (one per line or comma-separated)"})]}),
305
+ /* @__PURE__ */be(gD,{value:e,onValueChange:e=>t?.(e),className:"space-y-3",children:[{value:"tree",label:"Documents Tree",desc:"Show only the document tree"},{value:"outline",label:"Outline Only",desc:"Show only the headings outline"},{value:"split",label:"Split View",desc:"Show both tree and outline side by side"},{value:"last-used",label:"Remember Last Used",desc:"Use the view you had open last time"}].map(e=>/* @__PURE__ */xe("div",{className:"flex items-start space-x-3",children:[/* @__PURE__ */be(vD,{value:e.value,id:e.value,className:"mt-1"}),/* @__PURE__ */xe("label",{htmlFor:e.value,className:"flex-1 cursor-pointer",children:[/* @__PURE__ */be("div",{className:"flex items-center gap-2 mb-1",children:/* @__PURE__ */be("span",{className:"font-medium",children:e.label})}),/* @__PURE__ */be("p",{className:"text-sm text-muted-foreground",children:e.desc})]})]},e.value))})]})]})};Array(12).fill(0);var DD=1,ED=e=>{var t;return"number"==typeof(null==e?void 0:e.id)||(null==e||null==(t=e.id)?void 0:t.length)>0?e.id:DD++},ID=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),this.getActiveToasts().forEach(t=>e(t)),()=>{const t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e],this.trimHistory()},this.trimHistory=()=>{let e=this.toasts.length-100;e<=0||(this.toasts=this.toasts.filter(t=>!(e>0&&this.dismissedToasts.has(t.id))||(this.dismissedToasts.delete(t.id),e--,!1)))},this.create=e=>{const{message:t,...r}=e,n=ED(e),a=this.pendingDismissals.get(n);void 0!==a&&(cancelAnimationFrame(a),this.pendingDismissals.delete(n),this.dismissedToasts.delete(n));const o=this.dismissedToasts.has(n),i=void 0===e.dismissible||e.dismissible;return o&&(this.dismissedToasts.delete(n),this.toasts=this.toasts.filter(e=>e.id!==n)),(o?void 0:this.toasts.find(e=>e.id===n))?this.toasts=this.toasts.map(r=>r.id===n?(this.publish({...r,...e,id:n,title:t}),{...r,...e,id:n,dismissible:i,title:t}):r):this.addToast({title:t,...r,dismissible:i,id:n}),n},this.dismiss=e=>{if(null==e)return this.getActiveToasts().forEach(e=>{this.dismissedToasts.add(e.id),this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e;this.dismissedToasts.add(e);const t=this.pendingDismissals.get(e);return void 0!==t&&cancelAnimationFrame(t),this.pendingDismissals.set(e,requestAnimationFrame(()=>{this.pendingDismissals.delete(e),this.subscribers.forEach(t=>t({id:e,dismiss:!0}))})),e},this.message=(e,t)=>this.create({...t,message:e,type:void 0}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let r;void 0!==t.loading&&(r=this.create({...t,promise:e,type:"loading",message:t.loading,description:"function"!=typeof t.description?t.description:void 0}));const n=Promise.resolve(e instanceof Function?e():e);let a,o=void 0!==r;const i=n.then(async e=>{if(a=["resolve",e],Z.isValidElement(e))o=!1,this.create({id:r,type:"default",message:e});else if(RD(e)&&!e.ok){o=!1;const n="function"==typeof t.error?await t.error(`HTTP error! status: ${e.status}`):t.error,a="function"==typeof t.description?await t.description(`HTTP error! status: ${e.status}`):t.description,i="object"!=typeof n||Z.isValidElement(n)?{message:n}:n;this.create({id:r,type:"error",description:a,...i})}else if(e instanceof Error){o=!1;const n="function"==typeof t.error?await t.error(e):t.error,a="function"==typeof t.description?await t.description(e):t.description,i="object"!=typeof n||Z.isValidElement(n)?{message:n}:n;this.create({id:r,type:"error",description:a,...i})}else if(void 0!==t.success){o=!1;const n="function"==typeof t.success?await t.success(e):t.success,a="function"==typeof t.description?await t.description(e):t.description,i="object"!=typeof n||Z.isValidElement(n)?{message:n}:n;this.create({id:r,type:"success",description:a,...i})}}).catch(async e=>{if(a=["reject",e],void 0!==t.error){o=!1;const n="function"==typeof t.error?await t.error(e):t.error,a="function"==typeof t.description?await t.description(e):t.description,i="object"!=typeof n||Z.isValidElement(n)?{message:n}:n;this.create({id:r,type:"error",description:a,...i})}}).finally(()=>{o&&(this.dismiss(r),r=void 0),null==t.finally||t.finally.call(t)}),s=()=>new Promise((e,t)=>i.then(()=>"reject"===a[0]?t(a[1]):e(a[1])).catch(t));return"string"!=typeof r&&"number"!=typeof r?{unwrap:s}:Object.assign(r,{unwrap:s})},this.custom=(e,t)=>{const r=ED(t);return this.create({...t,jsx:e(r),id:r,type:void 0}),r},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=/* @__PURE__ */new Set,this.pendingDismissals=/* @__PURE__ */new Map}},RD=e=>e&&"object"==typeof e&&"ok"in e&&"boolean"==typeof e.ok&&"status"in e&&"number"==typeof e.status,zD=(e,t)=>ID.message(e,t),_D=Object.assign(zD,{success:ID.success,info:ID.info,warning:ID.warning,error:ID.error,custom:ID.custom,message:ID.message,promise:ID.promise,dismiss:ID.dismiss,loading:ID.loading},{getHistory:()=>ID.toasts,getToasts:()=>ID.getActiveToasts()});!function(e){if(!e||"undefined"==typeof document)return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");var PD={name:"",type:"local",credentials:{}},OD=({open:e,enableDatabaseSync:t=!1,onEnableDatabaseSyncChange:r})=>{const[n,a]=fe([]),[o,i]=fe(null),[s,l]=fe(PD);le(()=>{e&&a(jf())},[e]);const c=()=>{s.name.trim()?(o&&"new"!==o?(!function(e,t){qf(jf().map(r=>r.id===e?{...r,...t,updatedAt:/* @__PURE__ */(new Date).toISOString()}:r))}(o,{name:s.name,credentials:"local"!==s.type?s.credentials:void 0}),_D.success("Source updated")):(!function(e){let t={...e,id:`${e.type}-${Date.now()}`,createdAt:/* @__PURE__ */(new Date).toISOString(),updatedAt:/* @__PURE__ */(new Date).toISOString()};qf([...jf(),t])}({name:s.name,type:s.type,credentials:"local"!==s.type?s.credentials:void 0}),_D.success("Source added")),a(jf()),i(null),l(PD)):_D.error("Please enter a source name")},d=e=>{!function(e){"local-default"!==e&&(qf(jf().filter(t=>t.id!==e)),Uf()===e&&Gf("local-default"))}(e),a(jf()),_D.success("Source deleted")},u=()=>{i(null),l(PD)},h=e=>s.credentials[e],p=e=>l(t=>({...t,credentials:{...t.credentials,...e}})),m=({type:e})=>"local"===e?/* @__PURE__ */be(Fe,{className:"h-4 w-4"}):"ssh"===e?/* @__PURE__ */be(rt,{className:"h-4 w-4"}):"s3"===e||"b2"===e?/* @__PURE__ */be(De,{className:"h-4 w-4"}):"r2"===e?/* @__PURE__ */be(Re,{className:"h-4 w-4"}):"gdocs"===e?/* @__PURE__ */be(Oe,{className:"h-4 w-4"}):"turso"===e?/* @__PURE__ */be(dt,{className:"h-4 w-4"}):null,f=e=>"ssh"===e?/* @__PURE__ */xe(ye,{children:[
306
+ /* @__PURE__ */be(LD,{label:"Host",children:/* @__PURE__ */be(_M,{value:h("host")||"",onChange:e=>p({host:e.target.value}),placeholder:"example.com"})}),
307
+ /* @__PURE__ */xe("div",{className:"grid grid-cols-2 gap-2",children:[/* @__PURE__ */be(LD,{label:"Port",children:/* @__PURE__ */be(_M,{type:"number",value:h("port")||22,onChange:e=>p({port:parseInt(e.target.value)}),placeholder:"22"})}),/* @__PURE__ */be(LD,{label:"Username",children:/* @__PURE__ */be(_M,{value:h("username")||"",onChange:e=>p({username:e.target.value}),placeholder:"user"})})]}),
308
+ /* @__PURE__ */be(LD,{label:"Password (Optional)",children:/* @__PURE__ */be(_M,{type:"password",value:h("password")||"",onChange:e=>p({password:e.target.value}),placeholder:"••••••••"})}),
309
+ /* @__PURE__ */be(LD,{label:"Base Path (Optional)",children:/* @__PURE__ */be(_M,{value:h("basePath")||"",onChange:e=>p({basePath:e.target.value}),placeholder:"/home/user/documents"})})]}):"s3"===e?/* @__PURE__ */xe(ye,{children:[
310
+ /* @__PURE__ */be(LD,{label:"Access Key ID",children:/* @__PURE__ */be(_M,{value:h("accessKeyId")||"",onChange:e=>p({accessKeyId:e.target.value}),placeholder:"AKIAIOSFODNN7EXAMPLE"})}),
311
+ /* @__PURE__ */be(LD,{label:"Secret Access Key",children:/* @__PURE__ */be(_M,{type:"password",value:h("secretAccessKey")||"",onChange:e=>p({secretAccessKey:e.target.value}),placeholder:"••••••••"})}),
312
+ /* @__PURE__ */xe("div",{className:"grid grid-cols-2 gap-2",children:[/* @__PURE__ */be(LD,{label:"Region",children:/* @__PURE__ */be(_M,{value:h("region")||"",onChange:e=>p({region:e.target.value}),placeholder:"us-east-1"})}),/* @__PURE__ */be(LD,{label:"Bucket",children:/* @__PURE__ */be(_M,{value:h("bucket")||"",onChange:e=>p({bucket:e.target.value}),placeholder:"my-bucket"})})]})]}):"r2"===e?/* @__PURE__ */xe(ye,{children:[
313
+ /* @__PURE__ */be(LD,{label:"Account ID",children:/* @__PURE__ */be(_M,{value:h("accountId")||"",onChange:e=>p({accountId:e.target.value}),placeholder:"your-account-id"})}),
314
+ /* @__PURE__ */be(LD,{label:"Access Key ID",children:/* @__PURE__ */be(_M,{value:h("accessKeyId")||"",onChange:e=>p({accessKeyId:e.target.value}),placeholder:"your-access-key-id"})}),
315
+ /* @__PURE__ */be(LD,{label:"Secret Access Key",children:/* @__PURE__ */be(_M,{type:"password",value:h("secretAccessKey")||"",onChange:e=>p({secretAccessKey:e.target.value}),placeholder:"••••••••"})}),
316
+ /* @__PURE__ */be(LD,{label:"Bucket",children:/* @__PURE__ */be(_M,{value:h("bucket")||"",onChange:e=>p({bucket:e.target.value}),placeholder:"my-bucket"})})]}):"b2"===e?/* @__PURE__ */xe(ye,{children:[
317
+ /* @__PURE__ */be(LD,{label:"Access Key ID",children:/* @__PURE__ */be(_M,{value:h("accessKeyId")||"",onChange:e=>p({accessKeyId:e.target.value}),placeholder:"your-key-id"})}),
318
+ /* @__PURE__ */be(LD,{label:"Secret Access Key",children:/* @__PURE__ */be(_M,{type:"password",value:h("secretAccessKey")||"",onChange:e=>p({secretAccessKey:e.target.value}),placeholder:"••••••••"})}),
319
+ /* @__PURE__ */be(LD,{label:"Bucket",children:/* @__PURE__ */be(_M,{value:h("bucket")||"",onChange:e=>p({bucket:e.target.value}),placeholder:"my-bucket"})}),
320
+ /* @__PURE__ */be(LD,{label:"Endpoint (Optional)",children:/* @__PURE__ */be(_M,{value:h("endpoint")||"",onChange:e=>p({endpoint:e.target.value}),placeholder:"https://s3.us-west-004.backblazeb2.com"})})]}):"gdocs"===e?/* @__PURE__ */xe(ye,{children:[
321
+ /* @__PURE__ */be(LD,{label:"Email",children:/* @__PURE__ */be(_M,{value:h("email")||"",onChange:e=>p({email:e.target.value}),placeholder:"user@gmail.com",disabled:!0})}),
322
+ /* @__PURE__ */xe(LD,{label:"Folder IDs (comma-separated)",children:[/* @__PURE__ */be(ic,{value:h("folderIds")?.join(", ")||"",onChange:e=>p({folderIds:e.target.value.split(",").map(e=>e.trim()).filter(Boolean)}),placeholder:"folder-id-1, folder-id-2",rows:3}),/* @__PURE__ */be("p",{className:"text-xs text-muted-foreground",children:"Enter Google Drive folder IDs to sync (one per line or comma-separated)"})]}),
323
323
  /* @__PURE__ */xe("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-md",children:[/* @__PURE__ */be("div",{className:"flex-1",children:/* @__PURE__ */be("p",{className:"text-sm font-medium",children:h("isAuthenticated")?"Connected to Google":"Not authenticated"})}),/* @__PURE__ */xe(oc,{size:"sm",variant:"outline",children:[/* @__PURE__ */be(qe,{className:"h-4 w-4 mr-2"}),h("isAuthenticated")?"Reconnect":"Authenticate"]})]})]}):"turso"===e?/* @__PURE__ */xe(ye,{children:[
324
- /* @__PURE__ */be(HD,{label:"Database Endpoint",children:/* @__PURE__ */be(BM,{value:h("endpoint")||"",onChange:e=>p({endpoint:e.target.value}),placeholder:"https://your-db.turso.io"})}),
325
- /* @__PURE__ */be(HD,{label:"Auth Token (Optional)",children:/* @__PURE__ */be(BM,{type:"password",value:h("authToken")||"",onChange:e=>p({authToken:e.target.value}),placeholder:"••••••••"})}),
326
- /* @__PURE__ */be(HD,{label:"Database Name (Optional)",children:/* @__PURE__ */be(BM,{value:h("database")||"",onChange:e=>p({database:e.target.value}),placeholder:"my-database"})}),
327
- /* @__PURE__ */xe("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */be("input",{type:"checkbox",id:"gdocs-sync",checked:h("enableGoogleDocsSync")||!1,onChange:e=>p({enableGoogleDocsSync:e.target.checked}),className:"h-4 w-4"}),/* @__PURE__ */be(xD,{htmlFor:"gdocs-sync",className:"cursor-pointer",children:"Enable Google Docs Sync"})]}),h("enableGoogleDocsSync")&&/* @__PURE__ */xe("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-md",children:[/* @__PURE__ */be("div",{className:"flex-1",children:/* @__PURE__ */be("p",{className:"text-sm",children:"Authenticate with Google to sync documents"})}),/* @__PURE__ */xe(oc,{size:"sm",variant:"outline",children:[/* @__PURE__ */be(qe,{className:"h-4 w-4 mr-2"}),"Login with Google"]})]})]}):null;/* @__PURE__ */
324
+ /* @__PURE__ */be(LD,{label:"Database Endpoint",children:/* @__PURE__ */be(_M,{value:h("endpoint")||"",onChange:e=>p({endpoint:e.target.value}),placeholder:"https://your-db.turso.io"})}),
325
+ /* @__PURE__ */be(LD,{label:"Auth Token (Optional)",children:/* @__PURE__ */be(_M,{type:"password",value:h("authToken")||"",onChange:e=>p({authToken:e.target.value}),placeholder:"••••••••"})}),
326
+ /* @__PURE__ */be(LD,{label:"Database Name (Optional)",children:/* @__PURE__ */be(_M,{value:h("database")||"",onChange:e=>p({database:e.target.value}),placeholder:"my-database"})}),
327
+ /* @__PURE__ */xe("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */be("input",{type:"checkbox",id:"gdocs-sync",checked:h("enableGoogleDocsSync")||!1,onChange:e=>p({enableGoogleDocsSync:e.target.checked}),className:"h-4 w-4"}),/* @__PURE__ */be(fD,{htmlFor:"gdocs-sync",className:"cursor-pointer",children:"Enable Google Docs Sync"})]}),h("enableGoogleDocsSync")&&/* @__PURE__ */xe("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-md",children:[/* @__PURE__ */be("div",{className:"flex-1",children:/* @__PURE__ */be("p",{className:"text-sm",children:"Authenticate with Google to sync documents"})}),/* @__PURE__ */xe(oc,{size:"sm",variant:"outline",children:[/* @__PURE__ */be(qe,{className:"h-4 w-4 mr-2"}),"Login with Google"]})]})]}):null;/* @__PURE__ */
328
328
  return xe("div",{className:"space-y-6",children:[
329
329
  /* @__PURE__ */xe("div",{children:[/* @__PURE__ */be("h2",{className:"text-xl font-semibold mb-2",children:"Storage Sources"}),/* @__PURE__ */be("p",{className:"text-sm text-muted-foreground",children:"Choose where documents are stored (local, SQL database, SSH, S3, R2, B2, Google Docs, Turso DB)"})]}),
330
- /* @__PURE__ */be(eD,{}),
331
- /* @__PURE__ */xe("div",{className:"flex items-start justify-between",children:[/* @__PURE__ */xe("div",{className:"space-y-1",children:[/* @__PURE__ */xe(xD,{className:"text-base flex items-center gap-2",children:[/* @__PURE__ */be(Re,{className:"h-4 w-4"}),"Database Sync"]}),/* @__PURE__ */be("p",{className:"text-sm text-muted-foreground",children:t?"Documents are saved to the SQL database, synced a couple of seconds after each edit.":"Documents stay in this browser's local storage and won't be available on other devices."})]}),/* @__PURE__ */be("input",{type:"checkbox",id:"database-sync",checked:t,onChange:e=>r?.(e.target.checked),className:"h-4 w-4 rounded border-gray-300"})]}),
332
- /* @__PURE__ */be(eD,{}),
330
+ /* @__PURE__ */be(YM,{}),
331
+ /* @__PURE__ */xe("div",{className:"flex items-start justify-between",children:[/* @__PURE__ */xe("div",{className:"space-y-1",children:[/* @__PURE__ */xe(fD,{className:"text-base flex items-center gap-2",children:[/* @__PURE__ */be(Re,{className:"h-4 w-4"}),"Database Sync"]}),/* @__PURE__ */be("p",{className:"text-sm text-muted-foreground",children:t?"Documents are saved to the SQL database, synced a couple of seconds after each edit.":"Documents stay in this browser's local storage and won't be available on other devices."})]}),/* @__PURE__ */be("input",{type:"checkbox",id:"database-sync",checked:t,onChange:e=>r?.(e.target.checked),className:"h-4 w-4 rounded border-gray-300"})]}),
332
+ /* @__PURE__ */be(YM,{}),
333
333
  /* @__PURE__ */xe("div",{className:"space-y-3",children:[n.map(e=>{/* @__PURE__ */return be("div",{className:"border rounded-lg p-3 space-y-2",children:o===e.id?/* @__PURE__ */xe("div",{className:"space-y-3",children:[
334
- /* @__PURE__ */be(HD,{label:"Source Name",children:/* @__PURE__ */be(BM,{value:s.name,onChange:e=>l(t=>({...t,name:e.target.value})),placeholder:"My Remote Files"})}),f(e.type),
335
- /* @__PURE__ */be(jD,{onSave:c,onCancel:u,label:"Save"})]}):/* @__PURE__ */xe("div",{className:"space-y-2",children:[/* @__PURE__ */xe("div",{className:"flex items-center justify-between",children:[/* @__PURE__ */xe("div",{className:"flex items-center gap-2",children:[
334
+ /* @__PURE__ */be(LD,{label:"Source Name",children:/* @__PURE__ */be(_M,{value:s.name,onChange:e=>l(t=>({...t,name:e.target.value})),placeholder:"My Remote Files"})}),f(e.type),
335
+ /* @__PURE__ */be(FD,{onSave:c,onCancel:u,label:"Save"})]}):/* @__PURE__ */xe("div",{className:"space-y-2",children:[/* @__PURE__ */xe("div",{className:"flex items-center justify-between",children:[/* @__PURE__ */xe("div",{className:"flex items-center gap-2",children:[
336
336
  /* @__PURE__ */be(m,{type:e.type}),
337
337
  /* @__PURE__ */be("span",{className:"font-medium",children:e.name}),
338
- /* @__PURE__ */be(lc,{variant:"outline",className:"text-xs",children:(t=e.type,"gdocs"===t?"Google Docs":"turso"===t?"Turso DB":"b2"===t?"Backblaze B2":t.toUpperCase())})]}),"local-default"!==e.id&&/* @__PURE__ */xe("div",{className:"flex gap-1",children:[/* @__PURE__ */be(oc,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>(e=>{i(e.id),l({name:e.name,type:e.type,credentials:e.credentials||{}})})(e),children:/* @__PURE__ */be(ze,{className:"h-3 w-3"})}),/* @__PURE__ */be(oc,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-destructive",onClick:()=>d(e.id),children:/* @__PURE__ */be(it,{className:"h-3 w-3"})})]})]}),/* @__PURE__ */be(qD,{source:e})]})},e.id);var t}),"new"===o&&/* @__PURE__ */xe("div",{className:"border rounded-lg p-3 space-y-3",children:[
339
- /* @__PURE__ */be(HD,{label:"Source Name",children:/* @__PURE__ */be(BM,{value:s.name,onChange:e=>l(t=>({...t,name:e.target.value})),placeholder:"My Remote Files"})}),
340
- /* @__PURE__ */be(HD,{label:"Source Type",children:/* @__PURE__ */xe("select",{value:s.type,onChange:e=>{const t=e.target.value;l({name:s.name,type:t,credentials:"gdocs"===t?{isAuthenticated:!1}:{}})},className:"w-full border rounded-md px-3 py-2 text-sm",children:[
338
+ /* @__PURE__ */be(lc,{variant:"outline",className:"text-xs",children:(t=e.type,"gdocs"===t?"Google Docs":"turso"===t?"Turso DB":"b2"===t?"Backblaze B2":t.toUpperCase())})]}),"local-default"!==e.id&&/* @__PURE__ */xe("div",{className:"flex gap-1",children:[/* @__PURE__ */be(oc,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>(e=>{i(e.id),l({name:e.name,type:e.type,credentials:e.credentials||{}})})(e),children:/* @__PURE__ */be(ze,{className:"h-3 w-3"})}),/* @__PURE__ */be(oc,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-destructive",onClick:()=>d(e.id),children:/* @__PURE__ */be(it,{className:"h-3 w-3"})})]})]}),/* @__PURE__ */be(BD,{source:e})]})},e.id);var t}),"new"===o&&/* @__PURE__ */xe("div",{className:"border rounded-lg p-3 space-y-3",children:[
339
+ /* @__PURE__ */be(LD,{label:"Source Name",children:/* @__PURE__ */be(_M,{value:s.name,onChange:e=>l(t=>({...t,name:e.target.value})),placeholder:"My Remote Files"})}),
340
+ /* @__PURE__ */be(LD,{label:"Source Type",children:/* @__PURE__ */xe("select",{value:s.type,onChange:e=>{const t=e.target.value;l({name:s.name,type:t,credentials:"gdocs"===t?{isAuthenticated:!1}:{}})},className:"w-full border rounded-md px-3 py-2 text-sm",children:[
341
341
  /* @__PURE__ */be("option",{value:"ssh",children:"SSH"}),
342
342
  /* @__PURE__ */be("option",{value:"s3",children:"Amazon S3"}),
343
343
  /* @__PURE__ */be("option",{value:"r2",children:"Cloudflare R2"}),
344
344
  /* @__PURE__ */be("option",{value:"b2",children:"Backblaze B2"}),
345
345
  /* @__PURE__ */be("option",{value:"gdocs",children:"Google Docs"}),
346
346
  /* @__PURE__ */be("option",{value:"turso",children:"Turso DB"})]})}),f(s.type),
347
- /* @__PURE__ */be(jD,{onSave:c,onCancel:u,label:"Add Source"})]})]}),"new"!==o&&/* @__PURE__ */xe(oc,{variant:"outline",size:"sm",onClick:()=>{i("new"),l({name:"",type:"ssh",credentials:{port:22}})},className:"w-full gap-2",children:[/* @__PURE__ */be(Qe,{className:"h-4 w-4"}),"Add New Storage Source"]})]})},HD=({label:e,children:t})=>/* @__PURE__ */xe("div",{className:"space-y-2",children:[/* @__PURE__ */be(xD,{children:e}),t]}),jD=({onSave:e,onCancel:t,label:r})=>/* @__PURE__ */xe("div",{className:"flex gap-2",children:[/* @__PURE__ */be(oc,{size:"sm",onClick:e,children:r}),/* @__PURE__ */be(oc,{size:"sm",variant:"outline",onClick:t,children:"Cancel"})]}),qD=({source:e})=>{if("ssh"===e.type&&e.credentials){const t=e.credentials;/* @__PURE__ */
347
+ /* @__PURE__ */be(FD,{onSave:c,onCancel:u,label:"Add Source"})]})]}),"new"!==o&&/* @__PURE__ */xe(oc,{variant:"outline",size:"sm",onClick:()=>{i("new"),l({name:"",type:"ssh",credentials:{port:22}})},className:"w-full gap-2",children:[/* @__PURE__ */be(Qe,{className:"h-4 w-4"}),"Add New Storage Source"]})]})},LD=({label:e,children:t})=>/* @__PURE__ */xe("div",{className:"space-y-2",children:[/* @__PURE__ */be(fD,{children:e}),t]}),FD=({onSave:e,onCancel:t,label:r})=>/* @__PURE__ */xe("div",{className:"flex gap-2",children:[/* @__PURE__ */be(oc,{size:"sm",onClick:e,children:r}),/* @__PURE__ */be(oc,{size:"sm",variant:"outline",onClick:t,children:"Cancel"})]}),BD=({source:e})=>{if("ssh"===e.type&&e.credentials){const t=e.credentials;/* @__PURE__ */
348
348
  return xe("p",{className:"text-xs text-muted-foreground",children:[t.username,"@",t.host,":",t.port||22]})}if("s3"===e.type&&e.credentials){const t=e.credentials;/* @__PURE__ */
349
349
  return xe("p",{className:"text-xs text-muted-foreground",children:[t.bucket," (",t.region,")"]})}if("r2"===e.type&&e.credentials){const t=e.credentials;/* @__PURE__ */
350
350
  return be("p",{className:"text-xs text-muted-foreground",children:t.bucket})}if("b2"===e.type&&e.credentials){const t=e.credentials;/* @__PURE__ */
351
351
  return xe("p",{className:"text-xs text-muted-foreground",children:[t.bucket," (",t.endpoint||"default endpoint",")"]})}if("gdocs"===e.type&&e.credentials){const t=e.credentials;/* @__PURE__ */
352
352
  return be("p",{className:"text-xs text-muted-foreground",children:t.isAuthenticated?`${t.email||"Authenticated"} - ${t.folderIds?.length||0} folder(s)`:"Not authenticated"})}if("turso"===e.type&&e.credentials){const t=e.credentials;/* @__PURE__ */
353
- return xe("p",{className:"text-xs text-muted-foreground",children:[t.endpoint,t.enableGoogleDocsSync&&" (Google Docs sync enabled)"]})}return null},UD=["blue","purple","green","orange","pink"],GD=({open:e})=>{const[t,r]=fe([]),[n,a]=fe(null),[o,i]=fe({});le(()=>{e&&r(yM())},[e]);const s=({modeId:e,onSave:t,onCancel:r})=>/* @__PURE__ */xe("div",{className:"space-y-3",children:[
354
- /* @__PURE__ */xe("div",{className:"space-y-2",children:[/* @__PURE__ */be(xD,{htmlFor:`name-${e}`,children:"Mode Name"}),/* @__PURE__ */be(BM,{id:`name-${e}`,value:o.name||"",onChange:e=>i(t=>({...t,name:e.target.value})),placeholder:"Mode name"})]}),
355
- /* @__PURE__ */xe("div",{className:"space-y-2",children:[/* @__PURE__ */be(xD,{htmlFor:`prompt-${e}`,children:"Prompt"}),/* @__PURE__ */be(ic,{id:`prompt-${e}`,value:o.prompt||"",onChange:e=>i(t=>({...t,prompt:e.target.value})),placeholder:"Rewrite prompt...",rows:4})]}),
356
- /* @__PURE__ */xe("div",{className:"space-y-2",children:[/* @__PURE__ */be(xD,{htmlFor:`color-${e}`,children:"Color"}),/* @__PURE__ */be("select",{id:`color-${e}`,value:o.color||"blue",onChange:e=>i(t=>({...t,color:e.target.value})),className:"w-full border rounded-md px-3 py-2 text-sm",children:UD.map(e=>/* @__PURE__ */be("option",{value:e,children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]}),
353
+ return xe("p",{className:"text-xs text-muted-foreground",children:[t.endpoint,t.enableGoogleDocsSync&&" (Google Docs sync enabled)"]})}return null},VD=["blue","purple","green","orange","pink"],$D=({open:e})=>{const[t,r]=fe([]),[n,a]=fe(null),[o,i]=fe({});le(()=>{e&&r(pM())},[e]);const s=({modeId:e,onSave:t,onCancel:r})=>/* @__PURE__ */xe("div",{className:"space-y-3",children:[
354
+ /* @__PURE__ */xe("div",{className:"space-y-2",children:[/* @__PURE__ */be(fD,{htmlFor:`name-${e}`,children:"Mode Name"}),/* @__PURE__ */be(_M,{id:`name-${e}`,value:o.name||"",onChange:e=>i(t=>({...t,name:e.target.value})),placeholder:"Mode name"})]}),
355
+ /* @__PURE__ */xe("div",{className:"space-y-2",children:[/* @__PURE__ */be(fD,{htmlFor:`prompt-${e}`,children:"Prompt"}),/* @__PURE__ */be(ic,{id:`prompt-${e}`,value:o.prompt||"",onChange:e=>i(t=>({...t,prompt:e.target.value})),placeholder:"Rewrite prompt...",rows:4})]}),
356
+ /* @__PURE__ */xe("div",{className:"space-y-2",children:[/* @__PURE__ */be(fD,{htmlFor:`color-${e}`,children:"Color"}),/* @__PURE__ */be("select",{id:`color-${e}`,value:o.color||"blue",onChange:e=>i(t=>({...t,color:e.target.value})),className:"w-full border rounded-md px-3 py-2 text-sm",children:VD.map(e=>/* @__PURE__ */be("option",{value:e,children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]}),
357
357
  /* @__PURE__ */xe("div",{className:"flex gap-2",children:[/* @__PURE__ */be(oc,{size:"sm",onClick:t,children:"Save"}),/* @__PURE__ */be(oc,{size:"sm",variant:"outline",onClick:r,children:"Cancel"})]})]});/* @__PURE__ */
358
358
  return xe("div",{className:"space-y-6",children:[
359
- /* @__PURE__ */xe("div",{className:"flex items-center justify-between",children:[/* @__PURE__ */xe("div",{children:[/* @__PURE__ */be("h2",{className:"text-xl font-semibold mb-2",children:"AI Rewrite Modes"}),/* @__PURE__ */be("p",{className:"text-sm text-muted-foreground",children:"Customize AI rewrite prompts and add your own modes"})]}),/* @__PURE__ */xe(oc,{variant:"outline",size:"sm",onClick:()=>{bM(gM),r(yM()),BD.success("Modes reset to defaults")},className:"gap-2",children:[/* @__PURE__ */be(et,{className:"h-4 w-4"}),"Reset"]})]}),
360
- /* @__PURE__ */be(eD,{}),
361
- /* @__PURE__ */xe("div",{className:"space-y-3",children:[t.map(e=>/* @__PURE__ */be("div",{className:"border rounded-lg p-3 space-y-2",children:n===e.id?/* @__PURE__ */be(s,{modeId:e.id,onSave:()=>(e=>{const n=t.map(t=>t.id===e.id?e:t);r(n),bM(n),a(null),i({}),BD.success("Mode updated")})(o),onCancel:()=>{a(null),i({})}}):/* @__PURE__ */xe("div",{className:"space-y-2",children:[/* @__PURE__ */xe("div",{className:"flex items-center justify-between",children:[/* @__PURE__ */be(lc,{variant:"outline",className:"text-sm",children:e.name}),/* @__PURE__ */xe("div",{className:"flex gap-1",children:[/* @__PURE__ */be(oc,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>{a(e.id),i(e)},children:/* @__PURE__ */be(ze,{className:"h-3 w-3"})}),/* @__PURE__ */be(oc,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-destructive",onClick:()=>(e=>{const n=t.filter(t=>t.id!==e);r(n),bM(n),BD.success("Mode deleted")})(e.id),children:/* @__PURE__ */be(it,{className:"h-3 w-3"})})]})]}),/* @__PURE__ */be("p",{className:"text-xs text-muted-foreground line-clamp-2",children:e.prompt})]})},e.id)),"new"===n&&/* @__PURE__ */be("div",{className:"border rounded-lg p-3",children:/* @__PURE__ */be(s,{modeId:"new",onSave:()=>{const e={id:`custom-${Date.now()}`,name:o.name||"New Mode",prompt:o.prompt||"Rewrite this text:",color:o.color||"blue"},n=[...t,e];r(n),bM(n),a(null),i({}),BD.success("Mode added")},onCancel:()=>{a(null),i({})}})})]}),"new"!==n&&/* @__PURE__ */xe(oc,{variant:"outline",size:"sm",onClick:()=>{a("new"),i({name:"",prompt:"",color:"blue"})},className:"w-full gap-2",children:[/* @__PURE__ */be(Qe,{className:"h-4 w-4"}),"Add New Mode"]})]})};function WD({keys:e,muted:t=!1}){/* @__PURE__ */
362
- return be("span",{className:"inline-flex items-center gap-1",children:e.map((e,r)=>/* @__PURE__ */be("kbd",{className:"inline-flex h-5 min-w-5 items-center justify-center rounded border px-1.5 text-[11px] font-semibold leading-none "+(t?"border-gray-200 bg-gray-50 text-gray-400 dark:border-slate-700 dark:bg-slate-800/50 dark:text-slate-500":"border-gray-300 border-b-2 bg-gray-100 text-gray-700 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-200"),children:i(e)},`${e}-${r}`))})}function KD({action:e,recording:t,conflict:r,onStartRecording:a}){const o=s(e.id),i=n(e.id);/* @__PURE__ */
359
+ /* @__PURE__ */xe("div",{className:"flex items-center justify-between",children:[/* @__PURE__ */xe("div",{children:[/* @__PURE__ */be("h2",{className:"text-xl font-semibold mb-2",children:"AI Rewrite Modes"}),/* @__PURE__ */be("p",{className:"text-sm text-muted-foreground",children:"Customize AI rewrite prompts and add your own modes"})]}),/* @__PURE__ */xe(oc,{variant:"outline",size:"sm",onClick:()=>{mM(uM),r(pM()),_D.success("Modes reset to defaults")},className:"gap-2",children:[/* @__PURE__ */be(et,{className:"h-4 w-4"}),"Reset"]})]}),
360
+ /* @__PURE__ */be(YM,{}),
361
+ /* @__PURE__ */xe("div",{className:"space-y-3",children:[t.map(e=>/* @__PURE__ */be("div",{className:"border rounded-lg p-3 space-y-2",children:n===e.id?/* @__PURE__ */be(s,{modeId:e.id,onSave:()=>(e=>{const n=t.map(t=>t.id===e.id?e:t);r(n),mM(n),a(null),i({}),_D.success("Mode updated")})(o),onCancel:()=>{a(null),i({})}}):/* @__PURE__ */xe("div",{className:"space-y-2",children:[/* @__PURE__ */xe("div",{className:"flex items-center justify-between",children:[/* @__PURE__ */be(lc,{variant:"outline",className:"text-sm",children:e.name}),/* @__PURE__ */xe("div",{className:"flex gap-1",children:[/* @__PURE__ */be(oc,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>{a(e.id),i(e)},children:/* @__PURE__ */be(ze,{className:"h-3 w-3"})}),/* @__PURE__ */be(oc,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-destructive",onClick:()=>(e=>{const n=t.filter(t=>t.id!==e);r(n),mM(n),_D.success("Mode deleted")})(e.id),children:/* @__PURE__ */be(it,{className:"h-3 w-3"})})]})]}),/* @__PURE__ */be("p",{className:"text-xs text-muted-foreground line-clamp-2",children:e.prompt})]})},e.id)),"new"===n&&/* @__PURE__ */be("div",{className:"border rounded-lg p-3",children:/* @__PURE__ */be(s,{modeId:"new",onSave:()=>{const e={id:`custom-${Date.now()}`,name:o.name||"New Mode",prompt:o.prompt||"Rewrite this text:",color:o.color||"blue"},n=[...t,e];r(n),mM(n),a(null),i({}),_D.success("Mode added")},onCancel:()=>{a(null),i({})}})})]}),"new"!==n&&/* @__PURE__ */xe(oc,{variant:"outline",size:"sm",onClick:()=>{a("new"),i({name:"",prompt:"",color:"blue"})},className:"w-full gap-2",children:[/* @__PURE__ */be(Qe,{className:"h-4 w-4"}),"Add New Mode"]})]})};function HD({keys:e,muted:t=!1}){/* @__PURE__ */
362
+ return be("span",{className:"inline-flex items-center gap-1",children:e.map((e,r)=>/* @__PURE__ */be("kbd",{className:"inline-flex h-5 min-w-5 items-center justify-center rounded border px-1.5 text-[11px] font-semibold leading-none "+(t?"border-gray-200 bg-gray-50 text-gray-400 dark:border-slate-700 dark:bg-slate-800/50 dark:text-slate-500":"border-gray-300 border-b-2 bg-gray-100 text-gray-700 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-200"),children:i(e)},`${e}-${r}`))})}function jD({action:e,recording:t,conflict:r,onStartRecording:a}){const o=s(e.id),i=n(e.id);/* @__PURE__ */
363
363
  return xe("div",{className:"flex items-center gap-2 rounded-md px-2 py-1.5 hover:bg-gray-50 dark:hover:bg-slate-800/60",children:[
364
364
  /* @__PURE__ */be("span",{className:"flex-1 truncate text-sm",children:e.label}),r&&/* @__PURE__ */be("span",{className:"text-xs text-red-500 dark:text-red-400",children:r}),
365
- /* @__PURE__ */be("button",{type:"button",onClick:a,title:t?"Press the new shortcut (Esc to cancel)":"Click to record a new shortcut",className:"flex h-7 min-w-[88px] items-center justify-center rounded-md border px-2 transition-colors "+(t?"border-blue-400 bg-blue-50 ring-2 ring-blue-200 dark:border-blue-500 dark:bg-blue-950/40 dark:ring-blue-900":"border-transparent hover:border-gray-300 dark:hover:border-slate-600"),children:t?/* @__PURE__ */be("span",{className:"animate-pulse text-xs text-blue-600 dark:text-blue-400",children:"Press keys…"}):/* @__PURE__ */be(WD,{keys:o})}),
366
- /* @__PURE__ */be("button",{type:"button",onClick:()=>d(e.id,null),title:"Reset to default",className:"rounded p-1 text-gray-400 transition-opacity hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-slate-700 dark:hover:text-gray-300 "+(i?"opacity-100":"pointer-events-none opacity-0"),children:/* @__PURE__ */be(et,{size:13})})]})}var YD=({compact:e=!1}={})=>{c();const[t,i]=fe(null),[s,h]=fe(null),p=pe(()=>{const e=/* @__PURE__ */new Map;for(const t of o){const r=e.get(t.group)??[];r.push(t),e.set(t.group,r)}return[...e.entries()]},[]);le(()=>{if(!t)return;const e=e=>{if(e.preventDefault(),e.stopPropagation(),"Escape"===e.key)return void i(null);const n=r(e);if(!n)return;if(!a(n)&&!/^F\d{1,2}$/.test(n[n.length-1]))return void h({id:t,message:"Include Ctrl/⌘ or Alt"});const o=l(n);o&&o.id!==t?h({id:t,message:`Already used by “${o.label}”`}):(d(t,n),h(null),i(null))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t]);const m=o.some(e=>n(e.id));/* @__PURE__ */
367
- return xe("div",{className:"space-y-6",children:[/* @__PURE__ */xe("div",{className:"flex items-start justify-between gap-4",children:[/* @__PURE__ */xe("div",{children:[!e&&/* @__PURE__ */be("h2",{className:"text-xl font-semibold mb-2",children:"Keyboard Shortcuts"}),/* @__PURE__ */be("p",{className:"text-sm text-muted-foreground",children:"Click a shortcut, then press the new key combination. Esc cancels recording."})]}),/* @__PURE__ */xe("button",{type:"button",onClick:()=>{u(),h(null),i(null)},disabled:!m,className:"flex shrink-0 items-center gap-1.5 rounded-md border border-gray-200 px-3 py-1.5 text-xs hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-40 dark:border-slate-700 dark:hover:bg-slate-800",children:[/* @__PURE__ */be(et,{size:12}),"Reset all"]})]}),p.map(([e,r])=>/* @__PURE__ */xe("div",{className:"space-y-1",children:[/* @__PURE__ */be("h3",{className:"px-2 text-[11px] font-semibold uppercase tracking-wide text-gray-400",children:e}),r.map(e=>/* @__PURE__ */be(KD,{action:e,recording:t===e.id,conflict:s?.id===e.id?s.message:void 0,onStartRecording:()=>{h(null),i(t=>t===e.id?null:e.id)}},e.id))]},e))]})},XD=()=>/* @__PURE__ */xe("div",{className:"space-y-6",children:[
365
+ /* @__PURE__ */be("button",{type:"button",onClick:a,title:t?"Press the new shortcut (Esc to cancel)":"Click to record a new shortcut",className:"flex h-7 min-w-[88px] items-center justify-center rounded-md border px-2 transition-colors "+(t?"border-blue-400 bg-blue-50 ring-2 ring-blue-200 dark:border-blue-500 dark:bg-blue-950/40 dark:ring-blue-900":"border-transparent hover:border-gray-300 dark:hover:border-slate-600"),children:t?/* @__PURE__ */be("span",{className:"animate-pulse text-xs text-blue-600 dark:text-blue-400",children:"Press keys…"}):/* @__PURE__ */be(HD,{keys:o})}),
366
+ /* @__PURE__ */be("button",{type:"button",onClick:()=>d(e.id,null),title:"Reset to default",className:"rounded p-1 text-gray-400 transition-opacity hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-slate-700 dark:hover:text-gray-300 "+(i?"opacity-100":"pointer-events-none opacity-0"),children:/* @__PURE__ */be(et,{size:13})})]})}var qD=({compact:e=!1}={})=>{c();const[t,i]=fe(null),[s,h]=fe(null),p=pe(()=>{const e=/* @__PURE__ */new Map;for(const t of o){const r=e.get(t.group)??[];r.push(t),e.set(t.group,r)}return[...e.entries()]},[]);le(()=>{if(!t)return;const e=e=>{if(e.preventDefault(),e.stopPropagation(),"Escape"===e.key)return void i(null);const n=r(e);if(!n)return;if(!a(n)&&!/^F\d{1,2}$/.test(n[n.length-1]))return void h({id:t,message:"Include Ctrl/⌘ or Alt"});const o=l(n);o&&o.id!==t?h({id:t,message:`Already used by “${o.label}”`}):(d(t,n),h(null),i(null))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t]);const m=o.some(e=>n(e.id));/* @__PURE__ */
367
+ return xe("div",{className:"space-y-6",children:[/* @__PURE__ */xe("div",{className:"flex items-start justify-between gap-4",children:[/* @__PURE__ */xe("div",{children:[!e&&/* @__PURE__ */be("h2",{className:"text-xl font-semibold mb-2",children:"Keyboard Shortcuts"}),/* @__PURE__ */be("p",{className:"text-sm text-muted-foreground",children:"Click a shortcut, then press the new key combination. Esc cancels recording."})]}),/* @__PURE__ */xe("button",{type:"button",onClick:()=>{u(),h(null),i(null)},disabled:!m,className:"flex shrink-0 items-center gap-1.5 rounded-md border border-gray-200 px-3 py-1.5 text-xs hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-40 dark:border-slate-700 dark:hover:bg-slate-800",children:[/* @__PURE__ */be(et,{size:12}),"Reset all"]})]}),p.map(([e,r])=>/* @__PURE__ */xe("div",{className:"space-y-1",children:[/* @__PURE__ */be("h3",{className:"px-2 text-[11px] font-semibold uppercase tracking-wide text-gray-400",children:e}),r.map(e=>/* @__PURE__ */be(jD,{action:e,recording:t===e.id,conflict:s?.id===e.id?s.message:void 0,onStartRecording:()=>{h(null),i(t=>t===e.id?null:e.id)}},e.id))]},e))]})},UD=()=>/* @__PURE__ */xe("div",{className:"space-y-6",children:[
368
368
  /* @__PURE__ */xe("div",{children:[/* @__PURE__ */be("h2",{className:"text-xl font-semibold mb-2",children:"About"}),/* @__PURE__ */be("p",{className:"text-sm text-muted-foreground",children:"Application information"})]}),
369
- /* @__PURE__ */be(eD,{}),
370
- /* @__PURE__ */xe("div",{className:"text-sm space-y-3",children:[/* @__PURE__ */xe("div",{className:"space-y-1",children:[/* @__PURE__ */be("p",{className:"font-medium",children:"REASON"}),/* @__PURE__ */be("p",{className:"text-muted-foreground",children:"A powerful note-taking application"})]}),/* @__PURE__ */xe("div",{className:"space-y-1",children:[/* @__PURE__ */be("p",{className:"font-medium",children:"Version"}),/* @__PURE__ */be("p",{className:"text-muted-foreground",children:"1.0.0"})]})]})]}),ZD=[{name:"Appearance",icon:Ze},{name:"Storage Sources",icon:Re},{name:"AI Rewrite Modes",icon:ct},{name:"Keyboard Shortcuts",icon:$e},{name:"About",icon:Ve}],JD={Storage:"Storage Sources","File Sources":"Storage Sources"},QD=e=>e&&(JD[e]??e)||"Appearance",eE=({open:e,onOpenChange:t,initialSection:r,defaultSidebarView:n="last-used",onDefaultSidebarViewChange:a,enableDatabaseSync:o=!1,onEnableDatabaseSyncChange:i})=>{const[s,l]=fe(()=>QD(r));le(()=>{e&&l(QD(r))},[e,r]);/* @__PURE__ */
371
- return be(IM,{open:e,onOpenChange:t,children:/* @__PURE__ */xe(_M,{className:"overflow-hidden p-0 md:max-h-[500px] md:max-w-[700px] lg:max-w-[800px]",children:[
372
- /* @__PURE__ */be(LM,{className:"sr-only",children:"Settings"}),
373
- /* @__PURE__ */be(FM,{className:"sr-only",children:"Customize your settings here."}),
374
- /* @__PURE__ */xe(sD,{className:"items-start",children:[/* @__PURE__ */be(lD,{collapsible:"none",className:"hidden md:flex",children:/* @__PURE__ */be(cD,{children:/* @__PURE__ */be(dD,{children:/* @__PURE__ */be(uD,{children:/* @__PURE__ */be(hD,{children:ZD.map(e=>/* @__PURE__ */be(pD,{children:/* @__PURE__ */be(fD,{asChild:!0,isActive:e.name===s,onClick:()=>l(e.name),children:/* @__PURE__ */xe("a",{href:"#",children:[/* @__PURE__ */be(e.icon,{}),/* @__PURE__ */be("span",{children:e.name})]})})},e.name))})})})})}),/* @__PURE__ */xe("main",{className:"flex h-[480px] flex-1 flex-col overflow-hidden",children:[/* @__PURE__ */be("header",{className:"flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-[[data-collapsible=icon]]/sidebar-wrapper:h-12",children:/* @__PURE__ */be("div",{className:"flex items-center gap-2 px-4",children:/* @__PURE__ */be(WM,{children:/* @__PURE__ */xe(KM,{children:[
375
- /* @__PURE__ */be(YM,{className:"hidden md:block",children:/* @__PURE__ */xe(XM,{href:"#",children:[/* @__PURE__ */be(nt,{className:"h-4 w-4 inline mr-1"}),"Settings"]})}),
376
- /* @__PURE__ */be(JM,{className:"hidden md:block"}),
377
- /* @__PURE__ */be(YM,{children:/* @__PURE__ */be(ZM,{children:s})})]})})})}),/* @__PURE__ */be("div",{className:"flex flex-1 flex-col gap-4 overflow-y-auto p-4 pt-0",children:(()=>{switch(s){case"Appearance":/* @__PURE__ */return be(zD,{defaultSidebarView:n,onDefaultSidebarViewChange:a});case"Storage Sources":/* @__PURE__ */return be($D,{open:e,enableDatabaseSync:o,onEnableDatabaseSyncChange:i});case"AI Rewrite Modes":/* @__PURE__ */return be(GD,{open:e});case"Keyboard Shortcuts":/* @__PURE__ */return be(YD,{});case"About":/* @__PURE__ */return be(XD,{});default:return null}})()})]})]})]})})};function tE({className:e,...t}){/* @__PURE__ */
378
- return be(Ct.Root,{"data-slot":"tabs",className:ec("flex flex-col gap-2",e),...t})}function rE({className:e,...t}){/* @__PURE__ */
379
- return be(Ct.List,{"data-slot":"tabs-list",className:ec("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-2xl p-[3px]",e),...t})}function nE({className:e,...t}){/* @__PURE__ */
380
- return be(Ct.Trigger,{"data-slot":"tabs-trigger",className:ec("cursor-pointer data-[state=active]:bg-background data-[state=active]:text-foreground dark:data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-2xl border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function aE({className:e,...t}){/* @__PURE__ */
381
- return be(Ct.Content,{"data-slot":"tabs-content",className:ec("flex-1 outline-none",e),...t})}var oE=xt.Root,iE=xt.Value,sE=X.forwardRef(({className:e,children:t,...r},n)=>/* @__PURE__ */xe(xt.Trigger,{ref:n,className:ec("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,/* @__PURE__ */be(xt.Icon,{asChild:!0,children:/* @__PURE__ */be(Ce,{className:"h-4 w-4 opacity-50"})})]}));sE.displayName=xt.Trigger.displayName;var lE=X.forwardRef(({className:e,...t},r)=>/* @__PURE__ */be(xt.ScrollUpButton,{ref:r,className:ec("flex cursor-default items-center justify-center py-1",e),...t,children:/* @__PURE__ */be(Ae,{className:"h-4 w-4"})}));lE.displayName=xt.ScrollUpButton.displayName;var cE=X.forwardRef(({className:e,...t},r)=>/* @__PURE__ */be(xt.ScrollDownButton,{ref:r,className:ec("flex cursor-default items-center justify-center py-1",e),...t,children:/* @__PURE__ */be(Ce,{className:"h-4 w-4"})}));cE.displayName=xt.ScrollDownButton.displayName;var dE=X.forwardRef(({className:e,children:t,position:r="popper",...n},a)=>/* @__PURE__ */be(xt.Portal,{children:/* @__PURE__ */xe(xt.Content,{ref:a,className:ec("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-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","popper"===r&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...n,children:[
382
- /* @__PURE__ */be(lE,{}),
369
+ /* @__PURE__ */be(YM,{}),
370
+ /* @__PURE__ */xe("div",{className:"text-sm space-y-3",children:[/* @__PURE__ */xe("div",{className:"space-y-1",children:[/* @__PURE__ */be("p",{className:"font-medium",children:"REASON"}),/* @__PURE__ */be("p",{className:"text-muted-foreground",children:"A powerful note-taking application"})]}),/* @__PURE__ */xe("div",{className:"space-y-1",children:[/* @__PURE__ */be("p",{className:"font-medium",children:"Version"}),/* @__PURE__ */be("p",{className:"text-muted-foreground",children:"1.0.0"})]})]})]}),GD=[{name:"Appearance",icon:Ze},{name:"Storage Sources",icon:Re},{name:"AI Rewrite Modes",icon:ct},{name:"Keyboard Shortcuts",icon:$e},{name:"About",icon:Ve}],WD={Storage:"Storage Sources","File Sources":"Storage Sources"},KD=e=>e&&(WD[e]??e)||"Appearance",YD=({open:e,onOpenChange:t,initialSection:r,defaultSidebarView:n="last-used",onDefaultSidebarViewChange:a,enableDatabaseSync:o=!1,onEnableDatabaseSyncChange:i})=>{const[s,l]=fe(()=>KD(r));le(()=>{e&&l(KD(r))},[e,r]);/* @__PURE__ */
371
+ return be(TM,{open:e,onOpenChange:t,children:/* @__PURE__ */xe(DM,{className:"overflow-hidden p-0 md:max-h-[500px] md:max-w-[700px] lg:max-w-[800px]",children:[
372
+ /* @__PURE__ */be(RM,{className:"sr-only",children:"Settings"}),
373
+ /* @__PURE__ */be(zM,{className:"sr-only",children:"Customize your settings here."}),
374
+ /* @__PURE__ */xe(rD,{className:"items-start",children:[/* @__PURE__ */be(nD,{collapsible:"none",className:"hidden md:flex",children:/* @__PURE__ */be(aD,{children:/* @__PURE__ */be(oD,{children:/* @__PURE__ */be(iD,{children:/* @__PURE__ */be(sD,{children:GD.map(e=>/* @__PURE__ */be(lD,{children:/* @__PURE__ */be(dD,{asChild:!0,isActive:e.name===s,onClick:()=>l(e.name),children:/* @__PURE__ */xe("a",{href:"#",children:[/* @__PURE__ */be(e.icon,{}),/* @__PURE__ */be("span",{children:e.name})]})})},e.name))})})})})}),/* @__PURE__ */xe("main",{className:"flex h-[480px] flex-1 flex-col overflow-hidden",children:[/* @__PURE__ */be("header",{className:"flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-[[data-collapsible=icon]]/sidebar-wrapper:h-12",children:/* @__PURE__ */be("div",{className:"flex items-center gap-2 px-4",children:/* @__PURE__ */be(HM,{children:/* @__PURE__ */xe(jM,{children:[
375
+ /* @__PURE__ */be(qM,{className:"hidden md:block",children:/* @__PURE__ */xe(UM,{href:"#",children:[/* @__PURE__ */be(nt,{className:"h-4 w-4 inline mr-1"}),"Settings"]})}),
376
+ /* @__PURE__ */be(WM,{className:"hidden md:block"}),
377
+ /* @__PURE__ */be(qM,{children:/* @__PURE__ */be(GM,{children:s})})]})})})}),/* @__PURE__ */be("div",{className:"flex flex-1 flex-col gap-4 overflow-y-auto p-4 pt-0",children:(()=>{switch(s){case"Appearance":/* @__PURE__ */return be(MD,{defaultSidebarView:n,onDefaultSidebarViewChange:a});case"Storage Sources":/* @__PURE__ */return be(OD,{open:e,enableDatabaseSync:o,onEnableDatabaseSyncChange:i});case"AI Rewrite Modes":/* @__PURE__ */return be($D,{open:e});case"Keyboard Shortcuts":/* @__PURE__ */return be(qD,{});case"About":/* @__PURE__ */return be(UD,{});default:return null}})()})]})]})]})})};function XD({className:e,...t}){/* @__PURE__ */
378
+ return be(Ct.Root,{"data-slot":"tabs",className:ec("flex flex-col gap-2",e),...t})}function ZD({className:e,...t}){/* @__PURE__ */
379
+ return be(Ct.List,{"data-slot":"tabs-list",className:ec("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-2xl p-[3px]",e),...t})}function JD({className:e,...t}){/* @__PURE__ */
380
+ return be(Ct.Trigger,{"data-slot":"tabs-trigger",className:ec("cursor-pointer data-[state=active]:bg-background data-[state=active]:text-foreground dark:data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-2xl border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function QD({className:e,...t}){/* @__PURE__ */
381
+ return be(Ct.Content,{"data-slot":"tabs-content",className:ec("flex-1 outline-none",e),...t})}var eE=xt.Root,tE=xt.Value,rE=X.forwardRef(({className:e,children:t,...r},n)=>/* @__PURE__ */xe(xt.Trigger,{ref:n,className:ec("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,/* @__PURE__ */be(xt.Icon,{asChild:!0,children:/* @__PURE__ */be(Ce,{className:"h-4 w-4 opacity-50"})})]}));rE.displayName=xt.Trigger.displayName;var nE=X.forwardRef(({className:e,...t},r)=>/* @__PURE__ */be(xt.ScrollUpButton,{ref:r,className:ec("flex cursor-default items-center justify-center py-1",e),...t,children:/* @__PURE__ */be(Ae,{className:"h-4 w-4"})}));nE.displayName=xt.ScrollUpButton.displayName;var aE=X.forwardRef(({className:e,...t},r)=>/* @__PURE__ */be(xt.ScrollDownButton,{ref:r,className:ec("flex cursor-default items-center justify-center py-1",e),...t,children:/* @__PURE__ */be(Ce,{className:"h-4 w-4"})}));aE.displayName=xt.ScrollDownButton.displayName;var oE=X.forwardRef(({className:e,children:t,position:r="popper",...n},a)=>/* @__PURE__ */be(xt.Portal,{children:/* @__PURE__ */xe(xt.Content,{ref:a,className:ec("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-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","popper"===r&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...n,children:[
382
+ /* @__PURE__ */be(nE,{}),
383
383
  /* @__PURE__ */be(xt.Viewport,{className:ec("p-1","popper"===r&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),
384
- /* @__PURE__ */be(cE,{})]})}));dE.displayName=xt.Content.displayName,X.forwardRef(({className:e,...t},r)=>/* @__PURE__ */be(xt.Label,{ref:r,className:ec("px-2 py-1.5 text-sm font-semibold",e),...t})).displayName=xt.Label.displayName;var uE=X.forwardRef(({className:e,children:t,...r},n)=>/* @__PURE__ */xe(xt.Item,{ref:n,className:ec("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),...r,children:[/* @__PURE__ */be("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:/* @__PURE__ */be(xt.ItemIndicator,{children:/* @__PURE__ */be(Se,{className:"h-4 w-4"})})}),/* @__PURE__ */be(xt.ItemText,{children:t})]}));function hE({...e}){/* @__PURE__ */
385
- return be(Ht,{"data-slot":"alert-dialog",...e})}function pE({...e}){/* @__PURE__ */
386
- return be(jt,{"data-slot":"alert-dialog-portal",...e})}function mE({className:e,...t}){/* @__PURE__ */
387
- return be(qt,{"data-slot":"alert-dialog-overlay",className:ec("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50 backdrop-blur-xs",e),...t})}function fE({className:e,...t}){/* @__PURE__ */
388
- return xe(pE,{children:[/* @__PURE__ */be(mE,{}),/* @__PURE__ */be(Ut,{"data-slot":"alert-dialog-content",className:ec("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-2xl border p-6 shadow-lg duration-200 sm:max-w-lg",e),...t})]})}function gE({className:e,...t}){/* @__PURE__ */
389
- return be("div",{"data-slot":"alert-dialog-header",className:ec("flex flex-col gap-2 text-center sm:text-left",e),...t})}function vE({className:e,...t}){/* @__PURE__ */
390
- return be("div",{"data-slot":"alert-dialog-footer",className:ec("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function yE({className:e,...t}){/* @__PURE__ */
391
- return be(Kt,{"data-slot":"alert-dialog-title",className:ec("text-lg font-semibold",e),...t})}function bE({className:e,...t}){/* @__PURE__ */
392
- return be(Yt,{"data-slot":"alert-dialog-description",className:ec("text-muted-foreground text-sm",e),...t})}function xE({className:e,...t}){/* @__PURE__ */
393
- return be(Gt,{className:ec(ac(),e),...t})}function wE({className:e,...t}){/* @__PURE__ */
394
- return be(Wt,{className:ec(ac({variant:"outline"}),e),...t})}function SE(e,t){const[r,n]=fe(()=>{try{const r=window.localStorage.getItem(e);if(!r)return t;const n=JSON.parse(r);return Array.isArray(n)&&0===n.length&&Array.isArray(t)&&t.length>0?t:n}catch(r){return t}});return[r,t=>{try{const a=t instanceof Function?t(r):t;n(a),window.localStorage.setItem(e,JSON.stringify(a))}catch(a){}}]}uE.displayName=xt.Item.displayName,X.forwardRef(({className:e,...t},r)=>/* @__PURE__ */be(xt.Separator,{ref:r,className:ec("-mx-1 my-1 h-px bg-muted",e),...t})).displayName=xt.Separator.displayName;var kE={owner:/* @__PURE__ */be(Ie,{className:"h-3 w-3"}),admin:/* @__PURE__ */be(at,{className:"h-3 w-3"}),member:/* @__PURE__ */be(lt,{className:"h-3 w-3"}),viewer:/* @__PURE__ */be(Pe,{className:"h-3 w-3"})},CE={owner:"bg-yellow-500/10 text-yellow-700 dark:text-yellow-400",admin:"bg-purple-500/10 text-purple-700 dark:text-purple-400",member:"bg-blue-500/10 text-blue-700 dark:text-blue-400",viewer:"bg-gray-500/10 text-gray-700 dark:text-gray-400"},NE=({open:e,onOpenChange:t})=>{const[r,n]=SE("REASON-organizations",[{id:"1",name:"My Organization",slug:"my-org",description:"Your personal workspace",teams:[{id:"1",name:"General",description:"Default team for collaboration",members:[{id:"1",name:"You",email:"you@example.com",role:"owner",joinedAt:/* @__PURE__ */new Date}],createdAt:/* @__PURE__ */new Date,updatedAt:/* @__PURE__ */new Date}],createdAt:/* @__PURE__ */new Date,updatedAt:/* @__PURE__ */new Date}]),[a,o]=fe(r[0]?.id||null),[i,s]=fe(null),[l,c]=fe(!1),[d,u]=fe(null),[h,p]=fe(""),[m,f]=fe("member"),g=r.find(e=>e.id===a),v=g?.teams.find(e=>e.id===i);/* @__PURE__ */
384
+ /* @__PURE__ */be(aE,{})]})}));oE.displayName=xt.Content.displayName,X.forwardRef(({className:e,...t},r)=>/* @__PURE__ */be(xt.Label,{ref:r,className:ec("px-2 py-1.5 text-sm font-semibold",e),...t})).displayName=xt.Label.displayName;var iE=X.forwardRef(({className:e,children:t,...r},n)=>/* @__PURE__ */xe(xt.Item,{ref:n,className:ec("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),...r,children:[/* @__PURE__ */be("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:/* @__PURE__ */be(xt.ItemIndicator,{children:/* @__PURE__ */be(Se,{className:"h-4 w-4"})})}),/* @__PURE__ */be(xt.ItemText,{children:t})]}));function sE({...e}){/* @__PURE__ */
385
+ return be(Ht,{"data-slot":"alert-dialog",...e})}function lE({...e}){/* @__PURE__ */
386
+ return be(jt,{"data-slot":"alert-dialog-portal",...e})}function cE({className:e,...t}){/* @__PURE__ */
387
+ return be(qt,{"data-slot":"alert-dialog-overlay",className:ec("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50 backdrop-blur-xs",e),...t})}function dE({className:e,...t}){/* @__PURE__ */
388
+ return xe(lE,{children:[/* @__PURE__ */be(cE,{}),/* @__PURE__ */be(Ut,{"data-slot":"alert-dialog-content",className:ec("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-2xl border p-6 shadow-lg duration-200 sm:max-w-lg",e),...t})]})}function uE({className:e,...t}){/* @__PURE__ */
389
+ return be("div",{"data-slot":"alert-dialog-header",className:ec("flex flex-col gap-2 text-center sm:text-left",e),...t})}function hE({className:e,...t}){/* @__PURE__ */
390
+ return be("div",{"data-slot":"alert-dialog-footer",className:ec("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function pE({className:e,...t}){/* @__PURE__ */
391
+ return be(Kt,{"data-slot":"alert-dialog-title",className:ec("text-lg font-semibold",e),...t})}function mE({className:e,...t}){/* @__PURE__ */
392
+ return be(Yt,{"data-slot":"alert-dialog-description",className:ec("text-muted-foreground text-sm",e),...t})}function fE({className:e,...t}){/* @__PURE__ */
393
+ return be(Gt,{className:ec(ac(),e),...t})}function gE({className:e,...t}){/* @__PURE__ */
394
+ return be(Wt,{className:ec(ac({variant:"outline"}),e),...t})}function vE(e,t){const[r,n]=fe(()=>{try{const r=window.localStorage.getItem(e);if(!r)return t;const n=JSON.parse(r);return Array.isArray(n)&&0===n.length&&Array.isArray(t)&&t.length>0?t:n}catch(r){return t}});return[r,t=>{try{const a=t instanceof Function?t(r):t;n(a),window.localStorage.setItem(e,JSON.stringify(a))}catch(a){}}]}iE.displayName=xt.Item.displayName,X.forwardRef(({className:e,...t},r)=>/* @__PURE__ */be(xt.Separator,{ref:r,className:ec("-mx-1 my-1 h-px bg-muted",e),...t})).displayName=xt.Separator.displayName;var yE={owner:/* @__PURE__ */be(Ie,{className:"h-3 w-3"}),admin:/* @__PURE__ */be(at,{className:"h-3 w-3"}),member:/* @__PURE__ */be(lt,{className:"h-3 w-3"}),viewer:/* @__PURE__ */be(Pe,{className:"h-3 w-3"})},bE={owner:"bg-yellow-500/10 text-yellow-700 dark:text-yellow-400",admin:"bg-purple-500/10 text-purple-700 dark:text-purple-400",member:"bg-blue-500/10 text-blue-700 dark:text-blue-400",viewer:"bg-gray-500/10 text-gray-700 dark:text-gray-400"},xE=({open:e,onOpenChange:t})=>{const[r,n]=vE("REASON-organizations",[{id:"1",name:"My Organization",slug:"my-org",description:"Your personal workspace",teams:[{id:"1",name:"General",description:"Default team for collaboration",members:[{id:"1",name:"You",email:"you@example.com",role:"owner",joinedAt:/* @__PURE__ */new Date}],createdAt:/* @__PURE__ */new Date,updatedAt:/* @__PURE__ */new Date}],createdAt:/* @__PURE__ */new Date,updatedAt:/* @__PURE__ */new Date}]),[a,o]=fe(r[0]?.id||null),[i,s]=fe(null),[l,c]=fe(!1),[d,u]=fe(null),[h,p]=fe(""),[m,f]=fe("member"),g=r.find(e=>e.id===a),v=g?.teams.find(e=>e.id===i);/* @__PURE__ */
395
395
  return xe(ye,{children:[
396
- /* @__PURE__ */be(IM,{open:e,onOpenChange:t,children:/* @__PURE__ */xe(_M,{className:"max-w-4xl max-h-[85vh]",children:[/* @__PURE__ */xe(PM,{children:[/* @__PURE__ */xe("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */be(we,{className:"h-5 w-5"}),/* @__PURE__ */be(LM,{children:"Teams & Organizations"})]}),/* @__PURE__ */be(FM,{children:"Manage your teams and collaborate with others"})]}),/* @__PURE__ */xe(tE,{defaultValue:"teams",className:"flex-1",children:[
397
- /* @__PURE__ */xe(rE,{className:"grid w-full grid-cols-2",children:[/* @__PURE__ */be(nE,{value:"teams",children:"Teams"}),/* @__PURE__ */be(nE,{value:"organizations",children:"Organizations"})]}),
398
- /* @__PURE__ */xe(aE,{value:"teams",className:"space-y-4 mt-4",children:[
399
- /* @__PURE__ */xe("div",{className:"flex items-center justify-between",children:[/* @__PURE__ */xe("div",{className:"space-y-1",children:[/* @__PURE__ */be("h3",{className:"font-semibold",children:"Your Teams"}),/* @__PURE__ */be("p",{className:"text-sm text-muted-foreground",children:"Collaborate with team members"})]}),/* @__PURE__ */xe(oc,{onClick:()=>{if(!a)return;const e={id:Date.now().toString(),name:"New Team",members:[],createdAt:/* @__PURE__ */new Date,updatedAt:/* @__PURE__ */new Date};n(t=>t.map(t=>t.id===a?{...t,teams:[...t.teams,e],updatedAt:/* @__PURE__ */new Date}:t)),s(e.id),BD.success("Team created")},size:"sm",children:[/* @__PURE__ */be(Qe,{className:"h-4 w-4 mr-2"}),"New Team"]})]}),
400
- /* @__PURE__ */be(eD,{}),
401
- /* @__PURE__ */be(VM,{className:"h-[50vh]",children:g&&g.teams.length>0?/* @__PURE__ */be("div",{className:"space-y-4",children:g.teams.map(e=>/* @__PURE__ */xe("div",{className:"border rounded-lg p-4 space-y-4",children:[/* @__PURE__ */xe("div",{className:"flex items-start justify-between",children:[/* @__PURE__ */xe("div",{className:"space-y-1",children:[
396
+ /* @__PURE__ */be(TM,{open:e,onOpenChange:t,children:/* @__PURE__ */xe(DM,{className:"max-w-4xl max-h-[85vh]",children:[/* @__PURE__ */xe(EM,{children:[/* @__PURE__ */xe("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */be(we,{className:"h-5 w-5"}),/* @__PURE__ */be(RM,{children:"Teams & Organizations"})]}),/* @__PURE__ */be(zM,{children:"Manage your teams and collaborate with others"})]}),/* @__PURE__ */xe(XD,{defaultValue:"teams",className:"flex-1",children:[
397
+ /* @__PURE__ */xe(ZD,{className:"grid w-full grid-cols-2",children:[/* @__PURE__ */be(JD,{value:"teams",children:"Teams"}),/* @__PURE__ */be(JD,{value:"organizations",children:"Organizations"})]}),
398
+ /* @__PURE__ */xe(QD,{value:"teams",className:"space-y-4 mt-4",children:[
399
+ /* @__PURE__ */xe("div",{className:"flex items-center justify-between",children:[/* @__PURE__ */xe("div",{className:"space-y-1",children:[/* @__PURE__ */be("h3",{className:"font-semibold",children:"Your Teams"}),/* @__PURE__ */be("p",{className:"text-sm text-muted-foreground",children:"Collaborate with team members"})]}),/* @__PURE__ */xe(oc,{onClick:()=>{if(!a)return;const e={id:Date.now().toString(),name:"New Team",members:[],createdAt:/* @__PURE__ */new Date,updatedAt:/* @__PURE__ */new Date};n(t=>t.map(t=>t.id===a?{...t,teams:[...t.teams,e],updatedAt:/* @__PURE__ */new Date}:t)),s(e.id),_D.success("Team created")},size:"sm",children:[/* @__PURE__ */be(Qe,{className:"h-4 w-4 mr-2"}),"New Team"]})]}),
400
+ /* @__PURE__ */be(YM,{}),
401
+ /* @__PURE__ */be(PM,{className:"h-[50vh]",children:g&&g.teams.length>0?/* @__PURE__ */be("div",{className:"space-y-4",children:g.teams.map(e=>/* @__PURE__ */xe("div",{className:"border rounded-lg p-4 space-y-4",children:[/* @__PURE__ */xe("div",{className:"flex items-start justify-between",children:[/* @__PURE__ */xe("div",{className:"space-y-1",children:[
402
402
  /* @__PURE__ */xe("h4",{className:"font-semibold flex items-center gap-2",children:[/* @__PURE__ */be(lt,{className:"h-4 w-4"}),e.name]}),e.description&&/* @__PURE__ */be("p",{className:"text-sm text-muted-foreground",children:e.description}),
403
- /* @__PURE__ */xe("p",{className:"text-xs text-muted-foreground",children:[e.members.length," member",1!==e.members.length?"s":""]})]}),/* @__PURE__ */xe(oc,{variant:"outline",size:"sm",onClick:()=>{s(e.id),c(!0)},children:[/* @__PURE__ */be(st,{className:"h-4 w-4 mr-2"}),"Invite"]})]}),/* @__PURE__ */be("div",{className:"space-y-2",children:e.members.map(e=>/* @__PURE__ */xe("div",{className:"flex items-center justify-between p-2 rounded-lg hover:bg-muted/50",children:[/* @__PURE__ */xe("div",{className:"flex items-center gap-3",children:[/* @__PURE__ */xe(tc,{className:"h-8 w-8",children:[/* @__PURE__ */be(rc,{src:e.avatarUrl}),/* @__PURE__ */be(nc,{children:e.name.substring(0,2).toUpperCase()})]}),/* @__PURE__ */xe("div",{children:[/* @__PURE__ */be("p",{className:"text-sm font-medium",children:e.name}),/* @__PURE__ */be("p",{className:"text-xs text-muted-foreground",children:e.email})]})]}),/* @__PURE__ */xe("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */xe(lc,{variant:"secondary",className:CE[e.role],children:[/* @__PURE__ */be("span",{className:"mr-1",children:kE[e.role]}),e.role]}),"owner"!==e.role&&/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */xe(oE,{value:e.role,onValueChange:t=>{return r=e.id,o=t,void(a&&i&&(n(e=>e.map(e=>e.id===a?{...e,teams:e.teams.map(e=>e.id===i?{...e,members:e.members.map(e=>e.id===r?{...e,role:o}:e),updatedAt:/* @__PURE__ */new Date}:e)}:e)),BD.success("Role updated")));var r,o},children:[/* @__PURE__ */be(sE,{className:"h-8 w-28",children:/* @__PURE__ */be(iE,{})}),/* @__PURE__ */xe(dE,{children:[
404
- /* @__PURE__ */be(uE,{value:"admin",children:"Admin"}),
405
- /* @__PURE__ */be(uE,{value:"member",children:"Member"}),
406
- /* @__PURE__ */be(uE,{value:"viewer",children:"Viewer"})]})]}),/* @__PURE__ */be(oc,{variant:"ghost",size:"sm",onClick:()=>u(e),children:/* @__PURE__ */be(it,{className:"h-4 w-4 text-destructive"})})]})]})]},e.id))})]},e.id))}):/* @__PURE__ */xe("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[/* @__PURE__ */be(lt,{className:"h-12 w-12 text-muted-foreground mb-4 opacity-50"}),/* @__PURE__ */be("p",{className:"text-sm text-muted-foreground",children:"No teams yet. Create your first team to get started."})]})})]}),
407
- /* @__PURE__ */xe(aE,{value:"organizations",className:"space-y-4 mt-4",children:[
403
+ /* @__PURE__ */xe("p",{className:"text-xs text-muted-foreground",children:[e.members.length," member",1!==e.members.length?"s":""]})]}),/* @__PURE__ */xe(oc,{variant:"outline",size:"sm",onClick:()=>{s(e.id),c(!0)},children:[/* @__PURE__ */be(st,{className:"h-4 w-4 mr-2"}),"Invite"]})]}),/* @__PURE__ */be("div",{className:"space-y-2",children:e.members.map(e=>/* @__PURE__ */xe("div",{className:"flex items-center justify-between p-2 rounded-lg hover:bg-muted/50",children:[/* @__PURE__ */xe("div",{className:"flex items-center gap-3",children:[/* @__PURE__ */xe(tc,{className:"h-8 w-8",children:[/* @__PURE__ */be(rc,{src:e.avatarUrl}),/* @__PURE__ */be(nc,{children:e.name.substring(0,2).toUpperCase()})]}),/* @__PURE__ */xe("div",{children:[/* @__PURE__ */be("p",{className:"text-sm font-medium",children:e.name}),/* @__PURE__ */be("p",{className:"text-xs text-muted-foreground",children:e.email})]})]}),/* @__PURE__ */xe("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */xe(lc,{variant:"secondary",className:bE[e.role],children:[/* @__PURE__ */be("span",{className:"mr-1",children:yE[e.role]}),e.role]}),"owner"!==e.role&&/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */xe(eE,{value:e.role,onValueChange:t=>{return r=e.id,o=t,void(a&&i&&(n(e=>e.map(e=>e.id===a?{...e,teams:e.teams.map(e=>e.id===i?{...e,members:e.members.map(e=>e.id===r?{...e,role:o}:e),updatedAt:/* @__PURE__ */new Date}:e)}:e)),_D.success("Role updated")));var r,o},children:[/* @__PURE__ */be(rE,{className:"h-8 w-28",children:/* @__PURE__ */be(tE,{})}),/* @__PURE__ */xe(oE,{children:[
404
+ /* @__PURE__ */be(iE,{value:"admin",children:"Admin"}),
405
+ /* @__PURE__ */be(iE,{value:"member",children:"Member"}),
406
+ /* @__PURE__ */be(iE,{value:"viewer",children:"Viewer"})]})]}),/* @__PURE__ */be(oc,{variant:"ghost",size:"sm",onClick:()=>u(e),children:/* @__PURE__ */be(it,{className:"h-4 w-4 text-destructive"})})]})]})]},e.id))})]},e.id))}):/* @__PURE__ */xe("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[/* @__PURE__ */be(lt,{className:"h-12 w-12 text-muted-foreground mb-4 opacity-50"}),/* @__PURE__ */be("p",{className:"text-sm text-muted-foreground",children:"No teams yet. Create your first team to get started."})]})})]}),
407
+ /* @__PURE__ */xe(QD,{value:"organizations",className:"space-y-4 mt-4",children:[
408
408
  /* @__PURE__ */xe("div",{className:"space-y-1",children:[/* @__PURE__ */be("h3",{className:"font-semibold",children:"Your Organizations"}),/* @__PURE__ */be("p",{className:"text-sm text-muted-foreground",children:"Manage organization settings and details"})]}),
409
- /* @__PURE__ */be(eD,{}),
410
- /* @__PURE__ */be(VM,{className:"h-[50vh]",children:r.map(e=>/* @__PURE__ */be("div",{className:"border rounded-lg p-4 space-y-4 mb-4",children:/* @__PURE__ */xe("div",{className:"flex items-start gap-4",children:[/* @__PURE__ */xe(tc,{className:"h-16 w-16",children:[/* @__PURE__ */be(rc,{src:e.logoUrl}),/* @__PURE__ */be(nc,{className:"text-lg",children:e.name.substring(0,2).toUpperCase()})]}),/* @__PURE__ */xe("div",{className:"flex-1 space-y-1",children:[
409
+ /* @__PURE__ */be(YM,{}),
410
+ /* @__PURE__ */be(PM,{className:"h-[50vh]",children:r.map(e=>/* @__PURE__ */be("div",{className:"border rounded-lg p-4 space-y-4 mb-4",children:/* @__PURE__ */xe("div",{className:"flex items-start gap-4",children:[/* @__PURE__ */xe(tc,{className:"h-16 w-16",children:[/* @__PURE__ */be(rc,{src:e.logoUrl}),/* @__PURE__ */be(nc,{className:"text-lg",children:e.name.substring(0,2).toUpperCase()})]}),/* @__PURE__ */xe("div",{className:"flex-1 space-y-1",children:[
411
411
  /* @__PURE__ */be("h4",{className:"font-semibold text-lg",children:e.name}),
412
412
  /* @__PURE__ */be("p",{className:"text-sm text-muted-foreground",children:e.slug}),e.description&&/* @__PURE__ */be("p",{className:"text-sm",children:e.description}),
413
413
  /* @__PURE__ */xe("div",{className:"flex gap-4 text-xs text-muted-foreground pt-2",children:[/* @__PURE__ */xe("span",{children:[e.teams.length," teams"]}),/* @__PURE__ */xe("span",{children:[e.teams.reduce((e,t)=>e+t.members.length,0)," ","members"]})]})]})]})},e.id))})]})]})]})}),
414
- /* @__PURE__ */be(IM,{open:l,onOpenChange:c,children:/* @__PURE__ */xe(_M,{children:[
415
- /* @__PURE__ */xe(PM,{children:[/* @__PURE__ */be(LM,{children:"Invite Team Member"}),/* @__PURE__ */xe(FM,{children:["Send an invitation to join ",v?.name]})]}),
416
- /* @__PURE__ */xe("div",{className:"space-y-4 py-4",children:[/* @__PURE__ */xe("div",{className:"space-y-2",children:[/* @__PURE__ */be(xD,{htmlFor:"email",children:"Email Address"}),/* @__PURE__ */xe("div",{className:"relative",children:[/* @__PURE__ */be(Ue,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),/* @__PURE__ */be(BM,{id:"email",type:"email",placeholder:"colleague@example.com",value:h,onChange:e=>p(e.target.value),className:"pl-9"})]})]}),/* @__PURE__ */xe("div",{className:"space-y-2",children:[/* @__PURE__ */be(xD,{htmlFor:"role",children:"Role"}),/* @__PURE__ */xe(oE,{value:m,onValueChange:e=>f(e),children:[/* @__PURE__ */be(sE,{children:/* @__PURE__ */be(iE,{})}),/* @__PURE__ */xe(dE,{children:[
417
- /* @__PURE__ */be(uE,{value:"admin",children:"Admin"}),
418
- /* @__PURE__ */be(uE,{value:"member",children:"Member"}),
419
- /* @__PURE__ */be(uE,{value:"viewer",children:"Viewer"})]})]})]})]}),
420
- /* @__PURE__ */xe("div",{className:"flex justify-end gap-2",children:[/* @__PURE__ */be(oc,{variant:"outline",onClick:()=>c(!1),children:"Cancel"}),/* @__PURE__ */be(oc,{onClick:()=>{if(!h.trim()||!a||!i)return;const e={id:Date.now().toString(),name:h.split("@")[0],email:h,role:m,joinedAt:/* @__PURE__ */new Date};n(t=>t.map(t=>t.id===a?{...t,teams:t.teams.map(t=>t.id===i?{...t,members:[...t.members,e],updatedAt:/* @__PURE__ */new Date}:t)}:t)),p(""),f("member"),c(!1),BD.success("Member invited")},children:"Send Invitation"})]})]})}),
421
- /* @__PURE__ */be(hE,{open:!!d,onOpenChange:()=>u(null),children:/* @__PURE__ */xe(fE,{children:[/* @__PURE__ */xe(gE,{children:[/* @__PURE__ */be(yE,{children:"Remove Team Member"}),/* @__PURE__ */xe(bE,{children:["Are you sure you want to remove ",d?.name," from the team? They will lose access to all team resources."]})]}),/* @__PURE__ */xe(vE,{children:[/* @__PURE__ */be(wE,{children:"Cancel"}),/* @__PURE__ */be(xE,{onClick:()=>{return d&&(e=d.id,void(a&&i&&(n(t=>t.map(t=>t.id===a?{...t,teams:t.teams.map(t=>t.id===i?{...t,members:t.members.filter(t=>t.id!==e),updatedAt:/* @__PURE__ */new Date}:t)}:t)),u(null),BD.success("Member removed"))));var e},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]})})]})};function TE({className:e,...t}){/* @__PURE__ */
422
- return be(kt.Root,{"data-slot":"switch",className:ec("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:/* @__PURE__ */be(kt.Thumb,{"data-slot":"switch-thumb",className:ec("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}var AE=({open:e,onOpenChange:t,documentTitle:r,documentId:n,sharingInfo:a,teams:o=[],onUpdateSharing:i})=>{const[s,l]=fe(""),[c,d]=fe("editor"),[u,h]=fe(a?.isPublic||!1),[p,m]=fe(a?.sharedWith||[]),[f,g]=fe(a?.shareLink||null),[v,y]=fe(!1),b=()=>{if(!s.trim())return;if(p.find(e=>e.email===s))return void BD.error("Already shared with this user");const e={email:s,role:c,sharedAt:/* @__PURE__ */(new Date).toISOString()},t=[...p,e];m(t),i&&i({...a,isPublic:u,sharedWith:t}),l(""),BD.success(`Invited ${s}`)},x=async()=>{if(!v){y(!0);try{const e=await Nt("doc/share",{method:"POST",headers:{"Content-Type":"application/json"},body:{documentId:n}});return e.success?(g(e.data.shareUrl),i&&i({...a,isPublic:u,sharedWith:p,shareLink:e.data.shareUrl}),e.data.shareUrl):(BD.error(e.error||"Failed to generate share link"),null)}catch(e){return BD.error(e.message||"Failed to generate share link"),null}finally{y(!1)}}};/* @__PURE__ */
423
- return be(IM,{open:e,onOpenChange:t,children:/* @__PURE__ */xe(_M,{className:"max-w-2xl max-h-[85vh]",children:[/* @__PURE__ */xe(PM,{children:[/* @__PURE__ */xe("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */be(st,{className:"h-5 w-5"}),/* @__PURE__ */xe(LM,{children:['Share "',r,'"']})]}),/* @__PURE__ */be(FM,{children:"Invite people or share with teams"})]}),/* @__PURE__ */xe("div",{className:"space-y-6",children:[
424
- /* @__PURE__ */xe("div",{className:"flex items-center justify-between p-4 rounded-lg border bg-muted/30",children:[/* @__PURE__ */xe("div",{className:"flex items-center gap-3",children:[u?/* @__PURE__ */be(Le,{className:"h-5 w-5 text-primary"}):/* @__PURE__ */be(je,{className:"h-5 w-5 text-muted-foreground"}),/* @__PURE__ */xe("div",{children:[/* @__PURE__ */be("p",{className:"font-medium text-sm",children:u?"Public Access":"Private"}),/* @__PURE__ */be("p",{className:"text-xs text-muted-foreground",children:u?"Anyone with the link can view":"Only invited people can access"})]})]}),/* @__PURE__ */xe("div",{className:"flex items-center gap-2",children:[u&&/* @__PURE__ */be(oc,{variant:"ghost",size:"sm",onClick:async()=>{let e=f;(e||(e=await x(),e))&&(navigator.clipboard.writeText(e),BD.success("Link copied to clipboard"))},className:"h-8",children:/* @__PURE__ */be(He,{className:"h-4 w-4"})}),/* @__PURE__ */be(TE,{checked:u,onCheckedChange:async e=>{h(e),e&&!f&&await x(),i&&i({...a,isPublic:e,sharedWith:p,shareLink:f??void 0}),BD.success(e?"Document is now public":"Document is now private")}})]})]}),
425
- /* @__PURE__ */xe("div",{className:"space-y-3",children:[/* @__PURE__ */be(xD,{children:"Invite by email"}),/* @__PURE__ */xe("div",{className:"flex gap-2",children:[
426
- /* @__PURE__ */xe("div",{className:"relative flex-1",children:[/* @__PURE__ */be(Ue,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),/* @__PURE__ */be(BM,{type:"email",placeholder:"colleague@example.com",value:s,onChange:e=>l(e.target.value),onKeyPress:e=>"Enter"===e.key&&b(),className:"pl-9"})]}),
427
- /* @__PURE__ */xe(oE,{value:c,onValueChange:e=>d(e),children:[/* @__PURE__ */be(sE,{className:"w-36",children:/* @__PURE__ */be(iE,{})}),/* @__PURE__ */xe(dE,{children:[
428
- /* @__PURE__ */be(uE,{value:"editor",children:/* @__PURE__ */xe("span",{className:"flex items-center gap-2",children:[/* @__PURE__ */be(_e,{className:"h-3 w-3"}),"Editor"]})}),
429
- /* @__PURE__ */be(uE,{value:"commentor",children:/* @__PURE__ */xe("span",{className:"flex items-center gap-2",children:[/* @__PURE__ */be(We,{className:"h-3 w-3"}),"Commentor"]})}),
430
- /* @__PURE__ */be(uE,{value:"viewer",children:/* @__PURE__ */xe("span",{className:"flex items-center gap-2",children:[/* @__PURE__ */be(Pe,{className:"h-3 w-3"}),"Viewer"]})})]})]}),
414
+ /* @__PURE__ */be(TM,{open:l,onOpenChange:c,children:/* @__PURE__ */xe(DM,{children:[
415
+ /* @__PURE__ */xe(EM,{children:[/* @__PURE__ */be(RM,{children:"Invite Team Member"}),/* @__PURE__ */xe(zM,{children:["Send an invitation to join ",v?.name]})]}),
416
+ /* @__PURE__ */xe("div",{className:"space-y-4 py-4",children:[/* @__PURE__ */xe("div",{className:"space-y-2",children:[/* @__PURE__ */be(fD,{htmlFor:"email",children:"Email Address"}),/* @__PURE__ */xe("div",{className:"relative",children:[/* @__PURE__ */be(Ue,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),/* @__PURE__ */be(_M,{id:"email",type:"email",placeholder:"colleague@example.com",value:h,onChange:e=>p(e.target.value),className:"pl-9"})]})]}),/* @__PURE__ */xe("div",{className:"space-y-2",children:[/* @__PURE__ */be(fD,{htmlFor:"role",children:"Role"}),/* @__PURE__ */xe(eE,{value:m,onValueChange:e=>f(e),children:[/* @__PURE__ */be(rE,{children:/* @__PURE__ */be(tE,{})}),/* @__PURE__ */xe(oE,{children:[
417
+ /* @__PURE__ */be(iE,{value:"admin",children:"Admin"}),
418
+ /* @__PURE__ */be(iE,{value:"member",children:"Member"}),
419
+ /* @__PURE__ */be(iE,{value:"viewer",children:"Viewer"})]})]})]})]}),
420
+ /* @__PURE__ */xe("div",{className:"flex justify-end gap-2",children:[/* @__PURE__ */be(oc,{variant:"outline",onClick:()=>c(!1),children:"Cancel"}),/* @__PURE__ */be(oc,{onClick:()=>{if(!h.trim()||!a||!i)return;const e={id:Date.now().toString(),name:h.split("@")[0],email:h,role:m,joinedAt:/* @__PURE__ */new Date};n(t=>t.map(t=>t.id===a?{...t,teams:t.teams.map(t=>t.id===i?{...t,members:[...t.members,e],updatedAt:/* @__PURE__ */new Date}:t)}:t)),p(""),f("member"),c(!1),_D.success("Member invited")},children:"Send Invitation"})]})]})}),
421
+ /* @__PURE__ */be(sE,{open:!!d,onOpenChange:()=>u(null),children:/* @__PURE__ */xe(dE,{children:[/* @__PURE__ */xe(uE,{children:[/* @__PURE__ */be(pE,{children:"Remove Team Member"}),/* @__PURE__ */xe(mE,{children:["Are you sure you want to remove ",d?.name," from the team? They will lose access to all team resources."]})]}),/* @__PURE__ */xe(hE,{children:[/* @__PURE__ */be(gE,{children:"Cancel"}),/* @__PURE__ */be(fE,{onClick:()=>{return d&&(e=d.id,void(a&&i&&(n(t=>t.map(t=>t.id===a?{...t,teams:t.teams.map(t=>t.id===i?{...t,members:t.members.filter(t=>t.id!==e),updatedAt:/* @__PURE__ */new Date}:t)}:t)),u(null),_D.success("Member removed"))));var e},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]})})]})};function wE({className:e,...t}){/* @__PURE__ */
422
+ return be(kt.Root,{"data-slot":"switch",className:ec("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:/* @__PURE__ */be(kt.Thumb,{"data-slot":"switch-thumb",className:ec("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}var SE=({open:e,onOpenChange:t,documentTitle:r,documentId:n,sharingInfo:a,teams:o=[],onUpdateSharing:i})=>{const[s,l]=fe(""),[c,d]=fe("editor"),[u,h]=fe(a?.isPublic||!1),[p,m]=fe(a?.sharedWith||[]),[f,g]=fe(a?.shareLink||null),[v,y]=fe(!1),b=()=>{if(!s.trim())return;if(p.find(e=>e.email===s))return void _D.error("Already shared with this user");const e={email:s,role:c,sharedAt:/* @__PURE__ */(new Date).toISOString()},t=[...p,e];m(t),i&&i({...a,isPublic:u,sharedWith:t}),l(""),_D.success(`Invited ${s}`)},x=async()=>{if(!v){y(!0);try{const e=await Nt("doc/share",{method:"POST",headers:{"Content-Type":"application/json"},body:{documentId:n}});return e.success?(g(e.data.shareUrl),i&&i({...a,isPublic:u,sharedWith:p,shareLink:e.data.shareUrl}),e.data.shareUrl):(_D.error(e.error||"Failed to generate share link"),null)}catch(e){return _D.error(e.message||"Failed to generate share link"),null}finally{y(!1)}}};/* @__PURE__ */
423
+ return be(TM,{open:e,onOpenChange:t,children:/* @__PURE__ */xe(DM,{className:"max-w-2xl max-h-[85vh]",children:[/* @__PURE__ */xe(EM,{children:[/* @__PURE__ */xe("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */be(st,{className:"h-5 w-5"}),/* @__PURE__ */xe(RM,{children:['Share "',r,'"']})]}),/* @__PURE__ */be(zM,{children:"Invite people or share with teams"})]}),/* @__PURE__ */xe("div",{className:"space-y-6",children:[
424
+ /* @__PURE__ */xe("div",{className:"flex items-center justify-between p-4 rounded-lg border bg-muted/30",children:[/* @__PURE__ */xe("div",{className:"flex items-center gap-3",children:[u?/* @__PURE__ */be(Le,{className:"h-5 w-5 text-primary"}):/* @__PURE__ */be(je,{className:"h-5 w-5 text-muted-foreground"}),/* @__PURE__ */xe("div",{children:[/* @__PURE__ */be("p",{className:"font-medium text-sm",children:u?"Public Access":"Private"}),/* @__PURE__ */be("p",{className:"text-xs text-muted-foreground",children:u?"Anyone with the link can view":"Only invited people can access"})]})]}),/* @__PURE__ */xe("div",{className:"flex items-center gap-2",children:[u&&/* @__PURE__ */be(oc,{variant:"ghost",size:"sm",onClick:async()=>{let e=f;(e||(e=await x(),e))&&(navigator.clipboard.writeText(e),_D.success("Link copied to clipboard"))},className:"h-8",children:/* @__PURE__ */be(He,{className:"h-4 w-4"})}),/* @__PURE__ */be(wE,{checked:u,onCheckedChange:async e=>{h(e),e&&!f&&await x(),i&&i({...a,isPublic:e,sharedWith:p,shareLink:f??void 0}),_D.success(e?"Document is now public":"Document is now private")}})]})]}),
425
+ /* @__PURE__ */xe("div",{className:"space-y-3",children:[/* @__PURE__ */be(fD,{children:"Invite by email"}),/* @__PURE__ */xe("div",{className:"flex gap-2",children:[
426
+ /* @__PURE__ */xe("div",{className:"relative flex-1",children:[/* @__PURE__ */be(Ue,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),/* @__PURE__ */be(_M,{type:"email",placeholder:"colleague@example.com",value:s,onChange:e=>l(e.target.value),onKeyPress:e=>"Enter"===e.key&&b(),className:"pl-9"})]}),
427
+ /* @__PURE__ */xe(eE,{value:c,onValueChange:e=>d(e),children:[/* @__PURE__ */be(rE,{className:"w-36",children:/* @__PURE__ */be(tE,{})}),/* @__PURE__ */xe(oE,{children:[
428
+ /* @__PURE__ */be(iE,{value:"editor",children:/* @__PURE__ */xe("span",{className:"flex items-center gap-2",children:[/* @__PURE__ */be(_e,{className:"h-3 w-3"}),"Editor"]})}),
429
+ /* @__PURE__ */be(iE,{value:"commentor",children:/* @__PURE__ */xe("span",{className:"flex items-center gap-2",children:[/* @__PURE__ */be(We,{className:"h-3 w-3"}),"Commentor"]})}),
430
+ /* @__PURE__ */be(iE,{value:"viewer",children:/* @__PURE__ */xe("span",{className:"flex items-center gap-2",children:[/* @__PURE__ */be(Pe,{className:"h-3 w-3"}),"Viewer"]})})]})]}),
431
431
  /* @__PURE__ */be(oc,{onClick:b,children:"Invite"})]})]}),
432
- /* @__PURE__ */be(eD,{}),o.length>0&&/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */xe("div",{className:"space-y-3",children:[/* @__PURE__ */xe("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */be(lt,{className:"h-4 w-4 text-muted-foreground"}),/* @__PURE__ */be("h4",{className:"text-sm font-semibold",children:"Teams with access"})]}),/* @__PURE__ */be("div",{className:"space-y-2",children:o.map(e=>/* @__PURE__ */xe("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-card hover:bg-muted/50 transition-colors",children:[/* @__PURE__ */xe("div",{className:"flex items-center gap-3",children:[/* @__PURE__ */be(tc,{className:"h-8 w-8",children:/* @__PURE__ */be(nc,{className:"bg-primary/10 text-primary",children:/* @__PURE__ */be(lt,{className:"h-4 w-4"})})}),/* @__PURE__ */xe("div",{children:[/* @__PURE__ */be("p",{className:"text-sm font-medium",children:e.name}),/* @__PURE__ */xe("p",{className:"text-xs text-muted-foreground",children:[e.members.length," member",1!==e.members.length?"s":""]})]})]}),/* @__PURE__ */xe(lc,{variant:"secondary",className:"bg-blue-500/10 text-blue-700 dark:text-blue-400",children:[/* @__PURE__ */be(_e,{className:"h-3 w-3 mr-1"}),"Team"]})]},e.id))})]}),/* @__PURE__ */be(eD,{})]}),
433
- /* @__PURE__ */xe("div",{className:"space-y-3",children:[/* @__PURE__ */be("h4",{className:"text-sm font-semibold",children:"People with access"}),/* @__PURE__ */be(VM,{className:"max-h-[300px]",children:p.length>0?/* @__PURE__ */be("div",{className:"space-y-2 pr-4",children:p.map(e=>{/* @__PURE__ */return xe("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-card hover:bg-muted/50 transition-colors",children:[/* @__PURE__ */xe("div",{className:"flex items-center gap-3",children:[/* @__PURE__ */be(tc,{className:"h-8 w-8",children:/* @__PURE__ */be(nc,{className:"bg-gradient-to-br from-primary/20 to-primary/10",children:(t=e.email,t.substring(0,2).toUpperCase())})}),/* @__PURE__ */xe("div",{children:[/* @__PURE__ */be("p",{className:"text-sm font-medium",children:e.email}),/* @__PURE__ */xe("p",{className:"text-xs text-muted-foreground",children:["Added ",new Date(e.sharedAt).toLocaleDateString()]})]})]}),/* @__PURE__ */xe("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */xe(oE,{value:e.role||"viewer",onValueChange:t=>((e,t)=>{const r=p.map(r=>r.email===e?{...r,role:t}:r);m(r),i&&i({...a,isPublic:u,sharedWith:r}),BD.success("Role updated")})(e.email,t),children:[/* @__PURE__ */be(sE,{className:"h-8 w-32",children:/* @__PURE__ */be(iE,{})}),/* @__PURE__ */xe(dE,{children:[
434
- /* @__PURE__ */be(uE,{value:"editor",children:/* @__PURE__ */xe("span",{className:"flex items-center gap-2",children:[/* @__PURE__ */be(_e,{className:"h-3 w-3"}),"Editor"]})}),
435
- /* @__PURE__ */be(uE,{value:"commentor",children:/* @__PURE__ */xe("span",{className:"flex items-center gap-2",children:[/* @__PURE__ */be(We,{className:"h-3 w-3"}),"Commentor"]})}),
436
- /* @__PURE__ */be(uE,{value:"viewer",children:/* @__PURE__ */xe("span",{className:"flex items-center gap-2",children:[/* @__PURE__ */be(Pe,{className:"h-3 w-3"}),"Viewer"]})})]})]}),/* @__PURE__ */be(oc,{variant:"ghost",size:"sm",onClick:()=>(e=>{const t=p.filter(t=>t.email!==e);m(t),i&&i({...a,isPublic:u,sharedWith:t}),BD.success("Access removed")})(e.email),className:"h-8 w-8 p-0",children:/* @__PURE__ */be(ut,{className:"h-4 w-4 text-muted-foreground hover:text-destructive"})})]})]},e.email);var t})}):/* @__PURE__ */xe("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[
432
+ /* @__PURE__ */be(YM,{}),o.length>0&&/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */xe("div",{className:"space-y-3",children:[/* @__PURE__ */xe("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */be(lt,{className:"h-4 w-4 text-muted-foreground"}),/* @__PURE__ */be("h4",{className:"text-sm font-semibold",children:"Teams with access"})]}),/* @__PURE__ */be("div",{className:"space-y-2",children:o.map(e=>/* @__PURE__ */xe("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-card hover:bg-muted/50 transition-colors",children:[/* @__PURE__ */xe("div",{className:"flex items-center gap-3",children:[/* @__PURE__ */be(tc,{className:"h-8 w-8",children:/* @__PURE__ */be(nc,{className:"bg-primary/10 text-primary",children:/* @__PURE__ */be(lt,{className:"h-4 w-4"})})}),/* @__PURE__ */xe("div",{children:[/* @__PURE__ */be("p",{className:"text-sm font-medium",children:e.name}),/* @__PURE__ */xe("p",{className:"text-xs text-muted-foreground",children:[e.members.length," member",1!==e.members.length?"s":""]})]})]}),/* @__PURE__ */xe(lc,{variant:"secondary",className:"bg-blue-500/10 text-blue-700 dark:text-blue-400",children:[/* @__PURE__ */be(_e,{className:"h-3 w-3 mr-1"}),"Team"]})]},e.id))})]}),/* @__PURE__ */be(YM,{})]}),
433
+ /* @__PURE__ */xe("div",{className:"space-y-3",children:[/* @__PURE__ */be("h4",{className:"text-sm font-semibold",children:"People with access"}),/* @__PURE__ */be(PM,{className:"max-h-[300px]",children:p.length>0?/* @__PURE__ */be("div",{className:"space-y-2 pr-4",children:p.map(e=>{/* @__PURE__ */return xe("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-card hover:bg-muted/50 transition-colors",children:[/* @__PURE__ */xe("div",{className:"flex items-center gap-3",children:[/* @__PURE__ */be(tc,{className:"h-8 w-8",children:/* @__PURE__ */be(nc,{className:"bg-gradient-to-br from-primary/20 to-primary/10",children:(t=e.email,t.substring(0,2).toUpperCase())})}),/* @__PURE__ */xe("div",{children:[/* @__PURE__ */be("p",{className:"text-sm font-medium",children:e.email}),/* @__PURE__ */xe("p",{className:"text-xs text-muted-foreground",children:["Added ",new Date(e.sharedAt).toLocaleDateString()]})]})]}),/* @__PURE__ */xe("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */xe(eE,{value:e.role||"viewer",onValueChange:t=>((e,t)=>{const r=p.map(r=>r.email===e?{...r,role:t}:r);m(r),i&&i({...a,isPublic:u,sharedWith:r}),_D.success("Role updated")})(e.email,t),children:[/* @__PURE__ */be(rE,{className:"h-8 w-32",children:/* @__PURE__ */be(tE,{})}),/* @__PURE__ */xe(oE,{children:[
434
+ /* @__PURE__ */be(iE,{value:"editor",children:/* @__PURE__ */xe("span",{className:"flex items-center gap-2",children:[/* @__PURE__ */be(_e,{className:"h-3 w-3"}),"Editor"]})}),
435
+ /* @__PURE__ */be(iE,{value:"commentor",children:/* @__PURE__ */xe("span",{className:"flex items-center gap-2",children:[/* @__PURE__ */be(We,{className:"h-3 w-3"}),"Commentor"]})}),
436
+ /* @__PURE__ */be(iE,{value:"viewer",children:/* @__PURE__ */xe("span",{className:"flex items-center gap-2",children:[/* @__PURE__ */be(Pe,{className:"h-3 w-3"}),"Viewer"]})})]})]}),/* @__PURE__ */be(oc,{variant:"ghost",size:"sm",onClick:()=>(e=>{const t=p.filter(t=>t.email!==e);m(t),i&&i({...a,isPublic:u,sharedWith:t}),_D.success("Access removed")})(e.email),className:"h-8 w-8 p-0",children:/* @__PURE__ */be(ut,{className:"h-4 w-4 text-muted-foreground hover:text-destructive"})})]})]},e.email);var t})}):/* @__PURE__ */xe("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[
437
437
  /* @__PURE__ */be(st,{className:"h-12 w-12 text-muted-foreground mb-3 opacity-50"}),
438
438
  /* @__PURE__ */be("p",{className:"text-sm text-muted-foreground",children:"No one else has access yet"}),
439
- /* @__PURE__ */be("p",{className:"text-xs text-muted-foreground mt-1",children:"Invite people to collaborate"})]})})]})]})]})})},ME=({open:e,onOpenChange:t,currentTags:r,onUpdateTags:n})=>{const[a,o]=fe(""),[i,s]=fe(r),l=()=>{if(a.trim()&&!i.includes(a.trim())){const e=[...i,a.trim()];s(e),o("")}};/* @__PURE__ */
440
- return be(IM,{open:e,onOpenChange:t,children:/* @__PURE__ */xe(_M,{className:"sm:max-w-md",children:[/* @__PURE__ */be(PM,{children:/* @__PURE__ */be(LM,{children:"Manage Tags"})}),/* @__PURE__ */xe("div",{className:"space-y-4",children:[
441
- /* @__PURE__ */xe("div",{className:"flex gap-2",children:[/* @__PURE__ */be(BM,{value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),l())},placeholder:"Enter tag name...",className:"flex-1"}),/* @__PURE__ */xe(oc,{onClick:l,size:"sm",children:[/* @__PURE__ */be(Qe,{className:"h-4 w-4 mr-1"}),"Add"]})]}),
439
+ /* @__PURE__ */be("p",{className:"text-xs text-muted-foreground mt-1",children:"Invite people to collaborate"})]})})]})]})]})})},kE=({open:e,onOpenChange:t,currentTags:r,onUpdateTags:n})=>{const[a,o]=fe(""),[i,s]=fe(r),l=()=>{if(a.trim()&&!i.includes(a.trim())){const e=[...i,a.trim()];s(e),o("")}};/* @__PURE__ */
440
+ return be(TM,{open:e,onOpenChange:t,children:/* @__PURE__ */xe(DM,{className:"sm:max-w-md",children:[/* @__PURE__ */be(EM,{children:/* @__PURE__ */be(RM,{children:"Manage Tags"})}),/* @__PURE__ */xe("div",{className:"space-y-4",children:[
441
+ /* @__PURE__ */xe("div",{className:"flex gap-2",children:[/* @__PURE__ */be(_M,{value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),l())},placeholder:"Enter tag name...",className:"flex-1"}),/* @__PURE__ */xe(oc,{onClick:l,size:"sm",children:[/* @__PURE__ */be(Qe,{className:"h-4 w-4 mr-1"}),"Add"]})]}),
442
442
  /* @__PURE__ */be("div",{className:"flex flex-wrap gap-2 min-h-[60px] p-3 border border-border rounded-md bg-muted/20",children:0===i.length?/* @__PURE__ */be("p",{className:"text-sm text-muted-foreground",children:"No tags added yet"}):i.map(e=>/* @__PURE__ */xe(lc,{variant:"secondary",className:"gap-1 pl-2 pr-1",children:[e,/* @__PURE__ */be("button",{onClick:()=>(e=>{const t=i.filter(t=>t!==e);s(t)})(e),className:"ml-1 hover:bg-background/80 rounded-sm p-0.5",children:/* @__PURE__ */be(ut,{className:"h-3 w-3"})})]},e))}),
443
- /* @__PURE__ */xe("div",{className:"flex justify-end gap-2",children:[/* @__PURE__ */be(oc,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),/* @__PURE__ */be(oc,{onClick:()=>{n(i),t(!1)},children:"Save Tags"})]})]})]})})};function DE({isSearchModalOpen:e,setIsSearchModalOpen:t,isSettingsOpen:r,setIsSettingsOpen:n,settingsInitialSection:a,isTeamsOpen:o,setIsTeamsOpen:i,isInviteModalOpen:s,setIsInviteModalOpen:l,isTagDialogOpen:c,setIsTagDialogOpen:d,documents:u,activeDocument:h,tagManagementDocId:p,defaultSidebarView:m,setDefaultSidebarView:f,enableDatabaseSync:g,setEnableDatabaseSync:v,setDocuments:y,onSelectDocument:b,onToggleTheme:x,currentTheme:w,onUpdateTags:S}){/* @__PURE__ */
443
+ /* @__PURE__ */xe("div",{className:"flex justify-end gap-2",children:[/* @__PURE__ */be(oc,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),/* @__PURE__ */be(oc,{onClick:()=>{n(i),t(!1)},children:"Save Tags"})]})]})]})})};function CE({isSearchModalOpen:e,setIsSearchModalOpen:t,isSettingsOpen:r,setIsSettingsOpen:n,settingsInitialSection:a,isTeamsOpen:o,setIsTeamsOpen:i,isInviteModalOpen:s,setIsInviteModalOpen:l,isTagDialogOpen:c,setIsTagDialogOpen:d,documents:u,activeDocument:h,tagManagementDocId:p,defaultSidebarView:m,setDefaultSidebarView:f,enableDatabaseSync:g,setEnableDatabaseSync:v,setDocuments:y,onSelectDocument:b,onToggleTheme:x,currentTheme:w,onUpdateTags:S}){/* @__PURE__ */
444
444
  return xe(ye,{children:[
445
- /* @__PURE__ */be(GM,{open:e,onOpenChange:t,documents:u,onSelectDocument:b,onOpenSettings:()=>n(!0),onOpenTeams:()=>i(!0),onToggleTheme:x,currentTheme:w}),
446
- /* @__PURE__ */be(eE,{open:r,onOpenChange:n,initialSection:a,defaultSidebarView:m,onDefaultSidebarViewChange:f,enableDatabaseSync:g,onEnableDatabaseSyncChange:v}),
447
- /* @__PURE__ */be(NE,{open:o,onOpenChange:i}),
448
- /* @__PURE__ */be(AE,{open:s,onOpenChange:l,documentTitle:h?.title||"Untitled",documentId:h?.id||"",sharingInfo:h?.sharing,onUpdateSharing:e=>{h&&y(t=>t.map(t=>t.id===h.id?{...t,sharing:e}:t))}}),
449
- /* @__PURE__ */be(ME,{open:c,onOpenChange:d,currentTags:p&&u.find(e=>e.id===p)?.tags||[],onUpdateTags:S})]})}function EE(e,t){const r=[],n=t=>{for(const a of e)a.parentId===t&&(r.push(a.id),n(a.id))};return n(t),r}function IE(e,t){const r=/* @__PURE__ */new Set([t,...EE(e,t)]);let n=e.findIndex(e=>e.id===t);if(-1===n)return e.length;for(let a=n;a<e.length;a++)r.has(e[a].id)&&(n=a);return n+1}function RE(e){const t=QM(),[r,n]=fe(!1),[a,o]=fe(!1),[i,s]=fe(!1),[l,c]=fe(!1),[d,u]=fe(!1),[h,p]=fe(!1),[m,f]=fe(!1),[g,v]=fe(null),[y,b]=SE("REASON-default-sidebar-view","last-used"),[x,w]=SE("REASON-left-panels",["openTabs","files"]),[S,k]=SE("REASON-right-panels",[]),[C,N]=SE("REASON-show-dynamic-island",!1),[T,A]=SE("REASON-sidebar-width",25),[M,D]=fe(null),[E,I]=fe(!1),R=me(null),[z,_]=fe([]),[P,O]=SE("REASON-documents",Wb),[L,F]=SE("REASON-active-doc",P.length>0?P[0].id:null),[B,V]=SE("REASON-open-tabs",P.length>0?[P[0].id]:[]),[$,H]=fe([]),[j,q]=fe(null),[U,G]=fe(""),[W,K]=fe(null),[Y,X]=fe(Xf()),[Z,J]=SE("REASON-enable-db-sync",!1),{isSyncing:Q,lastSyncTime:ee,saveDocument:te,deleteDocument:re,queueDocumentForSync:ne}=function(e,t,r={}){const{enableSync:n=!1,syncInterval:a=5e3}=r,[o,i]=fe(!1),[s,l]=fe(null),c=me(/* @__PURE__ */new Map),d=me(void 0),u=ie(async()=>{if(n)try{const e=(await Nt("doc/documents")).map(e=>({id:e.id.toString(),title:e.title||e.name||"Untitled",content:e.content||"",parentId:e.parentId?e.parentId.toString():null,children:[],isExpanded:1===e.isExpanded,isFolder:1===e.isFolder,tags:e.metadata&&JSON.parse(e.metadata).tags||[],metadata:e.metadata?JSON.parse(e.metadata):void 0}));return t(e),l(/* @__PURE__ */new Date),e}catch(e){return BD.error("Failed to load documents from database"),null}},[n,t]),h=ie(async e=>{if(n)try{const r={name:e.title||"Untitled",title:e.title||"Untitled",content:e.content||"",parentId:e.parentId?parseInt(e.parentId):null,isFolder:e.isFolder||!1,metadata:{tags:e.tags||[],isExpanded:e.isExpanded||!1,...e.metadata}};if(isNaN(parseInt(e.id))){const n=await Nt("doc/documents",{method:"POST",headers:{"Content-Type":"application/json"},body:r});return t(t=>t.map(t=>t.id===e.id?{...t,id:n.id.toString()}:t)),n}return await Nt(`doc/documents/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:r})}catch(r){return BD.error("Failed to save document to database"),null}},[n,t]),p=ie(async()=>{if(n&&0!==c.current.size){i(!0);try{const e=Array.from(c.current.values());await Promise.all(e.map(e=>h(e))),c.current.clear(),l(/* @__PURE__ */new Date)}catch(e){}finally{i(!1)}}},[n,h]),m=ie(e=>{n&&(c.current.set(e.id,e),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{p()},2e3))},[n,p]),f=ie(async e=>{if(n)try{return await Nt(`doc/documents/${e}`,{method:"DELETE"}),!0}catch(t){return BD.error("Failed to delete document from database"),!1}},[n]);return le(()=>{if(!n||a<=0)return;const e=setInterval(()=>{c.current.size>0&&p()},a);return()=>clearInterval(e)},[n,a,p]),le(()=>()=>{d.current&&clearTimeout(d.current)},[]),{isSyncing:o,lastSyncTime:s,loadFromDatabase:u,saveDocument:h,deleteDocument:f,queueDocumentForSync:m,syncPendingChanges:p}}(0,O,{enableSync:Z,syncInterval:5e3}),ae=e=>{const t=/* @__PURE__ */new Map,r=[];return e.forEach(e=>{t.set(e.id,{...e,children:[]})}),e.forEach(e=>{const n=t.get(e.id);e.parentId&&t.has(e.parentId)?t.get(e.parentId).children.push(n):r.push(n)}),r},oe=pe(()=>ae(P),[P]),se=P.find(e=>e.id===L);le(()=>{document.title=se?.title?`${se.title} - Reason Docs`:"Reason - Powerful Note-Taking App"},[se?.title]),le(()=>{_([])},[L]);const ce=pe(()=>{const e=P.filter(e=>!e.isDeleted);if(!U.trim())return e;const t=U.toLowerCase();return e.filter(e=>e.title.toLowerCase().includes(t)||e.content.toLowerCase().includes(t))},[P,U]),de=pe(()=>U.trim()?ae(ce):oe,[ce,U]),ue=async(e,t=!1)=>{let r=null;if(e){const t=P.find(t=>t.id===e);t&&(r=t.isFolder?e:t.parentId)}const n={id:Date.now().toString(),title:t?"New Folder":"",content:"",parentId:r,children:[],isExpanded:t,isFolder:t,tags:[]};O([...P,n]),Z&&await te(n),t||(F(n.id),V([...B,n.id])),K(n.id),setTimeout(()=>K(null),500),r&&O(e=>e.map(e=>e.id===r?{...e,isExpanded:!0}:e)),BD.success(t?"Folder created":"Note created")},he=async e=>{const t=e=>[e,...P.filter(t=>t.parentId===e).flatMap(e=>t(e.id))],r=t(e),n=P.filter(e=>!r.includes(e.id));if(O(n),Z)for(const o of r)await re(o);const a=B.filter(e=>!r.includes(e));V(a),L&&r.includes(L)&&F(a.length>0?a[0]:n.length>0?n[0].id:null),BD.success("Note deleted")},ge=e=>{O(t=>t.map(t=>t.id===e?{...t,isExpanded:!t.isExpanded}:t))};le(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&"k"===e.key&&(e.preventDefault(),s(!0))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),le(()=>{e&&(w(e=>e.includes("files")?e:["files",...e]),n(!0))},[e]),le(()=>{const e="REASON-open-tabs-default-restored";try{if(window.localStorage.getItem(e))return;window.localStorage.setItem(e,"1")}catch{return}"tree"!==y&&"outline"!==y&&w(e=>e.includes("openTabs")?e:[...e,"openTabs"])},[]),le(()=>{"tree"===y?w(["files"]):"outline"===y?w(["outline"]):"split"===y&&w(["openTabs","files","outline"])},[]);const ve=e=>{const t=function(e,t,r){const n=new Set(r.filter(t=>e.includes(t)));if(0===n.size)return{openTabs:e,activeTabId:t,closed:[]};const a=e.filter(e=>!n.has(e)),o=e.filter(e=>n.has(e));if(!t||!n.has(t))return{openTabs:a,activeTabId:t,closed:o};const i=e.indexOf(t);let s=null;for(let l=i-1;l>=0&&null===s;l--)n.has(e[l])||(s=e[l]);for(let l=i+1;l<e.length&&null===s;l++)n.has(e[l])||(s=e[l]);return{openTabs:a,activeTabId:s,closed:o}}(B,L,e);0!==t.closed.length&&(H([...t.closed,...$].slice(0,10)),V(t.openTabs),t.activeTabId!==L&&F(t.activeTabId))},ye=e=>{ve([e])},be=()=>{if(0===$.length)return;const[e,...t]=$;P.find(t=>t.id===e)?(B.includes(e)||V([...B,e]),F(e),H(t),BD.success("Tab reopened")):(H(t),t.length>0&&be())},xe=()=>{k(e=>e.filter(e=>"ai"!==e)),w(e=>e.length>1?e.filter(e=>"ai"!==e):e)};return le(()=>{L&&!P.find(e=>e.id===L)&&F(P.length>0?P[0].id:null)},[P,L,F]),{isMobile:t,isSidebarOpen:r,setIsSidebarOpen:n,isRightSidebarOpen:a,setIsRightSidebarOpen:o,isSearchModalOpen:i,setIsSearchModalOpen:s,isSettingsOpen:l,setIsSettingsOpen:c,isTeamsOpen:d,setIsTeamsOpen:u,isInviteModalOpen:h,setIsInviteModalOpen:p,isTagDialogOpen:m,setIsTagDialogOpen:f,tagManagementDocId:g,defaultSidebarView:y,setDefaultSidebarView:b,leftPanels:x,setLeftPanels:w,rightPanels:S,setRightPanels:k,showDynamicIsland:C,setShowDynamicIsland:N,sidebarWidth:T,setSidebarWidth:A,aiSuggestion:M,setAiSuggestion:D,isAiLoading:E,setIsAiLoading:I,editorRef:R,headings:z,setHeadings:_,documents:P,setDocuments:O,activeDocId:L,setActiveDocId:F,openTabs:B,setOpenTabs:V,closedTabsHistory:$,splitViewDocId:j,setSplitViewDocId:q,searchQuery:U,setSearchQuery:G,newDocumentId:W,activeFileSourceId:Y,enableDatabaseSync:Z,setEnableDatabaseSync:J,isSyncing:Q,lastSyncTime:ee,documentTree:oe,activeDocument:se,filteredDocuments:ce,filteredTree:de,handleAddDocument:ue,handleDeleteDocument:he,handleDuplicateDocument:e=>{const t=P.find(t=>t.id===e);if(!t)return;const r={...t,id:Date.now().toString(),title:t.title+" (Copy)",children:[]};O([...P,r]),F(r.id),V([...B,r.id]),BD.success("Note duplicated")},handleUpdateDocument:(e,t)=>{O(r=>r.map(r=>{if(r.id===e){const e={...r,...t};return Z&&ne(e),e}return r}))},handleToggleExpand:ge,handleSetExpandedFolders:e=>{const t=new Set(e);O(e=>e.map(e=>{const r=t.has(e.id);return!!e.isExpanded===r?e:{...e,isExpanded:r}}))},handleMoveDocument:(e,t,r)=>{if(e===t)return;if(t&&EE(P,e).includes(t))return void BD.error("Cannot move a note into its own child");const n=function(e,t,r,n){if(!e.find(e=>e.id===t)||t===r)return e;if(r&&!e.some(e=>e.id===r))return e;const a=/* @__PURE__ */new Set([t,...EE(e,t)]);if(r&&a.has(r))return e;const o=r?e.find(e=>e.id===r):void 0,i="child"===n?r:o?.parentId??null,s=e.filter(e=>a.has(e.id)).map(e=>e.id===t?{...e,parentId:i}:e),l=e.filter(e=>!a.has(e.id));let c;return c="before"===n?l.findIndex(e=>e.id===r):"after"===n||r?IE(l,r):l.length,c<0&&(c=l.length),[...l.slice(0,c),...s,...l.slice(c)]}(P,e,t,r);if(n!==P){if(O(n),Z){const t=n.find(t=>t.id===e);t&&ne(t)}BD.success("Note moved")}},handleAddTag:(e,t)=>{O(r=>r.map(r=>r.id===e?{...r,tags:[...r.tags||[],t]}:r))},handleRemoveTag:(e,t)=>{O(r=>r.map(r=>r.id===e?{...r,tags:(r.tags||[]).filter(e=>e!==t)}:r))},handleManageTags:e=>{v(e),f(!0)},handleFileSourceChange:async e=>{X(e),Zf(e);const t=function(){let e=Kf(),t=Xf();return e.find(e=>e.id===t)||Wf}();try{"local"!==t.type?BD.info(`Source switching for ${t.type} not yet implemented in standalone mode`):BD.success("Switched to local storage")}catch(r){BD.error("Failed to load documents from source")}},handleUpdateTags:e=>{g&&(O(t=>t.map(t=>t.id===g?{...t,tags:e}:t)),BD.success("Tags updated"))},handleRestoreDocument:e=>{O(t=>t.map(t=>t.id===e?{...t,isDeleted:!1}:t)),BD.success("Note restored")},handlePermanentDelete:e=>{const t=e=>[e,...P.filter(t=>t.parentId===e).flatMap(e=>t(e.id))],r=t(e),n=P.filter(e=>!r.includes(e.id));O(n);const a=B.filter(e=>!r.includes(e));V(a),L&&r.includes(L)&&F(a.length>0?a[0]:n.length>0?n[0].id:null),BD.success("Note permanently deleted")},handleTabChange:e=>{F(e)},handleTabClose:ye,handleTabsClose:ve,handleTabAdd:()=>{ue(null)},handleTabDelete:e=>{ye(e),he(e)},handleReopenLastClosed:be,handleSplitRight:e=>{q(e),BD.success("Split view enabled")},handleSelectDocument:e=>{P.find(t=>t.id===e)?.isFolder?ge(e):(B.includes(e)||V([...B,e]),F(e))},handleAIRewrite:async(e,t)=>{BD.info("AI rewrite is not yet available for this editor")},handleAIApprove:()=>{D(null),xe()},handleAIReject:()=>{D(null),xe()},handleAIRegenerate:async e=>{BD.info("AI rewrite is not yet available for this editor")}}}var zE=te({});function _E(e){const t=me(null);return null===t.current&&(t.current=e()),t.current}var PE="undefined"!=typeof window?he:le,OE=/* @__PURE__ */te(null);function LE(e,t){-1===e.indexOf(t)&&e.push(t)}function FE(e,t){const r=e.indexOf(t);r>-1&&e.splice(r,1)}var BE=(e,t,r)=>r>t?t:r<e?e:r;var VE=()=>{},$E=()=>{};"undefined"!=typeof process&&"production"!==process.env.NODE_ENV&&(VE=(e,t,r)=>{},$E=(e,t,r)=>{if(!e)throw new Error(function(e,t){return t?`${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}`:e}(t,r))});var HE={},jE=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),qE=e=>"object"==typeof e&&null!==e,UE=e=>/^0[^.\s]+$/u.test(e);function GE(e){let t;return()=>(void 0===t&&(t=e()),t)}var WE=e=>e,KE=(...e)=>e.reduce((e,t)=>r=>t(e(r))),YE=(e,t,r)=>{const n=t-e;return n?(r-e)/n:1},XE=class{constructor(){this.subscriptions=[]}add(e){return LE(this.subscriptions,e),()=>FE(this.subscriptions,e)}notify(e,t,r){const n=this.subscriptions.length;if(n)if(1===n)this.subscriptions[0](e,t,r);else for(let a=0;a<n;a++){const n=this.subscriptions[a];n&&n(e,t,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},ZE=e=>1e3*e,JE=e=>e/1e3,QE=(e,t)=>t?e*(1e3/t):0,eI=/* @__PURE__ */new Set;function tI(e,t,r){e||eI.has(t)||eI.add(t)}var rI=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e;function nI(e,t,r,n){if(e===t&&r===n)return WE;const a=t=>function(e,t,r,n,a){let o,i,s=0;do{i=t+(r-t)/2,o=rI(i,n,a)-e,o>0?r=i:t=i}while(Math.abs(o)>1e-7&&++s<12);return i}(t,0,1,e,r);return e=>0===e||1===e?e:rI(a(e),t,n)}var aI=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,oI=e=>t=>1-e(1-t),iI=/*@__PURE__*/nI(.33,1.53,.69,.99),sI=/*@__PURE__*/oI(iI),lI=/*@__PURE__*/aI(sI),cI=e=>e>=1?1:(e*=2)<1?.5*sI(e):.5*(2-Math.pow(2,-10*(e-1))),dI=e=>1-Math.sin(Math.acos(e)),uI=oI(dI),hI=aI(dI),pI=/*@__PURE__*/nI(.42,0,1,1),mI=/*@__PURE__*/nI(0,0,.58,1),fI=/*@__PURE__*/nI(.42,0,.58,1),gI=e=>Array.isArray(e)&&"number"==typeof e[0],vI={linear:WE,easeIn:pI,easeInOut:fI,easeOut:mI,circIn:dI,circInOut:hI,circOut:uI,backIn:sI,backInOut:lI,backOut:iI,anticipate:cI},yI=e=>{if(gI(e)){$E(4===e.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[t,r,n,a]=e;return nI(t,r,n,a)}return"string"==typeof e?($E(void 0!==vI[e],`Invalid easing type '${e}'`,"invalid-easing-type"),vI[e]):e},bI=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function xI(e,t){let r=!1,n=!0;const a={delta:0,timestamp:0,isProcessing:!1},o=()=>r=!0,i=bI.reduce((e,t)=>(e[t]=function(e){let t=/* @__PURE__ */new Set,r=/* @__PURE__ */new Set,n=!1,a=!1;const o=/* @__PURE__ */new WeakSet;let i={delta:0,timestamp:0,isProcessing:!1};function s(t){o.has(t)&&(l.schedule(t),e()),t(i)}const l={schedule:(e,a=!1,i=!1)=>{const s=i&&n?t:r;return a&&o.add(e),s.add(e),e},cancel:e=>{r.delete(e),o.delete(e)},process:e=>{if(i=e,n)return void(a=!0);n=!0;const o=t;t=r,r=o,t.forEach(s),t.clear(),n=!1,a&&(a=!1,l.process(e))}};return l}(o),e),{}),{setup:s,read:l,resolveKeyframes:c,preUpdate:d,update:u,preRender:h,render:p,postRender:m}=i,f=()=>{const o=HE.useManualTiming,i=o?a.timestamp:performance.now();r=!1,o||(a.delta=n?1e3/60:Math.max(Math.min(i-a.timestamp,40),1)),a.timestamp=i,a.isProcessing=!0,s.process(a),l.process(a),c.process(a),d.process(a),u.process(a),h.process(a),p.process(a),m.process(a),a.isProcessing=!1,r&&t&&(n=!1,e(f))};return{schedule:bI.reduce((t,o)=>{const s=i[o];return t[o]=(t,o=!1,i=!1)=>(r||(r=!0,n=!0,a.isProcessing||e(f)),s.schedule(t,o,i)),t},{}),cancel:e=>{for(let t=0;t<bI.length;t++)i[bI[t]].cancel(e)},state:a,steps:i}}var wI,{schedule:SI,cancel:kI,state:CI,steps:NI}=/* @__PURE__ */xI("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:WE,!0);function TI(){wI=void 0}var AI={now:()=>(void 0===wI&&AI.set(CI.isProcessing||HE.useManualTiming?CI.timestamp:performance.now()),wI),set:e=>{wI=e,queueMicrotask(TI)}},MI=e=>t=>"string"==typeof t&&t.startsWith(e),DI=/*@__PURE__*/MI("--"),EI=/*@__PURE__*/MI("var(--"),II=e=>!!EI(e)&&RI.test(e.split("/*")[0].trim()),RI=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function zI(e){return"string"==typeof e&&e.split("/*")[0].includes("var(--")}var _I={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},PI={..._I,transform:e=>BE(0,1,e)},OI={..._I,default:1},LI=e=>Math.round(1e5*e)/1e5,FI=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;var BI=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,VI=(e,t)=>r=>Boolean("string"==typeof r&&BI.test(r)&&r.startsWith(e)||t&&!function(e){return null==e}(r)&&Object.prototype.hasOwnProperty.call(r,t)),$I=(e,t,r)=>n=>{if("string"!=typeof n)return n;const[a,o,i,s]=n.match(FI);return{[e]:parseFloat(a),[t]:parseFloat(o),[r]:parseFloat(i),alpha:void 0!==s?parseFloat(s):1}},HI={..._I,transform:e=>Math.round((e=>BE(0,255,e))(e))},jI={test:/*@__PURE__*/VI("rgb","red"),parse:/*@__PURE__*/$I("red","green","blue"),transform:({red:e,green:t,blue:r,alpha:n=1})=>"rgba("+HI.transform(e)+", "+HI.transform(t)+", "+HI.transform(r)+", "+LI(PI.transform(n))+")"};var qI={test:/*@__PURE__*/VI("#"),parse:function(e){let t="",r="",n="",a="";return e.length>5?(t=e.substring(1,3),r=e.substring(3,5),n=e.substring(5,7),a=e.substring(7,9)):(t=e.substring(1,2),r=e.substring(2,3),n=e.substring(3,4),a=e.substring(4,5),t+=t,r+=r,n+=n,a+=a),{red:parseInt(t,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:a?parseInt(a,16)/255:1}},transform:jI.transform},UI=e=>({test:t=>"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),GI=/*@__PURE__*/UI("deg"),WI=/*@__PURE__*/UI("%"),KI=/*@__PURE__*/UI("px"),YI=/*@__PURE__*/UI("vh"),XI=/*@__PURE__*/UI("vw"),ZI=/*@__PURE__*/(()=>({...WI,parse:e=>WI.parse(e)/100,transform:e=>WI.transform(100*e)}))(),JI={test:/*@__PURE__*/VI("hsl","hue"),parse:/*@__PURE__*/$I("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:r,alpha:n=1})=>"hsla("+Math.round(e)+", "+WI.transform(LI(t))+", "+WI.transform(LI(r))+", "+LI(PI.transform(n))+")"},QI={test:e=>jI.test(e)||qI.test(e)||JI.test(e),parse:e=>jI.test(e)?jI.parse(e):JI.test(e)?JI.parse(e):qI.parse(e),transform:e=>"string"==typeof e?e:e.hasOwnProperty("red")?jI.transform(e):JI.transform(e),getAnimatableNone:e=>{const t=QI.parse(e);return t.alpha=0,QI.transform(t)}},eR=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;var tR="number",rR="color",nR=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function aR(e){const t=e.toString(),r=[],n={color:[],number:[],var:[]},a=[];let o=0;return{values:r,split:t.replace(nR,e=>(QI.test(e)?(n.color.push(o),a.push(rR),r.push(QI.parse(e))):e.startsWith("var(")?(n.var.push(o),a.push("var"),r.push(e)):(n.number.push(o),a.push(tR),r.push(parseFloat(e))),++o,"${}")).split("${}"),indexes:n,types:a}}function oR({split:e,types:t}){const r=e.length;return n=>{let a="";for(let o=0;o<r;o++)if(a+=e[o],void 0!==n[o]){const e=t[o];a+=e===tR?LI(n[o]):e===rR?QI.transform(n[o]):n[o]}return a}}var iR=(e,t)=>"number"==typeof e?t?.trim().endsWith("/")?e:0:(e=>"number"==typeof e?0:QI.test(e)?QI.getAnimatableNone(e):e)(e);var sR={test:function(e){return isNaN(e)&&"string"==typeof e&&(e.match(FI)?.length||0)+(e.match(eR)?.length||0)>0},parse:function(e){return aR(e).values},createTransformer:function(e){return oR(aR(e))},getAnimatableNone:function(e){const t=aR(e);return oR(t)(t.values.map((e,r)=>iR(e,t.split[r])))}};function lR(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function cR(e,t){return r=>r>0?t:e}var dR=(e,t,r)=>e+(t-e)*r,uR=(e,t,r)=>{const n=e*e,a=r*(t*t-n)+n;return a<0?0:Math.sqrt(a)},hR=[qI,jI,JI];function pR(e){const t=(e=>hR.find(t=>t.test(e)))(e);if(VE(Boolean(t),`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!Boolean(t))return!1;let r=t.parse(e);return t===JI&&(r=function({hue:e,saturation:t,lightness:r,alpha:n}){e/=360,r/=100;let a=0,o=0,i=0;if(t/=100){const n=r<.5?r*(1+t):r+t-r*t,s=2*r-n;a=lR(s,n,e+1/3),o=lR(s,n,e),i=lR(s,n,e-1/3)}else a=o=i=r;return{red:Math.round(255*a),green:Math.round(255*o),blue:Math.round(255*i),alpha:n}}(r)),r}var mR=(e,t)=>{const r=pR(e),n=pR(t);if(!r||!n)return cR(e,t);const a={...r};return e=>(a.red=uR(r.red,n.red,e),a.green=uR(r.green,n.green,e),a.blue=uR(r.blue,n.blue,e),a.alpha=dR(r.alpha,n.alpha,e),jI.transform(a))},fR=/* @__PURE__ */new Set(["none","hidden"]);function gR(e,t){return r=>dR(e,t,r)}function vR(e){return"number"==typeof e?gR:"string"==typeof e?II(e)?cR:QI.test(e)?mR:xR:Array.isArray(e)?yR:"object"==typeof e?QI.test(e)?mR:bR:cR}function yR(e,t){const r=[...e],n=r.length,a=e.map((e,r)=>vR(e)(e,t[r]));return e=>{for(let t=0;t<n;t++)r[t]=a[t](e);return r}}function bR(e,t){const r={...e,...t},n={};for(const a in r)void 0!==e[a]&&void 0!==t[a]&&(n[a]=vR(e[a])(e[a],t[a]));return e=>{for(const t in n)r[t]=n[t](e);return r}}var xR=(e,t)=>{const r=sR.createTransformer(t),n=aR(e),a=aR(t);return n.indexes.var.length===a.indexes.var.length&&n.indexes.color.length===a.indexes.color.length&&n.indexes.number.length>=a.indexes.number.length?fR.has(e)&&!a.values.length||fR.has(t)&&!n.values.length?function(e,t){return fR.has(e)?r=>r<=0?e:t:r=>r>=1?t:e}(e,t):KE(yR(function(e,t){const r=[],n={color:0,var:0,number:0};for(let a=0;a<t.values.length;a++){const o=t.types[a],i=e.indexes[o][n[o]],s=e.values[i]??0;r[a]=s,n[o]++}return r}(n,a),a.values),r):(VE(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),cR(e,t))};function wR(e,t,r){return"number"==typeof e&&"number"==typeof t&&"number"==typeof r?dR(e,t,r):vR(e)(e,t)}var SR=e=>{const t=({timestamp:t})=>e(t);return{start:(e=!0)=>SI.update(t,e),stop:()=>kI(t),now:()=>CI.isProcessing?CI.timestamp:AI.now()}},kR=(e,t,r=10)=>{let n="";const a=Math.max(Math.round(t/r),2);for(let o=0;o<a;o++)n+=Math.round(1e4*e(o/(a-1)))/1e4+", ";return`linear(${n.substring(0,n.length-2)})`},CR=2e4;function NR(e,t=50,r=2e4,n){let a=0,o=e.next(a);for(n?.push(o.value);!o.done&&a<r;)a+=t,o=e.next(a),n?.push(o.value);return a>=r?1/0:a}var TR=100,AR=10,MR=1,DR=0,ER=800,IR=.3,RR=.3,zR={granular:.01,default:2},_R={granular:.005,default:.5},PR=.01,OR=10,LR=.05,FR=1;function BR(e,t){return e*Math.sqrt(1-t*t)}var VR=["duration","bounce"],$R=["stiffness","damping","mass"];function HR(e,t){return t.some(t=>void 0!==e[t])}function jR(e){let t={velocity:DR,stiffness:TR,damping:AR,mass:MR,isResolvedFromDuration:!1,...e};if(!HR(e,$R)&&HR(e,VR))if(t.velocity=0,e.visualDuration){const r=e.visualDuration,n=2*Math.PI/(1.2*r),a=n*n,o=2*BE(.05,1,1-(e.bounce||0))*Math.sqrt(a);t={...t,mass:MR,stiffness:a,damping:o}}else{const r=function({duration:e=ER,bounce:t=IR,velocity:r=DR,mass:n=MR}){let a,o;VE(e<=ZE(OR),"Spring duration must be 10 seconds or less","spring-duration-limit");let i=1-t;i=BE(LR,FR,i),e=BE(PR,OR,JE(e)),i<1?(a=t=>{const n=t*i,a=n*e;return.001-(n-r)/BR(t,i)*Math.exp(-a)},o=t=>{const n=t*i*e,o=n*r+r,s=i*i*t*t*e,l=Math.exp(-n),c=BR(t*t,i);return(.001-a(t)>0?-1:1)*((o-s)*l)/c}):(a=t=>Math.exp(-t*e)*((t-r)*e+1)-.001,o=t=>Math.exp(-t*e)*(e*e*(r-t)));const s=function(e,t,r){let n=r;for(let a=1;a<12;a++)n-=e(n)/t(n);return n}(a,o,5/e);if(e=ZE(e),isNaN(s))return{stiffness:TR,damping:AR,duration:e};{const t=s*s*n;return{stiffness:t,damping:2*i*Math.sqrt(n*t),duration:e}}}({...e,velocity:0});t={...t,...r,mass:MR},t.isResolvedFromDuration=!0}return t}function qR(e=RR,t=IR){const r="object"!=typeof e?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:n,restDelta:a}=r;const o=r.keyframes[0],i=r.keyframes[r.keyframes.length-1],s={done:!1,value:o},{stiffness:l,damping:c,mass:d,duration:u,velocity:h,isResolvedFromDuration:p}=jR({...r,velocity:-JE(r.velocity||0)}),m=h||0,f=c/(2*Math.sqrt(l*d)),g=i-o,v=JE(Math.sqrt(l/d)),y=f*v,b=Math.abs(g)<5;let x,w;if(n||(n=b?zR.granular:zR.default),a||(a=b?_R.granular:_R.default),f<1){const e=BR(v,f),t=(m+y*g)/e,r=y*t+g*e,n=y*g-t*e;let a=-1,o=0,s=0;const l=l=>{if(l!==a){a=l;const c=Math.exp(-y*l),d=Math.sin(e*l),u=Math.cos(e*l);o=i-c*(t*d+g*u),s=c*(r*d+n*u)}};x=e=>(l(e),o),w=e=>(l(e),s)}else if(1===f){x=e=>i-Math.exp(-v*e)*(g+(m+v*g)*e);const e=m+v*g;w=t=>Math.exp(-v*t)*(v*e*t-m)}else{const e=v*Math.sqrt(f*f-1);x=t=>{const r=Math.exp(-y*t),n=Math.min(e*t,300);return i-r*((m+y*g)*Math.sinh(n)+e*g*Math.cosh(n))/e};const t=(m+y*g)/e,r=y*t-g*e,n=y*g-t*e;w=t=>{const a=Math.exp(-y*t),o=Math.min(e*t,300);return a*(r*Math.sinh(o)+n*Math.cosh(o))}}const S={calculatedDuration:p&&u||null,velocity:e=>ZE(w(e)),next:e=>{const t=x(e);if(p)s.done=e>=u;else{const r=ZE(w(e));s.done=Math.abs(r)<=n&&Math.abs(i-t)<=a}return s.value=s.done?i:t,s},toString:()=>{const e=Math.min(NR(S),CR),t=kR(t=>S.next(e*t).value,e,30);return e+"ms "+t},toTransition:()=>{}};return S}function UR({keyframes:e,velocity:t=0,power:r=.8,timeConstant:n=325,bounceDamping:a=10,bounceStiffness:o=500,modifyTarget:i,min:s,max:l,restDelta:c=.5,restSpeed:d}){const u=e[0],h={done:!1,value:u},p=e=>void 0===s?l:void 0===l||Math.abs(s-e)<Math.abs(l-e)?s:l;let m=r*t;const f=u+m,g=void 0===i?f:i(f);g!==f&&(m=g-u);const v=e=>-m*Math.exp(-e/n),y=e=>{const t=v(e);h.done=Math.abs(t)<=c,h.value=h.done?g:g+t};let b,x;const w=e=>{(e=>e<s||e>l)(h.value)&&(b=e,x=qR({keyframes:[h.value,p(h.value)],velocity:-v(e)/n*1e3,damping:a,stiffness:o,restDelta:c,restSpeed:d}))};return w(0),{calculatedDuration:null,next:e=>{let t=!1;return x||void 0!==b||(t=!0,y(e),w(e)),void 0!==b&&e>=b?x.next(e-b):(!t&&y(e),h)}}}function GR(e,t,{clamp:r=!0,ease:n,mixer:a}={}){const o=e.length;if($E(o===t.length,"Both input and output ranges must be the same length","range-length"),1===o)return()=>t[0];if(2===o&&t[0]===t[1])return()=>t[1];const i=e[0]===e[1];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const s=function(e,t,r){const n=[],a=r||HE.mix||wR,o=e.length-1;for(let i=0;i<o;i++){let r=a(e[i],e[i+1]);if(t){const e=Array.isArray(t)?t[i]||WE:t;r=KE(e,r)}n.push(r)}return n}(t,n,a),l=s.length,c=r=>{if(i&&r<e[0])return t[0];let n=0;if(l>1)for(;n<e.length-2&&!(r<e[n+1]);n++);const a=YE(e[n],e[n+1],r);return s[n](a)};return r?t=>c(BE(e[0],e[o-1],t)):c}function WR(e){const t=[0];return function(e,t){const r=e[e.length-1];for(let n=1;n<=t;n++){const a=YE(0,t,n);e.push(dR(r,1,a))}}(t,e.length-1),t}function KR({duration:e=300,keyframes:t,times:r,ease:n="easeInOut"}){const a=(e=>Array.isArray(e)&&"number"!=typeof e[0])(n)?n.map(yI):yI(n),o={done:!1,value:t[0]},i=function(e,t){return e.map(e=>e*t)}(r&&r.length===t.length?r:WR(t),e),s=GR(i,t,{ease:Array.isArray(a)?a:(l=t,c=a,l.map(()=>c||fI).splice(0,l.length-1))});var l,c;return{calculatedDuration:e,next:t=>(o.value=s(t),o.done=t>=e,o)}}qR.applyToOptions=e=>{const t=function(e,t=100,r){const n=r({...e,keyframes:[0,t]}),a=Math.min(NR(n),CR);return{type:"keyframes",ease:e=>n.next(a*e).value/t,duration:JE(a)}}(e,100,qR);return e.ease=t.ease,e.duration=ZE(t.duration),e.type="keyframes",e};var YR=e=>null!==e;function XR(e,{repeat:t,repeatType:r="loop"},n,a=1){const o=e.filter(YR),i=a<0||t&&"loop"!==r&&t%2==1?0:o.length-1;return i&&void 0!==n?n:o[i]}var ZR={decay:UR,inertia:UR,tween:KR,keyframes:KR,spring:qR};function JR(e){"string"==typeof e.type&&(e.type=ZR[e.type])}var QR=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},ez=e=>e/100,tz=class extends QR{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{const{motionValue:e}=this.options;e&&e.updatedAt!==AI.now()&&this.tick(AI.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),!1===e.autoplay&&this.pause()}initAnimation(){const{options:e}=this;JR(e);const{type:t=KR,repeat:r=0,repeatDelay:n=0,repeatType:a,velocity:o=0}=e;let{keyframes:i}=e;const s=t||KR;"production"!==process.env.NODE_ENV&&s!==KR&&$E(i.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${i}`,"spring-two-frames"),s!==KR&&"number"!=typeof i[0]&&(this.mixKeyframes=KE(ez,wR(i[0],i[1])),i=[0,100]);const l=s({...e,keyframes:i});"mirror"===a&&(this.mirroredGenerator=s({...e,keyframes:[...i].reverse(),velocity:-o})),null===l.calculatedDuration&&(l.calculatedDuration=NR(l));const{calculatedDuration:c}=l;this.calculatedDuration=c,this.resolvedDuration=c+n,this.totalDuration=this.resolvedDuration*(r+1)-n,this.generator=l}updateTime(e){const t=Math.round(e-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=t}tick(e,t=!1){const{generator:r,totalDuration:n,mixKeyframes:a,mirroredGenerator:o,resolvedDuration:i,calculatedDuration:s}=this;if(null===this.startTime)return r.next(0);const{delay:l=0,keyframes:c,repeat:d,repeatType:u,repeatDelay:h,type:p,onUpdate:m,finalKeyframe:f}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-n/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);const g=this.currentTime-l*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?g<0:g>n;this.currentTime=Math.max(g,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=n);let y,b=this.currentTime,x=r;if(d){const e=Math.min(this.currentTime,n)/i;let t=Math.floor(e),r=e%1;!r&&e>=1&&(r=1),1===r&&t--,t=Math.min(t,d+1),Boolean(t%2)&&("reverse"===u?(r=1-r,h&&(r-=h/i)):"mirror"===u&&(x=o)),b=BE(0,1,r)*i}v?(this.delayState.value=c[0],y=this.delayState):y=x.next(b),a&&!v&&(y.value=a(y.value));let{done:w}=y;v||null===s||(w=this.playbackSpeed>=0?this.currentTime>=n:this.currentTime<=0);const S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&w);return S&&p!==UR&&(y.value=XR(c,this.options,f,this.speed)),m&&m(y.value),S&&this.finish(),y}then(e,t){return this.finished.then(e,t)}get duration(){return JE(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+JE(e)}get time(){return JE(this.currentTime)}set time(e){e=ZE(e),this.currentTime=e,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=e,this.tick(e))}getGeneratorVelocity(){const e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);return function(e,t,r){const n=Math.max(t-5,0);return QE(r-e(n),t-n)}(e=>this.generator.next(e).value,e,this.generator.next(e).value)}get speed(){return this.playbackSpeed}set speed(e){const t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(AI.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=JE(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=SR,startTime:t}=this.options;this.driver||(this.driver=e(e=>this.tick(e))),this.options.onPlay?.();const r=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=r):null!==this.holdTime?this.startTime=r-this.holdTime:this.startTime||(this.startTime=t??r),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(AI.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}};var rz=e=>180*e/Math.PI,nz=e=>{const t=rz(Math.atan2(e[1],e[0]));return oz(t)},az={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:nz,rotateZ:nz,skewX:e=>rz(Math.atan(e[1])),skewY:e=>rz(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},oz=e=>((e%=360)<0&&(e+=360),e),iz=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),sz=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),lz={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:iz,scaleY:sz,scale:e=>(iz(e)+sz(e))/2,rotateX:e=>oz(rz(Math.atan2(e[6],e[5]))),rotateY:e=>oz(rz(Math.atan2(-e[2],e[0]))),rotateZ:nz,rotate:nz,skewX:e=>rz(Math.atan(e[4])),skewY:e=>rz(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function cz(e){return e.includes("scale")?1:0}function dz(e,t){if(!e||"none"===e)return cz(t);const r=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let n,a;if(r)n=lz,a=r;else{const t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);n=az,a=t}if(!a)return cz(t);const o=n[t],i=a[1].split(",").map(uz);return"function"==typeof o?o(i):i[o]}function uz(e){return parseFloat(e.trim())}var hz=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],pz=/*@__PURE__*/(()=>/* @__PURE__ */new Set([...hz,"pathRotation"]))(),mz=e=>e===_I||e===KI,fz=/* @__PURE__ */new Set(["x","y","z"]),gz=hz.filter(e=>!fz.has(e));var vz={width:({x:e},{paddingLeft:t="0",paddingRight:r="0",boxSizing:n})=>{const a=e.max-e.min;return"border-box"===n?a:a-parseFloat(t)-parseFloat(r)},height:({y:e},{paddingTop:t="0",paddingBottom:r="0",boxSizing:n})=>{const a=e.max-e.min;return"border-box"===n?a:a-parseFloat(t)-parseFloat(r)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>dz(t,"x"),y:(e,{transform:t})=>dz(t,"y")};vz.translateX=vz.x,vz.translateY=vz.y;var yz=/* @__PURE__ */new Set,bz=!1,xz=!1,wz=!1;function Sz(){if(xz){const e=Array.from(yz).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),r=/* @__PURE__ */new Map;t.forEach(e=>{const t=function(e){const t=[];return gz.forEach(r=>{const n=e.getValue(r);void 0!==n&&(t.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),t}(e);t.length&&(r.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();const t=r.get(e);t&&t.forEach(([t,r])=>{e.getValue(t)?.set(r)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{void 0!==e.suspendedScrollY&&window.scrollTo(0,e.suspendedScrollY)})}xz=!1,bz=!1,yz.forEach(e=>e.complete(wz)),yz.clear()}function kz(){yz.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(xz=!0)})}var Cz=class{constructor(e,t,r,n,a,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=r,this.motionValue=n,this.element=a,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(yz.add(this),bz||(bz=!0,SI.read(kz),SI.resolveKeyframes(Sz))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:t,element:r,motionValue:n}=this;if(null===e[0]){const a=n?.get(),o=e[e.length-1];if(void 0!==a)e[0]=a;else if(r&&t){const n=r.readValue(t,o);null!=n&&(e[0]=n)}void 0===e[0]&&(e[0]=o),n&&void 0===a&&n.set(e[0])}!function(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),yz.delete(this)}cancel(){"scheduled"===this.state&&(yz.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}};function Nz(e,t,r){(e=>e.startsWith("--"))(t)?e.style.setProperty(t,r):e.style[t]=r}var Tz={};function Az(e,t){const r=GE(e);return()=>Tz[t]??r()}var Mz=/* @__PURE__ */Az(()=>void 0!==window.ScrollTimeline,"scrollTimeline"),Dz=/*@__PURE__*/Az(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(e){return!1}return!0},"linearEasing"),Ez=([e,t,r,n])=>`cubic-bezier(${e}, ${t}, ${r}, ${n})`,Iz={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:/*@__PURE__*/Ez([0,.65,.55,1]),circOut:/*@__PURE__*/Ez([.55,0,1,.45]),backIn:/*@__PURE__*/Ez([.31,.01,.66,-.59]),backOut:/*@__PURE__*/Ez([.33,1.53,.69,.99])};function Rz(e,t){return e?"function"==typeof e?Dz()?kR(e,t):"ease-out":gI(e)?Ez(e):Array.isArray(e)?e.map(e=>Rz(e,t)||Iz.easeOut):Iz[e]:void 0}function zz(e,t,r,{delay:n=0,duration:a=300,repeat:o=0,repeatType:i="loop",ease:s="easeOut",times:l}={},c=void 0){const d={[t]:r};l&&(d.offset=l);const u=Rz(s,a);Array.isArray(u)&&(d.easing=u);const h={delay:n,duration:a,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:o+1,direction:"reverse"===i?"alternate":"normal"};return c&&(h.pseudoElement=c),e.animate(d,h)}function _z(e){return"function"==typeof e&&"applyToOptions"in e}var Pz=class extends QR{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:r,keyframes:n,pseudoElement:a,allowFlatten:o=!1,finalKeyframe:i,onComplete:s}=e;this.isPseudoElement=Boolean(a),this.allowFlatten=o,this.options=e,$E("string"!=typeof e.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:e,...t}){return _z(e)&&Dz()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}(e);this.animation=zz(t,r,n,l,a),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!a){const e=XR(n,this.options,i,this.speed);this.updateMotionValue&&this.updateMotionValue(e),Nz(t,r,e),this.animation.cancel()}s?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(e){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;"idle"!==e&&"finished"!==e&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){const e=this.animation.effect?.getComputedTiming?.().duration||0;return JE(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+JE(e)}get time(){return JE(Number(this.animation.currentTime)||0)}set time(e){const t=null!==this.finishedTime;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=ZE(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:r,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&Mz()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),r&&(this.animation.rangeEnd=r),WE):n(this)}},Oz={anticipate:cI,backInOut:lI,circInOut:hI};function Lz(e){"string"==typeof e.ease&&e.ease in Oz&&(e.ease=Oz[e.ease])}var Fz=class extends Pz{constructor(e){Lz(e),JR(e),super(e),void 0!==e.startTime&&!1!==e.autoplay&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:t,onUpdate:r,onComplete:n,element:a,...o}=this.options;if(!t)return;if(void 0!==e)return void t.set(e);const i=new tz({...o,autoplay:!1}),s=Math.max(10,AI.now()-this.startTime),l=BE(0,10,s-10),c=i.sample(s).value,{name:d}=this.options;a&&d&&Nz(a,d,c),t.setWithVelocity(i.sample(Math.max(0,s-l)).value,c,l),i.stop()}},Bz=(e,t)=>"zIndex"!==t&&(!("number"!=typeof e&&!Array.isArray(e))||!("string"!=typeof e||!sR.test(e)&&"0"!==e||e.startsWith("url(")));function Vz(e){e.duration=0,e.type="keyframes"}var $z=/* @__PURE__ */new Set(["opacity","clipPath","filter","transform","backgroundColor"]),Hz=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;var jz=/* @__PURE__ */new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),qz=/*@__PURE__*/GE(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function Uz(e){const{motionValue:t,name:r,repeatDelay:n,repeatType:a,damping:o,type:i,keyframes:s}=e,l=t?.owner?.current;if(!(l instanceof HTMLElement||l instanceof SVGElement))return!1;const{onUpdate:c,transformTemplate:d}=t.owner.getProps();return qz()&&r&&($z.has(r)||jz.has(r)&&function(e){for(let t=0;t<e.length;t++)if("string"==typeof e[t]&&Hz.test(e[t]))return!0;return!1}(s))&&("transform"!==r||!d)&&!c&&!n&&"mirror"!==a&&0!==o&&"inertia"!==i}var Gz=class extends QR{constructor({autoplay:e=!0,delay:t=0,type:r="keyframes",repeat:n=0,repeatDelay:a=0,repeatType:o="loop",keyframes:i,name:s,motionValue:l,element:c,...d}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=AI.now();const u={autoplay:e,delay:t,type:r,repeat:n,repeatDelay:a,repeatType:o,name:s,motionValue:l,element:c,...d},h=c?.KeyframeResolver||Cz;this.keyframeResolver=new h(i,(e,t,r)=>this.onKeyframesResolved(e,t,u,!r),s,l,c),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,r,n){this.keyframeResolver=void 0;const{name:a,type:o,velocity:i,delay:s,isHandoff:l,onUpdate:c}=r;this.resolvedAt=AI.now();let d=!0;(function(e,t,r,n){const a=e[0];if(null===a)return!1;if("display"===t||"visibility"===t)return!0;const o=e[e.length-1],i=Bz(a,t),s=Bz(o,t);return VE(i===s,`You are trying to animate ${t} from "${a}" to "${o}". "${i?o:a}" is not an animatable value.`,"value-not-animatable"),!(!i||!s)&&(function(e){const t=e[0];if(1===e.length)return!0;for(let r=0;r<e.length;r++)if(e[r]!==t)return!0}(e)||("spring"===r||_z(r))&&n)})(e,a,o,i)||(d=!1,!HE.instantAnimations&&s||c?.(XR(e,r,t)),e[0]=e[e.length-1],Vz(r),r.repeat=0);const u={startTime:n?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...r,keyframes:e},h=d&&!l&&Uz(u),p=u.motionValue?.owner?.current;let m;if(h)try{m=new Fz({...u,element:p})}catch{m=new tz(u)}else m=new tz(u);m.finished.then(()=>{this.notifyFinished()}).catch(WE),this.pendingTimeline&&(this.stopTimeline=m.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=m}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),wz=!0,kz(),Sz(),wz=!1),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}};function Wz(e,t,r,n=0,a=1){const o=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),i=e.size,s=(i-1)*n;return"function"==typeof r?r(o,i):1===a?o*n:s-o*n}var Kz={current:void 0},Yz=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{const t=AI.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const r of this.dependents)r.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=AI.now(),null===this.canTrackVelocity&&void 0!==e&&(this.canTrackVelocity=(e=>!isNaN(parseFloat(e)))(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return"production"!==process.env.NODE_ENV&&tI(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new XE);const r=this.events[e].add(t);return"change"===e?()=>{r(),SI.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,r){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=/* @__PURE__ */new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return Kz.current&&Kz.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const e=AI.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||e-this.updatedAt>30)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,30);return QE(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function Xz(e,t){return new Yz(e,t)}function Zz(e,t){if(e?.inherit&&t){const{inherit:r,...n}=e;return{...t,...n}}return e}function Jz(e,t){const r=e?.[t]??e?.default??e;return r!==e?Zz(r,e):r}var Qz={type:"spring",stiffness:500,damping:25,restSpeed:10},e_={type:"keyframes",duration:.8},t_={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},r_=(e,{keyframes:t})=>t.length>2?e_:pz.has(e)?e.startsWith("scale")?(e=>({type:"spring",stiffness:550,damping:0===e?2*Math.sqrt(550):30,restSpeed:10}))(t[1]):Qz:t_,n_=/* @__PURE__ */new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);var a_=(e,t,r,n={},a,o)=>i=>{const s=Jz(n,e)||{},l=s.delay||n.delay||0;let{elapsed:c=0}=n;c-=ZE(l);const d={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:t.getVelocity(),...s,delay:-c,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{i(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:o?void 0:a};(function(e){for(const t in e)if(!n_.has(t))return!0;return!1})(s)||Object.assign(d,r_(e,d)),d.duration&&(d.duration=ZE(d.duration)),d.repeatDelay&&(d.repeatDelay=ZE(d.repeatDelay)),void 0!==d.from&&(d.keyframes[0]=d.from);let u=!1;if((!1===d.type||0===d.duration&&!d.repeatDelay)&&(Vz(d),0===d.delay&&(u=!0)),(HE.instantAnimations||HE.skipAnimations||a?.shouldSkipAnimations||s.skipAnimations)&&(u=!0,Vz(d),d.delay=0),d.allowFlatten=!s.type&&!s.ease,u&&!o&&void 0!==t.get()){const e=XR(d.keyframes,s);if(void 0!==e)return void SI.update(()=>{d.onUpdate(e),d.onComplete()})}return s.isSync?new tz(d):new Gz(d)},o_=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function i_(e,t,r=1){$E(r<=4,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[n,a]=function(e){const t=o_.exec(e);if(!t)return[,];const[,r,n,a]=t;return[`--${r??n}`,a]}(e);if(!n)return;const o=window.getComputedStyle(t).getPropertyValue(n);if(o){const e=o.trim();return jE(e)?parseFloat(e):e}return II(a)?i_(a,t,r+1):a}function s_(e){const t=[{},{}];return e?.values.forEach((e,r)=>{t[0][r]=e.get(),t[1][r]=e.getVelocity()}),t}function l_(e,t,r,n){if("function"==typeof t){const[a,o]=s_(n);t=t(void 0!==r?r:e.custom,a,o)}if("string"==typeof t&&(t=e.variants&&e.variants[t]),"function"==typeof t){const[a,o]=s_(n);t=t(void 0!==r?r:e.custom,a,o)}return t}function c_(e,t,r){const n=e.getProps();return l_(n,t,void 0!==r?r:n.custom,e)}var d_=/* @__PURE__ */new Set(["width","height","top","left","right","bottom",...hz]),u_=e=>Array.isArray(e);function h_(e,t,r){e.hasValue(t)?e.getValue(t).set(r):e.addValue(t,Xz(r))}function p_(e){return u_(e)?e[e.length-1]||0:e}var m_=e=>Boolean(e&&e.getVelocity);function f_(e,t){const r=e.getValue("willChange");if(function(e){return Boolean(m_(e)&&e.add)}(r))return r.add(t);if(!r&&HE.WillChange){const r=new HE.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function g_(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var v_="data-"+g_("framerAppearId");function y_(e){return e.props[v_]}var b_="undefined"!=typeof window;function x_({protectedKeys:e,needsAnimating:t},r){const n=e.hasOwnProperty(r)&&!0!==t[r];return t[r]=!1,n}function w_(e,t,{delay:r=0,transitionOverride:n,type:a}={}){let{transition:o,transitionEnd:i,...s}=t;const l=e.getDefaultTransition();o=o?Zz(o,l):l;const c=o?.reduceMotion,d=o?.skipAnimations;n&&(o=n);const u=[],h=a&&e.animationState&&e.animationState.getState()[a],p=o?.path;p&&p.animateVisualElement(e,s,o,r,u);for(const m in s){const t=e.getValue(m,e.latestValues[m]??null),n=s[m];if(void 0===n||h&&x_(h,m))continue;const a={delay:r,...Jz(o||{},m)};d&&(a.skipAnimations=!0);const i=t.get();if(void 0!==i&&!t.isAnimating()&&!Array.isArray(n)&&n===i&&!a.velocity){SI.update(()=>t.set(n));continue}let l=!1;if(b_&&window.MotionHandoffAnimation){const t=y_(e);if(t){const e=window.MotionHandoffAnimation(t,m,SI);null!==e&&(a.startTime=e,l=!0)}}f_(e,m);const p=c??e.shouldReduceMotion;t.start(a_(m,t,n,p&&d_.has(m)?{type:!1}:a,e,l));const f=t.animation;f&&u.push(f)}if(i){const t=()=>SI.update(()=>{i&&function(e,t){let{transitionEnd:r={},transition:n={},...a}=c_(e,t)||{};a={...a,...r};for(const o in a)h_(e,o,p_(a[o]))}(e,i)});u.length?Promise.all(u).then(t):t()}return u}function S_(e,t,r={}){const n=c_(e,t,"exit"===r.type?e.presenceContext?.custom:void 0);let{transition:a=e.getDefaultTransition()||{}}=n||{};r.transitionOverride&&(a=r.transitionOverride);const o=n?()=>Promise.all(w_(e,n,r)):()=>Promise.resolve(),i=e.variantChildren&&e.variantChildren.size?(n=0)=>{const{delayChildren:o=0,staggerChildren:i,staggerDirection:s}=a;return function(e,t,r=0,n=0,a=0,o=1,i){const s=[];for(const l of e.variantChildren)l.notify("AnimationStart",t),s.push(S_(l,t,{...i,delay:r+("function"==typeof n?0:n)+Wz(e.variantChildren,l,n,a,o)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(s)}(e,t,n,o,i,s,r)}:()=>Promise.resolve(),{when:s}=a;if(s){const[e,t]="beforeChildren"===s?[o,i]:[i,o];return e().then(()=>t())}return Promise.all([o(),i(r.delay)])}var k_=e=>t=>t.test(e),C_=[_I,KI,WI,GI,XI,YI,{test:e=>"auto"===e,parse:e=>e}],N_=e=>C_.find(k_(e));function T_(e){return"number"==typeof e?0===e:null===e||("none"===e||"0"===e||UE(e))}var A_=/* @__PURE__ */new Set(["brightness","contrast","saturate","opacity"]);function M_(e){const[t,r]=e.slice(0,-1).split("(");if("drop-shadow"===t)return e;const[n]=r.match(FI)||[];if(!n)return e;const a=r.replace(n,"");let o=A_.has(t)?1:0;return n!==r&&(o*=100),t+"("+o+a+")"}var D_=/\b([a-z-]*)\(.*?\)/gu,E_={...sR,getAnimatableNone:e=>{const t=e.match(D_);return t?t.map(M_).join(" "):e}},I_={...sR,getAnimatableNone:e=>{const t=sR.parse(e);return sR.createTransformer(e)(t.map(e=>"number"==typeof e?0:"object"==typeof e?{...e,alpha:1}:e))}},R_={..._I,transform:Math.round},z_={borderWidth:KI,borderTopWidth:KI,borderRightWidth:KI,borderBottomWidth:KI,borderLeftWidth:KI,borderRadius:KI,borderTopLeftRadius:KI,borderTopRightRadius:KI,borderBottomRightRadius:KI,borderBottomLeftRadius:KI,width:KI,maxWidth:KI,height:KI,maxHeight:KI,top:KI,right:KI,bottom:KI,left:KI,inset:KI,insetBlock:KI,insetBlockStart:KI,insetBlockEnd:KI,insetInline:KI,insetInlineStart:KI,insetInlineEnd:KI,padding:KI,paddingTop:KI,paddingRight:KI,paddingBottom:KI,paddingLeft:KI,paddingBlock:KI,paddingBlockStart:KI,paddingBlockEnd:KI,paddingInline:KI,paddingInlineStart:KI,paddingInlineEnd:KI,margin:KI,marginTop:KI,marginRight:KI,marginBottom:KI,marginLeft:KI,marginBlock:KI,marginBlockStart:KI,marginBlockEnd:KI,marginInline:KI,marginInlineStart:KI,marginInlineEnd:KI,fontSize:KI,backgroundPositionX:KI,backgroundPositionY:KI,...{rotate:GI,pathRotation:GI,rotateX:GI,rotateY:GI,rotateZ:GI,scale:OI,scaleX:OI,scaleY:OI,scaleZ:OI,skew:GI,skewX:GI,skewY:GI,distance:KI,translateX:KI,translateY:KI,translateZ:KI,x:KI,y:KI,z:KI,perspective:KI,transformPerspective:KI,opacity:PI,originX:ZI,originY:ZI,originZ:KI},zIndex:R_,fillOpacity:PI,strokeOpacity:PI,numOctaves:R_},__={...z_,color:QI,backgroundColor:QI,outlineColor:QI,fill:QI,stroke:QI,borderColor:QI,borderTopColor:QI,borderRightColor:QI,borderBottomColor:QI,borderLeftColor:QI,filter:E_,WebkitFilter:E_,mask:I_,WebkitMask:I_},P_=e=>__[e],O_=/*@__PURE__*/new Set([E_,I_]);function L_(e,t){let r=P_(e);return O_.has(r)||(r=sR),r.getAnimatableNone?r.getAnimatableNone(t):void 0}var F_=/* @__PURE__ */new Set(["auto","none","0"]);var B_=class extends Cz{constructor(e,t,r,n,a){super(e,t,r,n,a,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:t,name:r}=this;if(!t||!t.current)return;super.readKeyframes();for(let s=0;s<e.length;s++){let r=e[s];if("string"==typeof r&&(r=r.trim(),II(r))){const n=i_(r,t.current);void 0!==n&&(e[s]=n),s===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!d_.has(r)||2!==e.length)return;const[n,a]=e,o=N_(n),i=N_(a);if(zI(n)!==zI(a)&&vz[r])this.needsMeasurement=!0;else if(o!==i)if(mz(o)&&mz(i))for(let s=0;s<e.length;s++){const t=e[s];"string"==typeof t&&(e[s]=parseFloat(t))}else vz[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:t}=this,r=[];for(let n=0;n<e.length;n++)(null===e[n]||T_(e[n]))&&r.push(n);r.length&&function(e,t,r){let n,a=0;for(;a<e.length&&!n;){const t=e[a];"string"==typeof t&&!F_.has(t)&&aR(t).values.length&&(n=e[a]),a++}if(n&&r)for(const o of t)e[o]=L_(r,n)}(e,r,t)}measureInitialState(){const{element:e,unresolvedKeyframes:t,name:r}=this;if(!e||!e.current)return;"height"===r&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=vz[r](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;const n=t[t.length-1];void 0!==n&&e.getValue(r,n).jump(n,!1)}measureEndState(){const{element:e,name:t,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const n=e.getValue(t);n&&n.jump(this.measuredOrigin,!1);const a=r.length-1,o=r[a];r[a]=vz[t](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==o&&void 0===this.finalKeyframe&&(this.finalKeyframe=o),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,r])=>{e.getValue(t).set(r)}),this.resolveNoneKeyframes()}},V_=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function $_(e,t,r){if(null==e)return[];if(e instanceof EventTarget)return[e];if("string"==typeof e){let n=document;t&&(n=t.current);const a=r?.[e]??n.querySelectorAll(e);return a?Array.from(a):[]}return Array.from(e).filter(e=>null!=e)}var H_=(e,t)=>t&&"number"==typeof e?t.transform(e):e;function j_(e){return qE(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}var{schedule:q_,cancel:U_}=/* @__PURE__ */xI(queueMicrotask,!1),G_={x:!1,y:!1};function W_(){return G_.x||G_.y}function K_(e,t){const r=$_(e),n=new AbortController;return[r,{passive:!0,...t,signal:n.signal},()=>n.abort()]}function Y_(e,t,r={}){const[n,a,o]=K_(e,r);return n.forEach(e=>{let r,n=!1,o=!1;const i=t=>{r&&(r(t),r=void 0),e.removeEventListener("pointerleave",l)},s=e=>{n=!1,window.removeEventListener("pointerup",s),window.removeEventListener("pointercancel",s),o&&(o=!1,i(e))},l=e=>{"touch"!==e.pointerType&&(n?o=!0:i(e))};e.addEventListener("pointerenter",n=>{if("touch"===n.pointerType||W_())return;o=!1;const i=t(e,n);"function"==typeof i&&(r=i,e.addEventListener("pointerleave",l,a))},a),e.addEventListener("pointerdown",()=>{n=!0,window.addEventListener("pointerup",s,a),window.addEventListener("pointercancel",s,a)},a)}),o}var X_=(e,t)=>!!t&&(e===t||X_(e,t.parentElement)),Z_=e=>"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary,J_=/* @__PURE__ */new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);var Q_=/* @__PURE__ */new Set(["INPUT","SELECT","TEXTAREA"]);var eP=/* @__PURE__ */new WeakSet;function tP(e){return t=>{"Enter"===t.key&&e(t)}}function rP(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}function nP(e){return Z_(e)&&!W_()}var aP=/* @__PURE__ */new WeakSet;function oP(e,t,r={}){const[n,a,o]=K_(e,r),i=e=>{const n=e.currentTarget;if(!nP(e))return;if(aP.has(e))return;eP.add(n),r.stopPropagation&&aP.add(e);const o=t(n,e),i={...a,capture:!0},s=(e,t)=>{window.removeEventListener("pointerup",l,i),window.removeEventListener("pointercancel",c,i),eP.has(n)&&eP.delete(n),nP(e)&&"function"==typeof o&&o(e,{success:t})},l=e=>{s(e,n===window||n===document||r.useGlobalTarget||X_(n,e.target))},c=e=>{s(e,!1)};window.addEventListener("pointerup",l,i),window.addEventListener("pointercancel",c,i)};return n.forEach(e=>{var t;(r.useGlobalTarget?window:e).addEventListener("pointerdown",i,a),j_(e)&&(e.addEventListener("focus",e=>((e,t)=>{const r=e.currentTarget;if(!r)return;const n=tP(()=>{if(eP.has(r))return;rP(r,"down");const e=tP(()=>{rP(r,"up")});r.addEventListener("keyup",e,t),r.addEventListener("blur",()=>rP(r,"cancel"),t)});r.addEventListener("keydown",n,t),r.addEventListener("blur",()=>r.removeEventListener("keydown",n),t)})(e,a)),t=e,J_.has(t.tagName)||!0===t.isContentEditable||e.hasAttribute("tabindex")||(e.tabIndex=0))}),o}function iP(e){return qE(e)&&"ownerSVGElement"in e}var sP,lP=/* @__PURE__ */new WeakMap,cP=(e,t,r)=>(n,a)=>a&&a[0]?a[0][e+"Size"]:iP(n)&&"getBBox"in n?n.getBBox()[t]:n[r],dP=/*@__PURE__*/cP("inline","width","offsetWidth"),uP=/*@__PURE__*/cP("block","height","offsetHeight");function hP({target:e,borderBoxSize:t}){lP.get(e)?.forEach(r=>{r(e,{get width(){return dP(e,t)},get height(){return uP(e,t)}})})}function pP(e){e.forEach(hP)}function mP(e,t){sP||"undefined"!=typeof ResizeObserver&&(sP=new ResizeObserver(pP));const r=$_(e);return r.forEach(e=>{let r=lP.get(e);r||(r=/* @__PURE__ */new Set,lP.set(e,r)),r.add(t),sP?.observe(e)}),()=>{r.forEach(e=>{const r=lP.get(e);r?.delete(t),r?.size||sP?.unobserve(e)})}}var fP,gP=/* @__PURE__ */new Set;function vP(e){return gP.add(e),fP||(fP=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};gP.forEach(t=>t(e))},window.addEventListener("resize",fP)),()=>{gP.delete(e),gP.size||"function"!=typeof fP||(window.removeEventListener("resize",fP),fP=void 0)}}function yP(e,t){return"function"==typeof e?vP(e):mP(e,t)}var bP={value:null,addProjectionMetrics:null};var xP=[...C_,QI,sR],wP=()=>({x:{min:0,max:0},y:{min:0,max:0}}),SP=/* @__PURE__ */new WeakMap;function kP(e){return null!==e&&"object"==typeof e&&"function"==typeof e.start}function CP(e){return"string"==typeof e||Array.isArray(e)}var NP=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],TP=["initial",...NP];function AP(e){return kP(e.animate)||TP.some(t=>CP(e[t]))}function MP(e){return Boolean(AP(e)||e.variants)}var DP={current:null},EP={current:!1},IP="undefined"!=typeof window;var RP=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],zP={};function _P(e){zP=e}var PP=class{scrapeMotionValuesFromProps(e,t,r){return{}}constructor({parent:e,props:t,presenceContext:r,reducedMotionConfig:n,skipAnimations:a,blockInitialAnimation:o,visualState:i},s={}){this.current=null,this.children=/* @__PURE__ */new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=/* @__PURE__ */new Map,this.KeyframeResolver=Cz,this.features={},this.valueSubscriptions=/* @__PURE__ */new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const e=AI.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,SI.render(this.render,!1,!0))};const{latestValues:l,renderState:c}=i;this.latestValues=l,this.baseTarget={...l},this.initialValues=t.initial?{...l}:{},this.renderState=c,this.parent=e,this.props=t,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=n,this.skipAnimationsConfig=a,this.options=s,this.blockInitialAnimation=Boolean(o),this.isControllingVariants=AP(t),this.isVariantNode=MP(t),this.isVariantNode&&(this.variantChildren=/* @__PURE__ */new Set),this.manuallyAnimateOnMount=Boolean(e&&e.current);const{willChange:d,...u}=this.scrapeMotionValuesFromProps(t,{},this);for(const h in u){const e=u[h];void 0!==l[h]&&m_(e)&&e.set(l[h])}}mount(e){if(this.hasBeenMounted)for(const t in this.initialValues)this.values.get(t)?.jump(this.initialValues[t]),this.latestValues[t]=this.initialValues[t];this.current=e,SP.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(EP.current||function(){if(EP.current=!0,IP)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>DP.current=e.matches;e.addEventListener("change",t),t()}else DP.current=!1}(),this.shouldReduceMotion=DP.current),"production"!==process.env.NODE_ENV&&tI(!0!==this.shouldReduceMotion,"You have Reduced Motion enabled on your device. Animations may not appear as expected."),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),kI(this.notifyUpdate),kI(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=/* @__PURE__ */new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&$z.has(e)&&this.current instanceof HTMLElement){const{factory:r,keyframes:n,times:a,ease:o,duration:i}=t.accelerate,s=new Pz({element:this.current,name:e,keyframes:n,times:a,ease:o,duration:ZE(i)}),l=r(s);return void this.valueSubscriptions.set(e,()=>{l(),s.cancel()})}const r=pz.has(e);r&&this.onBindTransform&&this.onBindTransform();const n=t.on("change",t=>{this.latestValues[e]=t,this.props.onUpdate&&SI.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let a;"undefined"!=typeof window&&window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{n(),a&&a()})}sortNodePosition(e){return this.current&&this.sortInstanceNodePosition&&this.type===e.type?this.sortInstanceNodePosition(this.current,e.current):0}updateFeatures(){let e="animation";for(e in zP){const t=zP[e];if(!t)continue;const{isEnabled:r,Feature:n}=t;if(!this.features[e]&&n&&r(this.props)&&(this.features[e]=new n(this)),this.features[e]){const t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let r=0;r<RP.length;r++){const t=RP[r];this.propEventSubscriptions[t]&&(this.propEventSubscriptions[t](),delete this.propEventSubscriptions[t]);const n=e["on"+t];n&&(this.propEventSubscriptions[t]=this.on(t,n))}this.prevMotionValues=function(e,t,r){for(const n in t){const a=t[n],o=r[n];if(m_(a))e.addValue(n,a);else if(m_(o))e.addValue(n,Xz(a,{owner:e}));else if(o!==a)if(e.hasValue(n)){const t=e.getValue(n);!0===t.liveStyle?t.jump(a):t.hasAnimated||t.set(a)}else{const t=e.getStaticValue(n);e.addValue(n,Xz(void 0!==t?t:a,{owner:e}))}}for(const n in r)void 0===t[n]&&e.removeValue(n);return t}(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){const r=this.values.get(e);t!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);const t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return void 0===r&&void 0!==t&&(r=Xz(null===t?void 0:t,{owner:this}),this.addValue(e,r)),r}readValue(e,t){let r=void 0===this.latestValues[e]&&this.current?this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options):this.latestValues[e];return null!=r&&("string"==typeof r&&(jE(r)||UE(r))?r=parseFloat(r):!(e=>xP.find(k_(e)))(r)&&sR.test(t)&&(r=L_(e,t)),this.setBaseTarget(e,m_(r)?r.get():r)),m_(r)?r.get():r}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){const{initial:t}=this.props;let r;if("string"==typeof t||"object"==typeof t){const n=l_(this.props,t,this.presenceContext?.custom);n&&(r=n[e])}if(t&&void 0!==r)return r;const n=this.getBaseTargetFromProps(this.props,e);return void 0===n||m_(n)?void 0!==this.initialValues[e]&&void 0===r?void 0:this.baseTarget[e]:n}on(e,t){return this.events[e]||(this.events[e]=new XE),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){q_.render(this.render)}},OP=class extends PP{constructor(){super(...arguments),this.KeyframeResolver=B_}sortInstanceNodePosition(e,t){return 2&e.compareDocumentPosition(t)?1:-1}getBaseTargetFromProps(e,t){const r=e.style;return r?r[t]:void 0}removeValueFromRenderState(e,{vars:t,style:r}){delete t[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;m_(e)&&(this.childSubscription=e.on("change",e=>{this.current&&(this.current.textContent=`${e}`)}))}},LP=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function FP({top:e,left:t,right:r,bottom:n}){return{x:{min:t,max:r},y:{min:e,max:n}}}function BP(e){return void 0===e||1===e}function VP({scale:e,scaleX:t,scaleY:r}){return!BP(e)||!BP(t)||!BP(r)}function $P(e){return VP(e)||HP(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function HP(e){return jP(e.x)||jP(e.y)}function jP(e){return e&&"0%"!==e}function qP(e,t,r){return r+t*(e-r)}function UP(e,t,r,n,a){return void 0!==a&&(e=qP(e,a,n)),qP(e,r,n)+t}function GP(e,t=0,r=1,n,a){e.min=UP(e.min,t,r,n,a),e.max=UP(e.max,t,r,n,a)}function WP(e,{x:t,y:r}){GP(e.x,t.translate,t.scale,t.originPoint),GP(e.y,r.translate,r.scale,r.originPoint)}var KP=.999999999999,YP=1.0000000000001;function XP(e,t){e.min+=t,e.max+=t}function ZP(e,t,r,n,a=.5){GP(e,t,r,dR(e.min,e.max,a),n)}function JP(e,t){return"string"==typeof e?parseFloat(e)/100*(t.max-t.min):e}function QP(e,t,r){const n=r??e;ZP(e.x,JP(t.x,n.x),t.scaleX,t.scale,t.originX),ZP(e.y,JP(t.y,n.y),t.scaleY,t.scale,t.originY)}function eO(e,t){return FP(function(e,t){if(!t)return e;const r=t({x:e.left,y:e.top}),n=t({x:e.right,y:e.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}(e.getBoundingClientRect(),t))}var tO={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},rO=hz.length;function nO(e,t,r){const{style:n,vars:a,transformOrigin:o}=e;let i=!1,s=!1;for(const l in t){const e=t[l];if(pz.has(l))i=!0;else if(DI(l))a[l]=e;else{const t=H_(e,z_[l]);l.startsWith("origin")?(s=!0,o[l]=t):n[l]=t}}if(t.transform||(i||r?n.transform=function(e,t,r){let n="",a=!0;for(let i=0;i<rO;i++){const o=hz[i],s=e[o];if(void 0===s)continue;let l=!0;if("number"==typeof s)l=s===(o.startsWith("scale")?1:0);else{const e=parseFloat(s);l=o.startsWith("scale")?1===e:0===e}if(!l||r){const e=H_(s,z_[o]);l||(a=!1,n+=`${tO[o]||o}(${e}) `),r&&(t[o]=e)}}const o=e.pathRotation;return o&&(a=!1,n+=`rotate(${H_(o,z_.pathRotation)}) `),n=n.trim(),r?n=r(t,a?"":n):a&&(n="none"),n}(t,e.transform,r):n.transform&&(n.transform="none")),s){const{originX:e="50%",originY:t="50%",originZ:r=0}=o;n.transformOrigin=`${e} ${t} ${r}`}}function aO(e,{style:t,vars:r},n,a){const o=e.style;let i;for(i in t)o[i]=t[i];for(i in a?.applyProjectionStyles(o,n),r)o.setProperty(i,r[i])}function oO(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var iO={correct:(e,t)=>{if(!t.target)return e;if("string"==typeof e){if(!KI.test(e))return e;e=parseFloat(e)}return`${oO(e,t.target.x)}% ${oO(e,t.target.y)}%`}},sO={correct:(e,{treeScale:t,projectionDelta:r})=>{const n=e,a=sR.parse(e);if(a.length>5)return n;const o=sR.createTransformer(e),i="number"!=typeof a[0]?1:0,s=r.x.scale*t.x,l=r.y.scale*t.y;a[0+i]/=s,a[1+i]/=l;const c=dR(s,l,.5);return"number"==typeof a[2+i]&&(a[2+i]/=c),"number"==typeof a[3+i]&&(a[3+i]/=c),o(a)}},lO={borderRadius:{...iO,applyTo:[...V_]},borderTopLeftRadius:iO,borderTopRightRadius:iO,borderBottomLeftRadius:iO,borderBottomRightRadius:iO,boxShadow:sO};function cO(e,{layout:t,layoutId:r}){return pz.has(e)||e.startsWith("origin")||(t||void 0!==r)&&(!!lO[e]||"opacity"===e)}function dO(e,t,r){const n=e.style,a=t?.style,o={};if(!n)return o;for(const i in n)(m_(n[i])||a&&m_(a[i])||cO(i,e)||void 0!==r?.getValue(i)?.liveStyle)&&(o[i]=n[i]);return o}var uO=class extends OP{constructor(){super(...arguments),this.type="html",this.renderInstance=aO}mount(e){$E(Boolean(e.style),"motion.create() components must forward their ref to a HTML or SVG element","custom-component-ref"),super.mount(e)}readValueFromInstance(e,t){if(pz.has(t))return this.projection?.isProjecting?cz(t):((e,t)=>{const{transform:r="none"}=getComputedStyle(e);return dz(r,t)})(e,t);{const n=(r=e,window.getComputedStyle(r)),a=(DI(t)?n.getPropertyValue(t):n[t])||0;return"string"==typeof a?a.trim():a}var r}measureInstanceViewportBox(e,{transformPagePoint:t}){return eO(e,t)}build(e,t,r){nO(e,t,r.transformTemplate)}scrapeMotionValuesFromProps(e,t,r){return dO(e,t,r)}},hO={offset:"stroke-dashoffset",array:"stroke-dasharray"},pO={offset:"strokeDashoffset",array:"strokeDasharray"};var mO=["transform","opacity","offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function fO(e,{attrX:t,attrY:r,attrScale:n,pathLength:a,pathSpacing:o=1,pathOffset:i=0,...s},l,c,d){if(nO(e,s,c),l)return void(e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox));e.attrs=e.style,e.style={};const{attrs:u,style:h}=e;for(const p of mO)void 0!==u[p]&&(h[p]=u[p],delete u[p]);(h.transform||u.transformOrigin)&&(h.transformOrigin=u.transformOrigin??"50% 50%",delete u.transformOrigin),h.transform&&(h.transformBox=d?.transformBox??"fill-box",delete u.transformBox),void 0!==t&&(u.x=t),void 0!==r&&(u.y=r),void 0!==n&&(u.scale=n),void 0!==a&&function(e,t,r=1,n=0,a=!0){e.pathLength=1;const o=a?hO:pO;e[o.offset]=""+-n,e[o.array]=`${t} ${r}`}(u,a,o,i,!1)}var gO=/* @__PURE__ */new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),vO=e=>"string"==typeof e&&"svg"===e.toLowerCase();function yO(e,t,r){const n=dO(e,t,r);for(const a in e)if(m_(e[a])||m_(t[a])){n[-1!==hz.indexOf(a)?"attr"+a.charAt(0).toUpperCase()+a.substring(1):a]=e[a]}return n}var bO=class extends OP{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=wP}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(pz.has(t)){const e=P_(t);return e&&e.default||0}if(mO.includes(t)){const r=getComputedStyle(e)[t];if("string"==typeof r&&r)return r.trim()}return t=gO.has(t)?t:g_(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,r){return yO(e,t,r)}build(e,t,r){fO(e,t,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,t,r,n){!function(e,t,r,n){aO(e,t,void 0,n);for(const a in t.attrs)e.setAttribute(gO.has(a)?a:g_(a),t.attrs[a])}(e,t,0,n)}mount(e){this.isSVGTag=vO(e.tagName),super.mount(e)}},xO=TP.length;function wO(e){if(!e)return;if(!e.isControllingVariants){const t=e.parent&&wO(e.parent)||{};return void 0!==e.props.initial&&(t.initial=e.props.initial),t}const t={};for(let r=0;r<xO;r++){const n=TP[r],a=e.props[n];(CP(a)||!1===a)&&(t[n]=a)}return t}function SO(e,t){if(!Array.isArray(t))return!1;const r=t.length;if(r!==e.length)return!1;for(let n=0;n<r;n++)if(t[n]!==e[n])return!1;return!0}var kO=[...NP].reverse(),CO=NP.length;function NO(e){return t=>Promise.all(t.map(({animation:t,options:r})=>function(e,t,r={}){let n;if(e.notify("AnimationStart",t),Array.isArray(t)){const a=t.map(t=>S_(e,t,r));n=Promise.all(a)}else if("string"==typeof t)n=S_(e,t,r);else{const a="function"==typeof t?c_(e,t,r.custom):t;n=Promise.all(w_(e,a,r))}return n.then(()=>{e.notify("AnimationComplete",t)})}(e,t,r)))}function TO(e){let t=NO(e),r=DO(),n=!0,a=!1;const o=t=>(r,n)=>{const a=c_(e,n,"exit"===t?e.presenceContext?.custom:void 0);if(a){const{transition:e,transitionEnd:t,...n}=a;r={...r,...n,...t}}return r};function i(i){const{props:s}=e,l=wO(e.parent)||{},c=[],d=/* @__PURE__ */new Set;let u={},h=1/0;for(let t=0;t<CO;t++){const p=kO[t],m=r[p],f=void 0!==s[p]?s[p]:l[p],g=CP(f),v=p===i?m.isActive:null;!1===v&&(h=t);let y=f===l[p]&&f!==s[p]&&g;if(y&&(n||a)&&e.manuallyAnimateOnMount&&(y=!1),m.protectedKeys={...u},!m.isActive&&null===v||!f&&!m.prevProp||kP(f)||"boolean"==typeof f)continue;if("exit"===p&&m.isActive&&!0!==v){m.prevResolvedValues&&(u={...u,...m.prevResolvedValues});continue}const b=AO(m.prevProp,f);let x=b||p===i&&m.isActive&&!y&&g||t>h&&g,w=!1;const S=Array.isArray(f)?f:[f];let k=S.reduce(o(p),{});!1===v&&(k={});const{prevResolvedValues:C={}}=m,N={...C,...k},T=t=>{x=!0,d.has(t)&&(w=!0,d.delete(t)),m.needsAnimating[t]=!0;const r=e.getValue(t);r&&(r.liveStyle=!1)};for(const e in N){const t=k[e],r=C[e];if(u.hasOwnProperty(e))continue;let n=!1;n=u_(t)&&u_(r)?!SO(t,r)||b:t!==r,n?null!=t?T(e):d.add(e):void 0!==t&&d.has(e)?T(e):m.protectedKeys[e]=!0}m.prevProp=f,m.prevResolvedValues=k,m.isActive&&(u={...u,...k}),(n||a)&&e.blockInitialAnimation&&(x=!1);const A=y&&b;!x||A&&!w||c.push(...S.map(t=>{const r={type:p};if("string"==typeof t&&(n||a)&&!A&&e.manuallyAnimateOnMount&&e.parent){const{parent:n}=e,a=c_(n,t);if(n.enteringChildren&&a){const{delayChildren:t}=a.transition||{};r.delay=Wz(n.enteringChildren,e,t)}}return{animation:t,options:r}}))}if(d.size){const t={};if("boolean"!=typeof s.initial){const r=c_(e,Array.isArray(s.initial)?s.initial[0]:s.initial);r&&r.transition&&(t.transition=r.transition)}d.forEach(r=>{const n=e.getBaseTarget(r),a=e.getValue(r);a&&(a.liveStyle=!0),t[r]=n??null}),c.push({animation:t})}let p=Boolean(c.length);return!n||!1!==s.initial&&s.initial!==s.animate||e.manuallyAnimateOnMount||(p=!1),n=!1,a=!1,p?t(c):Promise.resolve()}return{animateChanges:i,setActive:function(t,n){if(r[t].isActive===n)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,n)),r[t].isActive=n;const a=i(t);for(const e in r)r[e].protectedKeys={};return a},setAnimateFunction:function(r){t=r(e)},getState:()=>r,reset:()=>{r=DO(),a=!0}}}function AO(e,t){return"string"==typeof t?t!==e:!!Array.isArray(t)&&!SO(t,e)}function MO(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function DO(){return{animate:MO(!0),whileInView:MO(),whileHover:MO(),whileTap:MO(),whileDrag:MO(),whileFocus:MO(),exit:MO()}}function EO(e,t){e.min=t.min,e.max=t.max}function IO(e,t){EO(e.x,t.x),EO(e.y,t.y)}function RO(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function zO(e){return e.max-e.min}function _O(e,t,r,n=.5){e.origin=n,e.originPoint=dR(t.min,t.max,e.origin),e.scale=zO(r)/zO(t),e.translate=dR(r.min,r.max,e.origin)-e.originPoint,(e.scale>=.9999&&e.scale<=1.0001||isNaN(e.scale))&&(e.scale=1),(e.translate>=-.01&&e.translate<=.01||isNaN(e.translate))&&(e.translate=0)}function PO(e,t,r,n){_O(e.x,t.x,r.x,n?n.originX:void 0),_O(e.y,t.y,r.y,n?n.originY:void 0)}function OO(e,t,r,n=0){e.min=(n?dR(r.min,r.max,n):r.min)+t.min,e.max=e.min+zO(t)}function LO(e,t,r,n=0){const a=n?dR(r.min,r.max,n):r.min;e.min=t.min-a,e.max=e.min+zO(t)}function FO(e,t,r,n){LO(e.x,t.x,r.x,n?.x),LO(e.y,t.y,r.y,n?.y)}function BO(e,t,r,n,a){return e=qP(e-=t,1/r,n),void 0!==a&&(e=qP(e,1/a,n)),e}function VO(e,t,[r,n,a],o,i){!function(e,t=0,r=1,n=.5,a,o=e,i=e){if(WI.test(t)&&(t=parseFloat(t),t=dR(i.min,i.max,t/100)-i.min),"number"!=typeof t)return;let s=dR(o.min,o.max,n);e===o&&(s-=t),e.min=BO(e.min,t,r,s,a),e.max=BO(e.max,t,r,s,a)}(e,t[r],t[n],t[a],t.scale,o,i)}var $O=["x","scaleX","originX"],HO=["y","scaleY","originY"];function jO(e,t,r,n){VO(e.x,t,$O,r?r.x:void 0,n?n.x:void 0),VO(e.y,t,HO,r?r.y:void 0,n?n.y:void 0)}function qO(e){return 0===e.translate&&1===e.scale}function UO(e){return qO(e.x)&&qO(e.y)}function GO(e,t){return e.min===t.min&&e.max===t.max}function WO(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function KO(e,t){return WO(e.x,t.x)&&WO(e.y,t.y)}function YO(e){return zO(e.x)/zO(e.y)}function XO(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function ZO(e){return[e("x"),e("y")]}var JO=V_.length,QO=e=>"string"==typeof e?parseFloat(e):e,eL=e=>"number"==typeof e||KI.test(e);function tL(e,t){return void 0!==e[t]?e[t]:e.borderRadius}var rL=/*@__PURE__*/aL(0,.5,uI),nL=/*@__PURE__*/aL(.5,.95,WE);function aL(e,t,r){return n=>n<e?0:n>t?1:r(YE(e,t,n))}function oL(e,t,r,n={passive:!0}){return e.addEventListener(t,r,n),()=>e.removeEventListener(t,r,n)}var iL=(e,t)=>e.depth-t.depth,sL=class{constructor(){this.children=[],this.isDirty=!1}add(e){LE(this.children,e),this.isDirty=!0}remove(e){FE(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(iL),this.isDirty=!1,this.children.forEach(e)}};function lL(e){return m_(e)?e.get():e}var cL=class{constructor(){this.members=[]}add(e){LE(this.members,e);for(let t=this.members.length-1;t>=0;t--){const r=this.members[t];if(r===e||r===this.lead||r===this.prevLead)continue;const n=r.instance;n&&!1!==n.isConnected||r.snapshot||(FE(this.members,r),r.unmount())}e.scheduleRender()}remove(e){if(FE(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){const e=this.members[t];if(!1!==e.isPresent&&!1!==e.instance?.isConnected)return this.promote(e),!0}return!1}promote(e,t){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.updateSnapshot(),e.scheduleRender();const{layoutDependency:n}=r.options,{layoutDependency:a}=e.options;void 0!==n&&n===a||(e.resumeFrom=r,t&&(r.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),!1===e.options.crossfade&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}},dL={hasAnimatedSinceResize:!0,hasEverUpdated:!1},uL={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},hL=["","X","Y","Z"],pL=0;function mL(e,t,r,n){const{latestValues:a}=t;a[e]&&(r[e]=a[e],t.setStaticValue(e,0),n&&(n[e]=0))}function fL(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const r=y_(t);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:t,layoutId:n}=e.options;window.MotionCancelOptimisedAnimation(r,"transform",SI,!(t||n))}const{parent:n}=e;n&&!n.hasCheckedOptimisedAppear&&fL(n)}function gL({attachResizeListener:e,defaultParent:t,measureScroll:r,checkIsScrollRoot:n,resetTransform:a}){return class{constructor(e={},r=t?.()){this.id=pL++,this.animationId=0,this.animationCommitId=0,this.children=/* @__PURE__ */new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=/* @__PURE__ */new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,bP.value&&(uL.nodes=uL.calculatedTargetDeltas=uL.calculatedProjections=0),this.nodes.forEach(bL),this.nodes.forEach(ML),this.nodes.forEach(DL),this.nodes.forEach(xL),bP.addProjectionMetrics&&bP.addProjectionMetrics(uL)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=/* @__PURE__ */new Map,this.latestValues=e,this.root=r?r.root||r:this,this.path=r?[...r.path,r]:[],this.parent=r,this.depth=r?r.depth+1:0;for(let t=0;t<this.path.length;t++)this.path[t].shouldResetTransform=!0;this.root===this&&(this.nodes=new sL)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new XE),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){const r=this.eventHandlers.get(e);r&&r.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;var r;this.isSVG=iP(t)&&!(iP(r=t)&&"svg"===r.tagName),this.instance=t;const{layoutId:n,layout:a,visualElement:o}=this.options;if(o&&!o.current&&o.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(a||n)&&(this.isLayoutDirty=!0),e){let r,n=0;const a=()=>this.root.updateBlockedByResize=!1;SI.read(()=>{n=window.innerWidth}),e(t,()=>{const e=window.innerWidth;e!==n&&(n=e,this.root.updateBlockedByResize=!0,r&&r(),r=function(e,t){const r=AI.now(),n=({timestamp:a})=>{const o=a-r;o>=t&&(kI(n),e(o-t))};return SI.setup(n,!0),()=>kI(n)}(a,250),dL.hasAnimatedSinceResize&&(dL.hasAnimatedSinceResize=!1,this.nodes.forEach(AL)))})}n&&this.root.registerSharedNode(n,this),!1!==this.options.animate&&o&&(n||a)&&this.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:r,layout:n})=>{if(this.isTreeAnimationBlocked())return this.target=void 0,void(this.relativeTarget=void 0);const a=this.options.transition||o.getDefaultTransition()||PL,{onLayoutAnimationStart:i,onLayoutAnimationComplete:s}=o.getProps(),l=!this.targetLayout||!KO(this.targetLayout,n),c=!t&&r;if(this.options.layoutRoot||this.resumeFrom||c||t&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const t={...Jz(a,"layout"),onPlay:i,onComplete:s};(o.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,c,t.path)}else t||AL(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=n})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),kI(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(EL),this.animationId++)}getTransformTemplate(){const{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked())return void(this.options.onExitComplete&&this.options.onExitComplete());if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&fL(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let a=0;a<this.path.length;a++){const e=this.path[a];e.shouldResetTransform=!0,"string"!=typeof e.latestValues.x&&"string"!=typeof e.latestValues.y||(e.isLayoutDirty=!0),e.updateScroll("snapshot"),e.options.layoutRoot&&e.willUpdate(!1)}const{layoutId:t,layout:r}=this.options;if(void 0===t&&!r)return;const n=this.getTransformTemplate();this.prevTransformTemplateValue=n?n(this.latestValues,""):void 0,this.updateSnapshot(),e&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const e=this.updateBlockedByResize;return this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),e&&this.nodes.forEach(kL),void this.nodes.forEach(SL)}if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(CL);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(NL),this.nodes.forEach(TL),this.nodes.forEach(vL),this.nodes.forEach(yL)):this.nodes.forEach(CL),this.clearAllSnapshots();const e=AI.now();CI.delta=BE(0,1e3/60,e-CI.timestamp),CI.timestamp=e,CI.isProcessing=!0,NI.update.process(CI),NI.preRender.process(CI),NI.render.process(CI),CI.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,q_.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(wL),this.sharedNodes.forEach(IL)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,SI.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){SI.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||zO(this.snapshot.measuredBox.x)||zO(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance)return;if(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead()||this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let r=0;r<this.path.length;r++)this.path[r].updateScroll();const e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected={x:{min:0,max:0},y:{min:0,max:0}}),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:t}=this.options;t&&t.notify("LayoutMeasure",this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e="measure"){let t=Boolean(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){const t=n(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:r(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!a)return;const e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!UO(this.projectionDelta),r=this.getTransformTemplate(),n=r?r(this.latestValues,""):void 0,o=n!==this.prevTransformTemplateValue;e&&this.instance&&(t||$P(this.latestValues)||o)&&(a(this.instance,n),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){const t=this.measurePageBox();let r=this.removeElementScroll(t);var n;return e&&(r=this.removeTransform(r)),FL((n=r).x),FL(n.y),{animationId:this.root.animationId,measuredBox:t,layoutBox:r,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:e}=this.options;if(!e)return{x:{min:0,max:0},y:{min:0,max:0}};const t=e.measureViewportBox();if(!this.scroll?.wasRoot&&!this.path.some(VL)){const{scroll:e}=this.root;e&&(XP(t.x,e.offset.x),XP(t.y,e.offset.y))}return t}removeElementScroll(e){const t={x:{min:0,max:0},y:{min:0,max:0}};if(IO(t,e),this.scroll?.wasRoot)return t;for(let r=0;r<this.path.length;r++){const n=this.path[r],{scroll:a,options:o}=n;n!==this.root&&a&&o.layoutScroll&&(a.wasRoot&&IO(t,e),XP(t.x,a.offset.x),XP(t.y,a.offset.y))}return t}applyTransform(e,t=!1,r){const n=r||{x:{min:0,max:0},y:{min:0,max:0}};IO(n,e);for(let a=0;a<this.path.length;a++){const e=this.path[a];!t&&e.options.layoutScroll&&e.scroll&&e!==e.root&&(XP(n.x,-e.scroll.offset.x),XP(n.y,-e.scroll.offset.y)),$P(e.latestValues)&&QP(n,e.latestValues,e.layout?.layoutBox)}return $P(this.latestValues)&&QP(n,this.latestValues,this.layout?.layoutBox),n}removeTransform(e){const t={x:{min:0,max:0},y:{min:0,max:0}};IO(t,e);for(let r=0;r<this.path.length;r++){const e=this.path[r];if(!$P(e.latestValues))continue;let n;e.instance&&(VP(e.latestValues)&&e.updateSnapshot(),n=wP(),IO(n,e.measurePageBox())),jO(t,e.latestValues,e.snapshot?.layoutBox,n)}return $P(this.latestValues)&&jO(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:void 0===e.crossfade||e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==CI.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){const t=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=t.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=t.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=t.isSharedProjectionDirty);const r=Boolean(this.resumingFrom)||this!==t;if(!(e||r&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:n,layoutId:a}=this.options;if(!this.layout||!n&&!a)return;this.resolvedRelativeTargetAt=CI.timestamp;const o=this.getClosestProjectingParent();o&&this.linkedParentVersion!==o.layoutVersion&&!o.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(!1!==this.options.layoutAnchor&&o&&o.layout?this.createRelativeTarget(o,this.layout.layoutBox,o.layout.layoutBox):this.removeRelativeTarget()),(this.relativeTarget||this.targetDelta)&&(this.target||(this.target={x:{min:0,max:0},y:{min:0,max:0}},this.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}}),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),function(e,t,r,n){OO(e.x,t.x,r.x,n?.x),OO(e.y,t.y,r.y,n?.y)}(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(Boolean(this.resumingFrom)?this.applyTransform(this.layout.layoutBox,!1,this.target):IO(this.target,this.layout.layoutBox),WP(this.target,this.targetDelta)):IO(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,!1!==this.options.layoutAnchor&&o&&Boolean(o.resumingFrom)===Boolean(this.resumingFrom)&&!o.options.layoutScroll&&o.target&&1!==this.animationProgress?this.createRelativeTarget(o,this.target,o.target):this.relativeParent=this.relativeTarget=void 0),bP.value&&uL.calculatedTargetDeltas++)}getClosestProjectingParent(){if(this.parent&&!VP(this.parent.latestValues)&&!HP(this.parent.latestValues))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return Boolean((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,r){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget={x:{min:0,max:0},y:{min:0,max:0}},this.relativeTargetOrigin={x:{min:0,max:0},y:{min:0,max:0}},FO(this.relativeTargetOrigin,t,r,this.options.layoutAnchor||void 0),IO(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const e=this.getLead(),t=Boolean(this.resumingFrom)||this!==e;let r=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(r=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(r=!1),this.resolvedRelativeTargetAt===CI.timestamp&&(r=!1),r)return;const{layout:n,layoutId:a}=this.options;if(this.isTreeAnimating=Boolean(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!n&&!a)return;IO(this.layoutCorrected,this.layout.layoutBox);const o=this.treeScale.x,i=this.treeScale.y;!function(e,t,r,n=!1){const a=r.length;if(!a)return;let o,i;t.x=t.y=1;for(let s=0;s<a;s++){o=r[s],i=o.projectionDelta;const{visualElement:a}=o.options;a&&a.props.style&&"contents"===a.props.style.display||(n&&o.options.layoutScroll&&o.scroll&&o!==o.root&&(XP(e.x,-o.scroll.offset.x),XP(e.y,-o.scroll.offset.y)),i&&(t.x*=i.x.scale,t.y*=i.y.scale,WP(e,i)),n&&$P(o.latestValues)&&QP(e,o.latestValues,o.layout?.layoutBox))}t.x<YP&&t.x>KP&&(t.x=1),t.y<YP&&t.y>KP&&(t.y=1)}(this.layoutCorrected,this.treeScale,this.path,t),!e.layout||e.target||1===this.treeScale.x&&1===this.treeScale.y||(e.target=e.layout.layoutBox,e.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}});const{target:s}=e;s?(this.projectionDelta&&this.prevProjectionDelta?(RO(this.prevProjectionDelta.x,this.projectionDelta.x),RO(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),PO(this.projectionDelta,this.layoutCorrected,s,this.latestValues),this.treeScale.x===o&&this.treeScale.y===i&&XO(this.projectionDelta.x,this.prevProjectionDelta.x)&&XO(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",s)),bP.value&&uL.calculatedProjections++):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){const e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDeltaWithTransform={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}}}setAnimationOrigin(e,t=!1,r){const n=this.snapshot,a=n?n.latestValues:{},o={...this.latestValues},i={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;const s={x:{min:0,max:0},y:{min:0,max:0}},l=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),d=!c||c.members.length<=1,u=Boolean(l&&!d&&!0===this.options.crossfade&&!this.path.some(_L));let h;this.animationProgress=0;const p=r?.interpolateProjection(e);this.mixTargetDelta=t=>{const r=t/1e3,n=p?.(r);var c,m;n?(i.x.translate=n.x,i.x.scale=dR(e.x.scale,1,r),i.x.origin=e.x.origin,i.x.originPoint=e.x.originPoint,i.y.translate=n.y,i.y.scale=dR(e.y.scale,1,r),i.y.origin=e.y.origin,i.y.originPoint=e.y.originPoint):(RL(i.x,e.x,r),RL(i.y,e.y,r)),this.setTargetDelta(i),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(FO(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),function(e,t,r,n){zL(e.x,t.x,r.x,n),zL(e.y,t.y,r.y,n)}(this.relativeTarget,this.relativeTargetOrigin,s,r),h&&(c=this.relativeTarget,m=h,GO(c.x,m.x)&&GO(c.y,m.y))&&(this.isProjectionDirty=!1),h||(h={x:{min:0,max:0},y:{min:0,max:0}}),IO(h,this.relativeTarget)),l&&(this.animationValues=o,function(e,t,r,n,a,o){a?(e.opacity=dR(0,r.opacity??1,rL(n)),e.opacityExit=dR(t.opacity??1,0,nL(n))):o&&(e.opacity=dR(t.opacity??1,r.opacity??1,n));for(let i=0;i<JO;i++){const a=V_[i];let o=tL(t,a),s=tL(r,a);void 0===o&&void 0===s||(o||(o=0),s||(s=0),0===o||0===s||eL(o)===eL(s)?(e[a]=Math.max(dR(QO(o),QO(s),n),0),(WI.test(s)||WI.test(o))&&(e[a]+="%")):e[a]=s)}(t.rotate||r.rotate)&&(e.rotate=dR(t.rotate||0,r.rotate||0,n))}(o,a,this.latestValues,r,u,d)),n&&void 0!==n.rotate&&(this.animationValues||(this.animationValues=o),this.animationValues.pathRotation=n.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=r},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(kI(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=SI.update(()=>{dL.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Xz(0)),this.motionValue.jump(0,!1),this.currentAnimation=function(e,t,r){const n=m_(e)?e:Xz(e);return n.start(a_("",n,t,r)),n.animation}(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const e=this.getLead();let{targetWithTransforms:t,target:r,layout:n,latestValues:a}=e;if(t&&r&&n){if(this!==e&&this.layout&&n&&BL(this.options.animationType,this.layout.layoutBox,n.layoutBox)){r=this.target||{x:{min:0,max:0},y:{min:0,max:0}};const t=zO(this.layout.layoutBox.x);r.x.min=e.target.x.min,r.x.max=r.x.min+t;const n=zO(this.layout.layoutBox.y);r.y.min=e.target.y.min,r.y.max=r.y.min+n}IO(t,r),QP(t,a),PO(this.projectionDeltaWithTransform,this.layoutCorrected,t,a)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new cL),this.sharedNodes.get(e).add(t);const r=t.options.initialPromotionConfig;t.promote({transition:r?r.transition:void 0,preserveFollowOpacity:r&&r.shouldPreserveFollowOpacity?r.shouldPreserveFollowOpacity(t):void 0})}isLead(){const e=this.getStack();return!e||e.lead===this}getLead(){const{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){const{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:r}={}){const n=this.getStack();n&&n.promote(this,r),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){const e=this.getStack();return!!e&&e.relegate(this)}resetSkewAndRotation(){const{visualElement:e}=this.options;if(!e)return;let t=!1;const{latestValues:r}=e;if((r.z||r.rotate||r.rotateX||r.rotateY||r.rotateZ||r.skewX||r.skewY)&&(t=!0),!t)return;const n={};r.z&&mL("z",e,n,this.animationValues);for(let a=0;a<hL.length;a++)mL(`rotate${hL[a]}`,e,n,this.animationValues),mL(`skew${hL[a]}`,e,n,this.animationValues);e.render();for(const a in n)e.setStaticValue(a,n[a]),this.animationValues&&(this.animationValues[a]=n[a]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible)return void(e.visibility="hidden");const r=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,e.visibility="",e.opacity="",e.pointerEvents=lL(t?.pointerEvents)||"",void(e.transform=r?r(this.latestValues,""):"none");const n=this.getLead();if(!this.projectionDelta||!this.layout||!n.target)return this.options.layoutId&&(e.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,e.pointerEvents=lL(t?.pointerEvents)||""),void(this.hasProjected&&!$P(this.latestValues)&&(e.transform=r?r({},""):"none",this.hasProjected=!1));e.visibility="";const a=n.animationValues||n.latestValues;this.applyTransformsToTarget();let o=function(e,t,r){let n="";const a=e.x.translate/t.x,o=e.y.translate/t.y,i=r?.z||0;if((a||o||i)&&(n=`translate3d(${a}px, ${o}px, ${i}px) `),1===t.x&&1===t.y||(n+=`scale(${1/t.x}, ${1/t.y}) `),r){const{transformPerspective:e,rotate:t,pathRotation:a,rotateX:o,rotateY:i,skewX:s,skewY:l}=r;e&&(n=`perspective(${e}px) ${n}`),t&&(n+=`rotate(${t}deg) `),a&&(n+=`rotate(${a}deg) `),o&&(n+=`rotateX(${o}deg) `),i&&(n+=`rotateY(${i}deg) `),s&&(n+=`skewX(${s}deg) `),l&&(n+=`skewY(${l}deg) `)}const s=e.x.scale*t.x,l=e.y.scale*t.y;return 1===s&&1===l||(n+=`scale(${s}, ${l})`),n||"none"}(this.projectionDeltaWithTransform,this.treeScale,a);r&&(o=r(a,o)),e.transform=o;const{x:i,y:s}=this.projectionDelta;e.transformOrigin=`${100*i.origin}% ${100*s.origin}% 0`,n.animationValues?e.opacity=n===this?a.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:a.opacityExit:e.opacity=n===this?void 0!==a.opacity?a.opacity:"":void 0!==a.opacityExit?a.opacityExit:0;for(const l in lO){if(void 0===a[l])continue;const{correct:t,applyTo:r,isCSSVariable:i}=lO[l],s="none"===o?a[l]:t(a[l],n);if(r){const t=r.length;for(let n=0;n<t;n++)e[r[n]]=s}else i?this.options.visualElement.renderState.vars[l]=s:e[l]=s}this.options.layoutId&&(e.pointerEvents=n===this?lL(t?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(SL),this.root.sharedNodes.clear()}}}function vL(e){e.updateLayout()}function yL(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:n}=e.layout,{animationType:a}=e.options,o=t.source!==e.layout.source;if("size"===a)ZO(e=>{const n=o?t.measuredBox[e]:t.layoutBox[e],a=zO(n);n.min=r[e].min,n.max=n.min+a});else if("x"===a||"y"===a){const e="x"===a?"y":"x";EO(o?t.measuredBox[e]:t.layoutBox[e],r[e])}else BL(a,t.layoutBox,r)&&ZO(n=>{const a=o?t.measuredBox[n]:t.layoutBox[n],i=zO(r[n]);a.max=a.min+i,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[n].max=e.relativeTarget[n].min+i)});const i={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};PO(i,r,t.layoutBox);const s={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};o?PO(s,e.applyTransform(n,!0),t.measuredBox):PO(s,r,t.layoutBox);const l=!UO(i);let c=!1;if(!e.resumeFrom){const n=e.getClosestProjectingParent();if(n&&!n.resumeFrom){const{snapshot:a,layout:o}=n;if(a&&o){const i=e.options.layoutAnchor||void 0,s={x:{min:0,max:0},y:{min:0,max:0}};FO(s,t.layoutBox,a.layoutBox,i);const l={x:{min:0,max:0},y:{min:0,max:0}};FO(l,r,o.layoutBox,i),KO(s,l)||(c=!0),n.options.layoutRoot&&(e.relativeTarget=l,e.relativeTargetOrigin=s,e.relativeParent=n)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:t,delta:s,layoutDelta:i,hasLayoutChanged:l,hasRelativeLayoutChanged:c})}else if(e.isLead()){const{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function bL(e){bP.value&&uL.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=Boolean(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function xL(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function wL(e){e.clearSnapshot()}function SL(e){e.clearMeasurements()}function kL(e){e.isLayoutDirty=!0,e.updateLayout()}function CL(e){e.isLayoutDirty=!1}function NL(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function TL(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function AL(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function ML(e){e.resolveTargetDelta()}function DL(e){e.calcProjection()}function EL(e){e.resetSkewAndRotation()}function IL(e){e.removeLeadSnapshot()}function RL(e,t,r){e.translate=dR(t.translate,0,r),e.scale=dR(t.scale,1,r),e.origin=t.origin,e.originPoint=t.originPoint}function zL(e,t,r,n){e.min=dR(t.min,r.min,n),e.max=dR(t.max,r.max,n)}function _L(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}var PL={duration:.45,ease:[.4,0,.1,1]},OL=e=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),LL=OL("applewebkit/")&&!OL("chrome/")?Math.round:WE;function FL(e){e.min=LL(e.min),e.max=LL(e.max)}function BL(e,t,r){return"position"===e||"preserve-aspect"===e&&!function(e,t,r){return Math.abs(e-t)<=r}(YO(t),YO(r),.2)}function VL(e){return e!==e.root&&e.scroll?.wasRoot}var $L=gL({attachResizeListener:(e,t)=>oL(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),HL={current:void 0},jL=gL({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!HL.current){const e=new $L({});e.mount(window),e.setOptions({layoutScroll:!0}),HL.current=e}return HL.current},resetTransform:(e,t)=>{e.style.transform=void 0!==t?t:"none"},checkIsScrollRoot:e=>Boolean("fixed"===window.getComputedStyle(e).position)}),qL=te({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function UL(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function GL(...e){return X.useCallback(function(...e){return t=>{let r=!1;const n=e.map(e=>{const n=UL(e,t);return r||"function"!=typeof n||(r=!0),n});if(r)return()=>{for(let t=0;t<n.length;t++){const r=n[t];"function"==typeof r?r():UL(e[t],null)}}}}(...e),e)}var WL=class extends X.Component{getSnapshotBeforeUpdate(e){const t=this.props.childRef.current;if(j_(t)&&e.isPresent&&!this.props.isPresent&&!1!==this.props.pop){const e=t.offsetParent,r=j_(e)&&e.offsetWidth||0,n=j_(e)&&e.offsetHeight||0,a=getComputedStyle(t),o=this.props.sizeRef.current;o.height=parseFloat(a.height),o.width=parseFloat(a.width),o.top=t.offsetTop,o.left=t.offsetLeft,o.right=r-o.width-o.left,o.bottom=n-o.height-o.top,o.direction=a.direction}return null}componentDidUpdate(){}render(){return this.props.children}};function KL({children:e,isPresent:t,anchorX:r,anchorY:n,root:a,pop:o}){const i=ce(),s=me(null),l=me({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:c}=se(qL),d=!1!==o?e.props?.ref??e?.ref:void 0,u=GL(s,d);return ue(()=>{const{width:e,height:d,top:u,left:h,right:p,bottom:m,direction:f}=l.current;if(t||!1===o||!s.current||!e||!d)return;const g="rtl"===f,v="left"===r?g?`right: ${p}`:`left: ${h}`:g?`left: ${h}`:`right: ${p}`,y="bottom"===n?`bottom: ${m}`:`top: ${u}`;s.current.dataset.motionPopId=i;const b=document.createElement("style");c&&(b.nonce=c);const x=a??document.head;return x.appendChild(b),b.sheet&&b.sheet.insertRule(`\n [data-motion-pop-id="${i}"] {\n position: absolute !important;\n width: ${e}px !important;\n height: ${d}px !important;\n ${v}px !important;\n ${y}px !important;\n }\n `),()=>{s.current?.removeAttribute("data-motion-pop-id"),x.contains(b)&&x.removeChild(b)}},[t]),be(WL,{isPresent:t,childRef:s,sizeRef:l,pop:o,children:!1===o?e:X.cloneElement(e,{ref:u})})}var YL=({children:e,initial:t,isPresent:r,onExitComplete:n,custom:a,presenceAffectsLayout:o,mode:i,anchorX:s,anchorY:l,root:c})=>{const d=_E(XL),u=ce(),h=me(r),p=me(n);PE(()=>{h.current=r,p.current=n});let m=!0,f=pe(()=>(m=!1,{id:u,initial:t,isPresent:r,custom:a,onExitComplete:e=>{d.set(e,!0);for(const t of d.values())if(!t)return;n&&n()},register:e=>(d.set(e,!1),()=>{d.delete(e),!h.current&&!d.size&&p.current?.()})}),[r,d,n]);return o&&m&&(f={...f}),pe(()=>{d.forEach((e,t)=>d.set(t,!1))},[r]),X.useEffect(()=>{!r&&!d.size&&n&&n()},[r]),e=be(KL,{pop:"popLayout"===i,isPresent:r,anchorX:s,anchorY:l,root:c,children:e}),be(OE.Provider,{value:f,children:e})};function XL(){/* @__PURE__ */
450
- return new Map}function ZL(e=!0){const t=se(OE);if(null===t)return[!0,null];const{isPresent:r,onExitComplete:n,register:a}=t,o=ce();le(()=>{if(e)return a(o)},[e]);const i=ie(()=>e&&n&&n(o),[o,n,e]);return!r&&n?[!1,i]:[!0]}var JL=e=>e.key||"";function QL(e){const t=[];return J.forEach(e,e=>{ae(e)&&t.push(e)}),t}var eF=({children:e,custom:t,initial:r=!0,onExitComplete:n,presenceAffectsLayout:a=!0,mode:o="sync",propagate:i=!1,anchorX:s="left",anchorY:l="top",root:c})=>{const[d,u]=ZL(i),h=pe(()=>QL(e),[e]),p=i&&!d?[]:h.map(JL),m=me(!0),f=me(h),g=_E(()=>/* @__PURE__ */new Map),v=me(/* @__PURE__ */new Set),[y,b]=fe(h),[x,w]=fe(h);PE(()=>{!i||d||x.length||u?.()},[d,i,x.length,u]),PE(()=>{m.current=!1,f.current=h;for(let e=0;e<x.length;e++){const t=JL(x[e]);p.includes(t)?(g.delete(t),v.current.delete(t)):!0!==g.get(t)&&g.set(t,!1)}},[x,p.length,p.join("-")]);const S=[];if(h!==y){let e=[...h],t=0;for(const r of x){const n=p.indexOf(JL(r));-1===n?(e.splice(t++,0,r),S.push(r)):t=n+S.length+1}return"wait"===o&&S.length&&(e=S),w(QL(e)),b(h),null}"production"!==process.env.NODE_ENV&&"wait"===o&&x.length;const{forceRender:k}=se(zE);return be(ye,{children:x.map(e=>{const y=JL(e),b=!(i&&!d)&&(h===x||p.includes(y));return be(YL,{isPresent:b,initial:!(m.current&&!r)&&void 0,custom:t,presenceAffectsLayout:a,mode:o,root:c,onExitComplete:b?void 0:()=>{if(v.current.has(y))return;if(!g.has(y))return;v.current.add(y),g.set(y,!0);let e=!0;g.forEach(t=>{t||(e=!1)}),e&&(k?.(),w(f.current),i&&u?.(),n&&n())},anchorX:s,anchorY:l,children:e},y)})})},tF=te({strict:!1}),rF={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},nF=!1;function aF(){return function(){if(nF)return;const e={};for(const t in rF)e[t]={isEnabled:e=>rF[t].some(t=>!!e[t])};_P(e),nF=!0}(),zP}var oF=/* @__PURE__ */te({});function iF(e){const{initial:t,animate:r}=function(e,t){if(AP(e)){const{initial:t,animate:r}=e;return{initial:!1===t||CP(t)?t:void 0,animate:CP(r)?r:void 0}}return!1!==e.inherit?t:{}}(e,se(oF));return pe(()=>({initial:t,animate:r}),[sF(t),sF(r)])}function sF(e){return Array.isArray(e)?e.join(" "):e}var lF=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function cF(e,t,r){for(const n in t)m_(t[n])||cO(n,r)||(e[n]=t[n])}function dF(e,t){const r={};return cF(r,e.style||{},e),Object.assign(r,function({transformTemplate:e},t){return pe(()=>{const r={style:{},transform:{},transformOrigin:{},vars:{}};return nO(r,t,e),Object.assign({},r.vars,r.style)},[t])}(e,t)),r}function uF(e,t){const r={},n=dF(e,t);return e.drag&&!1!==e.dragListener&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=!0===e.drag?"none":"pan-"+("x"===e.drag?"y":"x")),void 0===e.tabIndex&&(e.onTap||e.onTapStart||e.whileTap)&&(r.tabIndex=0),r.style=n,r}var hF=()=>({style:{},transform:{},transformOrigin:{},vars:{},attrs:{}});function pF(e,t,r,n){const a=pe(()=>{const r={style:{},transform:{},transformOrigin:{},vars:{},attrs:{}};return fO(r,t,vO(n),e.transformTemplate,e.style),{...r.attrs,style:{...r.style}}},[t]);if(e.style){const t={};cF(t,e.style,e),a.style={...t,...a.style}}return a}var mF=/* @__PURE__ */new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function fF(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||mF.has(e)}function gF(e,t){return e.startsWith("on")?!fF(e):t?.(e)??!fF(e)}var vF=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function yF(e){return"string"==typeof e&&!e.includes("-")&&!!(vF.indexOf(e)>-1||/[A-Z]/u.test(e))}function bF(e,t,r,{latestValues:n},a,o=!1,i,s){const l=(i??yF(e)?pF:uF)(t,n,a,e),c=function(e,t,r,n){const a={};for(const o in e)"values"===o&&"object"==typeof e.values||m_(e[o])||(gF(o,n)||!0===r&&fF(o)||!t&&!fF(o)||e.draggable&&o.startsWith("onDrag"))&&(a[o]=e[o]);return a}(t,"string"==typeof e,o,s),d=e!==ee?{...c,...l,ref:r}:{},{children:u}=t,h=pe(()=>m_(u)?u.get():u,[u]);return re(e,{...d,children:h})}function xF(e,t,r,n){const a={},o=n(e,{});for(const h in o)a[h]=lL(o[h]);let{initial:i,animate:s}=e;const l=AP(e),c=MP(e);t&&c&&!l&&!1!==e.inherit&&(void 0===i&&(i=t.initial),void 0===s&&(s=t.animate));let d=!!r&&!1===r.initial;d=d||!1===i;const u=d?s:i;if(u&&"boolean"!=typeof u&&!kP(u)){const t=Array.isArray(u)?u:[u];for(let r=0;r<t.length;r++){const n=l_(e,t[r]);if(n){const{transitionEnd:e,transition:t,...r}=n;for(const n in r){let e=r[n];if(Array.isArray(e)){e=e[d?e.length-1:0]}null!==e&&(a[n]=e)}for(const n in e)a[n]=e[n]}}}return a}var wF=e=>(t,r)=>{const n=se(oF),a=se(OE),o=()=>function({scrapeMotionValuesFromProps:e,createRenderState:t},r,n,a){return{latestValues:xF(r,n,a,e),renderState:t()}}(e,t,n,a);return r?o():_E(o)},SF=/*@__PURE__*/wF({scrapeMotionValuesFromProps:dO,createRenderState:lF}),kF=/*@__PURE__*/wF({scrapeMotionValuesFromProps:yO,createRenderState:hF}),CF=Symbol.for("motionComponentSymbol");function NF(e,t,r){const n=me(r);ue(()=>{n.current=r});const a=me(null);return ie(r=>{r&&e.onMount?.(r),t&&(r?t.mount(r):t.unmount());const o=n.current;if("function"==typeof o)if(r){const e=o(r);"function"==typeof e&&(a.current=e)}else a.current?(a.current(),a.current=null):o(r);else o&&(o.current=r)},[t])}var TF=te({});function AF(e){return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function MF(e,t,r,n,a,o){const{visualElement:i}=se(oF),s=se(tF),l=se(OE),c=se(qL),d=c.reducedMotion,u=c.skipAnimations,h=me(null),p=me(!1);n=n||s.renderer,!h.current&&n&&(h.current=n(e,{visualState:t,parent:i,props:r,presenceContext:l,blockInitialAnimation:!!l&&!1===l.initial,reducedMotionConfig:d,skipAnimations:u,isSVG:o}),p.current&&h.current&&(h.current.manuallyAnimateOnMount=!0));const m=h.current,f=se(TF);!m||m.projection||!a||"html"!==m.type&&"svg"!==m.type||function(e,t,r,n){const{layoutId:a,layout:o,drag:i,dragConstraints:s,layoutScroll:l,layoutRoot:c,layoutAnchor:d,layoutCrossfade:u}=t;e.projection=new r(e.latestValues,t["data-framer-portal-id"]?void 0:DF(e.parent)),e.projection.setOptions({layoutId:a,layout:o,alwaysMeasureLayout:Boolean(i)||s&&AF(s),visualElement:e,animationType:"string"==typeof o?o:"both",initialPromotionConfig:n,crossfade:u,layoutScroll:l,layoutRoot:c,layoutAnchor:d})}(h.current,r,a,f);const g=me(!1);ue(()=>{m&&g.current&&m.update(r,l)});const v=r[v_],y=me(Boolean(v)&&"undefined"!=typeof window&&!window.MotionHandoffIsComplete?.(v)&&window.MotionHasOptimisedAnimation?.(v));return PE(()=>{p.current=!0,m&&(g.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),y.current&&m.animationState&&m.animationState.animateChanges())}),le(()=>{m&&(!y.current&&m.animationState&&m.animationState.animateChanges(),y.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(v)}),y.current=!1),m.enteringChildren=void 0)}),m}function DF(e){if(e)return!1!==e.options.allowProjection?e.projection:DF(e.parent)}function EF(e,{forwardMotionProps:t=!1,type:r}={},n,a){n&&function(e){const t=aF();for(const r in e)t[r]={...t[r],...e[r]};_P(t)}(n);const o=r?"svg"===r:yF(e),i=o?kF:SF;function s(r,s){let l;const c={...se(qL),...r,layoutId:IF(r)},{isStatic:d,isValidProp:u}=c,h=iF(r),p=i(r,d);if(!d&&"undefined"!=typeof window){!function(e,t){const r=se(tF).strict;if("production"!==process.env.NODE_ENV&&t&&r){const t="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";e.ignoreStrict?VE(!1,t,"lazy-strict-mode"):$E(!1,t,"lazy-strict-mode")}}(c,n);const t=function(e){const{drag:t,layout:r}=aF();if(!t&&!r)return{};const n={...t,...r};return{MeasureLayout:t?.isEnabled(e)||r?.isEnabled(e)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}(c);l=t.MeasureLayout,h.visualElement=MF(e,p,c,a,t.ProjectionNode,o)}return xe(oF.Provider,{value:h,children:[l&&h.visualElement?be(l,{visualElement:h.visualElement,...c}):null,bF(e,r,NF(p,h.visualElement,s),p,d,t,o,u)]})}s.displayName=`motion.${"string"==typeof e?e:`create(${e.displayName??e.name??""})`}`;const l=ne(s);return l[CF]=e,l}function IF({layoutId:e}){const t=se(zE).id;return t&&void 0!==e?t+"-"+e:e}function RF(e,t){if("undefined"==typeof Proxy)return EF;const r=/* @__PURE__ */new Map,n=(r,n)=>EF(r,n,e,t);return new Proxy((e,t)=>("production"!==process.env.NODE_ENV&&tI(!1,"motion() is deprecated. Use motion.create() instead."),n(e,t)),{get:(a,o)=>"create"===o?n:(r.has(o)||r.set(o,EF(o,void 0,e,t)),r.get(o))})}var zF=(e,t)=>t.isSVG??yF(e)?new bO(t):new uO(t,{allowProjection:e!==ee}),_F=0,PF={animation:{Feature:class extends LP{constructor(e){super(e),e.animationState||(e.animationState=TO(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();kP(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}},exit:{Feature:class extends LP{constructor(){super(...arguments),this.id=_F++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;if(e&&!1===r){if(this.isExitComplete){const{initial:e,custom:t}=this.node.getProps();if("string"==typeof e||"object"==typeof e&&null!==e&&!Array.isArray(e)){const r=c_(this.node,e,t);if(r){const{transition:e,transitionEnd:t,...n}=r;for(const r in n)this.node.getValue(r)?.jump(n[r])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);return void(this.isExitComplete=!1)}const n=this.node.animationState.setActive("exit",!e);t&&!e&&n.then(()=>{this.isExitComplete=!0,t(this.id)})}mount(){const{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}}};function OF(e){return{point:{x:e.pageX,y:e.pageY}}}function LF(e,t,r,n){return oL(e,t,(e=>t=>Z_(t)&&e(t,OF(t)))(r),n)}var FF=({current:e})=>e?e.ownerDocument.defaultView:null,BF=(e,t)=>Math.abs(e-t);var VF=/*#__PURE__*/new Set(["auto","scroll"]),$F=class{constructor(e,t,{transformPagePoint:r,contextWindow:n=window,dragSnapToOrigin:a=!1,distanceThreshold:o=3,element:i}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=/* @__PURE__ */new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=HF(this.lastRawMoveEventInfo,this.transformPagePoint));const e=qF(this.lastMoveEventInfo,this.history),t=null!==this.startEvent,r=function(e,t){const r=BF(e.x,t.x),n=BF(e.y,t.y);return Math.sqrt(r**2+n**2)}(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!r)return;const{point:n}=e,{timestamp:a}=CI;this.history.push({...n,timestamp:a});const{onStart:o,onMove:i}=this.handlers;t||(o&&o(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),i&&i(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastRawMoveEventInfo=t,this.lastMoveEventInfo=HF(t,this.transformPagePoint),SI.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();const{onEnd:r,onSessionEnd:n,resumeAnimation:a}=this.handlers;if(!this.dragSnapToOrigin&&this.startEvent||a&&a(),!this.lastMoveEvent||!this.lastMoveEventInfo)return;const o=qF("pointercancel"===e.type?this.lastMoveEventInfo:HF(t,this.transformPagePoint),this.history);this.startEvent&&r&&r(e,o),n&&n(e,o)},!Z_(e))return;this.dragSnapToOrigin=a,this.handlers=t,this.transformPagePoint=r,this.distanceThreshold=o,this.contextWindow=n||window;const s=HF(OF(e),this.transformPagePoint),{point:l}=s,{timestamp:c}=CI;this.history=[{...l,timestamp:c}];const{onSessionStart:d}=t;d&&d(e,qF(s,this.history));const u={passive:!0,capture:!0};this.removeListeners=KE(LF(this.contextWindow,"pointermove",this.handlePointerMove,u),LF(this.contextWindow,"pointerup",this.handlePointerUp,u),LF(this.contextWindow,"pointercancel",this.handlePointerUp,u)),i&&this.startScrollTracking(i)}startScrollTracking(e){let t=e.parentElement;for(;t;){const e=getComputedStyle(t);(VF.has(e.overflowX)||VF.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const t=this.scrollPositions.get(e);if(!t)return;const r=e===window,n=r?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},a=n.x-t.x,o=n.y-t.y;0===a&&0===o||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=a,this.lastMoveEventInfo.point.y+=o):this.history.length>0&&(this.history[0].x-=a,this.history[0].y-=o),this.scrollPositions.set(e,n),SI.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),kI(this.updatePoint)}};function HF(e,t){return t?{point:t(e.point)}:e}function jF(e,t){return{x:e.x-t.x,y:e.y-t.y}}function qF({point:e},t){return{point:e,delta:jF(e,GF(t)),offset:jF(e,UF(t)),velocity:WF(t,.1)}}function UF(e){return e[0]}function GF(e){return e[e.length-1]}function WF(e,t){if(e.length<2)return{x:0,y:0};let r=e.length-1,n=null;const a=GF(e);for(;r>=0&&(n=e[r],!(a.timestamp-n.timestamp>ZE(t)));)r--;if(!n)return{x:0,y:0};n===e[0]&&e.length>2&&a.timestamp-n.timestamp>2*ZE(t)&&(n=e[1]);const o=JE(a.timestamp-n.timestamp);if(0===o)return{x:0,y:0};const i={x:(a.x-n.x)/o,y:(a.y-n.y)/o};return i.x===1/0&&(i.x=0),i.y===1/0&&(i.y=0),i}function KF(e,t,r){return{min:void 0!==t?e.min+t:void 0,max:void 0!==r?e.max+r-(e.max-e.min):void 0}}function YF(e,t){let r=t.min-e.min,n=t.max-e.max;return t.max-t.min<e.max-e.min&&([r,n]=[n,r]),{min:r,max:n}}var XF=.35;function ZF(e,t,r){return{min:JF(e,t),max:JF(e,r)}}function JF(e,t){return"number"==typeof e?e:e[t]||0}var QF=/* @__PURE__ */new WeakMap,eB=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic={x:{min:0,max:0},y:{min:0,max:0}},this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:r}={}){const{presenceContext:n}=this.visualElement;if(n&&!1===n.isPresent)return;const{dragSnapToOrigin:a}=this.getProps();this.panSession=new $F(e,{onSessionStart:e=>{t&&this.snapToCursor(OF(e).point),this.stopAnimation()},onStart:(e,t)=>{const{drag:r,dragPropagation:n,onDragStart:a}=this.getProps();if(r&&!n&&(this.openDragLock&&this.openDragLock(),this.openDragLock="x"===(o=r)||"y"===o?G_[o]?null:(G_[o]=!0,()=>{G_[o]=!1}):G_.x||G_.y?null:(G_.x=G_.y=!0,()=>{G_.x=G_.y=!1}),!this.openDragLock))return;var o;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),ZO(e=>{let t=this.getAxisMotionValue(e).get()||0;if(WI.test(t)){const{projection:r}=this.visualElement;if(r&&r.layout){const n=r.layout.layoutBox[e];n&&(t=zO(n)*(parseFloat(t)/100))}}this.originPoint[e]=t}),a&&SI.update(()=>a(e,t),!1,!0),f_(this.visualElement,"transform");const{animationState:i}=this.visualElement;i&&i.setActive("whileDrag",!0)},onMove:(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;const{dragPropagation:r,dragDirectionLock:n,onDirectionLock:a,onDrag:o}=this.getProps();if(!r&&!this.openDragLock)return;const{offset:i}=t;if(n&&null===this.currentDirection)return this.currentDirection=function(e,t=10){let r=null;Math.abs(e.y)>t?r="y":Math.abs(e.x)>t&&(r="x");return r}(i),void(null!==this.currentDirection&&a&&a(this.currentDirection));this.updateAxis("x",t.point,i),this.updateAxis("y",t.point,i),this.visualElement.render(),o&&SI.update(()=>o(e,t),!1,!0)},onSessionEnd:(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},resumeAnimation:()=>{const{dragSnapToOrigin:e}=this.getProps();(e||this.constraints)&&this.startAnimation({x:0,y:0})}},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:a,distanceThreshold:r,contextWindow:FF(this.visualElement),element:this.visualElement.current})}stop(e,t){const r=e||this.latestPointerEvent,n=t||this.latestPanInfo,a=this.isDragging;if(this.cancel(),!a||!n||!r)return;const{velocity:o}=n;this.startAnimation(o);const{onDragEnd:i}=this.getProps();i&&SI.postRender(()=>i(r,n))}cancel(){this.isDragging=!1;const{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,r){const{drag:n}=this.getProps();if(!r||!rB(e,n,this.currentDirection))return;const a=this.getAxisMotionValue(e);let o=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(o=function(e,{min:t,max:r},n){return void 0!==t&&e<t?e=n?dR(t,e,n.min):Math.max(e,t):void 0!==r&&e>r&&(e=n?dR(r,e,n.max):Math.min(e,r)),e}(o,this.constraints[e],this.elastic[e])),a.set(o)}resolveConstraints(){const{dragConstraints:e,dragElastic:t}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,n=this.constraints;e&&AF(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!e||!r)&&function(e,{top:t,left:r,bottom:n,right:a}){return{x:KF(e.x,r,a),y:KF(e.y,t,n)}}(r.layoutBox,e),this.elastic=function(e=XF){return!1===e?e=0:!0===e&&(e=XF),{x:ZF(e,"left","right"),y:ZF(e,"top","bottom")}}(t),n!==this.constraints&&!AF(e)&&r&&this.constraints&&!this.hasMutatedConstraints&&ZO(e=>{!1!==this.constraints&&this.getAxisMotionValue(e)&&(this.constraints[e]=function(e,t){const r={};return void 0!==t.min&&(r.min=t.min-e.min),void 0!==t.max&&(r.max=t.max-e.min),r}(r.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!AF(e))return!1;const r=e.current;$E(null!==r,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:n}=this.visualElement;if(!n||!n.layout)return!1;n.root&&(n.root.scroll=void 0,n.root.updateScroll());const a=function(e,t,r){const n=eO(e,r),{scroll:a}=t;return a&&(XP(n.x,a.offset.x),XP(n.y,a.offset.y)),n}(r,n.root,this.visualElement.getTransformPagePoint());let o=function(e,t){return{x:YF(e.x,t.x),y:YF(e.y,t.y)}}(n.layout.layoutBox,a);if(t){const e=t(function({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}(o));this.hasMutatedConstraints=!!e,e&&(o=FP(e))}return o}startAnimation(e){const{drag:t,dragMomentum:r,dragElastic:n,dragTransition:a,dragSnapToOrigin:o,onDragTransitionEnd:i}=this.getProps(),s=this.constraints||{},l=ZO(i=>{if(!rB(i,t,this.currentDirection))return;let l=s&&s[i]||{};!0!==o&&o!==i||(l={min:0,max:0});const c=n?200:1e6,d=n?40:1e7,u={type:"inertia",velocity:r?e[i]:0,bounceStiffness:c,bounceDamping:d,timeConstant:750,restDelta:1,restSpeed:10,...a,...l};return this.startAxisValueAnimation(i,u)});return Promise.all(l).then(i)}startAxisValueAnimation(e,t){const r=this.getAxisMotionValue(e);return f_(this.visualElement,e),r.start(a_(e,r,0,t,this.visualElement,!1))}stopAnimation(){ZO(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const t=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps()[t];return r||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor(e){ZO(t=>{const{drag:r}=this.getProps();if(!rB(t,r,this.currentDirection))return;const{projection:n}=this.visualElement,a=this.getAxisMotionValue(t);if(n&&n.layout){const{min:r,max:o}=n.layout.layoutBox[t],i=a.get()||0;a.set(e[t]-dR(r,o,.5)+i)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:r}=this.visualElement;if(!AF(t)||!r||!this.constraints)return;this.stopAnimation();const n={x:0,y:0};ZO(e=>{const t=this.getAxisMotionValue(e);if(t&&!1!==this.constraints){const r=t.get();n[e]=function(e,t){let r=.5;const n=zO(e),a=zO(t);return a>n?r=YE(t.min,t.max-n,e.min):n>a&&(r=YE(e.min,e.max-a,t.min)),BE(0,1,r)}({min:r,max:r},this.constraints[e])}});const{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),ZO(t=>{if(!rB(t,e,null))return;const r=this.getAxisMotionValue(t),{min:a,max:o}=this.constraints[t];r.set(dR(a,o,n[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;QF.set(this.visualElement,this);const e=this.visualElement.current,t=LF(e,"pointerdown",t=>{const{drag:r,dragListener:n=!0}=this.getProps(),a=t.target,o=a!==e&&function(e){return Q_.has(e.tagName)||!0===e.isContentEditable}(a);r&&n&&!o&&this.start(t)});let r;const n=()=>{const{dragConstraints:t}=this.getProps();AF(t)&&t.current&&(this.constraints=this.resolveRefConstraints(),r||(r=function(e,t,r){const n=yP(e,tB(r)),a=yP(t,tB(r));return()=>{n(),a()}}(e,t.current,()=>this.scalePositionWithinConstraints())))},{projection:a}=this.visualElement,o=a.addEventListener("measure",n);a&&!a.layout&&(a.root&&a.root.updateScroll(),a.updateLayout()),SI.read(n);const i=oL(window,"resize",()=>this.scalePositionWithinConstraints()),s=a.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(ZO(t=>{const r=this.getAxisMotionValue(t);r&&(this.originPoint[t]+=e[t].translate,r.set(r.get()+e[t].translate))}),this.visualElement.render())});return()=>{i(),t(),o(),s&&s(),r&&r()}}getProps(){const e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:r=!1,dragPropagation:n=!1,dragConstraints:a=!1,dragElastic:o=XF,dragMomentum:i=!0}=e;return{...e,drag:t,dragDirectionLock:r,dragPropagation:n,dragConstraints:a,dragElastic:o,dragMomentum:i}}};function tB(e){let t=!0;return()=>{t?t=!1:e()}}function rB(e,t,r){return!(!0!==t&&t!==e||null!==r&&r!==e)}var nB=e=>(t,r)=>{e&&SI.update(()=>e(t,r),!1,!0)},aB=!1,oB=class extends Q{componentDidMount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:r,layoutId:n}=this.props,{projection:a}=e;a&&(t.group&&t.group.add(a),r&&r.register&&n&&r.register(a),aB&&a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions({...a.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),dL.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:t,visualElement:r,drag:n,isPresent:a}=this.props,{projection:o}=r;return o?(o.isPresent=a,e.layoutDependency!==t&&o.setOptions({...o.options,layoutDependency:t}),aB=!0,n||e.layoutDependency!==t||void 0===t||e.isPresent!==a?o.willUpdate():this.safeToRemove(),e.isPresent!==a&&(a?o.promote():o.relegate()||SI.postRender(()=>{const e=o.getStack();e&&e.members.length||this.safeToRemove()})),null):null}componentDidUpdate(){const{visualElement:e,layoutAnchor:t}=this.props,{projection:r}=e;r&&(r.options.layoutAnchor=t,r.root.didUpdate(),q_.postRender(()=>{!r.currentAnimation&&r.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:r}=this.props,{projection:n}=e;aB=!0,n&&(n.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(n),r&&r.deregister&&r.deregister(n))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}};function iB(e){const[t,r]=ZL(),n=se(zE);return be(oB,{...e,layoutGroup:n,switchLayoutGroup:se(TF),isPresent:t,safeToRemove:r})}var sB={pan:{Feature:class extends LP{constructor(){super(...arguments),this.removePointerDownListener=WE}onPointerDown(e){this.session=new $F(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:FF(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:r,onPanEnd:n}=this.node.getProps();return{onSessionStart:nB(e),onStart:nB(t),onMove:nB(r),onEnd:(e,t)=>{delete this.session,n&&SI.postRender(()=>n(e,t))}}}mount(){this.removePointerDownListener=LF(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends LP{constructor(e){super(e),this.removeGroupControls=WE,this.removeListeners=WE,this.controls=new eB(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||WE}update(){const{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},ProjectionNode:jL,MeasureLayout:iB}};function lB(e,t,r){const{props:n}=e;e.animationState&&n.whileHover&&e.animationState.setActive("whileHover","Start"===r);const a=n["onHover"+r];a&&SI.postRender(()=>a(t,OF(t)))}function cB(e,t,r){const{props:n}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&n.whileTap&&e.animationState.setActive("whileTap","Start"===r);const a=n["onTap"+("End"===r?"":r)];a&&SI.postRender(()=>a(t,OF(t)))}var dB=/* @__PURE__ */new WeakMap,uB=/* @__PURE__ */new WeakMap,hB=e=>{const t=dB.get(e.target);t&&t(e)},pB=e=>{e.forEach(hB)};function mB(e,t,r){const n=function({root:e,...t}){const r=e||document;uB.has(r)||uB.set(r,{});const n=uB.get(r),a=JSON.stringify(t);return n[a]||(n[a]=new IntersectionObserver(pB,{root:e,...t})),n[a]}(t);return dB.set(e,r),n.observe(e),()=>{dB.delete(e),n.unobserve(e)}}var fB={some:0,all:1};var gB=/*@__PURE__*/RF({...PF,...{inView:{Feature:class extends LP{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();const{viewport:e={}}=this.node.getProps(),{root:t,margin:r,amount:n="some",once:a}=e,o={root:t?t.current:void 0,rootMargin:r,threshold:"number"==typeof n?n:fB[n]};this.stopObserver=mB(this.node.current,o,e=>{const{isIntersecting:t}=e;if(this.isInView===t)return;if(this.isInView=t,a&&!t&&this.hasEnteredView)return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",t);const{onViewportEnter:r,onViewportLeave:n}=this.node.getProps(),o=t?r:n;o&&o(e)})}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;const{props:e,prevProps:t}=this.node;["amount","margin","root"].some(function({viewport:e={}},{viewport:t={}}={}){return r=>e[r]!==t[r]}(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}},tap:{Feature:class extends LP{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:t,propagate:r}=this.node.props;this.unmount=oP(e,(e,t)=>(cB(this.node,t,"Start"),(e,{success:t})=>cB(this.node,e,t?"End":"Cancel")),{useGlobalTarget:t,stopPropagation:!1===r?.tap})}unmount(){}}},focus:{Feature:class extends LP{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch(t){e=!0}e&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=KE(oL(this.node.current,"focus",()=>this.onFocus()),oL(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends LP{mount(){const{current:e}=this.node;e&&(this.unmount=Y_(e,(e,t)=>(lB(this.node,t,"Start"),e=>lB(this.node,e,"End"))))}unmount(){}}}},...sB,...{layout:{ProjectionNode:jL,MeasureLayout:iB}}},zF),vB={type:"tween",ease:[.22,1,.36,1],duration:.5};function yB({percentage:e}){const t=24,r=10.75,n=2*Math.PI*r,a=n-e/100*n;/* @__PURE__ */
451
- return xe("svg",{width:t,height:t,className:"-rotate-90 shrink-0",children:[/* @__PURE__ */be("circle",{cx:12,cy:12,r:r,fill:"none",stroke:"var(--muted)",strokeWidth:2.5}),/* @__PURE__ */be(gB.circle,{cx:12,cy:12,r:r,fill:"none",stroke:"var(--foreground)",strokeWidth:2.5,strokeDasharray:n,initial:{strokeDashoffset:n},animate:{strokeDashoffset:a},transition:{duration:.15,ease:"easeOut"},strokeLinecap:"round"})]})}function bB({headings:e,onNavigate:t,editorRef:r}){const[n,a]=fe(null),[o,i]=fe(null),[s,l]=fe(!1),[c,d]=fe(0),[u,h]=fe(44),p=me(null);le(()=>{const e=()=>{const e=document.querySelector(".toolbar");e&&h(e.getBoundingClientRect().bottom+6)};e();const t=document.querySelector(".toolbar");if(!t)return;const r=new ResizeObserver(e);return r.observe(t),()=>r.disconnect()},[]);const m=pe(()=>0===e.length?1:Math.min(...e.map(([,,e])=>parseInt(e[1],10))),[e]);if(le(()=>{(()=>{if(!r?.current)return;const t=e[0]?.[0];if(!t)return;const n=r.current.getElementByKey(t);if(!n)return;let a=n.parentElement;for(;a;){const e=window.getComputedStyle(a);if("auto"===e.overflowY||"scroll"===e.overflowY)return void(p.current=a);a=a.parentElement}p.current=null})()},[e,r]),le(()=>{if(0===e.length)return;const t=e=>r?.current?.getElementByKey(e)??null,n=()=>{const r=p.current,n=r?r.scrollTop:window.scrollY,o=r?r.clientHeight:window.innerHeight,i=(r?r.scrollHeight:document.documentElement.scrollHeight)-o;d(i>0?Math.min(100,Math.max(0,n/i*100)):0);const s=.3*o;let l=null;for(const[a]of e){const e=t(a);if(!e)continue;const n=e.getBoundingClientRect(),o=r?r.getBoundingClientRect().top:0;if(!(n.top-o<=s))break;l=a}!l&&e.length>0&&(l=e[0][0]),a(l)},o=p.current??window;return o.addEventListener("scroll",n,{passive:!0}),n(),()=>o.removeEventListener("scroll",n)},[e,r]),0===e.length)return null;const f=e.find(([e])=>e===n)?.[1]??"Contents";/* @__PURE__ */
452
- return xe(ye,{children:[/* @__PURE__ */be(eF,{children:s&&/* @__PURE__ */be(gB.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:vB,className:"fixed inset-0 z-[9998] bg-black/20 backdrop-blur-[4px]",onClick:()=>l(!1)})}),/* @__PURE__ */be(gB.div,{initial:{y:-50,opacity:0},animate:{y:0,opacity:1},transition:{type:"spring",stiffness:300,damping:25},style:{top:u},className:"fixed left-1/2 z-[9999] flex -translate-x-1/2 flex-col items-center",children:/* @__PURE__ */xe(gB.div,{onClick:()=>{s||l(!0)},initial:!1,animate:{width:s?340:280,height:s?400:52,borderRadius:s?24:26},transition:vB,style:{cursor:s?"default":"pointer"},className:"relative overflow-hidden border border-foreground/10 bg-background text-foreground shadow-2xl",children:[/* @__PURE__ */xe(gB.div,{initial:!1,animate:{opacity:s?0:1,scale:s?.95:1,filter:s?"blur(4px)":"blur(0px)"},transition:{...vB,delay:s?0:.1},className:ec("absolute inset-0 flex items-center gap-4 px-4 sm:px-5",s&&"pointer-events-none"),children:[
445
+ /* @__PURE__ */be($M,{open:e,onOpenChange:t,documents:u,onSelectDocument:b,onOpenSettings:()=>n(!0),onOpenTeams:()=>i(!0),onToggleTheme:x,currentTheme:w}),
446
+ /* @__PURE__ */be(YD,{open:r,onOpenChange:n,initialSection:a,defaultSidebarView:m,onDefaultSidebarViewChange:f,enableDatabaseSync:g,onEnableDatabaseSyncChange:v}),
447
+ /* @__PURE__ */be(xE,{open:o,onOpenChange:i}),
448
+ /* @__PURE__ */be(SE,{open:s,onOpenChange:l,documentTitle:h?.title||"Untitled",documentId:h?.id||"",sharingInfo:h?.sharing,onUpdateSharing:e=>{h&&y(t=>t.map(t=>t.id===h.id?{...t,sharing:e}:t))}}),
449
+ /* @__PURE__ */be(kE,{open:c,onOpenChange:d,currentTags:p&&u.find(e=>e.id===p)?.tags||[],onUpdateTags:S})]})}function NE(e,t){const r=[],n=t=>{for(const a of e)a.parentId===t&&(r.push(a.id),n(a.id))};return n(t),r}function TE(e,t){const r=/* @__PURE__ */new Set([t,...NE(e,t)]);let n=e.findIndex(e=>e.id===t);if(-1===n)return e.length;for(let a=n;a<e.length;a++)r.has(e[a].id)&&(n=a);return n+1}function AE(e){const t=KM(),[r,n]=fe(!1),[a,o]=fe(!1),[i,s]=fe(!1),[l,c]=fe(!1),[d,u]=fe(!1),[h,p]=fe(!1),[m,f]=fe(!1),[g,v]=fe(null),[y,b]=vE("REASON-default-sidebar-view","last-used"),[x,w]=vE("REASON-left-panels",["openTabs","files"]),[S,k]=vE("REASON-right-panels",[]),[C,N]=vE("REASON-show-dynamic-island",!1),[T,A]=vE("REASON-sidebar-width",25),[M,D]=fe(null),[E,I]=fe(!1),R=me(null),[z,_]=fe([]),[P,O]=vE("REASON-documents",Hb),[L,F]=vE("REASON-active-doc",P.length>0?P[0].id:null),[B,V]=vE("REASON-open-tabs",P.length>0?[P[0].id]:[]),[$,H]=fe([]),[j,q]=fe(null),[U,G]=fe(""),[W,K]=fe(null),[Y,X]=fe(Uf()),[Z,J]=vE("REASON-enable-db-sync",!1),{isSyncing:Q,lastSyncTime:ee,saveDocument:te,deleteDocument:re,queueDocumentForSync:ne}=function(e,t,r={}){const{enableSync:n=!1,syncInterval:a=5e3}=r,[o,i]=fe(!1),[s,l]=fe(null),c=me(/* @__PURE__ */new Map),d=me(void 0),u=ie(async()=>{if(n)try{const e=(await Nt("doc/documents")).map(e=>({id:e.id.toString(),title:e.title||e.name||"Untitled",content:e.content||"",parentId:e.parentId?e.parentId.toString():null,children:[],isExpanded:1===e.isExpanded,isFolder:1===e.isFolder,tags:e.metadata&&JSON.parse(e.metadata).tags||[],metadata:e.metadata?JSON.parse(e.metadata):void 0}));return t(e),l(/* @__PURE__ */new Date),e}catch(e){return _D.error("Failed to load documents from database"),null}},[n,t]),h=ie(async e=>{if(n)try{const r={name:e.title||"Untitled",title:e.title||"Untitled",content:e.content||"",parentId:e.parentId?parseInt(e.parentId):null,isFolder:e.isFolder||!1,metadata:{tags:e.tags||[],isExpanded:e.isExpanded||!1,...e.metadata}};if(isNaN(parseInt(e.id))){const n=await Nt("doc/documents",{method:"POST",headers:{"Content-Type":"application/json"},body:r});return t(t=>t.map(t=>t.id===e.id?{...t,id:n.id.toString()}:t)),n}return await Nt(`doc/documents/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:r})}catch(r){return _D.error("Failed to save document to database"),null}},[n,t]),p=ie(async()=>{if(n&&0!==c.current.size){i(!0);try{const e=Array.from(c.current.values());await Promise.all(e.map(e=>h(e))),c.current.clear(),l(/* @__PURE__ */new Date)}catch(e){}finally{i(!1)}}},[n,h]),m=ie(e=>{n&&(c.current.set(e.id,e),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{p()},2e3))},[n,p]),f=ie(async e=>{if(n)try{return await Nt(`doc/documents/${e}`,{method:"DELETE"}),!0}catch(t){return _D.error("Failed to delete document from database"),!1}},[n]);return le(()=>{if(!n||a<=0)return;const e=setInterval(()=>{c.current.size>0&&p()},a);return()=>clearInterval(e)},[n,a,p]),le(()=>()=>{d.current&&clearTimeout(d.current)},[]),{isSyncing:o,lastSyncTime:s,loadFromDatabase:u,saveDocument:h,deleteDocument:f,queueDocumentForSync:m,syncPendingChanges:p}}(0,O,{enableSync:Z,syncInterval:5e3}),ae=e=>{const t=/* @__PURE__ */new Map,r=[];return e.forEach(e=>{t.set(e.id,{...e,children:[]})}),e.forEach(e=>{const n=t.get(e.id);e.parentId&&t.has(e.parentId)?t.get(e.parentId).children.push(n):r.push(n)}),r},oe=pe(()=>ae(P),[P]),se=P.find(e=>e.id===L);le(()=>{document.title=se?.title?`${se.title} - Reason Docs`:"Reason - Powerful Note-Taking App"},[se?.title]),le(()=>{_([])},[L]);const ce=pe(()=>{const e=P.filter(e=>!e.isDeleted);if(!U.trim())return e;const t=U.toLowerCase();return e.filter(e=>e.title.toLowerCase().includes(t)||e.content.toLowerCase().includes(t))},[P,U]),de=pe(()=>U.trim()?ae(ce):oe,[ce,U]),ue=async(e,t=!1)=>{let r=null;if(e){const t=P.find(t=>t.id===e);t&&(r=t.isFolder?e:t.parentId)}const n={id:Date.now().toString(),title:t?"New Folder":"",content:"",parentId:r,children:[],isExpanded:t,isFolder:t,tags:[]};O([...P,n]),Z&&await te(n),t||(F(n.id),V([...B,n.id])),K(n.id),setTimeout(()=>K(null),500),r&&O(e=>e.map(e=>e.id===r?{...e,isExpanded:!0}:e)),_D.success(t?"Folder created":"Note created")},he=async e=>{const t=e=>[e,...P.filter(t=>t.parentId===e).flatMap(e=>t(e.id))],r=t(e),n=P.filter(e=>!r.includes(e.id));if(O(n),Z)for(const o of r)await re(o);const a=B.filter(e=>!r.includes(e));V(a),L&&r.includes(L)&&F(a.length>0?a[0]:n.length>0?n[0].id:null),_D.success("Note deleted")},ge=e=>{O(t=>t.map(t=>t.id===e?{...t,isExpanded:!t.isExpanded}:t))};le(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&"k"===e.key&&(e.preventDefault(),s(!0))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),le(()=>{e&&(w(e=>e.includes("files")?e:["files",...e]),n(!0))},[e]),le(()=>{const e="REASON-open-tabs-default-restored";try{if(window.localStorage.getItem(e))return;window.localStorage.setItem(e,"1")}catch{return}"tree"!==y&&"outline"!==y&&w(e=>e.includes("openTabs")?e:[...e,"openTabs"])},[]),le(()=>{"tree"===y?w(["files"]):"outline"===y?w(["outline"]):"split"===y&&w(["openTabs","files","outline"])},[]);const ve=e=>{const t=function(e,t,r){const n=new Set(r.filter(t=>e.includes(t)));if(0===n.size)return{openTabs:e,activeTabId:t,closed:[]};const a=e.filter(e=>!n.has(e)),o=e.filter(e=>n.has(e));if(!t||!n.has(t))return{openTabs:a,activeTabId:t,closed:o};const i=e.indexOf(t);let s=null;for(let l=i-1;l>=0&&null===s;l--)n.has(e[l])||(s=e[l]);for(let l=i+1;l<e.length&&null===s;l++)n.has(e[l])||(s=e[l]);return{openTabs:a,activeTabId:s,closed:o}}(B,L,e);0!==t.closed.length&&(H([...t.closed,...$].slice(0,10)),V(t.openTabs),t.activeTabId!==L&&F(t.activeTabId))},ye=e=>{ve([e])},be=()=>{if(0===$.length)return;const[e,...t]=$;P.find(t=>t.id===e)?(B.includes(e)||V([...B,e]),F(e),H(t),_D.success("Tab reopened")):(H(t),t.length>0&&be())},xe=()=>{k(e=>e.filter(e=>"ai"!==e)),w(e=>e.length>1?e.filter(e=>"ai"!==e):e)};return le(()=>{L&&!P.find(e=>e.id===L)&&F(P.length>0?P[0].id:null)},[P,L,F]),{isMobile:t,isSidebarOpen:r,setIsSidebarOpen:n,isRightSidebarOpen:a,setIsRightSidebarOpen:o,isSearchModalOpen:i,setIsSearchModalOpen:s,isSettingsOpen:l,setIsSettingsOpen:c,isTeamsOpen:d,setIsTeamsOpen:u,isInviteModalOpen:h,setIsInviteModalOpen:p,isTagDialogOpen:m,setIsTagDialogOpen:f,tagManagementDocId:g,defaultSidebarView:y,setDefaultSidebarView:b,leftPanels:x,setLeftPanels:w,rightPanels:S,setRightPanels:k,showDynamicIsland:C,setShowDynamicIsland:N,sidebarWidth:T,setSidebarWidth:A,aiSuggestion:M,setAiSuggestion:D,isAiLoading:E,setIsAiLoading:I,editorRef:R,headings:z,setHeadings:_,documents:P,setDocuments:O,activeDocId:L,setActiveDocId:F,openTabs:B,setOpenTabs:V,closedTabsHistory:$,splitViewDocId:j,setSplitViewDocId:q,searchQuery:U,setSearchQuery:G,newDocumentId:W,activeFileSourceId:Y,enableDatabaseSync:Z,setEnableDatabaseSync:J,isSyncing:Q,lastSyncTime:ee,documentTree:oe,activeDocument:se,filteredDocuments:ce,filteredTree:de,handleAddDocument:ue,handleDeleteDocument:he,handleDuplicateDocument:e=>{const t=P.find(t=>t.id===e);if(!t)return;const r={...t,id:Date.now().toString(),title:t.title+" (Copy)",children:[]};O([...P,r]),F(r.id),V([...B,r.id]),_D.success("Note duplicated")},handleUpdateDocument:(e,t)=>{O(r=>r.map(r=>{if(r.id===e){const e={...r,...t};return Z&&ne(e),e}return r}))},handleToggleExpand:ge,handleSetExpandedFolders:e=>{const t=new Set(e);O(e=>e.map(e=>{const r=t.has(e.id);return!!e.isExpanded===r?e:{...e,isExpanded:r}}))},handleMoveDocument:(e,t,r)=>{if(e===t)return;if(t&&NE(P,e).includes(t))return void _D.error("Cannot move a note into its own child");const n=function(e,t,r,n){if(!e.find(e=>e.id===t)||t===r)return e;if(r&&!e.some(e=>e.id===r))return e;const a=/* @__PURE__ */new Set([t,...NE(e,t)]);if(r&&a.has(r))return e;const o=r?e.find(e=>e.id===r):void 0,i="child"===n?r:o?.parentId??null,s=e.filter(e=>a.has(e.id)).map(e=>e.id===t?{...e,parentId:i}:e),l=e.filter(e=>!a.has(e.id));let c;return c="before"===n?l.findIndex(e=>e.id===r):"after"===n||r?TE(l,r):l.length,c<0&&(c=l.length),[...l.slice(0,c),...s,...l.slice(c)]}(P,e,t,r);if(n!==P){if(O(n),Z){const t=n.find(t=>t.id===e);t&&ne(t)}_D.success("Note moved")}},handleAddTag:(e,t)=>{O(r=>r.map(r=>r.id===e?{...r,tags:[...r.tags||[],t]}:r))},handleRemoveTag:(e,t)=>{O(r=>r.map(r=>r.id===e?{...r,tags:(r.tags||[]).filter(e=>e!==t)}:r))},handleManageTags:e=>{v(e),f(!0)},handleFileSourceChange:async e=>{X(e),Gf(e);const t=function(){let e=jf(),t=Uf();return e.find(e=>e.id===t)||Hf}();try{"local"!==t.type?_D.info(`Source switching for ${t.type} not yet implemented in standalone mode`):_D.success("Switched to local storage")}catch(r){_D.error("Failed to load documents from source")}},handleUpdateTags:e=>{g&&(O(t=>t.map(t=>t.id===g?{...t,tags:e}:t)),_D.success("Tags updated"))},handleRestoreDocument:e=>{O(t=>t.map(t=>t.id===e?{...t,isDeleted:!1}:t)),_D.success("Note restored")},handlePermanentDelete:e=>{const t=e=>[e,...P.filter(t=>t.parentId===e).flatMap(e=>t(e.id))],r=t(e),n=P.filter(e=>!r.includes(e.id));O(n);const a=B.filter(e=>!r.includes(e));V(a),L&&r.includes(L)&&F(a.length>0?a[0]:n.length>0?n[0].id:null),_D.success("Note permanently deleted")},handleTabChange:e=>{F(e)},handleTabClose:ye,handleTabsClose:ve,handleTabAdd:()=>{ue(null)},handleTabDelete:e=>{ye(e),he(e)},handleReopenLastClosed:be,handleSplitRight:e=>{q(e),_D.success("Split view enabled")},handleSelectDocument:e=>{P.find(t=>t.id===e)?.isFolder?ge(e):(B.includes(e)||V([...B,e]),F(e))},handleAIRewrite:async(e,t)=>{_D.info("AI rewrite is not yet available for this editor")},handleAIApprove:()=>{D(null),xe()},handleAIReject:()=>{D(null),xe()},handleAIRegenerate:async e=>{_D.info("AI rewrite is not yet available for this editor")}}}var ME=te({});function DE(e){const t=me(null);return null===t.current&&(t.current=e()),t.current}var EE="undefined"!=typeof window?he:le,IE=/* @__PURE__ */te(null);function RE(e,t){-1===e.indexOf(t)&&e.push(t)}function zE(e,t){const r=e.indexOf(t);r>-1&&e.splice(r,1)}var _E=(e,t,r)=>r>t?t:r<e?e:r;var PE=()=>{},OE=()=>{};"undefined"!=typeof process&&"production"!==process.env.NODE_ENV&&(PE=(e,t,r)=>{},OE=(e,t,r)=>{if(!e)throw new Error(function(e,t){return t?`${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}`:e}(t,r))});var LE={},FE=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),BE=e=>"object"==typeof e&&null!==e,VE=e=>/^0[^.\s]+$/u.test(e);function $E(e){let t;return()=>(void 0===t&&(t=e()),t)}var HE=e=>e,jE=(...e)=>e.reduce((e,t)=>r=>t(e(r))),qE=(e,t,r)=>{const n=t-e;return n?(r-e)/n:1},UE=class{constructor(){this.subscriptions=[]}add(e){return RE(this.subscriptions,e),()=>zE(this.subscriptions,e)}notify(e,t,r){const n=this.subscriptions.length;if(n)if(1===n)this.subscriptions[0](e,t,r);else for(let a=0;a<n;a++){const n=this.subscriptions[a];n&&n(e,t,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},GE=e=>1e3*e,WE=e=>e/1e3,KE=(e,t)=>t?e*(1e3/t):0,YE=/* @__PURE__ */new Set;function XE(e,t,r){e||YE.has(t)||YE.add(t)}var ZE=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e;function JE(e,t,r,n){if(e===t&&r===n)return HE;const a=t=>function(e,t,r,n,a){let o,i,s=0;do{i=t+(r-t)/2,o=ZE(i,n,a)-e,o>0?r=i:t=i}while(Math.abs(o)>1e-7&&++s<12);return i}(t,0,1,e,r);return e=>0===e||1===e?e:ZE(a(e),t,n)}var QE=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,eI=e=>t=>1-e(1-t),tI=/*@__PURE__*/JE(.33,1.53,.69,.99),rI=/*@__PURE__*/eI(tI),nI=/*@__PURE__*/QE(rI),aI=e=>e>=1?1:(e*=2)<1?.5*rI(e):.5*(2-Math.pow(2,-10*(e-1))),oI=e=>1-Math.sin(Math.acos(e)),iI=eI(oI),sI=QE(oI),lI=/*@__PURE__*/JE(.42,0,1,1),cI=/*@__PURE__*/JE(0,0,.58,1),dI=/*@__PURE__*/JE(.42,0,.58,1),uI=e=>Array.isArray(e)&&"number"==typeof e[0],hI={linear:HE,easeIn:lI,easeInOut:dI,easeOut:cI,circIn:oI,circInOut:sI,circOut:iI,backIn:rI,backInOut:nI,backOut:tI,anticipate:aI},pI=e=>{if(uI(e)){OE(4===e.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[t,r,n,a]=e;return JE(t,r,n,a)}return"string"==typeof e?(OE(void 0!==hI[e],`Invalid easing type '${e}'`,"invalid-easing-type"),hI[e]):e},mI=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function fI(e,t){let r=!1,n=!0;const a={delta:0,timestamp:0,isProcessing:!1},o=()=>r=!0,i=mI.reduce((e,t)=>(e[t]=function(e){let t=/* @__PURE__ */new Set,r=/* @__PURE__ */new Set,n=!1,a=!1;const o=/* @__PURE__ */new WeakSet;let i={delta:0,timestamp:0,isProcessing:!1};function s(t){o.has(t)&&(l.schedule(t),e()),t(i)}const l={schedule:(e,a=!1,i=!1)=>{const s=i&&n?t:r;return a&&o.add(e),s.add(e),e},cancel:e=>{r.delete(e),o.delete(e)},process:e=>{if(i=e,n)return void(a=!0);n=!0;const o=t;t=r,r=o,t.forEach(s),t.clear(),n=!1,a&&(a=!1,l.process(e))}};return l}(o),e),{}),{setup:s,read:l,resolveKeyframes:c,preUpdate:d,update:u,preRender:h,render:p,postRender:m}=i,f=()=>{const o=LE.useManualTiming,i=o?a.timestamp:performance.now();r=!1,o||(a.delta=n?1e3/60:Math.max(Math.min(i-a.timestamp,40),1)),a.timestamp=i,a.isProcessing=!0,s.process(a),l.process(a),c.process(a),d.process(a),u.process(a),h.process(a),p.process(a),m.process(a),a.isProcessing=!1,r&&t&&(n=!1,e(f))};return{schedule:mI.reduce((t,o)=>{const s=i[o];return t[o]=(t,o=!1,i=!1)=>(r||(r=!0,n=!0,a.isProcessing||e(f)),s.schedule(t,o,i)),t},{}),cancel:e=>{for(let t=0;t<mI.length;t++)i[mI[t]].cancel(e)},state:a,steps:i}}var gI,{schedule:vI,cancel:yI,state:bI,steps:xI}=/* @__PURE__ */fI("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:HE,!0);function wI(){gI=void 0}var SI={now:()=>(void 0===gI&&SI.set(bI.isProcessing||LE.useManualTiming?bI.timestamp:performance.now()),gI),set:e=>{gI=e,queueMicrotask(wI)}},kI=e=>t=>"string"==typeof t&&t.startsWith(e),CI=/*@__PURE__*/kI("--"),NI=/*@__PURE__*/kI("var(--"),TI=e=>!!NI(e)&&AI.test(e.split("/*")[0].trim()),AI=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function MI(e){return"string"==typeof e&&e.split("/*")[0].includes("var(--")}var DI={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},EI={...DI,transform:e=>_E(0,1,e)},II={...DI,default:1},RI=e=>Math.round(1e5*e)/1e5,zI=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;var _I=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,PI=(e,t)=>r=>Boolean("string"==typeof r&&_I.test(r)&&r.startsWith(e)||t&&!function(e){return null==e}(r)&&Object.prototype.hasOwnProperty.call(r,t)),OI=(e,t,r)=>n=>{if("string"!=typeof n)return n;const[a,o,i,s]=n.match(zI);return{[e]:parseFloat(a),[t]:parseFloat(o),[r]:parseFloat(i),alpha:void 0!==s?parseFloat(s):1}},LI={...DI,transform:e=>Math.round((e=>_E(0,255,e))(e))},FI={test:/*@__PURE__*/PI("rgb","red"),parse:/*@__PURE__*/OI("red","green","blue"),transform:({red:e,green:t,blue:r,alpha:n=1})=>"rgba("+LI.transform(e)+", "+LI.transform(t)+", "+LI.transform(r)+", "+RI(EI.transform(n))+")"};var BI={test:/*@__PURE__*/PI("#"),parse:function(e){let t="",r="",n="",a="";return e.length>5?(t=e.substring(1,3),r=e.substring(3,5),n=e.substring(5,7),a=e.substring(7,9)):(t=e.substring(1,2),r=e.substring(2,3),n=e.substring(3,4),a=e.substring(4,5),t+=t,r+=r,n+=n,a+=a),{red:parseInt(t,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:a?parseInt(a,16)/255:1}},transform:FI.transform},VI=e=>({test:t=>"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),$I=/*@__PURE__*/VI("deg"),HI=/*@__PURE__*/VI("%"),jI=/*@__PURE__*/VI("px"),qI=/*@__PURE__*/VI("vh"),UI=/*@__PURE__*/VI("vw"),GI=/*@__PURE__*/(()=>({...HI,parse:e=>HI.parse(e)/100,transform:e=>HI.transform(100*e)}))(),WI={test:/*@__PURE__*/PI("hsl","hue"),parse:/*@__PURE__*/OI("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:r,alpha:n=1})=>"hsla("+Math.round(e)+", "+HI.transform(RI(t))+", "+HI.transform(RI(r))+", "+RI(EI.transform(n))+")"},KI={test:e=>FI.test(e)||BI.test(e)||WI.test(e),parse:e=>FI.test(e)?FI.parse(e):WI.test(e)?WI.parse(e):BI.parse(e),transform:e=>"string"==typeof e?e:e.hasOwnProperty("red")?FI.transform(e):WI.transform(e),getAnimatableNone:e=>{const t=KI.parse(e);return t.alpha=0,KI.transform(t)}},YI=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;var XI="number",ZI="color",JI=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function QI(e){const t=e.toString(),r=[],n={color:[],number:[],var:[]},a=[];let o=0;return{values:r,split:t.replace(JI,e=>(KI.test(e)?(n.color.push(o),a.push(ZI),r.push(KI.parse(e))):e.startsWith("var(")?(n.var.push(o),a.push("var"),r.push(e)):(n.number.push(o),a.push(XI),r.push(parseFloat(e))),++o,"${}")).split("${}"),indexes:n,types:a}}function eR({split:e,types:t}){const r=e.length;return n=>{let a="";for(let o=0;o<r;o++)if(a+=e[o],void 0!==n[o]){const e=t[o];a+=e===XI?RI(n[o]):e===ZI?KI.transform(n[o]):n[o]}return a}}var tR=(e,t)=>"number"==typeof e?t?.trim().endsWith("/")?e:0:(e=>"number"==typeof e?0:KI.test(e)?KI.getAnimatableNone(e):e)(e);var rR={test:function(e){return isNaN(e)&&"string"==typeof e&&(e.match(zI)?.length||0)+(e.match(YI)?.length||0)>0},parse:function(e){return QI(e).values},createTransformer:function(e){return eR(QI(e))},getAnimatableNone:function(e){const t=QI(e);return eR(t)(t.values.map((e,r)=>tR(e,t.split[r])))}};function nR(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function aR(e,t){return r=>r>0?t:e}var oR=(e,t,r)=>e+(t-e)*r,iR=(e,t,r)=>{const n=e*e,a=r*(t*t-n)+n;return a<0?0:Math.sqrt(a)},sR=[BI,FI,WI];function lR(e){const t=(e=>sR.find(t=>t.test(e)))(e);if(PE(Boolean(t),`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!Boolean(t))return!1;let r=t.parse(e);return t===WI&&(r=function({hue:e,saturation:t,lightness:r,alpha:n}){e/=360,r/=100;let a=0,o=0,i=0;if(t/=100){const n=r<.5?r*(1+t):r+t-r*t,s=2*r-n;a=nR(s,n,e+1/3),o=nR(s,n,e),i=nR(s,n,e-1/3)}else a=o=i=r;return{red:Math.round(255*a),green:Math.round(255*o),blue:Math.round(255*i),alpha:n}}(r)),r}var cR=(e,t)=>{const r=lR(e),n=lR(t);if(!r||!n)return aR(e,t);const a={...r};return e=>(a.red=iR(r.red,n.red,e),a.green=iR(r.green,n.green,e),a.blue=iR(r.blue,n.blue,e),a.alpha=oR(r.alpha,n.alpha,e),FI.transform(a))},dR=/* @__PURE__ */new Set(["none","hidden"]);function uR(e,t){return r=>oR(e,t,r)}function hR(e){return"number"==typeof e?uR:"string"==typeof e?TI(e)?aR:KI.test(e)?cR:fR:Array.isArray(e)?pR:"object"==typeof e?KI.test(e)?cR:mR:aR}function pR(e,t){const r=[...e],n=r.length,a=e.map((e,r)=>hR(e)(e,t[r]));return e=>{for(let t=0;t<n;t++)r[t]=a[t](e);return r}}function mR(e,t){const r={...e,...t},n={};for(const a in r)void 0!==e[a]&&void 0!==t[a]&&(n[a]=hR(e[a])(e[a],t[a]));return e=>{for(const t in n)r[t]=n[t](e);return r}}var fR=(e,t)=>{const r=rR.createTransformer(t),n=QI(e),a=QI(t);return n.indexes.var.length===a.indexes.var.length&&n.indexes.color.length===a.indexes.color.length&&n.indexes.number.length>=a.indexes.number.length?dR.has(e)&&!a.values.length||dR.has(t)&&!n.values.length?function(e,t){return dR.has(e)?r=>r<=0?e:t:r=>r>=1?t:e}(e,t):jE(pR(function(e,t){const r=[],n={color:0,var:0,number:0};for(let a=0;a<t.values.length;a++){const o=t.types[a],i=e.indexes[o][n[o]],s=e.values[i]??0;r[a]=s,n[o]++}return r}(n,a),a.values),r):(PE(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),aR(e,t))};function gR(e,t,r){return"number"==typeof e&&"number"==typeof t&&"number"==typeof r?oR(e,t,r):hR(e)(e,t)}var vR=e=>{const t=({timestamp:t})=>e(t);return{start:(e=!0)=>vI.update(t,e),stop:()=>yI(t),now:()=>bI.isProcessing?bI.timestamp:SI.now()}},yR=(e,t,r=10)=>{let n="";const a=Math.max(Math.round(t/r),2);for(let o=0;o<a;o++)n+=Math.round(1e4*e(o/(a-1)))/1e4+", ";return`linear(${n.substring(0,n.length-2)})`},bR=2e4;function xR(e,t=50,r=2e4,n){let a=0,o=e.next(a);for(n?.push(o.value);!o.done&&a<r;)a+=t,o=e.next(a),n?.push(o.value);return a>=r?1/0:a}var wR=100,SR=10,kR=1,CR=0,NR=800,TR=.3,AR=.3,MR={granular:.01,default:2},DR={granular:.005,default:.5},ER=.01,IR=10,RR=.05,zR=1;function _R(e,t){return e*Math.sqrt(1-t*t)}var PR=["duration","bounce"],OR=["stiffness","damping","mass"];function LR(e,t){return t.some(t=>void 0!==e[t])}function FR(e){let t={velocity:CR,stiffness:wR,damping:SR,mass:kR,isResolvedFromDuration:!1,...e};if(!LR(e,OR)&&LR(e,PR))if(t.velocity=0,e.visualDuration){const r=e.visualDuration,n=2*Math.PI/(1.2*r),a=n*n,o=2*_E(.05,1,1-(e.bounce||0))*Math.sqrt(a);t={...t,mass:kR,stiffness:a,damping:o}}else{const r=function({duration:e=NR,bounce:t=TR,velocity:r=CR,mass:n=kR}){let a,o;PE(e<=GE(IR),"Spring duration must be 10 seconds or less","spring-duration-limit");let i=1-t;i=_E(RR,zR,i),e=_E(ER,IR,WE(e)),i<1?(a=t=>{const n=t*i,a=n*e;return.001-(n-r)/_R(t,i)*Math.exp(-a)},o=t=>{const n=t*i*e,o=n*r+r,s=i*i*t*t*e,l=Math.exp(-n),c=_R(t*t,i);return(.001-a(t)>0?-1:1)*((o-s)*l)/c}):(a=t=>Math.exp(-t*e)*((t-r)*e+1)-.001,o=t=>Math.exp(-t*e)*(e*e*(r-t)));const s=function(e,t,r){let n=r;for(let a=1;a<12;a++)n-=e(n)/t(n);return n}(a,o,5/e);if(e=GE(e),isNaN(s))return{stiffness:wR,damping:SR,duration:e};{const t=s*s*n;return{stiffness:t,damping:2*i*Math.sqrt(n*t),duration:e}}}({...e,velocity:0});t={...t,...r,mass:kR},t.isResolvedFromDuration=!0}return t}function BR(e=AR,t=TR){const r="object"!=typeof e?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:n,restDelta:a}=r;const o=r.keyframes[0],i=r.keyframes[r.keyframes.length-1],s={done:!1,value:o},{stiffness:l,damping:c,mass:d,duration:u,velocity:h,isResolvedFromDuration:p}=FR({...r,velocity:-WE(r.velocity||0)}),m=h||0,f=c/(2*Math.sqrt(l*d)),g=i-o,v=WE(Math.sqrt(l/d)),y=f*v,b=Math.abs(g)<5;let x,w;if(n||(n=b?MR.granular:MR.default),a||(a=b?DR.granular:DR.default),f<1){const e=_R(v,f),t=(m+y*g)/e,r=y*t+g*e,n=y*g-t*e;let a=-1,o=0,s=0;const l=l=>{if(l!==a){a=l;const c=Math.exp(-y*l),d=Math.sin(e*l),u=Math.cos(e*l);o=i-c*(t*d+g*u),s=c*(r*d+n*u)}};x=e=>(l(e),o),w=e=>(l(e),s)}else if(1===f){x=e=>i-Math.exp(-v*e)*(g+(m+v*g)*e);const e=m+v*g;w=t=>Math.exp(-v*t)*(v*e*t-m)}else{const e=v*Math.sqrt(f*f-1);x=t=>{const r=Math.exp(-y*t),n=Math.min(e*t,300);return i-r*((m+y*g)*Math.sinh(n)+e*g*Math.cosh(n))/e};const t=(m+y*g)/e,r=y*t-g*e,n=y*g-t*e;w=t=>{const a=Math.exp(-y*t),o=Math.min(e*t,300);return a*(r*Math.sinh(o)+n*Math.cosh(o))}}const S={calculatedDuration:p&&u||null,velocity:e=>GE(w(e)),next:e=>{const t=x(e);if(p)s.done=e>=u;else{const r=GE(w(e));s.done=Math.abs(r)<=n&&Math.abs(i-t)<=a}return s.value=s.done?i:t,s},toString:()=>{const e=Math.min(xR(S),bR),t=yR(t=>S.next(e*t).value,e,30);return e+"ms "+t},toTransition:()=>{}};return S}function VR({keyframes:e,velocity:t=0,power:r=.8,timeConstant:n=325,bounceDamping:a=10,bounceStiffness:o=500,modifyTarget:i,min:s,max:l,restDelta:c=.5,restSpeed:d}){const u=e[0],h={done:!1,value:u},p=e=>void 0===s?l:void 0===l||Math.abs(s-e)<Math.abs(l-e)?s:l;let m=r*t;const f=u+m,g=void 0===i?f:i(f);g!==f&&(m=g-u);const v=e=>-m*Math.exp(-e/n),y=e=>{const t=v(e);h.done=Math.abs(t)<=c,h.value=h.done?g:g+t};let b,x;const w=e=>{(e=>e<s||e>l)(h.value)&&(b=e,x=BR({keyframes:[h.value,p(h.value)],velocity:-v(e)/n*1e3,damping:a,stiffness:o,restDelta:c,restSpeed:d}))};return w(0),{calculatedDuration:null,next:e=>{let t=!1;return x||void 0!==b||(t=!0,y(e),w(e)),void 0!==b&&e>=b?x.next(e-b):(!t&&y(e),h)}}}function $R(e,t,{clamp:r=!0,ease:n,mixer:a}={}){const o=e.length;if(OE(o===t.length,"Both input and output ranges must be the same length","range-length"),1===o)return()=>t[0];if(2===o&&t[0]===t[1])return()=>t[1];const i=e[0]===e[1];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const s=function(e,t,r){const n=[],a=r||LE.mix||gR,o=e.length-1;for(let i=0;i<o;i++){let r=a(e[i],e[i+1]);if(t){const e=Array.isArray(t)?t[i]||HE:t;r=jE(e,r)}n.push(r)}return n}(t,n,a),l=s.length,c=r=>{if(i&&r<e[0])return t[0];let n=0;if(l>1)for(;n<e.length-2&&!(r<e[n+1]);n++);const a=qE(e[n],e[n+1],r);return s[n](a)};return r?t=>c(_E(e[0],e[o-1],t)):c}function HR(e){const t=[0];return function(e,t){const r=e[e.length-1];for(let n=1;n<=t;n++){const a=qE(0,t,n);e.push(oR(r,1,a))}}(t,e.length-1),t}function jR({duration:e=300,keyframes:t,times:r,ease:n="easeInOut"}){const a=(e=>Array.isArray(e)&&"number"!=typeof e[0])(n)?n.map(pI):pI(n),o={done:!1,value:t[0]},i=function(e,t){return e.map(e=>e*t)}(r&&r.length===t.length?r:HR(t),e),s=$R(i,t,{ease:Array.isArray(a)?a:(l=t,c=a,l.map(()=>c||dI).splice(0,l.length-1))});var l,c;return{calculatedDuration:e,next:t=>(o.value=s(t),o.done=t>=e,o)}}BR.applyToOptions=e=>{const t=function(e,t=100,r){const n=r({...e,keyframes:[0,t]}),a=Math.min(xR(n),bR);return{type:"keyframes",ease:e=>n.next(a*e).value/t,duration:WE(a)}}(e,100,BR);return e.ease=t.ease,e.duration=GE(t.duration),e.type="keyframes",e};var qR=e=>null!==e;function UR(e,{repeat:t,repeatType:r="loop"},n,a=1){const o=e.filter(qR),i=a<0||t&&"loop"!==r&&t%2==1?0:o.length-1;return i&&void 0!==n?n:o[i]}var GR={decay:VR,inertia:VR,tween:jR,keyframes:jR,spring:BR};function WR(e){"string"==typeof e.type&&(e.type=GR[e.type])}var KR=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},YR=e=>e/100,XR=class extends KR{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{const{motionValue:e}=this.options;e&&e.updatedAt!==SI.now()&&this.tick(SI.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),!1===e.autoplay&&this.pause()}initAnimation(){const{options:e}=this;WR(e);const{type:t=jR,repeat:r=0,repeatDelay:n=0,repeatType:a,velocity:o=0}=e;let{keyframes:i}=e;const s=t||jR;"production"!==process.env.NODE_ENV&&s!==jR&&OE(i.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${i}`,"spring-two-frames"),s!==jR&&"number"!=typeof i[0]&&(this.mixKeyframes=jE(YR,gR(i[0],i[1])),i=[0,100]);const l=s({...e,keyframes:i});"mirror"===a&&(this.mirroredGenerator=s({...e,keyframes:[...i].reverse(),velocity:-o})),null===l.calculatedDuration&&(l.calculatedDuration=xR(l));const{calculatedDuration:c}=l;this.calculatedDuration=c,this.resolvedDuration=c+n,this.totalDuration=this.resolvedDuration*(r+1)-n,this.generator=l}updateTime(e){const t=Math.round(e-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=t}tick(e,t=!1){const{generator:r,totalDuration:n,mixKeyframes:a,mirroredGenerator:o,resolvedDuration:i,calculatedDuration:s}=this;if(null===this.startTime)return r.next(0);const{delay:l=0,keyframes:c,repeat:d,repeatType:u,repeatDelay:h,type:p,onUpdate:m,finalKeyframe:f}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-n/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);const g=this.currentTime-l*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?g<0:g>n;this.currentTime=Math.max(g,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=n);let y,b=this.currentTime,x=r;if(d){const e=Math.min(this.currentTime,n)/i;let t=Math.floor(e),r=e%1;!r&&e>=1&&(r=1),1===r&&t--,t=Math.min(t,d+1),Boolean(t%2)&&("reverse"===u?(r=1-r,h&&(r-=h/i)):"mirror"===u&&(x=o)),b=_E(0,1,r)*i}v?(this.delayState.value=c[0],y=this.delayState):y=x.next(b),a&&!v&&(y.value=a(y.value));let{done:w}=y;v||null===s||(w=this.playbackSpeed>=0?this.currentTime>=n:this.currentTime<=0);const S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&w);return S&&p!==VR&&(y.value=UR(c,this.options,f,this.speed)),m&&m(y.value),S&&this.finish(),y}then(e,t){return this.finished.then(e,t)}get duration(){return WE(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+WE(e)}get time(){return WE(this.currentTime)}set time(e){e=GE(e),this.currentTime=e,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=e,this.tick(e))}getGeneratorVelocity(){const e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);return function(e,t,r){const n=Math.max(t-5,0);return KE(r-e(n),t-n)}(e=>this.generator.next(e).value,e,this.generator.next(e).value)}get speed(){return this.playbackSpeed}set speed(e){const t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(SI.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=WE(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=vR,startTime:t}=this.options;this.driver||(this.driver=e(e=>this.tick(e))),this.options.onPlay?.();const r=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=r):null!==this.holdTime?this.startTime=r-this.holdTime:this.startTime||(this.startTime=t??r),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(SI.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}};var ZR=e=>180*e/Math.PI,JR=e=>{const t=ZR(Math.atan2(e[1],e[0]));return ez(t)},QR={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:JR,rotateZ:JR,skewX:e=>ZR(Math.atan(e[1])),skewY:e=>ZR(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},ez=e=>((e%=360)<0&&(e+=360),e),tz=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),rz=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),nz={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:tz,scaleY:rz,scale:e=>(tz(e)+rz(e))/2,rotateX:e=>ez(ZR(Math.atan2(e[6],e[5]))),rotateY:e=>ez(ZR(Math.atan2(-e[2],e[0]))),rotateZ:JR,rotate:JR,skewX:e=>ZR(Math.atan(e[4])),skewY:e=>ZR(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function az(e){return e.includes("scale")?1:0}function oz(e,t){if(!e||"none"===e)return az(t);const r=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let n,a;if(r)n=nz,a=r;else{const t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);n=QR,a=t}if(!a)return az(t);const o=n[t],i=a[1].split(",").map(iz);return"function"==typeof o?o(i):i[o]}function iz(e){return parseFloat(e.trim())}var sz=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],lz=/*@__PURE__*/(()=>/* @__PURE__ */new Set([...sz,"pathRotation"]))(),cz=e=>e===DI||e===jI,dz=/* @__PURE__ */new Set(["x","y","z"]),uz=sz.filter(e=>!dz.has(e));var hz={width:({x:e},{paddingLeft:t="0",paddingRight:r="0",boxSizing:n})=>{const a=e.max-e.min;return"border-box"===n?a:a-parseFloat(t)-parseFloat(r)},height:({y:e},{paddingTop:t="0",paddingBottom:r="0",boxSizing:n})=>{const a=e.max-e.min;return"border-box"===n?a:a-parseFloat(t)-parseFloat(r)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>oz(t,"x"),y:(e,{transform:t})=>oz(t,"y")};hz.translateX=hz.x,hz.translateY=hz.y;var pz=/* @__PURE__ */new Set,mz=!1,fz=!1,gz=!1;function vz(){if(fz){const e=Array.from(pz).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),r=/* @__PURE__ */new Map;t.forEach(e=>{const t=function(e){const t=[];return uz.forEach(r=>{const n=e.getValue(r);void 0!==n&&(t.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),t}(e);t.length&&(r.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();const t=r.get(e);t&&t.forEach(([t,r])=>{e.getValue(t)?.set(r)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{void 0!==e.suspendedScrollY&&window.scrollTo(0,e.suspendedScrollY)})}fz=!1,mz=!1,pz.forEach(e=>e.complete(gz)),pz.clear()}function yz(){pz.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(fz=!0)})}var bz=class{constructor(e,t,r,n,a,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=r,this.motionValue=n,this.element=a,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(pz.add(this),mz||(mz=!0,vI.read(yz),vI.resolveKeyframes(vz))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:t,element:r,motionValue:n}=this;if(null===e[0]){const a=n?.get(),o=e[e.length-1];if(void 0!==a)e[0]=a;else if(r&&t){const n=r.readValue(t,o);null!=n&&(e[0]=n)}void 0===e[0]&&(e[0]=o),n&&void 0===a&&n.set(e[0])}!function(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),pz.delete(this)}cancel(){"scheduled"===this.state&&(pz.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}};function xz(e,t,r){(e=>e.startsWith("--"))(t)?e.style.setProperty(t,r):e.style[t]=r}var wz={};function Sz(e,t){const r=$E(e);return()=>wz[t]??r()}var kz=/* @__PURE__ */Sz(()=>void 0!==window.ScrollTimeline,"scrollTimeline"),Cz=/*@__PURE__*/Sz(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(e){return!1}return!0},"linearEasing"),Nz=([e,t,r,n])=>`cubic-bezier(${e}, ${t}, ${r}, ${n})`,Tz={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:/*@__PURE__*/Nz([0,.65,.55,1]),circOut:/*@__PURE__*/Nz([.55,0,1,.45]),backIn:/*@__PURE__*/Nz([.31,.01,.66,-.59]),backOut:/*@__PURE__*/Nz([.33,1.53,.69,.99])};function Az(e,t){return e?"function"==typeof e?Cz()?yR(e,t):"ease-out":uI(e)?Nz(e):Array.isArray(e)?e.map(e=>Az(e,t)||Tz.easeOut):Tz[e]:void 0}function Mz(e,t,r,{delay:n=0,duration:a=300,repeat:o=0,repeatType:i="loop",ease:s="easeOut",times:l}={},c=void 0){const d={[t]:r};l&&(d.offset=l);const u=Az(s,a);Array.isArray(u)&&(d.easing=u);const h={delay:n,duration:a,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:o+1,direction:"reverse"===i?"alternate":"normal"};return c&&(h.pseudoElement=c),e.animate(d,h)}function Dz(e){return"function"==typeof e&&"applyToOptions"in e}var Ez=class extends KR{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:r,keyframes:n,pseudoElement:a,allowFlatten:o=!1,finalKeyframe:i,onComplete:s}=e;this.isPseudoElement=Boolean(a),this.allowFlatten=o,this.options=e,OE("string"!=typeof e.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:e,...t}){return Dz(e)&&Cz()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}(e);this.animation=Mz(t,r,n,l,a),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!a){const e=UR(n,this.options,i,this.speed);this.updateMotionValue&&this.updateMotionValue(e),xz(t,r,e),this.animation.cancel()}s?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(e){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;"idle"!==e&&"finished"!==e&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){const e=this.animation.effect?.getComputedTiming?.().duration||0;return WE(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+WE(e)}get time(){return WE(Number(this.animation.currentTime)||0)}set time(e){const t=null!==this.finishedTime;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=GE(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:r,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&kz()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),r&&(this.animation.rangeEnd=r),HE):n(this)}},Iz={anticipate:aI,backInOut:nI,circInOut:sI};function Rz(e){"string"==typeof e.ease&&e.ease in Iz&&(e.ease=Iz[e.ease])}var zz=class extends Ez{constructor(e){Rz(e),WR(e),super(e),void 0!==e.startTime&&!1!==e.autoplay&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:t,onUpdate:r,onComplete:n,element:a,...o}=this.options;if(!t)return;if(void 0!==e)return void t.set(e);const i=new XR({...o,autoplay:!1}),s=Math.max(10,SI.now()-this.startTime),l=_E(0,10,s-10),c=i.sample(s).value,{name:d}=this.options;a&&d&&xz(a,d,c),t.setWithVelocity(i.sample(Math.max(0,s-l)).value,c,l),i.stop()}},_z=(e,t)=>"zIndex"!==t&&(!("number"!=typeof e&&!Array.isArray(e))||!("string"!=typeof e||!rR.test(e)&&"0"!==e||e.startsWith("url(")));function Pz(e){e.duration=0,e.type="keyframes"}var Oz=/* @__PURE__ */new Set(["opacity","clipPath","filter","transform","backgroundColor"]),Lz=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;var Fz=/* @__PURE__ */new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),Bz=/*@__PURE__*/$E(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function Vz(e){const{motionValue:t,name:r,repeatDelay:n,repeatType:a,damping:o,type:i,keyframes:s}=e,l=t?.owner?.current;if(!(l instanceof HTMLElement||l instanceof SVGElement))return!1;const{onUpdate:c,transformTemplate:d}=t.owner.getProps();return Bz()&&r&&(Oz.has(r)||Fz.has(r)&&function(e){for(let t=0;t<e.length;t++)if("string"==typeof e[t]&&Lz.test(e[t]))return!0;return!1}(s))&&("transform"!==r||!d)&&!c&&!n&&"mirror"!==a&&0!==o&&"inertia"!==i}var $z=class extends KR{constructor({autoplay:e=!0,delay:t=0,type:r="keyframes",repeat:n=0,repeatDelay:a=0,repeatType:o="loop",keyframes:i,name:s,motionValue:l,element:c,...d}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=SI.now();const u={autoplay:e,delay:t,type:r,repeat:n,repeatDelay:a,repeatType:o,name:s,motionValue:l,element:c,...d},h=c?.KeyframeResolver||bz;this.keyframeResolver=new h(i,(e,t,r)=>this.onKeyframesResolved(e,t,u,!r),s,l,c),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,r,n){this.keyframeResolver=void 0;const{name:a,type:o,velocity:i,delay:s,isHandoff:l,onUpdate:c}=r;this.resolvedAt=SI.now();let d=!0;(function(e,t,r,n){const a=e[0];if(null===a)return!1;if("display"===t||"visibility"===t)return!0;const o=e[e.length-1],i=_z(a,t),s=_z(o,t);return PE(i===s,`You are trying to animate ${t} from "${a}" to "${o}". "${i?o:a}" is not an animatable value.`,"value-not-animatable"),!(!i||!s)&&(function(e){const t=e[0];if(1===e.length)return!0;for(let r=0;r<e.length;r++)if(e[r]!==t)return!0}(e)||("spring"===r||Dz(r))&&n)})(e,a,o,i)||(d=!1,!LE.instantAnimations&&s||c?.(UR(e,r,t)),e[0]=e[e.length-1],Pz(r),r.repeat=0);const u={startTime:n?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...r,keyframes:e},h=d&&!l&&Vz(u),p=u.motionValue?.owner?.current;let m;if(h)try{m=new zz({...u,element:p})}catch{m=new XR(u)}else m=new XR(u);m.finished.then(()=>{this.notifyFinished()}).catch(HE),this.pendingTimeline&&(this.stopTimeline=m.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=m}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),gz=!0,yz(),vz(),gz=!1),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}};function Hz(e,t,r,n=0,a=1){const o=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),i=e.size,s=(i-1)*n;return"function"==typeof r?r(o,i):1===a?o*n:s-o*n}var jz={current:void 0},qz=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{const t=SI.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const r of this.dependents)r.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=SI.now(),null===this.canTrackVelocity&&void 0!==e&&(this.canTrackVelocity=(e=>!isNaN(parseFloat(e)))(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return"production"!==process.env.NODE_ENV&&XE(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new UE);const r=this.events[e].add(t);return"change"===e?()=>{r(),vI.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,r){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=/* @__PURE__ */new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return jz.current&&jz.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const e=SI.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||e-this.updatedAt>30)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,30);return KE(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function Uz(e,t){return new qz(e,t)}function Gz(e,t){if(e?.inherit&&t){const{inherit:r,...n}=e;return{...t,...n}}return e}function Wz(e,t){const r=e?.[t]??e?.default??e;return r!==e?Gz(r,e):r}var Kz={type:"spring",stiffness:500,damping:25,restSpeed:10},Yz={type:"keyframes",duration:.8},Xz={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Zz=(e,{keyframes:t})=>t.length>2?Yz:lz.has(e)?e.startsWith("scale")?(e=>({type:"spring",stiffness:550,damping:0===e?2*Math.sqrt(550):30,restSpeed:10}))(t[1]):Kz:Xz,Jz=/* @__PURE__ */new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);var Qz=(e,t,r,n={},a,o)=>i=>{const s=Wz(n,e)||{},l=s.delay||n.delay||0;let{elapsed:c=0}=n;c-=GE(l);const d={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:t.getVelocity(),...s,delay:-c,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{i(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:o?void 0:a};(function(e){for(const t in e)if(!Jz.has(t))return!0;return!1})(s)||Object.assign(d,Zz(e,d)),d.duration&&(d.duration=GE(d.duration)),d.repeatDelay&&(d.repeatDelay=GE(d.repeatDelay)),void 0!==d.from&&(d.keyframes[0]=d.from);let u=!1;if((!1===d.type||0===d.duration&&!d.repeatDelay)&&(Pz(d),0===d.delay&&(u=!0)),(LE.instantAnimations||LE.skipAnimations||a?.shouldSkipAnimations||s.skipAnimations)&&(u=!0,Pz(d),d.delay=0),d.allowFlatten=!s.type&&!s.ease,u&&!o&&void 0!==t.get()){const e=UR(d.keyframes,s);if(void 0!==e)return void vI.update(()=>{d.onUpdate(e),d.onComplete()})}return s.isSync?new XR(d):new $z(d)},e_=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function t_(e,t,r=1){OE(r<=4,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[n,a]=function(e){const t=e_.exec(e);if(!t)return[,];const[,r,n,a]=t;return[`--${r??n}`,a]}(e);if(!n)return;const o=window.getComputedStyle(t).getPropertyValue(n);if(o){const e=o.trim();return FE(e)?parseFloat(e):e}return TI(a)?t_(a,t,r+1):a}function r_(e){const t=[{},{}];return e?.values.forEach((e,r)=>{t[0][r]=e.get(),t[1][r]=e.getVelocity()}),t}function n_(e,t,r,n){if("function"==typeof t){const[a,o]=r_(n);t=t(void 0!==r?r:e.custom,a,o)}if("string"==typeof t&&(t=e.variants&&e.variants[t]),"function"==typeof t){const[a,o]=r_(n);t=t(void 0!==r?r:e.custom,a,o)}return t}function a_(e,t,r){const n=e.getProps();return n_(n,t,void 0!==r?r:n.custom,e)}var o_=/* @__PURE__ */new Set(["width","height","top","left","right","bottom",...sz]),i_=e=>Array.isArray(e);function s_(e,t,r){e.hasValue(t)?e.getValue(t).set(r):e.addValue(t,Uz(r))}function l_(e){return i_(e)?e[e.length-1]||0:e}var c_=e=>Boolean(e&&e.getVelocity);function d_(e,t){const r=e.getValue("willChange");if(function(e){return Boolean(c_(e)&&e.add)}(r))return r.add(t);if(!r&&LE.WillChange){const r=new LE.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function u_(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var h_="data-"+u_("framerAppearId");function p_(e){return e.props[h_]}var m_="undefined"!=typeof window;function f_({protectedKeys:e,needsAnimating:t},r){const n=e.hasOwnProperty(r)&&!0!==t[r];return t[r]=!1,n}function g_(e,t,{delay:r=0,transitionOverride:n,type:a}={}){let{transition:o,transitionEnd:i,...s}=t;const l=e.getDefaultTransition();o=o?Gz(o,l):l;const c=o?.reduceMotion,d=o?.skipAnimations;n&&(o=n);const u=[],h=a&&e.animationState&&e.animationState.getState()[a],p=o?.path;p&&p.animateVisualElement(e,s,o,r,u);for(const m in s){const t=e.getValue(m,e.latestValues[m]??null),n=s[m];if(void 0===n||h&&f_(h,m))continue;const a={delay:r,...Wz(o||{},m)};d&&(a.skipAnimations=!0);const i=t.get();if(void 0!==i&&!t.isAnimating()&&!Array.isArray(n)&&n===i&&!a.velocity){vI.update(()=>t.set(n));continue}let l=!1;if(m_&&window.MotionHandoffAnimation){const t=p_(e);if(t){const e=window.MotionHandoffAnimation(t,m,vI);null!==e&&(a.startTime=e,l=!0)}}d_(e,m);const p=c??e.shouldReduceMotion;t.start(Qz(m,t,n,p&&o_.has(m)?{type:!1}:a,e,l));const f=t.animation;f&&u.push(f)}if(i){const t=()=>vI.update(()=>{i&&function(e,t){let{transitionEnd:r={},transition:n={},...a}=a_(e,t)||{};a={...a,...r};for(const o in a)s_(e,o,l_(a[o]))}(e,i)});u.length?Promise.all(u).then(t):t()}return u}function v_(e,t,r={}){const n=a_(e,t,"exit"===r.type?e.presenceContext?.custom:void 0);let{transition:a=e.getDefaultTransition()||{}}=n||{};r.transitionOverride&&(a=r.transitionOverride);const o=n?()=>Promise.all(g_(e,n,r)):()=>Promise.resolve(),i=e.variantChildren&&e.variantChildren.size?(n=0)=>{const{delayChildren:o=0,staggerChildren:i,staggerDirection:s}=a;return function(e,t,r=0,n=0,a=0,o=1,i){const s=[];for(const l of e.variantChildren)l.notify("AnimationStart",t),s.push(v_(l,t,{...i,delay:r+("function"==typeof n?0:n)+Hz(e.variantChildren,l,n,a,o)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(s)}(e,t,n,o,i,s,r)}:()=>Promise.resolve(),{when:s}=a;if(s){const[e,t]="beforeChildren"===s?[o,i]:[i,o];return e().then(()=>t())}return Promise.all([o(),i(r.delay)])}var y_=e=>t=>t.test(e),b_=[DI,jI,HI,$I,UI,qI,{test:e=>"auto"===e,parse:e=>e}],x_=e=>b_.find(y_(e));function w_(e){return"number"==typeof e?0===e:null===e||("none"===e||"0"===e||VE(e))}var S_=/* @__PURE__ */new Set(["brightness","contrast","saturate","opacity"]);function k_(e){const[t,r]=e.slice(0,-1).split("(");if("drop-shadow"===t)return e;const[n]=r.match(zI)||[];if(!n)return e;const a=r.replace(n,"");let o=S_.has(t)?1:0;return n!==r&&(o*=100),t+"("+o+a+")"}var C_=/\b([a-z-]*)\(.*?\)/gu,N_={...rR,getAnimatableNone:e=>{const t=e.match(C_);return t?t.map(k_).join(" "):e}},T_={...rR,getAnimatableNone:e=>{const t=rR.parse(e);return rR.createTransformer(e)(t.map(e=>"number"==typeof e?0:"object"==typeof e?{...e,alpha:1}:e))}},A_={...DI,transform:Math.round},M_={borderWidth:jI,borderTopWidth:jI,borderRightWidth:jI,borderBottomWidth:jI,borderLeftWidth:jI,borderRadius:jI,borderTopLeftRadius:jI,borderTopRightRadius:jI,borderBottomRightRadius:jI,borderBottomLeftRadius:jI,width:jI,maxWidth:jI,height:jI,maxHeight:jI,top:jI,right:jI,bottom:jI,left:jI,inset:jI,insetBlock:jI,insetBlockStart:jI,insetBlockEnd:jI,insetInline:jI,insetInlineStart:jI,insetInlineEnd:jI,padding:jI,paddingTop:jI,paddingRight:jI,paddingBottom:jI,paddingLeft:jI,paddingBlock:jI,paddingBlockStart:jI,paddingBlockEnd:jI,paddingInline:jI,paddingInlineStart:jI,paddingInlineEnd:jI,margin:jI,marginTop:jI,marginRight:jI,marginBottom:jI,marginLeft:jI,marginBlock:jI,marginBlockStart:jI,marginBlockEnd:jI,marginInline:jI,marginInlineStart:jI,marginInlineEnd:jI,fontSize:jI,backgroundPositionX:jI,backgroundPositionY:jI,...{rotate:$I,pathRotation:$I,rotateX:$I,rotateY:$I,rotateZ:$I,scale:II,scaleX:II,scaleY:II,scaleZ:II,skew:$I,skewX:$I,skewY:$I,distance:jI,translateX:jI,translateY:jI,translateZ:jI,x:jI,y:jI,z:jI,perspective:jI,transformPerspective:jI,opacity:EI,originX:GI,originY:GI,originZ:jI},zIndex:A_,fillOpacity:EI,strokeOpacity:EI,numOctaves:A_},D_={...M_,color:KI,backgroundColor:KI,outlineColor:KI,fill:KI,stroke:KI,borderColor:KI,borderTopColor:KI,borderRightColor:KI,borderBottomColor:KI,borderLeftColor:KI,filter:N_,WebkitFilter:N_,mask:T_,WebkitMask:T_},E_=e=>D_[e],I_=/*@__PURE__*/new Set([N_,T_]);function R_(e,t){let r=E_(e);return I_.has(r)||(r=rR),r.getAnimatableNone?r.getAnimatableNone(t):void 0}var z_=/* @__PURE__ */new Set(["auto","none","0"]);var __=class extends bz{constructor(e,t,r,n,a){super(e,t,r,n,a,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:t,name:r}=this;if(!t||!t.current)return;super.readKeyframes();for(let s=0;s<e.length;s++){let r=e[s];if("string"==typeof r&&(r=r.trim(),TI(r))){const n=t_(r,t.current);void 0!==n&&(e[s]=n),s===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!o_.has(r)||2!==e.length)return;const[n,a]=e,o=x_(n),i=x_(a);if(MI(n)!==MI(a)&&hz[r])this.needsMeasurement=!0;else if(o!==i)if(cz(o)&&cz(i))for(let s=0;s<e.length;s++){const t=e[s];"string"==typeof t&&(e[s]=parseFloat(t))}else hz[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:t}=this,r=[];for(let n=0;n<e.length;n++)(null===e[n]||w_(e[n]))&&r.push(n);r.length&&function(e,t,r){let n,a=0;for(;a<e.length&&!n;){const t=e[a];"string"==typeof t&&!z_.has(t)&&QI(t).values.length&&(n=e[a]),a++}if(n&&r)for(const o of t)e[o]=R_(r,n)}(e,r,t)}measureInitialState(){const{element:e,unresolvedKeyframes:t,name:r}=this;if(!e||!e.current)return;"height"===r&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=hz[r](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;const n=t[t.length-1];void 0!==n&&e.getValue(r,n).jump(n,!1)}measureEndState(){const{element:e,name:t,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const n=e.getValue(t);n&&n.jump(this.measuredOrigin,!1);const a=r.length-1,o=r[a];r[a]=hz[t](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==o&&void 0===this.finalKeyframe&&(this.finalKeyframe=o),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,r])=>{e.getValue(t).set(r)}),this.resolveNoneKeyframes()}},P_=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function O_(e,t,r){if(null==e)return[];if(e instanceof EventTarget)return[e];if("string"==typeof e){let n=document;t&&(n=t.current);const a=r?.[e]??n.querySelectorAll(e);return a?Array.from(a):[]}return Array.from(e).filter(e=>null!=e)}var L_=(e,t)=>t&&"number"==typeof e?t.transform(e):e;function F_(e){return BE(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}var{schedule:B_,cancel:V_}=/* @__PURE__ */fI(queueMicrotask,!1),$_={x:!1,y:!1};function H_(){return $_.x||$_.y}function j_(e,t){const r=O_(e),n=new AbortController;return[r,{passive:!0,...t,signal:n.signal},()=>n.abort()]}function q_(e,t,r={}){const[n,a,o]=j_(e,r);return n.forEach(e=>{let r,n=!1,o=!1;const i=t=>{r&&(r(t),r=void 0),e.removeEventListener("pointerleave",l)},s=e=>{n=!1,window.removeEventListener("pointerup",s),window.removeEventListener("pointercancel",s),o&&(o=!1,i(e))},l=e=>{"touch"!==e.pointerType&&(n?o=!0:i(e))};e.addEventListener("pointerenter",n=>{if("touch"===n.pointerType||H_())return;o=!1;const i=t(e,n);"function"==typeof i&&(r=i,e.addEventListener("pointerleave",l,a))},a),e.addEventListener("pointerdown",()=>{n=!0,window.addEventListener("pointerup",s,a),window.addEventListener("pointercancel",s,a)},a)}),o}var U_=(e,t)=>!!t&&(e===t||U_(e,t.parentElement)),G_=e=>"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary,W_=/* @__PURE__ */new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);var K_=/* @__PURE__ */new Set(["INPUT","SELECT","TEXTAREA"]);var Y_=/* @__PURE__ */new WeakSet;function X_(e){return t=>{"Enter"===t.key&&e(t)}}function Z_(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}function J_(e){return G_(e)&&!H_()}var Q_=/* @__PURE__ */new WeakSet;function eP(e,t,r={}){const[n,a,o]=j_(e,r),i=e=>{const n=e.currentTarget;if(!J_(e))return;if(Q_.has(e))return;Y_.add(n),r.stopPropagation&&Q_.add(e);const o=t(n,e),i={...a,capture:!0},s=(e,t)=>{window.removeEventListener("pointerup",l,i),window.removeEventListener("pointercancel",c,i),Y_.has(n)&&Y_.delete(n),J_(e)&&"function"==typeof o&&o(e,{success:t})},l=e=>{s(e,n===window||n===document||r.useGlobalTarget||U_(n,e.target))},c=e=>{s(e,!1)};window.addEventListener("pointerup",l,i),window.addEventListener("pointercancel",c,i)};return n.forEach(e=>{var t;(r.useGlobalTarget?window:e).addEventListener("pointerdown",i,a),F_(e)&&(e.addEventListener("focus",e=>((e,t)=>{const r=e.currentTarget;if(!r)return;const n=X_(()=>{if(Y_.has(r))return;Z_(r,"down");const e=X_(()=>{Z_(r,"up")});r.addEventListener("keyup",e,t),r.addEventListener("blur",()=>Z_(r,"cancel"),t)});r.addEventListener("keydown",n,t),r.addEventListener("blur",()=>r.removeEventListener("keydown",n),t)})(e,a)),t=e,W_.has(t.tagName)||!0===t.isContentEditable||e.hasAttribute("tabindex")||(e.tabIndex=0))}),o}function tP(e){return BE(e)&&"ownerSVGElement"in e}var rP,nP=/* @__PURE__ */new WeakMap,aP=(e,t,r)=>(n,a)=>a&&a[0]?a[0][e+"Size"]:tP(n)&&"getBBox"in n?n.getBBox()[t]:n[r],oP=/*@__PURE__*/aP("inline","width","offsetWidth"),iP=/*@__PURE__*/aP("block","height","offsetHeight");function sP({target:e,borderBoxSize:t}){nP.get(e)?.forEach(r=>{r(e,{get width(){return oP(e,t)},get height(){return iP(e,t)}})})}function lP(e){e.forEach(sP)}function cP(e,t){rP||"undefined"!=typeof ResizeObserver&&(rP=new ResizeObserver(lP));const r=O_(e);return r.forEach(e=>{let r=nP.get(e);r||(r=/* @__PURE__ */new Set,nP.set(e,r)),r.add(t),rP?.observe(e)}),()=>{r.forEach(e=>{const r=nP.get(e);r?.delete(t),r?.size||rP?.unobserve(e)})}}var dP,uP=/* @__PURE__ */new Set;function hP(e){return uP.add(e),dP||(dP=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};uP.forEach(t=>t(e))},window.addEventListener("resize",dP)),()=>{uP.delete(e),uP.size||"function"!=typeof dP||(window.removeEventListener("resize",dP),dP=void 0)}}function pP(e,t){return"function"==typeof e?hP(e):cP(e,t)}var mP={value:null,addProjectionMetrics:null};var fP=[...b_,KI,rR],gP=()=>({x:{min:0,max:0},y:{min:0,max:0}}),vP=/* @__PURE__ */new WeakMap;function yP(e){return null!==e&&"object"==typeof e&&"function"==typeof e.start}function bP(e){return"string"==typeof e||Array.isArray(e)}var xP=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],wP=["initial",...xP];function SP(e){return yP(e.animate)||wP.some(t=>bP(e[t]))}function kP(e){return Boolean(SP(e)||e.variants)}var CP={current:null},NP={current:!1},TP="undefined"!=typeof window;var AP=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],MP={};function DP(e){MP=e}var EP=class{scrapeMotionValuesFromProps(e,t,r){return{}}constructor({parent:e,props:t,presenceContext:r,reducedMotionConfig:n,skipAnimations:a,blockInitialAnimation:o,visualState:i},s={}){this.current=null,this.children=/* @__PURE__ */new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=/* @__PURE__ */new Map,this.KeyframeResolver=bz,this.features={},this.valueSubscriptions=/* @__PURE__ */new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const e=SI.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,vI.render(this.render,!1,!0))};const{latestValues:l,renderState:c}=i;this.latestValues=l,this.baseTarget={...l},this.initialValues=t.initial?{...l}:{},this.renderState=c,this.parent=e,this.props=t,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=n,this.skipAnimationsConfig=a,this.options=s,this.blockInitialAnimation=Boolean(o),this.isControllingVariants=SP(t),this.isVariantNode=kP(t),this.isVariantNode&&(this.variantChildren=/* @__PURE__ */new Set),this.manuallyAnimateOnMount=Boolean(e&&e.current);const{willChange:d,...u}=this.scrapeMotionValuesFromProps(t,{},this);for(const h in u){const e=u[h];void 0!==l[h]&&c_(e)&&e.set(l[h])}}mount(e){if(this.hasBeenMounted)for(const t in this.initialValues)this.values.get(t)?.jump(this.initialValues[t]),this.latestValues[t]=this.initialValues[t];this.current=e,vP.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(NP.current||function(){if(NP.current=!0,TP)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>CP.current=e.matches;e.addEventListener("change",t),t()}else CP.current=!1}(),this.shouldReduceMotion=CP.current),"production"!==process.env.NODE_ENV&&XE(!0!==this.shouldReduceMotion,"You have Reduced Motion enabled on your device. Animations may not appear as expected."),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),yI(this.notifyUpdate),yI(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=/* @__PURE__ */new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&Oz.has(e)&&this.current instanceof HTMLElement){const{factory:r,keyframes:n,times:a,ease:o,duration:i}=t.accelerate,s=new Ez({element:this.current,name:e,keyframes:n,times:a,ease:o,duration:GE(i)}),l=r(s);return void this.valueSubscriptions.set(e,()=>{l(),s.cancel()})}const r=lz.has(e);r&&this.onBindTransform&&this.onBindTransform();const n=t.on("change",t=>{this.latestValues[e]=t,this.props.onUpdate&&vI.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let a;"undefined"!=typeof window&&window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{n(),a&&a()})}sortNodePosition(e){return this.current&&this.sortInstanceNodePosition&&this.type===e.type?this.sortInstanceNodePosition(this.current,e.current):0}updateFeatures(){let e="animation";for(e in MP){const t=MP[e];if(!t)continue;const{isEnabled:r,Feature:n}=t;if(!this.features[e]&&n&&r(this.props)&&(this.features[e]=new n(this)),this.features[e]){const t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let r=0;r<AP.length;r++){const t=AP[r];this.propEventSubscriptions[t]&&(this.propEventSubscriptions[t](),delete this.propEventSubscriptions[t]);const n=e["on"+t];n&&(this.propEventSubscriptions[t]=this.on(t,n))}this.prevMotionValues=function(e,t,r){for(const n in t){const a=t[n],o=r[n];if(c_(a))e.addValue(n,a);else if(c_(o))e.addValue(n,Uz(a,{owner:e}));else if(o!==a)if(e.hasValue(n)){const t=e.getValue(n);!0===t.liveStyle?t.jump(a):t.hasAnimated||t.set(a)}else{const t=e.getStaticValue(n);e.addValue(n,Uz(void 0!==t?t:a,{owner:e}))}}for(const n in r)void 0===t[n]&&e.removeValue(n);return t}(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){const r=this.values.get(e);t!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);const t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return void 0===r&&void 0!==t&&(r=Uz(null===t?void 0:t,{owner:this}),this.addValue(e,r)),r}readValue(e,t){let r=void 0===this.latestValues[e]&&this.current?this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options):this.latestValues[e];return null!=r&&("string"==typeof r&&(FE(r)||VE(r))?r=parseFloat(r):!(e=>fP.find(y_(e)))(r)&&rR.test(t)&&(r=R_(e,t)),this.setBaseTarget(e,c_(r)?r.get():r)),c_(r)?r.get():r}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){const{initial:t}=this.props;let r;if("string"==typeof t||"object"==typeof t){const n=n_(this.props,t,this.presenceContext?.custom);n&&(r=n[e])}if(t&&void 0!==r)return r;const n=this.getBaseTargetFromProps(this.props,e);return void 0===n||c_(n)?void 0!==this.initialValues[e]&&void 0===r?void 0:this.baseTarget[e]:n}on(e,t){return this.events[e]||(this.events[e]=new UE),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){B_.render(this.render)}},IP=class extends EP{constructor(){super(...arguments),this.KeyframeResolver=__}sortInstanceNodePosition(e,t){return 2&e.compareDocumentPosition(t)?1:-1}getBaseTargetFromProps(e,t){const r=e.style;return r?r[t]:void 0}removeValueFromRenderState(e,{vars:t,style:r}){delete t[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;c_(e)&&(this.childSubscription=e.on("change",e=>{this.current&&(this.current.textContent=`${e}`)}))}},RP=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function zP({top:e,left:t,right:r,bottom:n}){return{x:{min:t,max:r},y:{min:e,max:n}}}function _P(e){return void 0===e||1===e}function PP({scale:e,scaleX:t,scaleY:r}){return!_P(e)||!_P(t)||!_P(r)}function OP(e){return PP(e)||LP(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function LP(e){return FP(e.x)||FP(e.y)}function FP(e){return e&&"0%"!==e}function BP(e,t,r){return r+t*(e-r)}function VP(e,t,r,n,a){return void 0!==a&&(e=BP(e,a,n)),BP(e,r,n)+t}function $P(e,t=0,r=1,n,a){e.min=VP(e.min,t,r,n,a),e.max=VP(e.max,t,r,n,a)}function HP(e,{x:t,y:r}){$P(e.x,t.translate,t.scale,t.originPoint),$P(e.y,r.translate,r.scale,r.originPoint)}var jP=.999999999999,qP=1.0000000000001;function UP(e,t){e.min+=t,e.max+=t}function GP(e,t,r,n,a=.5){$P(e,t,r,oR(e.min,e.max,a),n)}function WP(e,t){return"string"==typeof e?parseFloat(e)/100*(t.max-t.min):e}function KP(e,t,r){const n=r??e;GP(e.x,WP(t.x,n.x),t.scaleX,t.scale,t.originX),GP(e.y,WP(t.y,n.y),t.scaleY,t.scale,t.originY)}function YP(e,t){return zP(function(e,t){if(!t)return e;const r=t({x:e.left,y:e.top}),n=t({x:e.right,y:e.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}(e.getBoundingClientRect(),t))}var XP={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},ZP=sz.length;function JP(e,t,r){const{style:n,vars:a,transformOrigin:o}=e;let i=!1,s=!1;for(const l in t){const e=t[l];if(lz.has(l))i=!0;else if(CI(l))a[l]=e;else{const t=L_(e,M_[l]);l.startsWith("origin")?(s=!0,o[l]=t):n[l]=t}}if(t.transform||(i||r?n.transform=function(e,t,r){let n="",a=!0;for(let i=0;i<ZP;i++){const o=sz[i],s=e[o];if(void 0===s)continue;let l=!0;if("number"==typeof s)l=s===(o.startsWith("scale")?1:0);else{const e=parseFloat(s);l=o.startsWith("scale")?1===e:0===e}if(!l||r){const e=L_(s,M_[o]);l||(a=!1,n+=`${XP[o]||o}(${e}) `),r&&(t[o]=e)}}const o=e.pathRotation;return o&&(a=!1,n+=`rotate(${L_(o,M_.pathRotation)}) `),n=n.trim(),r?n=r(t,a?"":n):a&&(n="none"),n}(t,e.transform,r):n.transform&&(n.transform="none")),s){const{originX:e="50%",originY:t="50%",originZ:r=0}=o;n.transformOrigin=`${e} ${t} ${r}`}}function QP(e,{style:t,vars:r},n,a){const o=e.style;let i;for(i in t)o[i]=t[i];for(i in a?.applyProjectionStyles(o,n),r)o.setProperty(i,r[i])}function eO(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var tO={correct:(e,t)=>{if(!t.target)return e;if("string"==typeof e){if(!jI.test(e))return e;e=parseFloat(e)}return`${eO(e,t.target.x)}% ${eO(e,t.target.y)}%`}},rO={correct:(e,{treeScale:t,projectionDelta:r})=>{const n=e,a=rR.parse(e);if(a.length>5)return n;const o=rR.createTransformer(e),i="number"!=typeof a[0]?1:0,s=r.x.scale*t.x,l=r.y.scale*t.y;a[0+i]/=s,a[1+i]/=l;const c=oR(s,l,.5);return"number"==typeof a[2+i]&&(a[2+i]/=c),"number"==typeof a[3+i]&&(a[3+i]/=c),o(a)}},nO={borderRadius:{...tO,applyTo:[...P_]},borderTopLeftRadius:tO,borderTopRightRadius:tO,borderBottomLeftRadius:tO,borderBottomRightRadius:tO,boxShadow:rO};function aO(e,{layout:t,layoutId:r}){return lz.has(e)||e.startsWith("origin")||(t||void 0!==r)&&(!!nO[e]||"opacity"===e)}function oO(e,t,r){const n=e.style,a=t?.style,o={};if(!n)return o;for(const i in n)(c_(n[i])||a&&c_(a[i])||aO(i,e)||void 0!==r?.getValue(i)?.liveStyle)&&(o[i]=n[i]);return o}var iO=class extends IP{constructor(){super(...arguments),this.type="html",this.renderInstance=QP}mount(e){OE(Boolean(e.style),"motion.create() components must forward their ref to a HTML or SVG element","custom-component-ref"),super.mount(e)}readValueFromInstance(e,t){if(lz.has(t))return this.projection?.isProjecting?az(t):((e,t)=>{const{transform:r="none"}=getComputedStyle(e);return oz(r,t)})(e,t);{const n=(r=e,window.getComputedStyle(r)),a=(CI(t)?n.getPropertyValue(t):n[t])||0;return"string"==typeof a?a.trim():a}var r}measureInstanceViewportBox(e,{transformPagePoint:t}){return YP(e,t)}build(e,t,r){JP(e,t,r.transformTemplate)}scrapeMotionValuesFromProps(e,t,r){return oO(e,t,r)}},sO={offset:"stroke-dashoffset",array:"stroke-dasharray"},lO={offset:"strokeDashoffset",array:"strokeDasharray"};var cO=["transform","opacity","offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function dO(e,{attrX:t,attrY:r,attrScale:n,pathLength:a,pathSpacing:o=1,pathOffset:i=0,...s},l,c,d){if(JP(e,s,c),l)return void(e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox));e.attrs=e.style,e.style={};const{attrs:u,style:h}=e;for(const p of cO)void 0!==u[p]&&(h[p]=u[p],delete u[p]);(h.transform||u.transformOrigin)&&(h.transformOrigin=u.transformOrigin??"50% 50%",delete u.transformOrigin),h.transform&&(h.transformBox=d?.transformBox??"fill-box",delete u.transformBox),void 0!==t&&(u.x=t),void 0!==r&&(u.y=r),void 0!==n&&(u.scale=n),void 0!==a&&function(e,t,r=1,n=0,a=!0){e.pathLength=1;const o=a?sO:lO;e[o.offset]=""+-n,e[o.array]=`${t} ${r}`}(u,a,o,i,!1)}var uO=/* @__PURE__ */new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),hO=e=>"string"==typeof e&&"svg"===e.toLowerCase();function pO(e,t,r){const n=oO(e,t,r);for(const a in e)if(c_(e[a])||c_(t[a])){n[-1!==sz.indexOf(a)?"attr"+a.charAt(0).toUpperCase()+a.substring(1):a]=e[a]}return n}var mO=class extends IP{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=gP}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(lz.has(t)){const e=E_(t);return e&&e.default||0}if(cO.includes(t)){const r=getComputedStyle(e)[t];if("string"==typeof r&&r)return r.trim()}return t=uO.has(t)?t:u_(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,r){return pO(e,t,r)}build(e,t,r){dO(e,t,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,t,r,n){!function(e,t,r,n){QP(e,t,void 0,n);for(const a in t.attrs)e.setAttribute(uO.has(a)?a:u_(a),t.attrs[a])}(e,t,0,n)}mount(e){this.isSVGTag=hO(e.tagName),super.mount(e)}},fO=wP.length;function gO(e){if(!e)return;if(!e.isControllingVariants){const t=e.parent&&gO(e.parent)||{};return void 0!==e.props.initial&&(t.initial=e.props.initial),t}const t={};for(let r=0;r<fO;r++){const n=wP[r],a=e.props[n];(bP(a)||!1===a)&&(t[n]=a)}return t}function vO(e,t){if(!Array.isArray(t))return!1;const r=t.length;if(r!==e.length)return!1;for(let n=0;n<r;n++)if(t[n]!==e[n])return!1;return!0}var yO=[...xP].reverse(),bO=xP.length;function xO(e){return t=>Promise.all(t.map(({animation:t,options:r})=>function(e,t,r={}){let n;if(e.notify("AnimationStart",t),Array.isArray(t)){const a=t.map(t=>v_(e,t,r));n=Promise.all(a)}else if("string"==typeof t)n=v_(e,t,r);else{const a="function"==typeof t?a_(e,t,r.custom):t;n=Promise.all(g_(e,a,r))}return n.then(()=>{e.notify("AnimationComplete",t)})}(e,t,r)))}function wO(e){let t=xO(e),r=CO(),n=!0,a=!1;const o=t=>(r,n)=>{const a=a_(e,n,"exit"===t?e.presenceContext?.custom:void 0);if(a){const{transition:e,transitionEnd:t,...n}=a;r={...r,...n,...t}}return r};function i(i){const{props:s}=e,l=gO(e.parent)||{},c=[],d=/* @__PURE__ */new Set;let u={},h=1/0;for(let t=0;t<bO;t++){const p=yO[t],m=r[p],f=void 0!==s[p]?s[p]:l[p],g=bP(f),v=p===i?m.isActive:null;!1===v&&(h=t);let y=f===l[p]&&f!==s[p]&&g;if(y&&(n||a)&&e.manuallyAnimateOnMount&&(y=!1),m.protectedKeys={...u},!m.isActive&&null===v||!f&&!m.prevProp||yP(f)||"boolean"==typeof f)continue;if("exit"===p&&m.isActive&&!0!==v){m.prevResolvedValues&&(u={...u,...m.prevResolvedValues});continue}const b=SO(m.prevProp,f);let x=b||p===i&&m.isActive&&!y&&g||t>h&&g,w=!1;const S=Array.isArray(f)?f:[f];let k=S.reduce(o(p),{});!1===v&&(k={});const{prevResolvedValues:C={}}=m,N={...C,...k},T=t=>{x=!0,d.has(t)&&(w=!0,d.delete(t)),m.needsAnimating[t]=!0;const r=e.getValue(t);r&&(r.liveStyle=!1)};for(const e in N){const t=k[e],r=C[e];if(u.hasOwnProperty(e))continue;let n=!1;n=i_(t)&&i_(r)?!vO(t,r)||b:t!==r,n?null!=t?T(e):d.add(e):void 0!==t&&d.has(e)?T(e):m.protectedKeys[e]=!0}m.prevProp=f,m.prevResolvedValues=k,m.isActive&&(u={...u,...k}),(n||a)&&e.blockInitialAnimation&&(x=!1);const A=y&&b;!x||A&&!w||c.push(...S.map(t=>{const r={type:p};if("string"==typeof t&&(n||a)&&!A&&e.manuallyAnimateOnMount&&e.parent){const{parent:n}=e,a=a_(n,t);if(n.enteringChildren&&a){const{delayChildren:t}=a.transition||{};r.delay=Hz(n.enteringChildren,e,t)}}return{animation:t,options:r}}))}if(d.size){const t={};if("boolean"!=typeof s.initial){const r=a_(e,Array.isArray(s.initial)?s.initial[0]:s.initial);r&&r.transition&&(t.transition=r.transition)}d.forEach(r=>{const n=e.getBaseTarget(r),a=e.getValue(r);a&&(a.liveStyle=!0),t[r]=n??null}),c.push({animation:t})}let p=Boolean(c.length);return!n||!1!==s.initial&&s.initial!==s.animate||e.manuallyAnimateOnMount||(p=!1),n=!1,a=!1,p?t(c):Promise.resolve()}return{animateChanges:i,setActive:function(t,n){if(r[t].isActive===n)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,n)),r[t].isActive=n;const a=i(t);for(const e in r)r[e].protectedKeys={};return a},setAnimateFunction:function(r){t=r(e)},getState:()=>r,reset:()=>{r=CO(),a=!0}}}function SO(e,t){return"string"==typeof t?t!==e:!!Array.isArray(t)&&!vO(t,e)}function kO(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function CO(){return{animate:kO(!0),whileInView:kO(),whileHover:kO(),whileTap:kO(),whileDrag:kO(),whileFocus:kO(),exit:kO()}}function NO(e,t){e.min=t.min,e.max=t.max}function TO(e,t){NO(e.x,t.x),NO(e.y,t.y)}function AO(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function MO(e){return e.max-e.min}function DO(e,t,r,n=.5){e.origin=n,e.originPoint=oR(t.min,t.max,e.origin),e.scale=MO(r)/MO(t),e.translate=oR(r.min,r.max,e.origin)-e.originPoint,(e.scale>=.9999&&e.scale<=1.0001||isNaN(e.scale))&&(e.scale=1),(e.translate>=-.01&&e.translate<=.01||isNaN(e.translate))&&(e.translate=0)}function EO(e,t,r,n){DO(e.x,t.x,r.x,n?n.originX:void 0),DO(e.y,t.y,r.y,n?n.originY:void 0)}function IO(e,t,r,n=0){e.min=(n?oR(r.min,r.max,n):r.min)+t.min,e.max=e.min+MO(t)}function RO(e,t,r,n=0){const a=n?oR(r.min,r.max,n):r.min;e.min=t.min-a,e.max=e.min+MO(t)}function zO(e,t,r,n){RO(e.x,t.x,r.x,n?.x),RO(e.y,t.y,r.y,n?.y)}function _O(e,t,r,n,a){return e=BP(e-=t,1/r,n),void 0!==a&&(e=BP(e,1/a,n)),e}function PO(e,t,[r,n,a],o,i){!function(e,t=0,r=1,n=.5,a,o=e,i=e){if(HI.test(t)&&(t=parseFloat(t),t=oR(i.min,i.max,t/100)-i.min),"number"!=typeof t)return;let s=oR(o.min,o.max,n);e===o&&(s-=t),e.min=_O(e.min,t,r,s,a),e.max=_O(e.max,t,r,s,a)}(e,t[r],t[n],t[a],t.scale,o,i)}var OO=["x","scaleX","originX"],LO=["y","scaleY","originY"];function FO(e,t,r,n){PO(e.x,t,OO,r?r.x:void 0,n?n.x:void 0),PO(e.y,t,LO,r?r.y:void 0,n?n.y:void 0)}function BO(e){return 0===e.translate&&1===e.scale}function VO(e){return BO(e.x)&&BO(e.y)}function $O(e,t){return e.min===t.min&&e.max===t.max}function HO(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function jO(e,t){return HO(e.x,t.x)&&HO(e.y,t.y)}function qO(e){return MO(e.x)/MO(e.y)}function UO(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function GO(e){return[e("x"),e("y")]}var WO=P_.length,KO=e=>"string"==typeof e?parseFloat(e):e,YO=e=>"number"==typeof e||jI.test(e);function XO(e,t){return void 0!==e[t]?e[t]:e.borderRadius}var ZO=/*@__PURE__*/QO(0,.5,iI),JO=/*@__PURE__*/QO(.5,.95,HE);function QO(e,t,r){return n=>n<e?0:n>t?1:r(qE(e,t,n))}function eL(e,t,r,n={passive:!0}){return e.addEventListener(t,r,n),()=>e.removeEventListener(t,r,n)}var tL=(e,t)=>e.depth-t.depth,rL=class{constructor(){this.children=[],this.isDirty=!1}add(e){RE(this.children,e),this.isDirty=!0}remove(e){zE(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(tL),this.isDirty=!1,this.children.forEach(e)}};function nL(e){return c_(e)?e.get():e}var aL=class{constructor(){this.members=[]}add(e){RE(this.members,e);for(let t=this.members.length-1;t>=0;t--){const r=this.members[t];if(r===e||r===this.lead||r===this.prevLead)continue;const n=r.instance;n&&!1!==n.isConnected||r.snapshot||(zE(this.members,r),r.unmount())}e.scheduleRender()}remove(e){if(zE(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){const e=this.members[t];if(!1!==e.isPresent&&!1!==e.instance?.isConnected)return this.promote(e),!0}return!1}promote(e,t){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.updateSnapshot(),e.scheduleRender();const{layoutDependency:n}=r.options,{layoutDependency:a}=e.options;void 0!==n&&n===a||(e.resumeFrom=r,t&&(r.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),!1===e.options.crossfade&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}},oL={hasAnimatedSinceResize:!0,hasEverUpdated:!1},iL={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},sL=["","X","Y","Z"],lL=0;function cL(e,t,r,n){const{latestValues:a}=t;a[e]&&(r[e]=a[e],t.setStaticValue(e,0),n&&(n[e]=0))}function dL(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const r=p_(t);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:t,layoutId:n}=e.options;window.MotionCancelOptimisedAnimation(r,"transform",vI,!(t||n))}const{parent:n}=e;n&&!n.hasCheckedOptimisedAppear&&dL(n)}function uL({attachResizeListener:e,defaultParent:t,measureScroll:r,checkIsScrollRoot:n,resetTransform:a}){return class{constructor(e={},r=t?.()){this.id=lL++,this.animationId=0,this.animationCommitId=0,this.children=/* @__PURE__ */new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=/* @__PURE__ */new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,mP.value&&(iL.nodes=iL.calculatedTargetDeltas=iL.calculatedProjections=0),this.nodes.forEach(mL),this.nodes.forEach(kL),this.nodes.forEach(CL),this.nodes.forEach(fL),mP.addProjectionMetrics&&mP.addProjectionMetrics(iL)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=/* @__PURE__ */new Map,this.latestValues=e,this.root=r?r.root||r:this,this.path=r?[...r.path,r]:[],this.parent=r,this.depth=r?r.depth+1:0;for(let t=0;t<this.path.length;t++)this.path[t].shouldResetTransform=!0;this.root===this&&(this.nodes=new rL)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new UE),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){const r=this.eventHandlers.get(e);r&&r.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;var r;this.isSVG=tP(t)&&!(tP(r=t)&&"svg"===r.tagName),this.instance=t;const{layoutId:n,layout:a,visualElement:o}=this.options;if(o&&!o.current&&o.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(a||n)&&(this.isLayoutDirty=!0),e){let r,n=0;const a=()=>this.root.updateBlockedByResize=!1;vI.read(()=>{n=window.innerWidth}),e(t,()=>{const e=window.innerWidth;e!==n&&(n=e,this.root.updateBlockedByResize=!0,r&&r(),r=function(e,t){const r=SI.now(),n=({timestamp:a})=>{const o=a-r;o>=t&&(yI(n),e(o-t))};return vI.setup(n,!0),()=>yI(n)}(a,250),oL.hasAnimatedSinceResize&&(oL.hasAnimatedSinceResize=!1,this.nodes.forEach(SL)))})}n&&this.root.registerSharedNode(n,this),!1!==this.options.animate&&o&&(n||a)&&this.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:r,layout:n})=>{if(this.isTreeAnimationBlocked())return this.target=void 0,void(this.relativeTarget=void 0);const a=this.options.transition||o.getDefaultTransition()||EL,{onLayoutAnimationStart:i,onLayoutAnimationComplete:s}=o.getProps(),l=!this.targetLayout||!jO(this.targetLayout,n),c=!t&&r;if(this.options.layoutRoot||this.resumeFrom||c||t&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const t={...Wz(a,"layout"),onPlay:i,onComplete:s};(o.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,c,t.path)}else t||SL(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=n})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),yI(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(NL),this.animationId++)}getTransformTemplate(){const{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked())return void(this.options.onExitComplete&&this.options.onExitComplete());if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&dL(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let a=0;a<this.path.length;a++){const e=this.path[a];e.shouldResetTransform=!0,"string"!=typeof e.latestValues.x&&"string"!=typeof e.latestValues.y||(e.isLayoutDirty=!0),e.updateScroll("snapshot"),e.options.layoutRoot&&e.willUpdate(!1)}const{layoutId:t,layout:r}=this.options;if(void 0===t&&!r)return;const n=this.getTransformTemplate();this.prevTransformTemplateValue=n?n(this.latestValues,""):void 0,this.updateSnapshot(),e&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const e=this.updateBlockedByResize;return this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),e&&this.nodes.forEach(yL),void this.nodes.forEach(vL)}if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(bL);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(xL),this.nodes.forEach(wL),this.nodes.forEach(hL),this.nodes.forEach(pL)):this.nodes.forEach(bL),this.clearAllSnapshots();const e=SI.now();bI.delta=_E(0,1e3/60,e-bI.timestamp),bI.timestamp=e,bI.isProcessing=!0,xI.update.process(bI),xI.preRender.process(bI),xI.render.process(bI),bI.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,B_.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(gL),this.sharedNodes.forEach(TL)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,vI.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){vI.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||MO(this.snapshot.measuredBox.x)||MO(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance)return;if(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead()||this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let r=0;r<this.path.length;r++)this.path[r].updateScroll();const e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected={x:{min:0,max:0},y:{min:0,max:0}}),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:t}=this.options;t&&t.notify("LayoutMeasure",this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e="measure"){let t=Boolean(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){const t=n(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:r(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!a)return;const e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!VO(this.projectionDelta),r=this.getTransformTemplate(),n=r?r(this.latestValues,""):void 0,o=n!==this.prevTransformTemplateValue;e&&this.instance&&(t||OP(this.latestValues)||o)&&(a(this.instance,n),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){const t=this.measurePageBox();let r=this.removeElementScroll(t);var n;return e&&(r=this.removeTransform(r)),zL((n=r).x),zL(n.y),{animationId:this.root.animationId,measuredBox:t,layoutBox:r,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:e}=this.options;if(!e)return{x:{min:0,max:0},y:{min:0,max:0}};const t=e.measureViewportBox();if(!this.scroll?.wasRoot&&!this.path.some(PL)){const{scroll:e}=this.root;e&&(UP(t.x,e.offset.x),UP(t.y,e.offset.y))}return t}removeElementScroll(e){const t={x:{min:0,max:0},y:{min:0,max:0}};if(TO(t,e),this.scroll?.wasRoot)return t;for(let r=0;r<this.path.length;r++){const n=this.path[r],{scroll:a,options:o}=n;n!==this.root&&a&&o.layoutScroll&&(a.wasRoot&&TO(t,e),UP(t.x,a.offset.x),UP(t.y,a.offset.y))}return t}applyTransform(e,t=!1,r){const n=r||{x:{min:0,max:0},y:{min:0,max:0}};TO(n,e);for(let a=0;a<this.path.length;a++){const e=this.path[a];!t&&e.options.layoutScroll&&e.scroll&&e!==e.root&&(UP(n.x,-e.scroll.offset.x),UP(n.y,-e.scroll.offset.y)),OP(e.latestValues)&&KP(n,e.latestValues,e.layout?.layoutBox)}return OP(this.latestValues)&&KP(n,this.latestValues,this.layout?.layoutBox),n}removeTransform(e){const t={x:{min:0,max:0},y:{min:0,max:0}};TO(t,e);for(let r=0;r<this.path.length;r++){const e=this.path[r];if(!OP(e.latestValues))continue;let n;e.instance&&(PP(e.latestValues)&&e.updateSnapshot(),n=gP(),TO(n,e.measurePageBox())),FO(t,e.latestValues,e.snapshot?.layoutBox,n)}return OP(this.latestValues)&&FO(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:void 0===e.crossfade||e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==bI.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){const t=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=t.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=t.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=t.isSharedProjectionDirty);const r=Boolean(this.resumingFrom)||this!==t;if(!(e||r&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:n,layoutId:a}=this.options;if(!this.layout||!n&&!a)return;this.resolvedRelativeTargetAt=bI.timestamp;const o=this.getClosestProjectingParent();o&&this.linkedParentVersion!==o.layoutVersion&&!o.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(!1!==this.options.layoutAnchor&&o&&o.layout?this.createRelativeTarget(o,this.layout.layoutBox,o.layout.layoutBox):this.removeRelativeTarget()),(this.relativeTarget||this.targetDelta)&&(this.target||(this.target={x:{min:0,max:0},y:{min:0,max:0}},this.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}}),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),function(e,t,r,n){IO(e.x,t.x,r.x,n?.x),IO(e.y,t.y,r.y,n?.y)}(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(Boolean(this.resumingFrom)?this.applyTransform(this.layout.layoutBox,!1,this.target):TO(this.target,this.layout.layoutBox),HP(this.target,this.targetDelta)):TO(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,!1!==this.options.layoutAnchor&&o&&Boolean(o.resumingFrom)===Boolean(this.resumingFrom)&&!o.options.layoutScroll&&o.target&&1!==this.animationProgress?this.createRelativeTarget(o,this.target,o.target):this.relativeParent=this.relativeTarget=void 0),mP.value&&iL.calculatedTargetDeltas++)}getClosestProjectingParent(){if(this.parent&&!PP(this.parent.latestValues)&&!LP(this.parent.latestValues))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return Boolean((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,r){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget={x:{min:0,max:0},y:{min:0,max:0}},this.relativeTargetOrigin={x:{min:0,max:0},y:{min:0,max:0}},zO(this.relativeTargetOrigin,t,r,this.options.layoutAnchor||void 0),TO(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const e=this.getLead(),t=Boolean(this.resumingFrom)||this!==e;let r=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(r=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(r=!1),this.resolvedRelativeTargetAt===bI.timestamp&&(r=!1),r)return;const{layout:n,layoutId:a}=this.options;if(this.isTreeAnimating=Boolean(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!n&&!a)return;TO(this.layoutCorrected,this.layout.layoutBox);const o=this.treeScale.x,i=this.treeScale.y;!function(e,t,r,n=!1){const a=r.length;if(!a)return;let o,i;t.x=t.y=1;for(let s=0;s<a;s++){o=r[s],i=o.projectionDelta;const{visualElement:a}=o.options;a&&a.props.style&&"contents"===a.props.style.display||(n&&o.options.layoutScroll&&o.scroll&&o!==o.root&&(UP(e.x,-o.scroll.offset.x),UP(e.y,-o.scroll.offset.y)),i&&(t.x*=i.x.scale,t.y*=i.y.scale,HP(e,i)),n&&OP(o.latestValues)&&KP(e,o.latestValues,o.layout?.layoutBox))}t.x<qP&&t.x>jP&&(t.x=1),t.y<qP&&t.y>jP&&(t.y=1)}(this.layoutCorrected,this.treeScale,this.path,t),!e.layout||e.target||1===this.treeScale.x&&1===this.treeScale.y||(e.target=e.layout.layoutBox,e.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}});const{target:s}=e;s?(this.projectionDelta&&this.prevProjectionDelta?(AO(this.prevProjectionDelta.x,this.projectionDelta.x),AO(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),EO(this.projectionDelta,this.layoutCorrected,s,this.latestValues),this.treeScale.x===o&&this.treeScale.y===i&&UO(this.projectionDelta.x,this.prevProjectionDelta.x)&&UO(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",s)),mP.value&&iL.calculatedProjections++):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){const e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDeltaWithTransform={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}}}setAnimationOrigin(e,t=!1,r){const n=this.snapshot,a=n?n.latestValues:{},o={...this.latestValues},i={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;const s={x:{min:0,max:0},y:{min:0,max:0}},l=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),d=!c||c.members.length<=1,u=Boolean(l&&!d&&!0===this.options.crossfade&&!this.path.some(DL));let h;this.animationProgress=0;const p=r?.interpolateProjection(e);this.mixTargetDelta=t=>{const r=t/1e3,n=p?.(r);var c,m;n?(i.x.translate=n.x,i.x.scale=oR(e.x.scale,1,r),i.x.origin=e.x.origin,i.x.originPoint=e.x.originPoint,i.y.translate=n.y,i.y.scale=oR(e.y.scale,1,r),i.y.origin=e.y.origin,i.y.originPoint=e.y.originPoint):(AL(i.x,e.x,r),AL(i.y,e.y,r)),this.setTargetDelta(i),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(zO(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),function(e,t,r,n){ML(e.x,t.x,r.x,n),ML(e.y,t.y,r.y,n)}(this.relativeTarget,this.relativeTargetOrigin,s,r),h&&(c=this.relativeTarget,m=h,$O(c.x,m.x)&&$O(c.y,m.y))&&(this.isProjectionDirty=!1),h||(h={x:{min:0,max:0},y:{min:0,max:0}}),TO(h,this.relativeTarget)),l&&(this.animationValues=o,function(e,t,r,n,a,o){a?(e.opacity=oR(0,r.opacity??1,ZO(n)),e.opacityExit=oR(t.opacity??1,0,JO(n))):o&&(e.opacity=oR(t.opacity??1,r.opacity??1,n));for(let i=0;i<WO;i++){const a=P_[i];let o=XO(t,a),s=XO(r,a);void 0===o&&void 0===s||(o||(o=0),s||(s=0),0===o||0===s||YO(o)===YO(s)?(e[a]=Math.max(oR(KO(o),KO(s),n),0),(HI.test(s)||HI.test(o))&&(e[a]+="%")):e[a]=s)}(t.rotate||r.rotate)&&(e.rotate=oR(t.rotate||0,r.rotate||0,n))}(o,a,this.latestValues,r,u,d)),n&&void 0!==n.rotate&&(this.animationValues||(this.animationValues=o),this.animationValues.pathRotation=n.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=r},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(yI(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=vI.update(()=>{oL.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Uz(0)),this.motionValue.jump(0,!1),this.currentAnimation=function(e,t,r){const n=c_(e)?e:Uz(e);return n.start(Qz("",n,t,r)),n.animation}(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const e=this.getLead();let{targetWithTransforms:t,target:r,layout:n,latestValues:a}=e;if(t&&r&&n){if(this!==e&&this.layout&&n&&_L(this.options.animationType,this.layout.layoutBox,n.layoutBox)){r=this.target||{x:{min:0,max:0},y:{min:0,max:0}};const t=MO(this.layout.layoutBox.x);r.x.min=e.target.x.min,r.x.max=r.x.min+t;const n=MO(this.layout.layoutBox.y);r.y.min=e.target.y.min,r.y.max=r.y.min+n}TO(t,r),KP(t,a),EO(this.projectionDeltaWithTransform,this.layoutCorrected,t,a)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new aL),this.sharedNodes.get(e).add(t);const r=t.options.initialPromotionConfig;t.promote({transition:r?r.transition:void 0,preserveFollowOpacity:r&&r.shouldPreserveFollowOpacity?r.shouldPreserveFollowOpacity(t):void 0})}isLead(){const e=this.getStack();return!e||e.lead===this}getLead(){const{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){const{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:r}={}){const n=this.getStack();n&&n.promote(this,r),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){const e=this.getStack();return!!e&&e.relegate(this)}resetSkewAndRotation(){const{visualElement:e}=this.options;if(!e)return;let t=!1;const{latestValues:r}=e;if((r.z||r.rotate||r.rotateX||r.rotateY||r.rotateZ||r.skewX||r.skewY)&&(t=!0),!t)return;const n={};r.z&&cL("z",e,n,this.animationValues);for(let a=0;a<sL.length;a++)cL(`rotate${sL[a]}`,e,n,this.animationValues),cL(`skew${sL[a]}`,e,n,this.animationValues);e.render();for(const a in n)e.setStaticValue(a,n[a]),this.animationValues&&(this.animationValues[a]=n[a]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible)return void(e.visibility="hidden");const r=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,e.visibility="",e.opacity="",e.pointerEvents=nL(t?.pointerEvents)||"",void(e.transform=r?r(this.latestValues,""):"none");const n=this.getLead();if(!this.projectionDelta||!this.layout||!n.target)return this.options.layoutId&&(e.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,e.pointerEvents=nL(t?.pointerEvents)||""),void(this.hasProjected&&!OP(this.latestValues)&&(e.transform=r?r({},""):"none",this.hasProjected=!1));e.visibility="";const a=n.animationValues||n.latestValues;this.applyTransformsToTarget();let o=function(e,t,r){let n="";const a=e.x.translate/t.x,o=e.y.translate/t.y,i=r?.z||0;if((a||o||i)&&(n=`translate3d(${a}px, ${o}px, ${i}px) `),1===t.x&&1===t.y||(n+=`scale(${1/t.x}, ${1/t.y}) `),r){const{transformPerspective:e,rotate:t,pathRotation:a,rotateX:o,rotateY:i,skewX:s,skewY:l}=r;e&&(n=`perspective(${e}px) ${n}`),t&&(n+=`rotate(${t}deg) `),a&&(n+=`rotate(${a}deg) `),o&&(n+=`rotateX(${o}deg) `),i&&(n+=`rotateY(${i}deg) `),s&&(n+=`skewX(${s}deg) `),l&&(n+=`skewY(${l}deg) `)}const s=e.x.scale*t.x,l=e.y.scale*t.y;return 1===s&&1===l||(n+=`scale(${s}, ${l})`),n||"none"}(this.projectionDeltaWithTransform,this.treeScale,a);r&&(o=r(a,o)),e.transform=o;const{x:i,y:s}=this.projectionDelta;e.transformOrigin=`${100*i.origin}% ${100*s.origin}% 0`,n.animationValues?e.opacity=n===this?a.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:a.opacityExit:e.opacity=n===this?void 0!==a.opacity?a.opacity:"":void 0!==a.opacityExit?a.opacityExit:0;for(const l in nO){if(void 0===a[l])continue;const{correct:t,applyTo:r,isCSSVariable:i}=nO[l],s="none"===o?a[l]:t(a[l],n);if(r){const t=r.length;for(let n=0;n<t;n++)e[r[n]]=s}else i?this.options.visualElement.renderState.vars[l]=s:e[l]=s}this.options.layoutId&&(e.pointerEvents=n===this?nL(t?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(vL),this.root.sharedNodes.clear()}}}function hL(e){e.updateLayout()}function pL(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:n}=e.layout,{animationType:a}=e.options,o=t.source!==e.layout.source;if("size"===a)GO(e=>{const n=o?t.measuredBox[e]:t.layoutBox[e],a=MO(n);n.min=r[e].min,n.max=n.min+a});else if("x"===a||"y"===a){const e="x"===a?"y":"x";NO(o?t.measuredBox[e]:t.layoutBox[e],r[e])}else _L(a,t.layoutBox,r)&&GO(n=>{const a=o?t.measuredBox[n]:t.layoutBox[n],i=MO(r[n]);a.max=a.min+i,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[n].max=e.relativeTarget[n].min+i)});const i={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};EO(i,r,t.layoutBox);const s={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};o?EO(s,e.applyTransform(n,!0),t.measuredBox):EO(s,r,t.layoutBox);const l=!VO(i);let c=!1;if(!e.resumeFrom){const n=e.getClosestProjectingParent();if(n&&!n.resumeFrom){const{snapshot:a,layout:o}=n;if(a&&o){const i=e.options.layoutAnchor||void 0,s={x:{min:0,max:0},y:{min:0,max:0}};zO(s,t.layoutBox,a.layoutBox,i);const l={x:{min:0,max:0},y:{min:0,max:0}};zO(l,r,o.layoutBox,i),jO(s,l)||(c=!0),n.options.layoutRoot&&(e.relativeTarget=l,e.relativeTargetOrigin=s,e.relativeParent=n)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:t,delta:s,layoutDelta:i,hasLayoutChanged:l,hasRelativeLayoutChanged:c})}else if(e.isLead()){const{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function mL(e){mP.value&&iL.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=Boolean(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function fL(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function gL(e){e.clearSnapshot()}function vL(e){e.clearMeasurements()}function yL(e){e.isLayoutDirty=!0,e.updateLayout()}function bL(e){e.isLayoutDirty=!1}function xL(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function wL(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function SL(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function kL(e){e.resolveTargetDelta()}function CL(e){e.calcProjection()}function NL(e){e.resetSkewAndRotation()}function TL(e){e.removeLeadSnapshot()}function AL(e,t,r){e.translate=oR(t.translate,0,r),e.scale=oR(t.scale,1,r),e.origin=t.origin,e.originPoint=t.originPoint}function ML(e,t,r,n){e.min=oR(t.min,r.min,n),e.max=oR(t.max,r.max,n)}function DL(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}var EL={duration:.45,ease:[.4,0,.1,1]},IL=e=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),RL=IL("applewebkit/")&&!IL("chrome/")?Math.round:HE;function zL(e){e.min=RL(e.min),e.max=RL(e.max)}function _L(e,t,r){return"position"===e||"preserve-aspect"===e&&!function(e,t,r){return Math.abs(e-t)<=r}(qO(t),qO(r),.2)}function PL(e){return e!==e.root&&e.scroll?.wasRoot}var OL=uL({attachResizeListener:(e,t)=>eL(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),LL={current:void 0},FL=uL({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!LL.current){const e=new OL({});e.mount(window),e.setOptions({layoutScroll:!0}),LL.current=e}return LL.current},resetTransform:(e,t)=>{e.style.transform=void 0!==t?t:"none"},checkIsScrollRoot:e=>Boolean("fixed"===window.getComputedStyle(e).position)}),BL=te({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function VL(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function $L(...e){return X.useCallback(function(...e){return t=>{let r=!1;const n=e.map(e=>{const n=VL(e,t);return r||"function"!=typeof n||(r=!0),n});if(r)return()=>{for(let t=0;t<n.length;t++){const r=n[t];"function"==typeof r?r():VL(e[t],null)}}}}(...e),e)}var HL=class extends X.Component{getSnapshotBeforeUpdate(e){const t=this.props.childRef.current;if(F_(t)&&e.isPresent&&!this.props.isPresent&&!1!==this.props.pop){const e=t.offsetParent,r=F_(e)&&e.offsetWidth||0,n=F_(e)&&e.offsetHeight||0,a=getComputedStyle(t),o=this.props.sizeRef.current;o.height=parseFloat(a.height),o.width=parseFloat(a.width),o.top=t.offsetTop,o.left=t.offsetLeft,o.right=r-o.width-o.left,o.bottom=n-o.height-o.top,o.direction=a.direction}return null}componentDidUpdate(){}render(){return this.props.children}};function jL({children:e,isPresent:t,anchorX:r,anchorY:n,root:a,pop:o}){const i=ce(),s=me(null),l=me({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:c}=se(BL),d=!1!==o?e.props?.ref??e?.ref:void 0,u=$L(s,d);return ue(()=>{const{width:e,height:d,top:u,left:h,right:p,bottom:m,direction:f}=l.current;if(t||!1===o||!s.current||!e||!d)return;const g="rtl"===f,v="left"===r?g?`right: ${p}`:`left: ${h}`:g?`left: ${h}`:`right: ${p}`,y="bottom"===n?`bottom: ${m}`:`top: ${u}`;s.current.dataset.motionPopId=i;const b=document.createElement("style");c&&(b.nonce=c);const x=a??document.head;return x.appendChild(b),b.sheet&&b.sheet.insertRule(`\n [data-motion-pop-id="${i}"] {\n position: absolute !important;\n width: ${e}px !important;\n height: ${d}px !important;\n ${v}px !important;\n ${y}px !important;\n }\n `),()=>{s.current?.removeAttribute("data-motion-pop-id"),x.contains(b)&&x.removeChild(b)}},[t]),be(HL,{isPresent:t,childRef:s,sizeRef:l,pop:o,children:!1===o?e:X.cloneElement(e,{ref:u})})}var qL=({children:e,initial:t,isPresent:r,onExitComplete:n,custom:a,presenceAffectsLayout:o,mode:i,anchorX:s,anchorY:l,root:c})=>{const d=DE(UL),u=ce(),h=me(r),p=me(n);EE(()=>{h.current=r,p.current=n});let m=!0,f=pe(()=>(m=!1,{id:u,initial:t,isPresent:r,custom:a,onExitComplete:e=>{d.set(e,!0);for(const t of d.values())if(!t)return;n&&n()},register:e=>(d.set(e,!1),()=>{d.delete(e),!h.current&&!d.size&&p.current?.()})}),[r,d,n]);return o&&m&&(f={...f}),pe(()=>{d.forEach((e,t)=>d.set(t,!1))},[r]),X.useEffect(()=>{!r&&!d.size&&n&&n()},[r]),e=be(jL,{pop:"popLayout"===i,isPresent:r,anchorX:s,anchorY:l,root:c,children:e}),be(IE.Provider,{value:f,children:e})};function UL(){/* @__PURE__ */
450
+ return new Map}function GL(e=!0){const t=se(IE);if(null===t)return[!0,null];const{isPresent:r,onExitComplete:n,register:a}=t,o=ce();le(()=>{if(e)return a(o)},[e]);const i=ie(()=>e&&n&&n(o),[o,n,e]);return!r&&n?[!1,i]:[!0]}var WL=e=>e.key||"";function KL(e){const t=[];return J.forEach(e,e=>{ae(e)&&t.push(e)}),t}var YL=({children:e,custom:t,initial:r=!0,onExitComplete:n,presenceAffectsLayout:a=!0,mode:o="sync",propagate:i=!1,anchorX:s="left",anchorY:l="top",root:c})=>{const[d,u]=GL(i),h=pe(()=>KL(e),[e]),p=i&&!d?[]:h.map(WL),m=me(!0),f=me(h),g=DE(()=>/* @__PURE__ */new Map),v=me(/* @__PURE__ */new Set),[y,b]=fe(h),[x,w]=fe(h);EE(()=>{!i||d||x.length||u?.()},[d,i,x.length,u]),EE(()=>{m.current=!1,f.current=h;for(let e=0;e<x.length;e++){const t=WL(x[e]);p.includes(t)?(g.delete(t),v.current.delete(t)):!0!==g.get(t)&&g.set(t,!1)}},[x,p.length,p.join("-")]);const S=[];if(h!==y){let e=[...h],t=0;for(const r of x){const n=p.indexOf(WL(r));-1===n?(e.splice(t++,0,r),S.push(r)):t=n+S.length+1}return"wait"===o&&S.length&&(e=S),w(KL(e)),b(h),null}"production"!==process.env.NODE_ENV&&"wait"===o&&x.length;const{forceRender:k}=se(ME);return be(ye,{children:x.map(e=>{const y=WL(e),b=!(i&&!d)&&(h===x||p.includes(y));return be(qL,{isPresent:b,initial:!(m.current&&!r)&&void 0,custom:t,presenceAffectsLayout:a,mode:o,root:c,onExitComplete:b?void 0:()=>{if(v.current.has(y))return;if(!g.has(y))return;v.current.add(y),g.set(y,!0);let e=!0;g.forEach(t=>{t||(e=!1)}),e&&(k?.(),w(f.current),i&&u?.(),n&&n())},anchorX:s,anchorY:l,children:e},y)})})},XL=te({strict:!1}),ZL={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},JL=!1;function QL(){return function(){if(JL)return;const e={};for(const t in ZL)e[t]={isEnabled:e=>ZL[t].some(t=>!!e[t])};DP(e),JL=!0}(),MP}var eF=/* @__PURE__ */te({});function tF(e){const{initial:t,animate:r}=function(e,t){if(SP(e)){const{initial:t,animate:r}=e;return{initial:!1===t||bP(t)?t:void 0,animate:bP(r)?r:void 0}}return!1!==e.inherit?t:{}}(e,se(eF));return pe(()=>({initial:t,animate:r}),[rF(t),rF(r)])}function rF(e){return Array.isArray(e)?e.join(" "):e}var nF=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function aF(e,t,r){for(const n in t)c_(t[n])||aO(n,r)||(e[n]=t[n])}function oF(e,t){const r={};return aF(r,e.style||{},e),Object.assign(r,function({transformTemplate:e},t){return pe(()=>{const r={style:{},transform:{},transformOrigin:{},vars:{}};return JP(r,t,e),Object.assign({},r.vars,r.style)},[t])}(e,t)),r}function iF(e,t){const r={},n=oF(e,t);return e.drag&&!1!==e.dragListener&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=!0===e.drag?"none":"pan-"+("x"===e.drag?"y":"x")),void 0===e.tabIndex&&(e.onTap||e.onTapStart||e.whileTap)&&(r.tabIndex=0),r.style=n,r}var sF=()=>({style:{},transform:{},transformOrigin:{},vars:{},attrs:{}});function lF(e,t,r,n){const a=pe(()=>{const r={style:{},transform:{},transformOrigin:{},vars:{},attrs:{}};return dO(r,t,hO(n),e.transformTemplate,e.style),{...r.attrs,style:{...r.style}}},[t]);if(e.style){const t={};aF(t,e.style,e),a.style={...t,...a.style}}return a}var cF=/* @__PURE__ */new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function dF(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||cF.has(e)}function uF(e,t){return e.startsWith("on")?!dF(e):t?.(e)??!dF(e)}var hF=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function pF(e){return"string"==typeof e&&!e.includes("-")&&!!(hF.indexOf(e)>-1||/[A-Z]/u.test(e))}function mF(e,t,r,{latestValues:n},a,o=!1,i,s){const l=(i??pF(e)?lF:iF)(t,n,a,e),c=function(e,t,r,n){const a={};for(const o in e)"values"===o&&"object"==typeof e.values||c_(e[o])||(uF(o,n)||!0===r&&dF(o)||!t&&!dF(o)||e.draggable&&o.startsWith("onDrag"))&&(a[o]=e[o]);return a}(t,"string"==typeof e,o,s),d=e!==ee?{...c,...l,ref:r}:{},{children:u}=t,h=pe(()=>c_(u)?u.get():u,[u]);return re(e,{...d,children:h})}function fF(e,t,r,n){const a={},o=n(e,{});for(const h in o)a[h]=nL(o[h]);let{initial:i,animate:s}=e;const l=SP(e),c=kP(e);t&&c&&!l&&!1!==e.inherit&&(void 0===i&&(i=t.initial),void 0===s&&(s=t.animate));let d=!!r&&!1===r.initial;d=d||!1===i;const u=d?s:i;if(u&&"boolean"!=typeof u&&!yP(u)){const t=Array.isArray(u)?u:[u];for(let r=0;r<t.length;r++){const n=n_(e,t[r]);if(n){const{transitionEnd:e,transition:t,...r}=n;for(const n in r){let e=r[n];if(Array.isArray(e)){e=e[d?e.length-1:0]}null!==e&&(a[n]=e)}for(const n in e)a[n]=e[n]}}}return a}var gF=e=>(t,r)=>{const n=se(eF),a=se(IE),o=()=>function({scrapeMotionValuesFromProps:e,createRenderState:t},r,n,a){return{latestValues:fF(r,n,a,e),renderState:t()}}(e,t,n,a);return r?o():DE(o)},vF=/*@__PURE__*/gF({scrapeMotionValuesFromProps:oO,createRenderState:nF}),yF=/*@__PURE__*/gF({scrapeMotionValuesFromProps:pO,createRenderState:sF}),bF=Symbol.for("motionComponentSymbol");function xF(e,t,r){const n=me(r);ue(()=>{n.current=r});const a=me(null);return ie(r=>{r&&e.onMount?.(r),t&&(r?t.mount(r):t.unmount());const o=n.current;if("function"==typeof o)if(r){const e=o(r);"function"==typeof e&&(a.current=e)}else a.current?(a.current(),a.current=null):o(r);else o&&(o.current=r)},[t])}var wF=te({});function SF(e){return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function kF(e,t,r,n,a,o){const{visualElement:i}=se(eF),s=se(XL),l=se(IE),c=se(BL),d=c.reducedMotion,u=c.skipAnimations,h=me(null),p=me(!1);n=n||s.renderer,!h.current&&n&&(h.current=n(e,{visualState:t,parent:i,props:r,presenceContext:l,blockInitialAnimation:!!l&&!1===l.initial,reducedMotionConfig:d,skipAnimations:u,isSVG:o}),p.current&&h.current&&(h.current.manuallyAnimateOnMount=!0));const m=h.current,f=se(wF);!m||m.projection||!a||"html"!==m.type&&"svg"!==m.type||function(e,t,r,n){const{layoutId:a,layout:o,drag:i,dragConstraints:s,layoutScroll:l,layoutRoot:c,layoutAnchor:d,layoutCrossfade:u}=t;e.projection=new r(e.latestValues,t["data-framer-portal-id"]?void 0:CF(e.parent)),e.projection.setOptions({layoutId:a,layout:o,alwaysMeasureLayout:Boolean(i)||s&&SF(s),visualElement:e,animationType:"string"==typeof o?o:"both",initialPromotionConfig:n,crossfade:u,layoutScroll:l,layoutRoot:c,layoutAnchor:d})}(h.current,r,a,f);const g=me(!1);ue(()=>{m&&g.current&&m.update(r,l)});const v=r[h_],y=me(Boolean(v)&&"undefined"!=typeof window&&!window.MotionHandoffIsComplete?.(v)&&window.MotionHasOptimisedAnimation?.(v));return EE(()=>{p.current=!0,m&&(g.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),y.current&&m.animationState&&m.animationState.animateChanges())}),le(()=>{m&&(!y.current&&m.animationState&&m.animationState.animateChanges(),y.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(v)}),y.current=!1),m.enteringChildren=void 0)}),m}function CF(e){if(e)return!1!==e.options.allowProjection?e.projection:CF(e.parent)}function NF(e,{forwardMotionProps:t=!1,type:r}={},n,a){n&&function(e){const t=QL();for(const r in e)t[r]={...t[r],...e[r]};DP(t)}(n);const o=r?"svg"===r:pF(e),i=o?yF:vF;function s(r,s){let l;const c={...se(BL),...r,layoutId:TF(r)},{isStatic:d,isValidProp:u}=c,h=tF(r),p=i(r,d);if(!d&&"undefined"!=typeof window){!function(e,t){const r=se(XL).strict;if("production"!==process.env.NODE_ENV&&t&&r){const t="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";e.ignoreStrict?PE(!1,t,"lazy-strict-mode"):OE(!1,t,"lazy-strict-mode")}}(c,n);const t=function(e){const{drag:t,layout:r}=QL();if(!t&&!r)return{};const n={...t,...r};return{MeasureLayout:t?.isEnabled(e)||r?.isEnabled(e)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}(c);l=t.MeasureLayout,h.visualElement=kF(e,p,c,a,t.ProjectionNode,o)}return xe(eF.Provider,{value:h,children:[l&&h.visualElement?be(l,{visualElement:h.visualElement,...c}):null,mF(e,r,xF(p,h.visualElement,s),p,d,t,o,u)]})}s.displayName=`motion.${"string"==typeof e?e:`create(${e.displayName??e.name??""})`}`;const l=ne(s);return l[bF]=e,l}function TF({layoutId:e}){const t=se(ME).id;return t&&void 0!==e?t+"-"+e:e}function AF(e,t){if("undefined"==typeof Proxy)return NF;const r=/* @__PURE__ */new Map,n=(r,n)=>NF(r,n,e,t);return new Proxy((e,t)=>("production"!==process.env.NODE_ENV&&XE(!1,"motion() is deprecated. Use motion.create() instead."),n(e,t)),{get:(a,o)=>"create"===o?n:(r.has(o)||r.set(o,NF(o,void 0,e,t)),r.get(o))})}var MF=(e,t)=>t.isSVG??pF(e)?new mO(t):new iO(t,{allowProjection:e!==ee}),DF=0,EF={animation:{Feature:class extends RP{constructor(e){super(e),e.animationState||(e.animationState=wO(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();yP(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}},exit:{Feature:class extends RP{constructor(){super(...arguments),this.id=DF++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;if(e&&!1===r){if(this.isExitComplete){const{initial:e,custom:t}=this.node.getProps();if("string"==typeof e||"object"==typeof e&&null!==e&&!Array.isArray(e)){const r=a_(this.node,e,t);if(r){const{transition:e,transitionEnd:t,...n}=r;for(const r in n)this.node.getValue(r)?.jump(n[r])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);return void(this.isExitComplete=!1)}const n=this.node.animationState.setActive("exit",!e);t&&!e&&n.then(()=>{this.isExitComplete=!0,t(this.id)})}mount(){const{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}}};function IF(e){return{point:{x:e.pageX,y:e.pageY}}}function RF(e,t,r,n){return eL(e,t,(e=>t=>G_(t)&&e(t,IF(t)))(r),n)}var zF=({current:e})=>e?e.ownerDocument.defaultView:null,_F=(e,t)=>Math.abs(e-t);var PF=/*#__PURE__*/new Set(["auto","scroll"]),OF=class{constructor(e,t,{transformPagePoint:r,contextWindow:n=window,dragSnapToOrigin:a=!1,distanceThreshold:o=3,element:i}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=/* @__PURE__ */new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=LF(this.lastRawMoveEventInfo,this.transformPagePoint));const e=BF(this.lastMoveEventInfo,this.history),t=null!==this.startEvent,r=function(e,t){const r=_F(e.x,t.x),n=_F(e.y,t.y);return Math.sqrt(r**2+n**2)}(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!r)return;const{point:n}=e,{timestamp:a}=bI;this.history.push({...n,timestamp:a});const{onStart:o,onMove:i}=this.handlers;t||(o&&o(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),i&&i(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastRawMoveEventInfo=t,this.lastMoveEventInfo=LF(t,this.transformPagePoint),vI.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();const{onEnd:r,onSessionEnd:n,resumeAnimation:a}=this.handlers;if(!this.dragSnapToOrigin&&this.startEvent||a&&a(),!this.lastMoveEvent||!this.lastMoveEventInfo)return;const o=BF("pointercancel"===e.type?this.lastMoveEventInfo:LF(t,this.transformPagePoint),this.history);this.startEvent&&r&&r(e,o),n&&n(e,o)},!G_(e))return;this.dragSnapToOrigin=a,this.handlers=t,this.transformPagePoint=r,this.distanceThreshold=o,this.contextWindow=n||window;const s=LF(IF(e),this.transformPagePoint),{point:l}=s,{timestamp:c}=bI;this.history=[{...l,timestamp:c}];const{onSessionStart:d}=t;d&&d(e,BF(s,this.history));const u={passive:!0,capture:!0};this.removeListeners=jE(RF(this.contextWindow,"pointermove",this.handlePointerMove,u),RF(this.contextWindow,"pointerup",this.handlePointerUp,u),RF(this.contextWindow,"pointercancel",this.handlePointerUp,u)),i&&this.startScrollTracking(i)}startScrollTracking(e){let t=e.parentElement;for(;t;){const e=getComputedStyle(t);(PF.has(e.overflowX)||PF.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const t=this.scrollPositions.get(e);if(!t)return;const r=e===window,n=r?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},a=n.x-t.x,o=n.y-t.y;0===a&&0===o||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=a,this.lastMoveEventInfo.point.y+=o):this.history.length>0&&(this.history[0].x-=a,this.history[0].y-=o),this.scrollPositions.set(e,n),vI.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),yI(this.updatePoint)}};function LF(e,t){return t?{point:t(e.point)}:e}function FF(e,t){return{x:e.x-t.x,y:e.y-t.y}}function BF({point:e},t){return{point:e,delta:FF(e,$F(t)),offset:FF(e,VF(t)),velocity:HF(t,.1)}}function VF(e){return e[0]}function $F(e){return e[e.length-1]}function HF(e,t){if(e.length<2)return{x:0,y:0};let r=e.length-1,n=null;const a=$F(e);for(;r>=0&&(n=e[r],!(a.timestamp-n.timestamp>GE(t)));)r--;if(!n)return{x:0,y:0};n===e[0]&&e.length>2&&a.timestamp-n.timestamp>2*GE(t)&&(n=e[1]);const o=WE(a.timestamp-n.timestamp);if(0===o)return{x:0,y:0};const i={x:(a.x-n.x)/o,y:(a.y-n.y)/o};return i.x===1/0&&(i.x=0),i.y===1/0&&(i.y=0),i}function jF(e,t,r){return{min:void 0!==t?e.min+t:void 0,max:void 0!==r?e.max+r-(e.max-e.min):void 0}}function qF(e,t){let r=t.min-e.min,n=t.max-e.max;return t.max-t.min<e.max-e.min&&([r,n]=[n,r]),{min:r,max:n}}var UF=.35;function GF(e,t,r){return{min:WF(e,t),max:WF(e,r)}}function WF(e,t){return"number"==typeof e?e:e[t]||0}var KF=/* @__PURE__ */new WeakMap,YF=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic={x:{min:0,max:0},y:{min:0,max:0}},this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:r}={}){const{presenceContext:n}=this.visualElement;if(n&&!1===n.isPresent)return;const{dragSnapToOrigin:a}=this.getProps();this.panSession=new OF(e,{onSessionStart:e=>{t&&this.snapToCursor(IF(e).point),this.stopAnimation()},onStart:(e,t)=>{const{drag:r,dragPropagation:n,onDragStart:a}=this.getProps();if(r&&!n&&(this.openDragLock&&this.openDragLock(),this.openDragLock="x"===(o=r)||"y"===o?$_[o]?null:($_[o]=!0,()=>{$_[o]=!1}):$_.x||$_.y?null:($_.x=$_.y=!0,()=>{$_.x=$_.y=!1}),!this.openDragLock))return;var o;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),GO(e=>{let t=this.getAxisMotionValue(e).get()||0;if(HI.test(t)){const{projection:r}=this.visualElement;if(r&&r.layout){const n=r.layout.layoutBox[e];n&&(t=MO(n)*(parseFloat(t)/100))}}this.originPoint[e]=t}),a&&vI.update(()=>a(e,t),!1,!0),d_(this.visualElement,"transform");const{animationState:i}=this.visualElement;i&&i.setActive("whileDrag",!0)},onMove:(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;const{dragPropagation:r,dragDirectionLock:n,onDirectionLock:a,onDrag:o}=this.getProps();if(!r&&!this.openDragLock)return;const{offset:i}=t;if(n&&null===this.currentDirection)return this.currentDirection=function(e,t=10){let r=null;Math.abs(e.y)>t?r="y":Math.abs(e.x)>t&&(r="x");return r}(i),void(null!==this.currentDirection&&a&&a(this.currentDirection));this.updateAxis("x",t.point,i),this.updateAxis("y",t.point,i),this.visualElement.render(),o&&vI.update(()=>o(e,t),!1,!0)},onSessionEnd:(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},resumeAnimation:()=>{const{dragSnapToOrigin:e}=this.getProps();(e||this.constraints)&&this.startAnimation({x:0,y:0})}},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:a,distanceThreshold:r,contextWindow:zF(this.visualElement),element:this.visualElement.current})}stop(e,t){const r=e||this.latestPointerEvent,n=t||this.latestPanInfo,a=this.isDragging;if(this.cancel(),!a||!n||!r)return;const{velocity:o}=n;this.startAnimation(o);const{onDragEnd:i}=this.getProps();i&&vI.postRender(()=>i(r,n))}cancel(){this.isDragging=!1;const{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,r){const{drag:n}=this.getProps();if(!r||!ZF(e,n,this.currentDirection))return;const a=this.getAxisMotionValue(e);let o=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(o=function(e,{min:t,max:r},n){return void 0!==t&&e<t?e=n?oR(t,e,n.min):Math.max(e,t):void 0!==r&&e>r&&(e=n?oR(r,e,n.max):Math.min(e,r)),e}(o,this.constraints[e],this.elastic[e])),a.set(o)}resolveConstraints(){const{dragConstraints:e,dragElastic:t}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,n=this.constraints;e&&SF(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!e||!r)&&function(e,{top:t,left:r,bottom:n,right:a}){return{x:jF(e.x,r,a),y:jF(e.y,t,n)}}(r.layoutBox,e),this.elastic=function(e=UF){return!1===e?e=0:!0===e&&(e=UF),{x:GF(e,"left","right"),y:GF(e,"top","bottom")}}(t),n!==this.constraints&&!SF(e)&&r&&this.constraints&&!this.hasMutatedConstraints&&GO(e=>{!1!==this.constraints&&this.getAxisMotionValue(e)&&(this.constraints[e]=function(e,t){const r={};return void 0!==t.min&&(r.min=t.min-e.min),void 0!==t.max&&(r.max=t.max-e.min),r}(r.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!SF(e))return!1;const r=e.current;OE(null!==r,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:n}=this.visualElement;if(!n||!n.layout)return!1;n.root&&(n.root.scroll=void 0,n.root.updateScroll());const a=function(e,t,r){const n=YP(e,r),{scroll:a}=t;return a&&(UP(n.x,a.offset.x),UP(n.y,a.offset.y)),n}(r,n.root,this.visualElement.getTransformPagePoint());let o=function(e,t){return{x:qF(e.x,t.x),y:qF(e.y,t.y)}}(n.layout.layoutBox,a);if(t){const e=t(function({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}(o));this.hasMutatedConstraints=!!e,e&&(o=zP(e))}return o}startAnimation(e){const{drag:t,dragMomentum:r,dragElastic:n,dragTransition:a,dragSnapToOrigin:o,onDragTransitionEnd:i}=this.getProps(),s=this.constraints||{},l=GO(i=>{if(!ZF(i,t,this.currentDirection))return;let l=s&&s[i]||{};!0!==o&&o!==i||(l={min:0,max:0});const c=n?200:1e6,d=n?40:1e7,u={type:"inertia",velocity:r?e[i]:0,bounceStiffness:c,bounceDamping:d,timeConstant:750,restDelta:1,restSpeed:10,...a,...l};return this.startAxisValueAnimation(i,u)});return Promise.all(l).then(i)}startAxisValueAnimation(e,t){const r=this.getAxisMotionValue(e);return d_(this.visualElement,e),r.start(Qz(e,r,0,t,this.visualElement,!1))}stopAnimation(){GO(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const t=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps()[t];return r||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor(e){GO(t=>{const{drag:r}=this.getProps();if(!ZF(t,r,this.currentDirection))return;const{projection:n}=this.visualElement,a=this.getAxisMotionValue(t);if(n&&n.layout){const{min:r,max:o}=n.layout.layoutBox[t],i=a.get()||0;a.set(e[t]-oR(r,o,.5)+i)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:r}=this.visualElement;if(!SF(t)||!r||!this.constraints)return;this.stopAnimation();const n={x:0,y:0};GO(e=>{const t=this.getAxisMotionValue(e);if(t&&!1!==this.constraints){const r=t.get();n[e]=function(e,t){let r=.5;const n=MO(e),a=MO(t);return a>n?r=qE(t.min,t.max-n,e.min):n>a&&(r=qE(e.min,e.max-a,t.min)),_E(0,1,r)}({min:r,max:r},this.constraints[e])}});const{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),GO(t=>{if(!ZF(t,e,null))return;const r=this.getAxisMotionValue(t),{min:a,max:o}=this.constraints[t];r.set(oR(a,o,n[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;KF.set(this.visualElement,this);const e=this.visualElement.current,t=RF(e,"pointerdown",t=>{const{drag:r,dragListener:n=!0}=this.getProps(),a=t.target,o=a!==e&&function(e){return K_.has(e.tagName)||!0===e.isContentEditable}(a);r&&n&&!o&&this.start(t)});let r;const n=()=>{const{dragConstraints:t}=this.getProps();SF(t)&&t.current&&(this.constraints=this.resolveRefConstraints(),r||(r=function(e,t,r){const n=pP(e,XF(r)),a=pP(t,XF(r));return()=>{n(),a()}}(e,t.current,()=>this.scalePositionWithinConstraints())))},{projection:a}=this.visualElement,o=a.addEventListener("measure",n);a&&!a.layout&&(a.root&&a.root.updateScroll(),a.updateLayout()),vI.read(n);const i=eL(window,"resize",()=>this.scalePositionWithinConstraints()),s=a.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(GO(t=>{const r=this.getAxisMotionValue(t);r&&(this.originPoint[t]+=e[t].translate,r.set(r.get()+e[t].translate))}),this.visualElement.render())});return()=>{i(),t(),o(),s&&s(),r&&r()}}getProps(){const e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:r=!1,dragPropagation:n=!1,dragConstraints:a=!1,dragElastic:o=UF,dragMomentum:i=!0}=e;return{...e,drag:t,dragDirectionLock:r,dragPropagation:n,dragConstraints:a,dragElastic:o,dragMomentum:i}}};function XF(e){let t=!0;return()=>{t?t=!1:e()}}function ZF(e,t,r){return!(!0!==t&&t!==e||null!==r&&r!==e)}var JF=e=>(t,r)=>{e&&vI.update(()=>e(t,r),!1,!0)},QF=!1,eB=class extends Q{componentDidMount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:r,layoutId:n}=this.props,{projection:a}=e;a&&(t.group&&t.group.add(a),r&&r.register&&n&&r.register(a),QF&&a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions({...a.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),oL.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:t,visualElement:r,drag:n,isPresent:a}=this.props,{projection:o}=r;return o?(o.isPresent=a,e.layoutDependency!==t&&o.setOptions({...o.options,layoutDependency:t}),QF=!0,n||e.layoutDependency!==t||void 0===t||e.isPresent!==a?o.willUpdate():this.safeToRemove(),e.isPresent!==a&&(a?o.promote():o.relegate()||vI.postRender(()=>{const e=o.getStack();e&&e.members.length||this.safeToRemove()})),null):null}componentDidUpdate(){const{visualElement:e,layoutAnchor:t}=this.props,{projection:r}=e;r&&(r.options.layoutAnchor=t,r.root.didUpdate(),B_.postRender(()=>{!r.currentAnimation&&r.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:r}=this.props,{projection:n}=e;QF=!0,n&&(n.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(n),r&&r.deregister&&r.deregister(n))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}};function tB(e){const[t,r]=GL(),n=se(ME);return be(eB,{...e,layoutGroup:n,switchLayoutGroup:se(wF),isPresent:t,safeToRemove:r})}var rB={pan:{Feature:class extends RP{constructor(){super(...arguments),this.removePointerDownListener=HE}onPointerDown(e){this.session=new OF(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:zF(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:r,onPanEnd:n}=this.node.getProps();return{onSessionStart:JF(e),onStart:JF(t),onMove:JF(r),onEnd:(e,t)=>{delete this.session,n&&vI.postRender(()=>n(e,t))}}}mount(){this.removePointerDownListener=RF(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends RP{constructor(e){super(e),this.removeGroupControls=HE,this.removeListeners=HE,this.controls=new YF(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||HE}update(){const{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},ProjectionNode:FL,MeasureLayout:tB}};function nB(e,t,r){const{props:n}=e;e.animationState&&n.whileHover&&e.animationState.setActive("whileHover","Start"===r);const a=n["onHover"+r];a&&vI.postRender(()=>a(t,IF(t)))}function aB(e,t,r){const{props:n}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&n.whileTap&&e.animationState.setActive("whileTap","Start"===r);const a=n["onTap"+("End"===r?"":r)];a&&vI.postRender(()=>a(t,IF(t)))}var oB=/* @__PURE__ */new WeakMap,iB=/* @__PURE__ */new WeakMap,sB=e=>{const t=oB.get(e.target);t&&t(e)},lB=e=>{e.forEach(sB)};function cB(e,t,r){const n=function({root:e,...t}){const r=e||document;iB.has(r)||iB.set(r,{});const n=iB.get(r),a=JSON.stringify(t);return n[a]||(n[a]=new IntersectionObserver(lB,{root:e,...t})),n[a]}(t);return oB.set(e,r),n.observe(e),()=>{oB.delete(e),n.unobserve(e)}}var dB={some:0,all:1};var uB=/*@__PURE__*/AF({...EF,...{inView:{Feature:class extends RP{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();const{viewport:e={}}=this.node.getProps(),{root:t,margin:r,amount:n="some",once:a}=e,o={root:t?t.current:void 0,rootMargin:r,threshold:"number"==typeof n?n:dB[n]};this.stopObserver=cB(this.node.current,o,e=>{const{isIntersecting:t}=e;if(this.isInView===t)return;if(this.isInView=t,a&&!t&&this.hasEnteredView)return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",t);const{onViewportEnter:r,onViewportLeave:n}=this.node.getProps(),o=t?r:n;o&&o(e)})}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;const{props:e,prevProps:t}=this.node;["amount","margin","root"].some(function({viewport:e={}},{viewport:t={}}={}){return r=>e[r]!==t[r]}(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}},tap:{Feature:class extends RP{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:t,propagate:r}=this.node.props;this.unmount=eP(e,(e,t)=>(aB(this.node,t,"Start"),(e,{success:t})=>aB(this.node,e,t?"End":"Cancel")),{useGlobalTarget:t,stopPropagation:!1===r?.tap})}unmount(){}}},focus:{Feature:class extends RP{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch(t){e=!0}e&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=jE(eL(this.node.current,"focus",()=>this.onFocus()),eL(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends RP{mount(){const{current:e}=this.node;e&&(this.unmount=q_(e,(e,t)=>(nB(this.node,t,"Start"),e=>nB(this.node,e,"End"))))}unmount(){}}}},...rB,...{layout:{ProjectionNode:FL,MeasureLayout:tB}}},MF),hB={type:"tween",ease:[.22,1,.36,1],duration:.5};function pB({percentage:e}){const t=24,r=10.75,n=2*Math.PI*r,a=n-e/100*n;/* @__PURE__ */
451
+ return xe("svg",{width:t,height:t,className:"-rotate-90 shrink-0",children:[/* @__PURE__ */be("circle",{cx:12,cy:12,r:r,fill:"none",stroke:"var(--muted)",strokeWidth:2.5}),/* @__PURE__ */be(uB.circle,{cx:12,cy:12,r:r,fill:"none",stroke:"var(--foreground)",strokeWidth:2.5,strokeDasharray:n,initial:{strokeDashoffset:n},animate:{strokeDashoffset:a},transition:{duration:.15,ease:"easeOut"},strokeLinecap:"round"})]})}function mB({headings:e,onNavigate:t,editorRef:r}){const[n,a]=fe(null),[o,i]=fe(null),[s,l]=fe(!1),[c,d]=fe(0),[u,h]=fe(44),p=me(null);le(()=>{const e=()=>{const e=document.querySelector(".toolbar");e&&h(e.getBoundingClientRect().bottom+6)};e();const t=document.querySelector(".toolbar");if(!t)return;const r=new ResizeObserver(e);return r.observe(t),()=>r.disconnect()},[]);const m=pe(()=>0===e.length?1:Math.min(...e.map(([,,e])=>parseInt(e[1],10))),[e]);if(le(()=>{(()=>{if(!r?.current)return;const t=e[0]?.[0];if(!t)return;const n=r.current.getElementByKey(t);if(!n)return;let a=n.parentElement;for(;a;){const e=window.getComputedStyle(a);if("auto"===e.overflowY||"scroll"===e.overflowY)return void(p.current=a);a=a.parentElement}p.current=null})()},[e,r]),le(()=>{if(0===e.length)return;const t=e=>r?.current?.getElementByKey(e)??null,n=()=>{const r=p.current,n=r?r.scrollTop:window.scrollY,o=r?r.clientHeight:window.innerHeight,i=(r?r.scrollHeight:document.documentElement.scrollHeight)-o;d(i>0?Math.min(100,Math.max(0,n/i*100)):0);const s=.3*o;let l=null;for(const[a]of e){const e=t(a);if(!e)continue;const n=e.getBoundingClientRect(),o=r?r.getBoundingClientRect().top:0;if(!(n.top-o<=s))break;l=a}!l&&e.length>0&&(l=e[0][0]),a(l)},o=p.current??window;return o.addEventListener("scroll",n,{passive:!0}),n(),()=>o.removeEventListener("scroll",n)},[e,r]),0===e.length)return null;const f=e.find(([e])=>e===n)?.[1]??"Contents";/* @__PURE__ */
452
+ return xe(ye,{children:[/* @__PURE__ */be(YL,{children:s&&/* @__PURE__ */be(uB.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:hB,className:"fixed inset-0 z-[9998] bg-black/20 backdrop-blur-[4px]",onClick:()=>l(!1)})}),/* @__PURE__ */be(uB.div,{initial:{y:-50,opacity:0},animate:{y:0,opacity:1},transition:{type:"spring",stiffness:300,damping:25},style:{top:u},className:"fixed left-1/2 z-[9999] flex -translate-x-1/2 flex-col items-center",children:/* @__PURE__ */xe(uB.div,{onClick:()=>{s||l(!0)},initial:!1,animate:{width:s?340:280,height:s?400:52,borderRadius:s?24:26},transition:hB,style:{cursor:s?"default":"pointer"},className:"relative overflow-hidden border border-foreground/10 bg-background text-foreground shadow-2xl",children:[/* @__PURE__ */xe(uB.div,{initial:!1,animate:{opacity:s?0:1,scale:s?.95:1,filter:s?"blur(4px)":"blur(0px)"},transition:{...hB,delay:s?0:.1},className:ec("absolute inset-0 flex items-center gap-4 px-4 sm:px-5",s&&"pointer-events-none"),children:[
453
453
  /* @__PURE__ */be("div",{className:"h-2 w-2 shrink-0 rounded-full bg-foreground"}),
454
- /* @__PURE__ */be("div",{className:"relative flex h-full flex-1 items-center overflow-hidden text-left",children:/* @__PURE__ */be(eF,{mode:"popLayout",initial:!1,children:/* @__PURE__ */be(gB.span,{initial:{opacity:0,y:15},animate:{opacity:1,y:0},exit:{opacity:0,y:-15},transition:{duration:.35,ease:[.16,1,.3,1]},className:"block w-full overflow-hidden text-ellipsis whitespace-nowrap text-sm font-medium text-foreground",children:f},n??"empty")})}),
455
- /* @__PURE__ */be(yB,{percentage:c})]}),/* @__PURE__ */xe(gB.div,{initial:!1,animate:{opacity:s?1:0,scale:s?1:1.05},transition:{...vB,delay:s?.1:0},className:ec("absolute inset-0 flex flex-col",!s&&"pointer-events-none"),children:[/* @__PURE__ */xe("div",{className:"flex shrink-0 items-center justify-between px-6 pb-3 pt-5",children:[/* @__PURE__ */be("span",{className:"text-[11px] font-semibold tracking-[0.08em] text-muted-foreground",children:"TABLE OF CONTENTS"}),/* @__PURE__ */be("button",{onClick:e=>{e.stopPropagation(),l(!1)},className:"text-muted-foreground transition-colors hover:text-foreground",children:/* @__PURE__ */be(ut,{className:"h-5 w-5"})})]}),/* @__PURE__ */be("div",{className:"flex-1 overflow-y-auto px-3 pb-4",children:/* @__PURE__ */be("div",{className:"flex flex-col gap-0.5",children:e.map(([e,r,a])=>{const s=parseInt(a[1],10),c=n===e,d=o===e,u=14*Math.max(0,s-m)+12;/* @__PURE__ */
456
- return xe("button",{onMouseEnter:()=>i(e),onMouseLeave:()=>i(null),onClick:r=>{r.stopPropagation(),t(e),l(!1)},style:{paddingLeft:`${u}px`},className:ec("group flex w-full shrink-0 cursor-pointer items-center rounded-lg border-none py-2 pr-3 text-left text-sm transition-all duration-300 ease-out",c&&"bg-foreground/10 font-medium text-foreground",!c&&d&&"bg-foreground/5 text-foreground/85",!c&&!d&&"bg-transparent text-foreground/45"),children:[/* @__PURE__ */be("span",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap transition-transform duration-300 group-hover:translate-x-1",children:r}),/* @__PURE__ */be(gB.div,{initial:!1,animate:{scale:c?1:0,opacity:c?1:0},transition:{duration:.3,ease:"easeOut"},className:"ml-3 h-1.5 w-1.5 shrink-0 rounded-full bg-foreground"})]},e)})})})]})]})})]})}var xB="undefined"==typeof window?{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},key:()=>null,length:0}:window.localStorage;var wB=({state:e,onRequestAccess:t,onOpenChange:r,onSignIn:n})=>{const a="denied"===e.status||"not-found"===e.status||"sign-in-required"===e.status;/* @__PURE__ */
457
- return be(IM,{open:a,onOpenChange:r,children:/* @__PURE__ */xe(_M,{className:"sm:max-w-md",children:["denied"===e.status&&/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */xe(PM,{children:[/* @__PURE__ */xe("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */be(je,{className:"h-5 w-5 text-muted-foreground"}),/* @__PURE__ */be(LM,{children:"You don't have access to this document"})]}),/* @__PURE__ */be(FM,{children:"Ask the owner for access — they'll get a one-time email letting them know you'd like to view it."})]}),/* @__PURE__ */xe(OM,{children:[/* @__PURE__ */be(oc,{variant:"outline",onClick:()=>r(!1),children:"Close"}),/* @__PURE__ */be(oc,{onClick:t,disabled:e.accessRequested||e.requesting,children:e.accessRequested?/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be(Se,{className:"h-4 w-4"}),"Request sent"]}):/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be(Ue,{className:"h-4 w-4"}),e.requesting?"Sending…":"Request access"]})})]})]}),"sign-in-required"===e.status&&/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */xe(PM,{children:[/* @__PURE__ */xe("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */be(je,{className:"h-5 w-5 text-muted-foreground"}),/* @__PURE__ */be(LM,{children:"Sign in to open this document"})]}),/* @__PURE__ */be(FM,{children:"This document belongs to someone else. Sign in so we know who to request access for."})]}),/* @__PURE__ */xe(OM,{children:[/* @__PURE__ */be(oc,{variant:"outline",onClick:()=>r(!1),children:"Close"}),n&&/* @__PURE__ */be(oc,{onClick:n,children:"Sign in"})]})]}),"not-found"===e.status&&/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */xe(PM,{children:[/* @__PURE__ */xe("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */be(Be,{className:"h-5 w-5 text-muted-foreground"}),/* @__PURE__ */be(LM,{children:"Document not found"})]}),/* @__PURE__ */be(FM,{children:"This link doesn't point to a document that exists anymore."})]}),/* @__PURE__ */be(OM,{children:/* @__PURE__ */be(oc,{onClick:()=>r(!1),children:"Close"})})]})]})})},SB=({SidebarComponent:e,SidebarContentComponent:t,mainContent:r,belowMainContent:n,openFilesSidebarSignal:a,editorEngine:o,extraTabs:i,activeExtraTabId:s,onExtraTabSelect:l,onExtraTabClose:c,onExtraTabsClose:d,onExtraTabAdd:u,onFileTabSelect:h,initialDocId:p,onActiveDocumentChange:m,onGenerateTips:f,onGenerateTopics:g,onSearchTopic:v,onSignIn:y})=>{const{theme:b,setTheme:x}=bD(),w=RE(a),[S,k]=fe(void 0),[C,N]=fe([]),[T,A]=fe(!1),[M,D]=fe([]),[E,I]=fe(!1),R=me(!1);le(()=>{!R.current&&p&&w.documents.some(e=>e.id===p)&&(R.current=!0,p!==w.activeDocId&&w.handleSelectDocument(p))},[p,w.documents,w.activeDocId,w.handleSelectDocument]);const{state:z,requestAccess:_,dismiss:P}=function(e,t,r){const[n,a]=fe({status:"idle"}),o=me(t);o.current=t;const i=me(r);i.current=r;const s=me(null);return le(()=>{if(!e||o.current.some(t=>t.id===e))return void a({status:"idle"});if(s.current===e)return;s.current=e;let t=!1;return a({status:"loading"}),(async()=>{try{const r=await fetch(`/api/doc/documents/${e}`,{credentials:"include"});if(t)return;if(r.ok){const e=await r.json();return i.current({id:e.id.toString(),title:e.title||e.name||"Untitled",content:e.content||"",parentId:e.parentId?e.parentId.toString():null,children:[],isExpanded:1===e.isExpanded,isFolder:1===e.isFolder,tags:e.metadata&&JSON.parse(e.metadata).tags||[]}),void a({status:"idle"})}if(401===r.status)return void a({status:"sign-in-required"});if(403===r.status){const e=await r.json().catch(()=>({}));return void a({status:"denied",accessRequested:Boolean(e?.accessRequested),requesting:!1})}if(404===r.status)return void a({status:"not-found"});a({status:"error"})}catch{t||a({status:"error"})}})(),()=>{t=!0}},[e]),{state:n,requestAccess:ie(async()=>{if(e){a(e=>"denied"===e.status?{...e,requesting:!0}:e);try{const t=await fetch(`/api/doc/documents/${e}/access-request`,{method:"POST",credentials:"include"});t.ok||409===t.status?a({status:"denied",accessRequested:!0,requesting:!1}):a(e=>"denied"===e.status?{...e,requesting:!1}:e)}catch{a(e=>"denied"===e.status?{...e,requesting:!1}:e)}}},[e]),dismiss:ie(()=>a({status:"idle"}),[])}}(p??null,w.documents,e=>{w.setDocuments(t=>t.some(t=>t.id===e.id)?t:[...t,e])});le(()=>{m?.(w.activeDocId)},[w.activeDocId,m]),le(()=>{N([]),D([])},[w.activeDocId]);const O=f?{tips:C,isTipsLoading:T,onGenerateTips:async()=>{if(f&&w.activeDocument){A(!0);try{const e=await f(w.activeDocument.title,w.activeDocument.content||"");N(e)}catch{N([])}finally{A(!1)}}}}:void 0,L=g?{topics:M,isTopicsLoading:E,onGenerateTopics:async()=>{if(g&&w.activeDocument){I(!0);try{const e=await g(w.activeDocument.title,w.activeDocument.content||"");D(e)}catch{D([])}finally{I(!1)}}},onSearchTopic:v}:void 0,[F,B]=function(e){const{key:t,storage:r=localStorage,debounce:n=300}=e,[a,o]=fe(()=>{try{const e=r.getItem(t);return e?JSON.parse(e):[]}catch{return[]}});return le(()=>{if(0===a.length)return;const e=setTimeout(()=>{try{r.setItem(t,JSON.stringify(a))}catch(e){}},n);return()=>clearTimeout(e)},[a,t,r,n]),[a,o]}({key:"reason-docs-sidebar",storage:xB}),V=pe(()=>{const e=w.openTabs.map(e=>({id:e,title:w.documents.find(t=>t.id===e)?.title||"Untitled",kind:"file"})),t=(i??[]).map(e=>({id:e.id,title:e.title,kind:e.kind}));return[...e,...t]},[w.openTabs,w.documents,i]),$=s??w.activeDocId,H=e=>{i?.some(t=>t.id===e)?l?.(e):(w.handleTabChange(e),h?.())},j=e=>{i?.some(t=>t.id===e)?c?.(e):w.handleTabClose(e)},q=e=>{const t=e.filter(e=>i?.some(t=>t.id===e)),r=e.filter(e=>!t.includes(e));r.length>0&&w.handleTabsClose(r),t.length>0&&(d?d(t):t.forEach(e=>c?.(e)))},U=(e,t)=>{w.handleAddDocument(e,t),t||h?.()},G=e=>{w.handleSelectDocument(e),h?.()},W={documents:w.documents,activeId:w.activeDocId,activeDocument:w.activeDocument,onSelect:G,onAdd:U,onDelete:w.handleDeleteDocument,onDuplicate:w.handleDuplicateDocument,onToggleExpand:w.handleToggleExpand,onSetExpandedFolders:w.handleSetExpandedFolders,onMove:w.handleMoveDocument,onManageTags:w.handleManageTags,onRename:(e,t)=>w.handleUpdateDocument(e,{title:t}),searchQuery:w.searchQuery,onSearchChange:w.setSearchQuery,onSearchClear:()=>w.setSearchQuery(""),onSearchFocus:()=>w.setIsSearchModalOpen(!0),isOpen:w.isSidebarOpen,onOpenChange:w.setIsSidebarOpen,isMobile:w.isMobile,leftPanels:w.leftPanels,onLeftPanelsChange:w.setLeftPanels,rightPanels:w.rightPanels,onRightPanelsChange:w.setRightPanels,onSettingsClick:e=>{k(e),w.setIsSettingsOpen(!0)},onInviteClick:()=>w.setIsInviteModalOpen(!0),onRestore:w.handleRestoreDocument,onPermanentDelete:w.handlePermanentDelete,newDocumentId:w.newDocumentId,showDynamicIsland:w.showDynamicIsland,onToggleDynamicIsland:()=>w.setShowDynamicIsland(!w.showDynamicIsland),activeFileSourceId:w.activeFileSourceId,onFileSourceChange:w.handleFileSourceChange,onNavigate:e=>w.editorRef.current?.scrollToHeading(e),editorRef:w.editorRef,openTabs:w.openTabs,activeTab:$,onTabChange:H,onTabClose:j,onTabsClose:q,onTabRename:(e,t)=>w.handleUpdateDocument(e,{title:t}),onSplitRight:w.handleSplitRight,onReopenLastClosed:w.handleReopenLastClosed,canReopenLastClosed:w.closedTabsHistory.length>0,tabItems:V,onNewChat:u,aiProps:{isAiLoading:w.isAiLoading,aiSuggestion:w.aiSuggestion,onAiApprove:w.handleAIApprove,onAiReject:w.handleAIReject,onAiRegenerate:w.handleAIRegenerate},tipsProps:O,topicsProps:L},K={activeDocument:w.activeDocument,engine:o,documents:w.documents,splitViewDocId:w.splitViewDocId,activeDocId:w.activeDocId,isMobile:w.isMobile,editorRef:w.editorRef,onUpdateDocument:w.handleUpdateDocument,onHeadingsChange:w.setHeadings,onCloseSplitView:()=>w.setSplitViewDocId(null),aiSuggestion:w.aiSuggestion,isAiLoading:w.isAiLoading,onAiRewrite:w.handleAIRewrite,onAiApprove:w.handleAIApprove,onAiReject:w.handleAIReject,onAiRegenerate:w.handleAIRegenerate,onInviteClick:()=>w.setIsInviteModalOpen(!0),onShareClick:()=>w.setIsInviteModalOpen(!0)},Y=w.rightPanels.length>0&&/* @__PURE__ */be(EM,{panels:w.rightPanels,documents:w.documents,activeId:w.activeDocId,activeDocument:w.activeDocument,onSelect:G,onAdd:U,onDelete:w.handleDeleteDocument,onDuplicate:w.handleDuplicateDocument,onSetExpandedFolders:w.handleSetExpandedFolders,onMove:w.handleMoveDocument,onManageTags:w.handleManageTags,onRename:(e,t)=>w.handleUpdateDocument(e,{title:t}),headings:w.headings,onNavigate:e=>w.editorRef.current?.scrollToHeading(e),editorRef:w.editorRef,openTabs:w.openTabs,activeTab:$,onTabChange:H,onTabClose:j,onTabsClose:q,onTabRename:(e,t)=>w.handleUpdateDocument(e,{title:t}),onSplitRight:w.handleSplitRight,onReopenLastClosed:w.handleReopenLastClosed,canReopenLastClosed:w.closedTabsHistory.length>0,tabItems:V,onNewChat:u,aiProps:{isAiLoading:w.isAiLoading,aiSuggestion:w.aiSuggestion,onAiApprove:w.handleAIApprove,onAiReject:w.handleAIReject,onAiRegenerate:w.handleAIRegenerate},tipsProps:O,topicsProps:L,onClose:()=>w.setRightPanels([]),isMobile:w.isMobile,isOpen:w.isRightSidebarOpen,onOpenChange:w.setIsRightSidebarOpen,SidebarContentComponent:t});/* @__PURE__ */
458
- return xe("div",{className:"h-screen w-screen flex flex-col overflow-hidden",children:[w.isMobile?/* @__PURE__ */xe("div",{className:"flex-1 flex flex-col overflow-hidden",children:[/* @__PURE__ */xe("div",{className:"flex items-center justify-between h-10 px-1 border-b border-sidebar-border/60 shrink-0",children:[/* @__PURE__ */be(oc,{variant:"ghost",size:"sm",className:"size-8 p-0",onClick:()=>w.setIsSidebarOpen(!0),"aria-label":"Open sidebar",children:/* @__PURE__ */be(Ge,{className:"h-5 w-5"})}),w.rightPanels.length>0&&/* @__PURE__ */be(oc,{variant:"ghost",size:"sm",className:"size-8 p-0",onClick:()=>w.setIsRightSidebarOpen(!0),"aria-label":"Open right panel",children:/* @__PURE__ */be(Je,{className:"h-5 w-5"})})]}),/* @__PURE__ */xe("div",{className:"flex-1 flex overflow-hidden",children:[
459
- /* @__PURE__ */be(e,{...W,headings:w.headings}),
460
- /* @__PURE__ */xe("main",{className:"flex-1 overflow-hidden flex flex-col",children:[/* @__PURE__ */be("div",{className:"flex-1 min-h-0 overflow-hidden flex flex-col",children:r??/* @__PURE__ */be(zc,{...K})}),n&&/* @__PURE__ */be("div",{className:"shrink-0 px-2 pt-1 pb-[60px] sm:pb-2 sm:pr-56",children:n})]}),Y]})]}):/* @__PURE__ */be("div",{className:"flex-1 overflow-hidden",children:/* @__PURE__ */xe(Ic,{direction:"horizontal",onResize:B,children:[/* @__PURE__ */be(xc,{size:F?.[0]||"250px",minSize:"0px",maxSize:"600px",children:/* @__PURE__ */be("div",{className:"overflow-y-auto overflow-x-hidden bg-background",children:/* @__PURE__ */be(e,{...W,headings:w.headings})})}),/* @__PURE__ */be(xc,{children:/* @__PURE__ */xe("div",{className:"h-screen flex flex-col bg-background",children:[/* @__PURE__ */xe("div",{className:"flex-1 flex min-h-0",children:[/* @__PURE__ */be("div",{className:"flex-1 min-h-0 overflow-auto",children:r??/* @__PURE__ */be(zc,{...K})}),Y]}),n&&/* @__PURE__ */be("div",{className:"shrink-0 px-2 pb-2",children:n})]})})]})}),w.headings.length>0&&0===w.rightPanels.length&&w.showDynamicIsland&&/* @__PURE__ */be(bB,{headings:w.headings,onNavigate:e=>w.editorRef.current?.scrollToHeading(e),editorRef:w.editorRef}),
461
- /* @__PURE__ */be(DE,{isSearchModalOpen:w.isSearchModalOpen,setIsSearchModalOpen:w.setIsSearchModalOpen,isSettingsOpen:w.isSettingsOpen,setIsSettingsOpen:w.setIsSettingsOpen,settingsInitialSection:S,isTeamsOpen:w.isTeamsOpen,setIsTeamsOpen:w.setIsTeamsOpen,isInviteModalOpen:w.isInviteModalOpen,setIsInviteModalOpen:w.setIsInviteModalOpen,isTagDialogOpen:w.isTagDialogOpen,setIsTagDialogOpen:w.setIsTagDialogOpen,documents:w.documents,activeDocument:w.activeDocument,tagManagementDocId:w.tagManagementDocId,defaultSidebarView:w.defaultSidebarView,setDefaultSidebarView:w.setDefaultSidebarView,enableDatabaseSync:w.enableDatabaseSync,setEnableDatabaseSync:w.setEnableDatabaseSync,setDocuments:w.setDocuments,onSelectDocument:G,onToggleTheme:()=>{x("dark"===b?"light":"dark")},currentTheme:b,onUpdateTags:w.handleUpdateTags}),
462
- /* @__PURE__ */be(wB,{state:z,onRequestAccess:_,onOpenChange:e=>{e||P()},onSignIn:y})]})};export{SB as t};
454
+ /* @__PURE__ */be("div",{className:"relative flex h-full flex-1 items-center overflow-hidden text-left",children:/* @__PURE__ */be(YL,{mode:"popLayout",initial:!1,children:/* @__PURE__ */be(uB.span,{initial:{opacity:0,y:15},animate:{opacity:1,y:0},exit:{opacity:0,y:-15},transition:{duration:.35,ease:[.16,1,.3,1]},className:"block w-full overflow-hidden text-ellipsis whitespace-nowrap text-sm font-medium text-foreground",children:f},n??"empty")})}),
455
+ /* @__PURE__ */be(pB,{percentage:c})]}),/* @__PURE__ */xe(uB.div,{initial:!1,animate:{opacity:s?1:0,scale:s?1:1.05},transition:{...hB,delay:s?.1:0},className:ec("absolute inset-0 flex flex-col",!s&&"pointer-events-none"),children:[/* @__PURE__ */xe("div",{className:"flex shrink-0 items-center justify-between px-6 pb-3 pt-5",children:[/* @__PURE__ */be("span",{className:"text-[11px] font-semibold tracking-[0.08em] text-muted-foreground",children:"TABLE OF CONTENTS"}),/* @__PURE__ */be("button",{onClick:e=>{e.stopPropagation(),l(!1)},className:"text-muted-foreground transition-colors hover:text-foreground",children:/* @__PURE__ */be(ut,{className:"h-5 w-5"})})]}),/* @__PURE__ */be("div",{className:"flex-1 overflow-y-auto px-3 pb-4",children:/* @__PURE__ */be("div",{className:"flex flex-col gap-0.5",children:e.map(([e,r,a])=>{const s=parseInt(a[1],10),c=n===e,d=o===e,u=14*Math.max(0,s-m)+12;/* @__PURE__ */
456
+ return xe("button",{onMouseEnter:()=>i(e),onMouseLeave:()=>i(null),onClick:r=>{r.stopPropagation(),t(e),l(!1)},style:{paddingLeft:`${u}px`},className:ec("group flex w-full shrink-0 cursor-pointer items-center rounded-lg border-none py-2 pr-3 text-left text-sm transition-all duration-300 ease-out",c&&"bg-foreground/10 font-medium text-foreground",!c&&d&&"bg-foreground/5 text-foreground/85",!c&&!d&&"bg-transparent text-foreground/45"),children:[/* @__PURE__ */be("span",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap transition-transform duration-300 group-hover:translate-x-1",children:r}),/* @__PURE__ */be(uB.div,{initial:!1,animate:{scale:c?1:0,opacity:c?1:0},transition:{duration:.3,ease:"easeOut"},className:"ml-3 h-1.5 w-1.5 shrink-0 rounded-full bg-foreground"})]},e)})})})]})]})})]})}var fB="undefined"==typeof window?{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},key:()=>null,length:0}:window.localStorage;var gB=({state:e,onRequestAccess:t,onOpenChange:r,onSignIn:n})=>{const a="denied"===e.status||"not-found"===e.status||"sign-in-required"===e.status;/* @__PURE__ */
457
+ return be(TM,{open:a,onOpenChange:r,children:/* @__PURE__ */xe(DM,{className:"sm:max-w-md",children:["denied"===e.status&&/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */xe(EM,{children:[/* @__PURE__ */xe("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */be(je,{className:"h-5 w-5 text-muted-foreground"}),/* @__PURE__ */be(RM,{children:"You don't have access to this document"})]}),/* @__PURE__ */be(zM,{children:"Ask the owner for access — they'll get a one-time email letting them know you'd like to view it."})]}),/* @__PURE__ */xe(IM,{children:[/* @__PURE__ */be(oc,{variant:"outline",onClick:()=>r(!1),children:"Close"}),/* @__PURE__ */be(oc,{onClick:t,disabled:e.accessRequested||e.requesting,children:e.accessRequested?/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be(Se,{className:"h-4 w-4"}),"Request sent"]}):/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */be(Ue,{className:"h-4 w-4"}),e.requesting?"Sending…":"Request access"]})})]})]}),"sign-in-required"===e.status&&/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */xe(EM,{children:[/* @__PURE__ */xe("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */be(je,{className:"h-5 w-5 text-muted-foreground"}),/* @__PURE__ */be(RM,{children:"Sign in to open this document"})]}),/* @__PURE__ */be(zM,{children:"This document belongs to someone else. Sign in so we know who to request access for."})]}),/* @__PURE__ */xe(IM,{children:[/* @__PURE__ */be(oc,{variant:"outline",onClick:()=>r(!1),children:"Close"}),n&&/* @__PURE__ */be(oc,{onClick:n,children:"Sign in"})]})]}),"not-found"===e.status&&/* @__PURE__ */xe(ye,{children:[/* @__PURE__ */xe(EM,{children:[/* @__PURE__ */xe("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */be(Be,{className:"h-5 w-5 text-muted-foreground"}),/* @__PURE__ */be(RM,{children:"Document not found"})]}),/* @__PURE__ */be(zM,{children:"This link doesn't point to a document that exists anymore."})]}),/* @__PURE__ */be(IM,{children:/* @__PURE__ */be(oc,{onClick:()=>r(!1),children:"Close"})})]})]})})},vB=({SidebarComponent:e,SidebarContentComponent:t,mainContent:r,belowMainContent:n,openFilesSidebarSignal:a,editorEngine:o,extraTabs:i,activeExtraTabId:s,onExtraTabSelect:l,onExtraTabClose:c,onExtraTabsClose:d,onExtraTabAdd:u,onFileTabSelect:h,initialDocId:p,onActiveDocumentChange:m,onGenerateTips:f,onGenerateTopics:g,onSearchTopic:v,onSignIn:y,settingsHref:b})=>{const{theme:x,setTheme:w}=mD(),S=AE(a),[k,C]=fe([]),[N,T]=fe(!1),[A,M]=fe([]),[D,E]=fe(!1),I=me(!1);le(()=>{!I.current&&p&&S.documents.some(e=>e.id===p)&&(I.current=!0,p!==S.activeDocId&&S.handleSelectDocument(p))},[p,S.documents,S.activeDocId,S.handleSelectDocument]);const{state:R,requestAccess:z,dismiss:_}=function(e,t,r){const[n,a]=fe({status:"idle"}),o=me(t);o.current=t;const i=me(r);i.current=r;const s=me(null);return le(()=>{if(!e||o.current.some(t=>t.id===e))return void a({status:"idle"});if(s.current===e)return;s.current=e;let t=!1;return a({status:"loading"}),(async()=>{try{const r=await fetch(`/api/doc/documents/${e}`,{credentials:"include"});if(t)return;if(r.ok){const e=await r.json();return i.current({id:e.id.toString(),title:e.title||e.name||"Untitled",content:e.content||"",parentId:e.parentId?e.parentId.toString():null,children:[],isExpanded:1===e.isExpanded,isFolder:1===e.isFolder,tags:e.metadata&&JSON.parse(e.metadata).tags||[]}),void a({status:"idle"})}if(401===r.status)return void a({status:"sign-in-required"});if(403===r.status){const e=await r.json().catch(()=>({}));return void a({status:"denied",accessRequested:Boolean(e?.accessRequested),requesting:!1})}if(404===r.status)return void a({status:"not-found"});a({status:"error"})}catch{t||a({status:"error"})}})(),()=>{t=!0}},[e]),{state:n,requestAccess:ie(async()=>{if(e){a(e=>"denied"===e.status?{...e,requesting:!0}:e);try{const t=await fetch(`/api/doc/documents/${e}/access-request`,{method:"POST",credentials:"include"});t.ok||409===t.status?a({status:"denied",accessRequested:!0,requesting:!1}):a(e=>"denied"===e.status?{...e,requesting:!1}:e)}catch{a(e=>"denied"===e.status?{...e,requesting:!1}:e)}}},[e]),dismiss:ie(()=>a({status:"idle"}),[])}}(p??null,S.documents,e=>{S.setDocuments(t=>t.some(t=>t.id===e.id)?t:[...t,e])});le(()=>{m?.(S.activeDocId)},[S.activeDocId,m]),le(()=>{C([]),M([])},[S.activeDocId]);const P=f?{tips:k,isTipsLoading:N,onGenerateTips:async()=>{if(f&&S.activeDocument){T(!0);try{const e=await f(S.activeDocument.title,S.activeDocument.content||"");C(e)}catch{C([])}finally{T(!1)}}}}:void 0,O=g?{topics:A,isTopicsLoading:D,onGenerateTopics:async()=>{if(g&&S.activeDocument){E(!0);try{const e=await g(S.activeDocument.title,S.activeDocument.content||"");M(e)}catch{M([])}finally{E(!1)}}},onSearchTopic:v}:void 0,[L,F]=function(e){const{key:t,storage:r=localStorage,debounce:n=300}=e,[a,o]=fe(()=>{try{const e=r.getItem(t);return e?JSON.parse(e):[]}catch{return[]}});return le(()=>{if(0===a.length)return;const e=setTimeout(()=>{try{r.setItem(t,JSON.stringify(a))}catch(e){}},n);return()=>clearTimeout(e)},[a,t,r,n]),[a,o]}({key:"reason-docs-sidebar",storage:fB}),B=pe(()=>{const e=S.openTabs.map(e=>({id:e,title:S.documents.find(t=>t.id===e)?.title||"Untitled",kind:"file"})),t=(i??[]).map(e=>({id:e.id,title:e.title,kind:e.kind}));return[...e,...t]},[S.openTabs,S.documents,i]),V=s??S.activeDocId,$=e=>{i?.some(t=>t.id===e)?l?.(e):(S.handleTabChange(e),h?.())},H=e=>{i?.some(t=>t.id===e)?c?.(e):S.handleTabClose(e)},j=e=>{const t=e.filter(e=>i?.some(t=>t.id===e)),r=e.filter(e=>!t.includes(e));r.length>0&&S.handleTabsClose(r),t.length>0&&(d?d(t):t.forEach(e=>c?.(e)))},q=(e,t)=>{S.handleAddDocument(e,t),t||h?.()},U=e=>{S.handleSelectDocument(e),h?.()},G={documents:S.documents,activeId:S.activeDocId,activeDocument:S.activeDocument,onSelect:U,onAdd:q,onDelete:S.handleDeleteDocument,onDuplicate:S.handleDuplicateDocument,onToggleExpand:S.handleToggleExpand,onSetExpandedFolders:S.handleSetExpandedFolders,onMove:S.handleMoveDocument,onManageTags:S.handleManageTags,onRename:(e,t)=>S.handleUpdateDocument(e,{title:t}),searchQuery:S.searchQuery,onSearchChange:S.setSearchQuery,onSearchClear:()=>S.setSearchQuery(""),onSearchFocus:()=>S.setIsSearchModalOpen(!0),isOpen:S.isSidebarOpen,onOpenChange:S.setIsSidebarOpen,isMobile:S.isMobile,leftPanels:S.leftPanels,onLeftPanelsChange:S.setLeftPanels,rightPanels:S.rightPanels,onRightPanelsChange:S.setRightPanels,settingsHref:b,onInviteClick:()=>S.setIsInviteModalOpen(!0),onRestore:S.handleRestoreDocument,onPermanentDelete:S.handlePermanentDelete,newDocumentId:S.newDocumentId,showDynamicIsland:S.showDynamicIsland,onToggleDynamicIsland:()=>S.setShowDynamicIsland(!S.showDynamicIsland),activeFileSourceId:S.activeFileSourceId,onFileSourceChange:S.handleFileSourceChange,onNavigate:e=>S.editorRef.current?.scrollToHeading(e),editorRef:S.editorRef,openTabs:S.openTabs,activeTab:V,onTabChange:$,onTabClose:H,onTabsClose:j,onTabRename:(e,t)=>S.handleUpdateDocument(e,{title:t}),onSplitRight:S.handleSplitRight,onReopenLastClosed:S.handleReopenLastClosed,canReopenLastClosed:S.closedTabsHistory.length>0,tabItems:B,onNewChat:u,aiProps:{isAiLoading:S.isAiLoading,aiSuggestion:S.aiSuggestion,onAiApprove:S.handleAIApprove,onAiReject:S.handleAIReject,onAiRegenerate:S.handleAIRegenerate},tipsProps:P,topicsProps:O},W={activeDocument:S.activeDocument,engine:o,documents:S.documents,splitViewDocId:S.splitViewDocId,activeDocId:S.activeDocId,isMobile:S.isMobile,editorRef:S.editorRef,onUpdateDocument:S.handleUpdateDocument,onHeadingsChange:S.setHeadings,onCloseSplitView:()=>S.setSplitViewDocId(null),aiSuggestion:S.aiSuggestion,isAiLoading:S.isAiLoading,onAiRewrite:S.handleAIRewrite,onAiApprove:S.handleAIApprove,onAiReject:S.handleAIReject,onAiRegenerate:S.handleAIRegenerate,onInviteClick:()=>S.setIsInviteModalOpen(!0),onShareClick:()=>S.setIsInviteModalOpen(!0)},K=S.rightPanels.length>0&&/* @__PURE__ */be(NM,{panels:S.rightPanels,documents:S.documents,activeId:S.activeDocId,activeDocument:S.activeDocument,onSelect:U,onAdd:q,onDelete:S.handleDeleteDocument,onDuplicate:S.handleDuplicateDocument,onSetExpandedFolders:S.handleSetExpandedFolders,onMove:S.handleMoveDocument,onManageTags:S.handleManageTags,onRename:(e,t)=>S.handleUpdateDocument(e,{title:t}),headings:S.headings,onNavigate:e=>S.editorRef.current?.scrollToHeading(e),editorRef:S.editorRef,openTabs:S.openTabs,activeTab:V,onTabChange:$,onTabClose:H,onTabsClose:j,onTabRename:(e,t)=>S.handleUpdateDocument(e,{title:t}),onSplitRight:S.handleSplitRight,onReopenLastClosed:S.handleReopenLastClosed,canReopenLastClosed:S.closedTabsHistory.length>0,tabItems:B,onNewChat:u,aiProps:{isAiLoading:S.isAiLoading,aiSuggestion:S.aiSuggestion,onAiApprove:S.handleAIApprove,onAiReject:S.handleAIReject,onAiRegenerate:S.handleAIRegenerate},tipsProps:P,topicsProps:O,onClose:()=>S.setRightPanels([]),isMobile:S.isMobile,isOpen:S.isRightSidebarOpen,onOpenChange:S.setIsRightSidebarOpen,SidebarContentComponent:t});/* @__PURE__ */
458
+ return xe("div",{className:"h-screen w-screen flex flex-col overflow-hidden",children:[S.isMobile?/* @__PURE__ */xe("div",{className:"flex-1 flex flex-col overflow-hidden",children:[/* @__PURE__ */xe("div",{className:"flex items-center justify-between h-10 px-1 border-b border-sidebar-border/60 shrink-0",children:[/* @__PURE__ */be(oc,{variant:"ghost",size:"sm",className:"size-8 p-0",onClick:()=>S.setIsSidebarOpen(!0),"aria-label":"Open sidebar",children:/* @__PURE__ */be(Ge,{className:"h-5 w-5"})}),S.rightPanels.length>0&&/* @__PURE__ */be(oc,{variant:"ghost",size:"sm",className:"size-8 p-0",onClick:()=>S.setIsRightSidebarOpen(!0),"aria-label":"Open right panel",children:/* @__PURE__ */be(Je,{className:"h-5 w-5"})})]}),/* @__PURE__ */xe("div",{className:"flex-1 flex overflow-hidden",children:[
459
+ /* @__PURE__ */be(e,{...G,headings:S.headings}),
460
+ /* @__PURE__ */xe("main",{className:"flex-1 overflow-hidden flex flex-col",children:[/* @__PURE__ */be("div",{className:"flex-1 min-h-0 overflow-hidden flex flex-col",children:r??/* @__PURE__ */be(zc,{...W})}),n&&/* @__PURE__ */be("div",{className:"shrink-0 px-2 pt-1 pb-[60px] sm:pb-2 sm:pr-56",children:n})]}),K]})]}):/* @__PURE__ */be("div",{className:"flex-1 overflow-hidden",children:/* @__PURE__ */xe(Ic,{direction:"horizontal",onResize:F,children:[/* @__PURE__ */be(xc,{size:L?.[0]||"250px",minSize:"0px",maxSize:"600px",children:/* @__PURE__ */be("div",{className:"overflow-y-auto overflow-x-hidden bg-background",children:/* @__PURE__ */be(e,{...G,headings:S.headings})})}),/* @__PURE__ */be(xc,{children:/* @__PURE__ */xe("div",{className:"h-screen flex flex-col bg-background",children:[/* @__PURE__ */xe("div",{className:"flex-1 flex min-h-0",children:[/* @__PURE__ */be("div",{className:"flex-1 min-h-0 overflow-auto",children:r??/* @__PURE__ */be(zc,{...W})}),K]}),n&&/* @__PURE__ */be("div",{className:"shrink-0 px-2 pb-2",children:n})]})})]})}),S.headings.length>0&&0===S.rightPanels.length&&S.showDynamicIsland&&/* @__PURE__ */be(mB,{headings:S.headings,onNavigate:e=>S.editorRef.current?.scrollToHeading(e),editorRef:S.editorRef}),
461
+ /* @__PURE__ */be(CE,{isSearchModalOpen:S.isSearchModalOpen,setIsSearchModalOpen:S.setIsSearchModalOpen,isSettingsOpen:S.isSettingsOpen,setIsSettingsOpen:S.setIsSettingsOpen,isTeamsOpen:S.isTeamsOpen,setIsTeamsOpen:S.setIsTeamsOpen,isInviteModalOpen:S.isInviteModalOpen,setIsInviteModalOpen:S.setIsInviteModalOpen,isTagDialogOpen:S.isTagDialogOpen,setIsTagDialogOpen:S.setIsTagDialogOpen,documents:S.documents,activeDocument:S.activeDocument,tagManagementDocId:S.tagManagementDocId,defaultSidebarView:S.defaultSidebarView,setDefaultSidebarView:S.setDefaultSidebarView,enableDatabaseSync:S.enableDatabaseSync,setEnableDatabaseSync:S.setEnableDatabaseSync,setDocuments:S.setDocuments,onSelectDocument:U,onToggleTheme:()=>{w("dark"===x?"light":"dark")},currentTheme:x,onUpdateTags:S.handleUpdateTags}),
462
+ /* @__PURE__ */be(gB,{state:R,onRequestAccess:z,onOpenChange:e=>{e||_()},onSignIn:y})]})};export{vB as t};