react-reason-editor 1.0.148 → 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.
@@ -1 +0,0 @@
1
- const e=require("./rolldown-runtime-BeavJI0R.cjs"),t=require("./dist-2-kjLBhJ.cjs"),r=require("./tooltip-DSRLxJD_.cjs"),n=require("./editorConfig-BJeXCimT.cjs"),a=require("./locales-mNtGplJd.cjs"),o=require("./BubbleMenus-FfgNfh6Y.cjs"),i=require("./Icon-CC1yoE4E.cjs"),s=require("./Comment-CzxM8SYl.cjs"),l=require("./reason-toolbar-skin-CGqwfyDi.cjs"),c=require("./theme.cjs");require("./katex.min-DzTn8og2.cjs");let d=require("react"),u=e.__toESM(d,1);d=e.__toESM(d);let h=require("@radix-ui/react-slot"),p=require("clsx");p=e.__toESM(p,1);let m=require("react/jsx-runtime"),f=require("lucide-react"),g=require("@radix-ui/react-dialog");g=e.__toESM(g,1);let x=require("react-dom"),v=e.__toESM(x,1);x=e.__toESM(x);let y=require("@radix-ui/react-dropdown-menu");y=e.__toESM(y,1);let b=require("@radix-ui/react-label");b=e.__toESM(b,1);let w=require("@radix-ui/react-select");w=e.__toESM(w,1);let S=require("@radix-ui/react-separator");S=e.__toESM(S,1);let k=require("@radix-ui/react-tooltip");k=e.__toESM(k,1);let C=require("@radix-ui/react-switch");C=e.__toESM(C,1);let j=require("@radix-ui/react-tabs");j=e.__toESM(j,1);let T=require("grab-url");T=e.__toESM(T,1);let N=require("re-resizable");var M=Object.defineProperty,E=(e,t)=>M(e,"name",{value:t,configurable:!0}),[A,R]=s.createContextScope("AlertDialog",[g.createDialogScope]),D=(0,g.createDialogScope)(),I=E(e=>{const{__scopeAlertDialog:t,...r}=e,n=D(t);return(0,m.jsx)(g.Root,{...n,...r,modal:!0})},"AlertDialog"),z=(u.forwardRef(E(function(e,t){const{__scopeAlertDialog:r,...n}=e,a=D(r);return(0,m.jsx)(g.Trigger,{...a,...n,ref:t})},"AlertDialogTrigger")),E(e=>{const{__scopeAlertDialog:t,...r}=e,n=D(t);return(0,m.jsx)(g.Portal,{...n,...r})},"AlertDialogPortal")),_=u.forwardRef(E(function(e,t){const{__scopeAlertDialog:r,...n}=e,a=D(r);return(0,m.jsx)(g.Overlay,{...a,...n,ref:t})},"AlertDialogOverlay")),[P,O]=A("AlertDialogContent"),L=u.forwardRef(E(function(e,t){const{__scopeAlertDialog:r,children:a,...o}=e,i=D(r),s=u.useRef(null),c=n.useComposedRefs(t,s),d=u.useRef(null);return(0,m.jsx)(P,{scope:r,cancelRef:d,children:(0,m.jsx)(g.Content,{role:"alertdialog",...i,...o,ref:c,onOpenAutoFocus:l.composeEventHandlers(o.onOpenAutoFocus,e=>{e.preventDefault(),d.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:a})})},"AlertDialogContent")),F=u.forwardRef(E(function(e,t){const{__scopeAlertDialog:r,...n}=e,a=D(r);return(0,m.jsx)(g.Title,{...a,...n,ref:t})},"AlertDialogTitle")),B=u.forwardRef(E(function(e,t){const{__scopeAlertDialog:r,...n}=e,a=D(r);return(0,m.jsx)(g.Description,{...a,...n,ref:t})},"AlertDialogDescription")),H=u.forwardRef(E(function(e,t){const{__scopeAlertDialog:r,...n}=e,a=D(r);return(0,m.jsx)(g.Close,{...a,...n,ref:t})},"AlertDialogAction")),V=u.forwardRef(E(function(e,t){const{__scopeAlertDialog:r,...a}=e,{cancelRef:o}=O("AlertDialogCancel",r),i=D(r),s=n.useComposedRefs(t,o);return(0,m.jsx)(g.Close,{...i,...a,ref:s})},"AlertDialogCancel")),$=I,q=z,U=_,G=L,W=H,K=V,Y=F,X=B;function Z(e){const[t,r]=u.useState(void 0);return s.useLayoutEffect2(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver(t=>{if(!Array.isArray(t))return;if(!t.length)return;const n=t[0];let a,o;if("borderBoxSize"in n){const e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;a=t.inlineSize,o=t.blockSize}else a=e.offsetWidth,o=e.offsetHeight;r({width:a,height:o})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)},[e]),t}(0,Object.defineProperty)(Z,"name",{value:"useSize",configurable:!0});var J=Object.defineProperty,Q=(e,t)=>J(e,"name",{value:t,configurable:!0});function ee(e,t){return u.useReducer((e,r)=>t[e][r]??e,e)}Q(ee,"useStateMachine");var te=Q(e=>{const{present:t,children:r}=e,n=re(t),a="function"==typeof r?r({present:n.isPresent}):u.Children.only(r),o=ae(n.ref,ie(a));return"function"==typeof r||n.isPresent?u.cloneElement(a,{ref:o}):null},"Presence");function re(e){const[t,r]=u.useState(),n=u.useRef(null),a=u.useRef(e),o=u.useRef("none"),i=u.useRef(void 0),[l,c]=ee(e?"mounted":"unmounted",{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return u.useEffect(()=>{"mounted"===l?(o.current=i.current??oe(n.current),i.current=void 0):o.current="none"},[l]),s.useLayoutEffect2(()=>{const t=n.current,r=a.current;if(r!==e){const n=o.current,s=oe(t);e?(i.current=s,c("MOUNT")):c("none"===s||"none"===t?.display?"UNMOUNT":r&&n!==s?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,c]),s.useLayoutEffect2(()=>{if(t){let e;const r=t.ownerDocument.defaultView??window,i=Q(o=>{const i=oe(n.current).includes(CSS.escape(o.animationName));if(o.target===t&&i&&(c("ANIMATION_END"),!a.current)){const n=t.style.animationFillMode;t.style.animationFillMode="forwards",e=r.setTimeout(()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=n)})}},"handleAnimationEnd"),s=Q(e=>{e.target===t&&(o.current=oe(n.current))},"handleAnimationStart");return t.addEventListener("animationstart",s),t.addEventListener("animationcancel",i),t.addEventListener("animationend",i),()=>{r.clearTimeout(e),t.removeEventListener("animationstart",s),t.removeEventListener("animationcancel",i),t.removeEventListener("animationend",i)}}c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:u.useCallback(e=>{if(e){const t=getComputedStyle(e);n.current=t,i.current=oe(t)}else n.current=null;r(e)},[])}}function ne(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function ae(...e){const t=u.useRef(e);return t.current=e,u.useCallback(e=>{const r=t.current;let n=!1;const a=r.map(t=>{const r=ne(t,e);return n||"function"!=typeof r||(n=!0),r});if(n)return()=>{for(let e=0;e<a.length;e++){const t=a[e];"function"==typeof t?t():ne(r[e],null)}}},[])}function oe(e){return e?.animationName||"none"}function ie(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}Q(re,"usePresence"),Q(ne,"setRef"),Q(ae,"useStableComposedRefs"),Q(oe,"getAnimationName"),Q(ie,"getElementRef");var se=Object.defineProperty,le=(e,t)=>se(e,"name",{value:t,configurable:!0}),ce="Radio",[de,ue]=s.createContextScope(ce),[he,pe]=de(ce);function me(e){const{__scopeRadio:t,checked:r=!1,children:n,disabled:a,form:o,name:i,onCheck:s,required:l,value:c="on",internal_do_not_use_render:d}=e,[h,p]=u.useState(null),[f,g]=u.useState(null),x=u.useRef(!1),[v,y]=u.useReducer(e=>e+1,0),b={checked:r,disabled:a,required:l,name:i,form:o,value:c,control:h,setControl:p,hasConsumerStoppedPropagationRef:x,userInteractionCount:v,onUserInteraction:y,isFormControl:!h||(!!o||!!h.closest("form")),bubbleInput:f,setBubbleInput:g,onCheck:le(()=>s?.(),"onCheck")};return(0,m.jsx)(he,{scope:t,...b,children:ve(d)?d(b):n})}le(me,"RadioProvider");var fe=u.forwardRef(le(function({__scopeRadio:e,onClick:t,...r},a){const{checked:o,disabled:i,value:c,setControl:d,onCheck:u,hasConsumerStoppedPropagationRef:h,onUserInteraction:p,isFormControl:f,bubbleInput:g}=pe("RadioTrigger",e),x=n.useComposedRefs(a,d);return(0,m.jsx)(s.Primitive.button,{type:"button",role:"radio","aria-checked":o,"data-state":ye(o),"data-disabled":i?"":void 0,disabled:i,value:c,...r,ref:x,onClick:l.composeEventHandlers(t,e=>{o||(p(),u()),g&&f&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})})},"RadioTrigger")),ge=u.forwardRef(le(function(e,t){const{__scopeRadio:r,forceMount:n,...a}=e,o=pe("RadioIndicator",r);return(0,m.jsx)(te,{present:n||o.checked,children:(0,m.jsx)(s.Primitive.span,{"data-state":ye(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:t})})},"RadioIndicator")),xe=u.forwardRef(le(function({__scopeRadio:e,onClick:t,...r},a){const{control:o,checked:i,required:c,disabled:d,name:h,value:p,form:f,bubbleInput:g,setBubbleInput:x,hasConsumerStoppedPropagationRef:v,userInteractionCount:y}=pe("RadioBubbleInput",e),b=n.useComposedRefs(a,x),w=Z(o),S=u.useRef(!1),k=u.useRef(i),C=u.useRef(y);u.useEffect(()=>{const e=g;if(!e)return;const t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set,n=y!==C.current;C.current=y;const a=k.current!==i;k.current=i;const o=!(n&&v.current);if(a&&r){S.current=!n;const t=new Event("click",{bubbles:o});r.call(e,i),e.dispatchEvent(t),S.current=!1}},[g,i,v,y]);const j=u.useRef(i);return(0,m.jsx)(s.Primitive.input,{type:"radio","aria-hidden":!0,defaultChecked:j.current,required:c,disabled:d,name:h,value:p,form:f,...r,tabIndex:-1,ref:b,onClick:l.composeEventHandlers(t,e=>{S.current&&e.stopPropagation()}),style:{...r.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"RadioBubbleInput"));function ve(e){return"function"==typeof e}function ye(e){return e?"checked":"unchecked"}le(ve,"isFunction"),le(ye,"getState");var be=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],we="RadioGroup",[Se,ke]=s.createContextScope(we,[l.createRovingFocusGroupScope,ue]),Ce=l.createRovingFocusGroupScope(),je=ue(),[Te,Ne]=Se(we),Me=u.forwardRef(le(function(e,t){const{__scopeRadioGroup:r,name:a,form:o,defaultValue:i,value:c,required:d=!1,disabled:h=!1,orientation:p,dir:f,loop:g=!0,onValueChange:x,...v}=e,y=Ce(r),b=l.useDirection(f),[w,S]=l.useControllableState({prop:c,defaultProp:i??null,onChange:x,caller:we}),[k,C]=u.useState(null),j=n.useComposedRefs(t,C),T=u.useRef(w);return u.useEffect(()=>{const e=o?k?.ownerDocument.getElementById(o):k?.closest("form");if(e instanceof HTMLFormElement){const t=le(()=>S(T.current),"reset");return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}},[k,o,S]),(0,m.jsx)(Te,{scope:r,name:a,form:o,required:d,disabled:h,value:w,onValueChange:S,children:(0,m.jsx)(l.Root,{asChild:!0,...y,orientation:p,dir:b,loop:g,children:(0,m.jsx)(s.Primitive.div,{role:"radiogroup","aria-required":d,"aria-orientation":p,"data-disabled":h?"":void 0,dir:b,...v,ref:j})})})},"RadioGroup"));function Ee(e){const{__scopeRadioGroup:t,value:r,disabled:n,children:a,internal_do_not_use_render:o}=e,i=Ne("RadioGroupItemProvider",t),s=je(t),l=i.disabled||n;return(0,m.jsx)(me,{...s,checked:i.value===r,disabled:l,required:i.required,name:i.name,form:i.form,value:r,onCheck:()=>i.onValueChange(r),internal_do_not_use_render:o,children:a})}le(Ee,"RadioGroupItemProvider");var Ae=u.forwardRef(le(function(e,t){const{__scopeRadioGroup:r,...a}=e,o=Ce(r),i=je(r),{checked:s,disabled:c}=pe("RadioGroupItemTrigger",i.__scopeRadio),d=u.useRef(null),h=n.useComposedRefs(t,d),p=u.useRef(!1);return u.useEffect(()=>{const e=le(e=>{be.includes(e.key)&&(p.current=!0)},"handleKeyDown"),t=le(()=>p.current=!1,"handleKeyUp");return document.addEventListener("keydown",e),document.addEventListener("keyup",t),()=>{document.removeEventListener("keydown",e),document.removeEventListener("keyup",t)}},[]),(0,m.jsx)(l.Item,{asChild:!0,...o,focusable:!c,active:s,children:(0,m.jsx)(fe,{...i,...a,ref:h,onKeyDown:l.composeEventHandlers(a.onKeyDown,e=>{"Enter"===e.key&&e.preventDefault()}),onFocus:l.composeEventHandlers(a.onFocus,()=>{p.current&&d.current?.click()})})})},"RadioGroupItemTrigger")),Re=u.forwardRef(le(function(e,t){const{__scopeRadioGroup:r,value:n,disabled:a,...o}=e;return(0,m.jsx)(Ee,{__scopeRadioGroup:r,value:n,disabled:a,internal_do_not_use_render:({isFormControl:e})=>(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(Ae,{...o,ref:t,__scopeRadioGroup:r}),e&&(0,m.jsx)(De,{__scopeRadioGroup:r})]})})},"RadioGroupItem")),De=u.forwardRef(le(function(e,t){const{__scopeRadioGroup:r,...n}=e,a=je(r);return(0,m.jsx)(xe,{...a,...n,ref:t})},"RadioGroupItemBubbleInput")),Ie=u.forwardRef(le(function(e,t){const{__scopeRadioGroup:r,...n}=e,a=je(r);return(0,m.jsx)(ge,{...a,...n,ref:t})},"RadioGroupIndicator")),ze=Object.defineProperty;function _e(e,[t,r]){return Math.min(r,Math.max(t,e))}((e,t)=>{ze(e,"name",{value:t,configurable:!0})})(_e,"clamp");var Pe=Object.defineProperty,Oe=(e,t)=>Pe(e,"name",{value:t,configurable:!0});function Le(e,t){return u.useReducer((e,r)=>t[e][r]??e,e)}Oe(Le,"useStateMachine");var Fe="ScrollArea",[Be,He]=s.createContextScope(Fe),[Ve,$e]=Be(Fe),qe=u.forwardRef(Oe(function(e,t){const{__scopeScrollArea:r,type:a="hover",dir:o,scrollHideDelay:i=600,...c}=e,[d,h]=u.useState(null),[p,f]=u.useState(null),[g,x]=u.useState(null),[v,y]=u.useState(null),[b,w]=u.useState(null),[S,k]=u.useState(0),[C,j]=u.useState(0),[T,N]=u.useState(!1),[M,E]=u.useState(!1),A=n.useComposedRefs(t,h),R=l.useDirection(o);return(0,m.jsx)(Ve,{scope:r,type:a,dir:R,scrollHideDelay:i,scrollArea:d,viewport:p,onViewportChange:f,content:g,onContentChange:x,scrollbarX:v,onScrollbarXChange:y,scrollbarXEnabled:T,onScrollbarXEnabledChange:N,scrollbarY:b,onScrollbarYChange:w,scrollbarYEnabled:M,onScrollbarYEnabledChange:E,onCornerWidthChange:k,onCornerHeightChange:j,children:(0,m.jsx)(s.Primitive.div,{dir:R,...c,ref:A,style:{position:"relative","--radix-scroll-area-corner-width":S+"px","--radix-scroll-area-corner-height":C+"px",...e.style}})})},"ScrollArea")),Ue=u.forwardRef(Oe(function(e,t){const{__scopeScrollArea:r,children:a,nonce:o,...i}=e,l=$e("ScrollAreaViewport",r),c=u.useRef(null),d=n.useComposedRefs(t,c,l.onViewportChange);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(Ge,{nonce:o}),(0,m.jsx)(s.Primitive.div,{"data-radix-scroll-area-viewport":"",...i,ref:d,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...e.style},children:(0,m.jsx)("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:a})})]})},"ScrollAreaViewport")),Ge=u.memo(Oe(function({nonce:e}){return(0,m.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:e})},"ScrollAreaViewportStyle"),(e,t)=>e.nonce===t.nonce),We="ScrollAreaScrollbar",Ke=u.forwardRef(Oe(function(e,t){const{forceMount:r,...n}=e,a=$e(We,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:i}=a,s="horizontal"===e.orientation;return u.useEffect(()=>(s?o(!0):i(!0),()=>{s?o(!1):i(!1)}),[s,o,i]),"hover"===a.type?(0,m.jsx)(Ye,{...n,ref:t,forceMount:r}):"scroll"===a.type?(0,m.jsx)(Xe,{...n,ref:t,forceMount:r}):"auto"===a.type?(0,m.jsx)(Ze,{...n,ref:t,forceMount:r}):"always"===a.type?(0,m.jsx)(Je,{...n,ref:t,"data-state":"visible"}):null},"ScrollAreaScrollbar")),Ye=u.forwardRef(Oe(function(e,t){const{forceMount:r,...n}=e,a=$e(We,e.__scopeScrollArea),[o,i]=u.useState(!1);return u.useEffect(()=>{const e=a.scrollArea;let t=0;if(e){const r=Oe(()=>{window.clearTimeout(t),i(!0)},"handlePointerEnter"),n=Oe(()=>{t=window.setTimeout(()=>i(!1),a.scrollHideDelay)},"handlePointerLeave");return e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",n),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",n)}}},[a.scrollArea,a.scrollHideDelay]),(0,m.jsx)(te,{present:r||o,children:(0,m.jsx)(Ze,{"data-state":o?"visible":"hidden",...n,ref:t})})},"ScrollAreaScrollbarHover")),Xe=u.forwardRef(Oe(function(e,t){const{forceMount:r,...n}=e,a=$e(We,e.__scopeScrollArea),o="horizontal"===e.orientation,i=vt(()=>c("SCROLL_END"),100),[s,c]=Le("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return u.useEffect(()=>{if("idle"===s){const e=window.setTimeout(()=>c("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(e)}},[s,a.scrollHideDelay,c]),u.useEffect(()=>{const e=a.viewport,t=o?"scrollLeft":"scrollTop";if(e){let r=e[t];const n=Oe(()=>{const n=e[t];r!==n&&(c("SCROLL"),i()),r=n},"handleScroll");return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}},[a.viewport,o,c,i]),(0,m.jsx)(te,{present:r||"hidden"!==s,children:(0,m.jsx)(Je,{"data-state":"hidden"===s?"hidden":"visible",...n,ref:t,onPointerEnter:l.composeEventHandlers(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:l.composeEventHandlers(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})},"ScrollAreaScrollbarScroll")),Ze=u.forwardRef(Oe(function(e,t){const r=$e(We,e.__scopeScrollArea),{forceMount:n,...a}=e,[o,i]=u.useState(!1),s="horizontal"===e.orientation,l=vt(()=>{if(r.viewport){const e=r.viewport.offsetWidth<r.viewport.scrollWidth,t=r.viewport.offsetHeight<r.viewport.scrollHeight;i(s?e:t)}},10);return yt(r.viewport,l),yt(r.content,l),(0,m.jsx)(te,{present:n||o,children:(0,m.jsx)(Je,{"data-state":o?"visible":"hidden",...a,ref:t})})},"ScrollAreaScrollbarAuto")),Je=u.forwardRef(Oe(function(e,t){const{orientation:r="vertical",...n}=e,a=$e(We,e.__scopeScrollArea),o=u.useRef(null),i=u.useRef(0),[s,l]=u.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=ut(s.viewport,s.content),d={...n,sizes:s,onSizesChange:l,hasThumb:Boolean(c>0&&c<1),onThumbChange:Oe(e=>o.current=e,"onThumbChange"),onThumbPointerUp:Oe(()=>i.current=0,"onThumbPointerUp"),onThumbPointerDown:Oe(e=>i.current=e,"onThumbPointerDown")};function h(e,t){return pt(e,i.current,s,t)}return Oe(h,"getScrollPosition"),"horizontal"===r?(0,m.jsx)(Qe,{...d,ref:t,onThumbPositionChange:()=>{if(a.viewport&&o.current){const e=mt(a.viewport.scrollLeft,s,a.dir);o.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{a.viewport&&(a.viewport.scrollLeft=e)},onDragScroll:e=>{a.viewport&&(a.viewport.scrollLeft=h(e,a.dir))}}):"vertical"===r?(0,m.jsx)(et,{...d,ref:t,onThumbPositionChange:()=>{if(a.viewport&&o.current){const e=mt(a.viewport.scrollTop,s);o.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{a.viewport&&(a.viewport.scrollTop=e)},onDragScroll:e=>{a.viewport&&(a.viewport.scrollTop=h(e))}}):null},"ScrollAreaScrollbarVisible")),Qe=u.forwardRef(Oe(function(e,t){const{sizes:r,onSizesChange:a,...o}=e,i=$e(We,e.__scopeScrollArea),[s,l]=u.useState(),c=u.useRef(null),d=n.useComposedRefs(t,c,i.onScrollbarXChange);return u.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),(0,m.jsx)(nt,{"data-orientation":"horizontal",...o,ref:d,sizes:r,style:{bottom:0,left:"rtl"===i.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===i.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":ht(r)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,r)=>{if(i.viewport){const n=i.viewport.scrollLeft+t.deltaX;e.onWheelScroll(n),gt(n,r)&&t.preventDefault()}},onResize:()=>{c.current&&i.viewport&&s&&a({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:dt(s.paddingLeft),paddingEnd:dt(s.paddingRight)}})}})},"ScrollAreaScrollbarX")),et=u.forwardRef(Oe(function(e,t){const{sizes:r,onSizesChange:a,...o}=e,i=$e(We,e.__scopeScrollArea),[s,l]=u.useState(),c=u.useRef(null),d=n.useComposedRefs(t,c,i.onScrollbarYChange);return u.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),(0,m.jsx)(nt,{"data-orientation":"vertical",...o,ref:d,sizes:r,style:{top:0,right:"ltr"===i.dir?0:void 0,left:"rtl"===i.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":ht(r)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,r)=>{if(i.viewport){const n=i.viewport.scrollTop+t.deltaY;e.onWheelScroll(n),gt(n,r)&&t.preventDefault()}},onResize:()=>{c.current&&i.viewport&&s&&a({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:dt(s.paddingTop),paddingEnd:dt(s.paddingBottom)}})}})},"ScrollAreaScrollbarY")),[tt,rt]=Be(We),nt=u.forwardRef(Oe(function(e,t){const{__scopeScrollArea:r,sizes:a,hasThumb:o,onThumbChange:i,onThumbPointerUp:c,onThumbPointerDown:d,onThumbPositionChange:h,onDragScroll:p,onWheelScroll:f,onResize:g,...x}=e,v=$e(We,r),[y,b]=u.useState(null),w=n.useComposedRefs(t,b),S=u.useRef(null),k=u.useRef(""),C=v.viewport,j=a.content-a.viewport,T=s.useCallbackRef(f),N=s.useCallbackRef(h),M=vt(g,10);function E(e){if(S.current){const t=e.clientX-S.current.left,r=e.clientY-S.current.top;p({x:t,y:r})}}return Oe(E,"handleDragScroll"),u.useEffect(()=>{const e=Oe(e=>{const t=e.target;y?.contains(t)&&T(e,j)},"handleWheel");return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[C,y,j,T]),u.useEffect(N,[a,N]),yt(y,M),yt(v.content,M),(0,m.jsx)(tt,{scope:r,scrollbar:y,hasThumb:o,onThumbChange:s.useCallbackRef(i),onThumbPointerUp:s.useCallbackRef(c),onThumbPositionChange:N,onThumbPointerDown:s.useCallbackRef(d),children:(0,m.jsx)(s.Primitive.div,{...x,ref:w,style:{position:"absolute",...x.style},onPointerDown:l.composeEventHandlers(e.onPointerDown,e=>{0===e.button&&(e.target.setPointerCapture(e.pointerId),S.current=y.getBoundingClientRect(),k.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",v.viewport&&(v.viewport.style.scrollBehavior="auto"),E(e))}),onPointerMove:l.composeEventHandlers(e.onPointerMove,E),onPointerUp:l.composeEventHandlers(e.onPointerUp,e=>{const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=k.current,v.viewport&&(v.viewport.style.scrollBehavior=""),S.current=null})})})},"ScrollAreaScrollbarImpl")),at="ScrollAreaThumb",ot=u.forwardRef(Oe(function(e,t){const{forceMount:r,...n}=e,a=rt(at,e.__scopeScrollArea);return(0,m.jsx)(te,{present:r||a.hasThumb,children:(0,m.jsx)(it,{ref:t,...n})})},"ScrollAreaThumb")),it=u.forwardRef(Oe(function(e,t){const{__scopeScrollArea:r,style:a,...o}=e,i=$e(at,r),c=rt(at,r),{onThumbPositionChange:d}=c,h=n.useComposedRefs(t,c.onThumbChange),p=u.useRef(void 0),f=vt(()=>{p.current&&(p.current(),p.current=void 0)},100);return u.useEffect(()=>{const e=i.viewport;if(e){const t=Oe(()=>{if(f(),!p.current){const t=xt(e,d);p.current=t,d()}},"handleScroll");return d(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[i.viewport,f,d]),(0,m.jsx)(s.Primitive.div,{"data-state":c.hasThumb?"visible":"hidden",...o,ref:h,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...a},onPointerDownCapture:l.composeEventHandlers(e.onPointerDownCapture,e=>{const t=e.target.getBoundingClientRect(),r=e.clientX-t.left,n=e.clientY-t.top;c.onThumbPointerDown({x:r,y:n})}),onPointerUp:l.composeEventHandlers(e.onPointerUp,c.onThumbPointerUp)})},"ScrollAreaThumbImpl")),st="ScrollAreaCorner",lt=u.forwardRef(Oe(function(e,t){const r=$e(st,e.__scopeScrollArea),n=Boolean(r.scrollbarX&&r.scrollbarY);return"scroll"!==r.type&&n?(0,m.jsx)(ct,{...e,ref:t}):null},"ScrollAreaCorner")),ct=u.forwardRef(Oe(function(e,t){const{__scopeScrollArea:r,...n}=e,a=$e(st,r),[o,i]=u.useState(0),[l,c]=u.useState(0),d=Boolean(o&&l),{onCornerWidthChange:h,onCornerHeightChange:p}=a;return yt(a.scrollbarX,()=>{const e=a.scrollbarX?.offsetHeight||0;a.onCornerHeightChange(e),c(e)}),yt(a.scrollbarY,()=>{const e=a.scrollbarY?.offsetWidth||0;a.onCornerWidthChange(e),i(e)}),u.useEffect(()=>()=>{h(0),p(0)},[h,p]),d?(0,m.jsx)(s.Primitive.div,{...n,ref:t,style:{width:o,height:l,position:"absolute",right:"ltr"===a.dir?0:void 0,left:"rtl"===a.dir?0:void 0,bottom:0,...e.style}}):null},"ScrollAreaCornerImpl"));function dt(e){return e?parseInt(e,10):0}function ut(e,t){const r=e/t;return isNaN(r)?0:r}function ht(e){const t=ut(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function pt(e,t,r,n="ltr"){const a=ht(r),o=t||a/2,i=a-o,s=r.scrollbar.paddingStart+o,l=r.scrollbar.size-r.scrollbar.paddingEnd-i,c=r.content-r.viewport;return ft([s,l],"ltr"===n?[0,c]:[-1*c,0])(e)}function mt(e,t,r="ltr"){const n=ht(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-a,i=t.content-t.viewport,s=o-n,l=_e(e,"ltr"===r?[0,i]:[-1*i,0]);return ft([0,i],[0,s])(l)}function ft(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function gt(e,t){return e>0&&e<t}Oe(dt,"toInt"),Oe(ut,"getThumbRatio"),Oe(ht,"getThumbSize"),Oe(pt,"getScrollPositionFromPointer"),Oe(mt,"getThumbOffsetFromScroll"),Oe(ft,"linearScale"),Oe(gt,"isScrollingWithinScrollbarBounds");var xt=Oe((e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return Oe(function a(){const o={left:e.scrollLeft,top:e.scrollTop},i=r.left!==o.left,s=r.top!==o.top;(i||s)&&t(),r=o,n=window.requestAnimationFrame(a)},"loop")(),()=>window.cancelAnimationFrame(n)},"addUnlinkedScrollListener");function vt(e,t){const r=s.useCallbackRef(e),n=u.useRef(0);return u.useEffect(()=>()=>window.clearTimeout(n.current),[]),u.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function yt(e,t){const r=s.useCallbackRef(t);s.useLayoutEffect2(()=>{let t=0;if(e){const n=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(r)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.unobserve(e)}}},[e,r])}Oe(vt,"useDebounceCallback"),Oe(yt,"useResizeObserver");var bt=qe,wt=Ue,St=lt,kt=class e extends Error{constructor(t,r){var n,a,o="KaTeX parse error: "+t,i=r&&r.loc;if(i&&i.start<=i.end){var s=i.lexer.input;n=i.start,a=i.end,n===s.length?o+=" at end of input: ":o+=" at position "+(n+1)+": ";var l=s.slice(n,a).replace(/[^]/g,"$&̲");o+=(n>15?"…"+s.slice(n-15,n):s.slice(0,n))+l+(a+15<s.length?s.slice(a,a+15)+"…":s.slice(a))}super(o),this.name="ParseError",this.position=void 0,this.length=void 0,this.rawMessage=void 0,Object.setPrototypeOf(this,e.prototype),this.position=n,null!=n&&null!=a&&(this.length=a-n),this.rawMessage=t}},Ct=/([A-Z])/g,jt=e=>e.replace(Ct,"-$1").toLowerCase(),Tt={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},Nt=/[&><"']/g,Mt=e=>String(e).replace(Nt,e=>Tt[e]),Et=e=>"ordgroup"===e.type||"color"===e.type?1===e.body.length?Et(e.body[0]):e:"font"===e.type?Et(e.body):e,At=new Set(["mathord","textord","atom"]),Rt=e=>At.has(Et(e).type),Dt={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:e=>"#"+e},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(e,t)=>(t.push(e),t)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:e=>Math.max(0,e),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:e=>Math.max(0,e),cli:"-e, --max-expand <n>",cliProcessor:e=>"Infinity"===e?1/0:parseInt(e)},globalGroup:{type:"boolean",cli:!1}};function It(e){return Object.prototype.hasOwnProperty.call(e,"default")&&void 0!==e.default?e.default:function(e){if("string"!=typeof e)return e.enum[0];switch(e){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{};default:throw new Error("Unexpected schema type; settings must declare an explicit default.")}}(Array.isArray(e.type)?e.type[0]:e.type)}function zt(e,t,r,n){var a=Object.prototype.hasOwnProperty.call(r,t)?r[t]:void 0,o=Object.prototype.hasOwnProperty.call(n,"processor")?n.processor:void 0;e[t]=void 0!==a?o?o(a):a:It(n)}var _t=class{constructor(e){for(var t of(void 0===e&&(e={}),this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{},Object.keys(Dt))){var r=Dt[t];r&&zt(this,t,e,r)}}reportNonstrict(e,t,r){var n=this.strict;if("function"==typeof n&&(n=n(e,t,r)),n&&"ignore"!==n&&(!0===n||"error"===n))throw new kt("LaTeX-incompatible input and strict mode is set to 'error': "+t+" ["+e+"]",r)}useStrictBehavior(e,t,r){var n=this.strict;if("function"==typeof n)try{n=n(e,t,r)}catch(a){n="error"}return!(!n||"ignore"===n)&&(!0===n||"error"===n)}isTrusted(e){if("url"in e&&e.url&&!e.protocol){var t=(e=>{var t=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(e);return t?":"!==t[2]?null:/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?t[1].toLowerCase():null:"_relative"})(e.url);if(null==t)return!1;e.protocol=t}var r="function"==typeof this.trust?this.trust(e):this.trust;return Boolean(r)}},Pt=class{constructor(e,t,r){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=t,this.cramped=r}sup(){return Ot[Lt[this.id]]}sub(){return Ot[Ft[this.id]]}fracNum(){return Ot[Bt[this.id]]}fracDen(){return Ot[Ht[this.id]]}cramp(){return Ot[Vt[this.id]]}text(){return Ot[$t[this.id]]}isTight(){return this.size>=2}},Ot=[new Pt(0,0,!1),new Pt(1,0,!0),new Pt(2,1,!1),new Pt(3,1,!0),new Pt(4,2,!1),new Pt(5,2,!0),new Pt(6,3,!1),new Pt(7,3,!0)],Lt=[4,5,4,5,6,7,6,7],Ft=[5,5,5,5,7,7,7,7],Bt=[2,3,4,5,6,7,6,7],Ht=[3,3,5,5,7,7,7,7],Vt=[1,1,3,3,5,5,7,7],$t=[0,1,2,3,2,3,2,3],qt={DISPLAY:Ot[0],TEXT:Ot[2],SCRIPT:Ot[4],SCRIPTSCRIPT:Ot[6]},Ut=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];var Gt=[];function Wt(e){for(var t=0;t<Gt.length;t+=2)if(e>=Gt[t]&&e<=Gt[t+1])return!0;return!1}Ut.forEach(e=>e.blocks.forEach(e=>Gt.push(...e)));var Kt=e=>e+" "+e,Yt=80,Xt={doubleleftarrow:"M262 157\nl10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3\n 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28\n 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5\nc2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5\n 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87\n-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7\n-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z\nm8 0v40h399730v-40zm0 194v40h399730v-40z",doublerightarrow:"M399738 392l\n-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5\n 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88\n-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68\n-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18\n-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782\nc-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3\n-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z",leftarrow:"M400000 241H110l3-3c68.7-52.7 113.7-120\n 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8\n-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247\nc-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208\n 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3\n 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202\n l-3-3h399890zM100 241v40h399900v-40z",leftbrace:"M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117\n-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7\n 5-6 9-10 13-.7 1-7.3 1-20 1H6z",leftbraceunder:"M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13\n 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688\n 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7\n-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z",leftgroup:"M400000 80\nH435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0\n 435 0h399565z",leftgroupunder:"M400000 262\nH435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219\n 435 219h399565z",leftharpoon:"M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3\n-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5\n-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7\n-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z",leftharpoonplus:"M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5\n 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3\n-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7\n-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z\nm0 0v40h400000v-40z",leftharpoondown:"M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333\n 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5\n 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667\n-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z",leftharpoondownplus:"M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12\n 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7\n-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0\nv40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z",lefthook:"M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5\n-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3\n-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21\n 71.5 23h399859zM103 281v-40h399897v40z",leftlinesegment:Kt("M40 281 V428 H0 V94 H40 V241 H400000 v40z"),leftbracketunder:Kt("M0 0 h120 V290 H399995 v120 H0z"),leftbracketover:Kt("M0 440 h120 V150 H399995 v-120 H0z"),leftmapsto:Kt("M40 281 V448H0V74H40V241H400000v40z"),leftToFrom:"M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23\n-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8\nc28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3\n 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z",longequal:Kt("M0 50 h400000 v40H0z m0 194h40000v40H0z"),midbrace:"M200428 334\nc-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14\n-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7\n 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11\n 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z",midbraceunder:"M199572 214\nc100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14\n 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3\n 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0\n-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z",oiintSize1:"M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6\n-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z\nm368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8\n60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z",oiintSize2:"M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8\n-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z\nm502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2\nc0 110 84 276 504 276s502.4-166 502.4-276z",oiiintSize1:"M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6\n-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z\nm525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0\n85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z",oiiintSize2:"M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8\n-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z\nm770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1\nc0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z",rightarrow:"M0 241v40h399891c-47.3 35.3-84 78-110 128\n-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20\n 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7\n 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85\n-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n 151.7 139 205zm0 0v40h399900v-40z",rightbrace:"M400000 542l\n-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5\ns-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1\nc124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z",rightbraceunder:"M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3\n 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237\n-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z",rightgroup:"M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0\n 3-1 3-3v-38c-76-158-257-219-435-219H0z",rightgroupunder:"M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18\n 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z",rightharpoon:"M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3\n-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2\n-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58\n 69.2 92 94.5zm0 0v40h399900v-40z",rightharpoonplus:"M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11\n-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7\n 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z\nm0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z",rightharpoondown:"M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8\n 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5\n-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95\n-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z",rightharpoondownplus:"M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8\n 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3\n 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3\n-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z\nm0-194v40h400000v-40zm0 0v40h400000v-40z",righthook:"M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3\n 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0\n-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21\n 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z",rightlinesegment:Kt("M399960 241 V94 h40 V428 h-40 V281 H0 v-40z"),rightbracketunder:Kt("M399995 0 h-120 V290 H0 v120 H400000z"),rightbracketover:Kt("M399995 440 h-120 V150 H0 v-120 H399995z"),rightToFrom:"M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23\n 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32\n-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142\n-167z M100 147v40h399900v-40zM0 341v40h399900v-40z",twoheadleftarrow:"M0 167c68 40\n 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69\n-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3\n-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19\n-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101\n 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z",twoheadrightarrow:"M400000 167\nc-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3\n 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42\n 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333\n-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70\n 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z",tilde1:"M200 55.538c-77 0-168 73.953-177 73.953-3 0-7\n-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0\n 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0\n 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128\n-68.267.847-113-73.952-191-73.952z",tilde2:"M344 55.266c-142 0-300.638 81.316-311.5 86.418\n-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9\n 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114\nc1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751\n 181.476 676 181.476c-149 0-189-126.21-332-126.21z",tilde3:"M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457\n-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0\n 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697\n 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696\n -338 0-409-156.573-744-156.573z",tilde4:"M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345\n-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409\n 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9\n 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409\n -175.236-744-175.236z",vec:"M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5\n3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11\n10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63\n-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1\n-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59\nH213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359\nc-16-25.333-24-45-24-59z",widehat1:"M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22\nc-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z",widehat2:"M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widehat3:"M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widehat4:"M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widecheck1:"M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,\n-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z",widecheck2:"M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",widecheck3:"M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",widecheck4:"M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",baraboveleftarrow:"M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202\nc4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5\nc-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130\ns-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47\n121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6\ns2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11\nc0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z\nM100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z",rightarrowabovebar:"M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32\n-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0\n13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39\n-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5\n-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z",baraboveshortleftharpoon:"M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17\nc2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21\nc-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40\nc-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z\nM0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z",rightharpoonaboveshortbar:"M0,241 l0,40c399126,0,399993,0,399993,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z",shortbaraboveleftharpoon:"M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,\n1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,\n-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z\nM93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z",shortrightharpoonabovebar:"M53,241l0,40c398570,0,399437,0,399437,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z"};var Zt=class{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e}toMarkup(){for(var e="",t=0;t<this.children.length;t++)e+=this.children[t].toMarkup();return e}toText(){return this.children.map(e=>{if("toText"in e)return e.toText();throw new Error("Expected MathDomNode with toText, got "+e.constructor.name)}).join("")}},Jt={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:1.00375,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:1.00375},Qt={ex:!0,em:!0,mu:!0},er=function(e){return"string"!=typeof e&&(e=e.unit),e in Jt||e in Qt||"ex"===e},tr=function(e,t){var r;if(e.unit in Jt)r=Jt[e.unit]/t.fontMetrics().ptPerEm/t.sizeMultiplier;else if("mu"===e.unit)r=t.fontMetrics().cssEmPerMu;else{var n;if(n=t.style.isTight()?t.havingStyle(t.style.text()):t,"ex"===e.unit)r=n.fontMetrics().xHeight;else{if("em"!==e.unit)throw new kt("Invalid unit: '"+e.unit+"'");r=n.fontMetrics().quad}n!==t&&(r*=n.sizeMultiplier/t.sizeMultiplier)}return Math.min(e.number*r,t.maxSize)},rr=function(e){return+e.toFixed(4)+"em"},nr=function(e){return e.filter(e=>e).join(" ")},ar=function(e){var t="";for(var r of Object.keys(e)){var n=e[r];void 0!==n&&(t+=jt(r)+":"+n+";")}return t},or=function(e,t,r){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=r||{},t){t.style.isTight()&&this.classes.push("mtight");var n=t.getColor();n&&(this.style.color=n)}},ir=function(e){var t=document.createElement(e);for(var r of(t.className=nr(this.classes),Object.assign(t.style,this.style),Object.keys(this.attributes)))t.setAttribute(r,this.attributes[r]);for(var n=0;n<this.children.length;n++)t.appendChild(this.children[n].toNode());return t},sr=/[\s"'>/=\x00-\x1f]/,lr=function(e){var t="<"+e;this.classes.length&&(t+=' class="'+Mt(nr(this.classes))+'"');var r=ar(this.style);for(var n of(r&&(t+=' style="'+Mt(r)+'"'),Object.keys(this.attributes))){if(sr.test(n))throw new kt("Invalid attribute name '"+n+"'");t+=" "+n+'="'+Mt(this.attributes[n])+'"'}t+=">";for(var a=0;a<this.children.length;a++)t+=this.children[a].toMarkup();return t+="</"+e+">"},cr=class{constructor(e,t,r,n){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,this.italic=void 0,or.call(this,e,r,n),this.children=t||[]}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return ir.call(this,"span")}toMarkup(){return lr.call(this,"span")}},dr=class{constructor(e,t,r,n){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,or.call(this,t,n),this.children=r||[],this.setAttribute("href",e)}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return ir.call(this,"a")}toMarkup(){return lr.call(this,"a")}},ur=class{constructor(e,t,r){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=t,this.src=e,this.classes=["mord"],this.height=0,this.depth=0,this.maxFontSize=0,this.style=r}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement("img");return e.src=this.src,e.alt=this.alt,e.className="mord",Object.assign(e.style,this.style),e}toMarkup(){var e='<img src="'+Mt(this.src)+'" alt="'+Mt(this.alt)+'"',t=ar(this.style);return t&&(e+=' style="'+Mt(t)+'"'),e+="'/>"}},hr={"î":"ı̂","ï":"ı̈","í":"ı́","ì":"ı̀"},pr=class{constructor(e,t,r,n,a,o,i,s){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=e,this.height=t||0,this.depth=r||0,this.italic=n||0,this.skew=a||0,this.width=o||0,this.classes=i||[],this.style=s||{},this.maxFontSize=0;var l=function(e){for(var t=0;t<Ut.length;t++)for(var r=Ut[t],n=0;n<r.blocks.length;n++){var a=r.blocks[n];if(e>=a[0]&&e<=a[1])return r.name}return null}(this.text.charCodeAt(0));l&&this.classes.push(l+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=hr[this.text])}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createTextNode(this.text),t=null;return this.italic>0&&((t=document.createElement("span")).style.marginRight=rr(this.italic)),this.classes.length>0&&((t=t||document.createElement("span")).className=nr(this.classes)),Object.keys(this.style).length>0&&(t=t||document.createElement("span"),Object.assign(t.style,this.style)),t?(t.appendChild(e),t):e}toMarkup(){var e=!1,t="<span";this.classes.length&&(e=!0,t+=' class="',t+=Mt(nr(this.classes)),t+='"');var r="";this.italic>0&&(r+="margin-right:"+rr(this.italic)+";"),(r+=ar(this.style))&&(e=!0,t+=' style="'+Mt(r)+'"');var n=Mt(this.text);return e?(t+=">",t+=n,t+="</span>"):n}},mr=class{constructor(e,t){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=t||{}}toNode(){var e=document.createElementNS("http://www.w3.org/2000/svg","svg");for(var t of Object.keys(this.attributes))e.setAttribute(t,this.attributes[t]);for(var r=0;r<this.children.length;r++)e.appendChild(this.children[r].toNode());return e}toMarkup(){var e='<svg xmlns="http://www.w3.org/2000/svg"';for(var t of Object.keys(this.attributes))e+=" "+t+'="'+Mt(this.attributes[t])+'"';e+=">";for(var r=0;r<this.children.length;r++)e+=this.children[r].toMarkup();return e+="</svg>"}},fr=class{constructor(e,t){this.pathName=void 0,this.alternate=void 0,this.pathName=e,this.alternate=t}toNode(){var e=document.createElementNS("http://www.w3.org/2000/svg","path");return this.alternate?e.setAttribute("d",this.alternate):e.setAttribute("d",Xt[this.pathName]),e}toMarkup(){return this.alternate?'<path d="'+Mt(this.alternate)+'"/>':'<path d="'+Mt(Xt[this.pathName])+'"/>'}},gr=class{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e=document.createElementNS("http://www.w3.org/2000/svg","line");for(var t of Object.keys(this.attributes))e.setAttribute(t,this.attributes[t]);return e}toMarkup(){var e="<line";for(var t of Object.keys(this.attributes))e+=" "+t+'="'+Mt(this.attributes[t])+'"';return e+="/>"}};var xr={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},vr={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},yr={"Å":"A","Ð":"D","Þ":"o","å":"a","ð":"d","þ":"o","А":"A","Б":"B","В":"B","Г":"F","Д":"A","Е":"E","Ж":"K","З":"3","И":"N","Й":"N","К":"K","Л":"N","М":"M","Н":"H","О":"O","П":"N","Р":"P","С":"C","Т":"T","У":"y","Ф":"O","Х":"X","Ц":"U","Ч":"h","Ш":"W","Щ":"W","Ъ":"B","Ы":"X","Ь":"B","Э":"3","Ю":"X","Я":"R","а":"a","б":"b","в":"a","г":"r","д":"y","е":"e","ж":"m","з":"e","и":"n","й":"n","к":"n","л":"n","м":"m","н":"n","о":"o","п":"n","р":"p","с":"c","т":"o","у":"y","ф":"b","х":"x","ц":"n","ч":"n","ш":"w","щ":"w","ъ":"a","ы":"m","ь":"a","э":"e","ю":"m","я":"r"};function br(e,t,r){if(!xr[t])throw new Error("Font metrics not found for font: "+t+".");var n=e.charCodeAt(0),a=xr[t][n];if(!a&&e[0]in yr&&(n=yr[e[0]].charCodeAt(0),a=xr[t][n]),a||"text"!==r||Wt(n)&&(a=xr[t][77]),a)return{depth:a[0],height:a[1],italic:a[2],skew:a[3],width:a[4]}}var wr={};var Sr={math:{},text:{}};function kr(e,t,r,n,a,o){Sr[e][a]={font:t,group:r,replace:n},o&&n&&(Sr[e][n]=Sr[e][a])}var Cr="math",jr="text",Tr="main",Nr="ams",Mr="accent-token",Er="bin",Ar="close",Rr="inner",Dr="mathord",Ir="op-token",zr="open",_r="punct",Pr="rel",Or="spacing",Lr="textord";kr(Cr,Tr,Pr,"≡","\\equiv",!0),kr(Cr,Tr,Pr,"≺","\\prec",!0),kr(Cr,Tr,Pr,"≻","\\succ",!0),kr(Cr,Tr,Pr,"∼","\\sim",!0),kr(Cr,Tr,Pr,"⊥","\\perp"),kr(Cr,Tr,Pr,"⪯","\\preceq",!0),kr(Cr,Tr,Pr,"⪰","\\succeq",!0),kr(Cr,Tr,Pr,"≃","\\simeq",!0),kr(Cr,Tr,Pr,"∣","\\mid",!0),kr(Cr,Tr,Pr,"≪","\\ll",!0),kr(Cr,Tr,Pr,"≫","\\gg",!0),kr(Cr,Tr,Pr,"≍","\\asymp",!0),kr(Cr,Tr,Pr,"∥","\\parallel"),kr(Cr,Tr,Pr,"⋈","\\bowtie",!0),kr(Cr,Tr,Pr,"⌣","\\smile",!0),kr(Cr,Tr,Pr,"⊑","\\sqsubseteq",!0),kr(Cr,Tr,Pr,"⊒","\\sqsupseteq",!0),kr(Cr,Tr,Pr,"≐","\\doteq",!0),kr(Cr,Tr,Pr,"⌢","\\frown",!0),kr(Cr,Tr,Pr,"∋","\\ni",!0),kr(Cr,Tr,Pr,"∝","\\propto",!0),kr(Cr,Tr,Pr,"⊢","\\vdash",!0),kr(Cr,Tr,Pr,"⊣","\\dashv",!0),kr(Cr,Tr,Pr,"∋","\\owns"),kr(Cr,Tr,_r,".","\\ldotp"),kr(Cr,Tr,_r,"⋅","\\cdotp"),kr(Cr,Tr,_r,"⋅","·"),kr(jr,Tr,Lr,"⋅","·"),kr(Cr,Tr,Lr,"#","\\#"),kr(jr,Tr,Lr,"#","\\#"),kr(Cr,Tr,Lr,"&","\\&"),kr(jr,Tr,Lr,"&","\\&"),kr(Cr,Tr,Lr,"ℵ","\\aleph",!0),kr(Cr,Tr,Lr,"∀","\\forall",!0),kr(Cr,Tr,Lr,"ℏ","\\hbar",!0),kr(Cr,Tr,Lr,"∃","\\exists",!0),kr(Cr,Tr,Lr,"∇","\\nabla",!0),kr(Cr,Tr,Lr,"♭","\\flat",!0),kr(Cr,Tr,Lr,"ℓ","\\ell",!0),kr(Cr,Tr,Lr,"♮","\\natural",!0),kr(Cr,Tr,Lr,"♣","\\clubsuit",!0),kr(Cr,Tr,Lr,"℘","\\wp",!0),kr(Cr,Tr,Lr,"♯","\\sharp",!0),kr(Cr,Tr,Lr,"♢","\\diamondsuit",!0),kr(Cr,Tr,Lr,"ℜ","\\Re",!0),kr(Cr,Tr,Lr,"♡","\\heartsuit",!0),kr(Cr,Tr,Lr,"ℑ","\\Im",!0),kr(Cr,Tr,Lr,"♠","\\spadesuit",!0),kr(Cr,Tr,Lr,"§","\\S",!0),kr(jr,Tr,Lr,"§","\\S"),kr(Cr,Tr,Lr,"¶","\\P",!0),kr(jr,Tr,Lr,"¶","\\P"),kr(Cr,Tr,Lr,"†","\\dag"),kr(jr,Tr,Lr,"†","\\dag"),kr(jr,Tr,Lr,"†","\\textdagger"),kr(Cr,Tr,Lr,"‡","\\ddag"),kr(jr,Tr,Lr,"‡","\\ddag"),kr(jr,Tr,Lr,"‡","\\textdaggerdbl"),kr(Cr,Tr,Ar,"⎱","\\rmoustache",!0),kr(Cr,Tr,zr,"⎰","\\lmoustache",!0),kr(Cr,Tr,Ar,"⟯","\\rgroup",!0),kr(Cr,Tr,zr,"⟮","\\lgroup",!0),kr(Cr,Tr,Er,"∓","\\mp",!0),kr(Cr,Tr,Er,"⊖","\\ominus",!0),kr(Cr,Tr,Er,"⊎","\\uplus",!0),kr(Cr,Tr,Er,"⊓","\\sqcap",!0),kr(Cr,Tr,Er,"∗","\\ast"),kr(Cr,Tr,Er,"⊔","\\sqcup",!0),kr(Cr,Tr,Er,"◯","\\bigcirc",!0),kr(Cr,Tr,Er,"∙","\\bullet",!0),kr(Cr,Tr,Er,"‡","\\ddagger"),kr(Cr,Tr,Er,"≀","\\wr",!0),kr(Cr,Tr,Er,"⨿","\\amalg"),kr(Cr,Tr,Er,"&","\\And"),kr(Cr,Tr,Pr,"⟵","\\longleftarrow",!0),kr(Cr,Tr,Pr,"⇐","\\Leftarrow",!0),kr(Cr,Tr,Pr,"⟸","\\Longleftarrow",!0),kr(Cr,Tr,Pr,"⟶","\\longrightarrow",!0),kr(Cr,Tr,Pr,"⇒","\\Rightarrow",!0),kr(Cr,Tr,Pr,"⟹","\\Longrightarrow",!0),kr(Cr,Tr,Pr,"↔","\\leftrightarrow",!0),kr(Cr,Tr,Pr,"⟷","\\longleftrightarrow",!0),kr(Cr,Tr,Pr,"⇔","\\Leftrightarrow",!0),kr(Cr,Tr,Pr,"⟺","\\Longleftrightarrow",!0),kr(Cr,Tr,Pr,"↦","\\mapsto",!0),kr(Cr,Tr,Pr,"⟼","\\longmapsto",!0),kr(Cr,Tr,Pr,"↗","\\nearrow",!0),kr(Cr,Tr,Pr,"↩","\\hookleftarrow",!0),kr(Cr,Tr,Pr,"↪","\\hookrightarrow",!0),kr(Cr,Tr,Pr,"↘","\\searrow",!0),kr(Cr,Tr,Pr,"↼","\\leftharpoonup",!0),kr(Cr,Tr,Pr,"⇀","\\rightharpoonup",!0),kr(Cr,Tr,Pr,"↙","\\swarrow",!0),kr(Cr,Tr,Pr,"↽","\\leftharpoondown",!0),kr(Cr,Tr,Pr,"⇁","\\rightharpoondown",!0),kr(Cr,Tr,Pr,"↖","\\nwarrow",!0),kr(Cr,Tr,Pr,"⇌","\\rightleftharpoons",!0),kr(Cr,Nr,Pr,"≮","\\nless",!0),kr(Cr,Nr,Pr,"","\\@nleqslant"),kr(Cr,Nr,Pr,"","\\@nleqq"),kr(Cr,Nr,Pr,"⪇","\\lneq",!0),kr(Cr,Nr,Pr,"≨","\\lneqq",!0),kr(Cr,Nr,Pr,"","\\@lvertneqq"),kr(Cr,Nr,Pr,"⋦","\\lnsim",!0),kr(Cr,Nr,Pr,"⪉","\\lnapprox",!0),kr(Cr,Nr,Pr,"⊀","\\nprec",!0),kr(Cr,Nr,Pr,"⋠","\\npreceq",!0),kr(Cr,Nr,Pr,"⋨","\\precnsim",!0),kr(Cr,Nr,Pr,"⪹","\\precnapprox",!0),kr(Cr,Nr,Pr,"≁","\\nsim",!0),kr(Cr,Nr,Pr,"","\\@nshortmid"),kr(Cr,Nr,Pr,"∤","\\nmid",!0),kr(Cr,Nr,Pr,"⊬","\\nvdash",!0),kr(Cr,Nr,Pr,"⊭","\\nvDash",!0),kr(Cr,Nr,Pr,"⋪","\\ntriangleleft"),kr(Cr,Nr,Pr,"⋬","\\ntrianglelefteq",!0),kr(Cr,Nr,Pr,"⊊","\\subsetneq",!0),kr(Cr,Nr,Pr,"","\\@varsubsetneq"),kr(Cr,Nr,Pr,"⫋","\\subsetneqq",!0),kr(Cr,Nr,Pr,"","\\@varsubsetneqq"),kr(Cr,Nr,Pr,"≯","\\ngtr",!0),kr(Cr,Nr,Pr,"","\\@ngeqslant"),kr(Cr,Nr,Pr,"","\\@ngeqq"),kr(Cr,Nr,Pr,"⪈","\\gneq",!0),kr(Cr,Nr,Pr,"≩","\\gneqq",!0),kr(Cr,Nr,Pr,"","\\@gvertneqq"),kr(Cr,Nr,Pr,"⋧","\\gnsim",!0),kr(Cr,Nr,Pr,"⪊","\\gnapprox",!0),kr(Cr,Nr,Pr,"⊁","\\nsucc",!0),kr(Cr,Nr,Pr,"⋡","\\nsucceq",!0),kr(Cr,Nr,Pr,"⋩","\\succnsim",!0),kr(Cr,Nr,Pr,"⪺","\\succnapprox",!0),kr(Cr,Nr,Pr,"≆","\\ncong",!0),kr(Cr,Nr,Pr,"","\\@nshortparallel"),kr(Cr,Nr,Pr,"∦","\\nparallel",!0),kr(Cr,Nr,Pr,"⊯","\\nVDash",!0),kr(Cr,Nr,Pr,"⋫","\\ntriangleright"),kr(Cr,Nr,Pr,"⋭","\\ntrianglerighteq",!0),kr(Cr,Nr,Pr,"","\\@nsupseteqq"),kr(Cr,Nr,Pr,"⊋","\\supsetneq",!0),kr(Cr,Nr,Pr,"","\\@varsupsetneq"),kr(Cr,Nr,Pr,"⫌","\\supsetneqq",!0),kr(Cr,Nr,Pr,"","\\@varsupsetneqq"),kr(Cr,Nr,Pr,"⊮","\\nVdash",!0),kr(Cr,Nr,Pr,"⪵","\\precneqq",!0),kr(Cr,Nr,Pr,"⪶","\\succneqq",!0),kr(Cr,Nr,Pr,"","\\@nsubseteqq"),kr(Cr,Nr,Er,"⊴","\\unlhd"),kr(Cr,Nr,Er,"⊵","\\unrhd"),kr(Cr,Nr,Pr,"↚","\\nleftarrow",!0),kr(Cr,Nr,Pr,"↛","\\nrightarrow",!0),kr(Cr,Nr,Pr,"⇍","\\nLeftarrow",!0),kr(Cr,Nr,Pr,"⇏","\\nRightarrow",!0),kr(Cr,Nr,Pr,"↮","\\nleftrightarrow",!0),kr(Cr,Nr,Pr,"⇎","\\nLeftrightarrow",!0),kr(Cr,Nr,Pr,"△","\\vartriangle"),kr(Cr,Nr,Lr,"ℏ","\\hslash"),kr(Cr,Nr,Lr,"▽","\\triangledown"),kr(Cr,Nr,Lr,"◊","\\lozenge"),kr(Cr,Nr,Lr,"Ⓢ","\\circledS"),kr(Cr,Nr,Lr,"®","\\circledR"),kr(jr,Nr,Lr,"®","\\circledR"),kr(Cr,Nr,Lr,"∡","\\measuredangle",!0),kr(Cr,Nr,Lr,"∄","\\nexists"),kr(Cr,Nr,Lr,"℧","\\mho"),kr(Cr,Nr,Lr,"Ⅎ","\\Finv",!0),kr(Cr,Nr,Lr,"⅁","\\Game",!0),kr(Cr,Nr,Lr,"‵","\\backprime"),kr(Cr,Nr,Lr,"▲","\\blacktriangle"),kr(Cr,Nr,Lr,"▼","\\blacktriangledown"),kr(Cr,Nr,Lr,"■","\\blacksquare"),kr(Cr,Nr,Lr,"⧫","\\blacklozenge"),kr(Cr,Nr,Lr,"★","\\bigstar"),kr(Cr,Nr,Lr,"∢","\\sphericalangle",!0),kr(Cr,Nr,Lr,"∁","\\complement",!0),kr(Cr,Nr,Lr,"ð","\\eth",!0),kr(jr,Tr,Lr,"ð","ð"),kr(Cr,Nr,Lr,"╱","\\diagup"),kr(Cr,Nr,Lr,"╲","\\diagdown"),kr(Cr,Nr,Lr,"□","\\square"),kr(Cr,Nr,Lr,"□","\\Box"),kr(Cr,Nr,Lr,"◊","\\Diamond"),kr(Cr,Nr,Lr,"¥","\\yen",!0),kr(jr,Nr,Lr,"¥","\\yen",!0),kr(Cr,Nr,Lr,"✓","\\checkmark",!0),kr(jr,Nr,Lr,"✓","\\checkmark"),kr(Cr,Nr,Lr,"ℶ","\\beth",!0),kr(Cr,Nr,Lr,"ℸ","\\daleth",!0),kr(Cr,Nr,Lr,"ℷ","\\gimel",!0),kr(Cr,Nr,Lr,"ϝ","\\digamma",!0),kr(Cr,Nr,Lr,"ϰ","\\varkappa"),kr(Cr,Nr,zr,"┌","\\@ulcorner",!0),kr(Cr,Nr,Ar,"┐","\\@urcorner",!0),kr(Cr,Nr,zr,"└","\\@llcorner",!0),kr(Cr,Nr,Ar,"┘","\\@lrcorner",!0),kr(Cr,Nr,Pr,"≦","\\leqq",!0),kr(Cr,Nr,Pr,"⩽","\\leqslant",!0),kr(Cr,Nr,Pr,"⪕","\\eqslantless",!0),kr(Cr,Nr,Pr,"≲","\\lesssim",!0),kr(Cr,Nr,Pr,"⪅","\\lessapprox",!0),kr(Cr,Nr,Pr,"≊","\\approxeq",!0),kr(Cr,Nr,Er,"⋖","\\lessdot"),kr(Cr,Nr,Pr,"⋘","\\lll",!0),kr(Cr,Nr,Pr,"≶","\\lessgtr",!0),kr(Cr,Nr,Pr,"⋚","\\lesseqgtr",!0),kr(Cr,Nr,Pr,"⪋","\\lesseqqgtr",!0),kr(Cr,Nr,Pr,"≑","\\doteqdot"),kr(Cr,Nr,Pr,"≓","\\risingdotseq",!0),kr(Cr,Nr,Pr,"≒","\\fallingdotseq",!0),kr(Cr,Nr,Pr,"∽","\\backsim",!0),kr(Cr,Nr,Pr,"⋍","\\backsimeq",!0),kr(Cr,Nr,Pr,"⫅","\\subseteqq",!0),kr(Cr,Nr,Pr,"⋐","\\Subset",!0),kr(Cr,Nr,Pr,"⊏","\\sqsubset",!0),kr(Cr,Nr,Pr,"≼","\\preccurlyeq",!0),kr(Cr,Nr,Pr,"⋞","\\curlyeqprec",!0),kr(Cr,Nr,Pr,"≾","\\precsim",!0),kr(Cr,Nr,Pr,"⪷","\\precapprox",!0),kr(Cr,Nr,Pr,"⊲","\\vartriangleleft"),kr(Cr,Nr,Pr,"⊴","\\trianglelefteq"),kr(Cr,Nr,Pr,"⊨","\\vDash",!0),kr(Cr,Nr,Pr,"⊪","\\Vvdash",!0),kr(Cr,Nr,Pr,"⌣","\\smallsmile"),kr(Cr,Nr,Pr,"⌢","\\smallfrown"),kr(Cr,Nr,Pr,"≏","\\bumpeq",!0),kr(Cr,Nr,Pr,"≎","\\Bumpeq",!0),kr(Cr,Nr,Pr,"≧","\\geqq",!0),kr(Cr,Nr,Pr,"⩾","\\geqslant",!0),kr(Cr,Nr,Pr,"⪖","\\eqslantgtr",!0),kr(Cr,Nr,Pr,"≳","\\gtrsim",!0),kr(Cr,Nr,Pr,"⪆","\\gtrapprox",!0),kr(Cr,Nr,Er,"⋗","\\gtrdot"),kr(Cr,Nr,Pr,"⋙","\\ggg",!0),kr(Cr,Nr,Pr,"≷","\\gtrless",!0),kr(Cr,Nr,Pr,"⋛","\\gtreqless",!0),kr(Cr,Nr,Pr,"⪌","\\gtreqqless",!0),kr(Cr,Nr,Pr,"≖","\\eqcirc",!0),kr(Cr,Nr,Pr,"≗","\\circeq",!0),kr(Cr,Nr,Pr,"≜","\\triangleq",!0),kr(Cr,Nr,Pr,"∼","\\thicksim"),kr(Cr,Nr,Pr,"≈","\\thickapprox"),kr(Cr,Nr,Pr,"⫆","\\supseteqq",!0),kr(Cr,Nr,Pr,"⋑","\\Supset",!0),kr(Cr,Nr,Pr,"⊐","\\sqsupset",!0),kr(Cr,Nr,Pr,"≽","\\succcurlyeq",!0),kr(Cr,Nr,Pr,"⋟","\\curlyeqsucc",!0),kr(Cr,Nr,Pr,"≿","\\succsim",!0),kr(Cr,Nr,Pr,"⪸","\\succapprox",!0),kr(Cr,Nr,Pr,"⊳","\\vartriangleright"),kr(Cr,Nr,Pr,"⊵","\\trianglerighteq"),kr(Cr,Nr,Pr,"⊩","\\Vdash",!0),kr(Cr,Nr,Pr,"∣","\\shortmid"),kr(Cr,Nr,Pr,"∥","\\shortparallel"),kr(Cr,Nr,Pr,"≬","\\between",!0),kr(Cr,Nr,Pr,"⋔","\\pitchfork",!0),kr(Cr,Nr,Pr,"∝","\\varpropto"),kr(Cr,Nr,Pr,"◀","\\blacktriangleleft"),kr(Cr,Nr,Pr,"∴","\\therefore",!0),kr(Cr,Nr,Pr,"∍","\\backepsilon"),kr(Cr,Nr,Pr,"▶","\\blacktriangleright"),kr(Cr,Nr,Pr,"∵","\\because",!0),kr(Cr,Nr,Pr,"⋘","\\llless"),kr(Cr,Nr,Pr,"⋙","\\gggtr"),kr(Cr,Nr,Er,"⊲","\\lhd"),kr(Cr,Nr,Er,"⊳","\\rhd"),kr(Cr,Nr,Pr,"≂","\\eqsim",!0),kr(Cr,Tr,Pr,"⋈","\\Join"),kr(Cr,Nr,Pr,"≑","\\Doteq",!0),kr(Cr,Nr,Er,"∔","\\dotplus",!0),kr(Cr,Nr,Er,"∖","\\smallsetminus"),kr(Cr,Nr,Er,"⋒","\\Cap",!0),kr(Cr,Nr,Er,"⋓","\\Cup",!0),kr(Cr,Nr,Er,"⩞","\\doublebarwedge",!0),kr(Cr,Nr,Er,"⊟","\\boxminus",!0),kr(Cr,Nr,Er,"⊞","\\boxplus",!0),kr(Cr,Nr,Er,"⋇","\\divideontimes",!0),kr(Cr,Nr,Er,"⋉","\\ltimes",!0),kr(Cr,Nr,Er,"⋊","\\rtimes",!0),kr(Cr,Nr,Er,"⋋","\\leftthreetimes",!0),kr(Cr,Nr,Er,"⋌","\\rightthreetimes",!0),kr(Cr,Nr,Er,"⋏","\\curlywedge",!0),kr(Cr,Nr,Er,"⋎","\\curlyvee",!0),kr(Cr,Nr,Er,"⊝","\\circleddash",!0),kr(Cr,Nr,Er,"⊛","\\circledast",!0),kr(Cr,Nr,Er,"⋅","\\centerdot"),kr(Cr,Nr,Er,"⊺","\\intercal",!0),kr(Cr,Nr,Er,"⋒","\\doublecap"),kr(Cr,Nr,Er,"⋓","\\doublecup"),kr(Cr,Nr,Er,"⊠","\\boxtimes",!0),kr(Cr,Nr,Pr,"⇢","\\dashrightarrow",!0),kr(Cr,Nr,Pr,"⇠","\\dashleftarrow",!0),kr(Cr,Nr,Pr,"⇇","\\leftleftarrows",!0),kr(Cr,Nr,Pr,"⇆","\\leftrightarrows",!0),kr(Cr,Nr,Pr,"⇚","\\Lleftarrow",!0),kr(Cr,Nr,Pr,"↞","\\twoheadleftarrow",!0),kr(Cr,Nr,Pr,"↢","\\leftarrowtail",!0),kr(Cr,Nr,Pr,"↫","\\looparrowleft",!0),kr(Cr,Nr,Pr,"⇋","\\leftrightharpoons",!0),kr(Cr,Nr,Pr,"↶","\\curvearrowleft",!0),kr(Cr,Nr,Pr,"↺","\\circlearrowleft",!0),kr(Cr,Nr,Pr,"↰","\\Lsh",!0),kr(Cr,Nr,Pr,"⇈","\\upuparrows",!0),kr(Cr,Nr,Pr,"↿","\\upharpoonleft",!0),kr(Cr,Nr,Pr,"⇃","\\downharpoonleft",!0),kr(Cr,Tr,Pr,"⊶","\\origof",!0),kr(Cr,Tr,Pr,"⊷","\\imageof",!0),kr(Cr,Nr,Pr,"⊸","\\multimap",!0),kr(Cr,Nr,Pr,"↭","\\leftrightsquigarrow",!0),kr(Cr,Nr,Pr,"⇉","\\rightrightarrows",!0),kr(Cr,Nr,Pr,"⇄","\\rightleftarrows",!0),kr(Cr,Nr,Pr,"↠","\\twoheadrightarrow",!0),kr(Cr,Nr,Pr,"↣","\\rightarrowtail",!0),kr(Cr,Nr,Pr,"↬","\\looparrowright",!0),kr(Cr,Nr,Pr,"↷","\\curvearrowright",!0),kr(Cr,Nr,Pr,"↻","\\circlearrowright",!0),kr(Cr,Nr,Pr,"↱","\\Rsh",!0),kr(Cr,Nr,Pr,"⇊","\\downdownarrows",!0),kr(Cr,Nr,Pr,"↾","\\upharpoonright",!0),kr(Cr,Nr,Pr,"⇂","\\downharpoonright",!0),kr(Cr,Nr,Pr,"⇝","\\rightsquigarrow",!0),kr(Cr,Nr,Pr,"⇝","\\leadsto"),kr(Cr,Nr,Pr,"⇛","\\Rrightarrow",!0),kr(Cr,Nr,Pr,"↾","\\restriction"),kr(Cr,Tr,Lr,"‘","`"),kr(Cr,Tr,Lr,"$","\\$"),kr(jr,Tr,Lr,"$","\\$"),kr(jr,Tr,Lr,"$","\\textdollar"),kr(Cr,Tr,Lr,"%","\\%"),kr(jr,Tr,Lr,"%","\\%"),kr(Cr,Tr,Lr,"_","\\_"),kr(jr,Tr,Lr,"_","\\_"),kr(jr,Tr,Lr,"_","\\textunderscore"),kr(Cr,Tr,Lr,"∠","\\angle",!0),kr(Cr,Tr,Lr,"∞","\\infty",!0),kr(Cr,Tr,Lr,"′","\\prime"),kr(Cr,Tr,Lr,"△","\\triangle"),kr(Cr,Tr,Lr,"Γ","\\Gamma",!0),kr(Cr,Tr,Lr,"Δ","\\Delta",!0),kr(Cr,Tr,Lr,"Θ","\\Theta",!0),kr(Cr,Tr,Lr,"Λ","\\Lambda",!0),kr(Cr,Tr,Lr,"Ξ","\\Xi",!0),kr(Cr,Tr,Lr,"Π","\\Pi",!0),kr(Cr,Tr,Lr,"Σ","\\Sigma",!0),kr(Cr,Tr,Lr,"Υ","\\Upsilon",!0),kr(Cr,Tr,Lr,"Φ","\\Phi",!0),kr(Cr,Tr,Lr,"Ψ","\\Psi",!0),kr(Cr,Tr,Lr,"Ω","\\Omega",!0),kr(Cr,Tr,Lr,"A","Α"),kr(Cr,Tr,Lr,"B","Β"),kr(Cr,Tr,Lr,"E","Ε"),kr(Cr,Tr,Lr,"Z","Ζ"),kr(Cr,Tr,Lr,"H","Η"),kr(Cr,Tr,Lr,"I","Ι"),kr(Cr,Tr,Lr,"K","Κ"),kr(Cr,Tr,Lr,"M","Μ"),kr(Cr,Tr,Lr,"N","Ν"),kr(Cr,Tr,Lr,"O","Ο"),kr(Cr,Tr,Lr,"P","Ρ"),kr(Cr,Tr,Lr,"T","Τ"),kr(Cr,Tr,Lr,"X","Χ"),kr(Cr,Tr,Lr,"¬","\\neg",!0),kr(Cr,Tr,Lr,"¬","\\lnot"),kr(Cr,Tr,Lr,"⊤","\\top"),kr(Cr,Tr,Lr,"⊥","\\bot"),kr(Cr,Tr,Lr,"∅","\\emptyset"),kr(Cr,Nr,Lr,"∅","\\varnothing"),kr(Cr,Tr,Dr,"α","\\alpha",!0),kr(Cr,Tr,Dr,"β","\\beta",!0),kr(Cr,Tr,Dr,"γ","\\gamma",!0),kr(Cr,Tr,Dr,"δ","\\delta",!0),kr(Cr,Tr,Dr,"ϵ","\\epsilon",!0),kr(Cr,Tr,Dr,"ζ","\\zeta",!0),kr(Cr,Tr,Dr,"η","\\eta",!0),kr(Cr,Tr,Dr,"θ","\\theta",!0),kr(Cr,Tr,Dr,"ι","\\iota",!0),kr(Cr,Tr,Dr,"κ","\\kappa",!0),kr(Cr,Tr,Dr,"λ","\\lambda",!0),kr(Cr,Tr,Dr,"μ","\\mu",!0),kr(Cr,Tr,Dr,"ν","\\nu",!0),kr(Cr,Tr,Dr,"ξ","\\xi",!0),kr(Cr,Tr,Dr,"ο","\\omicron",!0),kr(Cr,Tr,Dr,"π","\\pi",!0),kr(Cr,Tr,Dr,"ρ","\\rho",!0),kr(Cr,Tr,Dr,"σ","\\sigma",!0),kr(Cr,Tr,Dr,"τ","\\tau",!0),kr(Cr,Tr,Dr,"υ","\\upsilon",!0),kr(Cr,Tr,Dr,"ϕ","\\phi",!0),kr(Cr,Tr,Dr,"χ","\\chi",!0),kr(Cr,Tr,Dr,"ψ","\\psi",!0),kr(Cr,Tr,Dr,"ω","\\omega",!0),kr(Cr,Tr,Dr,"ε","\\varepsilon",!0),kr(Cr,Tr,Dr,"ϑ","\\vartheta",!0),kr(Cr,Tr,Dr,"ϖ","\\varpi",!0),kr(Cr,Tr,Dr,"ϱ","\\varrho",!0),kr(Cr,Tr,Dr,"ς","\\varsigma",!0),kr(Cr,Tr,Dr,"φ","\\varphi",!0),kr(Cr,Tr,Er,"∗","*",!0),kr(Cr,Tr,Er,"+","+"),kr(Cr,Tr,Er,"−","-",!0),kr(Cr,Tr,Er,"⋅","\\cdot",!0),kr(Cr,Tr,Er,"∘","\\circ",!0),kr(Cr,Tr,Er,"÷","\\div",!0),kr(Cr,Tr,Er,"±","\\pm",!0),kr(Cr,Tr,Er,"×","\\times",!0),kr(Cr,Tr,Er,"∩","\\cap",!0),kr(Cr,Tr,Er,"∪","\\cup",!0),kr(Cr,Tr,Er,"∖","\\setminus",!0),kr(Cr,Tr,Er,"∧","\\land"),kr(Cr,Tr,Er,"∨","\\lor"),kr(Cr,Tr,Er,"∧","\\wedge",!0),kr(Cr,Tr,Er,"∨","\\vee",!0),kr(Cr,Tr,Lr,"√","\\surd"),kr(Cr,Tr,zr,"⟨","\\langle",!0),kr(Cr,Tr,zr,"∣","\\lvert"),kr(Cr,Tr,zr,"∥","\\lVert"),kr(Cr,Tr,Ar,"?","?"),kr(Cr,Tr,Ar,"!","!"),kr(Cr,Tr,Ar,"⟩","\\rangle",!0),kr(Cr,Tr,Ar,"∣","\\rvert"),kr(Cr,Tr,Ar,"∥","\\rVert"),kr(Cr,Tr,Pr,"=","="),kr(Cr,Tr,Pr,":",":"),kr(Cr,Tr,Pr,"≈","\\approx",!0),kr(Cr,Tr,Pr,"≅","\\cong",!0),kr(Cr,Tr,Pr,"≥","\\ge"),kr(Cr,Tr,Pr,"≥","\\geq",!0),kr(Cr,Tr,Pr,"←","\\gets"),kr(Cr,Tr,Pr,">","\\gt",!0),kr(Cr,Tr,Pr,"∈","\\in",!0),kr(Cr,Tr,Pr,"","\\@not"),kr(Cr,Tr,Pr,"⊂","\\subset",!0),kr(Cr,Tr,Pr,"⊃","\\supset",!0),kr(Cr,Tr,Pr,"⊆","\\subseteq",!0),kr(Cr,Tr,Pr,"⊇","\\supseteq",!0),kr(Cr,Nr,Pr,"⊈","\\nsubseteq",!0),kr(Cr,Nr,Pr,"⊉","\\nsupseteq",!0),kr(Cr,Tr,Pr,"⊨","\\models"),kr(Cr,Tr,Pr,"←","\\leftarrow",!0),kr(Cr,Tr,Pr,"≤","\\le"),kr(Cr,Tr,Pr,"≤","\\leq",!0),kr(Cr,Tr,Pr,"<","\\lt",!0),kr(Cr,Tr,Pr,"→","\\rightarrow",!0),kr(Cr,Tr,Pr,"→","\\to"),kr(Cr,Nr,Pr,"≱","\\ngeq",!0),kr(Cr,Nr,Pr,"≰","\\nleq",!0),kr(Cr,Tr,Or," ","\\ "),kr(Cr,Tr,Or," ","\\space"),kr(Cr,Tr,Or," ","\\nobreakspace"),kr(jr,Tr,Or," ","\\ "),kr(jr,Tr,Or," "," "),kr(jr,Tr,Or," ","\\space"),kr(jr,Tr,Or," ","\\nobreakspace"),kr(Cr,Tr,Or,"","\\nobreak"),kr(Cr,Tr,Or,"","\\allowbreak"),kr(Cr,Tr,_r,",",","),kr(Cr,Tr,_r,";",";"),kr(Cr,Nr,Er,"⊼","\\barwedge",!0),kr(Cr,Nr,Er,"⊻","\\veebar",!0),kr(Cr,Tr,Er,"⊙","\\odot",!0),kr(Cr,Tr,Er,"⊕","\\oplus",!0),kr(Cr,Tr,Er,"⊗","\\otimes",!0),kr(Cr,Tr,Lr,"∂","\\partial",!0),kr(Cr,Tr,Er,"⊘","\\oslash",!0),kr(Cr,Nr,Er,"⊚","\\circledcirc",!0),kr(Cr,Nr,Er,"⊡","\\boxdot",!0),kr(Cr,Tr,Er,"△","\\bigtriangleup"),kr(Cr,Tr,Er,"▽","\\bigtriangledown"),kr(Cr,Tr,Er,"†","\\dagger"),kr(Cr,Tr,Er,"⋄","\\diamond"),kr(Cr,Tr,Er,"⋆","\\star"),kr(Cr,Tr,Er,"◃","\\triangleleft"),kr(Cr,Tr,Er,"▹","\\triangleright"),kr(Cr,Tr,zr,"{","\\{"),kr(jr,Tr,Lr,"{","\\{"),kr(jr,Tr,Lr,"{","\\textbraceleft"),kr(Cr,Tr,Ar,"}","\\}"),kr(jr,Tr,Lr,"}","\\}"),kr(jr,Tr,Lr,"}","\\textbraceright"),kr(Cr,Tr,zr,"{","\\lbrace"),kr(Cr,Tr,Ar,"}","\\rbrace"),kr(Cr,Tr,zr,"[","\\lbrack",!0),kr(jr,Tr,Lr,"[","\\lbrack",!0),kr(Cr,Tr,Ar,"]","\\rbrack",!0),kr(jr,Tr,Lr,"]","\\rbrack",!0),kr(Cr,Tr,zr,"(","\\lparen",!0),kr(Cr,Tr,Ar,")","\\rparen",!0),kr(jr,Tr,Lr,"<","\\textless",!0),kr(jr,Tr,Lr,">","\\textgreater",!0),kr(Cr,Tr,zr,"⌊","\\lfloor",!0),kr(Cr,Tr,Ar,"⌋","\\rfloor",!0),kr(Cr,Tr,zr,"⌈","\\lceil",!0),kr(Cr,Tr,Ar,"⌉","\\rceil",!0),kr(Cr,Tr,Lr,"\\","\\backslash"),kr(Cr,Tr,Lr,"∣","|"),kr(Cr,Tr,Lr,"∣","\\vert"),kr(jr,Tr,Lr,"|","\\textbar",!0),kr(Cr,Tr,Lr,"∥","\\|"),kr(Cr,Tr,Lr,"∥","\\Vert"),kr(jr,Tr,Lr,"∥","\\textbardbl"),kr(jr,Tr,Lr,"~","\\textasciitilde"),kr(jr,Tr,Lr,"\\","\\textbackslash"),kr(jr,Tr,Lr,"^","\\textasciicircum"),kr(Cr,Tr,Pr,"↑","\\uparrow",!0),kr(Cr,Tr,Pr,"⇑","\\Uparrow",!0),kr(Cr,Tr,Pr,"↓","\\downarrow",!0),kr(Cr,Tr,Pr,"⇓","\\Downarrow",!0),kr(Cr,Tr,Pr,"↕","\\updownarrow",!0),kr(Cr,Tr,Pr,"⇕","\\Updownarrow",!0),kr(Cr,Tr,Ir,"∐","\\coprod"),kr(Cr,Tr,Ir,"⋁","\\bigvee"),kr(Cr,Tr,Ir,"⋀","\\bigwedge"),kr(Cr,Tr,Ir,"⨄","\\biguplus"),kr(Cr,Tr,Ir,"⋂","\\bigcap"),kr(Cr,Tr,Ir,"⋃","\\bigcup"),kr(Cr,Tr,Ir,"∫","\\int"),kr(Cr,Tr,Ir,"∫","\\intop"),kr(Cr,Tr,Ir,"∬","\\iint"),kr(Cr,Tr,Ir,"∭","\\iiint"),kr(Cr,Tr,Ir,"∏","\\prod"),kr(Cr,Tr,Ir,"∑","\\sum"),kr(Cr,Tr,Ir,"⨂","\\bigotimes"),kr(Cr,Tr,Ir,"⨁","\\bigoplus"),kr(Cr,Tr,Ir,"⨀","\\bigodot"),kr(Cr,Tr,Ir,"∮","\\oint"),kr(Cr,Tr,Ir,"∯","\\oiint"),kr(Cr,Tr,Ir,"∰","\\oiiint"),kr(Cr,Tr,Ir,"⨆","\\bigsqcup"),kr(Cr,Tr,Ir,"∫","\\smallint"),kr(jr,Tr,Rr,"…","\\textellipsis"),kr(Cr,Tr,Rr,"…","\\mathellipsis"),kr(jr,Tr,Rr,"…","\\ldots",!0),kr(Cr,Tr,Rr,"…","\\ldots",!0),kr(Cr,Tr,Rr,"⋯","\\@cdots",!0),kr(Cr,Tr,Rr,"⋱","\\ddots",!0),kr(Cr,Tr,Lr,"⋮","\\varvdots"),kr(jr,Tr,Lr,"⋮","\\varvdots"),kr(Cr,Tr,Mr,"ˊ","\\acute"),kr(Cr,Tr,Mr,"ˋ","\\grave"),kr(Cr,Tr,Mr,"¨","\\ddot"),kr(Cr,Tr,Mr,"~","\\tilde"),kr(Cr,Tr,Mr,"ˉ","\\bar"),kr(Cr,Tr,Mr,"˘","\\breve"),kr(Cr,Tr,Mr,"ˇ","\\check"),kr(Cr,Tr,Mr,"^","\\hat"),kr(Cr,Tr,Mr,"⃗","\\vec"),kr(Cr,Tr,Mr,"˙","\\dot"),kr(Cr,Tr,Mr,"˚","\\mathring"),kr(Cr,Tr,Dr,"","\\@imath"),kr(Cr,Tr,Dr,"","\\@jmath"),kr(Cr,Tr,Lr,"ı","ı"),kr(Cr,Tr,Lr,"ȷ","ȷ"),kr(jr,Tr,Lr,"ı","\\i",!0),kr(jr,Tr,Lr,"ȷ","\\j",!0),kr(jr,Tr,Lr,"ß","\\ss",!0),kr(jr,Tr,Lr,"æ","\\ae",!0),kr(jr,Tr,Lr,"œ","\\oe",!0),kr(jr,Tr,Lr,"ø","\\o",!0),kr(jr,Tr,Lr,"Æ","\\AE",!0),kr(jr,Tr,Lr,"Œ","\\OE",!0),kr(jr,Tr,Lr,"Ø","\\O",!0),kr(jr,Tr,Mr,"ˊ","\\'"),kr(jr,Tr,Mr,"ˋ","\\`"),kr(jr,Tr,Mr,"ˆ","\\^"),kr(jr,Tr,Mr,"˜","\\~"),kr(jr,Tr,Mr,"ˉ","\\="),kr(jr,Tr,Mr,"˘","\\u"),kr(jr,Tr,Mr,"˙","\\."),kr(jr,Tr,Mr,"¸","\\c"),kr(jr,Tr,Mr,"˚","\\r"),kr(jr,Tr,Mr,"ˇ","\\v"),kr(jr,Tr,Mr,"¨",'\\"'),kr(jr,Tr,Mr,"˝","\\H"),kr(jr,Tr,Mr,"◯","\\textcircled");var Fr={"--":!0,"---":!0,"``":!0,"''":!0};kr(jr,Tr,Lr,"–","--",!0),kr(jr,Tr,Lr,"–","\\textendash"),kr(jr,Tr,Lr,"—","---",!0),kr(jr,Tr,Lr,"—","\\textemdash"),kr(jr,Tr,Lr,"‘","`",!0),kr(jr,Tr,Lr,"‘","\\textquoteleft"),kr(jr,Tr,Lr,"’","'",!0),kr(jr,Tr,Lr,"’","\\textquoteright"),kr(jr,Tr,Lr,"“","``",!0),kr(jr,Tr,Lr,"“","\\textquotedblleft"),kr(jr,Tr,Lr,"”","''",!0),kr(jr,Tr,Lr,"”","\\textquotedblright"),kr(Cr,Tr,Lr,"°","\\degree",!0),kr(jr,Tr,Lr,"°","\\degree"),kr(jr,Tr,Lr,"°","\\textdegree",!0),kr(Cr,Tr,Lr,"£","\\pounds"),kr(Cr,Tr,Lr,"£","\\mathsterling",!0),kr(jr,Tr,Lr,"£","\\pounds"),kr(jr,Tr,Lr,"£","\\textsterling",!0),kr(Cr,Nr,Lr,"✠","\\maltese"),kr(jr,Nr,Lr,"✠","\\maltese");for(var Br='0123456789/@."',Hr=0;Hr<14;Hr++){var Vr=Br.charAt(Hr);kr(Cr,Tr,Lr,Vr,Vr)}for(var $r='0123456789!@*()-=+";:?/.,',qr=0;qr<25;qr++){var Ur=$r.charAt(qr);kr(jr,Tr,Lr,Ur,Ur)}for(var Gr,Wr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Kr=0;Kr<52;Kr++){var Yr=Wr.charAt(Kr);kr(Cr,Tr,Dr,Yr,Yr),kr(jr,Tr,Lr,Yr,Yr)}kr(Cr,Nr,Lr,"C","ℂ"),kr(jr,Nr,Lr,"C","ℂ"),kr(Cr,Nr,Lr,"H","ℍ"),kr(jr,Nr,Lr,"H","ℍ"),kr(Cr,Nr,Lr,"N","ℕ"),kr(jr,Nr,Lr,"N","ℕ"),kr(Cr,Nr,Lr,"P","ℙ"),kr(jr,Nr,Lr,"P","ℙ"),kr(Cr,Nr,Lr,"Q","ℚ"),kr(jr,Nr,Lr,"Q","ℚ"),kr(Cr,Nr,Lr,"R","ℝ"),kr(jr,Nr,Lr,"R","ℝ"),kr(Cr,Nr,Lr,"Z","ℤ"),kr(jr,Nr,Lr,"Z","ℤ"),kr(Cr,Tr,Dr,"h","ℎ"),kr(jr,Tr,Dr,"h","ℎ");for(var Xr=0;Xr<52;Xr++){var Zr=Wr.charAt(Xr);kr(Cr,Tr,Dr,Zr,Gr=String.fromCharCode(55349,56320+Xr)),kr(jr,Tr,Lr,Zr,Gr),kr(Cr,Tr,Dr,Zr,Gr=String.fromCharCode(55349,56372+Xr)),kr(jr,Tr,Lr,Zr,Gr),kr(Cr,Tr,Dr,Zr,Gr=String.fromCharCode(55349,56424+Xr)),kr(jr,Tr,Lr,Zr,Gr),kr(Cr,Tr,Dr,Zr,Gr=String.fromCharCode(55349,56580+Xr)),kr(jr,Tr,Lr,Zr,Gr),kr(Cr,Tr,Dr,Zr,Gr=String.fromCharCode(55349,56684+Xr)),kr(jr,Tr,Lr,Zr,Gr),kr(Cr,Tr,Dr,Zr,Gr=String.fromCharCode(55349,56736+Xr)),kr(jr,Tr,Lr,Zr,Gr),kr(Cr,Tr,Dr,Zr,Gr=String.fromCharCode(55349,56788+Xr)),kr(jr,Tr,Lr,Zr,Gr),kr(Cr,Tr,Dr,Zr,Gr=String.fromCharCode(55349,56840+Xr)),kr(jr,Tr,Lr,Zr,Gr),kr(Cr,Tr,Dr,Zr,Gr=String.fromCharCode(55349,56944+Xr)),kr(jr,Tr,Lr,Zr,Gr),Xr<26&&(kr(Cr,Tr,Dr,Zr,Gr=String.fromCharCode(55349,56632+Xr)),kr(jr,Tr,Lr,Zr,Gr),kr(Cr,Tr,Dr,Zr,Gr=String.fromCharCode(55349,56476+Xr)),kr(jr,Tr,Lr,Zr,Gr))}kr(Cr,Tr,Dr,"k",Gr=String.fromCharCode(55349,56668)),kr(jr,Tr,Lr,"k",Gr);for(var Jr=0;Jr<10;Jr++){var Qr=Jr.toString();kr(Cr,Tr,Dr,Qr,Gr=String.fromCharCode(55349,57294+Jr)),kr(jr,Tr,Lr,Qr,Gr),kr(Cr,Tr,Dr,Qr,Gr=String.fromCharCode(55349,57314+Jr)),kr(jr,Tr,Lr,Qr,Gr),kr(Cr,Tr,Dr,Qr,Gr=String.fromCharCode(55349,57324+Jr)),kr(jr,Tr,Lr,Qr,Gr),kr(Cr,Tr,Dr,Qr,Gr=String.fromCharCode(55349,57334+Jr)),kr(jr,Tr,Lr,Qr,Gr)}for(var en="ÐÞþ",tn=0;tn<3;tn++){var rn=en.charAt(tn);kr(Cr,Tr,Dr,rn,rn),kr(jr,Tr,Lr,rn,rn)}var nn={mathClass:"mathbf",textClass:"textbf",font:"Main-Bold"},an={mathClass:"mathnormal",textClass:"textit",font:"Math-Italic"},on={mathClass:"boldsymbol",textClass:"boldsymbol",font:"Main-BoldItalic"},sn={mathClass:"",textClass:"",font:""},ln={mathClass:"mathfrak",textClass:"textfrak",font:"Fraktur-Regular"},cn={mathClass:"mathbb",textClass:"textbb",font:"AMS-Regular"},dn={mathClass:"mathboldfrak",textClass:"textboldfrak",font:"Fraktur-Regular"},un={mathClass:"mathsf",textClass:"textsf",font:"SansSerif-Regular"},hn={mathClass:"mathboldsf",textClass:"textboldsf",font:"SansSerif-Bold"},pn={mathClass:"mathitsf",textClass:"textitsf",font:"SansSerif-Italic"},mn={mathClass:"mathtt",textClass:"texttt",font:"Typewriter-Regular"},fn=[nn,nn,an,an,on,on,{mathClass:"mathscr",textClass:"textscr",font:"Script-Regular"},sn,sn,sn,ln,ln,cn,cn,dn,dn,un,un,hn,hn,pn,pn,sn,sn,mn,mn],gn=[nn,sn,un,hn,mn],xn=function(e,t,r){if(Sr[r][e]){var n=Sr[r][e].replace;n&&(e=n)}return{value:e,metrics:br(e,t,r)}},vn=function(e,t,r,n,a){var o,i=xn(e,t,r),s=i.metrics;if(e=i.value,s){var l=s.italic;("text"===r||n&&"mathit"===n.font)&&(l=0),o=new pr(e,s.height,s.depth,l,s.skew,s.width,a)}else o=new pr(e,0,0,0,0,0,a);if(n){o.maxFontSize=n.sizeMultiplier,n.style.isTight()&&o.classes.push("mtight");var c=n.getColor();c&&(o.style.color=c)}return o},yn=function(e,t,r,n){return void 0===n&&(n=[]),"boldsymbol"===r.font&&xn(e,"Main-Bold",t).metrics?vn(e,"Main-Bold",t,r,n.concat(["mathbf"])):"\\"===e||"main"===Sr[t][e].font?vn(e,"Main-Regular",t,r,n):vn(e,"AMS-Regular",t,r,n.concat(["amsrm"]))},bn=function(e,t){var r="mathord"===e.type?"mathord":"textord",n=e.mode,a=e.text,o=["mord"],i=t.font,s=t.fontFamily,l=t.fontWeight,c=t.fontShape,d="math"===n||"text"===n&&!!i,u=d?i:s,h="",p="";if(55349===a.charCodeAt(0)){var m=(e=>{var t=1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320)+65536;if(119808<=t&&t<120484)return fn[Math.floor((t-119808)/26)];if(120782<=t&&t<=120831)return gn[Math.floor((t-120782)/10)];if(120485===t||120486===t)return fn[0];if(120486<t&&t<120782)return sn;throw new kt("Unsupported character: "+e)})(a);h=m.font,p=m[n+"Class"]}if(h)return vn(a,h,n,t,o.concat(p));if(u){var f,g;if("boldsymbol"===u){var x=function(e,t,r){return"textord"!==r&&xn(e,"Math-BoldItalic",t).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}}(a,n,r);f=x.fontName,g=[x.fontClass]}else d?(f=Dn[i].fontName,g=[i]):(f=Rn(s,l,c),g=[s,l,c]);if(xn(a,f,n).metrics)return vn(a,f,n,t,o.concat(g));if(Object.prototype.hasOwnProperty.call(Fr,a)&&"Typewriter"===f.slice(0,10)){for(var v=[],y=0;y<a.length;y++)v.push(vn(a[y],f,n,t,o.concat(g)));return Nn(v)}}if("mathord"===r)return vn(a,"Math-Italic",n,t,o.concat(["mathnormal"]));if("textord"===r){var b=Sr[n][a]&&Sr[n][a].font;if("ams"===b)return vn(a,Rn("amsrm",l,c),n,t,o.concat("amsrm",l,c));if("main"!==b&&b){var w=Rn(b,l,c);return vn(a,w,n,t,o.concat(w,l,c))}return vn(a,Rn("textrm",l,c),n,t,o.concat(l,c))}throw new Error("unexpected type: "+r+" in makeOrd")},wn=(e,t)=>{if(nr(e.classes)!==nr(t.classes)||e.skew!==t.skew||e.maxFontSize!==t.maxFontSize||0!==e.italic&&e.hasClass("mathnormal"))return!1;if(1===e.classes.length){var r=e.classes[0];if("mbin"===r||"mord"===r)return!1}for(var n of Object.keys(e.style))if(e.style[n]!==t.style[n])return!1;for(var a of Object.keys(t.style))if(e.style[a]!==t.style[a])return!1;return!0},Sn=e=>{for(var t=0;t<e.length-1;t++){var r=e[t],n=e[t+1];r instanceof pr&&n instanceof pr&&wn(r,n)&&(r.text+=n.text,r.height=Math.max(r.height,n.height),r.depth=Math.max(r.depth,n.depth),r.italic=n.italic,e.splice(t+1,1),t--)}return e},kn=function(e){for(var t=0,r=0,n=0,a=0;a<e.children.length;a++){var o=e.children[a];o.height>t&&(t=o.height),o.depth>r&&(r=o.depth),o.maxFontSize>n&&(n=o.maxFontSize)}e.height=t,e.depth=r,e.maxFontSize=n},Cn=function(e,t,r,n){var a=new cr(e,t,r,n);return kn(a),a},jn=(e,t,r,n)=>new cr(e,t,r,n),Tn=function(e,t,r){var n=Cn([e],[],t);return n.height=Math.max(r||t.fontMetrics().defaultRuleThickness,t.minRuleThickness),n.style.borderBottomWidth=rr(n.height),n.maxFontSize=1,n},Nn=function(e){var t=new Zt(e);return kn(t),t},Mn=function(e,t){return e instanceof Zt?Cn([],[e],t):e},En=function(e,t){for(var r=function(e){if("individualShift"===e.positionType){for(var t=e.children,r=[t[0]],n=-t[0].shift-t[0].elem.depth,a=n,o=1;o<t.length;o++){var i=-t[o].shift-a-t[o].elem.depth,s=i-(t[o-1].elem.height+t[o-1].elem.depth);a+=i,r.push({type:"kern",size:s}),r.push(t[o])}return{children:r,depth:n}}var l;if("top"===e.positionType){for(var c=e.positionData,d=0;d<e.children.length;d++){var u=e.children[d];c-="kern"===u.type?u.size:u.elem.height+u.elem.depth}l=c}else if("bottom"===e.positionType)l=-e.positionData;else{var h=e.children[0];if("elem"!==h.type)throw new Error('First child must have type "elem".');if("shift"===e.positionType)l=-h.elem.depth-e.positionData;else{if("firstBaseline"!==e.positionType)throw new Error("Invalid positionType "+e.positionType+".");l=-h.elem.depth}}return{children:e.children,depth:l}}(e),n=r.children,a=r.depth,o=0,i=0;i<n.length;i++){var s=n[i];if("elem"===s.type){var l=s.elem;o=Math.max(o,l.maxFontSize,l.height)}}o+=2;var c=Cn(["pstrut"],[]);c.style.height=rr(o);for(var d=[],u=a,h=a,p=a,m=0;m<n.length;m++){var f=n[m];if("kern"===f.type)p+=f.size;else{var g=f.elem,x=f.wrapperClasses||[],v=f.wrapperStyle||{},y=Cn(x,[c,g],void 0,v);y.style.top=rr(-o-p-g.depth),f.marginLeft&&(y.style.marginLeft=f.marginLeft),f.marginRight&&(y.style.marginRight=f.marginRight),d.push(y),p+=g.height+g.depth}u=Math.min(u,p),h=Math.max(h,p)}var b,w=Cn(["vlist"],d);if(w.style.height=rr(h),u<0){var S=Cn(["vlist"],[Cn([],[])]);S.style.height=rr(-u),b=[Cn(["vlist-r"],[w,Cn(["vlist-s"],[new pr("​")])]),Cn(["vlist-r"],[S])]}else b=[Cn(["vlist-r"],[w])];var k=Cn(["vlist-t"],b);return 2===b.length&&k.classes.push("vlist-t2"),k.height=h,k.depth=-u,k},An=(e,t)=>{var r=Cn(["mspace"],[],t),n=tr(e,t);return r.style.marginRight=rr(n),r},Rn=(e,t,r)=>{var n;switch(e){case"amsrm":n="AMS";break;case"textrm":n="Main";break;case"textsf":n="SansSerif";break;case"texttt":n="Typewriter";break;default:n=e}return n+"-"+("textbf"===t&&"textit"===r?"BoldItalic":"textbf"===t?"Bold":"textit"===r?"Italic":"Regular")},Dn={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},In={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},zn=function(e,t){var r=In[e],n=r[0],a=r[1],o=r[2],i=new fr(n),s=jn(["katex-overlay"],[new mr([i],{width:rr(a),height:rr(o),style:"width:"+rr(a),viewBox:"0 0 "+1e3*a+" "+1e3*o,preserveAspectRatio:"xMinYMin"})],t);return s.height=o,s.style.height=rr(o),s.style.width=rr(a),s},_n={number:3,unit:"mu"},Pn={number:4,unit:"mu"},On={number:5,unit:"mu"},Ln={mord:{mop:_n,mbin:Pn,mrel:On,minner:_n},mop:{mord:_n,mop:_n,mrel:On,minner:_n},mbin:{mord:Pn,mop:Pn,mopen:Pn,minner:Pn},mrel:{mord:On,mop:On,mopen:On,minner:On},mopen:{},mclose:{mop:_n,mbin:Pn,mrel:On,minner:_n},mpunct:{mord:_n,mop:_n,mrel:On,mopen:_n,mclose:_n,mpunct:_n,minner:_n},minner:{mord:_n,mop:_n,mbin:Pn,mrel:On,mopen:_n,mpunct:_n,minner:_n}},Fn={mord:{mop:_n},mop:{mord:_n,mop:_n},mbin:{},mrel:{},mopen:{},mclose:{mop:_n},mpunct:{},minner:{mop:_n}},Bn={},Hn={},Vn={};function $n(e){for(var t=e.type,r=e.names,n=e.htmlBuilder,a=e.mathmlBuilder,o=0;o<r.length;++o)Bn[r[o]]=e;t&&(n&&(Hn[t]=n),a&&(Vn[t]=a))}function qn(e){var t=e.type,r=e.htmlBuilder,n=e.mathmlBuilder;r&&(Hn[t]=r),n&&(Vn[t]=n)}var Un=function(e){return"ordgroup"===e.type&&1===e.body.length?e.body[0]:e},Gn=function(e){return"ordgroup"===e.type?e.body:[e]},Wn=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),Kn=new Set(["rightmost","mrel","mclose","mpunct"]),Yn={display:qt.DISPLAY,text:qt.TEXT,script:qt.SCRIPT,scriptscript:qt.SCRIPTSCRIPT},Xn={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},Zn=function(e,t,r,n){void 0===n&&(n=[null,null]);for(var a=[],o=0;o<e.length;o++){var i=na(e[o],t);if(i instanceof Zt){var s=i.children;a.push(...s)}else a.push(i)}if(Sn(a),!r)return a;var l=t;if(1===e.length){var c=e[0];"sizing"===c.type?l=t.havingSize(c.size):"styling"===c.type&&(l=t.havingStyle(Yn[c.style]))}var d=Cn([n[0]||"leftmost"],[],t),u=Cn([n[1]||"rightmost"],[],t),h="root"===r;return Jn(a,(e,t)=>{var r=t.classes[0],n=e.classes[0];"mbin"===r&&Kn.has(n)?t.classes[0]="mord":"mbin"===n&&Wn.has(r)&&(e.classes[0]="mord")},{node:d},u,h),Jn(a,(e,t)=>{var r,n,a=ta(t),o=ta(e),i=a&&o?e.hasClass("mtight")?null==(r=Fn[a])?void 0:r[o]:null==(n=Ln[a])?void 0:n[o]:null;if(i)return An(i,l)},{node:d},u,h),a},Jn=function(e,t,r,n,a){n&&e.push(n);for(var o=0;o<e.length;o++){var i=e[o],s=Qn(i);if(s)Jn(s.children,t,r,null,a);else{var l=!i.hasClass("mspace");if(l){var c=t(i,r.node);c&&(r.insertAfter?r.insertAfter(c):(e.unshift(c),o++))}l?r.node=i:a&&i.hasClass("katex-newline")&&(r.node=Cn(["leftmost"])),r.insertAfter=(t=>r=>{e.splice(t+1,0,r),o++})(o)}}n&&e.pop()},Qn=function(e){return e instanceof Zt||e instanceof dr||e instanceof cr&&e.hasClass("enclosing")?e:null},ea=function(e,t){var r=Qn(e);if(r){var n=r.children;if(n.length){if("right"===t)return ea(n[n.length-1],"right");if("left"===t)return ea(n[0],"left")}}return e},ta=function(e,t){return e?(t&&(e=ea(e,t)),Xn[e.classes[0]]||null):null},ra=function(e,t){var r=["nulldelimiter"].concat(e.baseSizingClasses());return Cn(t.concat(r))},na=function(e,t,r){if(!e)return Cn();if(Hn[e.type]){var n=Hn[e.type](e,t);if(r&&t.size!==r.size){n=Cn(t.sizingClasses(r),[n],t);var a=t.sizeMultiplier/r.sizeMultiplier;n.height*=a,n.depth*=a}return n}throw new kt("Got group of unknown type: '"+e.type+"'")};function aa(e,t){var r=Cn(["katex-base"],e,t),n=Cn(["katex-strut"]);return n.style.height=rr(r.height+r.depth),r.depth&&(n.style.verticalAlign=rr(-r.depth)),r.children.unshift(n),r}function oa(e,t){var r=null;1===e.length&&"tag"===e[0].type&&(r=e[0].tag,e=e[0].body);var n,a=Zn(e,t,"root");2===a.length&&a[1].hasClass("katex-tag")&&(n=a.pop());for(var o,i=[],s=[],l=0;l<a.length;l++)if(s.push(a[l]),a[l].hasClass("mbin")||a[l].hasClass("mrel")||a[l].hasClass("allowbreak")){for(var c=!1;l<a.length-1&&a[l+1].hasClass("mspace")&&!a[l+1].hasClass("katex-newline");)l++,s.push(a[l]),a[l].hasClass("nobreak")&&(c=!0);c||(i.push(aa(s,t)),s=[])}else a[l].hasClass("katex-newline")&&(s.pop(),s.length>0&&(i.push(aa(s,t)),s=[]),i.push(a[l]));s.length>0&&i.push(aa(s,t)),r?((o=aa(Zn(r,t,!0),t)).classes=["katex-tag"],i.push(o)):n&&i.push(n);var d=Cn(["katex-html"],i);if(d.setAttribute("aria-hidden","true"),o){var u=o.children[0];u.style.height=rr(d.height+d.depth),d.depth&&(u.style.verticalAlign=rr(-d.depth))}return d}function ia(e){return new Zt(e)}var sa=class{constructor(e,t,r){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=t||[],this.classes=r||[]}setAttribute(e,t){this.attributes[e]=t}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var t of Object.entries(this.attributes)){var r=t[0],n=t[1];e.setAttribute(r,n)}this.classes.length>0&&(e.className=nr(this.classes));for(var a=0;a<this.children.length;a++)if(this.children[a]instanceof la&&this.children[a+1]instanceof la){for(var o=this.children[a].toText()+this.children[++a].toText();this.children[a+1]instanceof la;)o+=this.children[++a].toText();e.appendChild(new la(o).toNode())}else e.appendChild(this.children[a].toNode());return e}toMarkup(){var e="<"+this.type;for(var t of Object.entries(this.attributes)){var r=t[0],n=t[1];e+=" "+r+'="',e+=Mt(n),e+='"'}this.classes.length>0&&(e+=' class ="'+Mt(nr(this.classes))+'"'),e+=">";for(var a=0;a<this.children.length;a++)e+=this.children[a].toMarkup();return e+="</"+this.type+">"}toText(){return this.children.map(e=>e.toText()).join("")}},la=class{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return Mt(this.toText())}toText(){return this.text}},ca=class{constructor(e){this.width=void 0,this.character=void 0,this.width=e,this.character=e>=.05555&&e<=.05556?" ":e>=.1666&&e<=.1667?" ":e>=.2222&&e<=.2223?" ":e>=.2777&&e<=.2778?"  ":e>=-.05556&&e<=-.05555?" ⁣":e>=-.1667&&e<=-.1666?" ⁣":e>=-.2223&&e<=-.2222?" ⁣":e>=-.2778&&e<=-.2777?" ⁣":null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",rr(this.width)),e}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+rr(this.width)+'"/>'}toText(){return this.character?this.character:" "}},da=new Set(["\\imath","\\jmath"]),ua=new Set(["mrow","mtable"]),ha=function(e,t,r){var n,a;return Sr[t][e]&&Sr[t][e].replace&&55349!==e.charCodeAt(0)&&(!Object.prototype.hasOwnProperty.call(Fr,e)||"tt"!==(null==r||null==(n=r.fontFamily)?void 0:n.slice(4,6))&&"tt"!==(null==r||null==(a=r.font)?void 0:a.slice(4,6)))&&(e=Sr[t][e].replace),new la(e)},pa=function(e){return 1===e.length?e[0]:new sa("mrow",e)},ma={mathit:"italic",boldsymbol:e=>"textord"===e.type?"bold":"bold-italic",mathbf:"bold",mathbb:"double-struck",mathsfit:"sans-serif-italic",mathfrak:"fraktur",mathscr:"script",mathcal:"script",mathsf:"sans-serif",mathtt:"monospace"},fa=(e,t)=>{if("text"===e.mode){if("texttt"===t.fontFamily)return"monospace";if("textsf"===t.fontFamily)return"textit"===t.fontShape&&"textbf"===t.fontWeight?"sans-serif-bold-italic":"textit"===t.fontShape?"sans-serif-italic":"textbf"===t.fontWeight?"bold-sans-serif":"sans-serif";if("textit"===t.fontShape&&"textbf"===t.fontWeight)return"bold-italic";if("textit"===t.fontShape)return"italic";if("textbf"===t.fontWeight)return"bold"}var r=t.font;if(!r||"mathnormal"===r)return null;var n=e.mode,a=ma[r];if(a)return"function"==typeof a?a(e):a;var o=e.text;if(da.has(o))return null;if(Sr[n][o]){var i=Sr[n][o].replace;i&&(o=i)}return br(o,Dn[r].fontName,n)?Dn[r].variant:null};function ga(e){if(!e)return!1;if("mi"===e.type&&1===e.children.length){var t=e.children[0];return t instanceof la&&"."===t.text}if("mo"===e.type&&1===e.children.length&&"true"===e.getAttribute("separator")&&"0em"===e.getAttribute("lspace")&&"0em"===e.getAttribute("rspace")){var r=e.children[0];return r instanceof la&&","===r.text}return!1}var xa=function(e,t,r){if(1===e.length){var n=ya(e[0],t);return r&&n instanceof sa&&"mo"===n.type&&(n.setAttribute("lspace","0em"),n.setAttribute("rspace","0em")),[n]}for(var a,o=[],i=0;i<e.length;i++){var s=ya(e[i],t);if(s instanceof sa&&a instanceof sa){if("mtext"===s.type&&"mtext"===a.type&&s.getAttribute("mathvariant")===a.getAttribute("mathvariant")){a.children.push(...s.children);continue}if("mn"===s.type&&"mn"===a.type){a.children.push(...s.children);continue}if(ga(s)&&"mn"===a.type){a.children.push(...s.children);continue}if("mn"===s.type&&ga(a))s.children=[...a.children,...s.children],o.pop();else if(("msup"===s.type||"msub"===s.type)&&s.children.length>=1&&("mn"===a.type||ga(a))){var l=s.children[0];l instanceof sa&&"mn"===l.type&&(l.children=[...a.children,...l.children],o.pop())}else if("mi"===a.type&&1===a.children.length){var c=a.children[0];if(c instanceof la&&"̸"===c.text&&("mo"===s.type||"mi"===s.type||"mn"===s.type)){var d=s.children[0];d instanceof la&&d.text.length>0&&(d.text=d.text.slice(0,1)+"̸"+d.text.slice(1),o.pop())}}}o.push(s),a=s}return o},va=function(e,t,r){return pa(xa(e,t,r))},ya=function(e,t){if(!e)return new sa("mrow");if(Vn[e.type])return Vn[e.type](e,t);throw new kt("Got group of unknown type: '"+e.type+"'")};function ba(e,t,r,n,a){var o,i=xa(e,r);o=1===i.length&&i[0]instanceof sa&&ua.has(i[0].type)?i[0]:new sa("mrow",i);var s=new sa("annotation",[new la(t)]);s.setAttribute("encoding","application/x-tex");var l=new sa("semantics",[o,s]),c=new sa("math",[l]);return c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),n&&c.setAttribute("display","block"),Cn([a?"katex":"katex-mathml"],[c])}var wa=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],Sa=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],ka=function(e,t){return t.size<2?e:wa[e-1][t.size-1]},Ca=class e{constructor(t){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=t.style,this.color=t.color,this.size=t.size||e.BASESIZE,this.textSize=t.textSize||this.size,this.phantom=!!t.phantom,this.font=t.font||"",this.fontFamily=t.fontFamily||"",this.fontWeight=t.fontWeight||"",this.fontShape=t.fontShape||"",this.sizeMultiplier=Sa[this.size-1],this.maxSize=t.maxSize,this.minRuleThickness=t.minRuleThickness,this._fontMetrics=void 0}extend(t){var r={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};return Object.assign(r,t),new e(r)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:ka(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:Sa[e-1]})}havingBaseStyle(t){t=t||this.style.text();var r=ka(e.BASESIZE,t);return this.size===r&&this.textSize===e.BASESIZE&&this.style===t?this:this.extend({style:t,size:r})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["katex-sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==e.BASESIZE?["katex-sizing","reset-size"+this.size,"size"+e.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=function(e){var t;if(!wr[t=e>=5?0:e>=3?1:2]){var r=wr[t]={cssEmPerMu:vr.quad[t]/18};for(var n of Object.keys(vr))r[n]=vr[n][t]}return wr[t]}(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}};Ca.BASESIZE=6;var ja=function(e){return new Ca({style:e.displayMode?qt.DISPLAY:qt.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},Ta=function(e,t){if(t.displayMode){var r=["katex-display"];t.leqno&&r.push("leqno"),t.fleqn&&r.push("fleqn"),e=Cn(r,[e])}return e},Na={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",underbracket:"⎵",overbracket:"⎴",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},Ma=function(e){var t=new sa("mo",[new la(Na[e.replace(/^\\/,"")])]);return t.setAttribute("stretchy","true"),t},Ea={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overbracket:[["leftbracketover","rightbracketover"],1.6,440],underbracket:[["leftbracketunder","rightbracketunder"],1.6,410],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},Aa=new Set(["widehat","widecheck","widetilde","utilde"]),Ra=function(e,t){var r=function(){var r=4e5,n=e.label.slice(1);if(Aa.has(n)&&"base"in e){var a,o,i,s="ordgroup"===e.base.type?e.base.body.length:1;if(s>5)"widehat"===n||"widecheck"===n?(a=420,r=2364,i=.42,o=n+"4"):(a=312,r=2340,i=.34,o="tilde4");else{var l=[1,1,2,2,3,3][s];"widehat"===n||"widecheck"===n?(r=[0,1062,2364,2364,2364][l],a=[0,239,300,360,420][l],i=[0,.24,.3,.3,.36,.42][l],o=n+l):(r=[0,600,1033,2339,2340][l],a=[0,260,286,306,312][l],i=[0,.26,.286,.3,.306,.34][l],o="tilde"+l)}var c=new fr(o);return{span:jn([],[new mr([c],{width:"100%",height:rr(i),viewBox:"0 0 "+r+" "+a,preserveAspectRatio:"none"})],t),minWidth:0,height:i}}var d=[],u=Ea[n];if(!u)throw new Error('No SVG data for "'+n+'".');var h,p,m=u[0],f=u[1],g=u[2],x=g/1e3,v=m.length;if(1===v){if(4!==u.length)throw new Error('Expected 4-tuple for single-path SVG data "'+n+'".');h=["hide-tail"],p=[u[3]]}else if(2===v)h=["halfarrow-left","halfarrow-right"],p=["xMinYMin","xMaxYMin"];else{if(3!==v)throw new Error("Correct katexImagesData or update code here to support\n "+v+" children.");h=["brace-left","brace-center","brace-right"],p=["xMinYMin","xMidYMin","xMaxYMin"]}for(var y=0;y<v;y++){var b=new fr(m[y]),w=new mr([b],{width:"400em",height:rr(x),viewBox:"0 0 "+r+" "+g,preserveAspectRatio:p[y]+" slice"}),S=jn([h[y]],[w],t);if(1===v)return{span:S,minWidth:f,height:x};S.style.height=rr(x),d.push(S)}return{span:Cn(["katex-stretchy"],d,t),minWidth:f,height:x}}(),n=r.span,a=r.minWidth,o=r.height;return n.height=o,n.style.height=rr(o),a>0&&(n.style.minWidth=rr(a)),n},Da=new Set(["bin","close","inner","open","punct","rel"]),Ia=new Set(["accent-token","mathord","op-token","spacing","textord"]);function za(e,t){if(!e||e.type!==t)throw new Error("Expected node of type "+t+", but got "+(e?"node of type "+e.type:String(e)));return e}function _a(e){var t=Pa(e);if(!t)throw new Error("Expected node of symbol group type, but got "+(e?"node of type "+e.type:String(e)));return t}function Pa(e){return"atom"===e.type||Ia.has(e.type)?e:null}function Oa(e,t,r){var n="";for(var a of e.body)if("textord"===a.type)n+=a.text;else{if(!r||"spacing"!==a.type||" "!==a.text)throw new kt(t,e);n+=" "}return n}var La=e=>{return e instanceof pr?e:((t=e)instanceof cr||t instanceof dr||t instanceof Zt)&&1===e.children.length?La(e.children[0]):void 0;var t},Fa=(e,t)=>{var r,n,a;e&&"supsub"===e.type?(r=(n=za(e.base,"accent")).base,e.base=r,a=function(e){if(e instanceof cr)return e;throw new Error("Expected span<HtmlDomNode> but got "+String(e)+".")}(na(e,t)),e.base=n):r=(n=za(e,"accent")).base;var o,i,s=na(r,t.havingCrampedStyle()),l=0;n.isShifty&&Rt(r)&&(l=null!=(o=null==(i=La(s))?void 0:i.skew)?o:0);var c,d="\\c"===n.label,u=d?s.height+s.depth:Math.min(s.height,t.fontMetrics().xHeight);if(n.isStretchy)c=Ra(n,t),c=En({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"elem",elem:c,wrapperClasses:["svg-align"],wrapperStyle:l>0?{width:"calc(100% - "+rr(2*l)+")",marginLeft:rr(2*l)}:void 0}]});else{var h,p;"\\vec"===n.label?(h=zn("vec",t),p=In.vec[1]):(h=function(e){if(e instanceof pr)return e;throw new Error("Expected symbolNode but got "+String(e)+".")}(h=bn({type:"textord",mode:n.mode,text:n.label},t)),h.italic=0,p=h.width,d&&(u+=h.depth)),c=Cn(["accent-body"],[h]);var m="\\textcircled"===n.label;m&&(c.classes.push("accent-full"),u=s.height);var f=l;m||(f-=p/2),c.style.left=rr(f),"\\textcircled"===n.label&&(c.style.top=".2em"),c=En({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"kern",size:-u},{type:"elem",elem:c}]})}var g=Cn(["mord","katex-accent"],[c],t);return a?(a.children[0]=g,a.height=Math.max(g.height,a.height),a.classes[0]="mord",a):g},Ba=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));$n({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],numArgs:1,handler:(e,t)=>{var r=Un(t[0]),n=!Ba.test(e.funcName),a=!n||"\\widehat"===e.funcName||"\\widetilde"===e.funcName||"\\widecheck"===e.funcName;return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:n,isShifty:a,base:r}},htmlBuilder:Fa,mathmlBuilder:(e,t)=>{var r=e.isStretchy?Ma(e.label):new sa("mo",[ha(e.label,e.mode)]),n=new sa("mover",[ya(e.base,t),r]);return n.setAttribute("accent","true"),n}}),$n({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"],handler:(e,t)=>{var r=t[0],n=e.parser.mode;return"math"===n&&(e.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+e.funcName+" works only in text mode"),n="text"),{type:"accent",mode:n,label:e.funcName,isStretchy:!1,isShifty:!0,base:r}}}),$n({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],numArgs:1,handler:(e,t)=>{var r=e.parser,n=e.funcName,a=t[0];return{type:"accentUnder",mode:r.mode,label:n,base:a}},htmlBuilder:(e,t)=>{var r=na(e.base,t),n=Ra(e,t),a="\\utilde"===e.label?.12:0;return Cn(["mord","accentunder"],[En({positionType:"top",positionData:r.height,children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:a},{type:"elem",elem:r}]})],t)},mathmlBuilder:(e,t)=>{var r=Ma(e.label),n=new sa("munder",[ya(e.base,t),r]);return n.setAttribute("accentunder","true"),n}});var Ha=e=>{var t=new sa("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};$n({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],numArgs:1,numOptionalArgs:1,handler(e,t,r){var n=e.parser,a=e.funcName;return{type:"xArrow",mode:n.mode,label:a,body:t[0],below:r[0]}},htmlBuilder(e,t){var r,n=t.style,a=t.havingStyle(n.sup()),o=Mn(na(e.body,a,t),t),i="\\x"===e.label.slice(0,2)?"x":"cd";o.classes.push(i+"-arrow-pad"),e.below&&(a=t.havingStyle(n.sub()),(r=Mn(na(e.below,a,t),t)).classes.push(i+"-arrow-pad"));var s,l=Ra(e,t),c=-t.fontMetrics().axisHeight+.5*l.height,d=-t.fontMetrics().axisHeight-.5*l.height-.111;if((o.depth>.25||"\\xleftequilibrium"===e.label)&&(d-=o.depth),r){var u=-t.fontMetrics().axisHeight+r.height+.5*l.height+.111;s=En({positionType:"individualShift",children:[{type:"elem",elem:o,shift:d},{type:"elem",elem:l,shift:c,wrapperClasses:["svg-align"]},{type:"elem",elem:r,shift:u}]})}else s=En({positionType:"individualShift",children:[{type:"elem",elem:o,shift:d},{type:"elem",elem:l,shift:c,wrapperClasses:["svg-align"]}]});return Cn(["mrel","x-arrow"],[s],t)},mathmlBuilder(e,t){var r,n=Ma(e.label);if(n.setAttribute("minsize","x"===e.label.charAt(0)?"1.75em":"3.0em"),e.body){var a=Ha(ya(e.body,t));if(e.below){var o=Ha(ya(e.below,t));r=new sa("munderover",[n,o,a])}else r=new sa("mover",[n,a])}else if(e.below){var i=Ha(ya(e.below,t));r=new sa("munder",[n,i])}else r=Ha(),r=new sa("mover",[n,r]);return r}}),$n({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],numArgs:1,primitive:!0,handler(e,t){var r=e.parser,n=e.funcName,a=t[0];return{type:"mclass",mode:r.mode,mclass:"m"+n.slice(5),body:Gn(a),isCharacterBox:Rt(a)}},htmlBuilder:function(e,t){var r=Zn(e.body,t,!0);return Cn([e.mclass],r,t)},mathmlBuilder:function(e,t){var r,n=xa(e.body,t);return"minner"===e.mclass?r=new sa("mpadded",n):"mord"===e.mclass?e.isCharacterBox?(r=n[0]).type="mi":r=new sa("mi",n):(e.isCharacterBox?(r=n[0]).type="mo":r=new sa("mo",n),"mbin"===e.mclass?(r.attributes.lspace="0.22em",r.attributes.rspace="0.22em"):"mpunct"===e.mclass?(r.attributes.lspace="0em",r.attributes.rspace="0.17em"):"mopen"!==e.mclass&&"mclose"!==e.mclass||(r.attributes.lspace="0em",r.attributes.rspace="0em")),r}});var Va=e=>{var t="ordgroup"===e.type&&e.body.length?e.body[0]:e;return"atom"!==t.type||"bin"!==t.family&&"rel"!==t.family?"mord":"m"+t.family};$n({type:"mclass",names:["\\@binrel"],numArgs:2,handler:(e,t)=>({type:"mclass",mode:e.parser.mode,mclass:Va(t[0]),body:Gn(t[1]),isCharacterBox:Rt(t[1])})}),$n({type:"mclass",names:["\\stackrel","\\overset","\\underset"],numArgs:2,handler(e,t){var r,n=e.parser,a=e.funcName,o=t[1],i=t[0];r="\\stackrel"!==a?Va(o):"mrel";var s={type:"op",mode:o.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:"\\stackrel"!==a,body:Gn(o)},l="\\underset"===a?{type:"supsub",mode:i.mode,base:s,sub:i}:{type:"supsub",mode:i.mode,base:s,sup:i};return{type:"mclass",mode:n.mode,mclass:r,body:[l],isCharacterBox:Rt(l)}}}),$n({type:"pmb",names:["\\pmb"],numArgs:1,allowedInText:!0,handler:(e,t)=>({type:"pmb",mode:e.parser.mode,mclass:Va(t[0]),body:Gn(t[0])}),htmlBuilder(e,t){var r=Zn(e.body,t,!0),n=Cn([e.mclass],r,t);return n.style.textShadow="0.02em 0.01em 0.04px",n},mathmlBuilder(e,t){var r=xa(e.body,t),n=new sa("mstyle",r);return n.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),n}});var $a={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},qa=()=>({type:"styling",body:[],mode:"math",style:"display",resetFont:!0}),Ua=e=>"textord"===e.type&&"@"===e.text,Ga=(e,t)=>("mathord"===e.type||"atom"===e.type)&&e.text===t;function Wa(e,t,r){var n=$a[e];switch(n){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return r.callFunction(n,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":var a={type:"atom",text:n,mode:"math",family:"rel"},o={type:"ordgroup",mode:"math",body:[r.callFunction("\\\\cdleft",[t[0]],[]),r.callFunction("\\Big",[a],[]),r.callFunction("\\\\cdright",[t[1]],[])]};return r.callFunction("\\\\cdparent",[o],[]);case"\\\\cdlongequal":return r.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":return r.callFunction("\\Big",[{type:"textord",text:"\\Vert",mode:"math"}],[]);default:return{type:"textord",text:" ",mode:"math"}}}$n({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],numArgs:1,handler(e,t){var r=e.parser,n=e.funcName;return{type:"cdlabel",mode:r.mode,side:n.slice(4),label:t[0]}},htmlBuilder(e,t){var r=t.havingStyle(t.style.sup()),n=Mn(na(e.label,r,t),t);return n.classes.push("cd-label-"+e.side),n.style.bottom=rr(.8-n.depth),n.height=0,n.depth=0,n},mathmlBuilder(e,t){var r=new sa("mrow",[ya(e.label,t)]);return(r=new sa("mpadded",[r])).setAttribute("width","0"),"left"===e.side&&r.setAttribute("lspace","-1width"),r.setAttribute("voffset","0.7em"),(r=new sa("mstyle",[r])).setAttribute("displaystyle","false"),r.setAttribute("scriptlevel","1"),r}}),$n({type:"cdlabelparent",names:["\\\\cdparent"],numArgs:1,handler:(e,t)=>({type:"cdlabelparent",mode:e.parser.mode,fragment:t[0]}),htmlBuilder(e,t){var r=Mn(na(e.fragment,t),t);return r.classes.push("cd-vert-arrow"),r},mathmlBuilder:(e,t)=>new sa("mrow",[ya(e.fragment,t)])}),$n({type:"textord",names:["\\@char"],numArgs:1,allowedInText:!0,handler(e,t){var r,n=e.parser,a=Oa(za(t[0],"ordgroup"),"\\@char has non-numeric argument"),o=parseInt(a);if(isNaN(o))throw new kt("\\@char has non-numeric argument "+a);if(o<0||o>1114111)throw new kt("\\@char with invalid code point "+a);return o<=65535?r=String.fromCharCode(o):(o-=65536,r=String.fromCharCode(55296+(o>>10),56320+(1023&o))),{type:"textord",mode:n.mode,text:r}}});$n({type:"color",names:["\\textcolor"],numArgs:2,allowedInText:!0,argTypes:["color","original"],handler(e,t){var r=e.parser,n=za(t[0],"color-token").color,a=t[1];return{type:"color",mode:r.mode,color:n,body:Gn(a)}},htmlBuilder:(e,t)=>Nn(Zn(e.body,t.withColor(e.color),!1)),mathmlBuilder:(e,t)=>{var r=xa(e.body,t.withColor(e.color)),n=new sa("mstyle",r);return n.setAttribute("mathcolor",e.color),n}}),$n({type:"color",names:["\\color"],numArgs:1,allowedInText:!0,argTypes:["color"],handler(e,t){var r=e.parser,n=e.breakOnTokenText,a=za(t[0],"color-token").color;r.gullet.macros.set("\\current@color",a);var o=r.parseExpression(!0,n);return{type:"color",mode:r.mode,color:a,body:o}}}),$n({type:"cr",names:["\\\\"],numArgs:0,numOptionalArgs:0,allowedInText:!0,handler(e,t,r){var n=e.parser,a="["===n.gullet.future().text?n.parseSizeGroup(!0):null,o=!n.settings.displayMode||!n.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:n.mode,newLine:o,size:a&&za(a,"size").value}},htmlBuilder(e,t){var r=Cn(["mspace"],[],t);return e.newLine&&(r.classes.push("katex-newline"),e.size&&(r.style.marginTop=rr(tr(e.size,t)))),r},mathmlBuilder(e,t){var r=new sa("mspace");return e.newLine&&(r.setAttribute("linebreak","newline"),e.size&&r.setAttribute("height",rr(tr(e.size,t)))),r}});var Ka={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},Ya=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new kt("Expected a control sequence",e);return t},Xa=(e,t,r,n)=>{var a=e.gullet.macros.get(r.text);null==a&&(r.noexpand=!0,a={tokens:[r],numArgs:0,unexpandable:!e.gullet.isExpandable(r.text)}),e.gullet.macros.set(t,a,n)};$n({type:"internal",names:["\\global","\\long","\\\\globallong"],numArgs:0,allowedInText:!0,handler(e){var t=e.parser,r=e.funcName;t.consumeSpaces();var n=t.fetch();if(Ka[n.text])return"\\global"!==r&&"\\\\globallong"!==r||(n.text=Ka[n.text]),za(t.parseFunction(),"internal");throw new kt("Invalid token after macro prefix",n)}}),$n({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],numArgs:0,allowedInText:!0,primitive:!0,handler(e){var t=e.parser,r=e.funcName,n=t.gullet.popToken(),a=n.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(a))throw new kt("Expected a control sequence",n);for(var o,i=0,s=[[]];"{"!==t.gullet.future().text;)if("#"===(n=t.gullet.popToken()).text){if("{"===t.gullet.future().text){o=t.gullet.future(),s[i].push("{");break}if(n=t.gullet.popToken(),!/^[1-9]$/.test(n.text))throw new kt('Invalid argument number "'+n.text+'"');if(parseInt(n.text)!==i+1)throw new kt('Argument number "'+n.text+'" out of order');i++,s.push([])}else{if("EOF"===n.text)throw new kt("Expected a macro definition");s[i].push(n.text)}var l=t.gullet.consumeArg().tokens;return o&&l.unshift(o),"\\edef"!==r&&"\\xdef"!==r||(l=t.gullet.expandTokens(l)).reverse(),t.gullet.macros.set(a,{tokens:l,numArgs:i,delimiters:s},r===Ka[r]),{type:"internal",mode:t.mode}}}),$n({type:"internal",names:["\\let","\\\\globallet"],numArgs:0,allowedInText:!0,primitive:!0,handler(e){var t=e.parser,r=e.funcName,n=Ya(t.gullet.popToken());return t.gullet.consumeSpaces(),Xa(t,n,(e=>{var t=e.gullet.popToken();return"="===t.text&&" "===(t=e.gullet.popToken()).text&&(t=e.gullet.popToken()),t})(t),"\\\\globallet"===r),{type:"internal",mode:t.mode}}}),$n({type:"internal",names:["\\futurelet","\\\\globalfuture"],numArgs:0,allowedInText:!0,primitive:!0,handler(e){var t=e.parser,r=e.funcName,n=Ya(t.gullet.popToken()),a=t.gullet.popToken(),o=t.gullet.popToken();return Xa(t,n,o,"\\\\globalfuture"===r),t.gullet.pushToken(o),t.gullet.pushToken(a),{type:"internal",mode:t.mode}}});var Za=function(e,t,r){var n=br(Sr.math[e]&&Sr.math[e].replace||e,t,r);if(!n)throw new Error("Unsupported symbol "+e+" and font size "+t+".");return n},Ja=function(e,t,r,n){var a=r.havingBaseStyle(t),o=Cn(n.concat(a.sizingClasses(r)),[e],r),i=a.sizeMultiplier/r.sizeMultiplier;return o.height*=i,o.depth*=i,o.maxFontSize=a.sizeMultiplier,o},Qa=function(e,t,r){var n=t.havingBaseStyle(r),a=(1-t.sizeMultiplier/n.sizeMultiplier)*t.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=rr(a),e.height-=a,e.depth+=a},eo=function(e,t,r,n,a,o){var i=function(e,t,r,n){return vn(e,"Size"+t+"-Regular",r,n)}(e,t,a,n),s=Ja(Cn(["delimsizing","size"+t],[i],n),qt.TEXT,n,o);return r&&Qa(s,n,qt.TEXT),s},to=function(e,t,r){return{type:"elem",elem:Cn(["delimsizinginner","Size1-Regular"===t?"delim-size1":"delim-size4"],[Cn([],[vn(e,t,r)])])}},ro=function(e,t,r){var n=xr["Size4-Regular"][e.charCodeAt(0)]?xr["Size4-Regular"][e.charCodeAt(0)][4]:xr["Size1-Regular"][e.charCodeAt(0)][4],a=new fr("inner",function(e,t){switch(e){case"⎜":return Kt("M291 0 H417 V"+t+" H291z");case"∣":return Kt("M145 0 H188 V"+t+" H145z");case"∥":return Kt("M145 0 H188 V"+t+" H145z")+Kt("M367 0 H410 V"+t+" H367z");case"⎟":return Kt("M457 0 H583 V"+t+" H457z");case"⎢":return Kt("M319 0 H403 V"+t+" H319z");case"⎥":return Kt("M263 0 H347 V"+t+" H263z");case"⎪":return Kt("M384 0 H504 V"+t+" H384z");case"⏐":return Kt("M312 0 H355 V"+t+" H312z");case"‖":return Kt("M257 0 H300 V"+t+" H257z")+Kt("M478 0 H521 V"+t+" H478z");default:return""}}(e,Math.round(1e3*t))),o=jn([],[new mr([a],{width:rr(n),height:rr(t),style:"width:"+rr(n),viewBox:"0 0 "+1e3*n+" "+Math.round(1e3*t),preserveAspectRatio:"xMinYMin"})],r);return o.height=t,o.style.height=rr(t),o.style.width=rr(n),{type:"elem",elem:o}},no={type:"kern",size:-.008},ao=new Set(["|","\\lvert","\\rvert","\\vert"]),oo=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),io=function(e,t,r,n,a,o){var i,s,l,c,d="",u=0;i=l=c=e,s=null;var h="Size1-Regular";"\\uparrow"===e?l=c="⏐":"\\Uparrow"===e?l=c="‖":"\\downarrow"===e?i=l="⏐":"\\Downarrow"===e?i=l="‖":"\\updownarrow"===e?(i="\\uparrow",l="⏐",c="\\downarrow"):"\\Updownarrow"===e?(i="\\Uparrow",l="‖",c="\\Downarrow"):ao.has(e)?(l="∣",d="vert",u=333):oo.has(e)?(l="∥",d="doublevert",u=556):"["===e||"\\lbrack"===e?(i="⎡",l="⎢",c="⎣",h="Size4-Regular",d="lbrack",u=667):"]"===e||"\\rbrack"===e?(i="⎤",l="⎥",c="⎦",h="Size4-Regular",d="rbrack",u=667):"\\lfloor"===e||"⌊"===e?(l=i="⎢",c="⎣",h="Size4-Regular",d="lfloor",u=667):"\\lceil"===e||"⌈"===e?(i="⎡",l=c="⎢",h="Size4-Regular",d="lceil",u=667):"\\rfloor"===e||"⌋"===e?(l=i="⎥",c="⎦",h="Size4-Regular",d="rfloor",u=667):"\\rceil"===e||"⌉"===e?(i="⎤",l=c="⎥",h="Size4-Regular",d="rceil",u=667):"("===e||"\\lparen"===e?(i="⎛",l="⎜",c="⎝",h="Size4-Regular",d="lparen",u=875):")"===e||"\\rparen"===e?(i="⎞",l="⎟",c="⎠",h="Size4-Regular",d="rparen",u=875):"\\{"===e||"\\lbrace"===e?(i="⎧",s="⎨",c="⎩",l="⎪",h="Size4-Regular"):"\\}"===e||"\\rbrace"===e?(i="⎫",s="⎬",c="⎭",l="⎪",h="Size4-Regular"):"\\lgroup"===e||"⟮"===e?(i="⎧",c="⎩",l="⎪",h="Size4-Regular"):"\\rgroup"===e||"⟯"===e?(i="⎫",c="⎭",l="⎪",h="Size4-Regular"):"\\lmoustache"===e||"⎰"===e?(i="⎧",c="⎭",l="⎪",h="Size4-Regular"):"\\rmoustache"!==e&&"⎱"!==e||(i="⎫",c="⎩",l="⎪",h="Size4-Regular");var p=Za(i,h,a),m=p.height+p.depth,f=Za(l,h,a),g=f.height+f.depth,x=Za(c,h,a),v=x.height+x.depth,y=0,b=1;if(null!==s){var w=Za(s,h,a);y=w.height+w.depth,b=2}var S=m+v+y,k=S+Math.max(0,Math.ceil((t-S)/(b*g)))*b*g,C=n.fontMetrics().axisHeight;r&&(C*=n.sizeMultiplier);var j=k/2-C,T=[];if(d.length>0){var N=k-m-v,M=Math.round(1e3*k),E=function(e,t){switch(e){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+t+" v1759 v84 h347 v-84\nH403z M403 1759 V0 H319 V1759 v"+t+" v1759 v84 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+t+" v1759 H0 v84 H347z\nM347 1759 V0 H263 V1759 v"+t+" v1759 h84z";case"vert":return"M145 15 v585 v"+t+" v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v"+-t+" v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M188 15 H145 v585 v"+t+" v585 h43z";case"doublevert":return"M145 15 v585 v"+t+" v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v"+-t+" v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M188 15 H145 v585 v"+t+" v585 h43z\nM367 15 v585 v"+t+" v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v"+-t+" v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M410 15 H367 v585 v"+t+" v585 h43z";case"lfloor":return"M319 602 V0 H403 V602 v"+t+" v1715 h263 v84 H319z\nMM319 602 V0 H403 V602 v"+t+" v1715 H319z";case"rfloor":return"M319 602 V0 H403 V602 v"+t+" v1799 H0 v-84 H319z\nMM319 602 V0 H403 V602 v"+t+" v1715 H319z";case"lceil":return"M403 1759 V84 H666 V0 H319 V1759 v"+t+" v602 h84z\nM403 1759 V0 H319 V1759 v"+t+" v602 h84z";case"rceil":return"M347 1759 V0 H0 V84 H263 V1759 v"+t+" v602 h84z\nM347 1759 V0 h-84 V1759 v"+t+" v602 h84z";case"lparen":return"M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1\nc-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349,\n-36,557 l0,"+(t+84)+"c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210,\n949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9\nc0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5,\n-544.7,-112.5,-882c-2,-104,-3,-167,-3,-189\nl0,-"+(t+92)+"c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3,\n-210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z";case"rparen":return"M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3,\n63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5\nc11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,"+(t+9)+"\nc-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664\nc-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11\nc0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17\nc242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558\nl0,-"+(t+144)+"c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,\n-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z";default:throw new Error("Unknown stretchy delimiter.")}}(d,Math.round(1e3*N)),A=new fr(d,E),R=rr(u/1e3),D=rr(M/1e3),I=jn([],[new mr([A],{width:R,height:D,viewBox:"0 0 "+u+" "+M})],n);I.height=M/1e3,I.style.width=R,I.style.height=D,T.push({type:"elem",elem:I})}else{if(T.push(to(c,h,a)),T.push(no),null===s){var z=k-m-v+.016;T.push(ro(l,z,n))}else{var _=(k-m-v-y)/2+.016;T.push(ro(l,_,n)),T.push(no),T.push(to(s,h,a)),T.push(no),T.push(ro(l,_,n))}T.push(no),T.push(to(i,h,a))}var P=n.havingBaseStyle(qt.TEXT);return Ja(Cn(["delimsizing","mult"],[En({positionType:"bottom",positionData:j,children:T})],P),qt.TEXT,n,o)},so=.08,lo=function(e,t,r,n,a){var o=function(e,t,r){t*=1e3;var n="";switch(e){case"sqrtMain":n=function(e,t){return"M95,"+(622+e+t)+"\nc-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14\nc0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54\nc44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10\ns173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429\nc69,-144,104.5,-217.7,106.5,-221\nl"+e/2.075+" -"+e+"\nc5.3,-9.3,12,-14,20,-14\nH400000v"+(40+e)+"H845.2724\ns-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7\nc-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z\nM"+(834+e)+" "+t+"h400000v"+(40+e)+"h-400000z"}(t,Yt);break;case"sqrtSize1":n=function(e,t){return"M263,"+(601+e+t)+"c0.7,0,18,39.7,52,119\nc34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120\nc340,-704.7,510.7,-1060.3,512,-1067\nl"+e/2.084+" -"+e+"\nc4.7,-7.3,11,-11,19,-11\nH40000v"+(40+e)+"H1012.3\ns-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232\nc-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1\ns-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26\nc-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z\nM"+(1001+e)+" "+t+"h400000v"+(40+e)+"h-400000z"}(t,Yt);break;case"sqrtSize2":n=function(e,t){return"M983 "+(10+e+t)+"\nl"+e/3.13+" -"+e+"\nc4,-6.7,10,-10,18,-10 H400000v"+(40+e)+"\nH1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7\ns-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744\nc-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30\nc26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722\nc56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5\nc53.7,-170.3,84.5,-266.8,92.5,-289.5z\nM"+(1001+e)+" "+t+"h400000v"+(40+e)+"h-400000z"}(t,Yt);break;case"sqrtSize3":n=function(e,t){return"M424,"+(2398+e+t)+"\nc-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514\nc0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20\ns-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121\ns209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081\nl"+e/4.223+" -"+e+"c4,-6.7,10,-10,18,-10 H400000\nv"+(40+e)+"H1014.6\ns-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185\nc-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2z M"+(1001+e)+" "+t+"\nh400000v"+(40+e)+"h-400000z"}(t,Yt);break;case"sqrtSize4":n=function(e,t){return"M473,"+(2713+e+t)+"\nc339.3,-1799.3,509.3,-2700,510,-2702 l"+e/5.298+" -"+e+"\nc3.3,-7.3,9.3,-11,18,-11 H400000v"+(40+e)+"H1017.7\ns-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200\nc0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26\ns76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,\n606zM"+(1001+e)+" "+t+"h400000v"+(40+e)+"H1017.7z"}(t,Yt);break;case"sqrtTall":n=function(e,t,r){return"M702 "+(e+t)+"H400000"+(40+e)+"\nH742v"+(r-54-t-e)+"l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1\nh-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170\nc-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667\n219 661 l218 661zM702 "+t+"H400000v"+(40+e)+"H742z"}(t,Yt,r)}return n}(e,n,r),i=new fr(e,o);return jn(["hide-tail"],[new mr([i],{width:"400em",height:rr(t),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"})],a)},co=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),uo=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),ho=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),po=[0,1.2,1.8,2.4,3],mo=function(e,t,r,n,a){if("<"===e||"\\lt"===e||"⟨"===e?e="\\langle":">"!==e&&"\\gt"!==e&&"⟩"!==e||(e="\\rangle"),co.has(e)||ho.has(e))return eo(e,t,!1,r,n,a);if(uo.has(e))return io(e,po[t],!1,r,n,a);throw new kt("Illegal delimiter: '"+e+"'")},fo=[{type:"small",style:qt.SCRIPTSCRIPT},{type:"small",style:qt.SCRIPT},{type:"small",style:qt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],go=[{type:"small",style:qt.SCRIPTSCRIPT},{type:"small",style:qt.SCRIPT},{type:"small",style:qt.TEXT},{type:"stack"}],xo=[{type:"small",style:qt.SCRIPTSCRIPT},{type:"small",style:qt.SCRIPT},{type:"small",style:qt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],vo=function(e){if("small"===e.type)return"Main-Regular";if("large"===e.type)return"Size"+e.size+"-Regular";if("stack"===e.type)return"Size4-Regular";var t=e.type;throw new Error("Add support for delim type '"+t+"' here.")},yo=function(e,t,r,n){for(var a=Math.min(2,3-n.style.size);a<r.length;a++){var o=r[a];if("stack"===o.type)break;var i=Za(e,vo(o),"math"),s=i.height+i.depth;if("small"===o.type)s*=n.havingBaseStyle(o.style).sizeMultiplier;if(s>t)return o}return r[r.length-1]},bo=function(e,t,r,n,a,o){var i;"<"===e||"\\lt"===e||"⟨"===e?e="\\langle":">"!==e&&"\\gt"!==e&&"⟩"!==e||(e="\\rangle"),i=ho.has(e)?fo:co.has(e)?xo:go;var s=yo(e,t,i,n);return"small"===s.type?function(e,t,r,n,a,o){var i=Ja(vn(e,"Main-Regular",a,n),t,n,o);return r&&Qa(i,n,t),i}(e,s.style,r,n,a,o):"large"===s.type?eo(e,s.size,r,n,a,o):io(e,t,r,n,a,o)},wo=function(e,t,r,n,a,o){var i=n.fontMetrics().axisHeight*n.sizeMultiplier,s=5/n.fontMetrics().ptPerEm,l=Math.max(t-i,r+i);return bo(e,Math.max(l/500*901,2*l-s),!0,n,a,o)},So={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},ko=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."]);function Co(e){return"isMiddle"in e}function jo(e,t){var r=Pa(e);if(r&&ko.has(r.text))return r;throw new kt(r?"Invalid delimiter '"+r.text+"' after '"+t.funcName+"'":"Invalid delimiter type '"+e.type+"'",e)}function To(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}$n({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],numArgs:1,argTypes:["primitive"],handler:(e,t)=>{var r=jo(Un(t[0]),e);return{type:"delimsizing",mode:e.parser.mode,size:So[e.funcName].size,mclass:So[e.funcName].mclass,delim:r.text}},htmlBuilder:(e,t)=>"."===e.delim?Cn([e.mclass]):mo(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];"."!==e.delim&&t.push(ha(e.delim,e.mode));var r=new sa("mo",t);"mopen"===e.mclass||"mclose"===e.mclass?r.setAttribute("fence","true"):r.setAttribute("fence","false"),r.setAttribute("stretchy","true");var n=rr(po[e.size]);return r.setAttribute("minsize",n),r.setAttribute("maxsize",n),r}}),$n({type:"leftright-right",names:["\\right"],numArgs:1,primitive:!0,handler:(e,t)=>{var r=e.parser.gullet.macros.get("\\current@color");if(r&&"string"!=typeof r)throw new kt("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:jo(t[0],e).text,color:r}}}),$n({type:"leftright",names:["\\left"],numArgs:1,primitive:!0,handler:(e,t)=>{var r=jo(t[0],e),n=e.parser;++n.leftrightDepth;var a=n.parseExpression(!1);--n.leftrightDepth,n.expect("\\right",!1);var o=za(n.parseFunction(),"leftright-right");return{type:"leftright",mode:n.mode,body:a,left:r.text,right:o.delim,rightColor:o.color}},htmlBuilder:(e,t)=>{To(e);for(var r,n,a=Zn(e.body,t,!0,["mopen","mclose"]),o=0,i=0,s=!1,l=0;l<a.length;l++){Co(a[l])?s=!0:(o=Math.max(a[l].height,o),i=Math.max(a[l].depth,i))}if(o*=t.sizeMultiplier,i*=t.sizeMultiplier,r="."===e.left?ra(t,["mopen"]):wo(e.left,o,i,t,e.mode,["mopen"]),a.unshift(r),s)for(var c=1;c<a.length;c++){var d=a[c];if(Co(d)){var u=d.isMiddle;a[c]=wo(u.delim,o,i,u.options,e.mode,[])}}if("."===e.right)n=ra(t,["mclose"]);else{var h=e.rightColor?t.withColor(e.rightColor):t;n=wo(e.right,o,i,h,e.mode,["mclose"])}return a.push(n),Cn(["minner"],a,t)},mathmlBuilder:(e,t)=>{To(e);var r=xa(e.body,t);if("."!==e.left){var n=new sa("mo",[ha(e.left,e.mode)]);n.setAttribute("fence","true"),r.unshift(n)}if("."!==e.right){var a=new sa("mo",[ha(e.right,e.mode)]);a.setAttribute("fence","true"),e.rightColor&&a.setAttribute("mathcolor",e.rightColor),r.push(a)}return pa(r)}}),$n({type:"middle",names:["\\middle"],numArgs:1,primitive:!0,handler:(e,t)=>{var r=jo(t[0],e);if(!e.parser.leftrightDepth)throw new kt("\\middle without preceding \\left",r);return{type:"middle",mode:e.parser.mode,delim:r.text}},htmlBuilder:(e,t)=>{var r;return"."===e.delim?r=ra(t,[]):(r=mo(e.delim,1,t,e.mode,[])).isMiddle={delim:e.delim,options:t},r},mathmlBuilder:(e,t)=>{var r="\\vert"===e.delim||"|"===e.delim?ha("|","text"):ha(e.delim,e.mode),n=new sa("mo",[r]);return n.setAttribute("fence","true"),n.setAttribute("lspace","0.05em"),n.setAttribute("rspace","0.05em"),n}});$n({type:"enclose",names:["\\colorbox"],numArgs:2,allowedInText:!0,argTypes:["color","hbox"],handler(e,t,r){var n=e.parser,a=e.funcName,o=za(t[0],"color-token").color,i=t[1];return{type:"enclose",mode:n.mode,label:a,backgroundColor:o,body:i}},htmlBuilder:(e,t)=>{var r,n,a,o=Mn(na(e.body,t),t),i=e.label.slice(1),s=t.sizeMultiplier,l=Rt(e.body);if("sout"===i)(r=Cn(["katex-stretchy","katex-sout"])).height=t.fontMetrics().defaultRuleThickness/s,n=-.5*t.fontMetrics().xHeight;else if("phase"===i){var c=tr({number:.6,unit:"pt"},t),d=tr({number:.35,unit:"ex"},t);s/=t.havingBaseSizing().sizeMultiplier;var u=o.height+o.depth+c+d;o.style.paddingLeft=rr(u/2+c);var h=Math.floor(1e3*u*s),p=function(e){return"M400000 "+e+" H0 L"+e/2+" 0 l65 45 L145 "+(e-80)+" H400000z"}(h);(r=jn(["hide-tail"],[new mr([new fr("phase",p)],{width:"400em",height:rr(h/1e3),viewBox:"0 0 400000 "+h,preserveAspectRatio:"xMinYMin slice"})],t)).style.height=rr(u),n=o.depth+c+d}else{var m,f;/cancel/.test(i)?l||o.classes.push("cancel-pad"):"angl"===i?o.classes.push("anglpad"):o.classes.push("boxpad");var g=0;/box/.test(i)?(g=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),f=m=t.fontMetrics().fboxsep+("colorbox"===i?0:g)):"angl"===i?(m=4*(g=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness)),f=Math.max(0,.25-o.depth)):f=m=l?.2:0,r=function(e,t,r,n,a){var o,i=e.height+e.depth+r+n;if(/fbox|color|angl/.test(t)){if(o=Cn(["katex-stretchy",t],[],a),"fbox"===t){var s=a.color&&a.getColor();s&&(o.style.borderColor=s)}}else{var l=[];/^[bx]cancel$/.test(t)&&l.push(new gr({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(t)&&l.push(new gr({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"})),o=jn([],[new mr(l,{width:"100%",height:rr(i)})],a)}return o.height=i,o.style.height=rr(i),o}(o,i,m,f,t),/fbox|boxed|fcolorbox/.test(i)?(r.style.borderStyle="solid",r.style.borderWidth=rr(g)):"angl"===i&&.049!==g&&(r.style.borderTopWidth=rr(g),r.style.borderRightWidth=rr(g)),n=o.depth+f,e.backgroundColor&&(r.style.backgroundColor=e.backgroundColor,e.borderColor&&(r.style.borderColor=e.borderColor))}if(e.backgroundColor)a=En({positionType:"individualShift",children:[{type:"elem",elem:r,shift:n},{type:"elem",elem:o,shift:0}]});else{var x=/cancel|phase/.test(i)?["svg-align"]:[];a=En({positionType:"individualShift",children:[{type:"elem",elem:o,shift:0},{type:"elem",elem:r,shift:n,wrapperClasses:x}]})}return/cancel/.test(i)&&(a.height=o.height,a.depth=o.depth),/cancel/.test(i)&&!l?Cn(["mord","cancel-lap"],[a],t):Cn(["mord"],[a],t)},mathmlBuilder:(e,t)=>{var r,n=new sa(e.label.includes("colorbox")?"mpadded":"menclose",[ya(e.body,t)]);switch(e.label){case"\\cancel":n.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":n.setAttribute("notation","downdiagonalstrike");break;case"\\phase":n.setAttribute("notation","phasorangle");break;case"\\sout":n.setAttribute("notation","horizontalstrike");break;case"\\fbox":n.setAttribute("notation","box");break;case"\\angl":n.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(r=t.fontMetrics().fboxsep*t.fontMetrics().ptPerEm,n.setAttribute("width","+"+2*r+"pt"),n.setAttribute("height","+"+2*r+"pt"),n.setAttribute("lspace",r+"pt"),n.setAttribute("voffset",r+"pt"),"\\fcolorbox"===e.label){var a=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness);n.setAttribute("style","border: "+rr(a)+" solid "+e.borderColor)}break;case"\\xcancel":n.setAttribute("notation","updiagonalstrike downdiagonalstrike")}return e.backgroundColor&&n.setAttribute("mathbackground",e.backgroundColor),n}}),$n({type:"enclose",names:["\\fcolorbox"],numArgs:3,allowedInText:!0,argTypes:["color","color","hbox"],handler(e,t,r){var n=e.parser,a=e.funcName,o=za(t[0],"color-token").color,i=za(t[1],"color-token").color,s=t[2];return{type:"enclose",mode:n.mode,label:a,backgroundColor:i,borderColor:o,body:s}}}),$n({type:"enclose",names:["\\fbox"],numArgs:1,argTypes:["hbox"],allowedInText:!0,handler:(e,t)=>({type:"enclose",mode:e.parser.mode,label:"\\fbox",body:t[0]})}),$n({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\phase"],numArgs:1,handler(e,t){var r=e.parser,n=e.funcName,a=t[0];return{type:"enclose",mode:r.mode,label:n,body:a}}}),$n({type:"enclose",names:["\\sout"],numArgs:1,allowedInText:!0,handler(e,t){var r=e.parser,n=e.funcName;"math"===r.mode&&r.settings.reportNonstrict("mathVsSout","LaTeX's \\sout works only in text mode");var a=t[0];return{type:"enclose",mode:r.mode,label:n,body:a}}}),$n({type:"enclose",names:["\\angl"],numArgs:1,argTypes:["hbox"],allowedInText:!1,handler:(e,t)=>({type:"enclose",mode:e.parser.mode,label:"\\angl",body:t[0]})});var No={};function Mo(e){for(var t=e.type,r=e.names,n=e.props,a=e.handler,o=e.htmlBuilder,i=e.mathmlBuilder,s={type:t,numArgs:n.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:a},l=0;l<r.length;++l)No[r[l]]=s;o&&(Hn[t]=o),i&&(Vn[t]=i)}var Eo={};function Ao(e,t){Eo[e]=t}var Ro=class e{constructor(e,t,r){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=e,this.start=t,this.end=r}static range(t,r){return r?t&&t.loc&&r.loc&&t.loc.lexer===r.loc.lexer?new e(t.loc.lexer,t.loc.start,r.loc.end):null:t&&t.loc}},Do=class e{constructor(e,t){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=e,this.loc=t}range(t,r){return new e(r,Ro.range(this,t))}};function Io(e){var t=[];e.consumeSpaces();var r=e.fetch().text;for("\\relax"===r&&(e.consume(),e.consumeSpaces(),r=e.fetch().text);"\\hline"===r||"\\hdashline"===r;)e.consume(),t.push("\\hdashline"===r),e.consumeSpaces(),r=e.fetch().text;return t}var zo=e=>{if(!e.parser.settings.displayMode)throw new kt("{"+e.envName+"} can be used only in display mode.")},_o=new Set(["gather","gather*"]);function Po(e){if(!e.includes("ed"))return!e.includes("*")}function Oo(e,t,r){var n=t.hskipBeforeAndAfter,a=t.addJot,o=t.cols,i=t.arraystretch,s=t.colSeparationType,l=t.autoTag,c=t.singleRow,d=t.emptySingleRow,u=t.maxNumCols,h=t.leqno;if(e.gullet.beginGroup(),c||e.gullet.macros.set("\\cr","\\\\\\relax"),!i){var p=e.gullet.expandMacroAsText("\\arraystretch");if(null==p)i=1;else if(!(i=parseFloat(p))||i<0)throw new kt("Invalid \\arraystretch: "+p)}e.gullet.beginGroup();var m=[],f=[m],g=[],x=[],v=null!=l?[]:void 0;function y(){l&&e.gullet.macros.set("\\@eqnsw","1",!0)}function b(){v&&(e.gullet.macros.get("\\df@tag")?(v.push(e.subparse([new Do("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):v.push(Boolean(l)&&"1"===e.gullet.macros.get("\\@eqnsw")))}for(y(),x.push(Io(e));;){var w=e.parseExpression(!1,c?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup();var S={type:"ordgroup",mode:e.mode,body:w};r&&(S={type:"styling",mode:e.mode,style:r,resetFont:!0,body:[S]}),m.push(S);var k=e.fetch().text;if("&"===k){if(u&&m.length===u){if(c||s)throw new kt("Too many tab characters: &",e.nextToken);e.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}e.consume()}else{if("\\end"===k){b(),1!==m.length||"styling"!==S.type||1!==S.body.length||"ordgroup"!==S.body[0].type||0!==S.body[0].body.length||!(f.length>1)&&d||Array.isArray(null==v?void 0:v[v.length-1])||f.pop(),x.length<f.length+1&&x.push([]);break}if("\\\\"!==k)throw new kt("Expected & or \\\\ or \\cr or \\end",e.nextToken);e.consume();var C=void 0;" "!==e.gullet.future().text&&(C=e.parseSizeGroup(!0)),g.push(C?C.value:null),b(),x.push(Io(e)),m=[],f.push(m),y()}}return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:e.mode,addJot:a,arraystretch:i,body:f,cols:o,rowGaps:g,hskipBeforeAndAfter:n,hLinesBeforeRow:x,colSeparationType:s,tags:v,leqno:h}}function Lo(e){return"d"===e.slice(0,1)?"display":"text"}var Fo=function(e,t){var r,n,a=e.body.length,o=e.hLinesBeforeRow,i=0,s=new Array(a),l=[],c=Math.max(t.fontMetrics().arrayRuleWidth,t.minRuleThickness),d=1/t.fontMetrics().ptPerEm,u=5*d;e.colSeparationType&&"small"===e.colSeparationType&&(u=t.havingStyle(qt.SCRIPT).sizeMultiplier/t.sizeMultiplier*.2778);var h="CD"===e.colSeparationType?tr({number:3,unit:"ex"},t):12*d,p=3*d,m=e.arraystretch*h,f=.7*m,g=.3*m,x=0;function v(e){for(var t=0;t<e.length;++t)t>0&&(x+=.25),l.push({pos:x,isDashed:e[t]})}for(v(o[0]),r=0;r<e.body.length;++r){var y=e.body[r],b=f,w=g;i<y.length&&(i=y.length);var S={cells:new Array(y.length),height:0,depth:0,pos:0};for(n=0;n<y.length;++n){var k=na(y[n],t);w<k.depth&&(w=k.depth),b<k.height&&(b=k.height),S.cells[n]=k}var C=e.rowGaps[r],j=0;C&&(j=tr(C,t))>0&&(w<(j+=g)&&(w=j),j=0),e.addJot&&r<e.body.length-1&&(w+=p),S.height=b,S.depth=w,x+=b,S.pos=x,x+=w+j,s[r]=S,v(o[r+1])}var T,N,M=x/2+t.fontMetrics().axisHeight,E=e.cols||[],A=[],R=[];if(e.tags&&e.tags.some(e=>e))for(r=0;r<a;++r){var D=s[r],I=D.pos-M,z=e.tags[r],_=void 0;(_=!0===z?Cn(["eqn-num"],[],t):Cn([],!1===z?[]:Zn(z,t,!0),t)).depth=D.depth,_.height=D.height,R.push({type:"elem",elem:_,shift:I})}for(n=0,N=0;n<i||N<E.length;++n,++N){for(var P,O=E[N],L=!0;"separator"===(null==(F=O)?void 0:F.type);){var F;if(L||((T=Cn(["arraycolsep"],[])).style.width=rr(t.fontMetrics().doubleRuleSep),A.push(T)),"|"!==O.separator&&":"!==O.separator)throw new kt("Invalid separator type: "+O.separator);var B="|"===O.separator?"solid":"dashed",H=Cn(["vertical-separator"],[],t);H.style.height=rr(x),H.style.borderRightWidth=rr(c),H.style.borderRightStyle=B,H.style.margin="0 "+rr(-c/2);var V=x-M;V&&(H.style.verticalAlign=rr(-V)),A.push(H),O=E[++N],L=!1}if(!(n>=i)){var $,q,U=void 0;if(n>0||e.hskipBeforeAndAfter)0!==(U=null!=($=null==(q=O)?void 0:q.pregap)?$:u)&&((T=Cn(["arraycolsep"],[])).style.width=rr(U),A.push(T));var G=[];for(r=0;r<a;++r){var W=s[r],K=W.cells[n];if(K){var Y=W.pos-M;K.depth=W.depth,K.height=W.height,G.push({type:"elem",elem:K,shift:Y})}}var X,Z,J=En({positionType:"individualShift",children:G}),Q=Cn(["col-align-"+((null==(P=O)?void 0:P.align)||"c")],[J]);if(A.push(Q),n<i-1||e.hskipBeforeAndAfter)0!==(U=null!=(X=null==(Z=O)?void 0:Z.postgap)?X:u)&&((T=Cn(["arraycolsep"],[])).style.width=rr(U),A.push(T))}}var ee=Cn(["mtable"],A);if(l.length>0){for(var te=Tn("katex-hline",t,c),re=Tn("katex-hdashline",t,c),ne=[{type:"elem",elem:ee,shift:0}];l.length>0;){var ae=l.pop(),oe=ae.pos-M;ae.isDashed?ne.push({type:"elem",elem:re,shift:oe}):ne.push({type:"elem",elem:te,shift:oe})}ee=En({positionType:"individualShift",children:ne})}if(0===R.length)return Cn(["mord"],[ee],t);var ie=Cn(["katex-tag"],[En({positionType:"individualShift",children:R})],t);return Nn([ee,ie])},Bo={c:"center ",l:"left ",r:"right "},Ho=function(e,t){for(var r=[],n=new sa("mtd",[],["mtr-glue"]),a=new sa("mtd",[],["mml-eqn-num"]),o=0;o<e.body.length;o++){for(var i=e.body[o],s=[],l=0;l<i.length;l++)s.push(new sa("mtd",[ya(i[l],t)]));e.tags&&e.tags[o]&&(s.unshift(n),s.push(n),e.leqno?s.unshift(a):s.push(a)),r.push(new sa("mtr",s))}var c=new sa("mtable",r),d=.5===e.arraystretch?.1:.16+e.arraystretch-1+(e.addJot?.09:0);c.setAttribute("rowspacing",rr(d));var u="",h="";if(e.cols&&e.cols.length>0){var p=e.cols,m="",f=!1,g=0,x=p.length;"separator"===p[0].type&&(u+="top ",g=1),"separator"===p[p.length-1].type&&(u+="bottom ",x-=1);for(var v=g;v<x;v++){var y=p[v];"align"===y.type?(h+=Bo[y.align],f&&(m+="none "),f=!0):"separator"===y.type&&f&&(m+="|"===y.separator?"solid ":"dashed ",f=!1)}c.setAttribute("columnalign",h.trim()),/[sd]/.test(m)&&c.setAttribute("columnlines",m.trim())}if("align"===e.colSeparationType){for(var b=e.cols||[],w="",S=1;S<b.length;S++)w+=S%2?"0em ":"1em ";c.setAttribute("columnspacing",w.trim())}else"alignat"===e.colSeparationType||"gather"===e.colSeparationType?c.setAttribute("columnspacing","0em"):"small"===e.colSeparationType?c.setAttribute("columnspacing","0.2778em"):"CD"===e.colSeparationType?c.setAttribute("columnspacing","0.5em"):c.setAttribute("columnspacing","1em");var k="",C=e.hLinesBeforeRow;u+=C[0].length>0?"left ":"",u+=C[C.length-1].length>0?"right ":"";for(var j=1;j<C.length-1;j++)k+=0===C[j].length?"none ":C[j][0]?"dashed ":"solid ";return/[sd]/.test(k)&&c.setAttribute("rowlines",k.trim()),""!==u&&(c=new sa("menclose",[c])).setAttribute("notation",u.trim()),e.arraystretch&&e.arraystretch<1&&(c=new sa("mstyle",[c])).setAttribute("scriptlevel","1"),c},Vo=function(e,t){e.envName.includes("ed")||zo(e);var r=[],n="split"===e.envName,a=Oo(e.parser,{cols:r,addJot:!0,autoTag:n?void 0:Po(e.envName),emptySingleRow:!0,colSeparationType:e.envName.includes("at")?"alignat":"align",maxNumCols:n?2:void 0,leqno:e.parser.settings.leqno},"display"),o=0,i=0,s={type:"ordgroup",mode:e.mode,body:[]};if(t[0]&&"ordgroup"===t[0].type){var l="Number of columns should be a positive integer",c=Oa(t[0],l);if(!/^[0-9]+$/.test(c)||Number(c)<1)throw new kt(l,t[0]);o=Number(c),i=2*o}var d=!i;a.body.forEach(function(e){for(var t=1;t<e.length;t+=2)za(za(e[t],"styling").body[0],"ordgroup").body.unshift(s);if(d)i<e.length&&(i=e.length);else{var r=e.length/2;if(o<r)throw new kt("Too many math in a row: expected "+o+", but got "+r,e[0])}});for(var u=0;u<i;++u){var h="r",p=0;u%2==1?h="l":u>0&&d&&(p=1),r[u]={type:"align",align:h,pregap:p,postgap:0}}return a.colSeparationType=d?"align":"alignat",a};Mo({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var r=(Pa(t[0])?[t[0]]:za(t[0],"ordgroup").body).map(function(e){var t=_a(e).text;if("lcr".includes(t))return{type:"align",align:t};if("|"===t)return{type:"separator",separator:"|"};if(":"===t)return{type:"separator",separator:":"};throw new kt("Unknown column alignment: "+t,e)}),n={cols:r,hskipBeforeAndAfter:!0,maxNumCols:r.length};return Oo(e.parser,n,Lo(e.envName))},htmlBuilder:Fo,mathmlBuilder:Ho}),Mo({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(e){var t={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],r="c",n={hskipBeforeAndAfter:!1,cols:[{type:"align",align:r}]};if("*"===e.envName.charAt(e.envName.length-1)){var a=e.parser;if(a.consumeSpaces(),"["===a.fetch().text){if(a.consume(),a.consumeSpaces(),r=a.fetch().text,!"lcr".includes(r))throw new kt("Expected l or c or r",a.nextToken);a.consume(),a.consumeSpaces(),a.expect("]"),a.consume(),n.cols=[{type:"align",align:r}]}}var o=Oo(e.parser,n,Lo(e.envName)),i=Math.max(0,...o.body.map(e=>e.length));return o.cols=new Array(i).fill({type:"align",align:r}),t?{type:"leftright",mode:e.mode,body:[o],left:t[0],right:t[1],rightColor:void 0}:o},htmlBuilder:Fo,mathmlBuilder:Ho}),Mo({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t=Oo(e.parser,{arraystretch:.5},"script");return t.colSeparationType="small",t},htmlBuilder:Fo,mathmlBuilder:Ho}),Mo({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var r=(Pa(t[0])?[t[0]]:za(t[0],"ordgroup").body).map(function(e){var t=_a(e).text;if("lc".includes(t))return{type:"align",align:t};throw new kt("Unknown column alignment: "+t,e)});if(r.length>1)throw new kt("{subarray} can contain only one column");var n={cols:r,hskipBeforeAndAfter:!1,arraystretch:.5},a=Oo(e.parser,n,"script");if(a.body.length>0&&a.body[0].length>1)throw new kt("{subarray} can contain only one column");return a},htmlBuilder:Fo,mathmlBuilder:Ho}),Mo({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){var t=Oo(e.parser,{arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},Lo(e.envName));return{type:"leftright",mode:e.mode,body:[t],left:e.envName.includes("r")?".":"\\{",right:e.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:Fo,mathmlBuilder:Ho}),Mo({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:Vo,htmlBuilder:Fo,mathmlBuilder:Ho}),Mo({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){_o.has(e.envName)&&zo(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:Po(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return Oo(e.parser,t,"display")},htmlBuilder:Fo,mathmlBuilder:Ho}),Mo({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:Vo,htmlBuilder:Fo,mathmlBuilder:Ho}),Mo({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){zo(e);var t={autoTag:Po(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return Oo(e.parser,t,"display")},htmlBuilder:Fo,mathmlBuilder:Ho}),Mo({type:"array",names:["CD"],props:{numArgs:0},handler:e=>(zo(e),function(e){var t=[];for(e.gullet.beginGroup(),e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();;){t.push(e.parseExpression(!1,"\\\\")),e.gullet.endGroup(),e.gullet.beginGroup();var r=e.fetch().text;if("&"!==r&&"\\\\"!==r){if("\\end"===r){0===t[t.length-1].length&&t.pop();break}throw new kt("Expected \\\\ or \\cr or \\end",e.nextToken)}e.consume()}for(var n=[],a=[n],o=0;o<t.length;o++){for(var i=t[o],s=qa(),l=0;l<i.length;l++)if(Ua(i[l])){n.push(s);var c=_a(i[l+=1]).text,d=new Array(2);if(d[0]={type:"ordgroup",mode:"math",body:[]},d[1]={type:"ordgroup",mode:"math",body:[]},"=|.".includes(c));else{if(!"<>AV".includes(c))throw new kt('Expected one of "<>AV=|." after @',i[l]);for(var u=0;u<2;u++){for(var h=!0,p=l+1;p<i.length;p++){if(Ga(i[p],c)){h=!1,l=p;break}if(Ua(i[p]))throw new kt("Missing a "+c+" character to complete a CD arrow.",i[p]);d[u].body.push(i[p])}if(h)throw new kt("Missing a "+c+" character to complete a CD arrow.",i[l])}}var m={type:"styling",body:[Wa(c,d,e)],mode:"math",style:"display",resetFont:!0};n.push(m),s=qa()}else s.body.push(i[l]);o%2==0?n.push(s):n.shift(),n=[],a.push(n)}return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:"math",body:a,arraystretch:1,addJot:!0,rowGaps:[null],cols:new Array(a[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25}),colSeparationType:"CD",hLinesBeforeRow:new Array(a.length+1).fill([])}}(e.parser)),htmlBuilder:Fo,mathmlBuilder:Ho}),Ao("\\nonumber","\\gdef\\@eqnsw{0}"),Ao("\\notag","\\nonumber"),$n({type:"text",names:["\\hline","\\hdashline"],numArgs:0,allowedInText:!0,allowedInMath:!0,handler(e,t){throw new kt(e.funcName+" valid only within array environment")}});var $o=No;$n({type:"environment",names:["\\begin","\\end"],numArgs:1,argTypes:["text"],handler(e,t){var r=e.parser,n=e.funcName,a=t[0];if("ordgroup"!==a.type)throw new kt("Invalid environment name",a);var o=Oa(a,"Environment name should contain only text characters and spaces",!0);if("\\begin"===n){if(!Object.prototype.hasOwnProperty.call($o,o))throw new kt("No such environment: "+o,a);var i=$o[o],s=r.parseArguments("\\begin{"+o+"}",i),l=s.args,c=s.optArgs,d={mode:r.mode,envName:o,parser:r},u=i.handler(d,l,c);r.expect("\\end",!1);var h=r.nextToken,p=za(r.parseFunction(),"environment");if(p.name!==o)throw new kt("Mismatch: \\begin{"+o+"} matched by \\end{"+p.name+"}",h);return u}return{type:"environment",mode:r.mode,name:o,nameGroup:a}}});var qo={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};$n({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],numArgs:1,allowedInArgument:!0,handler:(e,t)=>{var r=e.parser,n=e.funcName,a=Un(t[0]),o=n in qo?qo[n]:n;return{type:"font",mode:r.mode,font:o.slice(1),body:a}},htmlBuilder:(e,t)=>{var r=e.font,n=t.withFont(r);return na(e.body,n)},mathmlBuilder:(e,t)=>{var r=e.font,n=t.withFont(r);return ya(e.body,n)}}),$n({type:"mclass",names:["\\boldsymbol","\\bm"],numArgs:1,handler:(e,t)=>{var r=e.parser,n=t[0];return{type:"mclass",mode:r.mode,mclass:Va(n),body:[{type:"font",mode:r.mode,font:"boldsymbol",body:n}],isCharacterBox:Rt(n)}}}),$n({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],numArgs:0,allowedInText:!0,handler:(e,t)=>{var r=e.parser,n=e.funcName,a=e.breakOnTokenText,o=r.mode,i=r.parseExpression(!0,a);return{type:"font",mode:o,font:"math"+n.slice(1),body:{type:"ordgroup",mode:r.mode,body:i}}}});var Uo=(e,t)=>t?{type:"styling",mode:e.mode,style:t,body:[e]}:e;$n({type:"genfrac",names:["\\cfrac","\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],numArgs:2,allowedInArgument:!0,handler:(e,t)=>{var r,n=e.parser,a=e.funcName,o=t[0],i=t[1],s=null,l=null;switch(a){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":r=!0;break;case"\\\\atopfrac":r=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":r=!1,s="(",l=")";break;case"\\\\bracefrac":r=!1,s="\\{",l="\\}";break;case"\\\\brackfrac":r=!1,s="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}var c="\\cfrac"===a,d=null;return c||a.startsWith("\\d")?d="display":a.startsWith("\\t")&&(d="text"),Uo({type:"genfrac",mode:n.mode,numer:o,denom:i,continued:c,hasBarLine:r,leftDelim:s,rightDelim:l,barSize:null},d)},htmlBuilder:(e,t)=>{var r=t.style,n=r.fracNum(),a=r.fracDen(),o=t.havingStyle(n),i=na(e.numer,o,t);if(e.continued){var s=8.5/t.fontMetrics().ptPerEm,l=3.5/t.fontMetrics().ptPerEm;i.height=i.height<s?s:i.height,i.depth=i.depth<l?l:i.depth}o=t.havingStyle(a);var c,d,u,h,p,m,f,g,x,v,y=na(e.denom,o,t);if(e.hasBarLine?(e.barSize?(d=tr(e.barSize,t),c=Tn("frac-line",t,d)):c=Tn("frac-line",t),d=c.height,u=c.height):(c=null,d=0,u=t.fontMetrics().defaultRuleThickness),r.size===qt.DISPLAY.size?(h=t.fontMetrics().num1,p=d>0?3*u:7*u,m=t.fontMetrics().denom1):(d>0?(h=t.fontMetrics().num2,p=u):(h=t.fontMetrics().num3,p=3*u),m=t.fontMetrics().denom2),c){var b=t.fontMetrics().axisHeight;h-i.depth-(b+.5*d)<p&&(h+=p-(h-i.depth-(b+.5*d))),b-.5*d-(y.height-m)<p&&(m+=p-(b-.5*d-(y.height-m))),f=En({positionType:"individualShift",children:[{type:"elem",elem:y,shift:m},{type:"elem",elem:c,shift:-(b-.5*d)},{type:"elem",elem:i,shift:-h}]})}else{var w=h-i.depth-(y.height-m);w<p&&(h+=.5*(p-w),m+=.5*(p-w)),f=En({positionType:"individualShift",children:[{type:"elem",elem:y,shift:m},{type:"elem",elem:i,shift:-h}]})}return o=t.havingStyle(r),f.height*=o.sizeMultiplier/t.sizeMultiplier,f.depth*=o.sizeMultiplier/t.sizeMultiplier,g=r.size===qt.DISPLAY.size?t.fontMetrics().delim1:r.size===qt.SCRIPTSCRIPT.size?t.havingStyle(qt.SCRIPT).fontMetrics().delim2:t.fontMetrics().delim2,x=null==e.leftDelim?ra(t,["mopen"]):bo(e.leftDelim,g,!0,t.havingStyle(r),e.mode,["mopen"]),v=e.continued?Cn([]):null==e.rightDelim?ra(t,["mclose"]):bo(e.rightDelim,g,!0,t.havingStyle(r),e.mode,["mclose"]),Cn(["mord"].concat(o.sizingClasses(t)),[x,Cn(["mfrac"],[f]),v],t)},mathmlBuilder:(e,t)=>{var r=new sa("mfrac",[ya(e.numer,t),ya(e.denom,t)]);if(e.hasBarLine){if(e.barSize){var n=tr(e.barSize,t);r.setAttribute("linethickness",rr(n))}}else r.setAttribute("linethickness","0px");if(null!=e.leftDelim||null!=e.rightDelim){var a=[];if(null!=e.leftDelim){var o=new sa("mo",[new la(e.leftDelim.replace("\\",""))]);o.setAttribute("fence","true"),a.push(o)}if(a.push(r),null!=e.rightDelim){var i=new sa("mo",[new la(e.rightDelim.replace("\\",""))]);i.setAttribute("fence","true"),a.push(i)}return pa(a)}return r}}),$n({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],numArgs:0,infix:!0,handler(e){var t,r=e.parser,n=e.funcName,a=e.token;switch(n){case"\\over":t="\\frac";break;case"\\choose":t="\\binom";break;case"\\atop":t="\\\\atopfrac";break;case"\\brace":t="\\\\bracefrac";break;case"\\brack":t="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:r.mode,replaceWith:t,token:a}}});var Go=["display","text","script","scriptscript"],Wo=function(e){var t=null;return e.length>0&&(t="."===(t=e)?null:t),t};$n({type:"genfrac",names:["\\genfrac"],numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"],handler(e,t){var r,n=e.parser,a=t[4],o=t[5],i=Un(t[0]),s="atom"===i.type&&"open"===i.family?Wo(i.text):null,l=Un(t[1]),c="atom"===l.type&&"close"===l.family?Wo(l.text):null,d=za(t[2],"size"),u=null;r=!!d.isBlank||(u=d.value).number>0;var h=null,p=t[3];if("ordgroup"===p.type){if(p.body.length>0){var m=za(p.body[0],"textord");h=Go[Number(m.text)]}}else p=za(p,"textord"),h=Go[Number(p.text)];return Uo({type:"genfrac",mode:n.mode,numer:a,denom:o,continued:!1,hasBarLine:r,barSize:u,leftDelim:s,rightDelim:c},h)}}),$n({type:"infix",names:["\\above"],numArgs:1,argTypes:["size"],infix:!0,handler(e,t){var r=e.parser;e.funcName;var n=e.token;return{type:"infix",mode:r.mode,replaceWith:"\\\\abovefrac",size:za(t[0],"size").value,token:n}}}),$n({type:"genfrac",names:["\\\\abovefrac"],numArgs:3,argTypes:["math","size","math"],handler:(e,t)=>{var r=e.parser;e.funcName;var n=t[0],a=za(t[1],"infix").size;if(!a)throw new Error("\\\\abovefrac expected size, but got "+String(a));var o=t[2],i=a.number>0;return{type:"genfrac",mode:r.mode,numer:n,denom:o,continued:!1,hasBarLine:i,barSize:a,leftDelim:null,rightDelim:null}}});var Ko=(e,t)=>{var r,n,a=t.style;"supsub"===e.type?(r=e.sup?na(e.sup,t.havingStyle(a.sup()),t):na(e.sub,t.havingStyle(a.sub()),t),n=za(e.base,"horizBrace")):n=za(e,"horizBrace");var o,i=na(n.base,t.havingBaseStyle(qt.DISPLAY)),s=Ra(n,t);if(o=n.isOver?En({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:s,wrapperClasses:["svg-align"]}]}):En({positionType:"bottom",positionData:i.depth+.1+s.height,children:[{type:"elem",elem:s,wrapperClasses:["svg-align"]},{type:"kern",size:.1},{type:"elem",elem:i}]}),r){var l=Cn(["minner",n.isOver?"mover":"munder"],[o],t);o=n.isOver?En({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:r}]}):En({positionType:"bottom",positionData:l.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:l}]})}return Cn(["minner",n.isOver?"mover":"munder"],[o],t)};$n({type:"horizBrace",names:["\\overbrace","\\underbrace","\\overbracket","\\underbracket"],numArgs:1,handler(e,t){var r=e.parser,n=e.funcName;return{type:"horizBrace",mode:r.mode,label:n,isOver:n.includes("\\over"),base:t[0]}},htmlBuilder:Ko,mathmlBuilder:(e,t)=>{var r=Ma(e.label);return new sa(e.isOver?"mover":"munder",[ya(e.base,t),r])}}),$n({type:"href",names:["\\href"],numArgs:2,argTypes:["url","original"],allowedInText:!0,handler:(e,t)=>{var r=e.parser,n=t[1],a=za(t[0],"url").url;return r.settings.isTrusted({command:"\\href",url:a})?{type:"href",mode:r.mode,href:a,body:Gn(n)}:r.formatUnsupportedCmd("\\href")},htmlBuilder:(e,t)=>{var r=Zn(e.body,t,!1);return function(e,t,r,n){var a=new dr(e,t,r,n);return kn(a),a}(e.href,[],r,t)},mathmlBuilder:(e,t)=>{var r=va(e.body,t);return r instanceof sa||(r=new sa("mrow",[r])),r.setAttribute("href",e.href),r}}),$n({type:"href",names:["\\url"],numArgs:1,argTypes:["url"],allowedInText:!0,handler:(e,t)=>{var r=e.parser,n=za(t[0],"url").url;if(!r.settings.isTrusted({command:"\\url",url:n}))return r.formatUnsupportedCmd("\\url");for(var a=[],o=0;o<n.length;o++){var i=n[o];"~"===i&&(i="\\textasciitilde"),a.push({type:"textord",mode:"text",text:i})}var s={type:"text",mode:r.mode,font:"\\texttt",body:a};return{type:"href",mode:r.mode,href:n,body:Gn(s)}}}),$n({type:"hbox",names:["\\hbox"],numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0,handler:(e,t)=>({type:"hbox",mode:e.parser.mode,body:Gn(t[0])}),htmlBuilder:(e,t)=>Nn(Zn(e.body,t.withFont(""),!1)),mathmlBuilder:(e,t)=>new sa("mrow",xa(e.body,t.withFont("")))}),$n({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],numArgs:2,argTypes:["raw","original"],allowedInText:!0,handler:(e,t)=>{var r=e.parser,n=e.funcName;e.token;var a,o=za(t[0],"raw").string,i=t[1];r.settings.strict&&r.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var s={};switch(n){case"\\htmlClass":s.class=o,a={command:"\\htmlClass",class:o};break;case"\\htmlId":s.id=o,a={command:"\\htmlId",id:o};break;case"\\htmlStyle":s.style=o,a={command:"\\htmlStyle",style:o};break;case"\\htmlData":for(var l=[],c="",d=0;d<o.length;d++)o.startsWith("{,}",d)?(c+=",",d+=2):","===o[d]?(l.push(c),c=""):c+=o[d];l.push(c);for(var u=0;u<l.length;u++){var h=l[u],p=h.indexOf("=");if(p<0)throw new kt("\\htmlData key/value '"+h+"' missing equals sign");var m=h.slice(0,p),f=h.slice(p+1);s["data-"+m.trim()]=f}a={command:"\\htmlData",attributes:s};break;default:throw new Error("Unrecognized html command")}return r.settings.isTrusted(a)?{type:"html",mode:r.mode,attributes:s,body:Gn(i)}:r.formatUnsupportedCmd(n)},htmlBuilder:(e,t)=>{var r=Zn(e.body,t,!1),n=["enclosing"];e.attributes.class&&n.push(...e.attributes.class.trim().split(/\s+/));var a=Cn(n,r,t);for(var o of Object.entries(e.attributes)){var i=o[0],s=o[1];"class"!==i&&a.setAttribute(i,s)}return a},mathmlBuilder:(e,t)=>va(e.body,t)}),$n({type:"htmlmathml",names:["\\html@mathml"],numArgs:2,allowedInArgument:!0,allowedInText:!0,handler:(e,t)=>({type:"htmlmathml",mode:e.parser.mode,html:Gn(t[0]),mathml:Gn(t[1])}),htmlBuilder:(e,t)=>Nn(Zn(e.html,t,!1)),mathmlBuilder:(e,t)=>va(e.mathml,t)});var Yo=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var t=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!t)throw new kt("Invalid size: '"+e+"' in \\includegraphics");var r={number:+(t[1]+t[2]),unit:t[3]};if(!er(r))throw new kt("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};$n({type:"includegraphics",names:["\\includegraphics"],numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1,handler:(e,t,r)=>{var n=e.parser,a={number:0,unit:"em"},o={number:.9,unit:"em"},i={number:0,unit:"em"},s="";if(r[0])for(var l=za(r[0],"raw").string.split(","),c=0;c<l.length;c++){var d=l[c].split("=");if(2===d.length){var u=d[1].trim();switch(d[0].trim()){case"alt":s=u;break;case"width":a=Yo(u);break;case"height":o=Yo(u);break;case"totalheight":i=Yo(u);break;default:throw new kt("Invalid key: '"+d[0]+"' in \\includegraphics.")}}}var h=za(t[0],"url").url;return""===s&&(s=(s=(s=h).replace(/^.*[\\/]/,"")).substring(0,s.lastIndexOf("."))),n.settings.isTrusted({command:"\\includegraphics",url:h})?{type:"includegraphics",mode:n.mode,alt:s,width:a,height:o,totalheight:i,src:h}:n.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(e,t)=>{var r=tr(e.height,t),n=0;e.totalheight.number>0&&(n=tr(e.totalheight,t)-r);var a=0;e.width.number>0&&(a=tr(e.width,t));var o={height:rr(r+n)};a>0&&(o.width=rr(a)),n>0&&(o.verticalAlign=rr(-n));var i=new ur(e.src,e.alt,o);return i.height=r,i.depth=n,i},mathmlBuilder:(e,t)=>{var r=new sa("mglyph",[]);r.setAttribute("alt",e.alt);var n=tr(e.height,t),a=0;if(e.totalheight.number>0&&(a=tr(e.totalheight,t)-n,r.setAttribute("valign",rr(-a))),r.setAttribute("height",rr(n+a)),e.width.number>0){var o=tr(e.width,t);r.setAttribute("width",rr(o))}return r.setAttribute("src",e.src),r}}),$n({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0,handler(e,t){var r=e.parser,n=e.funcName,a=za(t[0],"size");if(r.settings.strict){var o="m"===n[1],i="mu"===a.value.unit;o?(i||r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" supports only mu units, not "+a.value.unit+" units"),"math"!==r.mode&&r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" works only in math mode")):i&&r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" doesn't support mu units")}return{type:"kern",mode:r.mode,dimension:a.value}},htmlBuilder:(e,t)=>An(e.dimension,t),mathmlBuilder(e,t){var r=tr(e.dimension,t);return new ca(r)}}),$n({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],numArgs:1,allowedInText:!0,handler:(e,t)=>{var r=e.parser,n=e.funcName,a=t[0];return{type:"lap",mode:r.mode,alignment:n.slice(5),body:a}},htmlBuilder:(e,t)=>{var r;"clap"===e.alignment?(r=Cn([],[na(e.body,t)]),r=Cn(["katex-inner"],[r],t)):r=Cn(["katex-inner"],[na(e.body,t)]);var n=Cn(["katex-fix"],[]),a=Cn([e.alignment],[r,n],t),o=Cn(["katex-strut"]);return o.style.height=rr(a.height+a.depth),a.depth&&(o.style.verticalAlign=rr(-a.depth)),a.children.unshift(o),a=Cn(["katex-thinbox"],[a],t),Cn(["mord","katex-vbox"],[a],t)},mathmlBuilder:(e,t)=>{var r=new sa("mpadded",[ya(e.body,t)]);if("rlap"!==e.alignment){var n="llap"===e.alignment?"-1":"-0.5";r.setAttribute("lspace",n+"width")}return r.setAttribute("width","0px"),r}}),$n({type:"styling",names:["\\(","$"],numArgs:0,allowedInText:!0,allowedInMath:!1,handler(e,t){var r=e.funcName,n=e.parser,a=n.mode;n.switchMode("math");var o="\\("===r?"\\)":"$",i=n.parseExpression(!1,o);return n.expect(o),n.switchMode(a),{type:"styling",mode:n.mode,style:"text",resetFont:!0,body:i}}}),$n({type:"text",names:["\\)","\\]"],numArgs:0,allowedInText:!0,allowedInMath:!1,handler(e,t){throw new kt("Mismatched "+e.funcName)}});var Xo=(e,t)=>{switch(t.style.size){case qt.DISPLAY.size:return e.display;case qt.TEXT.size:return e.text;case qt.SCRIPT.size:return e.script;case qt.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};$n({type:"mathchoice",names:["\\mathchoice"],numArgs:4,primitive:!0,handler:(e,t)=>({type:"mathchoice",mode:e.parser.mode,display:Gn(t[0]),text:Gn(t[1]),script:Gn(t[2]),scriptscript:Gn(t[3])}),htmlBuilder:(e,t)=>Nn(Zn(Xo(e,t),t,!1)),mathmlBuilder:(e,t)=>va(Xo(e,t),t)});var Zo=(e,t,r,n,a,o,i)=>{e=Cn([],[e]);var s,l,c,d=r&&Rt(r);if(t){var u=na(t,n.havingStyle(a.sup()),n);l={elem:u,kern:Math.max(n.fontMetrics().bigOpSpacing1,n.fontMetrics().bigOpSpacing3-u.depth)}}if(r){var h=na(r,n.havingStyle(a.sub()),n);s={elem:h,kern:Math.max(n.fontMetrics().bigOpSpacing2,n.fontMetrics().bigOpSpacing4-h.height)}}if(l&&s)c=En({positionType:"bottom",positionData:n.fontMetrics().bigOpSpacing5+s.elem.height+s.elem.depth+s.kern+e.depth+i,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:s.elem,marginLeft:rr(-o)},{type:"kern",size:s.kern},{type:"elem",elem:e},{type:"kern",size:l.kern},{type:"elem",elem:l.elem,marginLeft:rr(o)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]});else if(s)c=En({positionType:"top",positionData:e.height-i,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:s.elem,marginLeft:rr(-o)},{type:"kern",size:s.kern},{type:"elem",elem:e}]});else{if(!l)return e;c=En({positionType:"bottom",positionData:e.depth+i,children:[{type:"elem",elem:e},{type:"kern",size:l.kern},{type:"elem",elem:l.elem,marginLeft:rr(o)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]})}var p=[c];if(s&&0!==o&&!d){var m=Cn(["mspace"],[],n);m.style.marginRight=rr(o),p.unshift(m)}return Cn(["mop","op-limits"],p,n)},Jo=new Set(["\\smallint"]),Qo=(e,t)=>{var r,n,a,o=!1;"supsub"===e.type?(r=e.sup,n=e.sub,a=za(e.base,"op"),o=!0):a=za(e,"op");var i,s,l=t.style,c=!1;if(l.size===qt.DISPLAY.size&&a.symbol&&!Jo.has(a.name)&&(c=!0),a.symbol){var d=c?"Size2-Regular":"Size1-Regular",u="";if("\\oiint"!==a.name&&"\\oiiint"!==a.name||(u=a.name.slice(1),a.name="oiint"===u?"\\iint":"\\iiint"),s=(i=vn(a.name,d,"math",t,["mop","op-symbol",c?"large-op":"small-op"])).italic,u.length>0){var h=zn(u+"Size"+(c?"2":"1"),t);i=En({positionType:"individualShift",children:[{type:"elem",elem:i,shift:0},{type:"elem",elem:h,shift:c?.08:0}]}),a.name="\\"+u,i.classes.unshift("mop"),i.italic=s}}else if(a.body){var p=Zn(a.body,t,!0);1===p.length&&p[0]instanceof pr?(i=p[0]).classes[0]="mop":i=Cn(["mop"],p,t)}else{for(var m=[],f=1;f<a.name.length;f++)m.push(yn(a.name[f],a.mode,t));i=Cn(["mop"],m,t)}var g,x=0,v=0;(i instanceof pr||"\\oiint"===a.name||"\\oiiint"===a.name)&&!a.suppressBaseShift&&(x=(i.height-i.depth)/2-t.fontMetrics().axisHeight,v=null!=(g=i.italic)?g:0);return o?Zo(i,r,n,t,l,v,x):(x&&(i.style.position="relative",i.style.top=rr(x)),i)},ei={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};$n({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],numArgs:0,handler:(e,t)=>{var r=e.parser,n=e.funcName;return 1===n.length&&(n=ei[n]),{type:"op",mode:r.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:n}},htmlBuilder:Qo,mathmlBuilder:(e,t)=>{var r;if(e.symbol)r=new sa("mo",[ha(e.name,e.mode)]),Jo.has(e.name)&&r.setAttribute("largeop","false");else if(e.body)r=new sa("mo",xa(e.body,t));else{r=new sa("mi",[new la(e.name.slice(1))]);var n=new sa("mo",[ha("⁡","text")]);r=e.parentIsSupSub?new sa("mrow",[r,n]):ia([r,n])}return r}}),$n({type:"op",names:["\\mathop"],numArgs:1,primitive:!0,handler:(e,t)=>{var r=e.parser,n=t[0];return{type:"op",mode:r.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:Gn(n)}}});var ti={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};$n({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],numArgs:0,handler(e){var t=e.parser,r=e.funcName;return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:r}}}),$n({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],numArgs:0,handler(e){var t=e.parser,r=e.funcName;return{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:r}}}),$n({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],numArgs:0,allowedInArgument:!0,handler(e){var t=e.parser,r=e.funcName;return 1===r.length&&(r=ti[r]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}}});var ri=(e,t)=>{var r,n,a,o,i=!1;if("supsub"===e.type?(r=e.sup,n=e.sub,a=za(e.base,"operatorname"),i=!0):a=za(e,"operatorname"),a.body.length>0){for(var s=(Zn(a.body.map(e=>{var t="text"in e?e.text:void 0;return"string"==typeof t?{type:"textord",mode:e.mode,text:t}:e}),t.withFont("mathrm"),!0)),l=0;l<s.length;l++){var c=s[l];c instanceof pr&&(c.text=c.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}o=Cn(["mop"],s,t)}else o=Cn(["mop"],[],t);return i?Zo(o,r,n,t,t.style,0,0):o};$n({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],numArgs:1,handler:(e,t)=>{var r=e.parser,n=e.funcName,a=t[0];return{type:"operatorname",mode:r.mode,body:Gn(a),alwaysHandleSupSub:"\\operatornamewithlimits"===n,limits:!1,parentIsSupSub:!1}},htmlBuilder:ri,mathmlBuilder:(e,t)=>{for(var r=xa(e.body,t.withFont("mathrm")),n=!0,a=0;a<r.length;a++){var o=r[a];if(o instanceof ca);else if(o instanceof sa)switch(o.type){case"mi":case"mn":case"mspace":case"mtext":break;case"mo":var i=o.children[0];1===o.children.length&&i instanceof la?i.text=i.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):n=!1;break;default:n=!1}else n=!1}if(n){var s=r.map(e=>e.toText()).join("");r=[new la(s)]}var l=new sa("mi",r);l.setAttribute("mathvariant","normal");var c=new sa("mo",[ha("⁡","text")]);return e.parentIsSupSub?new sa("mrow",[l,c]):ia([l,c])}}),Ao("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@"),qn({type:"ordgroup",htmlBuilder:(e,t)=>e.semisimple?Nn(Zn(e.body,t,!1)):Cn(["mord"],Zn(e.body,t,!0),t),mathmlBuilder:(e,t)=>va(e.body,t,!0)}),$n({type:"overline",names:["\\overline"],numArgs:1,handler(e,t){var r=e.parser,n=t[0];return{type:"overline",mode:r.mode,body:n}},htmlBuilder(e,t){var r=na(e.body,t.havingCrampedStyle()),n=Tn("overline-line",t),a=t.fontMetrics().defaultRuleThickness;return Cn(["mord","katex-overline"],[En({positionType:"firstBaseline",children:[{type:"elem",elem:r},{type:"kern",size:3*a},{type:"elem",elem:n},{type:"kern",size:a}]})],t)},mathmlBuilder(e,t){var r=new sa("mo",[new la("‾")]);r.setAttribute("stretchy","true");var n=new sa("mover",[ya(e.body,t),r]);return n.setAttribute("accent","true"),n}}),$n({type:"phantom",names:["\\phantom"],numArgs:1,allowedInText:!0,handler:(e,t)=>{var r=e.parser,n=t[0];return{type:"phantom",mode:r.mode,body:Gn(n)}},htmlBuilder:(e,t)=>Nn(Zn(e.body,t.withPhantom(),!1)),mathmlBuilder:(e,t)=>{var r=xa(e.body,t);return new sa("mphantom",r)}}),Ao("\\hphantom","\\smash{\\phantom{#1}}"),$n({type:"vphantom",names:["\\vphantom"],numArgs:1,allowedInText:!0,handler:(e,t)=>{var r=e.parser,n=t[0];return{type:"vphantom",mode:r.mode,body:n}},htmlBuilder:(e,t)=>Cn(["mord","rlap"],[Cn(["katex-inner"],[na(e.body,t.withPhantom())]),Cn(["katex-fix"],[])],t),mathmlBuilder:(e,t)=>{var r=xa(Gn(e.body),t),n=new sa("mphantom",r),a=new sa("mpadded",[n]);return a.setAttribute("width","0px"),a}}),$n({type:"raisebox",names:["\\raisebox"],numArgs:2,argTypes:["size","hbox"],allowedInText:!0,handler(e,t){var r=e.parser,n=za(t[0],"size").value,a=t[1];return{type:"raisebox",mode:r.mode,dy:n,body:a}},htmlBuilder(e,t){var r=na(e.body,t);return En({positionType:"shift",positionData:-tr(e.dy,t),children:[{type:"elem",elem:r}]})},mathmlBuilder(e,t){var r=new sa("mpadded",[ya(e.body,t)]),n=e.dy.number+e.dy.unit;return r.setAttribute("voffset",n),r}});var ni=(e,t)=>({type:"reflectbox",mode:e.parser.mode,body:t[0]});function ai(e,t,r){for(var n=Zn(e,t,!1),a=t.sizeMultiplier/r.sizeMultiplier,o=0;o<n.length;o++){var i=n[o].classes.indexOf("katex-sizing");i<0?Array.prototype.push.apply(n[o].classes,t.sizingClasses(r)):n[o].classes[i+1]==="reset-size"+t.size&&(n[o].classes[i+1]="reset-size"+r.size),n[o].height*=a,n[o].depth*=a}return Nn(n)}$n({type:"reflectbox",names:["\\reflectbox"],numArgs:1,argTypes:["hbox"],allowedInText:!0,handler:ni,htmlBuilder:(e,t)=>Cn(["mord","reflectbox"],[na(e.body,t)],t),mathmlBuilder:(e,t)=>ya(e.body,t)}),$n({type:"reflectbox",names:["\\mathreflectbox"],numArgs:1,argTypes:["math"],handler:ni}),$n({type:"internal",names:["\\relax"],numArgs:0,allowedInText:!0,allowedInArgument:!0,handler:e=>({type:"internal",mode:e.parser.mode})}),$n({type:"rule",names:["\\rule"],numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"],handler(e,t,r){var n=e.parser,a=r[0],o=za(t[0],"size"),i=za(t[1],"size");return{type:"rule",mode:n.mode,shift:a&&za(a,"size").value,width:o.value,height:i.value}},htmlBuilder(e,t){var r=Cn(["mord","katex-rule"],[],t),n=tr(e.width,t),a=tr(e.height,t),o=e.shift?tr(e.shift,t):0;return r.style.borderRightWidth=rr(n),r.style.borderTopWidth=rr(a),r.style.bottom=rr(o),r.width=n,r.height=a+o,r.depth=-o,r.maxFontSize=1.125*a*t.sizeMultiplier,r},mathmlBuilder(e,t){var r=tr(e.width,t),n=tr(e.height,t),a=e.shift?tr(e.shift,t):0,o=t.color&&t.getColor()||"black",i=new sa("mspace");i.setAttribute("mathbackground",o),i.setAttribute("width",rr(r)),i.setAttribute("height",rr(n));var s=new sa("mpadded",[i]);return a>=0?s.setAttribute("height",rr(a)):(s.setAttribute("height",rr(a)),s.setAttribute("depth",rr(-a))),s.setAttribute("voffset",rr(a)),s}});var oi=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"];$n({type:"sizing",names:oi,numArgs:0,allowedInText:!0,handler:(e,t)=>{var r=e.breakOnTokenText,n=e.funcName,a=e.parser,o=a.parseExpression(!1,r);return{type:"sizing",mode:a.mode,size:oi.indexOf(n)+1,body:o}},htmlBuilder:(e,t)=>{var r=t.havingSize(e.size);return ai(e.body,r,t)},mathmlBuilder:(e,t)=>{var r=t.havingSize(e.size),n=xa(e.body,r),a=new sa("mstyle",n);return a.setAttribute("mathsize",rr(r.sizeMultiplier)),a}}),$n({type:"smash",names:["\\smash"],numArgs:1,numOptionalArgs:1,allowedInText:!0,handler:(e,t,r)=>{var n=e.parser,a=!1,o=!1,i=r[0]&&za(r[0],"ordgroup");if(i)for(var s,l=0;l<i.body.length;++l){if("t"===(s=_a(i.body[l]).text))a=!0;else{if("b"!==s){a=!1,o=!1;break}o=!0}}else a=!0,o=!0;var c=t[0];return{type:"smash",mode:n.mode,body:c,smashHeight:a,smashDepth:o}},htmlBuilder:(e,t)=>{var r=Cn([],[na(e.body,t)]);if(!e.smashHeight&&!e.smashDepth)return r;if(e.smashHeight&&(r.height=0),e.smashDepth&&(r.depth=0),e.smashHeight&&e.smashDepth)return Cn(["mord","katex-smash"],[r],t);if(r.children)for(var n=0;n<r.children.length;n++)e.smashHeight&&(r.children[n].height=0),e.smashDepth&&(r.children[n].depth=0);return Cn(["mord"],[En({positionType:"firstBaseline",children:[{type:"elem",elem:r}]})],t)},mathmlBuilder:(e,t)=>{var r=new sa("mpadded",[ya(e.body,t)]);return e.smashHeight&&r.setAttribute("height","0px"),e.smashDepth&&r.setAttribute("depth","0px"),r}}),$n({type:"sqrt",names:["\\sqrt"],numArgs:1,numOptionalArgs:1,handler(e,t,r){var n=e.parser,a=r[0],o=t[0];return{type:"sqrt",mode:n.mode,body:o,index:a}},htmlBuilder(e,t){var r=na(e.body,t.havingCrampedStyle());0===r.height&&(r.height=t.fontMetrics().xHeight),r=Mn(r,t);var n=t.fontMetrics().defaultRuleThickness,a=n;t.style.id<qt.TEXT.id&&(a=t.fontMetrics().xHeight);var o=n+a/4,i=function(e,t){var r,n,a,o,i,s=t.havingBaseSizing(),l=yo("\\surd",e*s.sizeMultiplier,xo,s),c=s.sizeMultiplier,d=Math.max(0,t.minRuleThickness-t.fontMetrics().sqrtRuleThickness);return"small"===l.type?(e<1?c=1:e<1.4&&(c=.7),a=(1+d)/c,(r=lo("sqrtMain",n=(1+d+so)/c,o=1e3+1e3*d+80,d,t)).style.minWidth="0.853em",i=.833/c):"large"===l.type?(o=1080*po[l.size],a=(po[l.size]+d)/c,n=(po[l.size]+d+so)/c,(r=lo("sqrtSize"+l.size,n,o,d,t)).style.minWidth="1.02em",i=1/c):(n=e+d+so,a=e+d,o=Math.floor(1e3*e+d)+80,(r=lo("sqrtTall",n,o,d,t)).style.minWidth="0.742em",i=1.056),r.height=a,r.style.height=rr(n),{span:r,advanceWidth:i,ruleWidth:(t.fontMetrics().sqrtRuleThickness+d)*c}}(r.height+r.depth+o+n,t),s=i.span,l=i.ruleWidth,c=i.advanceWidth,d=s.height-l;d>r.height+r.depth+o&&(o=(o+d-r.height-r.depth)/2);var u=s.height-r.height-o-l;r.style.paddingLeft=rr(c);var h=En({positionType:"firstBaseline",children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:-(r.height+u)},{type:"elem",elem:s},{type:"kern",size:l}]});if(e.index){var p=t.havingStyle(qt.SCRIPTSCRIPT),m=na(e.index,p,t);return Cn(["mord","sqrt"],[Cn(["katex-root"],[En({positionType:"shift",positionData:-.6*(h.height-h.depth),children:[{type:"elem",elem:m}]})]),h],t)}return Cn(["mord","sqrt"],[h],t)},mathmlBuilder(e,t){var r=e.body,n=e.index;return n?new sa("mroot",[ya(r,t),ya(n,t)]):new sa("msqrt",[ya(r,t)])}});var ii={display:qt.DISPLAY,text:qt.TEXT,script:qt.SCRIPT,scriptscript:qt.SCRIPTSCRIPT};$n({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],numArgs:0,allowedInText:!0,primitive:!0,handler(e,t){var r=e.breakOnTokenText,n=e.funcName,a=e.parser,o=a.parseExpression(!0,r),i=n.slice(1,n.length-5);if(!(i in ii))throw new Error("Unknown style: "+i);return{type:"styling",mode:a.mode,style:i,body:o}},htmlBuilder(e,t){var r=ii[e.style],n=t.havingStyle(r);return e.resetFont&&(n=n.withFont("")),ai(e.body,n,t)},mathmlBuilder(e,t){var r=ii[e.style],n=t.havingStyle(r);e.resetFont&&(n=n.withFont(""));var a=xa(e.body,n),o=new sa("mstyle",a),i={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]}[e.style];return o.setAttribute("scriptlevel",i[0]),o.setAttribute("displaystyle",i[1]),o}});qn({type:"supsub",htmlBuilder(e,t){var r=function(e,t){var r=e.base;return r?"op"===r.type?r.limits&&(t.style.size===qt.DISPLAY.size||r.alwaysHandleSupSub)?Qo:null:"operatorname"===r.type?r.alwaysHandleSupSub&&(t.style.size===qt.DISPLAY.size||r.limits)?ri:null:"accent"===r.type?Rt(r.base)?Fa:null:"horizBrace"===r.type&&!e.sub===r.isOver?Ko:null:null}(e,t);if(r)return r(e,t);var n,a,o,i=e.base,s=e.sup,l=e.sub,c=na(i,t),d=t.fontMetrics(),u=0,h=0,p=i&&Rt(i);if(s){var m=t.havingStyle(t.style.sup());n=na(s,m,t),p||(u=c.height-m.fontMetrics().supDrop*m.sizeMultiplier/t.sizeMultiplier)}if(l){var f=t.havingStyle(t.style.sub());a=na(l,f,t),p||(h=c.depth+f.fontMetrics().subDrop*f.sizeMultiplier/t.sizeMultiplier)}o=t.style===qt.DISPLAY?d.sup1:t.style.cramped?d.sup3:d.sup2;var g,x=t.sizeMultiplier,v=rr(.5/d.ptPerEm/x),y=null;if(a){var b,w=e.base&&"op"===e.base.type&&e.base.name&&("\\oiint"===e.base.name||"\\oiiint"===e.base.name);if(c instanceof pr||w)y=rr(-(null!=(b=c.italic)?b:0))}if(n&&a){u=Math.max(u,o,n.depth+.25*d.xHeight),h=Math.max(h,d.sub2);var S=4*d.defaultRuleThickness;if(u-n.depth-(a.height-h)<S){h=S-(u-n.depth)+a.height;var k=.8*d.xHeight-(u-n.depth);k>0&&(u+=k,h-=k)}g=En({positionType:"individualShift",children:[{type:"elem",elem:a,shift:h,marginRight:v,marginLeft:y},{type:"elem",elem:n,shift:-u,marginRight:v}]})}else if(a)h=Math.max(h,d.sub1,a.height-.8*d.xHeight),g=En({positionType:"shift",positionData:h,children:[{type:"elem",elem:a,marginLeft:y,marginRight:v}]});else{if(!n)throw new Error("supsub must have either sup or sub.");u=Math.max(u,o,n.depth+.25*d.xHeight),g=En({positionType:"shift",positionData:-u,children:[{type:"elem",elem:n,marginRight:v}]})}return Cn([ta(c,"right")||"mord"],[c,Cn(["msupsub"],[g])],t)},mathmlBuilder(e,t){var r,n=!1;e.base&&"horizBrace"===e.base.type&&!!e.sup===e.base.isOver&&(n=!0,r=e.base.isOver),!e.base||"op"!==e.base.type&&"operatorname"!==e.base.type||(e.base.parentIsSupSub=!0);var a,o=[ya(e.base,t)];if(e.sub&&o.push(ya(e.sub,t)),e.sup&&o.push(ya(e.sup,t)),n)a=r?"mover":"munder";else if(e.sub)if(e.sup){var i=e.base;a=i&&"op"===i.type&&i.limits&&t.style===qt.DISPLAY||i&&"operatorname"===i.type&&i.alwaysHandleSupSub&&(t.style===qt.DISPLAY||i.limits)?"munderover":"msubsup"}else{var s=e.base;a=s&&"op"===s.type&&s.limits&&(t.style===qt.DISPLAY||s.alwaysHandleSupSub)||s&&"operatorname"===s.type&&s.alwaysHandleSupSub&&(s.limits||t.style===qt.DISPLAY)?"munder":"msub"}else{var l=e.base;a=l&&"op"===l.type&&l.limits&&(t.style===qt.DISPLAY||l.alwaysHandleSupSub)||l&&"operatorname"===l.type&&l.alwaysHandleSupSub&&(l.limits||t.style===qt.DISPLAY)?"mover":"msup"}return new sa(a,o)}}),qn({type:"atom",htmlBuilder:(e,t)=>yn(e.text,e.mode,t,["m"+e.family]),mathmlBuilder(e,t){var r=new sa("mo",[ha(e.text,e.mode)]);if("bin"===e.family){var n=fa(e,t);"bold-italic"===n&&r.setAttribute("mathvariant",n)}else"punct"===e.family?r.setAttribute("separator","true"):"open"!==e.family&&"close"!==e.family||r.setAttribute("stretchy","false");return r}});var si={mi:"italic",mn:"normal",mtext:"normal"};qn({type:"mathord",htmlBuilder:(e,t)=>bn(e,t),mathmlBuilder(e,t){var r=new sa("mi",[ha(e.text,e.mode,t)]),n=fa(e,t)||"italic";return n!==si[r.type]&&r.setAttribute("mathvariant",n),r}}),qn({type:"textord",htmlBuilder:(e,t)=>bn(e,t),mathmlBuilder(e,t){var r,n=ha(e.text,e.mode,t),a=fa(e,t)||"normal";return r="text"===e.mode?new sa("mtext",[n]):/[0-9]/.test(e.text)?new sa("mn",[n]):"\\prime"===e.text?new sa("mo",[n]):new sa("mi",[n]),a!==si[r.type]&&r.setAttribute("mathvariant",a),r}});var li=new Map([["\\nobreak","nobreak"],["\\allowbreak","allowbreak"]]),ci=new Map([[" ",{}],["\\ ",{}],["~",{className:"nobreak"}],["\\space",{}],["\\nobreakspace",{className:"nobreak"}]]);qn({type:"spacing",htmlBuilder(e,t){var r=ci.get(e.text),n=li.get(e.text);if(r){var a=r.className||"";if("text"===e.mode){var o=bn(e,t);return o.classes.push(a),o}return Cn(["mspace",a],[yn(e.text,e.mode,t)],t)}if(n)return Cn(["mspace",n],[],t);throw new kt('Unknown type of space "'+e.text+'"')},mathmlBuilder(e,t){if(!ci.has(e.text)){if(li.has(e.text))return new sa("mspace");throw new kt('Unknown type of space "'+e.text+'"')}return new sa("mtext",[new la(" ")])}});var di=()=>{var e=new sa("mtd",[]);return e.setAttribute("width","50%"),e};qn({type:"tag",mathmlBuilder(e,t){var r=new sa("mtable",[new sa("mtr",[di(),new sa("mtd",[va(e.body,t)]),di(),new sa("mtd",[va(e.tag,t)])])]);return r.setAttribute("width","100%"),r}});var ui={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},hi={"\\textbf":"textbf","\\textmd":"textmd"},pi={"\\textit":"textit","\\textup":"textup"},mi=(e,t)=>{var r=e.font;return r?ui[r]?t.withTextFontFamily(ui[r]):hi[r]?t.withTextFontWeight(hi[r]):"\\emph"===r?"textit"===t.fontShape?t.withTextFontShape("textup"):t.withTextFontShape("textit"):t.withTextFontShape(pi[r]):t};$n({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0,handler(e,t){var r=e.parser,n=e.funcName,a=t[0];return{type:"text",mode:r.mode,body:Gn(a),font:n}},htmlBuilder(e,t){var r=mi(e,t);return Cn(["mord","text"],Zn(e.body,r,!0),r)},mathmlBuilder(e,t){var r=mi(e,t);return va(e.body,r)}}),$n({type:"underline",names:["\\underline"],numArgs:1,allowedInText:!0,handler:(e,t)=>({type:"underline",mode:e.parser.mode,body:t[0]}),htmlBuilder(e,t){var r=na(e.body,t),n=Tn("underline-line",t),a=t.fontMetrics().defaultRuleThickness;return Cn(["mord","katex-underline"],[En({positionType:"top",positionData:r.height,children:[{type:"kern",size:a},{type:"elem",elem:n},{type:"kern",size:3*a},{type:"elem",elem:r}]})],t)},mathmlBuilder(e,t){var r=new sa("mo",[new la("‾")]);r.setAttribute("stretchy","true");var n=new sa("munder",[ya(e.body,t),r]);return n.setAttribute("accentunder","true"),n}}),$n({type:"vcenter",names:["\\vcenter"],numArgs:1,argTypes:["original"],allowedInText:!1,handler:(e,t)=>({type:"vcenter",mode:e.parser.mode,body:t[0]}),htmlBuilder(e,t){var r=na(e.body,t),n=t.fontMetrics().axisHeight;return En({positionType:"shift",positionData:.5*(r.height-n-(r.depth+n)),children:[{type:"elem",elem:r}]})},mathmlBuilder(e,t){var r=new sa("mpadded",[ya(e.body,t)],["vcenter"]);return new sa("mrow",[r])}}),$n({type:"verb",names:["\\verb"],numArgs:0,allowedInText:!0,handler(e,t,r){throw new kt("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var r=fi(e),n=[],a=t.havingStyle(t.style.text()),o=0;o<r.length;o++){var i=r[o];"~"===i&&(i="\\textasciitilde"),n.push(vn(i,"Typewriter-Regular",e.mode,a,["mord","texttt"]))}return Cn(["mord","text"].concat(a.sizingClasses(t)),Sn(n),a)},mathmlBuilder(e,t){var r=new la(fi(e)),n=new sa("mtext",[r]);return n.setAttribute("mathvariant","monospace"),n}});var fi=e=>e.body.replace(/ /g,e.star?"␣":" "),gi=Bn,xi="[ \r\n\t]",vi="(\\\\[a-zA-Z@]+)"+xi+"*",yi="[̀-ͯ]",bi=new RegExp(yi+"+$"),wi="("+xi+"+)|\\\\(\n|[ \r\t]+\n?)[ \r\t]*|([!-\\[\\]-‧‪-퟿豈-￿]"+yi+"*|[\ud800-\udbff][\udc00-\udfff]"+yi+"*|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5|"+vi+"|\\\\[^\ud800-\udfff])",Si=class{constructor(e,t){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=e,this.settings=t,this.tokenRegex=new RegExp(wi,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,t){this.catcodes[e]=t}lex(){var e=this.input,t=this.tokenRegex.lastIndex;if(t===e.length)return new Do("EOF",new Ro(this,t,t));var r=this.tokenRegex.exec(e);if(null===r||r.index!==t)throw new kt("Unexpected character: '"+e[t]+"'",new Do(e[t],new Ro(this,t,t+1)));var n=r[6]||r[3]||(r[2]?"\\ ":" ");if(14===this.catcodes[n]){var a=e.indexOf("\n",this.tokenRegex.lastIndex);return-1===a?(this.tokenRegex.lastIndex=e.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=a+1,this.lex()}return new Do(n,new Ro(this,t,this.tokenRegex.lastIndex))}},ki=class{constructor(e,t){void 0===e&&(e={}),void 0===t&&(t={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=t,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(0===this.undefStack.length)throw new kt("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var t of Object.keys(e))void 0===e[t]?delete this.current[t]:this.current[t]=e[t]}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return Object.prototype.hasOwnProperty.call(this.current,e)||Object.prototype.hasOwnProperty.call(this.builtins,e)}get(e){return Object.prototype.hasOwnProperty.call(this.current,e)?this.current[e]:Object.prototype.hasOwnProperty.call(this.builtins,e)?this.builtins[e]:void 0}set(e,t,r){if(void 0===r&&(r=!1),r){for(var n=0;n<this.undefStack.length;n++)delete this.undefStack[n][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=t)}else{var a=this.undefStack[this.undefStack.length-1];a&&!Object.prototype.hasOwnProperty.call(a,e)&&(a[e]=Object.prototype.hasOwnProperty.call(this.current,e)?this.current[e]:void 0)}null==t?delete this.current[e]:this.current[e]=t}},Ci=Eo;Ao("\\noexpand",function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}}),Ao("\\expandafter",function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}}),Ao("\\@firstoftwo",function(e){return{tokens:e.consumeArgs(2)[0],numArgs:0}}),Ao("\\@secondoftwo",function(e){return{tokens:e.consumeArgs(2)[1],numArgs:0}}),Ao("\\@ifnextchar",function(e){var t=e.consumeArgs(3);e.consumeSpaces();var r=e.future();return 1===t[0].length&&t[0][0].text===r.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}}),Ao("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}"),Ao("\\TextOrMath",function(e){var t=e.consumeArgs(2);return"text"===e.mode?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var ji={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};Ao("\\char",function(e){var t,r=e.popToken(),n=0;if("'"===r.text)t=8,r=e.popToken();else if('"'===r.text)t=16,r=e.popToken();else if("`"===r.text)if("\\"===(r=e.popToken()).text[0])n=r.text.charCodeAt(1);else{if("EOF"===r.text)throw new kt("\\char` missing argument");n=r.text.charCodeAt(0)}else t=10;if(t){if(null==(n=ji[r.text])||n>=t)throw new kt("Invalid base-"+t+" digit "+r.text);for(var a;null!=(a=ji[e.future().text])&&a<t;)n*=t,n+=a,e.popToken()}return"\\@char{"+n+"}"});var Ti=(e,t,r,n)=>{var a=e.consumeArg().tokens;if(1!==a.length)throw new kt("\\newcommand's first argument must be a macro name");var o=a[0].text,i=e.isDefined(o);if(i&&!t)throw new kt("\\newcommand{"+o+"} attempting to redefine "+o+"; use \\renewcommand");if(!i&&!r)throw new kt("\\renewcommand{"+o+"} when command "+o+" does not yet exist; use \\newcommand");var s=0;if(1===(a=e.consumeArg().tokens).length&&"["===a[0].text){for(var l="",c=e.expandNextToken();"]"!==c.text&&"EOF"!==c.text;)l+=c.text,c=e.expandNextToken();if(!l.match(/^\s*[0-9]+\s*$/))throw new kt("Invalid number of arguments: "+l);s=parseInt(l),a=e.consumeArg().tokens}return i&&n||e.macros.set(o,{tokens:a,numArgs:s}),""};Ao("\\newcommand",e=>Ti(e,!1,!0,!1)),Ao("\\renewcommand",e=>Ti(e,!0,!1,!1)),Ao("\\providecommand",e=>Ti(e,!0,!0,!0)),Ao("\\message",e=>{e.consumeArgs(1)[0];return""}),Ao("\\errmessage",e=>{e.consumeArgs(1)[0];return""}),Ao("\\show",e=>{e.popToken().text;return""}),Ao("\\bgroup","{"),Ao("\\egroup","}"),Ao("~","\\nobreakspace"),Ao("\\lq","`"),Ao("\\rq","'"),Ao("\\aa","\\r a"),Ao("\\AA","\\r A"),Ao("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}"),Ao("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}"),Ao("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}"),Ao("ℬ","\\mathscr{B}"),Ao("ℰ","\\mathscr{E}"),Ao("ℱ","\\mathscr{F}"),Ao("ℋ","\\mathscr{H}"),Ao("ℐ","\\mathscr{I}"),Ao("ℒ","\\mathscr{L}"),Ao("ℳ","\\mathscr{M}"),Ao("ℛ","\\mathscr{R}"),Ao("ℭ","\\mathfrak{C}"),Ao("ℌ","\\mathfrak{H}"),Ao("ℨ","\\mathfrak{Z}"),Ao("\\Bbbk","\\Bbb{k}"),Ao("\\llap","\\mathllap{\\textrm{#1}}"),Ao("\\rlap","\\mathrlap{\\textrm{#1}}"),Ao("\\clap","\\mathclap{\\textrm{#1}}"),Ao("\\mathstrut","\\vphantom{(}"),Ao("\\underbar","\\underline{\\text{#1}}"),Ao("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}'),Ao("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}"),Ao("\\ne","\\neq"),Ao("≠","\\neq"),Ao("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}"),Ao("∉","\\notin"),Ao("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}"),Ao("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}"),Ao("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}"),Ao("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}"),Ao("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}"),Ao("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}"),Ao("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}"),Ao("⟂","\\perp"),Ao("‼","\\mathclose{!\\mkern-0.8mu!}"),Ao("∌","\\notni"),Ao("⌜","\\ulcorner"),Ao("⌝","\\urcorner"),Ao("⌞","\\llcorner"),Ao("⌟","\\lrcorner"),Ao("©","\\copyright"),Ao("®","\\textregistered"),Ao("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}'),Ao("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}'),Ao("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}'),Ao("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}'),Ao("\\vdots","{\\varvdots\\rule{0pt}{15pt}}"),Ao("⋮","\\vdots"),Ao("\\varGamma","\\mathit{\\Gamma}"),Ao("\\varDelta","\\mathit{\\Delta}"),Ao("\\varTheta","\\mathit{\\Theta}"),Ao("\\varLambda","\\mathit{\\Lambda}"),Ao("\\varXi","\\mathit{\\Xi}"),Ao("\\varPi","\\mathit{\\Pi}"),Ao("\\varSigma","\\mathit{\\Sigma}"),Ao("\\varUpsilon","\\mathit{\\Upsilon}"),Ao("\\varPhi","\\mathit{\\Phi}"),Ao("\\varPsi","\\mathit{\\Psi}"),Ao("\\varOmega","\\mathit{\\Omega}"),Ao("\\substack","\\begin{subarray}{c}#1\\end{subarray}"),Ao("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax"),Ao("\\boxed","\\fbox{$\\displaystyle{#1}$}"),Ao("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;"),Ao("\\implies","\\DOTSB\\;\\Longrightarrow\\;"),Ao("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;"),Ao("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}"),Ao("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var Ni={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"},Mi=new Set(["bin","rel"]);Ao("\\dots",function(e){var t="\\dotso",r=e.expandAfterFuture().text;return r in Ni?t=Ni[r]:("\\not"===r.slice(0,4)||r in Sr.math&&Mi.has(Sr.math[r].group))&&(t="\\dotsb"),t});var Ei={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};Ao("\\dotso",function(e){return e.future().text in Ei?"\\ldots\\,":"\\ldots"}),Ao("\\dotsc",function(e){var t=e.future().text;return t in Ei&&","!==t?"\\ldots\\,":"\\ldots"}),Ao("\\cdots",function(e){return e.future().text in Ei?"\\@cdots\\,":"\\@cdots"}),Ao("\\dotsb","\\cdots"),Ao("\\dotsm","\\cdots"),Ao("\\dotsi","\\!\\cdots"),Ao("\\dotsx","\\ldots\\,"),Ao("\\DOTSI","\\relax"),Ao("\\DOTSB","\\relax"),Ao("\\DOTSX","\\relax"),Ao("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"),Ao("\\,","\\tmspace+{3mu}{.1667em}"),Ao("\\thinspace","\\,"),Ao("\\>","\\mskip{4mu}"),Ao("\\:","\\tmspace+{4mu}{.2222em}"),Ao("\\medspace","\\:"),Ao("\\;","\\tmspace+{5mu}{.2777em}"),Ao("\\thickspace","\\;"),Ao("\\!","\\tmspace-{3mu}{.1667em}"),Ao("\\negthinspace","\\!"),Ao("\\negmedspace","\\tmspace-{4mu}{.2222em}"),Ao("\\negthickspace","\\tmspace-{5mu}{.277em}"),Ao("\\enspace","\\kern.5em "),Ao("\\enskip","\\hskip.5em\\relax"),Ao("\\quad","\\hskip1em\\relax"),Ao("\\qquad","\\hskip2em\\relax"),Ao("\\tag","\\@ifstar\\tag@literal\\tag@paren"),Ao("\\tag@paren","\\tag@literal{({#1})}"),Ao("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new kt("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"}),Ao("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}"),Ao("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)"),Ao("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}"),Ao("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1"),Ao("\\newline","\\\\\\relax"),Ao("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var Ai=rr(xr["Main-Regular"]["T".charCodeAt(0)][1]-.7*xr["Main-Regular"]["A".charCodeAt(0)][1]);Ao("\\LaTeX","\\textrm{\\html@mathml{L\\kern-.36em\\raisebox{"+Ai+"}{\\scriptstyle A}\\kern-.15em\\TeX}{LaTeX}}"),Ao("\\KaTeX","\\textrm{\\html@mathml{K\\kern-.17em\\raisebox{"+Ai+"}{\\scriptstyle A}\\kern-.15em\\TeX}{KaTeX}}"),Ao("\\hspace","\\@ifstar\\@hspacer\\@hspace"),Ao("\\@hspace","\\hskip #1\\relax"),Ao("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax"),Ao("\\ordinarycolon",":"),Ao("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}"),Ao("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}'),Ao("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}'),Ao("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}'),Ao("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}'),Ao("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}'),Ao("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}'),Ao("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}'),Ao("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}'),Ao("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}'),Ao("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}'),Ao("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}'),Ao("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}'),Ao("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}'),Ao("∷","\\dblcolon"),Ao("∹","\\eqcolon"),Ao("≔","\\coloneqq"),Ao("≕","\\eqqcolon"),Ao("⩴","\\Coloneqq"),Ao("\\ratio","\\vcentcolon"),Ao("\\coloncolon","\\dblcolon"),Ao("\\colonequals","\\coloneqq"),Ao("\\coloncolonequals","\\Coloneqq"),Ao("\\equalscolon","\\eqqcolon"),Ao("\\equalscoloncolon","\\Eqqcolon"),Ao("\\colonminus","\\coloneq"),Ao("\\coloncolonminus","\\Coloneq"),Ao("\\minuscolon","\\eqcolon"),Ao("\\minuscoloncolon","\\Eqcolon"),Ao("\\coloncolonapprox","\\Colonapprox"),Ao("\\coloncolonsim","\\Colonsim"),Ao("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),Ao("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}"),Ao("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),Ao("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}"),Ao("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}"),Ao("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}"),Ao("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}"),Ao("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}"),Ao("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}"),Ao("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}"),Ao("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}"),Ao("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}"),Ao("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}"),Ao("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}"),Ao("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}"),Ao("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}"),Ao("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}"),Ao("\\nleqq","\\html@mathml{\\@nleqq}{≰}"),Ao("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}"),Ao("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}"),Ao("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}"),Ao("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}"),Ao("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}"),Ao("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}"),Ao("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}"),Ao("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}"),Ao("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}"),Ao("\\imath","\\html@mathml{\\@imath}{ı}"),Ao("\\jmath","\\html@mathml{\\@jmath}{ȷ}"),Ao("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}"),Ao("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}"),Ao("⟦","\\llbracket"),Ao("⟧","\\rrbracket"),Ao("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}"),Ao("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}"),Ao("↤","\\mapsfrom"),Ao("\\mapsfrom","\\html@mathml{\\mathrel{\\mathreflectbox{\\mapsto}}}{\\mathrel{\\char`↤}}"),Ao("⦃","\\lBrace"),Ao("⦄","\\rBrace"),Ao("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}"),Ao("⦵","\\minuso"),Ao("\\darr","\\downarrow"),Ao("\\dArr","\\Downarrow"),Ao("\\Darr","\\Downarrow"),Ao("\\lang","\\langle"),Ao("\\rang","\\rangle"),Ao("\\uarr","\\uparrow"),Ao("\\uArr","\\Uparrow"),Ao("\\Uarr","\\Uparrow"),Ao("\\N","\\mathbb{N}"),Ao("\\R","\\mathbb{R}"),Ao("\\Z","\\mathbb{Z}"),Ao("\\alef","\\aleph"),Ao("\\alefsym","\\aleph"),Ao("\\Alpha","\\mathrm{A}"),Ao("\\Beta","\\mathrm{B}"),Ao("\\bull","\\bullet"),Ao("\\Chi","\\mathrm{X}"),Ao("\\clubs","\\clubsuit"),Ao("\\cnums","\\mathbb{C}"),Ao("\\Complex","\\mathbb{C}"),Ao("\\Dagger","\\ddagger"),Ao("\\diamonds","\\diamondsuit"),Ao("\\empty","\\emptyset"),Ao("\\Epsilon","\\mathrm{E}"),Ao("\\Eta","\\mathrm{H}"),Ao("\\exist","\\exists"),Ao("\\harr","\\leftrightarrow"),Ao("\\hArr","\\Leftrightarrow"),Ao("\\Harr","\\Leftrightarrow"),Ao("\\hearts","\\heartsuit"),Ao("\\image","\\Im"),Ao("\\infin","\\infty"),Ao("\\Iota","\\mathrm{I}"),Ao("\\isin","\\in"),Ao("\\Kappa","\\mathrm{K}"),Ao("\\larr","\\leftarrow"),Ao("\\lArr","\\Leftarrow"),Ao("\\Larr","\\Leftarrow"),Ao("\\lrarr","\\leftrightarrow"),Ao("\\lrArr","\\Leftrightarrow"),Ao("\\Lrarr","\\Leftrightarrow"),Ao("\\Mu","\\mathrm{M}"),Ao("\\natnums","\\mathbb{N}"),Ao("\\Nu","\\mathrm{N}"),Ao("\\Omicron","\\mathrm{O}"),Ao("\\plusmn","\\pm"),Ao("\\rarr","\\rightarrow"),Ao("\\rArr","\\Rightarrow"),Ao("\\Rarr","\\Rightarrow"),Ao("\\real","\\Re"),Ao("\\reals","\\mathbb{R}"),Ao("\\Reals","\\mathbb{R}"),Ao("\\Rho","\\mathrm{P}"),Ao("\\sdot","\\cdot"),Ao("\\sect","\\S"),Ao("\\spades","\\spadesuit"),Ao("\\sub","\\subset"),Ao("\\sube","\\subseteq"),Ao("\\supe","\\supseteq"),Ao("\\Tau","\\mathrm{T}"),Ao("\\thetasym","\\vartheta"),Ao("\\weierp","\\wp"),Ao("\\Zeta","\\mathrm{Z}"),Ao("\\argmin","\\DOTSB\\operatorname*{arg\\,min}"),Ao("\\argmax","\\DOTSB\\operatorname*{arg\\,max}"),Ao("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits"),Ao("\\bra","\\mathinner{\\langle{#1}|}"),Ao("\\ket","\\mathinner{|{#1}\\rangle}"),Ao("\\braket","\\mathinner{\\langle{#1}\\rangle}"),Ao("\\Bra","\\left\\langle#1\\right|"),Ao("\\Ket","\\left|#1\\right\\rangle");var Ri=e=>t=>{var r=t.consumeArg().tokens,n=t.consumeArg().tokens,a=t.consumeArg().tokens,o=t.consumeArg().tokens,i=t.macros.get("|"),s=t.macros.get("\\|");t.macros.beginGroup();var l=t=>r=>{e&&(r.macros.set("|",i),a.length&&r.macros.set("\\|",s));var o=t;return!t&&a.length&&"|"===r.future().text&&(r.popToken(),o=!0),{tokens:o?a:n,numArgs:0}};t.macros.set("|",l(!1)),a.length&&t.macros.set("\\|",l(!0));var c=t.consumeArg().tokens,d=t.expandTokens([...o,...c,...r]);return t.macros.endGroup(),{tokens:d.reverse(),numArgs:0}};Ao("\\bra@ket",Ri(!1)),Ao("\\bra@set",Ri(!0)),Ao("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}"),Ao("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}"),Ao("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}"),Ao("\\angln","{\\angl n}"),Ao("\\blue","\\textcolor{##6495ed}{#1}"),Ao("\\orange","\\textcolor{##ffa500}{#1}"),Ao("\\pink","\\textcolor{##ff00af}{#1}"),Ao("\\red","\\textcolor{##df0030}{#1}"),Ao("\\green","\\textcolor{##28ae7b}{#1}"),Ao("\\gray","\\textcolor{gray}{#1}"),Ao("\\purple","\\textcolor{##9d38bd}{#1}"),Ao("\\blueA","\\textcolor{##ccfaff}{#1}"),Ao("\\blueB","\\textcolor{##80f6ff}{#1}"),Ao("\\blueC","\\textcolor{##63d9ea}{#1}"),Ao("\\blueD","\\textcolor{##11accd}{#1}"),Ao("\\blueE","\\textcolor{##0c7f99}{#1}"),Ao("\\tealA","\\textcolor{##94fff5}{#1}"),Ao("\\tealB","\\textcolor{##26edd5}{#1}"),Ao("\\tealC","\\textcolor{##01d1c1}{#1}"),Ao("\\tealD","\\textcolor{##01a995}{#1}"),Ao("\\tealE","\\textcolor{##208170}{#1}"),Ao("\\greenA","\\textcolor{##b6ffb0}{#1}"),Ao("\\greenB","\\textcolor{##8af281}{#1}"),Ao("\\greenC","\\textcolor{##74cf70}{#1}"),Ao("\\greenD","\\textcolor{##1fab54}{#1}"),Ao("\\greenE","\\textcolor{##0d923f}{#1}"),Ao("\\goldA","\\textcolor{##ffd0a9}{#1}"),Ao("\\goldB","\\textcolor{##ffbb71}{#1}"),Ao("\\goldC","\\textcolor{##ff9c39}{#1}"),Ao("\\goldD","\\textcolor{##e07d10}{#1}"),Ao("\\goldE","\\textcolor{##a75a05}{#1}"),Ao("\\redA","\\textcolor{##fca9a9}{#1}"),Ao("\\redB","\\textcolor{##ff8482}{#1}"),Ao("\\redC","\\textcolor{##f9685d}{#1}"),Ao("\\redD","\\textcolor{##e84d39}{#1}"),Ao("\\redE","\\textcolor{##bc2612}{#1}"),Ao("\\maroonA","\\textcolor{##ffbde0}{#1}"),Ao("\\maroonB","\\textcolor{##ff92c6}{#1}"),Ao("\\maroonC","\\textcolor{##ed5fa6}{#1}"),Ao("\\maroonD","\\textcolor{##ca337c}{#1}"),Ao("\\maroonE","\\textcolor{##9e034e}{#1}"),Ao("\\purpleA","\\textcolor{##ddd7ff}{#1}"),Ao("\\purpleB","\\textcolor{##c6b9fc}{#1}"),Ao("\\purpleC","\\textcolor{##aa87ff}{#1}"),Ao("\\purpleD","\\textcolor{##7854ab}{#1}"),Ao("\\purpleE","\\textcolor{##543b78}{#1}"),Ao("\\mintA","\\textcolor{##f5f9e8}{#1}"),Ao("\\mintB","\\textcolor{##edf2df}{#1}"),Ao("\\mintC","\\textcolor{##e0e5cc}{#1}"),Ao("\\grayA","\\textcolor{##f6f7f7}{#1}"),Ao("\\grayB","\\textcolor{##f0f1f2}{#1}"),Ao("\\grayC","\\textcolor{##e3e5e6}{#1}"),Ao("\\grayD","\\textcolor{##d6d8da}{#1}"),Ao("\\grayE","\\textcolor{##babec2}{#1}"),Ao("\\grayF","\\textcolor{##888d93}{#1}"),Ao("\\grayG","\\textcolor{##626569}{#1}"),Ao("\\grayH","\\textcolor{##3b3e40}{#1}"),Ao("\\grayI","\\textcolor{##21242c}{#1}"),Ao("\\kaBlue","\\textcolor{##314453}{#1}"),Ao("\\kaGreen","\\textcolor{##71B307}{#1}");var Di={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0},Ii=class{constructor(e,t,r){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=t,this.expansionCount=0,this.feed(e),this.macros=new ki(Ci,t.macros),this.mode=r,this.stack=[]}feed(e){this.lexer=new Si(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return 0===this.stack.length&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var t,r,n;if(e){if(this.consumeSpaces(),"["!==this.future().text)return null;t=this.popToken();var a=this.consumeArg(["]"]);n=a.tokens,r=a.end}else{var o=this.consumeArg();n=o.tokens,t=o.start,r=o.end}return this.pushToken(new Do("EOF",r.loc)),this.pushTokens(n),new Do("",Ro.range(t,r))}consumeSpaces(){for(;" "===this.future().text;)this.stack.pop()}consumeArg(e){var t=[],r=e&&e.length>0;r||this.consumeSpaces();var n,a=this.future(),o=0,i=0;do{if(n=this.popToken(),t.push(n),"{"===n.text)++o;else if("}"===n.text){if(-1===--o)throw new kt("Extra }",n)}else if("EOF"===n.text)throw new kt("Unexpected end of input in a macro argument, expected '"+(e&&r?e[i]:"}")+"'",n);if(e&&r)if((0===o||1===o&&"{"===e[i])&&n.text===e[i]){if(++i===e.length){t.splice(-i,i);break}}else i=0}while(0!==o||r);return"{"===a.text&&"}"===t[t.length-1].text&&(t.pop(),t.shift()),t.reverse(),{tokens:t,start:a,end:n}}consumeArgs(e,t){if(t){if(t.length!==e+1)throw new kt("The length of delimiters doesn't match the number of args!");for(var r=t[0],n=0;n<r.length;n++){var a=this.popToken();if(r[n]!==a.text)throw new kt("Use of the macro doesn't match its definition",a)}}for(var o=[],i=0;i<e;i++)o.push(this.consumeArg(t&&t[i+1]).tokens);return o}countExpansion(e){if(this.expansionCount+=e,this.expansionCount>this.settings.maxExpand)throw new kt("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var t=this.popToken(),r=t.text,n=t.noexpand?null:this._getExpansion(r);if(null==n||e&&n.unexpandable){if(e&&null==n&&"\\"===r[0]&&!this.isDefined(r))throw new kt("Undefined control sequence: "+r);return this.pushToken(t),!1}this.countExpansion(1);var a=n.tokens,o=this.consumeArgs(n.numArgs,n.delimiters);if(n.numArgs)for(var i=(a=a.slice()).length-1;i>=0;--i){var s=a[i];if("#"===s.text){if(0===i)throw new kt("Incomplete placeholder at end of macro body",s);if("#"===(s=a[--i]).text)a.splice(i+1,1);else{if(!/^[1-9]$/.test(s.text))throw new kt("Not a valid argument number",s);a.splice(i,2,...o[+s.text-1])}}}return this.pushTokens(a),a.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(!1===this.expandOnce()){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}}expandMacro(e){return this.macros.has(e)?this.expandTokens([new Do(e)]):void 0}expandTokens(e){var t=[],r=this.stack.length;for(this.pushTokens(e);this.stack.length>r;)if(!1===this.expandOnce(!0)){var n=this.stack.pop();n.treatAsRelax&&(n.noexpand=!1,n.treatAsRelax=!1),t.push(n)}return this.countExpansion(t.length),t}expandMacroAsText(e){var t=this.expandMacro(e);return t?t.map(e=>e.text).join(""):t}_getExpansion(e){var t=this.macros.get(e);if(null==t)return t;if(1===e.length){var r=this.lexer.catcodes[e];if(null!=r&&13!==r)return}var n="function"==typeof t?t(this):t;if("string"==typeof n){var a=0;if(n.includes("#"))for(var o=n.replace(/##/g,"");o.includes("#"+(a+1));)++a;for(var i=new Si(n,this.settings),s=[],l=i.lex();"EOF"!==l.text;)s.push(l),l=i.lex();return s.reverse(),{tokens:s,numArgs:a}}return n}isDefined(e){return this.macros.has(e)||Object.prototype.hasOwnProperty.call(gi,e)||Object.prototype.hasOwnProperty.call(Sr.math,e)||Object.prototype.hasOwnProperty.call(Sr.text,e)||Object.prototype.hasOwnProperty.call(Di,e)}isExpandable(e){var t=this.macros.get(e);return null!=t?"string"==typeof t||"function"==typeof t||!t.unexpandable:Object.prototype.hasOwnProperty.call(gi,e)&&!gi[e].primitive}},zi=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,_i=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g","ʰ":"h","ⁱ":"i","ʲ":"j","ᵏ":"k","ˡ":"l","ᵐ":"m","ⁿ":"n","ᵒ":"o","ᵖ":"p","ʳ":"r","ˢ":"s","ᵗ":"t","ᵘ":"u","ᵛ":"v","ʷ":"w","ˣ":"x","ʸ":"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),Pi={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},Oi={"á":"á","à":"à","ä":"ä","ǟ":"ǟ","ã":"ã","ā":"ā","ă":"ă","ắ":"ắ","ằ":"ằ","ẵ":"ẵ","ǎ":"ǎ","â":"â","ấ":"ấ","ầ":"ầ","ẫ":"ẫ","ȧ":"ȧ","ǡ":"ǡ","å":"å","ǻ":"ǻ","ḃ":"ḃ","ć":"ć","ḉ":"ḉ","č":"č","ĉ":"ĉ","ċ":"ċ","ç":"ç","ď":"ď","ḋ":"ḋ","ḑ":"ḑ","é":"é","è":"è","ë":"ë","ẽ":"ẽ","ē":"ē","ḗ":"ḗ","ḕ":"ḕ","ĕ":"ĕ","ḝ":"ḝ","ě":"ě","ê":"ê","ế":"ế","ề":"ề","ễ":"ễ","ė":"ė","ȩ":"ȩ","ḟ":"ḟ","ǵ":"ǵ","ḡ":"ḡ","ğ":"ğ","ǧ":"ǧ","ĝ":"ĝ","ġ":"ġ","ģ":"ģ","ḧ":"ḧ","ȟ":"ȟ","ĥ":"ĥ","ḣ":"ḣ","ḩ":"ḩ","í":"í","ì":"ì","ï":"ï","ḯ":"ḯ","ĩ":"ĩ","ī":"ī","ĭ":"ĭ","ǐ":"ǐ","î":"î","ǰ":"ǰ","ĵ":"ĵ","ḱ":"ḱ","ǩ":"ǩ","ķ":"ķ","ĺ":"ĺ","ľ":"ľ","ļ":"ļ","ḿ":"ḿ","ṁ":"ṁ","ń":"ń","ǹ":"ǹ","ñ":"ñ","ň":"ň","ṅ":"ṅ","ņ":"ņ","ó":"ó","ò":"ò","ö":"ö","ȫ":"ȫ","õ":"õ","ṍ":"ṍ","ṏ":"ṏ","ȭ":"ȭ","ō":"ō","ṓ":"ṓ","ṑ":"ṑ","ŏ":"ŏ","ǒ":"ǒ","ô":"ô","ố":"ố","ồ":"ồ","ỗ":"ỗ","ȯ":"ȯ","ȱ":"ȱ","ő":"ő","ṕ":"ṕ","ṗ":"ṗ","ŕ":"ŕ","ř":"ř","ṙ":"ṙ","ŗ":"ŗ","ś":"ś","ṥ":"ṥ","š":"š","ṧ":"ṧ","ŝ":"ŝ","ṡ":"ṡ","ş":"ş","ẗ":"ẗ","ť":"ť","ṫ":"ṫ","ţ":"ţ","ú":"ú","ù":"ù","ü":"ü","ǘ":"ǘ","ǜ":"ǜ","ǖ":"ǖ","ǚ":"ǚ","ũ":"ũ","ṹ":"ṹ","ū":"ū","ṻ":"ṻ","ŭ":"ŭ","ǔ":"ǔ","û":"û","ů":"ů","ű":"ű","ṽ":"ṽ","ẃ":"ẃ","ẁ":"ẁ","ẅ":"ẅ","ŵ":"ŵ","ẇ":"ẇ","ẘ":"ẘ","ẍ":"ẍ","ẋ":"ẋ","ý":"ý","ỳ":"ỳ","ÿ":"ÿ","ỹ":"ỹ","ȳ":"ȳ","ŷ":"ŷ","ẏ":"ẏ","ẙ":"ẙ","ź":"ź","ž":"ž","ẑ":"ẑ","ż":"ż","Á":"Á","À":"À","Ä":"Ä","Ǟ":"Ǟ","Ã":"Ã","Ā":"Ā","Ă":"Ă","Ắ":"Ắ","Ằ":"Ằ","Ẵ":"Ẵ","Ǎ":"Ǎ","Â":"Â","Ấ":"Ấ","Ầ":"Ầ","Ẫ":"Ẫ","Ȧ":"Ȧ","Ǡ":"Ǡ","Å":"Å","Ǻ":"Ǻ","Ḃ":"Ḃ","Ć":"Ć","Ḉ":"Ḉ","Č":"Č","Ĉ":"Ĉ","Ċ":"Ċ","Ç":"Ç","Ď":"Ď","Ḋ":"Ḋ","Ḑ":"Ḑ","É":"É","È":"È","Ë":"Ë","Ẽ":"Ẽ","Ē":"Ē","Ḗ":"Ḗ","Ḕ":"Ḕ","Ĕ":"Ĕ","Ḝ":"Ḝ","Ě":"Ě","Ê":"Ê","Ế":"Ế","Ề":"Ề","Ễ":"Ễ","Ė":"Ė","Ȩ":"Ȩ","Ḟ":"Ḟ","Ǵ":"Ǵ","Ḡ":"Ḡ","Ğ":"Ğ","Ǧ":"Ǧ","Ĝ":"Ĝ","Ġ":"Ġ","Ģ":"Ģ","Ḧ":"Ḧ","Ȟ":"Ȟ","Ĥ":"Ĥ","Ḣ":"Ḣ","Ḩ":"Ḩ","Í":"Í","Ì":"Ì","Ï":"Ï","Ḯ":"Ḯ","Ĩ":"Ĩ","Ī":"Ī","Ĭ":"Ĭ","Ǐ":"Ǐ","Î":"Î","İ":"İ","Ĵ":"Ĵ","Ḱ":"Ḱ","Ǩ":"Ǩ","Ķ":"Ķ","Ĺ":"Ĺ","Ľ":"Ľ","Ļ":"Ļ","Ḿ":"Ḿ","Ṁ":"Ṁ","Ń":"Ń","Ǹ":"Ǹ","Ñ":"Ñ","Ň":"Ň","Ṅ":"Ṅ","Ņ":"Ņ","Ó":"Ó","Ò":"Ò","Ö":"Ö","Ȫ":"Ȫ","Õ":"Õ","Ṍ":"Ṍ","Ṏ":"Ṏ","Ȭ":"Ȭ","Ō":"Ō","Ṓ":"Ṓ","Ṑ":"Ṑ","Ŏ":"Ŏ","Ǒ":"Ǒ","Ô":"Ô","Ố":"Ố","Ồ":"Ồ","Ỗ":"Ỗ","Ȯ":"Ȯ","Ȱ":"Ȱ","Ő":"Ő","Ṕ":"Ṕ","Ṗ":"Ṗ","Ŕ":"Ŕ","Ř":"Ř","Ṙ":"Ṙ","Ŗ":"Ŗ","Ś":"Ś","Ṥ":"Ṥ","Š":"Š","Ṧ":"Ṧ","Ŝ":"Ŝ","Ṡ":"Ṡ","Ş":"Ş","Ť":"Ť","Ṫ":"Ṫ","Ţ":"Ţ","Ú":"Ú","Ù":"Ù","Ü":"Ü","Ǘ":"Ǘ","Ǜ":"Ǜ","Ǖ":"Ǖ","Ǚ":"Ǚ","Ũ":"Ũ","Ṹ":"Ṹ","Ū":"Ū","Ṻ":"Ṻ","Ŭ":"Ŭ","Ǔ":"Ǔ","Û":"Û","Ů":"Ů","Ű":"Ű","Ṽ":"Ṽ","Ẃ":"Ẃ","Ẁ":"Ẁ","Ẅ":"Ẅ","Ŵ":"Ŵ","Ẇ":"Ẇ","Ẍ":"Ẍ","Ẋ":"Ẋ","Ý":"Ý","Ỳ":"Ỳ","Ÿ":"Ÿ","Ỹ":"Ỹ","Ȳ":"Ȳ","Ŷ":"Ŷ","Ẏ":"Ẏ","Ź":"Ź","Ž":"Ž","Ẑ":"Ẑ","Ż":"Ż","ά":"ά","ὰ":"ὰ","ᾱ":"ᾱ","ᾰ":"ᾰ","έ":"έ","ὲ":"ὲ","ή":"ή","ὴ":"ὴ","ί":"ί","ὶ":"ὶ","ϊ":"ϊ","ΐ":"ΐ","ῒ":"ῒ","ῑ":"ῑ","ῐ":"ῐ","ό":"ό","ὸ":"ὸ","ύ":"ύ","ὺ":"ὺ","ϋ":"ϋ","ΰ":"ΰ","ῢ":"ῢ","ῡ":"ῡ","ῠ":"ῠ","ώ":"ώ","ὼ":"ὼ","Ύ":"Ύ","Ὺ":"Ὺ","Ϋ":"Ϋ","Ῡ":"Ῡ","Ῠ":"Ῠ","Ώ":"Ώ","Ὼ":"Ὼ"},Li=class e{constructor(e,t){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new Ii(e,t,this.mode),this.settings=t,this.leftrightDepth=0,this.nextToken=null}expect(e,t){if(void 0===t&&(t=!0),this.fetch().text!==e)throw new kt("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());t&&this.consume()}consume(){this.nextToken=null}fetch(){return null==this.nextToken&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var t=this.nextToken;this.consume(),this.gullet.pushToken(new Do("}")),this.gullet.pushTokens(e);var r=this.parseExpression(!1);return this.expect("}"),this.nextToken=t,r}parseExpression(t,r){for(var n=[];;){"math"===this.mode&&this.consumeSpaces();var a=this.fetch();if(e.endOfExpression.has(a.text))break;if(r&&a.text===r)break;if(t&&gi[a.text]&&gi[a.text].infix)break;var o=this.parseAtom(r);if(!o)break;"internal"!==o.type&&n.push(o)}return"text"===this.mode&&this.formLigatures(n),this.handleInfixNodes(n)}handleInfixNodes(e){for(var t,r=-1,n=0;n<e.length;n++){var a=e[n];if("infix"===a.type){if(-1!==r)throw new kt("only one infix operator per group",a.token);r=n,t=a.replaceWith}}if(-1!==r&&t){var o,i,s=e.slice(0,r),l=e.slice(r+1);return o=1===s.length&&"ordgroup"===s[0].type?s[0]:{type:"ordgroup",mode:this.mode,body:s},i=1===l.length&&"ordgroup"===l[0].type?l[0]:{type:"ordgroup",mode:this.mode,body:l},["\\\\abovefrac"===t?this.callFunction(t,[o,e[r],i],[]):this.callFunction(t,[o,i],[])]}return e}handleSupSubscript(e){var t,r=this.fetch(),n=r.text;this.consume(),this.consumeSpaces();do{var a;t=this.parseGroup(e)}while("internal"===(null==(a=t)?void 0:a.type));if(!t)throw new kt("Expected group after '"+n+"'",r);return t}formatUnsupportedCmd(e){for(var t=[],r=0;r<e.length;r++)t.push({type:"textord",mode:"text",text:e[r]});var n={type:"text",mode:this.mode,body:t};return{type:"color",mode:this.mode,color:this.settings.errorColor,body:[n]}}parseAtom(e){var t,r,n=this.parseGroup("atom",e);if("internal"===(null==n?void 0:n.type))return n;if("text"===this.mode)return n;for(;;){this.consumeSpaces();var a=this.fetch();if("\\limits"===a.text||"\\nolimits"===a.text){if(n&&"op"===n.type)n.limits="\\limits"===a.text,n.alwaysHandleSupSub=!0;else{if(!n||"operatorname"!==n.type)throw new kt("Limit controls must follow a math operator",a);n.alwaysHandleSupSub&&(n.limits="\\limits"===a.text)}this.consume()}else if("^"===a.text){if(t)throw new kt("Double superscript",a);t=this.handleSupSubscript("superscript")}else if("_"===a.text){if(r)throw new kt("Double subscript",a);r=this.handleSupSubscript("subscript")}else if("'"===a.text){if(t)throw new kt("Double superscript",a);var o={type:"textord",mode:this.mode,text:"\\prime"},i=[o];for(this.consume();"'"===this.fetch().text;)i.push(o),this.consume();"^"===this.fetch().text&&i.push(this.handleSupSubscript("superscript")),t={type:"ordgroup",mode:this.mode,body:i}}else{if(!_i[a.text])break;var s=zi.test(a.text),l=[];for(l.push(new Do(_i[a.text])),this.consume();;){var c=this.fetch().text;if(!_i[c])break;if(zi.test(c)!==s)break;l.unshift(new Do(_i[c])),this.consume()}var d=this.subparse(l);s?r={type:"ordgroup",mode:"math",body:d}:t={type:"ordgroup",mode:"math",body:d}}}return t&&r?{type:"supsub",mode:this.mode,base:n,sup:t,sub:r}:t?{type:"supsub",mode:this.mode,base:n,sup:t}:r?{type:"supsub",mode:this.mode,base:n,sub:r}:n}parseFunction(e,t){var r=this.fetch(),n=r.text,a=gi[n];if(!a)return null;if(this.consume(),t&&"atom"!==t&&!a.allowedInArgument)throw new kt("Got function '"+n+"' with no arguments"+(t?" as "+t:""),r);if("text"===this.mode&&!a.allowedInText)throw new kt("Can't use function '"+n+"' in text mode",r);if("math"===this.mode&&!1===a.allowedInMath)throw new kt("Can't use function '"+n+"' in math mode",r);var o=this.parseArguments(n,a),i=o.args,s=o.optArgs;return this.callFunction(n,i,s,r,e)}callFunction(e,t,r,n,a){var o={funcName:e,parser:this,token:n,breakOnTokenText:a},i=gi[e];if(i&&i.handler)return i.handler(o,t,r);throw new kt("No function handler for "+e)}parseArguments(e,t){var r,n=null!=(r=t.numOptionalArgs)?r:0,a=t.numArgs+n;if(0===a)return{args:[],optArgs:[]};for(var o=[],i=[],s=0;s<a;s++){var l,c=null==(l=t.argTypes)?void 0:l[s],d=s<n;("primitive"in t&&t.primitive&&null==c||"sqrt"===t.type&&1===s&&null==i[0])&&(c="primitive");var u=this.parseGroupOfType("argument to '"+e+"'",c,d);if(d)i.push(u);else{if(null==u)throw new kt("Null argument, please report this as a bug");o.push(u)}}return{args:o,optArgs:i}}parseGroupOfType(e,t,r){switch(t){case"color":return this.parseColorGroup(r);case"size":return this.parseSizeGroup(r);case"url":return this.parseUrlGroup(r);case"math":case"text":return this.parseArgumentGroup(r,t);case"hbox":var n=this.parseArgumentGroup(r,"text");return null!=n?{type:"styling",mode:n.mode,body:[n],style:"text",resetFont:!0}:null;case"raw":var a=this.parseStringGroup(r);return null!=a?{type:"raw",mode:"text",string:a.text}:null;case"primitive":if(r)throw new kt("A primitive argument cannot be optional");var o=this.parseGroup(e);if(null==o)throw new kt("Expected group as "+e,this.fetch());return o;case"original":case void 0:return this.parseArgumentGroup(r);default:throw new kt("Unknown group type as "+e,this.fetch())}}consumeSpaces(){for(;" "===this.fetch().text;)this.consume()}parseStringGroup(e){var t=this.gullet.scanArgument(e);if(null==t)return null;for(var r,n="";"EOF"!==(r=this.fetch()).text;)n+=r.text,this.consume();return this.consume(),t.text=n,t}parseRegexGroup(e,t){for(var r,n=this.fetch(),a=n,o="";"EOF"!==(r=this.fetch()).text&&e.test(o+r.text);)o+=(a=r).text,this.consume();if(""===o)throw new kt("Invalid "+t+": '"+n.text+"'",n);return n.range(a,o)}parseColorGroup(e){var t=this.parseStringGroup(e);if(null==t)return null;var r=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(t.text);if(!r)throw new kt("Invalid color: '"+t.text+"'",t);var n=r[0];return/^[0-9a-f]{6}$/i.test(n)&&(n="#"+n),{type:"color-token",mode:this.mode,color:n}}parseSizeGroup(e){var t,r=!1;if(this.gullet.consumeSpaces(),!(t=e||"{"===this.gullet.future().text?this.parseStringGroup(e):this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size")))return null;e||0!==t.text.length||(t.text="0pt",r=!0);var n=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t.text);if(!n)throw new kt("Invalid size: '"+t.text+"'",t);var a={number:+(n[1]+n[2]),unit:n[3]};if(!er(a))throw new kt("Invalid unit: '"+a.unit+"'",t);return{type:"size",mode:this.mode,value:a,isBlank:r}}parseUrlGroup(e){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var t=this.parseStringGroup(e);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),null==t)return null;var r=t.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:r}}parseArgumentGroup(e,t){var r=this.gullet.scanArgument(e);if(null==r)return null;var n=this.mode;t&&this.switchMode(t),this.gullet.beginGroup();var a=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var o={type:"ordgroup",mode:this.mode,loc:r.loc,body:a};return t&&this.switchMode(n),o}parseGroup(e,t){var r,n=this.fetch(),a=n.text;if("{"===a||"\\begingroup"===a){this.consume();var o="{"===a?"}":"\\endgroup";this.gullet.beginGroup();var i=this.parseExpression(!1,o),s=this.fetch();this.expect(o),this.gullet.endGroup(),r={type:"ordgroup",mode:this.mode,loc:Ro.range(n,s),body:i,semisimple:"\\begingroup"===a||void 0}}else if(null==(r=this.parseFunction(t,e)||this.parseSymbol())&&"\\"===a[0]&&!Object.prototype.hasOwnProperty.call(Di,a)){if(this.settings.throwOnError)throw new kt("Undefined control sequence: "+a,n);r=this.formatUnsupportedCmd(a),this.consume()}return r}formLigatures(e){for(var t=e.length-1,r=0;r<t;++r){var n=e[r];if("textord"===n.type){var a=n.text,o=e[r+1];if(o&&"textord"===o.type){if("-"===a&&"-"===o.text){var i=e[r+2];r+1<t&&i&&"textord"===i.type&&"-"===i.text?(e.splice(r,3,{type:"textord",mode:"text",loc:Ro.range(n,i),text:"---"}),t-=2):(e.splice(r,2,{type:"textord",mode:"text",loc:Ro.range(n,o),text:"--"}),t-=1)}"'"!==a&&"`"!==a||o.text!==a||(e.splice(r,2,{type:"textord",mode:"text",loc:Ro.range(n,o),text:a+a}),t-=1)}}}}parseSymbol(){var e=this.fetch(),t=e.text;if(/^\\verb[^a-zA-Z]/.test(t)){this.consume();var r=t.slice(5),n="*"===r.charAt(0);if(n&&(r=r.slice(1)),r.length<2||r.charAt(0)!==r.slice(-1))throw new kt("\\verb assertion failed --\n please report what input caused this bug");return{type:"verb",mode:"text",body:r=r.slice(1,-1),star:n}}Object.prototype.hasOwnProperty.call(Oi,t[0])&&!Sr[this.mode][t[0]]&&(this.settings.strict&&"math"===this.mode&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+t[0]+'" used in math mode',e),t=Oi[t[0]]+t.slice(1));var a,o=bi.exec(t);if(o&&("i"===(t=t.substring(0,o.index))?t="ı":"j"===t&&(t="ȷ")),Sr[this.mode][t]){this.settings.strict&&"math"===this.mode&&en.includes(t)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+t[0]+'" used in math mode',e);var i,s=Sr[this.mode][t].group,l=Ro.range(e);i=function(e){return Da.has(e)}(s)?{type:"atom",mode:this.mode,family:s,loc:l,text:t}:{type:s,mode:this.mode,loc:l,text:t},a=i}else{if(!(t.charCodeAt(0)>=128))return null;this.settings.strict&&(Wt(t.charCodeAt(0))?"math"===this.mode&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+t[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+t[0]+'" ('+t.charCodeAt(0)+")",e)),a={type:"textord",mode:"text",loc:Ro.range(e),text:t}}if(this.consume(),o)for(var c=0;c<o[0].length;c++){var d=o[0][c];if(!Pi[d])throw new kt("Unknown accent ' "+d+"'",e);var u=Pi[d][this.mode]||Pi[d].text;if(!u)throw new kt("Accent "+d+" unsupported in "+this.mode+" mode",e);a={type:"accent",mode:this.mode,loc:Ro.range(e),label:u,isStretchy:!1,isShifty:!0,base:a}}return a}};Li.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var Fi=function(e,t){if(!("string"==typeof e||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var r=new Li(e,t);delete r.gullet.macros.current["\\df@tag"];var n=r.parse();if(delete r.gullet.macros.current["\\current@color"],delete r.gullet.macros.current["\\color"],r.gullet.macros.get("\\df@tag")){if(!t.displayMode)throw new kt("\\tag works only in display equations");n=[{type:"tag",mode:"text",body:n,tag:r.subparse([new Do("\\df@tag")])}]}return n},Bi=function(e,t,r){t.textContent="";var n=Vi(e,r).toNode();t.appendChild(n)};"undefined"!=typeof document&&"CSS1Compat"!==document.compatMode&&(Bi=function(){throw new kt("KaTeX doesn't work in quirks mode.")});var Hi=function(e,t,r){if(r.throwOnError||!(e instanceof kt))throw e;var n=Cn(["katex-error"],[new pr(t)]);return n.setAttribute("title",e.toString()),n.setAttribute("style","color:"+r.errorColor),n},Vi=function(e,t){var r=new _t(t);try{return function(e,t,r){var n,a=ja(r);return"mathml"===r.output?ba(e,t,a,r.displayMode,!0):(n="html"===r.output?Cn(["katex"],[oa(e,a)]):Cn(["katex"],[ba(e,t,a,r.displayMode,!1),oa(e,a)]),Ta(n,r))}(Fi(e,r),e,r)}catch(n){return Hi(n,e,r)}},$i={version:"0.18.7",render:Bi,renderToString:function(e,t){return Vi(e,t).toMarkup()},ParseError:kt,SETTINGS_SCHEMA:Dt,__parse:function(e,t){return Fi(e,new _t(t))},__renderToDomTree:Vi,__renderToHTMLTree:function(e,t){var r=new _t(t);try{return function(e,t,r){return Ta(Cn(["katex"],[oa(e,ja(r))]),r)}(Fi(e,r),0,r)}catch(n){return Hi(n,e,r)}},__setFontMetrics:function(e,t){xr[e]=t},__defineSymbol:kr,__defineFunction:$n,__defineMacro:Ao,__domTree:{Span:cr,Anchor:dr,SymbolNode:pr,SvgNode:mr,PathNode:fr,LineNode:gr}};$i.__defineMacro("\\ce",function(e){return qi(e.consumeArgs(1)[0],"ce")}),$i.__defineMacro("\\pu",function(e){return qi(e.consumeArgs(1)[0],"pu")}),$i.__defineMacro("\\tripledash","{\\vphantom{-}\\raisebox{2.56mu}{$\\mkern2mu\\tiny\\text{-}\\mkern1mu\\text{-}\\mkern1mu\\text{-}\\mkern2mu$}}");var qi=function(e,t){for(var r="",n=e.length&&e[e.length-1].loc.start,a=e.length-1;a>=0;a--)e[a].loc.start>n&&(r+=" ",n=e[a].loc.start),r+=e[a].text,n+=e[a].text.length;return Gi.go(Ui.go(r,t))},Ui={go:function(e,t){if(!e)return[];void 0===t&&(t="ce");var r,n="0",a={};a.parenthesisLevel=0,e=(e=(e=e.replace(/\n/g," ")).replace(/[\u2212\u2013\u2014\u2010]/g,"-")).replace(/[\u2026]/g,"...");for(var o=10,i=[];;){r!==e?(o=10,r=e):o--;var s=Ui.stateMachines[t],l=s.transitions[n]||s.transitions["*"];e:for(var c=0;c<l.length;c++){var d=Ui.patterns.match_(l[c].pattern,e);if(d){for(var u=l[c].task,h=0;h<u.action_.length;h++){var p;if(s.actions[u.action_[h].type_])p=s.actions[u.action_[h].type_](a,d.match_,u.action_[h].option);else{if(!Ui.actions[u.action_[h].type_])throw["MhchemBugA","mhchem bug A. Please report. ("+u.action_[h].type_+")"];p=Ui.actions[u.action_[h].type_](a,d.match_,u.action_[h].option)}Ui.concatArray(i,p)}if(n=u.nextState||n,!(e.length>0))return i;if(u.revisit||(e=d.remainder),!u.toContinue)break e}}if(o<=0)throw["MhchemBugU","mhchem bug U. Please report."]}},concatArray:function(e,t){if(t)if(Array.isArray(t))for(var r=0;r<t.length;r++)e.push(t[r]);else e.push(t)},patterns:{patterns:{empty:/^$/,else:/^./,else2:/^./,space:/^\s/,"space A":/^\s(?=[A-Z\\$])/,space$:/^\s$/,"a-z":/^[a-z]/,x:/^x/,x$:/^x$/,i$:/^i$/,letters:/^(?:[a-zA-Z\u03B1-\u03C9\u0391-\u03A9?@]|(?:\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))))+/,"\\greek":/^\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))/,"one lowercase latin letter $":/^(?:([a-z])(?:$|[^a-zA-Z]))$/,"$one lowercase latin letter$ $":/^\$(?:([a-z])(?:$|[^a-zA-Z]))\$$/,"one lowercase greek letter $":/^(?:\$?[\u03B1-\u03C9]\$?|\$?\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega)\s*\$?)(?:\s+|\{\}|(?![a-zA-Z]))$/,digits:/^[0-9]+/,"-9.,9":/^[+\-]?(?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))/,"-9.,9 no missing 0":/^[+\-]?[0-9]+(?:[.,][0-9]+)?/,"(-)(9.,9)(e)(99)":function(e){var t=e.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))?(\((?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))\))?(?:([eE]|\s*(\*|x|\\times|\u00D7)\s*10\^)([+\-]?[0-9]+|\{[+\-]?[0-9]+\}))?/);return t&&t[0]?{match_:t.splice(1),remainder:e.substr(t[0].length)}:null},"(-)(9)^(-9)":function(e){var t=e.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+)?)\^([+\-]?[0-9]+|\{[+\-]?[0-9]+\})/);return t&&t[0]?{match_:t.splice(1),remainder:e.substr(t[0].length)}:null},"state of aggregation $":function(e){var t=Ui.patterns.findObserveGroups(e,"",/^\([a-z]{1,3}(?=[\),])/,")","");if(t&&t.remainder.match(/^($|[\s,;\)\]\}])/))return t;var r=e.match(/^(?:\((?:\\ca\s?)?\$[amothc]\$\))/);return r?{match_:r[0],remainder:e.substr(r[0].length)}:null},"_{(state of aggregation)}$":/^_\{(\([a-z]{1,3}\))\}/,"{[(":/^(?:\\\{|\[|\()/,")]}":/^(?:\)|\]|\\\})/,", ":/^[,;]\s*/,",":/^[,;]/,".":/^[.]/,". ":/^([.\u22C5\u00B7\u2022])\s*/,"...":/^\.\.\.(?=$|[^.])/,"* ":/^([*])\s*/,"^{(...)}":function(e){return Ui.patterns.findObserveGroups(e,"^{","","","}")},"^($...$)":function(e){return Ui.patterns.findObserveGroups(e,"^","$","$","")},"^a":/^\^([0-9]+|[^\\_])/,"^\\x{}{}":function(e){return Ui.patterns.findObserveGroups(e,"^",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"^\\x{}":function(e){return Ui.patterns.findObserveGroups(e,"^",/^\\[a-zA-Z]+\{/,"}","")},"^\\x":/^\^(\\[a-zA-Z]+)\s*/,"^(-1)":/^\^(-?\d+)/,"'":/^'/,"_{(...)}":function(e){return Ui.patterns.findObserveGroups(e,"_{","","","}")},"_($...$)":function(e){return Ui.patterns.findObserveGroups(e,"_","$","$","")},_9:/^_([+\-]?[0-9]+|[^\\])/,"_\\x{}{}":function(e){return Ui.patterns.findObserveGroups(e,"_",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"_\\x{}":function(e){return Ui.patterns.findObserveGroups(e,"_",/^\\[a-zA-Z]+\{/,"}","")},"_\\x":/^_(\\[a-zA-Z]+)\s*/,"^_":/^(?:\^(?=_)|\_(?=\^)|[\^_]$)/,"{}":/^\{\}/,"{...}":function(e){return Ui.patterns.findObserveGroups(e,"","{","}","")},"{(...)}":function(e){return Ui.patterns.findObserveGroups(e,"{","","","}")},"$...$":function(e){return Ui.patterns.findObserveGroups(e,"","$","$","")},"${(...)}$":function(e){return Ui.patterns.findObserveGroups(e,"${","","","}$")},"$(...)$":function(e){return Ui.patterns.findObserveGroups(e,"$","","","$")},"=<>":/^[=<>]/,"#":/^[#\u2261]/,"+":/^\+/,"-$":/^-(?=[\s_},;\]/]|$|\([a-z]+\))/,"-9":/^-(?=[0-9])/,"- orbital overlap":/^-(?=(?:[spd]|sp)(?:$|[\s,;\)\]\}]))/,"-":/^-/,"pm-operator":/^(?:\\pm|\$\\pm\$|\+-|\+\/-)/,operator:/^(?:\+|(?:[\-=<>]|<<|>>|\\approx|\$\\approx\$)(?=\s|$|-?[0-9]))/,arrowUpDown:/^(?:v|\(v\)|\^|\(\^\))(?=$|[\s,;\)\]\}])/,"\\bond{(...)}":function(e){return Ui.patterns.findObserveGroups(e,"\\bond{","","","}")},"->":/^(?:<->|<-->|->|<-|<=>>|<<=>|<=>|[\u2192\u27F6\u21CC])/,CMT:/^[CMT](?=\[)/,"[(...)]":function(e){return Ui.patterns.findObserveGroups(e,"[","","","]")},"1st-level escape":/^(&|\\\\|\\hline)\s*/,"\\,":/^(?:\\[,\ ;:])/,"\\x{}{}":function(e){return Ui.patterns.findObserveGroups(e,"",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"\\x{}":function(e){return Ui.patterns.findObserveGroups(e,"",/^\\[a-zA-Z]+\{/,"}","")},"\\ca":/^\\ca(?:\s+|(?![a-zA-Z]))/,"\\x":/^(?:\\[a-zA-Z]+\s*|\\[_&{}%])/,orbital:/^(?:[0-9]{1,2}[spdfgh]|[0-9]{0,2}sp)(?=$|[^a-zA-Z])/,others:/^[\/~|]/,"\\frac{(...)}":function(e){return Ui.patterns.findObserveGroups(e,"\\frac{","","","}","{","","","}")},"\\overset{(...)}":function(e){return Ui.patterns.findObserveGroups(e,"\\overset{","","","}","{","","","}")},"\\underset{(...)}":function(e){return Ui.patterns.findObserveGroups(e,"\\underset{","","","}","{","","","}")},"\\underbrace{(...)}":function(e){return Ui.patterns.findObserveGroups(e,"\\underbrace{","","","}_","{","","","}")},"\\color{(...)}0":function(e){return Ui.patterns.findObserveGroups(e,"\\color{","","","}")},"\\color{(...)}{(...)}1":function(e){return Ui.patterns.findObserveGroups(e,"\\color{","","","}","{","","","}")},"\\color(...){(...)}2":function(e){return Ui.patterns.findObserveGroups(e,"\\color","\\","",/^(?=\{)/,"{","","","}")},"\\ce{(...)}":function(e){return Ui.patterns.findObserveGroups(e,"\\ce{","","","}")},oxidation$:/^(?:[+-][IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,"d-oxidation$":/^(?:[+-]?\s?[IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,"roman numeral":/^[IVX]+/,"1/2$":/^[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+(?:\$[a-z]\$|[a-z])?$/,amount:function(e){var t=e.match(/^(?:(?:(?:\([+\-]?[0-9]+\/[0-9]+\)|[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+|[+\-]?[0-9]+[.,][0-9]+|[+\-]?\.[0-9]+|[+\-]?[0-9]+)(?:[a-z](?=\s*[A-Z]))?)|[+\-]?[a-z](?=\s*[A-Z])|\+(?!\s))/);if(t)return{match_:t[0],remainder:e.substr(t[0].length)};var r=Ui.patterns.findObserveGroups(e,"","$","$","");return r&&(t=r.match_.match(/^\$(?:\(?[+\-]?(?:[0-9]*[a-z]?[+\-])?[0-9]*[a-z](?:[+\-][0-9]*[a-z]?)?\)?|\+|-)\$$/))?{match_:t[0],remainder:e.substr(t[0].length)}:null},amount2:function(e){return this.amount(e)},"(KV letters),":/^(?:[A-Z][a-z]{0,2}|i)(?=,)/,formula$:function(e){if(e.match(/^\([a-z]+\)$/))return null;var t=e.match(/^(?:[a-z]|(?:[0-9\ \+\-\,\.\(\)]+[a-z])+[0-9\ \+\-\,\.\(\)]*|(?:[a-z][0-9\ \+\-\,\.\(\)]+)+[a-z]?)$/);return t?{match_:t[0],remainder:e.substr(t[0].length)}:null},uprightEntities:/^(?:pH|pOH|pC|pK|iPr|iBu)(?=$|[^a-zA-Z])/,"/":/^\s*(\/)\s*/,"//":/^\s*(\/\/)\s*/,"*":/^\s*[*.]\s*/},findObserveGroups:function(e,t,r,n,a,o,i,s,l,c){var d=function(e,t){if("string"==typeof t)return 0!==e.indexOf(t)?null:t;var r=e.match(t);return r?r[0]:null},u=d(e,t);if(null===u)return null;if(e=e.substr(u.length),null===(u=d(e,r)))return null;var h=function(e,t,r){for(var n=0;t<e.length;){var a=e.charAt(t),o=d(e.substr(t),r);if(null!==o&&0===n)return{endMatchBegin:t,endMatchEnd:t+o.length};if("{"===a)n++;else if("}"===a){if(0===n)throw["ExtraCloseMissingOpen","Extra close brace or missing open brace"];n--}t++}return null}(e,u.length,n||a);if(null===h)return null;var p=e.substring(0,n?h.endMatchEnd:h.endMatchBegin);if(o||i){var m=this.findObserveGroups(e.substr(h.endMatchEnd),o,i,s,l);if(null===m)return null;var f=[p,m.match_];return{match_:c?f.join(""):f,remainder:m.remainder}}return{match_:p,remainder:e.substr(h.endMatchEnd)}},match_:function(e,t){var r=Ui.patterns.patterns[e];if(void 0===r)throw["MhchemBugP","mhchem bug P. Please report. ("+e+")"];if("function"==typeof r)return Ui.patterns.patterns[e](t);var n=t.match(r);return n?{match_:n[2]?[n[1],n[2]]:n[1]?n[1]:n[0],remainder:t.substr(n[0].length)}:null}},actions:{"a=":function(e,t){e.a=(e.a||"")+t},"b=":function(e,t){e.b=(e.b||"")+t},"p=":function(e,t){e.p=(e.p||"")+t},"o=":function(e,t){e.o=(e.o||"")+t},"q=":function(e,t){e.q=(e.q||"")+t},"d=":function(e,t){e.d=(e.d||"")+t},"rm=":function(e,t){e.rm=(e.rm||"")+t},"text=":function(e,t){e.text_=(e.text_||"")+t},insert:function(e,t,r){return{type_:r}},"insert+p1":function(e,t,r){return{type_:r,p1:t}},"insert+p1+p2":function(e,t,r){return{type_:r,p1:t[0],p2:t[1]}},copy:function(e,t){return t},rm:function(e,t){return{type_:"rm",p1:t||""}},text:function(e,t){return Ui.go(t,"text")},"{text}":function(e,t){var r=["{"];return Ui.concatArray(r,Ui.go(t,"text")),r.push("}"),r},"tex-math":function(e,t){return Ui.go(t,"tex-math")},"tex-math tight":function(e,t){return Ui.go(t,"tex-math tight")},bond:function(e,t,r){return{type_:"bond",kind_:r||t}},"color0-output":function(e,t){return{type_:"color0",color:t[0]}},ce:function(e,t){return Ui.go(t)},"1/2":function(e,t){var r=[];t.match(/^[+\-]/)&&(r.push(t.substr(0,1)),t=t.substr(1));var n=t.match(/^([0-9]+|\$[a-z]\$|[a-z])\/([0-9]+)(\$[a-z]\$|[a-z])?$/);return n[1]=n[1].replace(/\$/g,""),r.push({type_:"frac",p1:n[1],p2:n[2]}),n[3]&&(n[3]=n[3].replace(/\$/g,""),r.push({type_:"tex-math",p1:n[3]})),r},"9,9":function(e,t){return Ui.go(t,"9,9")}},createTransitions:function(e){var t,r,n,a,o={};for(t in e)for(r in e[t])for(n=r.split("|"),e[t][r].stateArray=n,a=0;a<n.length;a++)o[n[a]]=[];for(t in e)for(r in e[t])for(n=e[t][r].stateArray||[],a=0;a<n.length;a++){var i=e[t][r];if(i.action_){i.action_=[].concat(i.action_);for(var s=0;s<i.action_.length;s++)"string"==typeof i.action_[s]&&(i.action_[s]={type_:i.action_[s]})}else i.action_=[];for(var l=t.split("|"),c=0;c<l.length;c++)if("*"===n[a])for(var d in o)o[d].push({pattern:l[c],task:i});else o[n[a]].push({pattern:l[c],task:i})}return o},stateMachines:{}};Ui.stateMachines={ce:{transitions:Ui.createTransitions({empty:{"*":{action_:"output"}},else:{"0|1|2":{action_:"beginsWithBond=false",revisit:!0,toContinue:!0}},oxidation$:{0:{action_:"oxidation-output"}},CMT:{r:{action_:"rdt=",nextState:"rt"},rd:{action_:"rqt=",nextState:"rdt"}},arrowUpDown:{"0|1|2|as":{action_:["sb=false","output","operator"],nextState:"1"}},uprightEntities:{"0|1|2":{action_:["o=","output"],nextState:"1"}},orbital:{"0|1|2|3":{action_:"o=",nextState:"o"}},"->":{"0|1|2|3":{action_:"r=",nextState:"r"},"a|as":{action_:["output","r="],nextState:"r"},"*":{action_:["output","r="],nextState:"r"}},"+":{o:{action_:"d= kv",nextState:"d"},"d|D":{action_:"d=",nextState:"d"},q:{action_:"d=",nextState:"qd"},"qd|qD":{action_:"d=",nextState:"qd"},dq:{action_:["output","d="],nextState:"d"},3:{action_:["sb=false","output","operator"],nextState:"0"}},amount:{"0|2":{action_:"a=",nextState:"a"}},"pm-operator":{"0|1|2|a|as":{action_:["sb=false","output",{type_:"operator",option:"\\pm"}],nextState:"0"}},operator:{"0|1|2|a|as":{action_:["sb=false","output","operator"],nextState:"0"}},"-$":{"o|q":{action_:["charge or bond","output"],nextState:"qd"},d:{action_:"d=",nextState:"d"},D:{action_:["output",{type_:"bond",option:"-"}],nextState:"3"},q:{action_:"d=",nextState:"qd"},qd:{action_:"d=",nextState:"qd"},"qD|dq":{action_:["output",{type_:"bond",option:"-"}],nextState:"3"}},"-9":{"3|o":{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"3"}},"- orbital overlap":{o:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"},d:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"}},"-":{"0|1|2":{action_:[{type_:"output",option:1},"beginsWithBond=true",{type_:"bond",option:"-"}],nextState:"3"},3:{action_:{type_:"bond",option:"-"}},a:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"},as:{action_:[{type_:"output",option:2},{type_:"bond",option:"-"}],nextState:"3"},b:{action_:"b="},o:{action_:{type_:"- after o/d",option:!1},nextState:"2"},q:{action_:{type_:"- after o/d",option:!1},nextState:"2"},"d|qd|dq":{action_:{type_:"- after o/d",option:!0},nextState:"2"},"D|qD|p":{action_:["output",{type_:"bond",option:"-"}],nextState:"3"}},amount2:{"1|3":{action_:"a=",nextState:"a"}},letters:{"0|1|2|3|a|as|b|p|bp|o":{action_:"o=",nextState:"o"},"q|dq":{action_:["output","o="],nextState:"o"},"d|D|qd|qD":{action_:"o after d",nextState:"o"}},digits:{o:{action_:"q=",nextState:"q"},"d|D":{action_:"q=",nextState:"dq"},q:{action_:["output","o="],nextState:"o"},a:{action_:"o=",nextState:"o"}},"space A":{"b|p|bp":{}},space:{a:{nextState:"as"},0:{action_:"sb=false"},"1|2":{action_:"sb=true"},"r|rt|rd|rdt|rdq":{action_:"output",nextState:"0"},"*":{action_:["output","sb=true"],nextState:"1"}},"1st-level escape":{"1|2":{action_:["output",{type_:"insert+p1",option:"1st-level escape"}]},"*":{action_:["output",{type_:"insert+p1",option:"1st-level escape"}],nextState:"0"}},"[(...)]":{"r|rt":{action_:"rd=",nextState:"rd"},"rd|rdt":{action_:"rq=",nextState:"rdq"}},"...":{"o|d|D|dq|qd|qD":{action_:["output",{type_:"bond",option:"..."}],nextState:"3"},"*":{action_:[{type_:"output",option:1},{type_:"insert",option:"ellipsis"}],nextState:"1"}},". |* ":{"*":{action_:["output",{type_:"insert",option:"addition compound"}],nextState:"1"}},"state of aggregation $":{"*":{action_:["output","state of aggregation"],nextState:"1"}},"{[(":{"a|as|o":{action_:["o=","output","parenthesisLevel++"],nextState:"2"},"0|1|2|3":{action_:["o=","output","parenthesisLevel++"],nextState:"2"},"*":{action_:["output","o=","output","parenthesisLevel++"],nextState:"2"}},")]}":{"0|1|2|3|b|p|bp|o":{action_:["o=","parenthesisLevel--"],nextState:"o"},"a|as|d|D|q|qd|qD|dq":{action_:["output","o=","parenthesisLevel--"],nextState:"o"}},", ":{"*":{action_:["output","comma"],nextState:"0"}},"^_":{"*":{}},"^{(...)}|^($...$)":{"0|1|2|as":{action_:"b=",nextState:"b"},p:{action_:"b=",nextState:"bp"},"3|o":{action_:"d= kv",nextState:"D"},q:{action_:"d=",nextState:"qD"},"d|D|qd|qD|dq":{action_:["output","d="],nextState:"D"}},"^a|^\\x{}{}|^\\x{}|^\\x|'":{"0|1|2|as":{action_:"b=",nextState:"b"},p:{action_:"b=",nextState:"bp"},"3|o":{action_:"d= kv",nextState:"d"},q:{action_:"d=",nextState:"qd"},"d|qd|D|qD":{action_:"d="},dq:{action_:["output","d="],nextState:"d"}},"_{(state of aggregation)}$":{"d|D|q|qd|qD|dq":{action_:["output","q="],nextState:"q"}},"_{(...)}|_($...$)|_9|_\\x{}{}|_\\x{}|_\\x":{"0|1|2|as":{action_:"p=",nextState:"p"},b:{action_:"p=",nextState:"bp"},"3|o":{action_:"q=",nextState:"q"},"d|D":{action_:"q=",nextState:"dq"},"q|qd|qD|dq":{action_:["output","q="],nextState:"q"}},"=<>":{"0|1|2|3|a|as|o|q|d|D|qd|qD|dq":{action_:[{type_:"output",option:2},"bond"],nextState:"3"}},"#":{"0|1|2|3|a|as|o":{action_:[{type_:"output",option:2},{type_:"bond",option:"#"}],nextState:"3"}},"{}":{"*":{action_:{type_:"output",option:1},nextState:"1"}},"{...}":{"0|1|2|3|a|as|b|p|bp":{action_:"o=",nextState:"o"},"o|d|D|q|qd|qD|dq":{action_:["output","o="],nextState:"o"}},"$...$":{a:{action_:"a="},"0|1|2|3|as|b|p|bp|o":{action_:"o=",nextState:"o"},"as|o":{action_:"o="},"q|d|D|qd|qD|dq":{action_:["output","o="],nextState:"o"}},"\\bond{(...)}":{"*":{action_:[{type_:"output",option:2},"bond"],nextState:"3"}},"\\frac{(...)}":{"*":{action_:[{type_:"output",option:1},"frac-output"],nextState:"3"}},"\\overset{(...)}":{"*":{action_:[{type_:"output",option:2},"overset-output"],nextState:"3"}},"\\underset{(...)}":{"*":{action_:[{type_:"output",option:2},"underset-output"],nextState:"3"}},"\\underbrace{(...)}":{"*":{action_:[{type_:"output",option:2},"underbrace-output"],nextState:"3"}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:[{type_:"output",option:2},"color-output"],nextState:"3"}},"\\color{(...)}0":{"*":{action_:[{type_:"output",option:2},"color0-output"]}},"\\ce{(...)}":{"*":{action_:[{type_:"output",option:2},"ce"],nextState:"3"}},"\\,":{"*":{action_:[{type_:"output",option:1},"copy"],nextState:"1"}},"\\x{}{}|\\x{}|\\x":{"0|1|2|3|a|as|b|p|bp|o|c0":{action_:["o=","output"],nextState:"3"},"*":{action_:["output","o=","output"],nextState:"3"}},others:{"*":{action_:[{type_:"output",option:1},"copy"],nextState:"3"}},else2:{a:{action_:"a to o",nextState:"o",revisit:!0},as:{action_:["output","sb=true"],nextState:"1",revisit:!0},"r|rt|rd|rdt|rdq":{action_:["output"],nextState:"0",revisit:!0},"*":{action_:["output","copy"],nextState:"3"}}}),actions:{"o after d":function(e,t){var r;if((e.d||"").match(/^[0-9]+$/)){var n=e.d;e.d=void 0,r=this.output(e),e.b=n}else r=this.output(e);return Ui.actions["o="](e,t),r},"d= kv":function(e,t){e.d=t,e.dType="kv"},"charge or bond":function(e,t){if(e.beginsWithBond){var r=[];return Ui.concatArray(r,this.output(e)),Ui.concatArray(r,Ui.actions.bond(e,t,"-")),r}e.d=t},"- after o/d":function(e,t,r){var n=Ui.patterns.match_("orbital",e.o||""),a=Ui.patterns.match_("one lowercase greek letter $",e.o||""),o=Ui.patterns.match_("one lowercase latin letter $",e.o||""),i=Ui.patterns.match_("$one lowercase latin letter$ $",e.o||""),s="-"===t&&(n&&""===n.remainder||a||o||i);!s||e.a||e.b||e.p||e.d||e.q||n||!o||(e.o="$"+e.o+"$");var l=[];return s?(Ui.concatArray(l,this.output(e)),l.push({type_:"hyphen"})):(n=Ui.patterns.match_("digits",e.d||""),r&&n&&""===n.remainder?(Ui.concatArray(l,Ui.actions["d="](e,t)),Ui.concatArray(l,this.output(e))):(Ui.concatArray(l,this.output(e)),Ui.concatArray(l,Ui.actions.bond(e,t,"-")))),l},"a to o":function(e){e.o=e.a,e.a=void 0},"sb=true":function(e){e.sb=!0},"sb=false":function(e){e.sb=!1},"beginsWithBond=true":function(e){e.beginsWithBond=!0},"beginsWithBond=false":function(e){e.beginsWithBond=!1},"parenthesisLevel++":function(e){e.parenthesisLevel++},"parenthesisLevel--":function(e){e.parenthesisLevel--},"state of aggregation":function(e,t){return{type_:"state of aggregation",p1:Ui.go(t,"o")}},comma:function(e,t){var r=t.replace(/\s*$/,"");return r!==t&&0===e.parenthesisLevel?{type_:"comma enumeration L",p1:r}:{type_:"comma enumeration M",p1:r}},output:function(e,t,r){var n,a,o;e.r?(a="M"===e.rdt?Ui.go(e.rd,"tex-math"):"T"===e.rdt?[{type_:"text",p1:e.rd||""}]:Ui.go(e.rd),o="M"===e.rqt?Ui.go(e.rq,"tex-math"):"T"===e.rqt?[{type_:"text",p1:e.rq||""}]:Ui.go(e.rq),n={type_:"arrow",r:e.r,rd:a,rq:o}):(n=[],(e.a||e.b||e.p||e.o||e.q||e.d||r)&&(e.sb&&n.push({type_:"entitySkip"}),e.o||e.q||e.d||e.b||e.p||2===r?e.o||e.q||e.d||!e.b&&!e.p?e.o&&"kv"===e.dType&&Ui.patterns.match_("d-oxidation$",e.d||"")?e.dType="oxidation":e.o&&"kv"===e.dType&&!e.q&&(e.dType=void 0):(e.o=e.a,e.d=e.b,e.q=e.p,e.a=e.b=e.p=void 0):(e.o=e.a,e.a=void 0),n.push({type_:"chemfive",a:Ui.go(e.a,"a"),b:Ui.go(e.b,"bd"),p:Ui.go(e.p,"pq"),o:Ui.go(e.o,"o"),q:Ui.go(e.q,"pq"),d:Ui.go(e.d,"oxidation"===e.dType?"oxidation":"bd"),dType:e.dType})));for(var i in e)"parenthesisLevel"!==i&&"beginsWithBond"!==i&&delete e[i];return n},"oxidation-output":function(e,t){var r=["{"];return Ui.concatArray(r,Ui.go(t,"oxidation")),r.push("}"),r},"frac-output":function(e,t){return{type_:"frac-ce",p1:Ui.go(t[0]),p2:Ui.go(t[1])}},"overset-output":function(e,t){return{type_:"overset",p1:Ui.go(t[0]),p2:Ui.go(t[1])}},"underset-output":function(e,t){return{type_:"underset",p1:Ui.go(t[0]),p2:Ui.go(t[1])}},"underbrace-output":function(e,t){return{type_:"underbrace",p1:Ui.go(t[0]),p2:Ui.go(t[1])}},"color-output":function(e,t){return{type_:"color",color1:t[0],color2:Ui.go(t[1])}},"r=":function(e,t){e.r=t},"rdt=":function(e,t){e.rdt=t},"rd=":function(e,t){e.rd=t},"rqt=":function(e,t){e.rqt=t},"rq=":function(e,t){e.rq=t},operator:function(e,t,r){return{type_:"operator",kind_:r||t}}}},a:{transitions:Ui.createTransitions({empty:{"*":{}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"1",revisit:!0}},"$(...)$":{"*":{action_:"tex-math tight",nextState:"1"}},",":{"*":{action_:{type_:"insert",option:"commaDecimal"}}},else2:{"*":{action_:"copy"}}}),actions:{}},o:{transitions:Ui.createTransitions({empty:{"*":{}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"1",revisit:!0}},letters:{"*":{action_:"rm"}},"\\ca":{"*":{action_:{type_:"insert",option:"circa"}}},"\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"{text}"}},else2:{"*":{action_:"copy"}}}),actions:{}},text:{transitions:Ui.createTransitions({empty:{"*":{action_:"output"}},"{...}":{"*":{action_:"text="}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"\\greek":{"*":{action_:["output","rm"]}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:["output","copy"]}},else:{"*":{action_:"text="}}}),actions:{output:function(e){if(e.text_){var t={type_:"text",p1:e.text_};for(var r in e)delete e[r];return t}}}},pq:{transitions:Ui.createTransitions({empty:{"*":{}},"state of aggregation $":{"*":{action_:"state of aggregation"}},i$:{0:{nextState:"!f",revisit:!0}},"(KV letters),":{0:{action_:"rm",nextState:"0"}},formula$:{0:{nextState:"f",revisit:!0}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"!f",revisit:!0}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"text"}},"a-z":{f:{action_:"tex-math"}},letters:{"*":{action_:"rm"}},"-9.,9":{"*":{action_:"9,9"}},",":{"*":{action_:{type_:"insert+p1",option:"comma enumeration S"}}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:"color-output"}},"\\color{(...)}0":{"*":{action_:"color0-output"}},"\\ce{(...)}":{"*":{action_:"ce"}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},else2:{"*":{action_:"copy"}}}),actions:{"state of aggregation":function(e,t){return{type_:"state of aggregation subscript",p1:Ui.go(t,"o")}},"color-output":function(e,t){return{type_:"color",color1:t[0],color2:Ui.go(t[1],"pq")}}}},bd:{transitions:Ui.createTransitions({empty:{"*":{}},x$:{0:{nextState:"!f",revisit:!0}},formula$:{0:{nextState:"f",revisit:!0}},else:{0:{nextState:"!f",revisit:!0}},"-9.,9 no missing 0":{"*":{action_:"9,9"}},".":{"*":{action_:{type_:"insert",option:"electron dot"}}},"a-z":{f:{action_:"tex-math"}},x:{"*":{action_:{type_:"insert",option:"KV x"}}},letters:{"*":{action_:"rm"}},"'":{"*":{action_:{type_:"insert",option:"prime"}}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"text"}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:"color-output"}},"\\color{(...)}0":{"*":{action_:"color0-output"}},"\\ce{(...)}":{"*":{action_:"ce"}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},else2:{"*":{action_:"copy"}}}),actions:{"color-output":function(e,t){return{type_:"color",color1:t[0],color2:Ui.go(t[1],"bd")}}}},oxidation:{transitions:Ui.createTransitions({empty:{"*":{}},"roman numeral":{"*":{action_:"roman-numeral"}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},else:{"*":{action_:"copy"}}}),actions:{"roman-numeral":function(e,t){return{type_:"roman numeral",p1:t||""}}}},"tex-math":{transitions:Ui.createTransitions({empty:{"*":{action_:"output"}},"\\ce{(...)}":{"*":{action_:["output","ce"]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"o="}},else:{"*":{action_:"o="}}}),actions:{output:function(e){if(e.o){var t={type_:"tex-math",p1:e.o};for(var r in e)delete e[r];return t}}}},"tex-math tight":{transitions:Ui.createTransitions({empty:{"*":{action_:"output"}},"\\ce{(...)}":{"*":{action_:["output","ce"]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"o="}},"-|+":{"*":{action_:"tight operator"}},else:{"*":{action_:"o="}}}),actions:{"tight operator":function(e,t){e.o=(e.o||"")+"{"+t+"}"},output:function(e){if(e.o){var t={type_:"tex-math",p1:e.o};for(var r in e)delete e[r];return t}}}},"9,9":{transitions:Ui.createTransitions({empty:{"*":{}},",":{"*":{action_:"comma"}},else:{"*":{action_:"copy"}}}),actions:{comma:function(){return{type_:"commaDecimal"}}}},pu:{transitions:Ui.createTransitions({empty:{"*":{action_:"output"}},space$:{"*":{action_:["output","space"]}},"{[(|)]}":{"0|a":{action_:"copy"}},"(-)(9)^(-9)":{0:{action_:"number^",nextState:"a"}},"(-)(9.,9)(e)(99)":{0:{action_:"enumber",nextState:"a"}},space:{"0|a":{}},"pm-operator":{"0|a":{action_:{type_:"operator",option:"\\pm"},nextState:"0"}},operator:{"0|a":{action_:"copy",nextState:"0"}},"//":{d:{action_:"o=",nextState:"/"}},"/":{d:{action_:"o=",nextState:"/"}},"{...}|else":{"0|d":{action_:"d=",nextState:"d"},a:{action_:["space","d="],nextState:"d"},"/|q":{action_:"q=",nextState:"q"}}}),actions:{enumber:function(e,t){var r=[];return"+-"===t[0]||"+/-"===t[0]?r.push("\\pm "):t[0]&&r.push(t[0]),t[1]&&(Ui.concatArray(r,Ui.go(t[1],"pu-9,9")),t[2]&&(t[2].match(/[,.]/)?Ui.concatArray(r,Ui.go(t[2],"pu-9,9")):r.push(t[2])),t[3]=t[4]||t[3],t[3]&&(t[3]=t[3].trim(),"e"===t[3]||"*"===t[3].substr(0,1)?r.push({type_:"cdot"}):r.push({type_:"times"}))),t[3]&&r.push("10^{"+t[5]+"}"),r},"number^":function(e,t){var r=[];return"+-"===t[0]||"+/-"===t[0]?r.push("\\pm "):t[0]&&r.push(t[0]),Ui.concatArray(r,Ui.go(t[1],"pu-9,9")),r.push("^{"+t[2]+"}"),r},operator:function(e,t,r){return{type_:"operator",kind_:r||t}},space:function(){return{type_:"pu-space-1"}},output:function(e){var t,r=Ui.patterns.match_("{(...)}",e.d||"");r&&""===r.remainder&&(e.d=r.match_);var n=Ui.patterns.match_("{(...)}",e.q||"");if(n&&""===n.remainder&&(e.q=n.match_),e.d&&(e.d=e.d.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),e.d=e.d.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F")),e.q){e.q=e.q.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),e.q=e.q.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F");var a={d:Ui.go(e.d,"pu"),q:Ui.go(e.q,"pu")};"//"===e.o?t={type_:"pu-frac",p1:a.d,p2:a.q}:(t=a.d,a.d.length>1||a.q.length>1?t.push({type_:" / "}):t.push({type_:"/"}),Ui.concatArray(t,a.q))}else t=Ui.go(e.d,"pu-2");for(var o in e)delete e[o];return t}}},"pu-2":{transitions:Ui.createTransitions({empty:{"*":{action_:"output"}},"*":{"*":{action_:["output","cdot"],nextState:"0"}},"\\x":{"*":{action_:"rm="}},space:{"*":{action_:["output","space"],nextState:"0"}},"^{(...)}|^(-1)":{1:{action_:"^(-1)"}},"-9.,9":{0:{action_:"rm=",nextState:"0"},1:{action_:"^(-1)",nextState:"0"}},"{...}|else":{"*":{action_:"rm=",nextState:"1"}}}),actions:{cdot:function(){return{type_:"tight cdot"}},"^(-1)":function(e,t){e.rm+="^{"+t+"}"},space:function(){return{type_:"pu-space-2"}},output:function(e){var t=[];if(e.rm){var r=Ui.patterns.match_("{(...)}",e.rm||"");t=r&&""===r.remainder?Ui.go(r.match_,"pu"):{type_:"rm",p1:e.rm}}for(var n in e)delete e[n];return t}}},"pu-9,9":{transitions:Ui.createTransitions({empty:{0:{action_:"output-0"},o:{action_:"output-o"}},",":{0:{action_:["output-0","comma"],nextState:"o"}},".":{0:{action_:["output-0","copy"],nextState:"o"}},else:{"*":{action_:"text="}}}),actions:{comma:function(){return{type_:"commaDecimal"}},"output-0":function(e){var t=[];if(e.text_=e.text_||"",e.text_.length>4){var r=e.text_.length%3;0===r&&(r=3);for(var n=e.text_.length-3;n>0;n-=3)t.push(e.text_.substr(n,3)),t.push({type_:"1000 separator"});t.push(e.text_.substr(0,r)),t.reverse()}else t.push(e.text_);for(var a in e)delete e[a];return t},"output-o":function(e){var t=[];if(e.text_=e.text_||"",e.text_.length>4){for(var r=e.text_.length-3,n=0;n<r;n+=3)t.push(e.text_.substr(n,3)),t.push({type_:"1000 separator"});t.push(e.text_.substr(n))}else t.push(e.text_);for(var a in e)delete e[a];return t}}}};var Gi={go:function(e,t){if(!e)return"";for(var r="",n=!1,a=0;a<e.length;a++){var o=e[a];"string"==typeof o?r+=o:(r+=Gi._go2(o),"1st-level escape"===o.type_&&(n=!0))}return t||n||!r||(r="{"+r+"}"),r},_goInner:function(e){return e?Gi.go(e,!0):e},_go2:function(e){var t;switch(e.type_){case"chemfive":t="";var r={a:Gi._goInner(e.a),b:Gi._goInner(e.b),p:Gi._goInner(e.p),o:Gi._goInner(e.o),q:Gi._goInner(e.q),d:Gi._goInner(e.d)};r.a&&(r.a.match(/^[+\-]/)&&(r.a="{"+r.a+"}"),t+=r.a+"\\,"),(r.b||r.p)&&(t+="{\\vphantom{X}}",t+="^{\\hphantom{"+(r.b||"")+"}}_{\\hphantom{"+(r.p||"")+"}}",t+="{\\vphantom{X}}",t+="^{\\smash[t]{\\vphantom{2}}\\mathllap{"+(r.b||"")+"}}",t+="_{\\vphantom{2}\\mathllap{\\smash[t]{"+(r.p||"")+"}}}"),r.o&&(r.o.match(/^[+\-]/)&&(r.o="{"+r.o+"}"),t+=r.o),"kv"===e.dType?((r.d||r.q)&&(t+="{\\vphantom{X}}"),r.d&&(t+="^{"+r.d+"}"),r.q&&(t+="_{\\smash[t]{"+r.q+"}}")):"oxidation"===e.dType?(r.d&&(t+="{\\vphantom{X}}",t+="^{"+r.d+"}"),r.q&&(t+="{\\vphantom{X}}",t+="_{\\smash[t]{"+r.q+"}}")):(r.q&&(t+="{\\vphantom{X}}",t+="_{\\smash[t]{"+r.q+"}}"),r.d&&(t+="{\\vphantom{X}}",t+="^{"+r.d+"}"));break;case"rm":case"roman numeral":t="\\mathrm{"+e.p1+"}";break;case"text":e.p1.match(/[\^_]/)?(e.p1=e.p1.replace(" ","~").replace("-","\\text{-}"),t="\\mathrm{"+e.p1+"}"):t="\\text{"+e.p1+"}";break;case"state of aggregation":t="\\mskip2mu "+Gi._goInner(e.p1);break;case"state of aggregation subscript":t="\\mskip1mu "+Gi._goInner(e.p1);break;case"bond":if(!(t=Gi._getBond(e.kind_)))throw["MhchemErrorBond","mhchem Error. Unknown bond type ("+e.kind_+")"];break;case"frac":var n="\\frac{"+e.p1+"}{"+e.p2+"}";t="\\mathchoice{\\textstyle"+n+"}{"+n+"}{"+n+"}{"+n+"}";break;case"pu-frac":var a="\\frac{"+Gi._goInner(e.p1)+"}{"+Gi._goInner(e.p2)+"}";t="\\mathchoice{\\textstyle"+a+"}{"+a+"}{"+a+"}{"+a+"}";break;case"tex-math":case"1st-level escape":t=e.p1+" ";break;case"frac-ce":t="\\frac{"+Gi._goInner(e.p1)+"}{"+Gi._goInner(e.p2)+"}";break;case"overset":t="\\overset{"+Gi._goInner(e.p1)+"}{"+Gi._goInner(e.p2)+"}";break;case"underset":t="\\underset{"+Gi._goInner(e.p1)+"}{"+Gi._goInner(e.p2)+"}";break;case"underbrace":t="\\underbrace{"+Gi._goInner(e.p1)+"}_{"+Gi._goInner(e.p2)+"}";break;case"color":t="{\\color{"+e.color1+"}{"+Gi._goInner(e.color2)+"}}";break;case"color0":t="\\color{"+e.color+"}";break;case"arrow":var o={rd:Gi._goInner(e.rd),rq:Gi._goInner(e.rq)},i="\\x"+Gi._getArrow(e.r);o.rq&&(i+="[{"+o.rq+"}]"),t=i+=o.rd?"{"+o.rd+"}":"{}";break;case"operator":t=Gi._getOperator(e.kind_);break;case"space":t=" ";break;case"entitySkip":case"pu-space-1":t="~";break;case"pu-space-2":t="\\mkern3mu ";break;case"1000 separator":t="\\mkern2mu ";break;case"commaDecimal":t="{,}";break;case"comma enumeration L":t="{"+e.p1+"}\\mkern6mu ";break;case"comma enumeration M":t="{"+e.p1+"}\\mkern3mu ";break;case"comma enumeration S":t="{"+e.p1+"}\\mkern1mu ";break;case"hyphen":t="\\text{-}";break;case"addition compound":t="\\,{\\cdot}\\,";break;case"electron dot":t="\\mkern1mu \\bullet\\mkern1mu ";break;case"KV x":t="{\\times}";break;case"prime":t="\\prime ";break;case"cdot":t="\\cdot ";break;case"tight cdot":t="\\mkern1mu{\\cdot}\\mkern1mu ";break;case"times":t="\\times ";break;case"circa":t="{\\sim}";break;case"^":t="uparrow";break;case"v":t="downarrow";break;case"ellipsis":t="\\ldots ";break;case"/":t="/";break;case" / ":t="\\,/\\,";break;default:throw["MhchemBugT","mhchem bug T. Please report."]}return t},_getArrow:function(e){switch(e){case"->":case"→":case"⟶":return"rightarrow";case"<-":return"leftarrow";case"<->":return"leftrightarrow";case"<--\x3e":return"rightleftarrows";case"<=>":case"⇌":return"rightleftharpoons";case"<=>>":return"rightequilibrium";case"<<=>":return"leftequilibrium";default:throw["MhchemBugT","mhchem bug T. Please report."]}},_getBond:function(e){switch(e){case"-":case"1":return"{-}";case"=":case"2":return"{=}";case"#":case"3":return"{\\equiv}";case"~":return"{\\tripledash}";case"~-":return"{\\mathrlap{\\raisebox{-.1em}{$-$}}\\raisebox{.1em}{$\\tripledash$}}";case"~=":case"~--":return"{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$\\tripledash$}}-}";case"-~-":return"{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$-$}}\\tripledash}";case"...":return"{{\\cdot}{\\cdot}{\\cdot}}";case"....":return"{{\\cdot}{\\cdot}{\\cdot}{\\cdot}}";case"->":return"{\\rightarrow}";case"<-":return"{\\leftarrow}";case"<":return"{<}";case">":return"{>}";default:throw["MhchemBugT","mhchem bug T. Please report."]}},_getOperator:function(e){switch(e){case"+":return" {}+{} ";case"-":return" {}-{} ";case"=":return" {}={} ";case"<":return" {}<{} ";case">":return" {}>{} ";case"<<":return" {}\\ll{} ";case">>":return" {}\\gg{} ";case"\\pm":return" {}\\pm{} ";case"\\approx":case"$\\approx$":return" {}\\approx{} ";case"v":case"(v)":return" \\downarrow{} ";case"^":case"(^)":return" \\uparrow{} ";default:throw["MhchemBugT","mhchem bug T. Please report."]}}};function Wi(e,t,r){return`${e}:${t}:${r}`}function Ki(e){const t=e.indexOf(":"),r=e.indexOf(":",t+1);return{level:e.slice(0,t),text:e.slice(r+1)}}function Yi(){const e=(0,u.useRef)({loadedContentKey:null,shouldSuppressNextLoad:!1});return{shouldLoadContent:(0,u.useCallback)(t=>{const r=e.current;return r.shouldSuppressNextLoad?(r.shouldSuppressNextLoad=!1,!1):r.loadedContentKey!==t},[]),markContentLoaded:(0,u.useCallback)(t=>{e.current.loadedContentKey=t},[]),markContentSaved:(0,u.useCallback)(()=>{e.current.shouldSuppressNextLoad=!0},[])}}var Xi={[l.KEYS.h1]:1,[l.KEYS.h2]:2,[l.KEYS.h3]:3,[l.KEYS.h4]:4,[l.KEYS.h5]:5,[l.KEYS.h6]:6};function Zi(e){if(!e?.length)return[];const t=[];return e.forEach((e,r)=>{const n=Xi[e?.type];if(!n)return;const a=l.NodeApi.string(e);t.push([Wi(n,r,a),a,`h${n}`])}),t}var Ji=(0,u.forwardRef)(({content:e,contentKey:t,onChange:r,onHeadingsChange:n,readOnly:a},o)=>{const i=Yi(),s=t??e.slice(0,40),c=(0,u.useRef)(e),d=(0,u.useMemo)(()=>l.htmlToPlateValue(c.current),[]),h=l.usePlateEditor({plugins:l.platePlugins,value:d}),p=(0,u.useRef)(r),f=(0,u.useRef)(n),g=(0,u.useRef)(!1),x=(0,u.useRef)(null),v=(0,u.useRef)(null),y=(0,u.useRef)(0),b=(0,u.useRef)(h.children);(0,u.useEffect)(()=>{p.current=r},[r]),(0,u.useEffect)(()=>{f.current=n},[n]);const w=(0,u.useCallback)(e=>{if(!f.current)return;const t=Date.now(),r=t-y.current;r>=300?(y.current=t,f.current(Zi(e))):(v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{y.current=Date.now(),f.current?.(Zi(b.current))},300-r))},[]),S=(0,u.useCallback)(async e=>{const t=await l.plateValueToHtml(e);i.markContentSaved(),p.current(t)},[i]),k=(0,u.useCallback)(({value:e})=>{b.current=e,g.current=!0,x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{g.current&&(g.current=!1,S(b.current))},2e4),w(e)},[S,w]),C=(0,u.useRef)(!1);(0,u.useEffect)(()=>{if(i.shouldLoadContent(s)){if(C.current){const t=l.htmlToPlateValue(e);h.tf.setValue(t),b.current=t,g.current=!1}else C.current=!0;i.markContentLoaded(s),w(b.current)}},[e,h,s,i,w]),(0,u.useEffect)(()=>()=>{x.current&&clearTimeout(x.current),v.current&&clearTimeout(v.current),g.current&&(g.current=!1,S(b.current))},[S]);const j=(0,u.useRef)(null),T=(0,u.useCallback)(e=>{const t=j.current;if(!t)return null;const{level:r,text:n}=Ki(e);for(const a of t.querySelectorAll(`h${r}`))if(a.textContent?.trim()===n)return a;return null},[]);return(0,u.useImperativeHandle)(o,()=>({scrollToHeading:e=>T(e)?.scrollIntoView({behavior:"smooth",block:"start"}),getElementByKey:e=>T(e)}),[T]),(0,m.jsx)("div",{className:"flex h-full w-full flex-col bg-editor-bg",children:(0,m.jsx)(l.Plate,{editor:h,onValueChange:k,readOnly:a,children:(0,m.jsxs)("div",{className:"flex flex-1 flex-col overflow-hidden",children:[!a&&(0,m.jsx)(l.FixedToolbar,{className:l.REASON_TOOLBAR_SKIN,children:(0,m.jsx)(l.FixedToolbarButtons,{})}),(0,m.jsxs)(l.EditorContainer,{className:"relative min-h-0 flex-1",children:[(0,m.jsx)(l.Editor,{placeholder:"Start writing…",ref:j,variant:"default"}),!a&&(0,m.jsx)(l.FloatingToolbar,{children:(0,m.jsx)(l.FloatingToolbarButtons,{})})]})]})})})});Ji.displayName="PlateEditorWrapper";var Qi=({editor:e,theme:t,setTheme:r})=>{const[n,o]=(0,u.useState)(!1);return a.useLocale(),c.useTheme(),(0,u.useEffect)(()=>{c.themeActions.setColor("default"),o(e?.isEditable??!0)},[]),(0,u.useEffect)(()=>(e&&e.on("update",()=>{o(e.isEditable)}),()=>{e&&e.off("update",()=>{o(e.isEditable)})}),[e]),null},es=n.buildExtensions(n.createDefaultConfig());function ts(...e){return t.twMerge((0,p.default)(e))}function rs({className:e,...t}){return(0,m.jsx)(s.Avatar,{"data-slot":"avatar",className:ts("relative flex size-8 shrink-0 overflow-hidden rounded-full",e),...t})}function ns({className:e,...t}){return(0,m.jsx)(s.AvatarImage,{"data-slot":"avatar-image",className:ts("aspect-square size-full",e),...t})}function as({className:e,...t}){return(0,m.jsx)(s.AvatarFallback,{"data-slot":"avatar-fallback",className:ts("bg-muted flex size-full items-center justify-center rounded-full",e),...t})}var os=t.cva("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"}});function is({className:e,variant:t,size:r,asChild:n=!1,...a}){return(0,m.jsx)(n?h.Slot:"button",{"data-slot":"button",className:ts(os({variant:t,size:r,className:e})),...a})}function ss({className:e,...t}){return(0,m.jsx)("textarea",{"data-slot":"textarea",className:ts("border-input placeholder:text-muted-foreground 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 flex field-sizing-content min-h-16 w-full rounded-2xl border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),...t})}var ls=t.cva("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"}});function cs({className:e,variant:t,asChild:r=!1,...n}){return(0,m.jsx)(r?h.Slot:"span",{"data-slot":"badge",className:ts(ls({variant:t}),e),...n})}function ds(e){return new Date(e).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function us({thread:e,active:t,onSelect:r,onSubmitBody:n,onReply:a,onResolve:o,onRemove:i}){const[s,l]=(0,u.useState)(""),c=(0,u.useRef)(null),d=!e.text.trim();(0,u.useEffect)(()=>{t&&d&&c.current?.focus()},[t,d]);const h=()=>{const t=s.trim();t&&(d?n(e.id,t):a(e.id,t),l(""))};return(0,m.jsxs)("div",{role:"button",tabIndex:0,onClick:()=>r(e.id),onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||r(e.id)},className:ts("rounded-lg border bg-card p-3 text-left shadow-sm transition-colors cursor-pointer",t?"border-primary ring-1 ring-primary/40":"hover:border-primary/40",e.resolved&&"opacity-70"),children:[(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)(rs,{className:"h-6 w-6",children:(0,m.jsx)(as,{className:"text-[10px]",style:{backgroundColor:e.authorColor,color:"#fff"},children:(p=e.authorName,p.split(" ").map(e=>e[0]).filter(Boolean).slice(0,2).join("").toUpperCase())})}),(0,m.jsx)("span",{className:"text-sm font-medium truncate flex-1",children:e.authorName}),(0,m.jsx)("span",{className:"text-[11px] text-muted-foreground shrink-0",children:ds(e.timestamp)}),e.resolved&&(0,m.jsx)(cs,{variant:"secondary",className:"shrink-0",children:"Resolved"})]}),!d&&(0,m.jsx)("p",{className:"mt-2 whitespace-pre-wrap break-words text-sm",children:e.text}),e.replies?.length>0&&(0,m.jsx)("div",{className:"mt-2 space-y-2 border-l-2 border-border pl-2",children:e.replies.map(e=>(0,m.jsxs)("div",{children:[(0,m.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,m.jsx)("span",{className:"text-xs font-medium",children:e.authorName}),(0,m.jsx)("span",{className:"text-[10px] text-muted-foreground",children:ds(e.timestamp)})]}),(0,m.jsx)("p",{className:"whitespace-pre-wrap break-words text-sm",children:e.text})]},e.id))}),!e.resolved&&(0,m.jsxs)("div",{className:"mt-2",onClick:e=>e.stopPropagation(),children:[(0,m.jsx)(ss,{ref:c,value:s,onChange:e=>l(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),h())},placeholder:d?"Write a comment…":"Reply…",className:"min-h-[56px] text-sm"}),(0,m.jsxs)("div",{className:"mt-1.5 flex items-center justify-between",children:[(0,m.jsxs)("div",{className:"flex gap-1",children:[!d&&(0,m.jsxs)(is,{variant:"ghost",size:"sm",className:"h-7 gap-1 px-2 text-xs",onClick:()=>o(e.id,!0),children:[(0,m.jsx)(f.Check,{className:"h-3.5 w-3.5"})," Resolve"]}),(0,m.jsxs)(is,{variant:"ghost",size:"sm",className:"h-7 gap-1 px-2 text-xs text-destructive hover:text-destructive",onClick:()=>i(e.id),children:[(0,m.jsx)(f.Trash2,{className:"h-3.5 w-3.5"})," Delete"]})]}),(0,m.jsx)(is,{size:"sm",className:"h-7 px-3 text-xs",onClick:h,disabled:!s.trim(),children:d?"Comment":"Reply"})]})]}),e.resolved&&(0,m.jsxs)("div",{className:"mt-2 flex gap-1",onClick:e=>e.stopPropagation(),children:[(0,m.jsxs)(is,{variant:"ghost",size:"sm",className:"h-7 gap-1 px-2 text-xs",onClick:()=>o(e.id,!1),children:[(0,m.jsx)(f.RotateCcw,{className:"h-3.5 w-3.5"})," Reopen"]}),(0,m.jsxs)(is,{variant:"ghost",size:"sm",className:"h-7 gap-1 px-2 text-xs text-destructive hover:text-destructive",onClick:()=>i(e.id),children:[(0,m.jsx)(f.Trash2,{className:"h-3.5 w-3.5"})," Delete"]})]})]});var p}function hs({threads:e,activeId:t,onSelect:r,onSubmitBody:n,onReply:a,onResolve:o,onRemove:i,onClose:s}){const l=e.filter(e=>!e.resolved),c=e.filter(e=>e.resolved);return(0,m.jsxs)("aside",{className:"flex h-full w-full flex-col border-l border-border bg-background",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[(0,m.jsx)("h2",{className:"text-sm font-semibold",children:"Comments"}),(0,m.jsx)(is,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:s,"aria-label":"Close comments",children:(0,m.jsx)(f.X,{className:"h-4 w-4"})})]}),(0,m.jsx)("div",{className:"flex-1 space-y-2 overflow-y-auto p-3",children:0===e.length?(0,m.jsxs)("div",{className:"flex flex-col items-center gap-2 py-10 text-center text-muted-foreground",children:[(0,m.jsx)(f.MessageSquarePlus,{className:"h-8 w-8 opacity-50"}),(0,m.jsx)("p",{className:"text-sm",children:"No comments yet"}),(0,m.jsx)("p",{className:"text-xs",children:"Select text in the document, then choose “Comment”."})]}):(0,m.jsxs)(m.Fragment,{children:[l.map(e=>(0,m.jsx)(us,{thread:e,active:e.id===t,onSelect:r,onSubmitBody:n,onReply:a,onResolve:o,onRemove:i},e.id)),c.length>0&&(0,m.jsxs)("div",{className:"pt-2",children:[(0,m.jsxs)("p",{className:"mb-1 px-1 text-xs font-medium uppercase tracking-wide text-muted-foreground",children:["Resolved (",c.length,")"]}),(0,m.jsx)("div",{className:"space-y-2",children:c.map(e=>(0,m.jsx)(us,{thread:e,active:e.id===t,onSelect:r,onSubmitBody:n,onReply:a,onResolve:o,onRemove:i},e.id))})]})]})})]})}var ps="comment";function ms(e,t){let r=null,n=null;return e.state.doc.descendants((e,a)=>{e.isText&&e.marks.some(e=>e.type.name===ps&&e.attrs.id===t)&&(null===r&&(r=a),n=a+e.nodeSize)}),null===r||null===n?null:{from:r,to:n}}var fs="local-user",gs="You",xs="#4F46E5";function vs(e){if(!e)return[];const t=e.getJSON(),r=[];return(t.content??[]).forEach((e,t)=>{if("heading"===e.type&&e.attrs?.level){const n=(e.content??[]).map(e=>e.text??"").join("");r.push([Wi(e.attrs.level,t,n),n,`h${e.attrs.level}`])}}),r}var ys=(0,u.forwardRef)(({content:e,contentKey:t,onChange:r,onHeadingsChange:a,readOnly:i},l)=>{const c=Yi(),[d,h]=(0,u.useState)("light"),p=t??e.slice(0,40),f=function(){const[e,t]=(0,u.useState)({}),r=(0,u.useRef)(e);r.current=e;const n=(0,u.useCallback)(e=>{t(t=>({...t,[e.id]:e}))},[]),a=(0,u.useCallback)((e,r)=>{t(t=>t[e]?{...t,[e]:{...t[e],text:r}}:t)},[]),o=(0,u.useCallback)((e,r)=>{t(t=>t[e]?{...t,[e]:{...t[e],replies:[...t[e].replies||[],r]}}:t)},[]),i=(0,u.useCallback)((e,r)=>{t(t=>t[e]?{...t,[e]:{...t[e],resolved:r}}:t)},[]),s=(0,u.useCallback)(e=>{t(t=>{if(!t[e])return t;const r={...t};return delete r[e],r})},[]),l=(0,u.useCallback)(e=>{t(t=>{const r={};for(const n of e){const e=t[n.id];r[n.id]=e?{...n,text:e.text||n.text,replies:e.replies}:n}return r})},[]),c=(0,u.useCallback)(e=>Boolean(r.current[e]),[]);return{threads:Object.values(e).sort((e,t)=>t.timestamp-e.timestamp),addThread:n,setThreadText:a,addReply:o,setResolved:i,removeThread:s,hydrate:l,has:c}}(),g=(0,u.useRef)(f);g.current=f;const[x,v]=(0,u.useState)(!1),[y,b]=(0,u.useState)(null),[w,S]=(0,u.useState)(!0),k=(0,u.useMemo)(()=>[...es.filter(e=>"comment"!==e.name),s.Comment.configure({authorId:fs,authorName:gs,authorColor:xs,onCommentAdd:e=>g.current.addThread(e),onCommentRemove:e=>g.current.removeThread(e),onCommentResolve:(e,t)=>g.current.setResolved(e,t)})],[]),C=(0,u.useRef)(r),j=(0,u.useRef)(a),T=(0,u.useRef)(!1),N=(0,u.useRef)(null),M=(0,u.useRef)(null),E=(0,u.useRef)(0);(0,u.useEffect)(()=>{C.current=r},[r]),(0,u.useEffect)(()=>{j.current=a},[a]);const A=(0,u.useCallback)(e=>{if(!j.current)return;const t=vs(e),r=Date.now(),n=r-E.current;n>=300?(E.current=r,j.current(t)):(M.current&&clearTimeout(M.current),M.current=setTimeout(()=>{E.current=Date.now(),j.current?.(vs(e))},300-n))},[]),[R,D]=(0,u.useState)(null),I=(0,u.useCallback)(({editor:e})=>{T.current=!0,N.current&&clearTimeout(N.current),N.current=setTimeout(()=>{T.current&&(T.current=!1,c.markContentSaved(),C.current(e.getHTML()))},2e4),A(e)},[A,c]),z=(0,u.useCallback)(({editor:e})=>{S(e.state.selection.empty);const t=function(e){if(!e.isActive(ps))return null;const t=e.getAttributes(ps).id;return"string"==typeof t&&t?t:null}(e);t&&(b(t),v(!0))},[]);(0,u.useEffect)(()=>{R&&c.shouldLoadContent(p)&&(R.commands.setContent(e||""),c.markContentLoaded(p),A(R),g.current.hydrate(function(e){const t=new Map;return e.state.doc.descendants(e=>{if(e.isText)for(const r of e.marks){if(r.type.name!==ps)continue;const e=r.attrs;e.id&&!t.has(e.id)&&t.set(e.id,{id:e.id,authorId:e.authorId??"",authorName:e.authorName??"Anonymous",authorColor:e.authorColor??"#4F46E5",text:e.text??"",timestamp:"number"==typeof e.timestamp?e.timestamp:Date.now(),resolved:Boolean(e.resolved),replies:[]})}}),[...t.values()]}(R)),b(null))},[R,p,c,A]),(0,u.useEffect)(()=>{R&&R.setEditable(!i)},[R,i]),(0,u.useEffect)(()=>{const e=R;return()=>{N.current&&clearTimeout(N.current),M.current&&clearTimeout(M.current),e&&T.current&&(T.current=!1,c.markContentSaved(),C.current(e.getHTML()))}},[R,c]);const _=(0,u.useCallback)(e=>{if(!R)return null;const{level:t,text:r}=Ki(e);for(const n of R.view.dom.querySelectorAll(`h${t}`))if(n.textContent?.trim()===r)return n;return null},[R]);(0,u.useImperativeHandle)(l,()=>({scrollToHeading:e=>_(e)?.scrollIntoView({behavior:"smooth",block:"start"}),getElementByKey:e=>_(e)}),[_]);const P=(0,u.useCallback)(()=>{if(!R)return;const e=`comment-${Date.now()}`;R.chain().focus().setComment({id:e}).run()&&(b(e),v(!0))},[R]),O=(0,u.useCallback)(e=>{b(e),R&&function(e,t){const r=ms(e,t);!!r&&(e.chain().setTextSelection(r).run(),e.view.dom.querySelector(`[data-comment-id="${t}"]`)?.scrollIntoView({behavior:"smooth",block:"center"}))}(R,e)},[R]),L=(0,u.useCallback)((e,t)=>{f.setResolved(e,t),R&&function(e,t,r){const n=ms(e,t);if(!n)return!1;const{state:a,view:o}=e,i=a.schema.marks[ps];if(!i)return!1;const s=a.tr;a.doc.nodesBetween(n.from,n.to,(e,a)=>{if(!e.isText)return;const o=e.marks.find(e=>e.type===i&&e.attrs.id===t);if(!o)return;const l=Math.max(a,n.from),c=Math.min(a+e.nodeSize,n.to);s.removeMark(l,c,i),s.addMark(l,c,i.create({...o.attrs,...r}))}),s.docChanged&&o.dispatch(s)}(R,e,{resolved:t})},[R,f]),F=(0,u.useCallback)(e=>{f.removeThread(e),R&&function(e,t){const r=ms(e,t);if(!r)return!1;const{state:n,view:a}=e,o=n.schema.marks[ps];if(!o)return!1;const i=n.tr.removeMark(r.from,r.to,o);i.docChanged&&a.dispatch(i)}(R,e),b(t=>t===e?null:t)},[R,f]),B=(0,u.useCallback)((e,t)=>{f.addReply(e,{id:`reply-${Date.now()}`,authorId:fs,authorName:gs,authorColor:xs,text:t,timestamp:Date.now()})},[f]),H=f.threads.filter(e=>!e.resolved).length;return(0,m.jsxs)("div",{className:"flex h-full w-full flex-col bg-editor-bg",children:[(0,m.jsx)(Qi,{editor:R,theme:d,setTheme:h}),(0,m.jsx)(n.NovelEditor,{className:"flex flex-1 min-h-0 flex-col",extensions:k,initialContent:e,editable:!i,onEditor:D,onUpdate:I,onSelectionUpdate:z,children:({editor:e,EditorSurface:t})=>(0,m.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[!i&&e&&(0,m.jsx)(o.RichTextToolbar,{theme:d,setTheme:h,onAddComment:P,commentDisabled:w,showComments:x,onToggleComments:()=>v(e=>!e),commentCount:H}),(0,m.jsxs)("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[(0,m.jsx)(t,{className:"flex-1 min-h-0 overflow-auto prose dark:prose-invert max-w-none px-4 py-3"}),!i&&x&&(0,m.jsx)("div",{className:"w-80 shrink-0",children:(0,m.jsx)(hs,{threads:f.threads,activeId:y,onSelect:O,onSubmitBody:f.setThreadText,onReply:B,onResolve:L,onRemove:F,onClose:()=>v(!1)})})]}),!i&&e&&(0,m.jsx)(o.BubbleMenus,{})]})})]})});function bs(...e){return e.filter(Boolean).join(" ")}ys.displayName="TiptapEditorWrapper";var ws=(0,u.forwardRef)(function(e,t){const{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=bs("split-pane-pane",r);return(0,m.jsx)("div",{ref:t,className:u,style:d,"data-pane":"true",...c,children:a})});function Ss(e,t="polite"){if("undefined"==typeof document)return;const r=document.createElement("div");r.setAttribute("role","status"),r.setAttribute("aria-live",t),r.setAttribute("aria-atomic","true"),r.style.position="absolute",r.style.left="-10000px",r.style.width="1px",r.style.height="1px",r.style.overflow="hidden",r.textContent=e,document.body.appendChild(r),setTimeout(()=>{document.body.removeChild(r)},1e3)}function ks(e){return 1e3>e?Math.round(e)+" pixels":Math.round(e/10)/100+" thousand pixels"}function Cs(e){const{direction:t,index:r,isDragging:n,disabled:a,onPointerDown:o,onKeyDown:i,className:s,style:l,currentSize:c,minSize:d,maxSize:u,children:h}=e,p="horizontal"===t?"vertical":"horizontal",f={flex:"none",position:"relative",userSelect:"none",touchAction:"none",..."horizontal"===t?{width:"1px",cursor:a?"default":"col-resize"}:{height:"1px",cursor:a?"default":"row-resize"},...n&&{cursor:"horizontal"===t?"col-resize":"row-resize"},...l},g=bs("split-pane-divider",t,n&&"dragging",s),x=function(e,t){return`${"horizontal"===t?"vertical":"horizontal"} divider ${e+1}`}(r,t);return(0,m.jsx)("div",{role:"separator","aria-orientation":p,"aria-label":x,"aria-valuenow":c,"aria-valuemin":d,"aria-valuemax":void 0===u||u===1/0?void 0:u,"aria-description":(v=t,`Use ${"horizontal"===v?"left and right arrow keys":"up and down arrow keys"} to resize. Hold Shift for larger steps. Press Home or End to minimize or maximize.`),tabIndex:a?-1:0,className:g,style:f,onPointerDown:a?void 0:o,onKeyDown:a?void 0:i,"data-divider-index":r,children:h});var v}function js(e,t){if("number"==typeof e)return e;if(e.endsWith("%"))return parseFloat(e)/100*t;if(e.endsWith("px"))return parseFloat(e);const r=parseFloat(e);return isNaN(r)?0:r}function Ts(e,t,r){return Math.min(Math.max(e,t),r)}function Ns(e,t,r,n,a){const o=[...e],i=e[t]??0,s=e[t+1]??0,l=n[t+1]??0,c=a[t+1]??1/0;let d=Ts(i+r,n[t]??0,a[t]??1/0),u=Ts(s-r,l,c);const h=s-u,p=Math.min(Math.abs(d-i),Math.abs(h));return r>0?(d=i+p,u=s-p):(d=i-p,u=s+p),o[t]=d,o[t+1]=u,o}var Ms=10,Es=50;function As(e){const{direction:t,sizes:r,minSizes:n,maxSizes:a,step:o=Ms,largeStep:i=Es,onResize:s,onResizeEnd:l}=e,c=(0,u.useRef)(null);return{handleKeyDown:(0,u.useCallback)(e=>d=>{if(!("horizontal"===t?["ArrowLeft","ArrowRight"]:["ArrowUp","ArrowDown"]).includes(d.key)&&"Home"!==d.key&&"End"!==d.key&&"Escape"!==d.key)return;if(d.preventDefault(),"Escape"===d.key){if(c.current){const e=c.current;c.current=null,s&&s(e,{sizes:e,source:"keyboard",originalEvent:d.nativeEvent}),l&&l(e,{sizes:e,source:"keyboard",originalEvent:d.nativeEvent}),Ss("Pane sizes restored")}return}null===c.current&&(c.current=[...r]);let u=0,h=[...r],p="arrow";switch(d.key){case"ArrowLeft":case"ArrowUp":u=-(d.shiftKey?i:o);break;case"ArrowRight":case"ArrowDown":u=d.shiftKey?i:o;break;case"Home":{p="home";const t=e+1,a=n[e]??0,o=(r[e]??0)+(r[t]??0);h[e]=a,h[t]=o-a;break}case"End":{p="end";const t=e,o=e+1,i=(r[t]??0)+(r[o]??0);h[t]=Math.min(a[t]??1/0,i-(n[o]??0)),h[o]=i-h[t];break}}if(0!==u&&(h=Ns(r,e,u,n,a)),h=h.map((e,t)=>Ts(e,n[t]??0,a[t]??1/0)),s&&s(h,{sizes:h,source:"keyboard",originalEvent:d.nativeEvent}),l&&l(h,{sizes:h,source:"keyboard",originalEvent:d.nativeEvent}),"home"===p)Ss(`Pane ${e+1} minimized to ${ks(h[e]??0)}`);else if("end"===p)Ss(`Pane ${e+1} maximized to ${ks(h[e]??0)}`);else{const t=u>0?e:e+1;Ss(`Pane ${t+1} resized to ${ks(h[t]??0)}`)}},[t,r,n,a,o,i,s,l])}}function Rs(e){const{direction:t="horizontal",resizable:r=!0,snapPoints:n,snapTolerance:a=10,step:o,onResizeStart:i,onResize:s,onResizeEnd:l,className:c,style:d,divider:h,dividerStyle:p,dividerClassName:f,dividerSize:g=1,children:x}=e,v=(0,u.useRef)(null),[y,b]=(0,u.useState)(0),w=(0,u.useRef)(0),S=(0,u.useMemo)(()=>u.Children.toArray(x).filter(e=>"object"==typeof e&&null!==e&&"props"in e).map(e=>({props:e.props,size:e.props.size,defaultSize:e.props.defaultSize,minSize:e.props.minSize??0,maxSize:e.props.maxSize??1/0})),[x]),k=S.length,C=(0,u.useRef)(!1);2>k&&!C.current&&(C.current=!0);const{minSizes:j,maxSizes:T}=(0,u.useMemo)(()=>{if(0===y)return{minSizes:Array(k).fill(0),maxSizes:Array(k).fill(1/0)};const e=[],t=[];return S.forEach(r=>{e.push(js(r.minSize,y)),t.push(r.maxSize===1/0?1/0:js(r.maxSize,y))}),{minSizes:e,maxSizes:t}},[y,k,S]),N=(0,u.useCallback)(e=>{if(0===e)return Array(k).fill(0);const t=e-g*(k-1),r=S.map(e=>{const r=e.size??e.defaultSize;return void 0!==r?js(r,t):null}),n=r.reduce((e,t)=>e+(t??0),0),a=r.filter(e=>null===e).length,o=a>0?(t-n)/a:0;return r.map(e=>null===e?o:e)},[k,S,g]),[M,E]=(0,u.useState)(()=>N(y));(0,u.useEffect)(()=>{if(0===y)return;if(!S.some(e=>void 0!==e.size))return;const e=N(y);E(t=>t.length===e.length&&t.every((t,r)=>t===e[r])?t:e)},[y,S,N]);const A=(0,u.useCallback)(e=>{const t=w.current;if(w.current=e,0===e)return;const r=S.some(e=>void 0!==e.size),n=e-g*(k-1);E(a=>a.every(e=>0===e)||a.length!==k?N(e):t>0&&t!==e?r?N(e):function(e,t){const r=e.reduce((e,t)=>e+t,0);if(0===r){const r=t/e.length;return e.map(()=>r)}return e.map(e=>e/r*t)}(a,n):0===t?N(e):a)},[k,S,N,g]),R=(0,u.useRef)(0);(0,u.useEffect)(()=>{const e=v.current;if(!e)return;const r=new ResizeObserver(e=>{const r=e[0];r&&(e=>{const r=Math.round("horizontal"===t?e.width:e.height);r>0&&r!==R.current&&(R.current=r,b(r),A(r))})(r.contentRect)});return r.observe(e),()=>{r.disconnect()}},[t,A]);const D=(0,u.useCallback)((e,t)=>{E(e),s?.(e,t)},[s]),{isDragging:I,currentSizes:z,handlePointerDown:_}=function(e){const{direction:t,sizes:r,minSizes:n,maxSizes:a,snapPoints:o=[],snapTolerance:i=10,step:s,onResizeStart:l,onResize:c,onResizeEnd:d}=e,[h,p]=(0,u.useState)(!1),[m,f]=(0,u.useState)(r),g=(0,u.useRef)(null),x=(0,u.useRef)(null),v=(0,u.useRef)(!0),y=(0,u.useRef)(null),b=(0,u.useRef)(m);b.current=m;const w=(0,u.useRef)(d);w.current=d;const S=(0,u.useRef)(r);(0,u.useEffect)(()=>{h||JSON.stringify(r)===JSON.stringify(S.current)||(S.current=r,f(r))},[r,h]),(0,u.useEffect)(()=>(v.current=!0,()=>{v.current=!1,x.current&&(cancelAnimationFrame(x.current),x.current=null)}),[]);const k=(0,u.useCallback)((e,r)=>{if(!g.current||!v.current)return;const{dividerIndex:l,startPosition:d,startSizes:u,pointerType:h}=g.current;let p=("horizontal"===t?e:r)-d;s&&(p=function(e,t){return t>0?Math.round(e/t)*t:e}(p,s));let m=Ns(u,l,p,n,a);o.length>0&&(m=m.map(e=>function(e,t,r){for(const n of t)if(r>=Math.abs(e-n))return n;return e}(e,o,i))),f(m),c&&c(m,{sizes:m,source:"pointer",pointerType:h})},[t,s,n,a,o,i,c]),C=(0,u.useCallback)(e=>{g.current&&e.pointerId===g.current.pointerId&&(e.preventDefault(),y.current={x:e.clientX,y:e.clientY},x.current||(x.current=requestAnimationFrame(()=>{x.current=null,v.current&&y.current&&k(y.current.x,y.current.y)})))},[k]),j=(0,u.useCallback)(e=>{if(!g.current||e.pointerId!==g.current.pointerId)return;const{element:t,pointerId:r,pointerType:n}=g.current;t?.hasPointerCapture?.(r)&&t.releasePointerCapture(r),x.current&&(cancelAnimationFrame(x.current),x.current=null),p(!1);const a=b.current,o=w.current;o&&o(a,{sizes:a,source:"pointer",pointerType:n}),g.current=null},[]),T=(0,u.useCallback)(e=>r=>{r.preventDefault();const n="horizontal"===t?r.clientX:r.clientY,a=r.currentTarget;a.setPointerCapture(r.pointerId);const o=r.pointerType;g.current={dividerIndex:e,startPosition:n,startSizes:m,pointerId:r.pointerId,pointerType:o,element:a},p(!0),l&&l({sizes:m,source:"pointer",pointerType:o,originalEvent:r.nativeEvent})},[t,m,l]);return(0,u.useEffect)(()=>{if(h)return document.addEventListener("pointermove",C),document.addEventListener("pointerup",j),document.addEventListener("pointercancel",j),()=>{document.removeEventListener("pointermove",C),document.removeEventListener("pointerup",j),document.removeEventListener("pointercancel",j)}},[h,C,j]),{isDragging:h,currentSizes:m,handlePointerDown:T}}({direction:t,sizes:M,minSizes:j,maxSizes:T,snapPoints:n,snapTolerance:a,step:o,onResizeStart:i,onResize:D,onResizeEnd:l}),{handleKeyDown:P}=As({direction:t,sizes:z,minSizes:j,maxSizes:T,step:o,onResize:D,onResizeEnd:l}),O=(0,u.useCallback)(e=>t=>{const r={...t,pointerId:1,pointerType:"mouse",nativeEvent:t.nativeEvent};_(e)(r)},[_]),L=(0,u.useCallback)(e=>t=>{const r=t.touches[0];if(!r)return;const n={...t,clientX:r.clientX,clientY:r.clientY,pointerId:r.identifier,pointerType:"touch",nativeEvent:t.nativeEvent};_(e)(n)},[_]),F=(0,u.useCallback)(()=>{},[]),B={display:"flex",flexDirection:"horizontal"===t?"row":"column",height:"100%",width:"100%",overflow:"hidden",position:"relative",...d},H=bs("split-pane",t,c);return(0,m.jsx)("div",{ref:v,className:H,style:B,children:y>0&&(()=>{if(2>k)return null;const e=[];return S.forEach((n,a)=>{const o=z[a]??0,i={..."horizontal"===t?{width:o+"px",height:"100%"}:{height:o+"px",width:"100%"},...n.props.style};if(e.push((0,m.jsx)(ws,{...n.props,style:i,children:n.props.children},"pane-"+a)),k-1>a){const n=j[a],i=T[a];e.push((0,m.jsx)(h??Cs,{direction:t,index:a,isDragging:I,disabled:!r,onPointerDown:_(a),onMouseDown:O(a),onTouchStart:L(a),onTouchEnd:F,onKeyDown:P(a),className:f,style:p,currentSize:o,minSize:n,maxSize:i===1/0?void 0:i},"divider-"+a))}}),e})()})}var Ds={plate:Ji,tiptap:ys};function Is({activeDocument:e,engine:t="plate",documents:r,splitViewDocId:n,activeDocId:a,isMobile:o,editorRef:i,onUpdateDocument:s,onHeadingsChange:l,onCloseSplitView:c,aiSuggestion:d,isAiLoading:u,onAiRewrite:h,onAiApprove:p,onAiReject:g,onAiRegenerate:x,onInviteClick:v,onShareClick:y}){const b=Ds[t]??Ds.plate;if(!e)return(0,m.jsx)("div",{className:"flex h-full items-center justify-center bg-editor-bg",children:(0,m.jsxs)("div",{className:"text-center",children:[(0,m.jsx)(f.FileText,{className:"mx-auto h-16 w-16 text-muted-foreground mb-4"}),(0,m.jsx)("h2",{className:"text-2xl font-serif font-semibold text-foreground mb-2",children:"No Note Selected"}),(0,m.jsx)("p",{className:"text-muted-foreground",children:o?"Tap the menu to select a note":"Select a note from the sidebar or create a new one"})]})});if(n&&n!==a){const t=r.find(e=>e.id===n);return(0,m.jsx)("div",{className:"flex-1 h-full",children:(0,m.jsxs)(Rs,{direction:"horizontal",children:[(0,m.jsx)(ws,{minSize:"300px",children:(0,m.jsx)("div",{className:"flex flex-col h-full border-r border-border",children:(0,m.jsx)("div",{className:"flex-1 min-h-0",children:(0,m.jsx)(b,{ref:i,contentKey:e.id,content:e.content,onChange:t=>s(e.id,{content:t}),title:e.title,onTitleChange:t=>s(e.id,{title:t}),scrollToHeading:()=>{},onHeadingsChange:l,aiSuggestion:d,isAiLoading:u,onAiRewrite:h,onAiApprove:p,onAiReject:g,onAiRegenerate:x,onInviteClick:v,onShareClick:y,documentId:e.id})})})}),(0,m.jsx)(ws,{minSize:"300px",children:(0,m.jsx)("div",{className:"flex flex-col h-full",children:t?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-muted/30",children:[(0,m.jsx)("span",{className:"text-sm font-medium",children:t.title}),(0,m.jsx)(is,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:c,title:"Close split view",children:(0,m.jsx)(f.X,{className:"h-3 w-3"})})]}),(0,m.jsx)("div",{className:"flex-1 min-h-0",children:(0,m.jsx)(b,{content:t.content,onChange:e=>s(t.id,{content:e}),title:t.title,onTitleChange:e=>s(t.id,{title:e}),scrollToHeading:()=>{},onInviteClick:v,onShareClick:y,documentId:t.id})})]}):null})})]})})}return(0,m.jsx)("div",{className:"h-full flex flex-col",children:(0,m.jsx)(b,{ref:i,contentKey:e.id,content:e.content,onChange:t=>s(e.id,{content:t}),title:e.title,onTitleChange:t=>s(e.id,{title:t}),scrollToHeading:()=>{},onHeadingsChange:l,aiSuggestion:d,isAiLoading:u,onAiRewrite:h,onAiApprove:p,onAiReject:g,onAiRegenerate:x,onInviteClick:v,onShareClick:y,documentId:e.id})})}var zs=Object.create,_s=Object.defineProperty,Ps=Object.getOwnPropertyDescriptor,Os=Object.getOwnPropertyNames,Ls=Object.getPrototypeOf,Fs=Object.prototype.hasOwnProperty,Bs=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),Hs=(e,t,r)=>(r=null==e?{}:zs(Ls(e)),((e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var a,o=Os(t),i=0,s=o.length;i<s;i++)a=o[i],!Fs.call(e,a)&&a!==r&&_s(e,a,{get:(e=>t[e]).bind(null,a),enumerable:!(n=Ps(t,a))||n.enumerable});return e})(!t&&e&&e.__esModule&&Fs.call(e,"default")?r:_s(r,"default",{value:e,enumerable:!0}),e));function Vs(e,t){let r=[],n=new Set([t]),a=[t];for(;a.length>0;){let t=[];for(let r of a)for(let a of e[r]?.children??[])n.has(a)||(n.add(a),e[a]?.isFolder&&t.push(a));if(0===t.length)break;r.push(t),a=t}return r}function $s(e,t){return Vs(e,t).length}function qs(e,t,r){return r<=0?[]:Vs(e,t).slice(0,r).flat()}function Us(e,t,r){let n=new Set(r),a=0;for(let o of Vs(e,t)){if(!o.every(e=>n.has(e)))break;a++}return a}var Gs=Object.defineProperty,Ws=(e,t)=>Gs(e,"name",{value:t,configurable:!0}),Ks=!!(typeof window<"u"&&window.document&&window.document.createElement);function Ys(e,t,{checkForDefaultPrevented:r=!0}={}){return Ws(function(n){if(e?.(n),!1===r||!n||!n.defaultPrevented)return t?.(n)},"handleEvent")}function Xs(e){if(!Ks)throw Error("Cannot access document outside of the DOM");return e?.ownerDocument??document}function Zs(e){return"IFRAME"===e.tagName}Ws(Ys,"composeEventHandlers"),Ws(function(e){if(!Ks)throw Error("Cannot access window outside of the DOM");return e?.ownerDocument?.defaultView??window},"getOwnerWindow"),Ws(Xs,"getOwnerDocument"),Ws(function e(t,r=!1){let{activeElement:n}=Xs(t);if(!n?.nodeName)return null;if(Zs(n)&&n.contentDocument)return e(n.contentDocument.body,r);if(r){let e=n.getAttribute("aria-activedescendant");if(e){let t=Xs(n).getElementById(e);if(t)return t}}return n},"getActiveElement"),Ws(Zs,"isFrame");var Js=Object.defineProperty,Qs=(e,t)=>Js(e,"name",{value:t,configurable:!0});function el(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function tl(...e){return t=>{let r=!1,n=e.map(e=>{let n=el(e,t);return!r&&"function"==typeof n&&(r=!0),n});if(r)return()=>{for(let t=0;t<n.length;t++){let r=n[t];"function"==typeof r?r():el(e[t],null)}}}}function rl(...e){return u.useCallback(tl(...e),e)}Qs(el,"setRef"),Qs(tl,"composeRefs"),Qs(rl,"useComposedRefs");var nl=Object.defineProperty,al=(e,t)=>nl(e,"name",{value:t,configurable:!0});function ol(e,t=[]){let r=[];function n(t,n){let a=u.createContext(n);a.displayName=t+"Context";let o=r.length;r=[...r,n];let i=al(t=>{let{scope:r,children:n,...i}=t,s=r?.[e]?.[o]||a,l=u.useMemo(()=>i,Object.values(i));return(0,m.jsx)(s.Provider,{value:l,children:n})},"Provider");function s(r,i,s={}){let{optional:l=!1}=s,c=i?.[e]?.[o]||a,d=u.useContext(c);if(d)return d;if(void 0!==n)return n;if(!l)throw Error(`\`${r}\` must be used within \`${t}\``)}return i.displayName=t+"Provider",al(s,"useContext"),[i,s]}al(n,"createContext");let a=al(()=>{let t=r.map(e=>u.createContext(e));return al(function(r){let n=r?.[e]||t;return u.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])},"useScope")},"createScope");return a.scopeName=e,[n,il(a,...t)]}function il(...e){let t=e[0];if(1===e.length)return t;let r=al(()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return al(function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>({...t,...r(e)[`__scope${n}`]}),{});return u.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])},"useComposedScopes")},"createScope");return r.scopeName=t.scopeName,r}al(function(e,t){let r=u.createContext(t);r.displayName=e+"Context";let n=al(e=>{let{children:t,...n}=e,a=u.useMemo(()=>n,Object.values(n));return(0,m.jsx)(r.Provider,{value:a,children:t})},"Provider");function a(n,a={}){let{optional:o=!1}=a,i=u.useContext(r);if(i)return i;if(void 0!==t)return t;if(!o)throw Error(`\`${n}\` must be used within \`${e}\``)}return n.displayName=e+"Provider",al(a,"useContext"),[n,a]},"createContext"),al(ol,"createContextScope"),al(il,"composeContextScopes");var sl=globalThis?.document?u.useLayoutEffect:()=>{},ll=Object.defineProperty,cl=u.useId||(()=>{}),dl=0;function ul(e){let[t,r]=u.useState(cl());return sl(()=>{e||r(e=>e??String(dl++))},[e]),e||(t?`radix-${t}`:"")}ll(ul,"name",{value:"useId",configurable:!0});var hl=Object.defineProperty,pl=u.useEffectEvent,ml=u.useInsertionEffect;function fl(e){if("function"==typeof pl)return pl(e);let t=u.useRef(()=>{throw Error("Cannot call an event handler while rendering.")});return"function"==typeof ml?ml(()=>{t.current=e}):sl(()=>{t.current=e}),u.useMemo(()=>(...e)=>t.current?.(...e),[])}((e,t)=>{hl(e,"name",{value:t,configurable:!0})})(fl,"useEffectEvent");var gl=Object.defineProperty,xl=(e,t)=>gl(e,"name",{value:t,configurable:!0}),vl=u.useInsertionEffect||sl;function yl({prop:e,defaultProp:t,onChange:r=xl(()=>{},"onChange"),caller:n}){let[a,o,i]=bl({defaultProp:t,onChange:r}),s=void 0!==e;return[s?e:a,u.useCallback(t=>{if(s){let r=wl(t)?t(e):t;r!==e&&i.current?.(r)}else o(t)},[s,e,o,i])]}function bl({defaultProp:e,onChange:t}){let[r,n]=u.useState(e),a=u.useRef(r),o=u.useRef(t);return vl(()=>{o.current=t},[t]),u.useEffect(()=>{a.current!==r&&(o.current?.(r),a.current=r)},[r,a]),[r,n,o]}function wl(e){return"function"==typeof e}xl(yl,"useControllableState"),xl(bl,"useUncontrolledState"),xl(wl,"isFunction");var Sl=Symbol("RADIX:SYNC_STATE");xl(function(e,t,r,n){let{prop:a,defaultProp:o,onChange:i,caller:s}=t,l=void 0!==a,c=fl(i),d=[{...r,state:o}];n&&d.push(n);let[h,p]=u.useReducer((t,r)=>{if(r.type===Sl)return{...t,state:r.state};let n=e(t,r);return l&&!Object.is(n.state,t.state)&&c(n.state),n},...d),m=h.state,f=u.useRef(m);u.useEffect(()=>{f.current!==m&&(f.current=m,l||c(m))},[m,f,l]);let g=u.useMemo(()=>void 0===a?h:{...h,state:a},[h,a]);return u.useEffect(()=>{l&&!Object.is(a,h.state)&&p({type:Sl,state:a})},[a,h.state,l]),[g,p]},"useControllableStateReducer");var kl=Object.defineProperty,Cl=(e,t)=>kl(e,"name",{value:t,configurable:!0});function jl(e){let t=u.forwardRef((t,r)=>{let{children:n,...a}=t,o=null,i=!1,s=[];zl(n)&&"function"==typeof Ll&&(n=Ll(n._payload)),u.Children.forEach(n,e=>{if(Dl(e)){i=!0;let t=e,r="child"in t.props?t.props.child:t.props.children;zl(r)&&"function"==typeof Ll&&(r=Ll(r._payload)),o=El(t,r),s.push(o?.props?.children)}else s.push(e)}),o?o=u.cloneElement(o,void 0,s):!i&&1===u.Children.count(n)&&u.isValidElement(n)&&(o=n);let l=o?Rl(o):void 0,c=rl(r,l);if(!o){if(n||0===n)throw Error(i?Ol(e):Pl(e));return n}let d=Al(a,o.props??{});return o.type!==u.Fragment&&(d.ref=r?c:l),u.cloneElement(o,d)});return t.displayName=`${e}.Slot`,t}Cl(jl,"createSlot");var Tl=jl("Slot"),Nl=Symbol.for("radix.slottable");function Ml(e){let t=Cl(e=>"child"in e?e.children(e.child):e.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=Nl,t}Cl(Ml,"createSlottable");var El=Cl((e,t)=>{if("child"in e.props){let t=e.props.child;return u.isValidElement(t)?u.cloneElement(t,void 0,e.props.children(t.props.children)):null}return u.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function Al(e,t){let r={...t};for(let n in t){let a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{let t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}function Rl(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function Dl(e){return u.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Nl}Cl(Al,"mergeProps"),Cl(Rl,"getElementRef"),Cl(Dl,"isSlottable");var Il=Symbol.for("react.lazy");function zl(e){return"object"==typeof e&&!!e&&"$$typeof"in e&&e.$$typeof===Il&&"_payload"in e&&_l(e._payload)}function _l(e){return"object"==typeof e&&!!e&&"then"in e}Cl(zl,"isLazyComponent"),Cl(_l,"isPromiseLike");var Pl=Cl(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),Ol=Cl(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Ll=u.use,Fl=Object.defineProperty,Bl=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let r=jl(`Primitive.${t}`),n=u.forwardRef((e,n)=>{let{asChild:a,...o}=e,i=a?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,m.jsx)(i,{...o,ref:n})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function Hl(e,t){e&&v.flushSync(()=>e.dispatchEvent(t))}((e,t)=>{Fl(e,"name",{value:t,configurable:!0})})(Hl,"dispatchDiscreteCustomEvent");var Vl=Object.defineProperty;function $l(e){let t=u.useRef(e);return u.useEffect(()=>{t.current=e}),u.useMemo(()=>(...e)=>t.current?.(...e),[])}((e,t)=>{Vl(e,"name",{value:t,configurable:!0})})($l,"useCallbackRef");var ql,Ul=Object.defineProperty,Gl=(e,t)=>Ul(e,"name",{value:t,configurable:!0}),Wl="dismissableLayer.update",Kl=u.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Yl=u.forwardRef(Gl(function(e,t){let{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:n=!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:l,...c}=e,d=u.useContext(Kl),[h,p]=u.useState(null),f=h?.ownerDocument??globalThis?.document,[,g]=u.useState({}),x=rl(t,p),v=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=y?v.indexOf(y):-1,w=h?v.indexOf(h):-1,S=d.layersWithOutsidePointerEventsDisabled.size>0,k=w>=b,C=u.useRef(!1),j=Jl(e=>{o?.(e),s?.(e),e.defaultPrevented||l?.()},{ownerDocument:f,deferPointerDownOutside:n,isDeferredPointerDownOutsideRef:C,dismissableSurfaces:d.dismissableSurfaces,shouldHandlePointerDownOutside:u.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...d.branches].some(t=>t.contains(e));return k&&!t},[d.branches,k])}),T=Ql(e=>{if(n&&C.current)return;let t=e.target;[...d.branches].some(e=>e.contains(t))||(i?.(e),s?.(e),e.defaultPrevented||l?.())},f),N=!!h&&w===v.length-1,M=$l(e=>{"Escape"===e.key&&(a?.(e),!e.defaultPrevented&&l&&(e.preventDefault(),l()))});return u.useEffect(()=>{if(N)return f.addEventListener("keydown",M,{capture:!0}),()=>f.removeEventListener("keydown",M,{capture:!0})},[f,N,M]),u.useEffect(()=>{if(h)return r&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(ql=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(h)),d.layers.add(h),ec(),()=>{r&&(d.layersWithOutsidePointerEventsDisabled.delete(h),0===d.layersWithOutsidePointerEventsDisabled.size&&(f.body.style.pointerEvents=ql))}},[h,f,r,d]),u.useEffect(()=>()=>{h&&(d.layers.delete(h),d.layersWithOutsidePointerEventsDisabled.delete(h),ec())},[h,d]),u.useEffect(()=>{let e=Gl(()=>g({}),"handleUpdate");return document.addEventListener(Wl,e),()=>document.removeEventListener(Wl,e)},[]),(0,m.jsx)(Bl.div,{...c,ref:x,style:{pointerEvents:S?k?"auto":"none":void 0,...e.style},onFocusCapture:Ys(e.onFocusCapture,T.onFocusCapture),onBlurCapture:Ys(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:Ys(e.onPointerDownCapture,j.onPointerDownCapture)})},"DismissableLayer"));function Xl(){let e=u.useContext(Kl),[t,r]=u.useState(null);return u.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),r}Gl(Xl,"useDismissableLayerSurface");var Zl=Gl(()=>!0,"IS_TRUE");function Jl(e,t){let{ownerDocument:r=globalThis?.document,deferPointerDownOutside:n=!1,isDeferredPointerDownOutsideRef:a,dismissableSurfaces:o,shouldHandlePointerDownOutside:i=Zl}=t,s=$l(e),l=u.useRef(!1),c=u.useRef(!1),d=u.useRef(new Map),h=u.useRef(()=>{});return u.useEffect(()=>{function e(){c.current=!1,a.current=!1,d.current.clear()}function t(){return Array.from(d.current.values()).some(Boolean)}function u(e){if(!c.current)return;let t=e.target;t instanceof Node&&[...o].some(e=>e.contains(t))||d.current.set(e.type,!0),"click"===e.type&&window.setTimeout(()=>{c.current&&h.current()},0)}function p(e){c.current&&d.current.set(e.type,!1)}Gl(e,"resetOutsideInteraction"),Gl(t,"isOutsideInteractionIntercepted"),Gl(u,"handleInteractionCapture"),Gl(p,"handleInteractionBubble");let m=Gl(o=>{if(o.target&&!l.current){let u=function(){r.removeEventListener("click",h.current);let n=t();e(),n||tc("dismissableLayer.pointerDownOutside",s,p,{discrete:!0})};if(Gl(u,"handleAndDispatchPointerDownOutsideEvent"),!i(o.target))return r.removeEventListener("click",h.current),e(),void(l.current=!1);let p={originalEvent:o};c.current=!0,a.current=n&&0===o.button,d.current.clear(),n&&0===o.button?(r.removeEventListener("click",h.current),h.current=u,r.addEventListener("click",h.current,{once:!0})):u()}else r.removeEventListener("click",h.current),e();l.current=!1},"handlePointerDown"),f=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(let n of f)r.addEventListener(n,u,!0),r.addEventListener(n,p);let g=window.setTimeout(()=>{r.addEventListener("pointerdown",m)},0);return()=>{window.clearTimeout(g),r.removeEventListener("pointerdown",m),r.removeEventListener("click",h.current);for(let e of f)r.removeEventListener(e,u,!0),r.removeEventListener(e,p)}},[r,s,n,a,o,i]),{onPointerDownCapture:Gl(()=>l.current=!0,"onPointerDownCapture")}}function Ql(e,t=globalThis?.document){let r=$l(e),n=u.useRef(!1);return u.useEffect(()=>{let e=Gl(e=>{e.target&&!n.current&&tc("dismissableLayer.focusOutside",r,{originalEvent:e},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,r]),{onFocusCapture:Gl(()=>n.current=!0,"onFocusCapture"),onBlurCapture:Gl(()=>n.current=!1,"onBlurCapture")}}function ec(){let e=new CustomEvent(Wl);document.dispatchEvent(e)}function tc(e,t,r,{discrete:n}){let a=r.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?Hl(a,o):a.dispatchEvent(o)}Gl(Jl,"usePointerDownOutside"),Gl(Ql,"useFocusOutside"),Gl(ec,"dispatchUpdate"),Gl(tc,"handleAndDispatchCustomEvent");var rc=Object.defineProperty,nc=(e,t)=>rc(e,"name",{value:t,configurable:!0}),ac="focusScope.autoFocusOnMount",oc="focusScope.autoFocusOnUnmount",ic={bubbles:!1,cancelable:!0},sc=u.forwardRef(nc(function(e,t){let{loop:r=!1,trapped:n=!1,onMountAutoFocus:a,onUnmountAutoFocus:o,...i}=e,[s,l]=u.useState(null),c=$l(a),d=$l(o),h=u.useRef(null),p=rl(t,l),f=u.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;u.useEffect(()=>{if(n){let e=function(e){if(f.paused||!s)return;let t=e.target;s.contains(t)?h.current=t:mc(h.current,{select:!0})},t=function(e){if(f.paused||!s)return;let t=e.relatedTarget;null!==t&&(s.contains(t)||mc(h.current,{select:!0}))},r=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&mc(s)};nc(e,"handleFocusIn"),nc(t,"handleFocusOut"),nc(r,"handleMutations"),document.addEventListener("focusin",e),document.addEventListener("focusout",t);let n=new MutationObserver(r);return s&&n.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),n.disconnect()}}},[n,s,f.paused]),u.useEffect(()=>{if(s){fc.add(f);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(ac,ic);s.addEventListener(ac,c),s.dispatchEvent(t),t.defaultPrevented||(lc(vc(dc(s)),{select:!0}),document.activeElement===e&&mc(s))}return()=>{s.removeEventListener(ac,c),setTimeout(()=>{let t=new CustomEvent(oc,ic);s.addEventListener(oc,d),s.dispatchEvent(t),t.defaultPrevented||mc(e??document.body,{select:!0}),s.removeEventListener(oc,d),fc.remove(f)},0)}}},[s,c,d,f]);let g=u.useCallback(e=>{if(!r&&!n||f.paused)return;let t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,a=document.activeElement;if(t&&a){let t=e.currentTarget,[n,o]=cc(t);n&&o?e.shiftKey||a!==o?e.shiftKey&&a===n&&(e.preventDefault(),r&&mc(o,{select:!0})):(e.preventDefault(),r&&mc(n,{select:!0})):a===t&&e.preventDefault()}},[r,n,f.paused]);return(0,m.jsx)(Bl.div,{tabIndex:-1,...i,ref:p,onKeyDown:g})},"FocusScope"));function lc(e,{select:t=!1}={}){let r=document.activeElement;for(let n of e)if(mc(n,{select:t}),document.activeElement!==r)return}function cc(e){let t=dc(e);return[uc(t,e),uc(t.reverse(),e)]}function dc(e){let t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:nc(e=>{let t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;r.nextNode();)t.push(r.currentNode);return t}function uc(e,t){let r="function"==typeof t.checkVisibility&&t.checkVisibility({checkVisibilityCSS:!0});for(let n of e)if(!(r?!n.checkVisibility({checkVisibilityCSS:!0}):hc(n,{upTo:t})))return n}function hc(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function pc(e){return e instanceof HTMLInputElement&&"select"in e}function mc(e,{select:t=!1}={}){if(e&&e.focus){let r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&pc(e)&&t&&e.select()}}nc(lc,"focusFirst"),nc(cc,"getTabbableEdges"),nc(dc,"getTabbableCandidates"),nc(uc,"findVisible"),nc(hc,"isHidden"),nc(pc,"isSelectableInput"),nc(mc,"focus");var fc=gc();function gc(){let e=[];return{add(t){let r=e[0];t!==r&&r?.pause(),e=xc(e,t),e.unshift(t)},remove(t){e=xc(e,t),e[0]?.resume()}}}function xc(e,t){let r=[...e],n=r.indexOf(t);return-1!==n&&r.splice(n,1),r}function vc(e){return e.filter(e=>"A"!==e.tagName)}nc(gc,"createFocusScopesStack"),nc(xc,"arrayRemove"),nc(vc,"removeLinks");var yc=Object.defineProperty,bc=u.forwardRef((()=>yc(function(e,t){let{container:r,...n}=e,[a,o]=u.useState(!1);sl(()=>o(!0),[]);let i=r||a&&globalThis?.document?.body;return i?v.createPortal((0,m.jsx)(Bl.div,{...n,ref:t}),i):null},"name",{value:"Portal",configurable:!0}))()),wc=Object.defineProperty,Sc=(e,t)=>wc(e,"name",{value:t,configurable:!0});function kc(e,t){return u.useReducer((e,r)=>t[e][r]??e,e)}Sc(kc,"useStateMachine");var Cc=Sc(e=>{let{present:t,children:r}=e,n=jc(t),a="function"==typeof r?r({present:n.isPresent}):u.Children.only(r),o=Nc(n.ref,Ec(a));return"function"==typeof r||n.isPresent?u.cloneElement(a,{ref:o}):null},"Presence");function jc(e){let[t,r]=u.useState(),n=u.useRef(null),a=u.useRef(e),o=u.useRef("none"),i=u.useRef(void 0),[s,l]=kc(e?"mounted":"unmounted",{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return u.useEffect(()=>{"mounted"===s?(o.current=i.current??Mc(n.current),i.current=void 0):o.current="none"},[s]),sl(()=>{let t=n.current,r=a.current;if(r!==e){let n=o.current,s=Mc(t);e?(i.current=s,l("MOUNT")):l("none"===s||"none"===t?.display?"UNMOUNT":r&&n!==s?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,l]),sl(()=>{if(t){let e,r=t.ownerDocument.defaultView??window,i=Sc(o=>{let i=Mc(n.current).includes(CSS.escape(o.animationName));if(o.target===t&&i&&(l("ANIMATION_END"),!a.current)){let n=t.style.animationFillMode;t.style.animationFillMode="forwards",e=r.setTimeout(()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=n)})}},"handleAnimationEnd"),s=Sc(e=>{e.target===t&&(o.current=Mc(n.current))},"handleAnimationStart");return t.addEventListener("animationstart",s),t.addEventListener("animationcancel",i),t.addEventListener("animationend",i),()=>{r.clearTimeout(e),t.removeEventListener("animationstart",s),t.removeEventListener("animationcancel",i),t.removeEventListener("animationend",i)}}l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:u.useCallback(e=>{if(e){let t=getComputedStyle(e);n.current=t,i.current=Mc(t)}else n.current=null;r(e)},[])}}function Tc(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function Nc(...e){let t=u.useRef(e);return t.current=e,u.useCallback(e=>{let r=t.current,n=!1,a=r.map(t=>{let r=Tc(t,e);return!n&&"function"==typeof r&&(n=!0),r});if(n)return()=>{for(let e=0;e<a.length;e++){let t=a[e];"function"==typeof t?t():Tc(r[e],null)}}},[])}function Mc(e){return e?.animationName||"none"}function Ec(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}Sc(jc,"usePresence"),Sc(Tc,"setRef"),Sc(Nc,"useStableComposedRefs"),Sc(Mc,"getAnimationName"),Sc(Ec,"getElementRef");var Ac=Object.defineProperty,Rc=(e,t)=>Ac(e,"name",{value:t,configurable:!0}),Dc=0,Ic=null;function zc(){u.useEffect(()=>{Ic||={start:_c(),end:_c()};let{start:e,end:t}=Ic;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Dc++,()=>{1===Dc&&(Ic?.start.remove(),Ic?.end.remove(),Ic=null),Dc=Math.max(0,Dc-1)}},[])}function _c(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}Rc(function(e){return zc(),e.children},"FocusGuards"),Rc(zc,"useFocusGuards"),Rc(_c,"createFocusGuard");var Pc=function(){return Pc=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Pc.apply(this,arguments)};function Oc(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}var Lc="right-scroll-bar-position",Fc="width-before-scroll-bar";function Bc(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var Hc=typeof window<"u"?u.useLayoutEffect:u.useEffect,Vc=new WeakMap;function $c(e,t){var r=function(e,t){var r=(0,u.useState)(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(e){var t=r.value;t!==e&&(r.value=e,r.callback(e,t))}}}})[0];return r.callback=t,r.facade}(t||null,function(t){return e.forEach(function(e){return Bc(e,t)})});return Hc(function(){var t=Vc.get(r);if(t){var n=new Set(t),a=new Set(e),o=r.current;n.forEach(function(e){a.has(e)||Bc(e,null)}),a.forEach(function(e){n.has(e)||Bc(e,o)})}Vc.set(r,e)},[e]),r}function qc(e){return e}var Uc=function(e){var t=e.sideCar,r=Oc(e,["sideCar"]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw Error("Sidecar medium not found");return u.createElement(n,Pc({},r))};Uc.isSideCarExport=!0;var Gc=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=qc);var r=[],n=!1;return{read:function(){if(n)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(e){var a=t(e,n);return r.push(a),function(){r=r.filter(function(e){return e!==a})}},assignSyncMedium:function(e){for(n=!0;r.length;){var t=r;r=[],t.forEach(e)}r={push:function(t){return e(t)},filter:function(){return r}}},assignMedium:function(e){n=!0;var t=[];if(r.length){var a=r;r=[],a.forEach(e),t=r}var o=function(){var r=t;t=[],r.forEach(e)},i=function(){return Promise.resolve().then(o)};i(),r={push:function(e){t.push(e),i()},filter:function(e){return t=t.filter(e),r}}}}}(null);return t.options=Pc({async:!0,ssr:!1},e),t}(),Wc=function(){},Kc=u.forwardRef(function(e,t){var r=u.useRef(null),n=u.useState({onScrollCapture:Wc,onWheelCapture:Wc,onTouchMoveCapture:Wc}),a=n[0],o=n[1],i=e.forwardProps,s=e.children,l=e.className,c=e.removeScrollBar,d=e.enabled,h=e.shards,p=e.sideCar,m=e.noRelative,f=e.noIsolation,g=e.inert,x=e.allowPinchZoom,v=e.as,y=void 0===v?"div":v,b=e.gapMode,w=Oc(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=p,k=$c([r,t]),C=Pc(Pc({},w),a);return u.createElement(u.Fragment,null,d&&u.createElement(S,{sideCar:Gc,removeScrollBar:c,shards:h,noRelative:m,noIsolation:f,inert:g,setCallbacks:o,allowPinchZoom:!!x,lockRef:r,gapMode:b}),i?u.cloneElement(u.Children.only(s),Pc(Pc({},C),{ref:k})):u.createElement(y,Pc({},C,{className:l,ref:k}),s))});Kc.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Kc.classNames={fullWidth:Fc,zeroRight:Lc};function Yc(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__}();return t&&e.setAttribute("nonce",t),e}var Xc=function(){var e=0,t=null;return{add:function(r){0==e&&(t=Yc())&&(function(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}(t,r),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(t)),e++},remove:function(){! --e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Zc=function(){var e=function(){var e=Xc();return function(t,r){u.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}}();return function(t){var r=t.styles,n=t.dynamic;return e(r,n),null}},Jc={left:0,top:0,right:0,gap:0},Qc=function(e){return parseInt(e||"",10)||0},ed=function(e){if(void 0===e&&(e="margin"),typeof window>"u")return Jc;var t=function(e){var t=window.getComputedStyle(document.body),r=t["padding"===e?"paddingLeft":"marginLeft"],n=t["padding"===e?"paddingTop":"marginTop"],a=t["padding"===e?"paddingRight":"marginRight"];return[Qc(r),Qc(n),Qc(a)]}(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},td=Zc(),rd="data-scroll-locked",nd=function(e,t,r,n){var a=e.left,o=e.top,i=e.right,s=e.gap;return void 0===r&&(r="margin"),`\n .with-scroll-bars-hidden {\n overflow: hidden ${n};\n padding-right: ${s}px ${n};\n }\n body[${rd}] {\n overflow: hidden ${n};\n overscroll-behavior: contain;\n ${[t&&`position: relative ${n};`,"margin"===r&&`\n padding-left: ${a}px;\n padding-top: ${o}px;\n padding-right: ${i}px;\n margin-left:0;\n margin-top:0;\n margin-right: ${s}px ${n};\n `,"padding"===r&&`padding-right: ${s}px ${n};`].filter(Boolean).join("")}\n }\n \n .${Lc} {\n right: ${s}px ${n};\n }\n \n .${Fc} {\n margin-right: ${s}px ${n};\n }\n \n .${Lc} .${Lc} {\n right: 0 ${n};\n }\n \n .${Fc} .${Fc} {\n margin-right: 0 ${n};\n }\n \n body[${rd}] {\n --removed-body-scroll-bar-size: ${s}px;\n }\n`},ad=function(){var e=parseInt(document.body.getAttribute("data-scroll-locked")||"0",10);return isFinite(e)?e:0},od=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,a=void 0===n?"margin":n;u.useEffect(function(){return document.body.setAttribute(rd,(ad()+1).toString()),function(){var e=ad()-1;e<=0?document.body.removeAttribute(rd):document.body.setAttribute(rd,e.toString())}},[]);var o=u.useMemo(function(){return ed(a)},[a]);return u.createElement(td,{styles:nd(o,!t,a,r?"":"!important")})},id=!1;if(typeof window<"u")try{var sd=Object.defineProperty({},"passive",{get:function(){return id=!0,!0}});window.addEventListener("test",sd,sd),window.removeEventListener("test",sd,sd)}catch{id=!1}var ld=!!id&&{passive:!1},cd=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return"hidden"!==r[t]&&!(r.overflowY===r.overflowX&&!function(e){return"TEXTAREA"===e.tagName}(e)&&"visible"===r[t])},dd=function(e,t){var r=t.ownerDocument,n=t;do{if(typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host),ud(e,n)){var a=hd(e,n);if(a[1]>a[2])return!0}n=n.parentNode}while(n&&n!==r.body);return!1},ud=function(e,t){return"v"===e?function(e){return cd(e,"overflowY")}(t):function(e){return cd(e,"overflowX")}(t)},hd=function(e,t){return"v"===e?function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]}(t):function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t)},pd=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},md=function(e){return[e.deltaX,e.deltaY]},fd=function(e){return e&&"current"in e?e.current:e},gd=function(e){return`\n .block-interactivity-${e} {pointer-events: none;}\n .allow-interactivity-${e} {pointer-events: all;}\n`},xd=0,vd=[];function yd(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var bd=function(e,t){return e.useMedium(t),Uc}(Gc,function(e){var t=u.useRef([]),r=u.useRef([0,0]),n=u.useRef(),a=u.useState(xd++)[0],o=u.useState(Zc)[0],i=u.useRef(e);u.useEffect(function(){i.current=e},[e]),u.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${a}`);var t=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,o=t.length;a<o;a++)(n||!(a in t))&&(n||=Array.prototype.slice.call(t,0,a),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))}([e.lockRef.current],(e.shards||[]).map(fd),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${a}`)}),function(){document.body.classList.remove(`block-interactivity-${a}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${a}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=u.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!i.current.allowPinchZoom;var a,o=pd(e),s=r.current,l="deltaX"in e?e.deltaX:s[0]-o[0],c="deltaY"in e?e.deltaY:s[1]-o[1],d=e.target,u=Math.abs(l)>Math.abs(c)?"h":"v";if("touches"in e&&"h"===u&&"range"===d.type)return!1;var h=window.getSelection(),p=h&&h.anchorNode;if(p&&(p===d||p.contains(d)))return!1;var m=dd(u,d);if(!m)return!0;if(m?a=u:(a="v"===u?"h":"v",m=dd(u,d)),!m)return!1;if(!n.current&&"changedTouches"in e&&(l||c)&&(n.current=a),!a)return!0;var f=n.current||a;return function(e,t,r,n,a){var o=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),i=o*n,s=r.target,l=t.contains(s),c=!1,d=i>0,u=0,h=0;do{if(!s)break;var p=hd(e,s),m=p[0],f=p[1]-p[2]-o*m;(m||f)&&ud(e,s)&&(u+=f,h+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!l&&s!==document.body||l&&(t.contains(s)||t===s));return(d&&(a&&Math.abs(u)<1||!a&&i>u)||!d&&(a&&Math.abs(h)<1||!a&&-i>h))&&(c=!0),c}(f,t,e,"h"===f?l:c,!0)},[]),l=u.useCallback(function(e){var r=e;if(vd.length&&vd[vd.length-1]===o){var n="deltaY"in r?md(r):pd(r),a=t.current.filter(function(e){return e.name===r.type&&(e.target===r.target||r.target===e.shadowParent)&&function(e,t){return e[0]===t[0]&&e[1]===t[1]}(e.delta,n)})[0];if(a&&a.should)return void(r.cancelable&&r.preventDefault());if(!a){var l=(i.current.shards||[]).map(fd).filter(Boolean).filter(function(e){return e.contains(r.target)});(l.length>0?s(r,l[0]):!i.current.noIsolation)&&r.cancelable&&r.preventDefault()}}},[]),c=u.useCallback(function(e,r,n,a){var o={name:e,delta:r,target:n,should:a,shadowParent:yd(n)};t.current.push(o),setTimeout(function(){t.current=t.current.filter(function(e){return e!==o})},1)},[]),d=u.useCallback(function(e){r.current=pd(e),n.current=void 0},[]),h=u.useCallback(function(t){c(t.type,md(t),t.target,s(t,e.lockRef.current))},[]),p=u.useCallback(function(t){c(t.type,pd(t),t.target,s(t,e.lockRef.current))},[]);u.useEffect(function(){return vd.push(o),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:p}),document.addEventListener("wheel",l,ld),document.addEventListener("touchmove",l,ld),document.addEventListener("touchstart",d,ld),function(){vd=vd.filter(function(e){return e!==o}),document.removeEventListener("wheel",l,ld),document.removeEventListener("touchmove",l,ld),document.removeEventListener("touchstart",d,ld)}},[]);var m=e.removeScrollBar,f=e.inert;return u.createElement(u.Fragment,null,f?u.createElement(o,{styles:gd(a)}):null,m?u.createElement(od,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}),wd=u.forwardRef(function(e,t){return u.createElement(Kc,Pc({},e,{ref:t,sideCar:bd}))});wd.classNames=Kc.classNames;var Sd=new WeakMap,kd=new WeakMap,Cd={},jd=0,Td=function(e){return e&&(e.host||Td(e.parentNode))},Nd=function(e,t,r,n){var a=function(e,t){return t.map(function(t){if(e.contains(t))return t;var r=Td(t);return r&&e.contains(r)?r:null}).filter(function(e){return!!e})}(t,Array.isArray(e)?e:[e]);Cd[r]||(Cd[r]=new WeakMap);var o=Cd[r],i=[],s=new Set,l=new Set(a),c=function(e){e&&!s.has(e)&&(s.add(e),c(e.parentNode))};a.forEach(c);var d=function(e){e&&!l.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))d(e);else try{var t=e.getAttribute(n),a=null!==t&&"false"!==t,l=(Sd.get(e)||0)+1,c=(o.get(e)||0)+1;Sd.set(e,l),o.set(e,c),i.push(e),1===l&&a&&kd.set(e,!0),1===c&&e.setAttribute(r,"true"),a||e.setAttribute(n,"true")}catch(t){}})};return d(t),s.clear(),jd++,function(){i.forEach(function(e){var t=Sd.get(e)-1,a=o.get(e)-1;Sd.set(e,t),o.set(e,a),t||(kd.has(e)||e.removeAttribute(n),kd.delete(e)),a||e.removeAttribute(r)}),--jd||(Sd=new WeakMap,Sd=new WeakMap,kd=new WeakMap,Cd={})}},Md=function(e,t,r){void 0===r&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),a=t||function(e){return typeof document>"u"?null:(Array.isArray(e)?e[0]:e).ownerDocument.body}(e);return a?(n.push.apply(n,Array.from(a.querySelectorAll("[aria-live], script"))),Nd(n,a,r,"aria-hidden")):function(){return null}},Ed=Object.defineProperty,Ad=(e,t)=>Ed(e,"name",{value:t,configurable:!0}),Rd="Dialog",[Dd,Id]=ol(Rd),[zd,_d]=Dd(Rd),Pd=Ad(e=>{let{__scopeDialog:t,children:r,open:n,defaultOpen:a,onOpenChange:o,modal:i=!0}=e,s=u.useRef(null),l=u.useRef(null),[c,d]=yl({prop:n,defaultProp:a??!1,onChange:o,caller:Rd}),[h,p]=u.useState(0),[f,g]=u.useState(0);return(0,m.jsx)(zd,{scope:t,triggerRef:s,contentRef:l,contentId:ul(),titleId:ul(),descriptionId:ul(),titlePresent:h>0,descriptionPresent:f>0,setTitleCount:p,setDescriptionCount:g,open:c,onOpenChange:d,onOpenToggle:u.useCallback(()=>d(e=>!e),[d]),modal:i,children:r})},"Dialog"),Od=u.forwardRef(Ad(function(e,t){let{__scopeDialog:r,...n}=e,a=_d("DialogTrigger",r),o=rl(t,a.triggerRef);return(0,m.jsx)(Bl.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":eu(a.open),...n,ref:o,onClick:Ys(e.onClick,a.onOpenToggle)})},"DialogTrigger")),Ld="DialogPortal",[Fd,Bd]=Dd(Ld,{forceMount:void 0}),Hd=Ad(e=>{let{__scopeDialog:t,forceMount:r,children:n,container:a}=e,o=_d(Ld,t);return(0,m.jsx)(Fd,{scope:t,forceMount:r,children:u.Children.map(n,e=>(0,m.jsx)(Cc,{present:r||o.open,children:(0,m.jsx)(bc,{asChild:!0,container:a,children:e})}))})},"DialogPortal"),Vd="DialogOverlay",$d=u.forwardRef(Ad(function(e,t){let r=Bd(Vd,e.__scopeDialog),{forceMount:n=r.forceMount,...a}=e,o=_d(Vd,e.__scopeDialog);return o.modal?(0,m.jsx)(Cc,{present:n||o.open,children:(0,m.jsx)(Ud,{...a,ref:t})}):null},"DialogOverlay")),qd=jl("DialogOverlay.RemoveScroll"),Ud=u.forwardRef(Ad(function(e,t){let{__scopeDialog:r,...n}=e,a=_d(Vd,r),o=rl(t,Xl());return(0,m.jsx)(wd,{as:qd,allowPinchZoom:!0,shards:[a.contentRef],children:(0,m.jsx)(Bl.div,{"data-state":eu(a.open),...n,ref:o,style:{pointerEvents:"auto",...n.style}})})},"DialogOverlayImpl")),Gd="DialogContent",Wd=u.forwardRef(Ad(function(e,t){let r=Bd(Gd,e.__scopeDialog),{forceMount:n=r.forceMount,...a}=e,o=_d(Gd,e.__scopeDialog);return(0,m.jsx)(Cc,{present:n||o.open,children:o.modal?(0,m.jsx)(Kd,{...a,ref:t}):(0,m.jsx)(Yd,{...a,ref:t})})},"DialogContent")),Kd=u.forwardRef(Ad(function(e,t){let r=_d(Gd,e.__scopeDialog),n=u.useRef(null),a=rl(t,r.contentRef,n);return u.useEffect(()=>{let e=n.current;if(e)return Md(e)},[]),(0,m.jsx)(Xd,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:Ys(e.onCloseAutoFocus,e=>{e.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:Ys(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;(2===t.button||r)&&e.preventDefault()}),onFocusOutside:Ys(e.onFocusOutside,e=>e.preventDefault())})},"DialogContentModal")),Yd=u.forwardRef(Ad(function(e,t){let r=_d(Gd,e.__scopeDialog),n=u.useRef(!1),a=u.useRef(!1);return(0,m.jsx)(Xd,{...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")),Xd=u.forwardRef(Ad(function(e,t){let{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:o,...i}=e,s=_d(Gd,r);return zc(),(0,m.jsx)(m.Fragment,{children:(0,m.jsx)(sc,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:o,children:(0,m.jsx)(Yl,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":eu(s.open),...i,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},"DialogContentImpl")),Zd=u.forwardRef(Ad(function(e,t){let{__scopeDialog:r,...n}=e,a=_d("DialogTitle",r),{setTitleCount:o}=a;return sl(()=>(o(e=>e+1),()=>o(e=>e-1)),[o]),(0,m.jsx)(Bl.h2,{id:a.titleId,...n,ref:t})},"DialogTitle")),Jd=u.forwardRef(Ad(function(e,t){let{__scopeDialog:r,...n}=e,a=_d("DialogDescription",r),{setDescriptionCount:o}=a;return sl(()=>(o(e=>e+1),()=>o(e=>e-1)),[o]),(0,m.jsx)(Bl.p,{id:a.descriptionId,...n,ref:t})},"DialogDescription")),Qd=u.forwardRef(Ad(function(e,t){let{__scopeDialog:r,...n}=e,a=_d("DialogClose",r);return(0,m.jsx)(Bl.button,{type:"button",...n,ref:t,onClick:Ys(e.onClick,()=>a.onOpenChange(!1))})},"DialogClose"));function eu(e){return e?"open":"closed"}Ad(eu,"getState");var tu=e=>e?.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var ru=(...e)=>e.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),nu={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 au(e){return null!=e}function ou(e,t={}){return function(e,t={}){let r=t.attributeNames??{},n=e=>r[e]??e,a=e.size??e.width??nu.width,o=e.size??e.height??nu.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?ru(...l):ru("lucide",...s,...l),d=t.absoluteStrokeWidth?Number(t.strokeWidth??nu["stroke-width"])*Number(e.size??e.width??nu.width)/Number(t.size??t.width??nu.width):t.strokeWidth??nu["stroke-width"];return["svg",{...Object.entries(nu).reduce((e,[t,r])=>(e[n(t)]=r,e),{}),..."color"in t&&t.color&&{[n("stroke")]:t.color},..."size"in t&&au(t.size)&&{[n("width")]:t.size,[n("height")]:t.size},..."width"in t&&au(t.width)&&{[n("width")]:t.width},..."height"in t&&au(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 iu=(0,u.createContext)({}),su=(0,u.forwardRef)(({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},...h},p)=>{let{size:m=24,strokeWidth:f=2,absoluteStrokeWidth:g=!1,nonScalingStroke:x=!1,color:v="currentColor",className:y=""}=(0,u.useContext)(iu)??{},b=!!l||(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1})(h),[w,S,k=[]]=ou(d,{color:e??v,width:r??t??m,height:n??t??m,strokeWidth:a??f,absoluteStrokeWidth:o??g,nonScalingStroke:i??x,className:ru(y,s),hasA11yProp:b,attributes:h});return(0,u.createElement)(w,{ref:p,...S},[...k.map(([e,t])=>(0,u.createElement)(e,t)),...Array.isArray(l)?l:[l]])});function lu(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:tu(e),size:24,node:t,...r.length>0?{aliases:r}:{}}}(e,t,r):e,a=(0,u.forwardRef)(({className:e,...t},r)=>(0,u.createElement)(su,{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 cu={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"}]]},du=(lu(cu),{name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]}),uu=lu(du),hu={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]},pu=lu(hu),mu={name:"chevron-right",size:24,node:[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]},fu=lu(mu),gu={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"}]]},xu=(lu(gu),{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"}]]}),vu=(lu(xu),{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"]}),yu=(lu(vu),{name:"circle",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]}),bu=lu(yu),wu={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"}]]},Su=lu(wu),ku={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"}]]},Cu=lu(ku),ju={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"}]]},Tu=(lu(ju),{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"]}),Nu=(lu(Tu),{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"}]]}),Mu=lu(Nu),Eu={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"}]]},Au=(lu(Eu),{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"]}),Ru=(lu(Au),{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"}]]}),Du=(lu(Ru),{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"]}),Iu=(lu(Du),{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"}]]}),zu=lu(Iu),_u={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"}]]},Pu=lu(_u),Ou={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"}]]},Lu=(lu(Ou),{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"}]]}),Fu=lu(Lu),Bu={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"}]]},Hu=(lu(Bu),{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"}]]}),Vu=(lu(Hu),{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"}]]}),$u=lu(Vu),qu={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"}]]},Uu=(lu(qu),{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"]}),Gu=lu(Uu),Wu={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"}]]},Ku=(lu(Wu),{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"}]]}),Yu=lu(Ku),Xu={name:"loader-circle",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],aliases:["loader-2"]},Zu=(lu(Xu),{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"}]]}),Ju=(lu(Zu),{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"}]]}),Qu=(lu(Ju),{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"}]]}),eh=(lu(Qu),{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"}]]}),th=(lu(eh),{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"}]]}),rh=(lu(th),{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"]}),nh=(lu(rh),{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"}]]}),ah=lu(nh),oh={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"}]]},ih=(lu(oh),{name:"search",size:24,node:[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]}),sh=(lu(ih),{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"}]]}),lh=(lu(sh),{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"}]]}),ch=(lu(lh),{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"]}),dh=lu(ch),uh={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"]},hh=(lu(uh),{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"}]]}),ph=lu(hh),mh={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"]},fh=lu(mh),gh={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"]},xh=lu(gh),vh={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"]},yh=(lu(vh),{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"}]]}),bh=(lu(yh),{name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]});lu(bh);function wh(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=wh(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Sh(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=wh(e))&&(n&&(n+=" "),n+=t);return n}var kh=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Ch="-",jh=[],Th=e=>{let t=Eh(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return Mh(e);let r=e.split(Ch);return Nh(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||jh}return r[e]||jh}}},Nh=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;let n=e[t],a=r.nextPart.get(n);if(a){let r=Nh(e,t+1,a);if(r)return r}let o=r.validators;if(null===o)return;let i=0===t?e.join(Ch):e.slice(t).join(Ch),s=o.length;for(let l=0;l<s;l++){let e=o[l];if(e.validator(i))return e.classGroupId}},Mh=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})(),Eh=e=>{let{theme:t,classGroups:r}=e;return Ah(r,t)},Ah=(e,t)=>{let r=kh();for(let n in e){let a=e[n];Rh(a,r,n,t)}return r},Rh=(e,t,r,n)=>{let a=e.length;for(let o=0;o<a;o++){let a=e[o];Dh(a,t,r,n)}},Dh=(e,t,r,n)=>{"string"!=typeof e?"function"!=typeof e?_h(e,t,r,n):zh(e,t,r,n):Ih(e,t,r)},Ih=(e,t,r)=>{(""===e?t:Ph(t,e)).classGroupId=r},zh=(e,t,r,n)=>{Oh(e)?Rh(e(n),t,r,n):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(r,e)))},_h=(e,t,r,n)=>{let a=Object.entries(e),o=a.length;for(let i=0;i<o;i++){let[e,o]=a[i];Rh(o,Ph(t,e),r,n)}},Ph=(e,t)=>{let r=e,n=t.split(Ch),a=n.length;for(let o=0;o<a;o++){let e=n[o],t=r.nextPart.get(e);t||(t=kh(),r.nextPart.set(e,t)),r=t}return r},Oh=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,Lh=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)}}},Fh=[],Bh=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),Hh=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),Bh(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)):Bh(Fh,!1,t,void 0,!0)}if(r){let e=n;n=t=>r({className:t,parseClassName:e})}return n},Vh=e=>{let t=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}},$h=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},qh=/\s+/,Uh=e=>{if("string"==typeof e)return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Uh(e[n]))&&(r&&(r+=" "),r+=t);return r},Gh=(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(qh),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 x=0===u.length?"":1===u.length?u[0]:o(u).join(":"),v=h?x+"!":x,y=v+f;if(s.indexOf(y)>-1)continue;s.push(y);let b=a(f,g);for(let r=0;r<b.length;++r){let e=b[r];s.push(v+e)}c=e+(c.length>0?" "+c:c)}return c})(e,r);return a(e,o),o};return o=s=>(r=(e=>({cache:Lh(e.cacheSize),parseClassName:Hh(e),sortModifiers:Vh(e),postfixLookupClassGroupIds:$h(e),...Th(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=Uh(t))&&(a&&(a+=" "),a+=r);return a})(...e))},Wh=[],Kh=e=>{let t=t=>t[e]||Wh;return t.isThemeGetter=!0,t},Yh=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Xh=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Zh=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Jh=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Qh=/\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$/,ep=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,tp=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,rp=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,np=e=>Zh.test(e),ap=e=>!!e&&!Number.isNaN(Number(e)),op=e=>!!e&&Number.isInteger(Number(e)),ip=e=>e.endsWith("%")&&ap(e.slice(0,-1)),sp=e=>Jh.test(e),lp=()=>!0,cp=e=>Qh.test(e)&&!ep.test(e),dp=()=>!1,up=e=>tp.test(e),hp=e=>rp.test(e),pp=e=>!gp(e)&&!Cp(e),mp=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)),fp=e=>Dp(e,Pp,dp),gp=e=>Yh.test(e),xp=e=>Dp(e,Op,cp),vp=e=>Dp(e,Lp,ap),yp=e=>Dp(e,Bp,lp),bp=e=>Dp(e,Fp,dp),wp=e=>Dp(e,zp,dp),Sp=e=>Dp(e,_p,hp),kp=e=>Dp(e,Hp,up),Cp=e=>Xh.test(e),jp=e=>Ip(e,Op),Tp=e=>Ip(e,Fp),Np=e=>Ip(e,zp),Mp=e=>Ip(e,Pp),Ep=e=>Ip(e,_p),Ap=e=>Ip(e,Hp,!0),Rp=e=>Ip(e,Bp,!0),Dp=(e,t,r)=>{let n=Yh.exec(e);return!!n&&(n[1]?t(n[1]):r(n[2]))},Ip=(e,t,r=!1)=>{let n=Xh.exec(e);return!!n&&(n[1]?t(n[1]):r)},zp=e=>"position"===e||"percentage"===e,_p=e=>"image"===e||"url"===e,Pp=e=>"length"===e||"size"===e||"bg-size"===e,Op=e=>"length"===e,Lp=e=>"number"===e,Fp=e=>"family-name"===e,Bp=e=>"number"===e||"weight"===e,Hp=e=>"shadow"===e,Vp=Gh(()=>{let e=Kh("color"),t=Kh("font"),r=Kh("text"),n=Kh("font-weight"),a=Kh("tracking"),o=Kh("leading"),i=Kh("breakpoint"),s=Kh("container"),l=Kh("spacing"),c=Kh("radius"),d=Kh("shadow"),u=Kh("inset-shadow"),h=Kh("text-shadow"),p=Kh("drop-shadow"),m=Kh("blur"),f=Kh("perspective"),g=Kh("aspect"),x=Kh("ease"),v=Kh("animate"),y=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Cp,gp],b=()=>[Cp,gp,l],w=()=>[np,"full","auto",...b()],S=()=>[op,"none","subgrid",Cp,gp],k=()=>["auto",{span:["full",op,Cp,gp]},op,Cp,gp],C=()=>[op,"auto",Cp,gp],j=()=>["auto","min","max","fr",Cp,gp],T=()=>["auto",...b()],N=()=>[np,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...b()],M=()=>[np,"screen","full","dvw","lvw","svw","min","max","fit",...b()],E=()=>[np,"screen","full","lh","dvh","lvh","svh","min","max","fit",...b()],A=()=>[e,Cp,gp],R=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Np,wp,{position:[Cp,gp]}],D=()=>["auto","cover","contain",Mp,fp,{size:[Cp,gp]}],I=()=>[ip,jp,xp],z=()=>["","none","full",c,Cp,gp],_=()=>["",ap,jp,xp],P=()=>[ap,ip,Np,wp],O=()=>["","none",m,Cp,gp],L=()=>["none",ap,Cp,gp],F=()=>["none",ap,Cp,gp],B=()=>[ap,Cp,gp],H=()=>[np,"full",...b()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[sp],breakpoint:[sp],color:[lp],container:[sp],"drop-shadow":[sp],ease:["in","out","in-out"],font:[pp],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[sp],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[sp],shadow:[sp],spacing:["px",ap],text:[sp],"text-shadow":[sp],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",np,gp,Cp,g]}],container:["container"],"container-type":[{"@container":["","normal","size",Cp,gp]}],"container-named":[mp],columns:[{columns:[ap,gp,Cp,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:y()}],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:[op,"auto",Cp,gp]}],basis:[{basis:[np,"full","auto",s,...b()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ap,np,"auto","initial","none",gp]}],grow:[{grow:["",ap,Cp,gp]}],shrink:[{shrink:["",ap,Cp,gp]}],order:[{order:[op,"first","last","none",Cp,gp]}],"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":j()}],"auto-rows":[{"auto-rows":j()}],gap:[{gap:b()}],"gap-x":[{"gap-x":b()}],"gap-y":[{"gap-y":b()}],"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:b()}],px:[{px:b()}],py:[{py:b()}],ps:[{ps:b()}],pe:[{pe:b()}],pbs:[{pbs:b()}],pbe:[{pbe:b()}],pt:[{pt:b()}],pr:[{pr:b()}],pb:[{pb:b()}],pl:[{pl:b()}],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":b()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":b()}],"space-y-reverse":["space-y-reverse"],size:[{size:N()}],"inline-size":[{inline:["auto",...M()]}],"min-inline-size":[{"min-inline":["auto",...M()]}],"max-inline-size":[{"max-inline":["none",...M()]}],"block-size":[{block:["auto",...E()]}],"min-block-size":[{"min-block":["auto",...E()]}],"max-block-size":[{"max-block":["none",...E()]}],w:[{w:[s,"screen",...N()]}],"min-w":[{"min-w":[s,"screen","none",...N()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[i]},...N()]}],h:[{h:["screen","lh",...N()]}],"min-h":[{"min-h":["screen","lh","none",...N()]}],"max-h":[{"max-h":["screen","lh",...N()]}],"font-size":[{text:["base",r,jp,xp]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Rp,yp]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ip,gp]}],"font-family":[{font:[Tp,bp,t]}],"font-features":[{"font-features":[gp]}],"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,Cp,gp]}],"line-clamp":[{"line-clamp":[ap,"none",Cp,vp]}],leading:[{leading:[o,...b()]}],"list-image":[{"list-image":["none",Cp,gp]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Cp,gp]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:A()}],"text-color":[{text:A()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[ap,"from-font","auto",Cp,xp]}],"text-decoration-color":[{decoration:A()}],"underline-offset":[{"underline-offset":[ap,"auto",Cp,gp]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:b()}],"tab-size":[{tab:[op,Cp,gp]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Cp,gp]}],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",Cp,gp]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:R()}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:D()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},op,Cp,gp],radial:["",Cp,gp],conic:[op,Cp,gp]},Ep,Sp]}],"bg-color":[{bg:A()}],"gradient-from-pos":[{from:I()}],"gradient-via-pos":[{via:I()}],"gradient-to-pos":[{to:I()}],"gradient-from":[{from:A()}],"gradient-via":[{via:A()}],"gradient-to":[{to:A()}],rounded:[{rounded:z()}],"rounded-s":[{"rounded-s":z()}],"rounded-e":[{"rounded-e":z()}],"rounded-t":[{"rounded-t":z()}],"rounded-r":[{"rounded-r":z()}],"rounded-b":[{"rounded-b":z()}],"rounded-l":[{"rounded-l":z()}],"rounded-ss":[{"rounded-ss":z()}],"rounded-se":[{"rounded-se":z()}],"rounded-ee":[{"rounded-ee":z()}],"rounded-es":[{"rounded-es":z()}],"rounded-tl":[{"rounded-tl":z()}],"rounded-tr":[{"rounded-tr":z()}],"rounded-br":[{"rounded-br":z()}],"rounded-bl":[{"rounded-bl":z()}],"border-w":[{border:_()}],"border-w-x":[{"border-x":_()}],"border-w-y":[{"border-y":_()}],"border-w-s":[{"border-s":_()}],"border-w-e":[{"border-e":_()}],"border-w-bs":[{"border-bs":_()}],"border-w-be":[{"border-be":_()}],"border-w-t":[{"border-t":_()}],"border-w-r":[{"border-r":_()}],"border-w-b":[{"border-b":_()}],"border-w-l":[{"border-l":_()}],"divide-x":[{"divide-x":_()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":_()}],"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:A()}],"border-color-x":[{"border-x":A()}],"border-color-y":[{"border-y":A()}],"border-color-s":[{"border-s":A()}],"border-color-e":[{"border-e":A()}],"border-color-bs":[{"border-bs":A()}],"border-color-be":[{"border-be":A()}],"border-color-t":[{"border-t":A()}],"border-color-r":[{"border-r":A()}],"border-color-b":[{"border-b":A()}],"border-color-l":[{"border-l":A()}],"divide-color":[{divide:A()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[ap,Cp,gp]}],"outline-w":[{outline:["",ap,jp,xp]}],"outline-color":[{outline:A()}],shadow:[{shadow:["","none",d,Ap,kp]}],"shadow-color":[{shadow:A()}],"inset-shadow":[{"inset-shadow":["none",u,Ap,kp]}],"inset-shadow-color":[{"inset-shadow":A()}],"ring-w":[{ring:_()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:A()}],"ring-offset-w":[{"ring-offset":[ap,xp]}],"ring-offset-color":[{"ring-offset":A()}],"inset-ring-w":[{"inset-ring":_()}],"inset-ring-color":[{"inset-ring":A()}],"text-shadow":[{"text-shadow":["none",h,Ap,kp]}],"text-shadow-color":[{"text-shadow":A()}],opacity:[{opacity:[ap,Cp,gp]}],"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":[ap]}],"mask-image-linear-from-pos":[{"mask-linear-from":P()}],"mask-image-linear-to-pos":[{"mask-linear-to":P()}],"mask-image-linear-from-color":[{"mask-linear-from":A()}],"mask-image-linear-to-color":[{"mask-linear-to":A()}],"mask-image-t-from-pos":[{"mask-t-from":P()}],"mask-image-t-to-pos":[{"mask-t-to":P()}],"mask-image-t-from-color":[{"mask-t-from":A()}],"mask-image-t-to-color":[{"mask-t-to":A()}],"mask-image-r-from-pos":[{"mask-r-from":P()}],"mask-image-r-to-pos":[{"mask-r-to":P()}],"mask-image-r-from-color":[{"mask-r-from":A()}],"mask-image-r-to-color":[{"mask-r-to":A()}],"mask-image-b-from-pos":[{"mask-b-from":P()}],"mask-image-b-to-pos":[{"mask-b-to":P()}],"mask-image-b-from-color":[{"mask-b-from":A()}],"mask-image-b-to-color":[{"mask-b-to":A()}],"mask-image-l-from-pos":[{"mask-l-from":P()}],"mask-image-l-to-pos":[{"mask-l-to":P()}],"mask-image-l-from-color":[{"mask-l-from":A()}],"mask-image-l-to-color":[{"mask-l-to":A()}],"mask-image-x-from-pos":[{"mask-x-from":P()}],"mask-image-x-to-pos":[{"mask-x-to":P()}],"mask-image-x-from-color":[{"mask-x-from":A()}],"mask-image-x-to-color":[{"mask-x-to":A()}],"mask-image-y-from-pos":[{"mask-y-from":P()}],"mask-image-y-to-pos":[{"mask-y-to":P()}],"mask-image-y-from-color":[{"mask-y-from":A()}],"mask-image-y-to-color":[{"mask-y-to":A()}],"mask-image-radial":[{"mask-radial":[Cp,gp]}],"mask-image-radial-from-pos":[{"mask-radial-from":P()}],"mask-image-radial-to-pos":[{"mask-radial-to":P()}],"mask-image-radial-from-color":[{"mask-radial-from":A()}],"mask-image-radial-to-color":[{"mask-radial-to":A()}],"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":[ap]}],"mask-image-conic-from-pos":[{"mask-conic-from":P()}],"mask-image-conic-to-pos":[{"mask-conic-to":P()}],"mask-image-conic-from-color":[{"mask-conic-from":A()}],"mask-image-conic-to-color":[{"mask-conic-to":A()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:R()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:D()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Cp,gp]}],filter:[{filter:["","none",Cp,gp]}],blur:[{blur:O()}],brightness:[{brightness:[ap,Cp,gp]}],contrast:[{contrast:[ap,Cp,gp]}],"drop-shadow":[{"drop-shadow":["","none",p,Ap,kp]}],"drop-shadow-color":[{"drop-shadow":A()}],grayscale:[{grayscale:["",ap,Cp,gp]}],"hue-rotate":[{"hue-rotate":[ap,Cp,gp]}],invert:[{invert:["",ap,Cp,gp]}],saturate:[{saturate:[ap,Cp,gp]}],sepia:[{sepia:["",ap,Cp,gp]}],"backdrop-filter":[{"backdrop-filter":["","none",Cp,gp]}],"backdrop-blur":[{"backdrop-blur":O()}],"backdrop-brightness":[{"backdrop-brightness":[ap,Cp,gp]}],"backdrop-contrast":[{"backdrop-contrast":[ap,Cp,gp]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ap,Cp,gp]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ap,Cp,gp]}],"backdrop-invert":[{"backdrop-invert":["",ap,Cp,gp]}],"backdrop-opacity":[{"backdrop-opacity":[ap,Cp,gp]}],"backdrop-saturate":[{"backdrop-saturate":[ap,Cp,gp]}],"backdrop-sepia":[{"backdrop-sepia":["",ap,Cp,gp]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":b()}],"border-spacing-x":[{"border-spacing-x":b()}],"border-spacing-y":[{"border-spacing-y":b()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Cp,gp]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ap,"initial",Cp,gp]}],ease:[{ease:["linear","initial",x,Cp,gp]}],delay:[{delay:[ap,Cp,gp]}],animate:[{animate:["none",v,Cp,gp]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[f,Cp,gp]}],"perspective-origin":[{"perspective-origin":y()}],rotate:[{rotate:L()}],"rotate-x":[{"rotate-x":L()}],"rotate-y":[{"rotate-y":L()}],"rotate-z":[{"rotate-z":L()}],scale:[{scale:F()}],"scale-x":[{"scale-x":F()}],"scale-y":[{"scale-y":F()}],"scale-z":[{"scale-z":F()}],"scale-3d":["scale-3d"],skew:[{skew:B()}],"skew-x":[{"skew-x":B()}],"skew-y":[{"skew-y":B()}],transform:[{transform:[Cp,gp,"","none","gpu","cpu"]}],"transform-origin":[{origin:y()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:H()}],"translate-x":[{"translate-x":H()}],"translate-y":[{"translate-y":H()}],"translate-z":[{"translate-z":H()}],"translate-none":["translate-none"],zoom:[{zoom:[op,Cp,gp]}],accent:[{accent:A()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:A()}],"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",Cp,gp]}],"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":A()}],"scrollbar-track-color":[{"scrollbar-track":A()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":b()}],"scroll-mx":[{"scroll-mx":b()}],"scroll-my":[{"scroll-my":b()}],"scroll-ms":[{"scroll-ms":b()}],"scroll-me":[{"scroll-me":b()}],"scroll-mbs":[{"scroll-mbs":b()}],"scroll-mbe":[{"scroll-mbe":b()}],"scroll-mt":[{"scroll-mt":b()}],"scroll-mr":[{"scroll-mr":b()}],"scroll-mb":[{"scroll-mb":b()}],"scroll-ml":[{"scroll-ml":b()}],"scroll-p":[{"scroll-p":b()}],"scroll-px":[{"scroll-px":b()}],"scroll-py":[{"scroll-py":b()}],"scroll-ps":[{"scroll-ps":b()}],"scroll-pe":[{"scroll-pe":b()}],"scroll-pbs":[{"scroll-pbs":b()}],"scroll-pbe":[{"scroll-pbe":b()}],"scroll-pt":[{"scroll-pt":b()}],"scroll-pr":[{"scroll-pr":b()}],"scroll-pb":[{"scroll-pb":b()}],"scroll-pl":[{"scroll-pl":b()}],"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",Cp,gp]}],fill:[{fill:["none",...A()]}],"stroke-w":[{stroke:[ap,jp,xp,vp]}],stroke:[{stroke:["none",...A()]}],"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 $p(...e){return Vp(Sh(e))}var qp="REASON-file-sources",Up="REASON-active-file-source",Gp={id:"local-default",name:"Local Files",type:"local",isDefault:!0,createdAt:(new Date).toISOString(),updatedAt:(new Date).toISOString()};function Wp(){try{let e=localStorage.getItem(qp);if(e){let t=JSON.parse(e);return t.some(e=>"local-default"===e.id)?t:[Gp,...t]}}catch(e){}return[Gp]}function Kp(e){try{localStorage.setItem(qp,JSON.stringify(e))}catch(e){}}function Yp(){try{return localStorage.getItem(Up)||"local-default"}catch(e){return"local-default"}}function Xp(e){try{localStorage.setItem(Up,e)}catch(e){}}function Zp(e){let[t,r]=(0,u.useState)(e),n=(0,u.useRef)(e);return(0,u.useEffect)(()=>{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 Jp(e,t){return"function"==typeof e?"object"==typeof t?e(t):e():e}function Qp(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 em(e,t="data-id"){let r=Qp(e,t);return r?tm(r,t):null}function tm(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 rm(e){return"string"==typeof e?":"+e:e}(new Date).valueOf();var nm={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 am(e){Object.assign(nm,e)}function om(e,t,r){nm.addEvent(e,r,function(e){let n=Qp(e);if(!n)return;let a=tm(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 im(e,t){om(e,t,"click"),t.dblclick&&om(e,t.dblclick,"dblclick")}function sm(e,t,r){for(let n=0;n<um.length;n++){if(n===r)continue;let a=um[n],o=a.props.parent?.();if(o&&e.contains(o)&&a.node.contains(t))return!0}return!1}var lm=new Date,cm=!1,dm=[],um=[],hm=e=>{let t=e.target;if(!cm&&t.isConnected)for(let r=um.length-1;r>=0;r--){let{node:n,date:a,props:o}=um[r];if(!(a>lm)&&!n.contains(t)&&n!==t&&(sm(n,t,r)||(o.callback&&o.callback(e),o.modal||e.defaultPrevented)))break}else cm=!1},pm=e=>{lm=new Date,cm=!0;for(let t=um.length-1;t>=0;t--){let{node:r}=um[t];if(!r.contains(e.target)&&r!==e.target){cm=!1;break}}};function mm(e,t){dm.length||(dm=[nm.addGlobalEvent("click",hm,e),nm.addGlobalEvent("contextmenu",hm,e),nm.addGlobalEvent("mousedown",pm,e)]),"object"!=typeof t&&(t={callback:t});let r={node:e,date:new Date,props:t};return um.push(r),{destroy(){(function(e,t){for(let r=e.length-1;r>=0;r--)if(e[r]===t){e.splice(r,1);break}})(um,r),um.length||(dm.forEach(e=>e()),dm=[])}}}var fm,gm,xm,vm,ym=e=>-1!==e.indexOf("bottom"),bm=e=>-1!==e.indexOf("left"),wm=e=>-1!==e.indexOf("right"),Sm=e=>-1!==e.indexOf("top"),km=e=>-1!==e.indexOf("fit"),Cm=e=>-1!==e.indexOf("overlap");function jm(e,t,r="bottom",n=0,a=0){if(!e)return null;fm=n,gm=a,xm="auto";let o=0,i=0,s=r,l=Tm(e),c=Cm(r)?nm.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 b in m){let e=`border-${b}-width`;m[b]=parseFloat(p.getPropertyValue(e))}if(t){let e=function(e,t){let r=0,n=nm.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(vm=t.getBoundingClientRect(),km(r)&&(xm=vm.width+"px"),"point"!==r)if((e=>e.split("-").every(e=>["center","fit"].indexOf(e)>-1))(r))km(r)?fm=0:(fm=h.width/2,i=1),gm=(h.height-u.height)/2;else{let e=+!Cm(r);fm=wm(r)?vm.right+e:vm.left-e,gm=ym(r)?vm.bottom+1:vm.top;let t=(e=>{let t=e.match(/(start|center|end)/);return t?t[0]:null})(r);t&&(wm(r)||bm(r)?"center"===t?gm-=(u.height-vm.height)/2:"end"===t&&(gm-=u.height-vm.height):(ym(r)||Sm(r))&&("center"===t?fm-=(u.width-vm.width)/2:"end"===t&&(fm-=u.width-vm.width),Cm(r)||(fm+=1)))}}else vm={left:n,right:n,top:a,bottom:a};let f=(bm(r)||wm(r))&&(ym(r)||Sm(r));bm(r)&&(i=2);let g=fm-u.width-h.left;t&&bm(r)&&!f&&g<0&&(fm=vm.right,i=0,s=s.replace("left","right"));let x=fm+u.width*(1-i/2)-h.right;if(x>0)if(wm(r)){let e=vm.left-h.x-u.width;t&&!f&&e>=0?(fm=vm.left-u.width,s=s.replace("right","left")):fm-=x+m.right}else fm=h.right-m.right-u.width;i&&(fm=Math.round(fm-u.width*i/2));let v=g<0||x>0||!f;Sm(r)&&(gm=vm.top-u.height,t&&gm<h.y&&v&&(gm=vm.bottom,s=s.replace("top","bottom")));let y=gm+u.height-h.bottom;return y>0&&(t&&ym(r)&&v?(gm-=u.height+vm.height+1,s=s.replace("bottom","top")):gm-=y+m.bottom),fm-=d.left+m.left,gm-=d.top+m.top,fm=(Cm(r)?fm:Math.max(fm,0))+c.scrollLeft,gm=(Cm(r)?gm:Math.max(gm,0))+c.scrollTop,xm||="auto",{at:s,x:fm,y:gm,z:o,width:xm}}function Tm(e){let t=nm.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 Nm=(new Date).valueOf();function Mm(){return Nm+=1}function Em(e){return e<10?"0"+e:e.toString()}function Am(e){let t=11*Math.floor(e/11);return{start:t,end:t+11}}function Rm(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 Dm=["",""];function Im(e,t,r){switch(e){case"%d":return Em(t.getDate());case"%m":return Em(t.getMonth()+1);case"%j":return t.getDate();case"%n":return t.getMonth()+1;case"%y":return Em(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 Em((t.getHours()+11)%12+1);case"%g":return(t.getHours()+11)%12+1;case"%G":return t.getHours();case"%H":return Em(t.getHours());case"%i":return Em(t.getMinutes());case"%a":return((t.getHours()>11?r.pm:r.am)||Dm)[0];case"%A":return((t.getHours()>11?r.pm:r.am)||Dm)[1];case"%s":return Em(t.getSeconds());case"%S":return function(e){let t=Em(e);return 2==t.length?"0"+t:t}(t.getMilliseconds());case"%W":return Em(Rm(t));case"%w":{let e=r.weekStart??1;if(1===e)return Em(Rm(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)),Em(Rm(o))}case"%c":{let e=t.getFullYear()+"";return e+="-"+Em(t.getMonth()+1),e+="-"+Em(t.getDate()),e+="T",e+=Em(t.getHours()),e+=":"+Em(t.getMinutes()),e+=":"+Em(t.getSeconds()),e}case"%Q":return Math.floor(t.getMonth()/3)+1;default:return e}}var zm=/%[a-zA-Z]/g;function _m(e,t){return"function"==typeof e?e:function(r){return r?(r.getMonth||(r=new Date(r)),e.replace(zm,e=>Im(e,r,t))):""}}function Pm(e){return e&&"object"==typeof e&&!Array.isArray(e)}function Om(e,t){for(let r in t){let n=t[r];e[r]=Pm(e[r])&&Pm(n)?Om({...e[r]},t[r]):t[r]}return e}function Lm(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?Om({...t},e):Om({...e},t),Lm(n)}}}var Fm={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"},Bm=(0,u.createContext)(""),Hm=(0,u.createContext)({}),Vm=(0,u.createContext)(null),$m=(0,u.createContext)(null),qm=Object.freeze(Object.defineProperty({__proto__:null,fieldId:$m,helpers:Hm,i18n:Vm,theme:Bm},Symbol.toStringTag,{value:"Module"}));function Um(e){let t=(0,u.useContext)($m),[r]=(0,u.useState)(()=>e||t||Mm());return r}function Gm({type:e="",css:t="",icon:r="",disabled:n=!1,title:a="",tooltip:o,text:i="",children:s,onClick:l}){let c=(0,u.useMemo)(()=>{let r=e?e.split(" ").filter(e=>""!==e).map(e=>"wx-"+e).join(" "):"";return t+(t?" ":"")+r},[e,t]);return(0,m.jsxs)("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&&(0,m.jsx)("i",{className:"wx-2ZWgb4 "+r}),s||i||" "]})}function Wm({id:e,label:t="",inputValue:r="",value:n=!1,onChange:a,disabled:o=!1,css:i=""}){let s=Um(e),[l,c]=Zp(n);return(0,m.jsxs)("div",{className:`wx-2IvefP wx-checkbox ${i}`,children:[(0,m.jsx)("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})}}),(0,m.jsxs)("label",{htmlFor:s,className:"wx-2IvefP wx-label",children:[(0,m.jsx)("span",{className:"wx-2IvefP wx-before"}),t&&(0,m.jsx)("span",{className:"wx-2IvefP wx-after",children:t})]})]})}function Km({theme:e="",target:t,children:r}){let n=(0,u.useRef)(null),a=(0,u.useRef)(null),[o,i]=(0,u.useState)(null);n.current||=document.createElement("div");let s=(0,u.useContext)(Bm);return(0,u.useEffect)(()=>{i(t||function(e){let t=nm.getTopNode(e);for(;e&&e!==t&&!e.getAttribute("data-wx-portal-root");)e=e.parentNode;return e}(a.current)||nm.getTopNode(a.current))},[a.current]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("span",{ref:a,style:{display:"none"}}),a.current&&o?(0,v.createPortal)((0,m.jsx)("div",{className:`wx-3ZWsT0 wx-${e||s}-theme`,children:r}),o):null]})}function Ym({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]=(0,u.useState)(0),[h,p]=(0,u.useState)(0),[f,g]=(0,u.useState)("auto"),[x,v]=(0,u.useState)(!1),y=(0,u.useRef)(null),b=(0,u.useRef)(null),w=(0,u.useRef)(i);function S(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}(0,u.useEffect)(()=>{w.current=i},[i]);let k=(0,u.useCallback)(()=>{if(!y.current)return;let a=jm(y.current,n,r,e,t);a&&(d(a.x),p(a.y),g(S(a.width)))},[y,n,r,e,t,a]);return(0,u.useLayoutEffect)(()=>{let e,t=e=>{w.current&&e.target!==b.current&&y.current&&!y.current.contains(e.target)&&w.current(e)};return requestAnimationFrame(()=>{k(),v(!0),l&&y.current&&(b.current=Tm(y.current),b.current&&b.current.addEventListener("scroll",t,!0)),n&&(e=new ResizeObserver(k),e.observe(n))}),()=>{l&&b.current&&b.current.removeEventListener("scroll",t,!0),e?.disconnect()}},[]),(0,u.useLayoutEffect)(()=>{k()},[n,r,e,t]),(0,u.useEffect)(()=>{if(y.current)return mm(y.current,{callback:e=>{w.current&&w.current(e)},parent:()=>n}).destroy},[n]),(0,m.jsx)("div",{ref:y,className:["wx-37M6Fj","wx-popup",o].filter(Boolean).join(" "),style:{position:"absolute",visibility:x?"visible":"hidden",top:h+"px",left:c+"px",width:f},children:s})}function Xm({position:e="bottom",align:t="start",autoFit:r=!0,onCancel:n=null,width:a="100%",css:o="",children:i}){let s=(0,u.useRef)(null),[l,c]=(0,u.useState)(e),[d,h]=(0,u.useState)(t),p=(0,u.useRef)(n);return(0,u.useEffect)(()=>{p.current=n},[n]),(0,u.useEffect)(()=>{if(r){let e=s.current;if(e){let t=e.getBoundingClientRect(),r=document.body.getBoundingClientRect();t.right>=r.right&&h("end"),t.bottom>=r.bottom&&c("top")}}},[]),(0,u.useEffect)(()=>{if(s.current)return mm(s.current,e=>{p.current&&p.current(e)}).destroy},[]),(0,m.jsx)("div",{ref:s,className:["wx-dropdown",`wx-${l}-${d}`,o||"","wx-aaaVytZW"].filter(Boolean).join(" "),style:{width:a},children:i})}function Zm({position:e="bottom",align:t="start",autoFit:r=!0,inline:n=!1,onCancel:a,width:o="100%",children:i,...s}){let[l,c]=(0,u.useState)(void 0),d=(0,u.useRef)(null),h=(0,u.useMemo)(()=>`${e}-${t}`,[e,t]);return(0,u.useLayoutEffect)(()=>{d.current&&c(d.current.parentNode)},[]),(0,m.jsxs)(m.Fragment,{children:[l&&(n?(0,m.jsx)(Xm,{onCancel:a,position:e,align:t,autoFit:r,width:o,...s,children:i}):(0,m.jsx)(Km,{children:(0,m.jsx)(Ym,{parent:l,at:h,onCancel:a,width:o,...s,children:i})})),(0,m.jsx)("span",{ref:d,className:"wx-portal-node wx-32GZ52"})]})}function Jm(){return Lm(Fm)}var Qm=(0,u.memo)(function({data:e,checkboxes:t,itemTemplate:r,value:n}){return(0,m.jsxs)(m.Fragment,{children:[t&&(0,m.jsx)(Wm,{id:e.id,css:"wx-list-checkbox",value:n&&n.includes(e.id)}),r?Jp(r,{option:e}):e.label]})});function ef({visibleItems:e,visibleRange:t,navIndex:r,checkboxes:n,itemTemplate:a,value:o,measureRefCallback:i}){return e.map((e,s)=>{let l=t.start+s;return(0,m.jsx)("div",{ref:0===s?i:void 0,className:"wx-233fr7 wx-item "+(l===r?"wx-focus":""),"data-id":e.id,children:(0,m.jsx)(Qm,{data:e,checkboxes:n,itemTemplate:a,value:o})},e.id)})}function tf({items:e=[],children:t,onSelect:r,onReady:n,virtualized:a=!1,checkboxes:o,multiselect:i,value:s,...l}){let c=(0,u.useRef)(),d=(0,u.useRef)(!1),h=(0,u.useRef)(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=em(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}}()),[p,f]=(0,u.useState)(null),g=(0,u.useRef)(p),[x,v]=(0,u.useState)(0),[y,b]=(0,u.useState)(24),w=(0,u.useRef)(!1),S=((0,u.useContext)(Vm)||Jm()).getGroup("core"),k=(0,u.useRef)(e);(0,u.useEffect)(()=>{k.current=e},[e]);let C=(0,u.useRef)(s);(0,u.useEffect)(()=>{C.current=s},[s]);let j=(0,u.useRef)(0);(0,u.useEffect)(()=>{j.current=y},[y]);let T=(0,u.useCallback)(e=>{e&&e.stopPropagation();let t,n=k.current,a=C.current,o=g.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=(0,u.useRef)(T);(0,u.useEffect)(()=>{N.current=T},[T]);let M=(0,u.useCallback)(e=>{if(c.current){let t=e*j.current-c.current.clientHeight+j.current;v(t),c.current.scrollTop=t}},[j.current]),E=(0,u.useCallback)(e=>{c.current=e,a&&(e&&!d.current&&null!==g.current&&requestAnimationFrame(()=>{c.current&&(M(g.current),d.current=!0)}),e||(d.current=!1))},[M]),A=(0,u.useCallback)(e=>{if(!e||w.current)return;let t=e.getBoundingClientRect().height;t&&(b(t),j.current=t,w.current=!0)},[]);(0,u.useEffect)(()=>{h.current.init(c.current,e,e=>{f(e),g.current=e},e=>N.current(e),a)},[e,c.current,a]),(0,u.useEffect)(()=>{n&&n({navigate:a?(e,t)=>{h.current.navigate(e,t),M(g.current)}:h.current.navigate,keydown:a?(e,t)=>{let r=g.current,n=k.current;if(0!==r&&r!==n.length-1&&("ArrowDown"===e.key||"ArrowUp"===e.key)&&e.preventDefault(),h.current.keydown(e,t),c.current){let e=c.current.scrollTop<=g.current*j.current,t=c.current.scrollTop+c.current.clientHeight>=g.current*j.current+j.current;e?t||M(g.current):(c.current.scrollTop=g.current*j.current,v(c.current.scrollTop))}}:h.current.keydown,move:h.current.move})},[]);let R=(0,u.useRef)(0),D=(0,u.useRef)(e);D.current!==e&&(D.current=e,R.current+=1);let I=(0,u.useCallback)(()=>{h.current.navigate(null)},[h]),z=(0,u.useCallback)(e=>{a&&v(e.target.scrollTop)},[a]),_=(0,u.useMemo)(()=>Math.ceil((c.current?.clientHeight||0)/y),[y,x]),P=(0,u.useMemo)(()=>{if(!a)return{start:0,end:e.length};if(!e.length)return{start:0,end:0};let t=Math.floor(x/y),r=t+_;return{start:Math.max(0,t-10),end:Math.min(e.length,r+10)}},[a,e,x,y,_]),O=(0,u.useMemo)(()=>{if(!a)return e;let{start:t,end:r}=P;return e.slice(t,r).map(e=>({...e}))},[a,e,P]),L=P.start*y,F=e.length*y;return(0,u.useEffect)(()=>{a&&v(0)},[e,a]),(0,u.useEffect)(()=>{null===p&&(d.current=!1)},[p]),null===p?null:(0,m.jsx)(Zm,{onCancel:I,...l,children:(0,m.jsx)("div",{className:"wx-233fr7 wx-list",ref:E,onClick:T,onMouseMove:h.current.move,onScroll:z,children:e.length?a?(0,m.jsx)("div",{className:"wx-233fr7 wx-list-wrapper",style:{height:`${F}px`},children:(0,m.jsx)("div",{className:"wx-233fr7 wx-list-content",style:{transform:`translateY(${L}px)`},children:(0,m.jsx)(ef,{visibleRange:P,visibleItems:O,navIndex:p,measureRefCallback:A,checkboxes:o,itemTemplate:t,value:s})})}):(0,m.jsx)(ef,{visibleRange:P,visibleItems:O,navIndex:p,measureRefCallback:A,checkboxes:o,itemTemplate:t,value:s}):(0,m.jsx)("div",{className:"wx-233fr7 wx-no-data",children:S("No data")})})},R.current)}function rf({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:h="",icon:p="",clear:f=!1,onChange:g}){let x=Um(t),[v,y]=Zp(e),b=(0,u.useRef)(null),w=(0,u.useMemo)(()=>p&&-1===h.indexOf("wx-icon-left")?"wx-icon-right "+h:h,[p,h]),S=(0,u.useMemo)(()=>p&&-1!==h.indexOf("wx-icon-left"),[p,h]);(0,u.useEffect)(()=>{let e=setTimeout(()=>{n&&b.current&&b.current.focus(),a&&b.current&&b.current.select()},1);return()=>clearTimeout(e)},[n,a]);let k=(0,u.useCallback)(e=>{let t=e.target.value;y(t),g&&g({value:t,input:!0})},[g]),C=(0,u.useCallback)(e=>g&&g({value:e.target.value}),[g]);let j=o;return"password"!==o&&"number"!==o&&(j="text"),(0,u.useEffect)(()=>{let e=C,t=b.current;return t.addEventListener("change",e),()=>{t&&t.removeEventListener("change",e)}},[C]),(0,m.jsxs)("div",{className:`wx-hQ64J4 wx-text ${w} ${l?"wx-error":""} ${s?"wx-disabled":""} ${f?"wx-clear":""}`,"data-tooltip-text":d,children:[(0,m.jsx)("input",{className:"wx-hQ64J4 wx-input",ref:b,id:x,readOnly:r,disabled:s,placeholder:i,type:j,title:c,value:v,onInput:k}),f&&!s&&v?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("i",{className:"wx-hQ64J4 wx-icon wxi-close",onClick:function(e){e.stopPropagation(),y(""),g&&g({value:""})}}),S&&(0,m.jsx)("i",{className:`wx-hQ64J4 wx-icon ${p}`})]}):p?(0,m.jsx)("i",{className:`wx-hQ64J4 wx-icon ${p}`}):null]})}function nf({date:e,type:t,part:r,onShift:n}){let{calendar:a,formats:o}=(0,u.useContext)(Vm).getRaw(),i=e.getFullYear(),s=(0,u.useMemo)(()=>{switch(t){case"month":return _m(o.monthYearFormat,a)(e);case"year":return _m(o.yearFormat,a)(e);case"duodecade":{let{start:e,end:t}=Am(i),r=_m(o.yearFormat,a);return`${r(new Date(e,0,1))} - ${r(new Date(t,11,31))}`}default:return""}},[e,t,i,a,o]);return(0,m.jsxs)("div",{className:"wx-8HQVQV wx-header",children:["right"===r?(0,m.jsx)("span",{className:"wx-8HQVQV wx-spacer"}):(0,m.jsx)("i",{className:"wx-8HQVQV wx-pager wxi-angle-left",onClick:()=>n&&n({diff:-1,type:t})}),(0,m.jsx)("span",{className:"wx-8HQVQV wx-label",onClick:function(){n&&n({diff:0,type:t})},children:s}),"left"===r?(0,m.jsx)("span",{className:"wx-8HQVQV wx-spacer"}):(0,m.jsx)("i",{className:"wx-8HQVQV wx-pager wxi-angle-right",onClick:()=>n&&n({diff:1,type:t})})]})}function af({onClick:e,children:t}){return(0,m.jsx)("button",{className:"wx-3s8W4d wx-button",onClick:e,children:t})}var of="wx-1XEF33",sf={month:{component:function({value:e,current:t,part:r="",markers:n=null,css:a="",onCancel:o,onChange:i}){let s=((0,u.useContext)(Vm)||Jm()).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)),h="normal"!==r;function p(e){let t=e.getDay();return 0===t||6===t}let f=(0,u.useRef)(0),g=(0,u.useMemo)(()=>"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]),x=(0,u.useMemo)(()=>{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+=g.indexOf(e.date)>-1?" wx-selected":"",h){let t=e.date==g[0],n=e.date==g[1];t&&!n?r+=" wx-left":n&&!t&&(r+=" wx-right"),e.date>g[0]&&e.date<g[1]&&(r+=" wx-inrange")}if(r+=p(t)?" wx-weekend":"",n){let e=n(t);e&&(r+=" "+e)}o.push({...e,css:r})}return o},[t,g,h,n]),v=(0,u.useRef)(null),y=(0,u.useRef)({});return y.current.click=function(e,t){t.timeStamp!==f.current&&(f.current=t.timeStamp,t.stopPropagation(),i&&i(new Date(e)),o&&o())},(0,u.useEffect)(()=>{im(v.current,y.current)},[]),(0,m.jsxs)("div",{className:`wx-398RBS wx-month ${a}`,children:[(0,m.jsx)("div",{className:"wx-398RBS wx-weekdays",children:c.map(e=>(0,m.jsx)("div",{className:"wx-398RBS wx-weekday",children:e},e))}),(0,m.jsx)("div",{className:"wx-398RBS wx-days",ref:v,children:x.map(e=>(0,m.jsx)("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=(0,u.useRef)(new Date),[s,l]=Zp(e||i.current),[c,d]=Zp(t||i.current),h=(0,u.useContext)(Vm).getRaw().calendar,p=h.monthShort||[],f=(0,u.useMemo)(()=>c.getMonth(),[c]),g=(0,u.useCallback)((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]),x=(0,u.useCallback)(()=>{let e=new Date(lf(s,r)||c);e.setMonth(c.getMonth()),e.setFullYear(c.getFullYear()),a&&a(e)},[s,c,r,a]),v=(0,u.useCallback)(e=>{let t=e.target.closest("[data-id]");if(t){let r=parseInt(t.getAttribute("data-id"),10);g(r,e)}},[g]);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("div",{className:"wx-34U8T8 wx-months",onClick:v,children:p.map((e,t)=>(0,m.jsx)("div",{className:"wx-34U8T8 wx-month"+(f===t?" wx-current":""),"data-id":t,children:e},t))}),(0,m.jsx)("div",{className:"wx-34U8T8 wx-buttons",children:(0,m.jsx)(af,{onClick:x,children:h.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=(0,u.useContext)(Vm).getRaw().calendar,[s,l]=Zp(t),[c,d]=Zp(e),h=(0,u.useMemo)(()=>s.getFullYear(),[s]),p=(0,u.useMemo)(()=>{let{start:e,end:t}=Am(h),r=[];for(let n=e;n<=t;++n)r.push(n);return r},[h]),f={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 g=(0,u.useRef)(null);return(0,u.useEffect)(()=>{g.current&&im(g.current,f)},[]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("div",{className:of+" wx-years",ref:g,children:p.map((e,t)=>(0,m.jsx)("div",{className:`wx-1XEF33 wx-year ${h==e?"wx-current":""} ${0===t?"wx-prev-decade":""} ${11===t?"wx-next-decade":""}`,"data-id":e,children:e},t))}),(0,m.jsx)("div",{className:of+" wx-buttons",children:(0,m.jsx)(af,{onClick:function(){let e=new Date(lf(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 lf(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 cf=["clear","today"];function df({value:e,current:t,onCurrentChange:r,part:n="normal",markers:a=null,buttons:o,css:i="",onShift:s,onChange:l}){let c=(0,u.useContext)(Vm).getGroup("calendar"),[d,h]=(0,u.useState)("month"),p=Array.isArray(o)?o:o?cf:[],f=e=>{let{diff:n,current:a}=e;if(0!==n){if(n){let e=sf[d];r(n>0?e.next(t):e.prev(t))}else a&&r(a);s&&s()}else"month"===d?h("year"):"year"===d&&h("duodecade")},g=(0,u.useMemo)(()=>sf[d].component,[d]);return(0,m.jsx)("div",{className:`wx-2Gr4AS wx-calendar ${"normal"!==n&&"both"!==n?"wx-part":""} ${i}`,children:(0,m.jsxs)("div",{className:"wx-2Gr4AS wx-wrap",children:[(0,m.jsx)(nf,{date:t,part:n,type:d,onShift:f}),(0,m.jsxs)("div",{children:[(0,m.jsx)(g,{value:e,current:t,onCurrentChange:r,part:n,markers:a,onCancel:()=>{"duodecade"===d?h("year"):"year"===d&&h("month")},onChange:e=>{h("month"),l&&l({select:!0,value:e})},onShift:f}),"month"===d&&p.length>0&&(0,m.jsx)("div",{className:"wx-2Gr4AS wx-buttons",children:p.map(e=>(0,m.jsx)("div",{className:"wx-2Gr4AS wx-button-item",children:(0,m.jsx)(af,{onClick:t=>((e,t)=>{e.preventDefault(),l&&l({value:t})})(t,function(e){return"done"===e?-1:"clear"===e?null:"today"===e?new Date:void 0}(e)),children:c(e)})},e))})]})]})})}function uf(e){let{words:t=null,optional:r=!1,children:n}=e,a=(0,u.useContext)(Vm),o=(0,u.useMemo)(()=>{let e=a;return(!e||!e.extend)&&(e=Lm(Fm)),null!==t&&(e=e.extend(t,r)),e},[t,r,a]);return(0,m.jsx)(Vm.Provider,{value:o,children:n})}function hf(e,t,r,n){if(!e||n){let e=t?new Date(t):new Date;e.setDate(1),r(e)}else if(1!==e.getDate()){let t=new Date(e);t.setDate(1),r(t)}}var pf=["clear","today"];function mf({value:e,current:t,markers:r=null,buttons:n=pf,css:a="",onChange:o}){let[i,s]=Zp(e),[l,c]=Zp(t);(0,u.useEffect)(()=>{hf(l,i,c,!1)},[i,l]);let d=(0,u.useCallback)(e=>{let t=e.value;t?(s(new Date(t)),hf(l,new Date(t),c,!0)):s(null),o&&o({value:t?new Date(t):null})},[o,l]),h=(0,u.useCallback)(e=>{c(e)},[c]);return l?(0,m.jsx)(uf,{children:(0,m.jsx)(df,{value:i,current:l,markers:r,buttons:n,css:a,onChange:d,onCurrentChange:h})}):null}function ff(e){return e||={},e.width||(e.width="unset"),e}var gf=["clear","today"];function xf({value:e,id:t,disabled:r=!1,error:n=!1,placeholder:a="",format:o="",buttons:i=gf,css:s="",title:l="",tooltip:c,editable:d=!1,clear:h=!1,onChange:p,dropdown:f={}}){let{calendar:g,formats:x}=((0,u.useContext)(Vm)||Jm()).getRaw(),v=o||x?.dateFormat,y="function"==typeof v?v:_m(v,g),[b,w]=(0,u.useState)(e),[S,k]=(0,u.useState)(!1);function C(){k(!1)}function j(e){let t=e===b||e&&b&&e.valueOf()===b.valueOf()||!e&&!b;w(e),t||p&&p({value:e}),setTimeout(C,1)}(0,u.useEffect)(()=>{w(e)},[e]);let T=(0,u.useMemo)(()=>b?y(b):"",[b,y]);return(0,u.useEffect)(()=>{let e=C;return window.addEventListener("scroll",e),()=>window.removeEventListener("scroll",e)},[]),(0,m.jsxs)("div",{className:"wx-1lKOFG wx-datepicker",onClick:()=>k(!0),children:[(0,m.jsx)(rf,{css:`wx-date-input ${s}`,title:l,tooltip:c,value:T,id:t,readonly:!d,disabled:r,error:n,placeholder:a,onInput:C,onChange:function({value:e,input:t}){if(!d&&!h||t)return;let r="function"==typeof d?d(e):e?new Date(e):null;r=isNaN(r)?b||null:r||null,j(r)},icon:"wxi-calendar",clear:h}),S&&!r&&(0,m.jsx)(Zm,{onCancel:C,...ff(f),children:(0,m.jsx)(mf,{buttons:i,value:b,onChange:e=>j(e.value)})})]})}function vf({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:h,onChange:p,dropdown:f={}}){let g=(0,u.useRef)(null),x=(0,u.useRef)(null),[v,y]=Zp(e);let b=(0,u.useMemo)(()=>v||0===v?(r||t).find(e=>e.id===v):null,[v,r,t]),w=(0,u.useCallback)(({id:e})=>{(e||0===e)&&(y(e),g.current(null),p&&p({value:e}))},[y,p]),S=(0,u.useCallback)(e=>{e.stopPropagation(),y(""),p&&p({value:""})},[y,p]),k=(0,u.useCallback)(()=>t.findIndex(e=>e.id===v),[t,v]);return(0,m.jsxs)("div",{className:`wx-2YgblL wx-richselect ${d} ${o?"wx-2YgblL wx-error":""} ${a?"wx-2YgblL wx-disabled":""} ${h?"":"wx-2YgblL wx-nowrap"}`,title:i,onClick:()=>g.current(k()),onKeyDown:e=>x.current(e,k()),tabIndex:0,"data-tooltip-text":s,children:[(0,m.jsx)("div",{className:"wx-2YgblL wx-label",children:b?h?h(b):b[l]:n?(0,m.jsx)("span",{className:"wx-2YgblL wx-placeholder",children:n}):" "}),c&&!a&&v?(0,m.jsx)("i",{className:"wx-2YgblL wx-icon wxi-close",onClick:S}):(0,m.jsx)("i",{className:"wx-2YgblL wx-icon wxi-angle-down"}),!a&&(0,m.jsx)(tf,{items:t,onReady:function(e){g.current=e.navigate,x.current=e.keydown},onSelect:w,...f,children:({option:e})=>h?h(e):e[l]})]})}var yf=({options:e=[],value:t="",css:r="",children:n,onChange:a})=>{let[o,i]=(0,u.useState)(t);return(0,u.useEffect)(()=>{i(t)},[t]),(0,m.jsx)("div",{className:`wx-0hMO7P wx-segmented ${r}`,children:e.map(e=>(0,m.jsx)("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?Jp(n,{option:e}):(0,m.jsxs)(m.Fragment,{children:[e.icon&&(0,m.jsx)("i",{className:`wx-0hMO7P wx-icon ${e.icon} ${e.label?"":"wx-only"}`}),e.label&&(0,m.jsx)("span",{className:"wx-0hMO7P wx-label",children:e.label})]})},e.id))})};function bf({notice:e={}}){return(0,m.jsxs)("div",{className:`wx-11sNg5 wx-notice wx-${e.type?e.type:""}`,role:"status","aria-live":"polite",children:[(0,m.jsx)("div",{className:"wx-11sNg5 wx-text",children:e.text}),(0,m.jsx)("div",{className:"wx-11sNg5 wx-button",children:(0,m.jsx)("i",{className:"wx-11sNg5 wxi-close",onClick:function(){e.remove&&e.remove()}})})]})}function wf({data:e=[]}){return(0,m.jsx)("div",{className:"wx-3nwoO9 wx-notices",children:e.map(e=>(0,m.jsx)(bf,{notice:e},e.id))})}function Sf({title:e="",buttons:t=["cancel","ok"],header:r,children:n,footer:a,css:o="",onConfirm:i,onCancel:s}){let l=((0,u.useContext)(Vm)||Jm()).getGroup("core"),c=(0,u.useRef)(null);return(0,u.useEffect)(()=>{c.current?.focus()},[]),(0,m.jsx)("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:(0,m.jsxs)("div",{className:"wx-1FxkZa wx-window",children:[r||(e?(0,m.jsx)("div",{className:"wx-1FxkZa wx-header",children:e}):null),(0,m.jsx)("div",{children:n}),a||t&&(0,m.jsx)("div",{className:"wx-1FxkZa wx-buttons",children:t.map(e=>(0,m.jsx)("div",{className:"wx-1FxkZa wx-button",children:(0,m.jsx)(Gm,{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 kf=(0,u.forwardRef)(function({children:e},t){let[r,n]=(0,u.useState)(null),[a,o]=(0,u.useState)([]);return(0,u.useImperativeHandle)(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||Mm(),e.remove=()=>o(t=>t.filter(t=>t.id!==e.id)),-1!=e.expire&&setTimeout(e.remove,e.expire||5100),o(t=>[...t,e])}}),[]),(0,m.jsxs)(m.Fragment,{children:[e,r&&(0,m.jsx)(Sf,{title:r.title,buttons:r.buttons,onConfirm:r.resolve,onCancel:r.reject,children:r.message}),(0,m.jsx)(wf,{data:a})]})});function Cf(e){let{children:t}=e,r=(0,u.useRef)(),n=(0,u.useMemo)(()=>({showNotice:e=>r.current.showNotice(e),showModal:e=>r.current.showModal(e)}),[]);return(0,m.jsx)(Hm.Provider,{value:n,children:(0,m.jsx)(kf,{ref:r,children:t})})}var jf=({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:h,active:p,onChange:f})=>{let[g,x]=Zp(e),v=(0,u.useMemo)(()=>(g?"pressed":"")+(t?" "+t:""),[g,t]),y=(0,u.useCallback)(e=>{let t=!g;o&&o(e),e.defaultPrevented||(x(t),f&&f({value:t}))},[g,o,f]);return g&&p?(0,m.jsx)(Gm,{title:i,tooltip:s,text:g&&d||c,css:l,type:v,icon:g&&a||r,onClick:y,disabled:n,children:Jp(p,{value:g})}):h?(0,m.jsx)(Gm,{title:i,tooltip:s,text:g&&d||c,css:l,type:v,icon:g&&a||r,onClick:y,disabled:n,children:h}):(0,m.jsx)(Gm,{title:i,tooltip:s,text:g&&d||c,css:l,type:v,icon:g&&a||r,onClick:y,disabled:n})};am(nm);var Tf={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"}};(new Date).valueOf();var Nf=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}};(new Date).valueOf();var Mf=class{constructor(e){let t=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]:Af(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=Rf(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=Rf(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=Rf(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:Rf(l,o.id)+ +("after"===t);if(Af(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&&Ef(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 Ef(e,t){e.forEach(e=>{t.push(e),!0===e.open&&Ef(e.data,t)})}function Af(e,t,r){let n=[...e.data];n.splice(t,0,r),e.data=n}function Rf(e,t){return e?.data.findIndex(e=>e.id===t)}var Df=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 If(e,t){return Object.defineProperty(e,"__reactive",{value:!0,enumerable:!1,writable:!1}),e}var zf=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=new Map,this._sources=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=>_f(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 _f(e,t,r){let n=t.get(e);if(!n)return r;let a=Object.keys(n).map(e=>_f(e,t,r+1));return Math.max(...a)}var Pf=class{constructor(){this._nextHandler=null,this._handlers={},this._tag=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}},Of=1024;function Lf(e){return e<Of?`${e} B`:e<Of**2?`${(e/Of).toFixed(1)} KB`:e<Of**3?`${(e/Of**2).toFixed(1)} MB`:`${(e/Of**3).toFixed(1)} GB`}function Ff(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(Vf(t)),...n.sort(Vf(t))]}function Bf(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 Hf(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 Vf({key:e,order:t}){let r="asc"===t?Bf:Hf;return(t,n)=>r(t[e],n[e])}function $f(e,t){let r="/"===e?1:e.split("/").length;return r>=t.length?null:t[r].id}var qf=class extends Mf{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()}}},Uf=class extends Df{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=Ff(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=Ff(n,i[o]),l=[];l[a]={_selected:s},this.setState({panels:l},e)}});this._router=new zf(super.setState.bind(this),t,{data:e=>new qf(e)});let r=this.in=new Pf;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=[...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]=If({_crumbs:[],_files:[],_selected:[],_sorts:{},path:"/",selected:[],...e[r]});let t={panels:If(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 Gf(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 Wf(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 Kf(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}(new Date).valueOf();var Yf={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 Xf(e){let[t,r]=(0,u.useState)(e),n=(0,u.useRef)(e);return(0,u.useEffect)(()=>{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 Zf(e,t){let r=e.getState();return function(e,t){let[r,n]=(0,u.useState)(()=>t);return(0,u.useEffect)(()=>{if(e)return e.subscribe(e=>{n(()=>e)})},[e]),r}(e.getReactiveState()[t],r[t])}function Jf(e,t){let r=e.getState();return function(e,t){let r=(0,u.useRef)(t);r.current=t;let[n,a]=(0,u.useState)(1);return(0,u.useEffect)(()=>e.subscribe(e=>{r.current=e,a(e=>e+1)}),[e]),[r.current,n]}(e.getReactiveState()[t],r[t])}function Qf(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 eg(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 tg(e,t,r){return Yf.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=Kf(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){return e.map((e,r)=>{let n=t(e,r);return e.data&&e.data.length&&(n.data=rg(e.data,t)),n}).filter(Boolean)}function ng(e,t){let r=[];return e.forEach(e=>{if(e.data){let n=ng(e.data,t);n.length&&r.push({...e,data:n})}else t(e)&&r.push(e)}),r}function ag(e){return rg(e,(t,r)=>{let n={...t,id:t.id||Mm()};return n.type&&(n.comp=n.type),"separator"===n.comp&&"separator"===e[r-1]?.comp?null:n})}(new Date).valueOf();var og={};function ig({onClick:e,onShow:t,option:r}){let n=(0,u.useRef)(null),a=(0,u.useCallback)(()=>{t(!!r.data&&r.id,n.current)},[t,r]),o=(0,u.useCallback)(a=>{if(r.data)return a.stopPropagation(),void t(r.id,n.current);e(a)},[e,t,r]),i=(0,u.useMemo)(()=>r&&r.comp?function(e){return og[e]||e}(r.comp):null,[r]);return(0,m.jsxs)("div",{ref:n,className:`wx-cDCz9rZQ wx-option ${r.css||""} ${r.disabled?"wx-disabled":""}`,"data-id":rm(r.id),onMouseEnter:a,onClick:o,children:[r.icon?(0,m.jsx)("i",{className:`wx-cDCz9rZQ wx-icon ${r.icon}`}):null,r.comp?i?(0,m.jsx)(i,{item:r,option:r}):null:(0,m.jsxs)("span",{className:"wx-cDCz9rZQ wx-value",children:[" ",r.text," "]}),r.subtext?(0,m.jsx)("span",{className:"wx-cDCz9rZQ wx-subtext",children:r.subtext}):null,r.data?(0,m.jsx)("i",{className:"wx-cDCz9rZQ wx-sub-icon wxi-angle-right"}):null]})}function sg({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,h]=(0,u.useState)(-1e4),[p,f]=(0,u.useState)(-1e4),[g,x]=(0,u.useState)(20),[v,y]=(0,u.useState)(),b=(0,u.useRef)(null),[w,S]=(0,u.useState)(!1),[k,C]=(0,u.useState)(null),j=(0,u.useCallback)(()=>{let e=jm(b.current,a,n,t,r);e&&(h(e.x),f(e.y),y(e.width));let o=e?.z??20,i=a?function(e){let t=[],r=e,n=nm.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),x(o)},[a,n,t,r]);(0,u.useEffect)(()=>{o&&o(j)},[]);let T=(0,u.useCallback)(()=>{S(!1)},[]),N=(0,u.useCallback)((e,t)=>{S(e),C(t)},[]),M=(0,u.useMemo)(()=>ag(e),[e]);(0,u.useEffect)(()=>{j()},[a,j]);let E=(0,u.useRef)(l),A=(0,u.useRef)(c),R=(0,u.useRef)(a);return(0,u.useEffect)(()=>{E.current=l},[l]),(0,u.useEffect)(()=>{A.current=c},[c]),(0,u.useEffect)(()=>{R.current=a},[a]),(0,u.useEffect)(()=>{if(b.current)return mm(b.current,{callback:function(e){A.current?A.current(e):E.current&&E.current({action:null,option:null})},modal:!0,parent:()=>R.current}).destroy},[]),(0,m.jsx)("div",{ref:b,"data-wx-menu":"true",className:`wx-XMmAGqVx wx-menu ${s}`,style:{position:"absolute",top:p+"px",left:d+"px",width:v,zIndex:g},onMouseLeave:T,children:M.map(e=>(0,m.jsxs)(u.Fragment,{children:["separator"===e.comp?(0,m.jsx)("div",{className:"wx-XMmAGqVx wx-separator"}):(0,m.jsx)(ig,{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&&w===e.id?(0,m.jsx)(sg,{css:s,options:e.data,at:"right-overlap",parent:k,context:i,onClick:l,onCancel:c}):null]},e.id))})}var lg=(0,u.forwardRef)(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,h]=(0,u.useState)(null),[p,f]=(0,u.useState)(null),[g,x]=(0,u.useState)(0),[v,y]=(0,u.useState)(0),b=(0,u.useRef)(null),w=(0,u.useMemo)(()=>`data-${o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,[o]),S=(0,u.useMemo)(()=>null!==d&&i?ng(r,e=>i(e,d)):r,[d,i,r]);let k=(0,u.useCallback)((e,t)=>{if(!e)return void f(null);if(e.defaultPrevented)return;let r=e.target;if(r&&r.dataset&&r.dataset.menuIgnore)return;if(p&&p===r)return f(null),void e.preventDefault();x(e.clientX+1),y(e.clientY+1);let n=typeof t<"u"?t:em(r,w);a&&(n=a(n,e),!n)||(h(n),f(r),b.current=e.nativeEvent||e,e.preventDefault())},[p,w,a]);return(0,u.useImperativeHandle)(t,()=>({show:k}),[k]),(0,m.jsxs)(m.Fragment,{children:[l?(0,m.jsx)("span",{onClick:k,"data-menu-ignore":"true",children:"function"==typeof l?l():l}):null,p?(0,m.jsx)(Km,{children:(0,m.jsx)(sg,{css:s,at:n,top:v,left:g,parent:p,context:d,onClick:function(e){f(null),c&&c(e)},onCancel:function(e){b.current!==e?(f(null),c&&c({action:null,option:null})):b.current=null},options:S},p)}):null]})}),cg=(0,u.forwardRef)(function(e,t){let{options:r,at:n="bottom",css:a="",children:o,onClick:i}=e,[s,l]=(0,u.useState)(null),c=(0,u.useRef)(null);let d=(0,u.useCallback)(e=>{l(e.target),c.current=e.nativeEvent||e,e.preventDefault()},[]);return(0,u.useImperativeHandle)(t,()=>({show:d}),[d]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("span",{onClick:function(e){let t=e.target;for(;!t.dataset.menuIgnore;)l(t),t=t.parentNode},"data-menu-ignore":"true",children:o}),s?(0,m.jsx)(Km,{children:(0,m.jsx)(sg,{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]})}),dg=(0,u.forwardRef)(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=(0,u.useRef)(null),h=(0,u.useCallback)((e,t)=>{d.current.show(e,t)},[]);return(0,u.useImperativeHandle)(t,()=>({show:h}),[h]),(0,m.jsxs)(m.Fragment,{children:[l?(0,m.jsx)("span",{onContextMenu:h,"data-menu-ignore":"true",children:l}):null,(0,m.jsx)(lg,{css:s,at:n,options:r,resolver:a,dataKey:o,filter:i,ref:d,onClick:c})]})}),ug={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"}},hg=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 pg(e){let[t,r]=(0,u.useState)(e||[]),[n,a]=(0,u.useState)(Promise.resolve(null)),[o,i]=(0,u.useState)(null),[s,l]=(0,u.useState)(!1),c=(0,u.useRef)();return c.current||=new hg(r,a,i,l,e),c.current.files=t,c.current.ready=n,c.current.signal=o,c.current.drag=s,c.current}var mg=({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=(0,u.useRef)(null),h=(0,u.useRef)(null),[p,f]=(0,u.useState)({}),g=pg(),x=e||g,v=function(e,t){if(e){let r=e.getGroup(t);if(r)return r}return Lm(ug).getGroup(t)}((0,u.useContext)(qm.i18n),"uploader");(0,u.useEffect)(()=>{d.current&&n&&(d.current.webkitdirectory=!0)},[n]),(0,u.useEffect)(()=>{if(!o&&h.current&&!i)return x.droparea(h.current)},[o,i,h]);let y=(e,t)=>{let r=x.updateFile(e,t),n={...r,status:x.getState()};r&&r.uploaded&&r.uploaded(n),c&&c(n),r.temp&&x.deleteFile(r.id)},b=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);x.setReady(t.then(t=>{t.status=t.status||"server",y(e.id,t)}).catch(t=>{y(e.id,{status:"error",error:t})}))},w=(e,t)=>{let n={...t||p,id:Math.random().toString(36).substr(2,9),status:"client",name:e.name,file:e};n.selected&&n.selected(n),l&&l(n),x.addFile(n,r),b(n),d.current&&(d.current.value="")},S=(e,t,r)=>{e.isFile?e.file(e=>{w(e,r)}):e.isDirectory&&e.createReader().readEntries(e=>{e.forEach(e=>{S(e,t+e.name+"/",r)})})},k=e=>{Array.from(e.target.files).forEach(e=>w(e))},C=()=>{d.current&&d.current.click()};return(0,u.useEffect)(()=>{if(x.signal){let[e,t,r]=x.signal;f(t),"click"===e?C():"drop"===e&&((e,t)=>{Array.from(e.dataTransfer.items).forEach(e=>{let r=e.webkitGetAsEntry();r&&S(r,"",t)})})(r,t),x.setSignal(null)}},[x.signal]),o?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("input",{type:"file",className:"wx-at1A8tb8 wx-input",ref:d,onChange:k,accept:t,multiple:r,disabled:i}),s]}):(0,m.jsxs)("div",{className:`wx-at1A8tb8 wx-label ${x.drag?"wx-active":""} ${i?"wx-disabled":""}`,ref:h,children:[(0,m.jsx)("input",{type:"file",className:"wx-at1A8tb8 wx-input",ref:d,onChange:k,accept:t,multiple:r,disabled:i}),s||(0,m.jsx)("div",{className:"wx-at1A8tb8 wx-dropzone",children:(0,m.jsxs)("span",{children:[v("Drop files here or")," ",(0,m.jsx)("span",{className:"wx-at1A8tb8 wx-action",onClick:C,children:v("select files")})]})})]})};function fg(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(!fg(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(!fg(e[r],t[r]))return!1;return!0}(e,t)}return e===t}function gg(e){if("object"!=typeof e||!e)return e;if(e instanceof Date)return new Date(e);if(e instanceof Array)return e.map(gg);let t={};for(let r in e)t[r]=gg(e[r]);return t}(new Date).valueOf();var xg=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}}}},vg=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=new Map,this._sources=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=>yg(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 yg(e,t,r){let n=t.get(e);if(!n)return r;let a=Object.keys(n).map(e=>yg(e,t,r+1));return Math.max(...a)}var bg=class{constructor(){this._nextHandler=null,this._handlers={},this._tag=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 wg(e,t){return(t.getter||function(e){return t=>t[e]}(t.id))(e)}function Sg(e,t,r){return(t.setter||function(e){return(t,r)=>t[e]=r}(t.id))(e,r)}function kg(e,t){let r=wg(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 Cg(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 jg={a3:{width:11.7,height:16.5},a4:{width:8.27,height:11.7},letter:{width:8.5,height:11}};function Tg(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}=jg[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 Ng(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 Mg(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 Eg(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 Ag=["resize-column","hide-column","update-cell"],Rg=["delete-row","update-row","update-cell"],Dg=["move-item"],Ig=["resize-column","move-item"],zg=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=wg(this.getRow(t),this.getColumn(r));return fg(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(Ig.includes(t))return(e.inProgress&&!this.progress[t]||"boolean"!=typeof e.inProgress)&&(Dg.includes(t)&&this.setPrev("flatData"),Ag.includes(t)&&this.setPrev("columns")),void(this.progress[t]=e.inProgress);Rg.includes(t)&&this.setPrev("data"),Ag.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]=gg(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 _g(e,t){return typeof e>"u"||null===e?-1:typeof t>"u"||null===t?1:e===t?0:e>t?1:-1}function Pg(e,t){return-_g(e,t)}function Og(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?_g:Pg;return function(e,n){return r(wg(e,t),wg(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 Lg(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 Fg(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=Lg(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 Bg={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 Hg(e){return Bg[e]}var Vg=class extends xg{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 vg(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 bg;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:wg(a,o)??"",renderedValue:kg(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)};Sg(n,r,e),t.renderedValue=kg(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||qg(),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]};Sg(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]};Sg(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=kg(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 Lg(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 Lg(o,n,t).width+a;Array.isArray(o)||(o=[o]);for(let i=0;i<o.length;i++){let e=o[i],s=Lg("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=Og(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=wg(e,a);return o?.handler?o.handler(t,s):Hg(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:qg()};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=Cg("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=kg(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=Cg("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])))}),fg(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 zg(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=qg());return e}normalizeTreeRows(e,t,r){return!t&&!r&&(this._branches={0:{data:e}}),e.forEach(e=>{e.id||=qg(),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=wg(e,a);return o?.handler?o.handler(t,s):Hg(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=kg(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=Fg(e,"header",r,t.headerHeight,a),i=Fg(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}}},$g=(new Date).valueOf();function qg(){return"temp://"+$g++}(new Date).valueOf();var Ug=class{constructor(){this.store=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)}}},Gg=[],Wg=e=>{Kg||(Kg=!0,document.addEventListener("keydown",e=>{if(Gg.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=Gg.length-1;a>=0;a--){let t=Gg[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 Ug;return Gg.push(t),e(t),()=>{let e=Gg.findIndex(e=>e===t);e>=0&&Gg.splice(e,1)}},Kg=!1;var Yg={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 Xg=(0,u.createContext)(null);function Zg(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 Jg(e,t){let r=Zg(t);return{x:e.clientX-r.x,y:e.clientY-r.y}}function Qg(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=Qp(t);r&&(o={container:l,sourceNode:t.target,from:tm(r),pos:Jg(t,e)},n=o.pos,u(t))}function u(t){if(!o)return;let r=o.pos=Jg(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&&(b(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),b(t),t.target.addEventListener("touchmove",x),t.target.addEventListener("touchend",function e(){r&&c(),t.target.removeEventListener("touchmove",x),t.target.removeEventListener("touchend",e),h(t)}),e.addEventListener("contextmenu",v))}function x(e){i?(e.preventDefault(),u(e.touches[0])):r&&c()}function v(e){if(i||r)return e.preventDefault(),!1}function y(e){e.preventDefault()}function b(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",y))}return l.className="wx-drag-zone",l.setAttribute("tabindex",-1),e.addEventListener("mousedown",p),e.addEventListener("touchstart",g),e.addEventListener("dragstart",y),{destroy(){w(!0)}}}function ex(e,t,r,n){let{node:a,left:o,top:i,bottom:s,sense:l,xScroll:c,yScroll:d}=n,u=Jg(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)&&(tx(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(rx,15,e,t,r)},250)}(r,n,{x:r.scrollState.dirX,y:r.scrollState.dirY})}function tx(e){e.scrollSpeedFactor=1,e.autoScrollTimer&&(e.autoScrollTimer=clearTimeout(e.autoScrollTimer),e.activeAutoScroll=clearInterval(e.activeAutoScroll))}function rx(e,t,r){let{x:n,y:a}=r;e.scrollSpeedFactor+=.004,0!==n&&function(e,t,r){let n=t.node.scrollLeft;nx(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;nx(n+Math.round(t.sense/3)*e.scrollSpeedFactor*r,"scrollTop",t)}(e,t,a)}function nx(e,t,r){r.node[t]=e}function ax(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 ox(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 ix(e){let{row:t,column:r,cellStyle:n=null,columnStyle:a=null,children:o,focusable:i}=e,s=(0,u.useContext)(Xg),l=Zf(s,"focusCell"),c=Zf(s,"search"),d=Zf(s,"reorder"),h=(0,u.useMemo)(()=>c?.rows[t.id]&&c.rows[t.id][r.id],[c,t.id,r.id]),p=(0,u.useMemo)(()=>ax(r.width,r.flexgrow,r.fixed,r.left,r.right),[r.width,r.flexgrow,r.fixed,r.left,r.right]);let f=(0,u.useMemo)(()=>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]),g=(0,u.useMemo)(()=>"function"==typeof r.draggable?!1!==r.draggable(t,r):r.draggable,[r,t]),x=(0,u.useRef)(null);(0,u.useEffect)(()=>{x.current&&i&&l?.row===t.id&&l?.column===r.id&&x.current.focus()},[l,i,t.id,r.id]);let v=(0,u.useCallback)(()=>{i&&!l&&s.exec("focus-cell",{row:t.id,column:r.id,eventSource:"focus"})},[s,i,l,t.id,r.id]);let y=(0,u.useMemo)(()=>{let e=r.fixed&&-1===r.fixed.left||-1===r.fixed.right,t=r.fixed&&r.fixed.right;return[f,e?"wx-shadow":"",t?"wx-fixed-right":""].filter(Boolean).join(" ")},[f,r]),b=r.cell;return(0,m.jsxs)("div",{className:"wx-TSCaXsGV "+y,ref:x,onFocus:v,style:p,"data-row-id":rm(t.id),"data-col-id":rm(r.id),tabIndex:i?"0":"-1",role:"gridcell","aria-colindex":r._colindex,"aria-readonly":!r.editor||void 0,children:[d&&r.draggable?g?(0,m.jsx)("i",{"draggable-data":"true",className:"wx-TSCaXsGV wx-draggable wxi-drag"}):(0,m.jsx)("i",{className:"wx-TSCaXsGV wx-draggable-stub"}):null,r.treetoggle?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("span",{style:{marginLeft:28*t.$level+"px"}}),t.$count?(0,m.jsx)("i",{"data-action":"toggle-row",className:"wx-TSCaXsGV wx-table-tree-toggle wxi-menu-"+(!1===t.open?"right":"down")}):null]}):null,b?(0,m.jsx)(b,{api:s,row:t,column:r,onAction:({action:e,data:t})=>s.exec(e,t)}):o?o():h?(0,m.jsx)("span",{children:function(e){let t=RegExp(`(${c.value.trim()})`,"gi");return String(e).split(t).map(e=>({text:e,highlight:t.test(e)}))}(kg(t,r)).map(({highlight:e,text:t},r)=>e?(0,m.jsx)("mark",{className:"wx-TSCaXsGV wx-search",children:t},r):(0,m.jsx)("span",{children:t},r))}):kg(t,r)]})}function sx(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 lx(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:h}=e,[p,f]=Xf(t||[]),g=(0,u.useMemo)(()=>(p||[]).map(e=>r.find(t=>t.id===e)).filter(Boolean),[p,r]),x=(0,u.useRef)(null),v=(0,u.useRef)(null),[y,b]=(0,u.useState)(null),w=()=>{let e=p||[];if(!e.length)return 0;let t=r.find(t=>e.includes(t.id));return t?r.indexOf(t):0};return(0,u.useEffect)(()=>{c&&(x.current?.focus(),typeof window<"u"&&window.getSelection&&window.getSelection().removeAllRanges())},[]),(0,m.jsxs)("div",{ref:x,className:"wx-multiselect wx-aadNNOwy",onClick:function(){v.current?.(w())},onKeyDown:function(e){y?.(e,w())},tabIndex:0,children:[(0,m.jsx)("div",{className:"wx-label wx-aadNNOwy",children:i?i(g):s?(0,m.jsx)(s,{data:g,onAction:h}):o?(0,m.jsx)("span",{className:"wx-text wx-aadNNOwy",children:o}):g.length?(0,m.jsx)("span",{className:"wx-text wx-aadNNOwy",children:g.map(e=>e.label).join(", ")}):n?(0,m.jsx)("span",{className:"wx-placeholder wx-aadNNOwy",children:n}):" "}),a&&p?.length?(0,m.jsx)("i",{className:"wx-icon wxi-close wx-aadNNOwy",onClick:function(e){e.stopPropagation(),f([]),d&&d({value:[]})}}):(0,m.jsx)("i",{className:"wx-icon wxi-angle-down wx-aadNNOwy"}),(0,m.jsx)(tf,{items:r,onReady:function(e){v.current=e.navigate,b(()=>e.keydown),c&&e.navigate(w())},onSelect:function({id:e}){f(e),d&&d({value:e})},multiselect:!0,checkboxes:!0,value:p||[],onCancel:function(){v.current?.(null)},...l,children:({option:e})=>(0,m.jsx)("div",{className:"wx-option wx-aadNNOwy",children:i?i(e):s?(0,m.jsx)(s,{data:e,onAction:h}):e.label})})]})}var cx={text:function({filter:e,column:t,action:r,filterValue:n}){return(0,m.jsx)(rf,{...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=Zf((0,u.useContext)(Xg),"flatData"),o=(0,u.useMemo)(()=>e?.config?.options||t?.options||function(){let e=[];return a.forEach(r=>{let n=wg(r,t);e.includes(n)||e.push(n)}),e.map(e=>({id:e,label:e}))}(),[e,t,a]),i=(0,u.useMemo)(()=>e?.config?.template,[e]);return(0,m.jsx)("div",{style:{width:"100%"},onKeyDown:function(e){"Tab"!==e.key&&e.preventDefault()},children:(0,m.jsx)(vf,{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}){return(0,m.jsx)("div",{className:"wx-aaaK5VYO",style:{width:"100%"},children:(0,m.jsx)(xf,{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=(0,u.useContext)(qm.i18n)?.getGroup("grid")||Lm(Tf).getGroup("grid"),o=(0,u.useMemo)(()=>({clear:!0,...e?.config||{}}),[e]),i=(0,u.useMemo)(()=>o.options||t.options,[o,t]),s=(0,u.useMemo)(()=>{let e=n?.length;return e?e<3?n.map(e=>t.optionsMap.get(e)).join(", "):e+" "+a("selected"):""},[n,t,a]);return(0,m.jsx)("div",{style:{width:"100%"},onKeyDown:function(e){"Tab"!==e.key&&e.preventDefault()},children:(0,m.jsx)(lx,{placeholder:"",...o,options:i,value:n||[],text:s,onChange:function({value:e}){r({value:e,key:t.id})}})})}};function dx({filter:e,column:t}){let r=(0,u.useContext)(Xg),n=Zf(r,"filterValues");let a=(0,u.useMemo)(()=>cx[e.type],[e.type]);return(0,m.jsx)(a,{filter:e,column:t,action:function(e){r.exec("filter-rows",e)},filterValue:n[t.id]})}function ux(e){let{cell:t,column:r,row:n,lastRow:a,sortRow:o,columnStyle:i,bodyHeight:s,hasSplit:l}=e,c=(0,u.useContext)(Xg),d=Zf(c,"sortMarks"),h=(0,u.useMemo)(()=>d?d[r.id]:void 0,[d,r.id]),p=(0,u.useRef)(),f=(0,u.useCallback)(e=>{p.current=t.flexgrow?e.parentNode.clientWidth:t.width},[t.flexgrow,t.width]),g=(0,u.useCallback)((e,r)=>{c.exec("resize-column",{id:t.id,width:Math.max(1,(p.current||0)+e),inProgress:r})},[c,t.id]),x=(0,u.useCallback)(e=>g(e,!0),[g]),v=(0,u.useCallback)(e=>g(e,!1),[g]),y=(0,u.useCallback)(e=>{if(!r.sort||t.filter)return;let n=h?.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,h?.order]),b=(0,u.useCallback)(e=>{e&&e.stopPropagation(),c.exec("collapse-column",{id:t.id,row:n})},[c,t.id,n]),w=(0,u.useCallback)(e=>{"Enter"===e.key&&b()},[b]),S=(0,u.useCallback)(e=>{"Enter"===e.key&&!t.filter&&y(e)},[y,t.filter]),k=(0,u.useMemo)(()=>t.collapsed&&r.collapsed,[t.collapsed,r.collapsed]),C=(0,u.useMemo)(()=>k&&!l&&"header"!==t.collapsible,[k,l,t.collapsible]),j=(0,u.useMemo)(()=>C?{top:-s/2,position:"absolute"}:{},[C,s]),T=(0,u.useMemo)(()=>ax(t.width,t.flexgrow,r.fixed,r.left,t.right??r.right,t.height+(k&&C?s:0)),[t.width,t.flexgrow,r.fixed,r.left,t.right,r.right,t.height,k,C,s]),N=(0,u.useMemo)(()=>ox(r,t,i),[r,t,i]),M=(0,u.useCallback)(()=>Object.fromEntries(Object.entries(t).filter(([e])=>"cell"!==e)),[t]),E=`wx-cell ${N} ${t.css||""} wx-collapsed`,A=["wx-cell",N,t.css||"",t.filter?"wx-filter":"",r.fixed&&r.fixed.right?"wx-fixed-right":""].filter(Boolean).join(" "),R=(0,u.useRef)(null);return(0,u.useEffect)(()=>{let e=R.current;if(!e)return;let t=sx(e,{down:f,move:x,up:v});return()=>{"function"==typeof t&&t()}},[f,x,v,sx]),k?(0,m.jsx)("div",{className:"wx-RsQD74qC "+E,style:T,role:"button","aria-label":`Expand column ${t.text||""}`,"aria-expanded":!t.collapsed,tabIndex:0,onKeyDown:w,onClick:b,"data-header-id":rm(r.id),children:(0,m.jsx)("div",{className:"wx-RsQD74qC wx-text",style:j,children:t.text||""})}):(0,m.jsxs)("div",{className:"wx-RsQD74qC "+A,style:T,onClick:y,"data-header-id":rm(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":!h?.order||t.filter?"none":"asc"===h?.order?"ascending":"descending",onKeyDown:S,children:[t.collapsible?(0,m.jsx)("div",{className:"wx-RsQD74qC wx-collapse",role:"button","aria-label":t.collapsed?"Expand column":"Collapse column","aria-expanded":!t.collapsed,tabIndex:0,onKeyDown:w,onClick:b,children:(0,m.jsx)("i",{className:"wx-RsQD74qC wxi-angle-"+(t.collapsed?"down":"right")})}):null,t.cell?(()=>{let e=t.cell;return(0,m.jsx)(e,{api:c,cell:M(),column:r,row:n,onAction:({action:e,data:t})=>c.exec(e,t)})})():t.filter?(0,m.jsx)(dx,{filter:t.filter,column:r}):(0,m.jsx)("div",{className:"wx-RsQD74qC wx-text",children:t.text||""}),r.resize&&a&&!t._hidden?(0,m.jsx)("div",{className:"wx-RsQD74qC wx-grip",role:"presentation","aria-label":"Resize column",ref:R,onClick:e=>e.stopPropagation(),children:(0,m.jsx)("div",{})}):null,o?(0,m.jsx)("div",{className:"wx-RsQD74qC wx-sort",children:h?(0,m.jsxs)(m.Fragment,{children:[typeof h.index<"u"?(0,m.jsx)("div",{className:"wx-RsQD74qC wx-order",children:h.index+1}):null,(0,m.jsx)("i",{className:"wx-RsQD74qC wxi-arrow-"+("asc"===h.order?"up":"down")})]}):null}):null]})}function hx({cell:e,column:t,row:r,columnStyle:n}){let a=(0,u.useContext)(Xg),o=(0,u.useMemo)(()=>ax(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=(0,u.useMemo)(()=>ox(t,e,n),[t,e,n]),s=(0,u.useCallback)(()=>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":"");return(0,m.jsx)("div",{className:l,style:o,children:t?.collapsed||e?.collapsed?null:e?.cell?u.default.createElement(e.cell,{api:a,cell:s(),column:t,row:r,onAction:({action:e,data:t})=>a.exec(e,t)}):(0,m.jsx)("div",{className:"wx-6Sdi3Dfd wx-text",children:e?.text||""})})}function px({deltaLeft:e,contentWidth:t,columns:r,type:n="header",columnStyle:a,bodyHeight:o}){let i=(0,u.useContext)(Xg),s=Zf(i,"_sizes"),l=Zf(i,"split"),c=(0,u.useMemo)(()=>s?.[`${n}RowHeights`],[s,n]),d=(0,u.useMemo)(()=>{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]),h=(0,u.useMemo)(()=>l?.left||l?.right,[l]);function p(e){return r.find(t=>t.id===e)}function f(e,t){let r=t;return e.rowspan&&(r+=e.rowspan-1),r===d.length-1}function g(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 f(e,t)}return(0,m.jsx)("div",{className:`wx-sAsPVaUK wx-${n}`,style:{paddingLeft:`${e}px`,width:`${t}px`},role:"rowgroup",children:d.map((e,t)=>(0,m.jsx)("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=p(e.id);return"header"===n?(0,m.jsx)(ux,{cell:e,columnStyle:a,column:r,row:t,lastRow:f(e,t),bodyHeight:o,sortRow:g(e,t,r),hasSplit:h},e.id):(0,m.jsx)(hx,{cell:e,columnStyle:a,column:p(e.id),row:t},e.id)})},t))})}function mx({overlay:e}){let t=(0,u.useContext)(Xg);let r=e;return(0,m.jsx)("div",{className:"wx-1ty666CQ wx-overlay",children:function(e){return"function"==typeof e}(e)?(0,m.jsx)(r,{onAction:({action:e,data:r})=>t.exec(e,r)}):e})}var fx={text:function(e){let{editor:t,onSave:r,onApply:n}=e,[a,o]=(0,u.useState)(t?.value||""),{type:i="text"}=(0,u.useMemo)(()=>t?.config||{},[t]),s=(0,u.useRef)(null);return(0,u.useEffect)(()=>{s.current&&s.current.focus()},[]),(0,u.useEffect)(()=>{if(!s.current)return;let e=mm(s.current,()=>r(!0));return()=>e.destroy()},[r]),(0,m.jsx)("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]=(0,u.useState)(e?.value),[s,l]=(0,u.useState)(e?.renderedValue),[c,d]=(0,u.useState)(e?.options||[]),h=(0,u.useMemo)(()=>e?.config?.template,[e]),p=(0,u.useMemo)(()=>e?.config?.cell,[e]),f=(0,u.useMemo)(()=>e?.config?.dropdown||{},[e]),g=(0,u.useMemo)(()=>({trackScroll:!0,...f}),[f]),x=(0,u.useMemo)(()=>(c||[]).findIndex(e=>e.id===o),[c,o]),v=(0,u.useRef)(null),y=(0,u.useRef)(null),b=(0,u.useCallback)(e=>{v.current=e.navigate,y.current=e.keydown,v.current(x)},[x,v]),w=(0,u.useCallback)(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?v.current(-1/0):v.current(null)},[e]),S=(0,u.useRef)(null);(0,u.useEffect)(()=>{S.current&&S.current.focus()},[]);let k=(0,u.useRef)(r);(0,u.useEffect)(()=>{k.current=r},[r]),(0,u.useEffect)(()=>{if(!S.current)return;let e=mm(S.current,()=>k.current(!0));return()=>e.destroy()},[]),(0,u.useEffect)(()=>{i(e?.value),l(e?.renderedValue),d(e?.options||[])},[e]);let C=(0,u.useCallback)(({id:e})=>{n(e),r()},[n,r]);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("input",{className:"wx-0UYfSd1x wx-input",ref:S,value:s??"",onChange:w,onKeyDown:e=>y.current?y.current(e,x):void 0}),(0,m.jsx)(tf,{items:c,onReady:b,onSelect:C,...g,onCancel:a,children:({option:e})=>h?h(e):p?(0,m.jsx)(p,{data:e,onAction:t}):e.label})]})},datepicker:function({editor:e,onAction:t,onSave:r,onApply:n,onCancel:a}){let[o]=(0,u.useState)(()=>e.value||new Date),{template:i,cell:s,dropdown:l={}}=e?.config||{},c=(0,u.useMemo)(()=>({trackScroll:!0,width:"auto",...l}),[l]),d=(0,u.useRef)(null),[h,p]=(0,u.useState)(null);return(0,u.useEffect)(()=>{d.current&&d.current.focus(),typeof window<"u"&&window.getSelection&&window.getSelection().removeAllRanges()},[]),(0,u.useEffect)(()=>{if(!h)return;let e=mm(h,()=>r(!0));return()=>e.destroy()},[h,r]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("div",{className:"wx-lNWNYUb6 wx-value",ref:d,tabIndex:0,onClick:a,onKeyDown:e=>e.preventDefault(),children:i?i(o):s?(0,m.jsx)(s,{data:e.value,onAction:t}):(0,m.jsx)("span",{className:"wx-lNWNYUb6 wx-text",children:e.renderedValue})}),(0,m.jsx)(Zm,{...c,onCancel:a,children:(0,m.jsx)("div",{ref:p,className:"wx-lNWNYUb6",children:(0,m.jsx)(mf,{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=(0,u.useMemo)(()=>({trackScroll:!0,...l}),[l]),[d]=(0,u.useState)(r.options.find(e=>e.id===r.value)),[h]=(0,u.useState)(r.value),[p]=(0,u.useState)(r.options),f=(0,u.useMemo)(()=>p.findIndex(e=>e.id===h),[p,h]),[g,x]=(0,u.useState)(),v=(0,u.useRef)(null);return(0,u.useEffect)(()=>{v.current&&v.current.focus(),typeof window<"u"&&window.getSelection&&window.getSelection().removeAllRanges()},[]),(0,u.useEffect)(()=>{if(!v.current)return;let e=mm(v.current,()=>a(!0));return()=>e.destroy()},[a]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("div",{ref:v,className:"wx-ywGRk611 wx-value",tabIndex:0,onClick:i,onKeyDown:e=>{g(e,f),e.preventDefault()},children:s.template?s.template(d):s.cell?(()=>{let e=s.cell;return(0,m.jsx)(e,{data:d,onAction:n})})():(0,m.jsx)("span",{className:"wx-ywGRk611 wx-text",children:r.renderedValue})}),(0,m.jsx)(tf,{items:p,onReady:function(e){t=e.navigate,x(()=>e.keydown),t(f)},onSelect:function({id:e}){o(e),a()},...c,onCancel:i,children:({option:e})=>s.template?s.template(e):s.cell?(()=>{let t=s.cell;return(0,m.jsx)(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=(0,u.useMemo)(()=>({trackScroll:!0,...o.dropdown||{}}),[o]),d=(0,u.useRef)(null);return(0,u.useEffect)(()=>{if(!d.current)return;let e=mm(d.current,()=>n(!0));return()=>e.destroy()},[n]),(0,m.jsx)("div",{ref:d,className:"wx-value wx-aacZ4gNU",onClick:()=>n(!0),children:(0,m.jsx)(lx,{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 gx({column:e,row:t}){let r=(0,u.useContext)(Xg),n=Zf(r,"editor"),a=(0,u.useCallback)((e,t)=>{r.exec("close-editor",{ignore:e}),t&&r.exec("focus-cell",{...t,eventSource:"click"})},[r]),o=(0,u.useCallback)(e=>{a(!1,e?null:{row:n?.id,column:n?.column})},[n,a]),i=(0,u.useCallback)(()=>{a(!0,{row:n?.id,column:n?.column})},[n,a]),s=(0,u.useCallback)(e=>{r.exec("editor",{value:e})},[r]),l=(0,u.useCallback)(t=>{"Enter"===t.key&&n&&("multiselect"===e.editor.type?s(n.value):i())},[n,e.editor,i,s]),c=(0,u.useMemo)(()=>ax(e.width,e.flexgrow,e.fixed,e.left,e.right),[e.width,e.flexgrow,e.fixed,e.left,e.right]),d=(0,u.useMemo)(()=>{let r=e.editor;return"function"==typeof r&&(r=r(t,e)),r?fx["string"==typeof r?r:r.type]:null},[e,t]),h=(0,u.useRef)(null);(0,u.useEffect)(()=>{h.current&&"string"==typeof c&&h.current.setAttribute("style",c)},[c]);let p=typeof t.$parent<"u"?"gridcell":"cell",f=typeof t.$parent<"u"?!e.editor:void 0;return(0,m.jsx)("div",{className:"wx-8l724t2g wx-cell wx-editor",ref:h,style:"object"==typeof c&&c?c:void 0,role:p,"aria-readonly":f,tabIndex:-1,onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),onKeyDown:l,children:d?(0,m.jsx)(d,{editor:n,onSave:o,onApply:s,onCancel:i,onAction:({action:e,data:t})=>r.exec(e,t)}):null})}function xx(e){let{columns:t,type:r,columnStyle:n}=e,a=(0,u.useContext)(Xg),{filterValues:o,_columns:i,_sizes:s}=a.getState();function l(e){return n?" "+n(e):""}return(0,m.jsx)(m.Fragment,{children:t.map((e,t)=>(0,m.jsx)("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;return(0,m.jsx)("th",{style:Qf(Mg(e,s.columnWidth)),className:"wx-Gy81xq2u "+c,rowSpan:e.rowspan,colSpan:e.colspan,children:d?(0,m.jsx)(d,{api:a,cell:Object.fromEntries(Object.entries(e).filter(([e])=>"cell"!==e)),column:n,row:t}):e.filter?(0,m.jsx)("div",{className:"wx-Gy81xq2u wx-print-filter",children:Eg(o,i,e)}):(0,m.jsx)("div",{className:"wx-Gy81xq2u wx-text",children:e.text??""})},e.id)})},t))})}function vx(e){let{columns:t,rowStyle:r,columnStyle:n,cellStyle:a,header:o,footer:i,reorder:s}=e,l=(0,u.useContext)(Xg),{flatData:c,_sizes:d}=l.getState(),h=o&&Ng(t,"header",d.headerRowHeights),p=i&&Ng(t,"footer",d.footerRowHeights);function f(e,t){let r="";return r+=n?" "+n(t):"",r+=a?" "+a(e,t):"",r}function g(e,t){return"function"==typeof t.draggable?!1!==t.draggable(e,t):t.draggable}return(0,m.jsxs)("table",{className:"wx-8NTMLH0z wx-print-grid "+(t.some(e=>e.flexgrow)?"wx-flex-columns":""),children:[o?(0,m.jsx)("thead",{children:(0,m.jsx)(xx,{columns:h,type:"header",columnStyle:n})}):null,(0,m.jsx)("tbody",{children:c.map((e,n)=>(0,m.jsx)("tr",{className:"wx-8NTMLH0z wx-row"+(r?" "+r(e):""),style:{height:`${e.rowHeight||d.rowHeight}px`},children:t.map(t=>t.collapsed?null:(0,m.jsxs)("td",{className:`wx-8NTMLH0z wx-print-cell wx-cell ${f(e,t)}`,style:Qf(Mg(t,d.columnWidth)),children:[s&&t.draggable?(0,m.jsx)("span",{className:"wx-8NTMLH0z wx-print-draggable",children:g(e,t)?(0,m.jsx)("i",{className:"wx-8NTMLH0z wxi-drag"}):null}):null,t.treetoggle?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("span",{style:{marginLeft:28*e.$level+"px"}}),e.$count?(0,m.jsx)("i",{className:"wx-8NTMLH0z wx-print-grid-tree-toggle wxi-menu-"+(!1===e.open?"right":"down")}):null]}):null,t.cell?(()=>{let r=t.cell;return(0,m.jsx)(r,{api:l,row:e,column:t})})():(0,m.jsx)("span",{children:kg(e,t)})]},t.id))},n))}),i?(0,m.jsx)("tfoot",{children:(0,m.jsx)(xx,{columns:p,type:"footer",columnStyle:n})}):null]})}function yx(e){let{config:t,...r}=e,{_skin:n,_columns:a}=(0,u.useContext)(Xg).getState(),o=(0,u.useMemo)(()=>Tg(a,t),[]),i=(0,u.useRef)(null);return(0,u.useEffect)(()=>{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()},[]),(0,m.jsx)("div",{className:`wx-4zwCKA7C wx-${n}-theme wx-print-container`,ref:i,children:o.map((e,t)=>(0,m.jsx)("div",{className:"wx-4zwCKA7C wx-print-grid-wrapper",children:(0,m.jsx)(vx,{columns:e,...r})},t))})}function bx(e){let{header:t,footer:r,overlay:n,multiselect:a,onreorder:o,rowStyle:i,columnStyle:s,cellStyle:l,autoRowHeight:c,resize:d,clientWidth:h,clientHeight:p,responsiveLevel:f,hotkeys:g}=e,x=(0,u.useContext)(Xg),v=Zf(x,"dynamic"),y=Zf(x,"_columns"),b=Zf(x,"flatData"),w=Zf(x,"split"),S=Zf(x,"_sizes"),[k,C]=Jf(x,"selectedRows"),j=Zf(x,"select"),T=Zf(x,"editor"),N=Zf(x,"scrollLeft"),M=Zf(x,"scrollTop"),E=Zf(x,"tree"),A=Zf(x,"focusCell"),R=Zf(x,"_print"),D=Zf(x,"undo"),I=Zf(x,"reorder"),z=Zf(x,"_rowHeightFromData"),[_,P]=(0,u.useState)(0);(0,u.useEffect)(()=>{P(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[O,L]=(0,u.useState)(0),F=(0,u.useMemo)(()=>(y||[]).some(e=>!e.hidden&&e.flexgrow),[y]),B=(0,u.useMemo)(()=>S?.rowHeight||0,[S]),H=(0,u.useRef)(null),[V,$]=(0,u.useState)(null),[q,U]=(0,u.useState)(null),G=(0,u.useMemo)(()=>{let e=[],t=0;return w&&w.left&&(e=(y||[]).slice(0,w.left).filter(e=>!e.hidden).map(e=>({...e})),e.forEach(e=>{e.fixed={left:1,leftSize:w.left},e.left=t,t+=e.width}),e.length&&(e[e.length-1].fixed.left=-1)),{columns:e,width:t}},[w,y]),W=(0,u.useMemo)(()=>{let e=[],t=0;if(w&&w.right){e=(y||[]).slice(-1*w.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}},[w,y]),K=(0,u.useMemo)(()=>{let e=(y||[]).slice(w?.left||0,(y||[]).length-(w?.right??0)).filter(e=>!e.hidden);return e.forEach(e=>{e.fixed=0}),e},[y,w]),Y=(0,u.useMemo)(()=>(y||[]).reduce((e,t)=>(t.hidden||(e+=t.width),e),0),[y]);function X(e,t,r){let n=t,a=e;if(K.length){let t=K.length;for(let n=e;n>=0;n--)K[n][r].forEach(r=>{r.colspan>1&&n>e-r.colspan&&n<t&&(t=n)});if(t!==K.length&&t<e){for(let r=t;r<e;r++)n-=K[r].width;a=t}}return{index:a,delta:n}}let Z=(0,u.useMemo)(()=>{let e,t,r,n=N||0,a=(N||0)+(h||0),o=0,i=0,s=0,l=0;K.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 h=i;h>=o;h--)["header","footer"].forEach(e=>{K[h]&&K[h][e].forEach(t=>{let r=t.colspan;if(r&&r>1){let t=r-(i-h+1);t>0&&(c[e]=Math.max(c[e],t))}})});let d=X(o,l,"header"),u=X(o,l,"footer"),p=d.delta,m=d.index,f=u.delta,g=u.index;return F&&Y>(h||0)?e=t=r=[...G.columns,...K,...W.columns]:(e=[...G.columns,...K.slice(o,i+1),...W.columns],t=[...G.columns,...K.slice(m,i+c.header+1),...W.columns],r=[...G.columns,...K.slice(g,i+c.footer+1),...W.columns]),{data:e||[],header:t||[],footer:r||[],d:l,df:f,dh:p}},[K,G,W,N,h,F,Y]),J=(0,u.useMemo)(()=>t&&S?.headerHeight||0,[t,S]),Q=(0,u.useMemo)(()=>r&&S?.footerHeight||0,[r,S]),ee=(0,u.useMemo)(()=>!(!h||!p)&&Y>=h,[h,p,Y]),[te,re]=(0,u.useState)(!1),ne=(0,u.useMemo)(()=>(p||0)-J-Q-(ee?_:0),[p,J,Q,ee,_]),ae=(0,u.useMemo)(()=>Math.ceil((ne||0)/(B||1))+1,[ne,B]),oe=(0,u.useRef)([]),[ie,se]=(0,u.useState)(0),[le,ce]=(0,u.useState)(void 0),de=(0,u.useMemo)(()=>{let e=0,t=0,r=M||0;if(c){let n=r;for(;n>0;)n-=oe.current[e]||B,e++;t=r-n;for(let r=Math.max(0,e-2-1);r<e;r++)t-=oe.current[e-r]||B;e=Math.max(0,e-2)}else{if(z){let n=0,a=0;for(let e=0;e<(b||[]).length;e++){let t=b[e].rowHeight||B;if(a+t>r){n=e;break}a+=t}e=Math.max(0,n-2);for(let r=0;r<e;r++)t+=b[r].rowHeight||B;let o=0,i=0;for(let e=n+1;e<(b||[]).length;e++){let t=b[e].rowHeight||B;if(o++,i+t>ne)break;i+=t}return{d:t,start:e,end:Math.min(v?v.rowCount:(b||[]).length,n+o+2)}}e=Math.floor(r/(B||1)),e=Math.max(0,e-2),t=e*(B||0)}let n=v?v.rowCount:(b||[]).length;return{d:t,start:e,end:Math.min(n,e+(ae||0)+2)}},[c,z,M,B,v,b,ae,ne]),ue=(0,u.useMemo)(()=>{let e=v?v.rowCount:(b||[]).length;if(c)return ie+de.d+(e-(le||0))*(B||0);if(!z)return e*(B||0);let t=0;for(let r=0;r<e;r++)t+=b[r]?.rowHeight||B;return t},[v,b,B,c,z,ie,de.d,le]),he=(0,u.useRef)({});he.current={clientWidth:h,clientHeight:p,fullHeight:ue,headerHeight:J,footerHeight:Q,fullWidth:Y,SCROLLSIZE:_};let pe=(0,u.useCallback)(()=>{let e=he.current;re(!(!e.clientWidth||!e.clientHeight)&&e.fullHeight+e.headerHeight+e.footerHeight>=e.clientHeight-(e.fullWidth>=e.clientWidth?e.SCROLLSIZE:0))},[]);(0,u.useEffect)(()=>{let e=requestAnimationFrame(pe);return()=>window.cancelAnimationFrame(e)},[O,pe]),(0,u.useEffect)(()=>{pe()},[p,pe]);let me=(0,u.useMemo)(()=>F&&Y<=(h||0)?(h||0)-0-(te?_:0):Y,[F,Y,h,te,_,ee]),fe=(0,u.useMemo)(()=>F&&Y<=(h||0)?h||0:me<(h||0)?Y+(te?_:0):-1,[F,Y,h,me,te,_]),ge=(0,u.useRef)({});(0,u.useEffect)(()=>{if(v&&(ge.current.start!==de.start||ge.current.end!==de.end)){let{start:e,end:t}=de;ge.current={start:e,end:t},x&&x.exec&&x.exec("request-data",{row:{start:e,end:t}})}},[v,de,x]);let xe=(0,u.useMemo)(()=>v?b||[]:(b||[]).slice(de.start,de.end),[v,b,de]),ve=(0,u.useMemo)(()=>(k||[]).filter(e=>(xe||[]).some(t=>t.id===e)),[C,xe]),ye=(0,u.useMemo)(()=>de.start,[de.start]),be=(0,u.useRef)({top:M,left:N});be.current={top:M,left:N};let we=(0,u.useCallback)(e=>{let t=e.target.scrollTop,r=e.target.scrollLeft,n=be.current;(t!==n.top||r!==n.left)&&x.exec("scroll-to",{top:t,left:r})},[x]),Se=(0,u.useCallback)(e=>{e.shiftKey&&e.preventDefault(),H.current&&H.current.focus&&H.current.focus()},[]),ke=(0,u.useCallback)(()=>!!(y||[]).find(e=>!!e.draggable),[y]),Ce=(0,u.useRef)(null),je=(0,u.useRef)(null),Te=(0,u.useRef)({dblclick:(e,t)=>{let r={id:e,column:em(t,"data-col-id")};x.exec("open-editor",r)},click:(e,t)=>{if(t.target.closest("input")||Ce.current)return;let r=em(t,"data-col-id");if(A?.id!==e&&x.exec("focus-cell",{row:e,column:r,eventSource:"click"}),!1===j)return;let n=a&&(t.ctrlKey||t.metaKey),o=a&&t.shiftKey;(n||k.length>1||!k.includes(e))&&x.exec("select-row",{id:e,toggle:n,range:o})},"toggle-row":e=>{let t=x.getRow(e);x.exec(!1===t.open?"open-row":"close-row",{id:e})},"ignore-click":()=>!1}),Ne=(0,u.useMemo)(()=>({top:J,bottom:Q,left:G.width,xScroll:ee,yScroll:te,sense:c&&q?q.offsetHeight:Math.max(S?.rowHeight||0,40),node:H.current&&H.current.firstElementChild}),[J,Q,G.width,ee,te,c,q,S]);let Me=(0,u.useMemo)(()=>fe>0?{width:`${fe}px`}:void 0,[fe]),Ee=(0,u.useRef)(null);(0,u.useEffect)(()=>{xe&&c&&Promise.resolve().then(()=>{let e=0,t=ye,r=Ee.current;r&&(Array.from(r.children).forEach((r,n)=>{oe.current[ye+n]=r.offsetHeight,e+=r.offsetHeight,t++}),se(e),ce(t))})},[xe,c,ye]);let[Ae,Re]=(0,u.useState)();(0,u.useEffect)(()=>{if(!A||j&&ve.length&&!ve.includes(A.row))if(xe.length&&Z.data.length){if(!Ae||ve.length&&!ve.includes(Ae.row)||-1===xe.findIndex(e=>e.id===Ae.row)||-1===Z.data.findIndex(e=>e.id===Ae.column&&!e.collapsed)){let e=ve[0]||xe[0].id,t=Z.data.findIndex(e=>!e.collapsed);Re(-1===t?null:{row:e,column:Z.data[t].id})}}else Re(null);else Re({...A})},[A]);let De=(0,u.useRef)(null);(0,u.useEffect)(()=>{let e=H.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 Ie=(0,u.useRef)({});Object.assign(Ie.current,{start:function(e,t){let{container:r,sourceNode:n,from:a}=t;if(ke()&&!n.getAttribute("draggable-data"))return!1;$(a),E&&x.getRow(a).open&&x.exec("close-row",{id:a,nested:!0});let o=Qp(n),i=o.cloneNode(!0);i.classList.remove("wx-selected"),i.querySelectorAll("[tabindex]").forEach(e=>e.setAttribute("tabindex","-1")),r.appendChild(i),U(i);let s=(N||0)-Z.d,l=te?_:0;r.style.width=Math.min((h||0)-l,F&&Y<=(h||0)?me:me-l)+s+"px";let c=Zg(o);t.offset={x:s,y:-Math.round(c.height/2)},je.current||=e.clientY},move:function(e,t){let{from:r}=t,n=t.pos,a=Zg(H.current);n.x=a.x;let i=Ne.top;if(n.y<i)n.y=i;else{let e=a.height-(ee&&_>0?_:Math.round(Ne.sense/2))-Ne.bottom;n.y>e&&(n.y=e)}if(H.current.contains(t.targetNode)){let a=Qp(t.targetNode),s=a&&tm(a);if(s&&s!==r){t.to=s;let o=c?q?.offsetHeight:S?.rowHeight;if(q&&(0===(M||0)||n.y>i+o-1)){let t=a.getBoundingClientRect(),n=Zg(q).y>t.y?-1:1,o=1===n?"after":"before",i=x.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>je.current||1===n&&e.clientY<je.current))return;je.current=e.clientY,x.exec("move-item",{id:r,target:s,mode:c,inProgress:!0})}}o&&o({event:e,context:t})}ex(e,a,t,Ne)},end:function(e,t){let{from:r,to:n}=t;x.exec("move-item",{id:r,target:n,inProgress:!1}),Ce.current=setTimeout(()=>{Ce.current=0},1),$(null),U(null),je.current=null,tx(t)},getReorder:()=>I,getDraggableInfo:()=>({hasDraggable:ke()})}),(0,u.useEffect)(()=>{let e=H.current;return e?Qg(e,Ie).destroy:void 0},[I,H.current]),(0,u.useEffect)(()=>{let e=H.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=Wg(t=>{t.configure(a,e)});return{destroy:()=>{o()}}}(e,{keys:!1!==g&&{...Yg,"ctrl+z":D,"ctrl+y":D,...g},exec:e=>x.exec("hotkey",e)}).destroy:void 0},[x,D,g]);let ze=(0,u.useRef)({scroll:x.getReactiveState().scroll,scrollLeft:x.getReactiveState().scrollLeft,scrollTop:x.getReactiveState().scrollTop});ze.current.getWidth=()=>(h||0)-(te?_:0),ze.current.getHeight=()=>ne,ze.current.getScrollMargin=()=>G.width+W.width,(0,u.useEffect)(()=>{!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)})})}(De.current,ze.current)},[]);let _e=(0,u.useRef)(null);(0,u.useEffect)(()=>{let e=_e.current;if(!e)return;let t=[];t.push(mm(e,()=>A&&x.exec("focus-cell",{eventSource:"click"})).destroy),t.push(function(e,t){let r=[tg(e,t,"click")];return t.dblclick&&r.push(tg(e,t.dblclick,"dblclick")),()=>{r.forEach(e=>e())}}(e,Te.current)),L(e.clientHeight);let r=new ResizeObserver(()=>{L(e.clientHeight)});return r.observe(e),t.push(()=>r.disconnect()),()=>t.forEach(e=>e())},[]);let Pe="wx-grid "+(f?`wx-responsive-${f}`:"");return(0,u.useEffect)(()=>{A&&(xe.some(e=>e.id===A.row)&&Z.data.some(e=>e.id===A.column&&!e.collapsed)||x.exec("focus-cell",{eventSource:"destroy"}))},[A,xe,Z.data,x]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("div",{className:"wx-4VuBwK2D "+Pe,style:{"--header-height":`${J}px`,"--footer-height":`${Q}px`,"--split-left-width":`${G.width}px`,"--split-right-width":`${W.width}px`},children:(0,m.jsx)("div",{ref:H,className:"wx-4VuBwK2D wx-table-box",style:Me,role:E?"treegrid":"grid","aria-colcount":Z.data.length,"aria-rowcount":xe.length,"aria-multiselectable":!(!E||!a)||void 0,tabIndex:-1,children:(0,m.jsxs)("div",{ref:De,className:"wx-4VuBwK2D wx-scroll",style:{overflowX:ee?"scroll":"hidden",overflowY:te?"scroll":"hidden"},onScroll:we,children:[t?(0,m.jsx)("div",{className:"wx-4VuBwK2D wx-header-wrapper",children:(0,m.jsx)(px,{contentWidth:me,deltaLeft:Z.dh,columns:Z.header,columnStyle:s,bodyHeight:ne-+r})}):null,(0,m.jsxs)("div",{ref:_e,className:"wx-4VuBwK2D wx-body",style:{width:`${me}px`,height:`${ue}px`},onMouseDown:e=>Se(e),children:[n?(0,m.jsx)(mx,{overlay:n}):null,(0,m.jsx)("div",{ref:Ee,className:"wx-4VuBwK2D wx-data",style:{paddingTop:`${de.d}px`,paddingLeft:`${Z.d}px`},children:xe.map((e,t)=>{let r=-1!==k.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||B}px`}:{height:`${e.rowHeight||B}px`};return(0,m.jsx)("div",{className:"wx-4VuBwK2D "+a,"data-id":rm(e.id),"data-context-id":rm(e.id),style:o,role:"row","aria-rowindex":t,"aria-expanded":e.open,"aria-level":E?e.$level+1:void 0,"aria-selected":E?r:void 0,tabIndex:-1,children:Z.data.map(t=>t.collapsed?(0,m.jsx)("div",{className:"wx-4VuBwK2D wx-cell wx-collapsed"},t.id):T?.id===e.id&&T.column===t.id?(0,m.jsx)(gx,{row:e,column:t},t.id):(0,m.jsx)(ix,{row:e,column:t,columnStyle:s,cellStyle:l,reorder:I,focusable:Ae?.row===e.id&&Ae?.column===t.id},t.id))},e.id)})})]}),r&&(b||[]).length?(0,m.jsx)(px,{type:"footer",contentWidth:me,deltaLeft:Z.df,columns:Z.footer,columnStyle:s}):null]})})}),R?(0,m.jsx)(yx,{config:R,rowStyle:i,columnStyle:s,cellStyle:l,header:t,footer:r,reorder:I}):null]})}var wx=(0,u.forwardRef)(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:h=null,reorder:p=!1,onReorder:f=null,autoRowHeight:g=!1,sizes:x,split:v,tree:y=!1,autoConfig:b=!1,init:w=null,responsive:S=null,sortMarks:k,undo:C=!1,hotkeys:j=null,filterValues:T,...N},M){let E=(0,u.useRef)();E.current=N;let A=(0,u.useMemo)(()=>new Vg(eg),[]),R=(0,u.useMemo)(()=>A.in,[A]),D=(0,u.useRef)(null);null===D.current&&(D.current=new Nf((e,t)=>{let r="on"+(e=>e.split("-").map(e=>e?e.charAt(0).toUpperCase()+e.slice(1):"").join(""))(e);E.current&&E.current[r]&&E.current[r](t)}),R.setNext(D.current));let I=(0,u.useMemo)(()=>({getState:A.getState.bind(A),getReactiveState:A.getReactive.bind(A),getStores:()=>({data:A}),exec:R.exec,setNext:e=>(D.current=D.current.setNext(e),D.current),intercept:R.intercept.bind(R),on:R.on.bind(R),detach:R.detach.bind(R),getRow:A.getRow.bind(A),getColumn:A.getColumn.bind(A)}),[A,R]),[z,_]=(0,u.useState)(0),[P,O]=(0,u.useState)(0),[L,F]=(0,u.useState)(null),[B,H]=(0,u.useState)(null),V=(0,u.useMemo)(()=>{if(b&&!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 b&&(t={...t,...b}),r.push(t)}return r}return(B&&B.columns)??t},[b,t,e,B]),$=(0,u.useMemo)(()=>(B&&B.sizes)??x,[B,x]),q=(0,u.useCallback)(e=>{if(_(e.width),O(e.height),S){let t=Object.keys(S).map(Number).sort((e,t)=>e-t).find(t=>e.width<=t)??null;t!==L&&(H(S[t]),F(t))}},[S,L]),U=(0,u.useContext)(qm.theme),G=(0,u.useRef)(0);return(0,u.useEffect)(()=>{if(G.current){let t=A.getState();A.init({data:e,columns:V,split:v||t.split,sizes:$||t.sizes,selectedRows:o||t.selectedRows,dynamic:d,tree:y,sortMarks:k||t.sortMarks,filterValues:T||t.filterValues,undo:C,reorder:p,_skin:U,_select:i})}else w&&w(I);G.current++},[A,e,V,v,$,o,d,y,k,T,C,p,U,i,w,I]),0===G.current&&A.init({data:e,columns:V,split:v||{left:0},sizes:$||{},selectedRows:o||[],dynamic:d,tree:y,sortMarks:k||{},filterValues:T||{},undo:C,reorder:p,_skin:U,select:i}),(0,u.useImperativeHandle)(M,()=>({...I}),[I]),(0,m.jsx)(Xg.Provider,{value:I,children:(0,m.jsx)(uf,{words:Tf,optional:!0,children:(0,m.jsx)(bx,{header:l,footer:c,overlay:h,rowStyle:r,columnStyle:n,cellStyle:a,onReorder:f,multiselect:s,autoRowHeight:g,clientWidth:z,clientHeight:P,responsiveLevel:L,resize:q,hotkeys:j})})})});am(nm);var Sx=(0,u.createContext)(null),kx=(0,u.createContext)(null),Cx=(0,u.createContext)(null);function jx({children:e}){let t=(0,u.useContext)(qm.i18n),r=(0,u.useMemo)(()=>t.getGroup("filemanager"),[t]),n=(0,u.useContext)(Sx),[a]=Jf(n,"panels"),o=a[Zf(n,"activePanel")].path,[i,s]=(0,u.useState)(null),[l,c]=(0,u.useState)(null),[d,h]=(0,u.useState)(""),[p,f]=(0,u.useState)(""),[g,x]=(0,u.useState)(!1);function v(){s(null),x(null),f(""),h("")}let y=(0,u.useMemo)(()=>({showPrompt(e){let t=e.item.name||("folder"===e.item.type?r("New folder"):`${r("New file")}.txt`);f(t),h(t),s({...e})},showConfirm(e){c({...e})}}),[r]);return(0,m.jsxs)(kx.Provider,{value:y,children:[(0,m.jsx)(Cf,{children:e}),i?(0,m.jsx)(Sf,{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}):p!==e&&n.exec("rename-file",{id:i.item.id,name:e}),v()):x(!0)},onCancel:v,children:(0,m.jsx)(rf,{error:g,select:!0,focus:!0,value:d,onChange:({value:e})=>h(e)})}):null,l?(0,m.jsx)(Sf,{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?(0,m.jsx)("ul",{className:"wx-gq7BMzEP wx-list",children:l.selected.map((e,t)=>(0,m.jsx)("li",{children:e},t))}):null}):null]})}var Tx={"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 Nx({item:e}){let t=(0,u.useContext)(Sx),r=(0,u.useContext)(qm.i18n).getGroup("filemanager"),n=(0,u.useContext)(Sx).templates,[a]=Jf(t,"panels"),o=Zf(t,"activePanel"),i=Zf(t,"mode"),s=a[o].selected,l=(0,u.useMemo)(()=>n.preview(e,214,163),[n,e]),c=(0,u.useMemo)(()=>n.icon(e,"big"),[n,e]),[d,h]=(0,u.useMemo)(()=>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]);return(0,m.jsx)(m.Fragment,{children:"/wx-filemanager-parent-link"===e.id?"search"===i?null:(0,m.jsx)("div",{className:"wx-GAOa4kDV wx-back-item",children:(0,m.jsxs)("div",{className:"wx-GAOa4kDV wx-back "+(e.navigation?"wx-selected":""),"data-id":rm("/wx-filemanager-parent-link"),children:[(0,m.jsx)("i",{className:"wx-GAOa4kDV wxi-arrow-left"}),(0,m.jsx)("span",{children:r("Back to parent folder")})]})}):(0,m.jsxs)("div",{className:"wx-GAOa4kDV wx-item "+(s?.length&&s.indexOf(e.id)>=0?"wx-selected":""),"data-id":rm(e.id),children:[l?(0,m.jsx)("div",{className:"wx-GAOa4kDV wx-preview wx-file-preview",children:(0,m.jsx)("img",{className:"wx-GAOa4kDV wx-card-preview",alt:r("A miniature file preview"),src:l})}):c?(0,m.jsx)("div",{className:"wx-GAOa4kDV wx-preview wx-file-icon",children:(0,m.jsx)("img",{className:"wx-GAOa4kDV wx-card-preview",alt:"",src:c})}):(0,m.jsx)("div",{className:"wx-GAOa4kDV wx-preview",children:(0,m.jsx)("i",{className:`wx-GAOa4kDV wxi-${e.type}`})}),"folder"===e.type?(0,m.jsxs)("div",{className:"wx-GAOa4kDV wx-info",children:[(0,m.jsxs)("div",{className:"wx-GAOa4kDV wx-folder-name",children:[(0,m.jsx)("span",{className:"wx-GAOa4kDV wx-type",children:r("Folder")}),(0,m.jsxs)("span",{className:"wx-GAOa4kDV wx-name",children:[(0,m.jsx)("span",{children:d}),(0,m.jsx)("span",{children:h})]})]}),(0,m.jsx)("div",{"data-action-id":rm(e.id),className:"wx-GAOa4kDV wx-more",children:(0,m.jsx)("i",{className:"wx-GAOa4kDV wxi-dots-v"})})]}):(0,m.jsxs)("div",{className:"wx-GAOa4kDV wx-info",children:[(0,m.jsx)("div",{className:"wx-GAOa4kDV wx-file-name",children:(0,m.jsxs)("span",{className:"wx-GAOa4kDV wx-name",children:[(0,m.jsx)("span",{children:d}),(0,m.jsx)("span",{children:h})]})}),(0,m.jsx)("div",{"data-action-id":rm(e.id),className:"wx-GAOa4kDV wx-more",children:(0,m.jsx)("i",{className:"wx-GAOa4kDV wxi-dots-v"})})]})]})})}function Mx(){let e=(0,u.useContext)(Sx),t=(0,u.useContext)(qm.i18n),r=(0,u.useMemo)(()=>t.getGroup("filemanager"),[t]),[n]=Jf(e,"panels"),a=Zf(e,"activePanel"),o=Zf(e,"mode"),i=n[a]._files,s=n[a].selected,l=n[a].path,c=n[a]._crumbs,d=n[a]._selectNavigation,h=(0,u.useCallback)((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]),p=(0,u.useCallback)(()=>{c.length>1&&e.exec("set-path",{id:c[c.length-2].id,panel:a,selected:[c[c.length-1].id]})},[e,c,a]),f=(0,u.useCallback)(t=>{if("/wx-filemanager-parent-link"===t)return p();"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,p,o,i,a]),g=(0,u.useCallback)((e,t)=>{(!s?.length||!s.filter(t=>t?.id===e).length>0)&&h(e,t)},[s,h]),x=(0,u.useMemo)(()=>"/"===l?i:[{id:"/wx-filemanager-parent-link",name:r("Back to parent folder"),navigation:d},...i],[l,r,d,i]),v=(0,u.useRef)(null),y=(0,u.useRef)();return(0,u.useEffect)(()=>{v.current&&(y.current?(y.current.click=h,y.current._dblclick=f,y.current.context=g):(y.current={click:h,dblclick:e=>y.current._dblclick(e),_dblclick:f,context:g},im(v.current,y.current)))},[h,f,g]),"search"!=o||x.length?(0,m.jsx)("div",{tabIndex:0,className:"wx-iyjASZCY wx-cards"+("/"!==l&&"search"!==o?" wx-has-back-link":""),"data-id":rm("body"),ref:v,children:x.map(e=>(0,m.jsx)(Nx,{item:e},e.id))}):(0,m.jsx)("div",{className:"wx-iyjASZCY wx-not-found",children:(0,m.jsx)("div",{className:"wx-iyjASZCY wx-not-found-text",children:r("Looks like nothing is here")})})}function Ex({name:e="",spin:t=!1,onClick:r}){return(0,m.jsx)("i",{"data-menu-ignore":"true",className:`wx-uwcvNSAG wx-icon wxi-${e} ${t?"wx-spin":""} ${r?"wx-clickable":""}`,onClick:()=>{r&&r()}})}function Ax(){let e=(0,u.useContext)(qm.i18n).getGroup("filemanager"),t=(0,u.useContext)(Sx),r=Zf(t,"activePanel"),[n]=Jf(t,"panels"),a=(0,u.useMemo)(()=>n[r]._crumbs,[n,r]);return(0,m.jsxs)("div",{className:"wx-GDJvtROw wx-search",children:[(0,m.jsxs)("div",{className:"wx-GDJvtROw wx-toolbar",children:[(0,m.jsx)("div",{className:"wx-GDJvtROw wx-back-icon",children:(0,m.jsx)(Ex,{name:"angle-left",onClick:function(){t.exec("filter-files",{text:""})}})}),(0,m.jsxs)("div",{className:"wx-GDJvtROw wx-text",children:[e("Search results in")," ",Array.isArray(a)&&a.map((t,r)=>(0,m.jsxs)(u.Fragment,{children:[r?"/":null,"/"==t.id?e(t.name):t.name]},r))]})]}),(0,m.jsx)(Mx,{})]})}function Rx({narrowMode:e,extraInfo:t}){let r=(0,u.useContext)(Sx),{preview:n,icon:a}=r.templates,o=(0,u.useContext)(qm.i18n),i=(0,u.useMemo)(()=>o.getGroup("filemanager"),[o]),s=(0,u.useMemo)(()=>_m("%D, %d %F %Y, %H:%i",o.getRaw().calendar),[o]),[l,c]=Jf(r,"panels"),d=Zf(r,"activePanel"),h=Zf(r,"preview"),p=Zf(r,"search"),f=(0,u.useMemo)(()=>{let e=l&&null!=d&&l[d]?._selected?.length||0;return p&&!e},[p,c,d]),g=(0,u.useMemo)(()=>{let e=l&&null!=d?l[d]:null;return e?f?e._files:e._selected:[]},[f,c,d]),x=(0,u.useCallback)((e,t)=>(e?`${e} ${i(e>1?"folders":"folder")} `:"")+(t?`${t} ${i(t>1?"files":"file")}`:""),[i]),v=(0,u.useCallback)(()=>{r.exec("show-preview",{mode:!h})},[r,h]),y=(0,u.useCallback)(e=>"folder"===e.type?i("Folder"):e.ext||i("Unknown file"),[i]),b=(0,u.useMemo)(()=>{let e,t,r,o,s,l,c,d;if(1!==g.length||f){if(t=s=null,e="",g.length){let t,r=0,n=0,a=0,o=[];g.forEach(e=>{typeof e.size>"u"&&(t=!0,r=void 0),t||(r+=e.size),o.push(y(e)),"folder"===e.type?n++:a++});let s=new Set(o);l=s.size>1?i("multiple"):[...s][0],c=x(n,a),d=r,f||(e=i("Multiple files"))}o=a({type:f?"search":g.length?"multiple":"none"},"big"),r=""}else{t=g[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}},[g,f,n,a,i,y,x]),w=(0,u.useCallback)(()=>{r.exec("download-file",{id:g[0].id})},[r,g]),S=(0,u.useCallback)(async e=>{if(!t||!e)return null;try{return await t(e)}catch(e){return null}},[t]),[k,C]=(0,u.useState)(null);return(0,u.useEffect)(()=>{let e=!1;return C(null),Promise.resolve(S(b.item)).then(t=>{e||C(t)}).catch(()=>{e||C(null)}),()=>{e=!0}},[S,b.item]),(0,m.jsx)("div",{className:"wx-O0BTtRrH wx-wrapper",children:g&&g.length?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("div",{className:"wx-O0BTtRrH wx-preview",children:[(0,m.jsxs)("div",{className:"wx-O0BTtRrH wx-toolbar",children:[(0,m.jsx)("div",{className:"wx-O0BTtRrH wx-name",children:b.name}),(0,m.jsxs)("div",{className:"wx-O0BTtRrH wx-icons",children:[b.showDownloadIcon?(0,m.jsx)(Ex,{name:"download",onClick:w}):null,e?(0,m.jsx)(Ex,{name:"close",onClick:v}):null]})]}),b.previewSrc?(0,m.jsx)("div",{className:"wx-O0BTtRrH wx-img-wrapper",children:(0,m.jsx)("img",{src:b.previewSrc,alt:i("A miniature file preview")})}):b.iconSrc?(0,m.jsx)("div",{className:"wx-O0BTtRrH wx-icon-wrapper",children:(0,m.jsx)("img",{src:b.iconSrc,alt:i("A miniature file preview")})}):(0,m.jsx)("div",{className:"wx-O0BTtRrH wx-icon-wrapper",children:b.item?(0,m.jsx)("i",{className:`wx-O0BTtRrH wx-icon wxi-${b.item.type}`}):(0,m.jsx)("i",{className:"wx-O0BTtRrH wx-icon wxi-"+(f?"search":"file-multiple-outline")})})]}),(0,m.jsxs)("div",{className:"wx-O0BTtRrH wx-info-panel",children:[(0,m.jsx)("div",{className:"wx-O0BTtRrH wx-title",children:i(f?"Found":"Information")}),(0,m.jsxs)("div",{className:"wx-O0BTtRrH wx-list",children:[b.item?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("span",{className:"wx-O0BTtRrH wx-name",children:i("Type")}),(0,m.jsx)("span",{className:"wx-O0BTtRrH wx-value",children:y(b.item)}),typeof b.item.size<"u"?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("span",{className:"wx-O0BTtRrH wx-name",children:i("Size")}),(0,m.jsx)("span",{className:"wx-O0BTtRrH wx-value",children:Lf(b.item.size)})]}):null,(0,m.jsx)("span",{className:"wx-O0BTtRrH wx-name",children:i("Date")}),(0,m.jsxs)("span",{className:"wx-O0BTtRrH wx-value",children:[s(b.item.date)," "]})]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("span",{className:"wx-O0BTtRrH wx-name",children:i("Count")}),(0,m.jsx)("span",{className:"wx-O0BTtRrH wx-value",children:b.totalCount}),(0,m.jsx)("span",{className:"wx-O0BTtRrH wx-name",children:i("Type")}),(0,m.jsx)("span",{className:"wx-O0BTtRrH wx-value",children:b.type}),typeof b.totalSize<"u"?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("span",{className:"wx-O0BTtRrH wx-name",children:i("Size")}),(0,m.jsx)("span",{className:"wx-O0BTtRrH wx-value",children:Lf(b.totalSize)})]}):null]}),k?Object.entries(k).map(([e,t])=>(0,m.jsxs)(u.default.Fragment,{children:[(0,m.jsx)("span",{className:"wx-O0BTtRrH wx-name",children:e}),(0,m.jsx)("span",{className:"wx-O0BTtRrH wx-value",children:t})]},e)):null]})]})]}):(0,m.jsxs)("div",{className:"wx-O0BTtRrH wx-no-info-panel",children:[(0,m.jsxs)("div",{className:"wx-O0BTtRrH wx-toolbar",children:[(0,m.jsx)("div",{className:"wx-O0BTtRrH wx-name",children:b.name}),(0,m.jsx)("div",{className:"wx-O0BTtRrH wx-icons",children:e?(0,m.jsx)(Ex,{name:"close",onClick:v}):null})]}),(0,m.jsx)("div",{className:"wx-O0BTtRrH wx-no-info-wrapper",children:(0,m.jsxs)("div",{className:"wx-O0BTtRrH wx-no-info",children:[b.previewSrc?(0,m.jsx)("div",{className:"wx-O0BTtRrH wx-img-wrapper",children:(0,m.jsx)("img",{src:b.previewSrc,alt:i("A miniature file preview")})}):b.iconSrc?(0,m.jsx)("div",{className:"wx-O0BTtRrH wx-icon-wrapper",children:(0,m.jsx)("img",{src:b.iconSrc,alt:i("A miniature file preview")})}):(0,m.jsx)("div",{className:"wx-O0BTtRrH wx-icon-wrapper",children:(0,m.jsx)("i",{className:"wx-O0BTtRrH wx-icon wxi-"+(f?"search":"message-question-outline")})}),(0,m.jsx)("span",{className:"wx-O0BTtRrH wx-text",children:f?"":i("Select file or folder to view details")})]})})]})})}function Dx({panel:e}){let t=(0,u.useContext)(Sx),r=(0,u.useContext)(qm.i18n),n=(0,u.useMemo)(()=>r.getGroup("filemanager"),[r]),[a,o]=Jf(t,"panels"),i=(0,u.useMemo)(()=>a[e]._files,[o,e]),s=(0,u.useMemo)(()=>a[e]._crumbs||[],[o,e]);function l(r){let n=$f(r,s);t.exec("set-path",{id:r,panel:e,...n&&{selected:[n]}})}let[c,d]=(0,u.useState)(null);(0,u.useEffect)(()=>{i&&d(null)},[i]);let h=(0,u.useRef)(null),p=(0,u.useRef)();return(0,u.useEffect)(()=>{p.current?p.current.click=l:(p.current={click:l},im(h.current,p.current))},[l]),(0,m.jsxs)("div",{className:"wx-SNY5LTYx wx-breadcrumbs","data-menu-ignore":"true",ref:h,children:[(0,m.jsx)("div",{className:"wx-SNY5LTYx wx-refresh-icon",children:(0,m.jsx)(Ex,{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)=>(0,m.jsxs)(u.default.Fragment,{children:[t?(0,m.jsx)(Ex,{name:"angle-right"}):null,(0,m.jsx)("div",{className:"wx-SNY5LTYx wx-item","data-id":rm(e.id),"data-menu-ignore":"true",children:"/"==e.id?n(e.name):e.name})]},t))]})}function Ix({row:e}){let t=(0,u.useContext)(qm.i18n),[r]=(0,u.useState)(()=>t.getGroup("filemanager")),n=(0,u.useContext)(Sx).templates,[a]=(0,u.useState)(()=>n.icon(e,"small"));return(0,m.jsx)("div",{className:"wx-qgAqG6sL wx-name-cell",children:"/wx-filemanager-parent-link"===e.id?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("i",{className:"wx-qgAqG6sL wxi-arrow-left"}),(0,m.jsxs)("span",{className:"wx-qgAqG6sL wx-name",children:[" ",r("Back to parent folder")]})]}):(0,m.jsxs)(m.Fragment,{children:[a?(0,m.jsx)("img",{className:"wx-qgAqG6sL wx-icon",alt:"",src:a,height:"24px",width:"24px"}):(0,m.jsx)("i",{className:`wx-qgAqG6sL wxi-${e.type}`}),(0,m.jsxs)("span",{className:"wx-qgAqG6sL wx-name",children:[" ",e.name," "]})]})})}function zx({children:e}){let t=(0,u.useContext)(Sx),r=Zf(t,"activePanel"),n=(0,u.useContext)(Cx),a=(0,u.useRef)(null),o=(0,u.useRef)({});return o.current.drop=()=>{let e=function(e,t="data-id"){let r=Qp(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")},(0,u.useEffect)(()=>{let e=a.current;return n.droparea(e,o.current)},[]),(0,m.jsx)("div",{className:"wx-LT9X7tb7 wx-upload-area",ref:a,children:e})}function _x({panel:e,active:t=!1,onClick:r,onContextMenu:n}){let a=(0,u.useContext)(Sx),o=(0,u.useContext)(qm.i18n),i=(0,u.useMemo)(()=>o.getGroup("filemanager"),[o]),s=(0,u.useMemo)(()=>_m("%d %M %Y",o.getRaw().calendar),[o]),[l]=Jf(a,"panels"),c=l[e].selected,d=l[e].path,h=l[e]._crumbs,p=l[e]._sorts,f=l[e]._selectNavigation,g=l[e]._files,x=(0,u.useMemo)(()=>[{id:"name",header:i("Name"),flexgrow:3,sort:!0,resize:!0,cell:Ix},{id:"size",header:i("Size"),width:100,sort:!0,resize:!0,template:e=>"number"==typeof e?Lf(e):""},{id:"date",header:i("Date"),width:120,sort:!0,resize:!0,template:e=>e?s(e):""}],[i,s]),v=(0,u.useRef)(null),y=(0,u.useRef)(null),b=(0,u.useMemo)(()=>f?["/wx-filemanager-parent-link"]:[...c],[f,c]);function w(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;v.current||y.current?(v.current=null,y.current=null):a.exec("select-file",{id:i,toggle:n,range:o,panel:e})}function S(t){if("/wx-filemanager-parent-link"===t)return void(h.length>1&&a.exec("set-path",{id:h[h.length-2].id,panel:e,selected:[h[h.length-1].id]}));let r=g.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 k(t){let r=t.key,n=p[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 C=(0,u.useMemo)(()=>"/"===d?g:[{id:"/wx-filemanager-parent-link",name:i("Back to parent folder")},...g],[d,g,i]),j=(0,u.useMemo)(()=>{if(C&&p&&p[d]){let{key:e,order:t}=p[d];return{[e]:{order:t}}}},[C,p,d]),T=(0,u.useRef)(null),N=(0,u.useRef)();return(0,u.useEffect)(()=>{N.current?(N.current.click=w,N.current._dblclick=S):(N.current={click:w,dblclick:e=>N.current._dblclick(e),_dblclick:S},im(T.current,N.current))},[w,S]),(0,m.jsxs)("div",{onClick:r,onContextMenu:n,className:"wx-SSaVhET7 wx-wrapper",children:[(0,m.jsx)(Dx,{panel:e}),(0,m.jsx)("div",{"data-id":rm("body"),className:"wx-SSaVhET7 wx-list "+(t?"wx-active":""),ref:T,children:(0,m.jsx)(zx,{children:(0,m.jsx)(wx,{init:function(e){e.intercept("sort-rows",e=>(v.current=!0,k(e),!1)),e.intercept("select-row",()=>!1),e.on("resize-column",()=>y.current=!0),e.intercept("hotkey",()=>!1)},data:C,columns:x,selectedRows:b,columnStyle:()=>"wx-SSaVhET7 wx-each-cell",sizes:{rowHeight:42,headerHeight:42},sortMarks:j})})})]})}function Px(){let e=(0,u.useContext)(Sx),t=Zf(e,"activePanel");function r(t){e.exec("set-active-panel",{panel:t})}return(0,m.jsxs)("div",{className:"wx-L55BfJa2 wx-panels","data-id":rm("body"),children:[(0,m.jsx)("div",{className:"wx-L55BfJa2 wx-item","data-panel":0,children:(0,m.jsx)(_x,{panel:0,active:0==t,onClick:()=>r(0),onContextMenu:()=>r(0)})}),(0,m.jsx)("div",{className:"wx-L55BfJa2 wx-item","data-panel":1,children:(0,m.jsx)(_x,{panel:1,active:1==t,onClick:()=>r(1),onContextMenu:()=>r(1)})})]})}function Ox({folderIcon:e=!1,folder:t={}}){let r=(0,u.useContext)(Sx),[n,a]=Jf(r,"panels"),o=Zf(r,"activePanel"),i=(0,u.useMemo)(()=>n[o].path,[a,o]),s=(0,u.useContext)(qm.i18n),l=(0,u.useMemo)(()=>s.getGroup("filemanager"),[s]),c=(0,u.useMemo)(()=>!!t.data?.find(e=>"folder"===e.type),[t]),d=(0,u.useMemo)(()=>"/"==t.id?l(t.name):t.name,[t,l]),h=(0,u.useMemo)(()=>t.$level>1?20*(t.$level-1):0,[t]),p=t.open;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("li",{"data-id":rm(t.id),className:"wx-NYfhvGIt wx-folder"+(i===t.id?" wx-selected":""),style:{paddingLeft:`${h}px`},children:[c?(0,m.jsx)("i",{className:"wx-NYfhvGIt wx-toggle wxi-"+(p?"angle-down":"angle-right"),"data-action":"toggle"}):(0,m.jsx)("span",{className:"wx-NYfhvGIt wx-toggle-placeholder"}),(0,m.jsx)("i",{className:"wx-NYfhvGIt "+(e||"wxi-folder")}),(0,m.jsxs)("span",{className:"wx-NYfhvGIt wx-name",children:[" ",d," "]})]}),p&&t.data&&t.data.length&&c?(0,m.jsx)(m.Fragment,{children:t.data.map(e=>"folder"===e.type?(0,m.jsx)(Ox,{folder:e},e.id):null)}):null]})}function Lx(){let e=(0,u.useContext)(Sx),[t,r]=Jf(e,"data"),[n,a]=Jf(e,"panels"),o=Zf(e,"activePanel"),i=(0,u.useMemo)(()=>n[o]._crumbs,[a,o]),s=(0,u.useCallback)(r=>{e.exec("open-tree-folder",{id:r,mode:!t.byId(r).open})},[e,r]),l=(0,u.useCallback)(t=>{let r=$f(t,i);e.exec("set-path",{id:t,panel:o,...r&&{selected:[r]}})},[e,i,o]),[c,d]=(0,u.useState)([]);(0,u.useEffect)(()=>{d(t.byId(0).data)},[r]);let h=(0,u.useRef)(null),p=(0,u.useRef)();return(0,u.useEffect)(()=>{p.current?(p.current.click=l,p.current.toggle=s):(p.current={click:l,toggle:s},im(h.current,p.current))},[l,s]),(0,m.jsx)("ul",{ref:h,className:"wx-LyHJ6R6A",children:c.map(e=>"folder"===e.type?(0,m.jsx)(Ox,{folder:e},e.id):null)})}function Fx(){let e=(0,u.useContext)(Sx),t=(0,u.useContext)(qm.i18n),r=(0,u.useMemo)(()=>t.getGroup("filemanager"),[t]),n=Zf(e,"drive"),a=n?n.used:"",o=n?n.total:"";return a&&o?(0,m.jsxs)("div",{className:"wx-DetSyKGG wx-drive",children:[(0,m.jsx)("progress",{value:a,max:o,className:"wx-DetSyKGG wx-progress"}),(0,m.jsxs)("p",{children:[Lf(a)," ",r("of")," ",Lf(o)," ",r("used")]})]}):null}function Bx({option:e}){let t=(0,u.useContext)(qm.i18n).getGroup("filemanager"),r=(0,u.useContext)(Cx),n=(0,u.useCallback)(()=>{r.open({})},[r]);return(0,m.jsx)("div",{className:"wx-9XiKcxq5 wx-upload-button",onClick:n,children:(0,m.jsx)("span",{children:t(e.text)})})}function Hx({readonly:e,menuOptions:t}){let r=(0,u.useContext)(qm.i18n).getGroup("filemanager"),{showPrompt:n}=(0,u.useContext)(kx);(0,u.useEffect)(()=>{!function(e,t){og[e]=t}("upload",Bx)},[]);let a=(0,u.useMemo)(()=>t("add").map(e=>(e.text=r(e.text),e)),[t,r]);return(0,m.jsxs)("div",{className:"wx-FlucfALM wx-wrapper",children:[!e&&(0,m.jsx)("div",{className:"wx-FlucfALM wx-button",children:(0,m.jsx)(cg,{options:a,at:"bottom-fit",onClick:function({action:e}){e&&("add-file"===e.id?n({item:{type:"file",size:0,date:new Date},add:!0}):"add-folder"===e.id&&n({item:{type:"folder",date:new Date},add:!0}))},children:(0,m.jsx)(Gm,{type:"primary block",children:r("Add New")})})}),(0,m.jsx)("div",{className:"wx-FlucfALM wx-tree",children:(0,m.jsx)(Lx,{})}),(0,m.jsx)(Fx,{})]})}function Vx({value:e="",onSearch:t}){let[r,n]=Xf(e),a=(0,u.useContext)(qm.i18n).getGroup("filemanager"),o=(0,u.useRef)(null),i=(0,u.useMemo)(()=>""===r?"wxi-search":"wxi-close",[r]);return(0,m.jsxs)("div",{className:"wx-lUZMtgT1 wx-search-input",children:[(0,m.jsx)("i",{className:`wx-lUZMtgT1 wx-icon ${i}`,onClick:function(){n(""),o.current&&o.current.focus(),t&&t({value:""})}}),(0,m.jsx)("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 $x({narrowMode:e=!1,onShowTree:t}){let r=(0,u.useContext)(Sx),n=(0,u.useContext)(qm.i18n).getGroup("filemanager"),a=Zf(r,"mode"),o=Zf(r,"preview"),i=Zf(r,"search");return(0,m.jsxs)("div",{className:"wx-5PZQQztG wx-toolbar",children:[(0,m.jsxs)("div",{className:"wx-5PZQQztG wx-left "+(e?"wx-left-narrow":""),children:[e?"panels"===a||"search"===a?null:(0,m.jsx)("div",{className:"wx-5PZQQztG wx-sidebar-icon","data-id":rm("toggle-tree"),children:(0,m.jsx)(Ex,{onClick:()=>t&&t(),name:"subtask"})}):(0,m.jsx)("div",{className:"wx-5PZQQztG wx-name",children:n("Files")}),(0,m.jsx)(Vx,{onSearch:function(e){r.exec("filter-files",{text:e.value})},value:i})]}),(0,m.jsxs)("div",{className:"wx-5PZQQztG wx-right",children:[e?null:(0,m.jsx)("div",{className:"wx-5PZQQztG wx-preview-icon",children:(0,m.jsx)(jf,{onClick:function(e){e.preventDefault(),r.exec("show-preview",{mode:!o})},value:o,children:(0,m.jsx)("i",{className:"wx-5PZQQztG wxi-eye"})})}),(0,m.jsx)("div",{className:"wx-5PZQQztG wx-modes",children:(0,m.jsx)(yf,{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 qx(){let e=Zf((0,u.useContext)(Sx),"activePanel");return(0,m.jsxs)("div",{className:"wx-NwohNJzN wx-wrapper",children:[(0,m.jsx)(Dx,{panel:e}),(0,m.jsx)(zx,{children:(0,m.jsx)(Mx,{})})]})}function Ux({readonly:e=!1,menuOptions:t,extraInfo:r}){let n=(0,u.useRef)(null),a=(0,u.useRef)(null),[o,i]=(0,u.useState)(void 0),[s,l]=(0,u.useState)(void 0),[c,d]=(0,u.useState)(!1),h=pg(),p=(0,u.useContext)(Sx),{showPrompt:f,showConfirm:g}=(0,u.useContext)(kx),x=(0,u.useContext)(qm.i18n),v=(0,u.useMemo)(()=>x.getGroup("filemanager"),[x]),y=Zf(p,"mode"),b=Zf(p,"preview"),w=Zf(p,"activePanel"),[S,k]=Jf(p,"panels"),C=(0,u.useMemo)(()=>(S&&null!=w?S[w]:null)?.selected??[],[k,w]),j=(0,u.useMemo)(()=>(S&&null!=w?S[w]:null)?.path,[k,w]),[T,N]=(0,u.useState)([]);(0,u.useEffect)(()=>{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 M=(0,u.useCallback)(()=>{d(e=>!e)},[]),E=(0,u.useCallback)(e=>{s&&"toggle-tree"!==em(e)&&d(!1)},[s]);(0,u.useEffect)(()=>{let e=a.current;if(e)return mm(e,E).destroy},[E]),(0,u.useEffect)(()=>{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 A=(0,u.useMemo)(()=>({icon:"wxi-eye",text:"Preview",id:"preview"}),[]),R=(0,u.useCallback)(e=>{let r=s?[A]:[];return"file"===e&&(r=[...r,...t().filter(e=>"download"===e.id)]),r},[s,A,t]),D=(0,u.useRef)(null),I=(0,u.useCallback)((e,t,r)=>{let n=r?[t.id]:C;switch(e){case"download":p.exec("download-file",{id:t.id});break;case"copy":case"move":D.current={action:e,ids:n};break;case"paste":D.current&&p.exec("copy"===D.current.action?"copy-files":"move-files",{ids:D.current.ids,target:"folder"===t?.type?t.id:j});break;case"rename":f({item:t});break;case"delete":g({selected:n});break;case"preview":p.exec("show-preview",{mode:!b})}},[p,C,j,f,g,b]),z=(0,u.useCallback)(()=>S?.[w],[S,w]);(0,u.useEffect)(()=>{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=$f(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:+Wf(e,"data-panel")})})}return e.addEventListener("keydown",a),{destroy:()=>{e.removeEventListener("keydown",a)}}}(r,{api:p,menuOptions:e?R:t,performAction:I,getPanel:z});return()=>{"function"==typeof a?a():a&&"function"==typeof a.destroy&&a.destroy()}},[p,e,R,t,I,z]);let _=(0,u.useCallback)((r,n)=>{let a,o=r?p.getFile(r):null,i=n.target.closest(".tree-item.folder");if(e)a=R(o?.type);else{if("body"===r)a=t(r);else if(o)if(!i&&C.length>1)a=s?[A,...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?[A,...e]:e)}"search"===y&&(a=a?.filter(e=>"paste"!==e.id))}if(o?.id&&(!C.length||!C.some(e=>e===o.id))&&!i&&p.exec("select-file",{id:o.id}),a?.length)return a.forEach(e=>{i&&(e.hotkey=""),e.text&&=v(e.text),e.hotkey&&(e.subtext=e.hotkey)}),N(a),o||{}},[p,e,R,t,C,s,A,y,v]),P=(0,u.useCallback)(e=>{let{action:t,context:r}=e;t&&I(t.id,r,!t.hotkey)},[I]);return(0,m.jsx)("div",{className:"wx-RJbNonjJ wx-filemanager wx-flex",ref:n,"data-menu-ignore":"false",children:s&&b?(0,m.jsx)("div",{className:"wx-RJbNonjJ wx-info-narrow",children:(0,m.jsx)(Rx,{narrowMode:s,extraInfo:r})}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)($x,{narrowMode:s,onShowTree:M}),(0,m.jsx)(dg,{dataKey:"id",at:"point",options:T,resolver:_,onClick:P,children:(0,m.jsxs)(lg,{dataKey:"actionId",options:T,resolver:_,onClick:P,children:[(0,m.jsx)(mg,{data:h,apiOnly:!0,uploadURL:async function(e){await Promise.resolve();let{name:t,size:r}=e.file;p.exec("create-file",{file:{name:t,size:r,date:new Date,file:e.file},parent:j})}}),(0,m.jsx)(Cx.Provider,{value:h,children:(0,m.jsx)("div",{className:"wx-RJbNonjJ wx-content-wrapper wx-flex",children:"panels"!==y&&"search"!==y?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("div",{className:"wx-RJbNonjJ "+["wx-sidebar",s?"wx-sidebar-narrow":"",c?"wx-sidebar-visible":""].filter(Boolean).join(" "),ref:a,children:(0,m.jsx)(Hx,{readonly:e,menuOptions:t})}),(0,m.jsxs)("div",{className:"wx-RJbNonjJ wx-content",style:{width:`calc(100% - ${o||0}px - 10px)`},children:[(0,m.jsx)("div",{className:"wx-RJbNonjJ wx-content-item"+(b?"":"-fit"),"data-id":rm("body"),children:"table"===y?(0,m.jsx)(_x,{panel:w}):(0,m.jsx)(qx,{})}),b?(0,m.jsx)("div",{className:"wx-RJbNonjJ wx-info",children:(0,m.jsx)(Rx,{extraInfo:r})}):null]})]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("div",{className:"wx-RJbNonjJ wx-content-item"+(b?"":"-fit"),children:(0,m.jsx)("panels"===y?Px:Ax,{})}),b?(0,m.jsx)("div",{className:"wx-RJbNonjJ wx-info",children:(0,m.jsx)(Rx,{extraInfo:r})}):null]})})})]})})]})})}function Gx(e,t){let r,{type:n,ext:a}=e;return"folder"!==n&&(r=n&&"file"!==n&&Tx[n]?n:a?Tx[a]?a:"file":"unknown",`https://cdn.svar.dev/icons/filemanager/vivid/${t}/${r}.svg`)}(0,u.forwardRef)(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=Gf,extraInfo:d=null,init:h=null,icons:p=Gx,previews:f=null,...g}=e,x=(0,u.useRef)();x.current=g;let v=(0,u.useMemo)(()=>new Uf(eg),[]),y=(0,u.useMemo)(()=>v.in,[v]),b=(0,u.useRef)(null);null===b.current&&(b.current=new Nf((e,t)=>{let r="on"+(e=>e.split("-").map(e=>e?e.charAt(0).toUpperCase()+e.slice(1):"").join(""))(e);x.current&&x.current[r]&&x.current[r](t)}),y.setNext(b.current));let w=(0,u.useMemo)(()=>({getState:v.getState.bind(v),getReactiveState:v.getReactive.bind(v),getStores:()=>({data:v}),exec:y.exec,setNext:e=>(b.current=b.current.setNext(e),b.current),intercept:y.intercept.bind(y),on:y.on.bind(y),detach:y.detach.bind(y),getFile:v.getFile.bind(v),serialize:v.serialize.bind(v),templates:{preview:f||(()=>null),icon:"simple"===p?()=>null:p}}),[v,y]),S=(0,u.useRef)(0);return(0,u.useEffect)(()=>{if(S.current){let e=v.getState();v.init({data:r,mode:n,drive:a,preview:o,panels:i||e.panels||[],activePanel:s})}else h&&h(w);S.current++},[v,r,n,a,o,i,s,h,w]),0===S.current&&v.init({data:r,mode:n,drive:a,preview:o,panels:i||[],activePanel:s}),(0,u.useImperativeHandle)(t,()=>({...w}),[w]),(0,m.jsx)(Sx.Provider,{value:w,children:(0,m.jsx)(uf,{words:Tf,optional:!0,children:(0,m.jsx)(jx,{children:(0,m.jsx)(Ux,{readonly:l,menuOptions:c,extraInfo:d})})})})});am(nm);var Wx=[{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"]}],Kx=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,Yx=Sh,Xx=(e,t)=>r=>{if(null==t?.variants)return Yx(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=Kx(t)||Kx(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 Yx(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)},Zx=Xx("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"}}),Jx=["top","right","bottom","left"],Qx=Math.min,ev=Math.max,tv=Math.round,rv=Math.floor,nv=e=>({x:e,y:e}),av={left:"right",right:"left",bottom:"top",top:"bottom"};function ov(e,t,r){return ev(e,Qx(t,r))}function iv(e,t){return"function"==typeof e?e(t):e}function sv(e){return e.split("-")[0]}function lv(e){return e.split("-")[1]}function cv(e){return"x"===e?"y":"x"}function dv(e){return"y"===e?"height":"width"}function uv(e){let t=e[0];return"t"===t||"b"===t?"y":"x"}function hv(e){return cv(uv(e))}function pv(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}var mv=["left","right"],fv=["right","left"],gv=["top","bottom"],xv=["bottom","top"];function vv(e,t,r,n){let a=lv(e),o=function(e,t,r){switch(e){case"top":case"bottom":return r?t?fv:mv:t?mv:fv;case"left":case"right":return t?gv:xv;default:return[]}}(sv(e),"start"===r,n);return a&&(o=o.map(e=>e+"-"+a),t&&(o=o.concat(o.map(pv)))),o}function yv(e){let t=sv(e);return av[t]+e.slice(t.length)}function bv(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 wv(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 Sv(e,t,r){let n,{reference:a,floating:o}=e,i=uv(t),s=hv(t),l=dv(s),c=sv(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=lv(t);return m&&(n[s]+=p*("end"===m?1:-1)*(r&&d?-1:1)),n}async function kv(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}=iv(t,e),p=bv(h),m=i[u?"floating"===d?"reference":"floating":d],f=wv(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,x=await(null==a.getOffsetParent?void 0:a.getOffsetParent(i.floating)),v=await(null==a.isElement?void 0:a.isElement(x))&&await(null==a.getScale?void 0:a.getScale(x))||{x:1,y:1},y=wv(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:g,offsetParent:x,strategy:s}):g);return{top:(f.top-y.top+p.top)/v.y,bottom:(y.bottom-f.bottom+p.bottom)/v.y,left:(f.left-y.left+p.left)/v.x,right:(y.right-f.right+p.right)/v.x}}function Cv(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function jv(e){return Jx.some(t=>e[t]>=0)}var Tv=new Set(["left","top"]);function Nv(){return typeof window<"u"}function Mv(e){return Rv(e)?(e.nodeName||"").toLowerCase():"#document"}function Ev(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Av(e){return((Rv(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Rv(e){return!!Nv()&&(e instanceof Node||e instanceof Ev(e).Node)}function Dv(e){return!!Nv()&&(e instanceof Element||e instanceof Ev(e).Element)}function Iv(e){return!!Nv()&&(e instanceof HTMLElement||e instanceof Ev(e).HTMLElement)}function zv(e){return!(!Nv()||typeof ShadowRoot>"u")&&(e instanceof ShadowRoot||e instanceof Ev(e).ShadowRoot)}function _v(e){let{overflow:t,overflowX:r,overflowY:n,display:a}=Uv(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&"inline"!==a&&"contents"!==a}function Pv(e){return/^(table|td|th)$/.test(Mv(e))}function Ov(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}var Lv,Fv=/transform|translate|scale|rotate|perspective|filter/,Bv=/paint|layout|strict|content/,Hv=e=>!!e&&"none"!==e;function Vv(e){let t=Dv(e)?Uv(e):e;return Hv(t.transform)||Hv(t.translate)||Hv(t.scale)||Hv(t.rotate)||Hv(t.perspective)||!$v()&&(Hv(t.backdropFilter)||Hv(t.filter))||Fv.test(t.willChange||"")||Bv.test(t.contain||"")}function $v(){return Lv??=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none"),Lv}function qv(e){return/^(html|body|#document)$/.test(Mv(e))}function Uv(e){return Ev(e).getComputedStyle(e)}function Gv(e){return Dv(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Wv(e){if("html"===Mv(e))return e;let t=e.assignedSlot||e.parentNode||zv(e)&&e.host||Av(e);return zv(t)?t.host:t}function Kv(e){let t=Wv(e);return qv(t)?(e.ownerDocument||e).body:Iv(t)&&_v(t)?t:Kv(t)}function Yv(e,t,r){void 0===t&&(t=[]),void 0===r&&(r=!0);let n=Kv(e),a=n===e.ownerDocument?.body,o=Ev(n);if(a){let e=Xv(o);return t.concat(o,o.visualViewport||[],_v(n)?n:[],e&&r?Yv(e):[])}return t.concat(n,Yv(n,[],r))}function Xv(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Zv(e){let t=Uv(e),r=parseFloat(t.width)||0,n=parseFloat(t.height)||0,a=Iv(e),o=a?e.offsetWidth:r,i=a?e.offsetHeight:n,s=tv(r)!==o||tv(n)!==i;return s&&(r=o,n=i),{width:r,height:n,$:s}}function Jv(e){return Dv(e)?e:e.contextElement}function Qv(e){let t=Jv(e);if(!Iv(t))return nv(1);let r=t.getBoundingClientRect(),{width:n,height:a,$:o}=Zv(t),i=(o?tv(r.width):r.width)/n,s=(o?tv(r.height):r.height)/a;return(!i||!Number.isFinite(i))&&(i=1),(!s||!Number.isFinite(s))&&(s=1),{x:i,y:s}}var ey=nv(0);function ty(e){let t=Ev(e);return $v()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:ey}function ry(e,t,r,n){void 0===t&&(t=!1),void 0===r&&(r=!1);let a=e.getBoundingClientRect(),o=Jv(e),i=nv(1);t&&(n?Dv(n)&&(i=Qv(n)):i=Qv(e));let s=function(e,t,r){return void 0===t&&(t=!1),!!r&&t&&r===Ev(e)}(o,r,n)?ty(o):nv(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=Ev(o),t=Dv(n)?Ev(n):n,r=e,a=Xv(r);for(;a&&t!==r;){let e=Qv(a),t=a.getBoundingClientRect(),n=Uv(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=Ev(a),a=Xv(r)}}return wv({width:d,height:u,x:l,y:c})}function ny(e,t){let r=Gv(e).scrollLeft;return t?t.left+r:ry(Av(e)).left+r}function ay(e,t){let r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-ny(e,r),y:r.top+t.scrollTop}}function oy(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=Ev(e),o=Av(e),i=a.visualViewport,s=o.clientWidth,l=o.clientHeight,c=0,d=0;if(i){let e=!$v()||"fixed"===t;n?e||(c=-i.offsetLeft,d=-i.offsetTop):(s=i.width,l=i.height,e&&(c=i.offsetLeft,d=i.offsetTop))}if(ny(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=Gv(e),r=e.ownerDocument.body,n=ev(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),a=ev(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight),o=-t.scrollLeft+ny(e),i=-t.scrollTop;return"rtl"===Uv(r).direction&&(o+=ev(e.clientWidth,r.clientWidth)-n),{width:n,height:a,x:o,y:i}}(Av(e));else if(Dv(t))n=function(e,t){let r=ry(e,!0,"fixed"===t),n=r.top+e.clientTop,a=r.left+e.clientLeft,o=Qv(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=ty(e);n={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return wv(n)}function iy(e,t){let r=t.get(e);if(r)return r;let n=Yv(e,[],!1).filter(e=>Dv(e)&&"body"!==Mv(e)),a=null,o="fixed"===Uv(e).position,i=o?Wv(e):e;for(;Dv(i)&&!qv(i);){let e=Uv(i),t=Vv(i),r=a?a.position:o?"fixed":"";t||"fixed"!==r&&("absolute"!==r||"static"!==e.position)?a=e:n=n.filter(e=>e!==i),i=Wv(i)}return t.set(e,n),n}function sy(e,t,r){let n=Iv(t),a=Av(t),o="fixed"===r,i=ry(e,!0,o,t),s={scrollLeft:0,scrollTop:0},l=nv(0);if((n||!o)&&(("body"!==Mv(t)||_v(a))&&(s=Gv(t)),n)){let e=ry(t,!0,o,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}!n&&a&&(l.x=ny(a));let c=!a||n||o?nv(0):ay(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 ly(e){return"static"===Uv(e).position}function cy(e,t){if(!Iv(e)||"fixed"===Uv(e).position)return null;if(t)return t(e);let r=e.offsetParent;return Av(e)===r&&(r=r.ownerDocument.body),r}function dy(e,t){let r=Ev(e);if(Ov(e))return r;if(!Iv(e)){let t=Wv(e);for(;t&&!qv(t);){if(Dv(t)&&!ly(t))return t;t=Wv(t)}return r}let n=cy(e,t);for(;n&&Pv(n)&&ly(n);)n=cy(n,t);return n&&qv(n)&&ly(n)&&!Vv(n)?r:n||function(e){let t=Wv(e);for(;Iv(t)&&!qv(t);){if(Vv(t))return t;if(Ov(t))return null;t=Wv(t)}return null}(e)||r}var uy={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e,o="fixed"===a,i=Av(n),s=!!t&&Ov(t.floating);if(n===i||s&&o)return r;let l={scrollLeft:0,scrollTop:0},c=nv(1),d=nv(0),u=Iv(n);if((u||!o)&&(("body"!==Mv(n)||_v(i))&&(l=Gv(n)),u)){let e=ry(n);c=Qv(n),d.x=e.x+n.clientLeft,d.y=e.y+n.clientTop}let h=!i||u||o?nv(0):ay(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:Av,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e,o=[..."clippingAncestors"===r?Ov(t)?[]:iy(t,this._c):[].concat(r),n],i=oy(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=oy(t,o[u],a);s=ev(e.top,s),l=Qx(e.right,l),c=Qx(e.bottom,c),d=ev(e.left,d)}return{width:l-d,height:c-s,x:d,y:s}},getOffsetParent:dy,getElementRects:async function(e){let t=this.getOffsetParent||dy,r=this.getDimensions,n=await r(e.floating);return{reference:sy(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}=Zv(e);return{width:t,height:r}},getScale:Qv,isElement:Dv,isRTL:function(e){return"rtl"===Uv(e).direction}};function hy(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function py(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=Jv(e),d=a||o?[...c?Yv(c):[],...t?Yv(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=Av(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:-rv(u)+"px "+-rv(o.clientWidth-(d+h))+"px "+-rv(o.clientHeight-(u+p))+"px "+-rv(d)+"px",threshold:ev(0,Qx(1,l))||1},f=!0;function g(t){let r=t[0].intersectionRatio;if(!hy(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=Ev(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?ry(e):null;return l&&function t(){let n=ry(e);f&&!hy(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 my=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=sv(r),s=lv(r),l="y"===uv(r),c=Tv.has(i)?-1:1,d=o&&l?-1:1,u=iv(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}}}}},fy=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}=iv(e,t),d={x:r,y:n},u=await o.detectOverflow(t,c),h=uv(a),p=cv(h),m=d[p],f=d[h],g=(e,t)=>ov(t+u["y"===e?"top":"left"],t,t-u["y"===e?"bottom":"right"]);i&&(m=g(p,m)),s&&(f=g(h,f));let x=l.fn({...t,[p]:m,[h]:f});return{...x,data:{x:x.x-r,y:x.y-n,enabled:{[p]:i,[h]:s}}}}}},gy=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}=iv(e,t);if(null!=(r=a.arrow)&&r.alignmentOffset)return{};let g=sv(n),x=uv(i),v=sv(i)===i,y=await(null==s.isRTL?void 0:s.isRTL(l.floating)),b=u||(v||!m?[yv(i)]:function(e){let t=yv(e);return[pv(e),t,pv(t)]}(i)),w="none"!==p;!u&&w&&b.push(...vv(i,m,p,y));let S=[i,...b],k=await s.detectOverflow(t,f),C=[],j=a.flip?.overflows||[];if(c&&C.push(k[g]),d){let e=function(e,t,r){void 0===r&&(r=!1);let n=lv(e),a=hv(e),o=dv(a),i="x"===a?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=yv(i)),[i,yv(i)]}(n,o,y);C.push(k[e[0]],k[e[1]])}if(j=[...j,{placement:n,overflows:C}],!C.every(e=>e<=0)){let e=(a.flip?.index||0)+1,t=S[e];if(t&&("alignment"!==d||x===uv(t)||j.every(e=>uv(e.placement)!==x||e.overflows[0]>0)))return{data:{index:e,overflows:j},reset:{placement:t}};let r=j.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=j.filter(e=>{if(w){let t=uv(e.placement);return t===x||"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{}}}},xy=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}=iv(e,t),d=await i.detectOverflow(t,c),u=sv(a),h=lv(a),p="y"===uv(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,x=m-d.left-d.right,v=Qx(f-d[r],g),y=Qx(m-d[n],x),b=t.middlewareData.shift,w=!b,S=v,k=y;null!=b&&b.enabled.x&&(k=x),null!=b&&b.enabled.y&&(S=g),w&&!h&&(p?k=m-2*ev(d.left,d.right):S=f-2*ev(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}}:{}}}},vy=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){let{rects:r,platform:n}=t,{strategy:a="referenceHidden",...o}=iv(e,t);switch(a){case"referenceHidden":{let e=Cv(await n.detectOverflow(t,{...o,elementContext:"reference"}),r.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:jv(e)}}}case"escaped":{let e=Cv(await n.detectOverflow(t,{...o,altBoundary:!0}),r.floating);return{data:{escapedOffsets:e,escaped:jv(e)}}}default:return{}}}}},yy=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}=iv(e,t)||{};if(null==c)return{};let u=bv(d),h={x:r,y:n},p=hv(a),m=dv(p),f=await i.getDimensions(c),g="y"===p,x=g?"top":"left",v=g?"bottom":"right",y=g?"clientHeight":"clientWidth",b=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[y]:0;(!k||!(await(null==i.isElement?void 0:i.isElement(S))))&&(k=s.floating[y]||o.floating[m]);let C=b/2-w/2,j=k/2-f[m]/2-1,T=Qx(u[x],j),N=Qx(u[v],j),M=k-f[m]-N,E=k/2-f[m]/2+C,A=ov(T,E,M),R=!l.arrow&&null!=lv(a)&&E!==A&&o.reference[m]/2-(E<T?T:N)-f[m]/2<0,D=R?E<T?E-T:E-M:0;return{[p]:h[p]+D,data:{[p]:A,centerOffset:E-A-D,...R&&{alignmentOffset:D}},reset:R}}}),by=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}=iv(e,t),d={x:r,y:n},u=uv(a),h=cv(u),p=d[h],m=d[u],f=iv(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=Tv.has(sv(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}}}},wy=(e,t,r)=>{let n=new Map,a=r??{},o={...uy,...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:kv},l=await(null==i.isRTL?void 0:i.isRTL(t)),c=await i.getElementRects({reference:e,floating:t,strategy:a}),{x:d,y:u}=Sv(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:x}=r,{x:v,y:y,data:b,reset:w}=await x({x:d,y:u,initialPlacement:n,placement:h,strategy:a,middlewareData:m,rects:c,platform:s,elements:{reference:e,floating:t}});d=v??d,u=y??u,m[g]={...m[g],...b},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}=Sv(c,h,l))),f=-1)}return{x:d,y:u,placement:h,strategy:a,middlewareData:m}})(e,t,{...a,platform:o})},Sy=typeof document<"u"?u.useLayoutEffect:function(){};function ky(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(!ky(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||ky(e[r],t[r])))return!1}return!0}return e!=e&&t!=t}function Cy(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function jy(e,t){let r=Cy(e);return Math.round(t*r)/r}function Ty(e){let t=u.useRef(e);return Sy(()=>{t.current=e}),t}var Ny=(e,t)=>{let r=my(e);return{name:r.name,fn:r.fn,options:[e,t]}},My=(e,t)=>{let r=fy(e);return{name:r.name,fn:r.fn,options:[e,t]}},Ey=(e,t)=>({fn:by(e).fn,options:[e,t]}),Ay=(e,t)=>{let r=gy(e);return{name:r.name,fn:r.fn,options:[e,t]}},Ry=(e,t)=>{let r=xy(e);return{name:r.name,fn:r.fn,options:[e,t]}},Dy=(e,t)=>{let r=vy(e);return{name:r.name,fn:r.fn,options:[e,t]}},Iy=(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?{}:yy({element:r.current,padding:n}).fn(t):r?yy({element:r,padding:n}).fn(t):{}}}))(e);return{name:r.name,fn:r.fn,options:[e,t]}},zy=(Object.defineProperty,Object.defineProperty);function _y(e){let[t,r]=u.useState(void 0);return sl(()=>{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)=>{zy(e,"name",{value:t,configurable:!0})})(_y,"useSize");var Py=Object.defineProperty,Oy=(e,t)=>Py(e,"name",{value:t,configurable:!0}),Ly="Popper",[Fy,By]=ol(Ly),[Hy,Vy]=Fy(Ly),$y=Oy(e=>{let{__scopePopper:t,children:r}=e,[n,a]=u.useState(null),[o,i]=u.useState(void 0);return(0,m.jsx)(Hy,{scope:t,anchor:n,onAnchorChange:a,placementState:o,setPlacementState:i,children:r})},"Popper"),qy=u.forwardRef(Oy(function(e,t){let{__scopePopper:r,virtualRef:n,...a}=e,o=Vy("PopperAnchor",r),i=u.useRef(null),s=o.onAnchorChange,l=rl(t,u.useCallback(e=>{i.current=e,e&&s(e)},[s])),c=u.useRef(null);u.useEffect(()=>{if(!n)return;let e=c.current;c.current=n.current,e!==c.current&&s(c.current)});let d=o.placementState&&Zy(o.placementState),h=d?.[0],p=d?.[1];return n?null:(0,m.jsx)(Bl.div,{"data-radix-popper-side":h,"data-radix-popper-align":p,...a,ref:l})},"PopperAnchor")),Uy="PopperContent",[Gy,Wy]=Fy(Uy),Ky=u.forwardRef(Oy(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:h="partial",hideWhenDetached:p=!1,updatePositionStrategy:f="optimized",onPlaced:g,...x}=e,y=Vy(Uy,r),[b,w]=u.useState(null),S=rl(t,w),[k,C]=u.useState(null),j=_y(k),T=j?.width??0,N=j?.height??0,M=n+("center"===o?"":"-"+o),E="number"==typeof d?d:{top:0,right:0,bottom:0,left:0,...d},A=Array.isArray(c)?c:[c],R=A.length>0,D={padding:E,boundary:A.filter(Yy),altBoundary:R},{refs:I,floatingStyles:z,placement:_,isPositioned:P,middlewareData:O}=function(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,h]=u.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=u.useState(n);ky(p,n)||m(n);let[f,g]=u.useState(null),[x,y]=u.useState(null),b=u.useCallback(e=>{e!==C.current&&(C.current=e,g(e))},[]),w=u.useCallback(e=>{e!==j.current&&(j.current=e,y(e))},[]),S=o||f,k=i||x,C=u.useRef(null),j=u.useRef(null),T=u.useRef(d),N=null!=l,M=Ty(l),E=Ty(a),A=Ty(c),R=u.useCallback(()=>{if(!C.current||!j.current)return;let e={placement:t,strategy:r,middleware:p};E.current&&(e.platform=E.current),wy(C.current,j.current,e).then(e=>{let t={...e,isPositioned:!1!==A.current};D.current&&!ky(T.current,t)&&(T.current=t,v.flushSync(()=>{h(t)}))})},[p,t,r,E,A]);Sy(()=>{!1===c&&T.current.isPositioned&&(T.current.isPositioned=!1,h(e=>({...e,isPositioned:!1})))},[c]);let D=u.useRef(!1);Sy(()=>(D.current=!0,()=>{D.current=!1}),[]),Sy(()=>{if(S&&(C.current=S),k&&(j.current=k),S&&k){if(M.current)return M.current(S,k,R);R()}},[S,k,R,M,N]);let I=u.useMemo(()=>({reference:C,floating:j,setReference:b,setFloating:w}),[b,w]),z=u.useMemo(()=>({reference:S,floating:k}),[S,k]),_=u.useMemo(()=>{let e={position:r,left:0,top:0};if(!z.floating)return e;let t=jy(z.floating,d.x),n=jy(z.floating,d.y);return s?{...e,transform:"translate("+t+"px, "+n+"px)",...Cy(z.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,s,z.floating,d.x,d.y]);return u.useMemo(()=>({...d,update:R,refs:I,elements:z,floatingStyles:_}),[d,R,I,z,_])}({strategy:"fixed",placement:M,whileElementsMounted:Oy((...e)=>py(...e,{animationFrame:"always"===f}),"whileElementsMounted"),elements:{reference:y.anchor},middleware:[Ny({mainAxis:a+N,alignmentAxis:i}),l&&My({mainAxis:!0,crossAxis:!1,limiter:"partial"===h?Ey():void 0,...D}),l&&Ay({...D}),Ry({...D,apply:Oy(({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")}),k&&Iy({element:k,padding:s}),Xy({arrowWidth:T,arrowHeight:N}),p&&Dy({strategy:"referenceHidden",...D,boundary:R?D.boundary:void 0})]}),L=y.setPlacementState;sl(()=>(L(_),()=>{L(void 0)}),[_,L]);let[F,B]=Zy(_),H=$l(g);sl(()=>{P&&H?.()},[P,H]);let V=O.arrow?.x,$=O.arrow?.y,q=0!==O.arrow?.centerOffset,[U,G]=u.useState();return sl(()=>{b&&G(window.getComputedStyle(b).zIndex)},[b]),(0,m.jsx)("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:P?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:U,"--radix-popper-transform-origin":[O.transformOrigin?.x,O.transformOrigin?.y].join(" "),...O.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:(0,m.jsx)(Gy,{scope:r,placedSide:F,placedAlign:B,onArrowChange:C,arrowX:V,arrowY:$,shouldHideArrow:q,children:(0,m.jsx)(Bl.div,{"data-side":F,"data-align":B,...x,ref:S,style:{...x.style,animation:P?x.style?.animation:"none"}})})})},"PopperContent"));function Yy(e){return null!==e}Oy(Yy,"isNotNull");var Xy=Oy(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]=Zy(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 Zy(e){let[t,r="center"]=e.split("-");return[t,r]}Oy(Zy,"getSideAndAlignFromPlacement");var Jy=$y,Qy=qy,eb=Ky,tb=(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),rb=(e,t)=>tb(e,"name",{value:t,configurable:!0}),[nb,ab]=ol("Tooltip",[By]),[ob,ib]=(By(),nb("TooltipProvider")),sb="Tooltip",[lb,cb]=nb(sb),db="TooltipPortal",[ub,hb]=nb(db,{forceMount:void 0});function pb(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 mb(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 fb(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 gb(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 xb(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)),vb(t)}function vb(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)}rb(pb,"getExitSideFromRect"),rb(mb,"getPaddedExitPoints"),rb(fb,"getPointsFromRect"),rb(gb,"isPointInPolygon"),rb(xb,"getHull"),rb(vb,"getHullPresorted");var yb=Object.defineProperty,bb=(e,t)=>yb(e,"name",{value:t,configurable:!0});function wb(e){let t=e+"CollectionProvider",[r,n]=ol(t),[a,o]=r(t,{collectionRef:{current:null},itemMap:new Map}),i=bb(e=>{let{scope:t,children:r}=e,n=u.useRef(null),o=u.useRef(new Map).current;return(0,m.jsx)(a,{scope:t,itemMap:o,collectionRef:n,children:r})},"CollectionProvider");i.displayName=t;let s=e+"CollectionSlot",l=jl(s),c=u.forwardRef((e,t)=>{let{scope:r,children:n}=e,a=rl(t,o(s,r).collectionRef);return(0,m.jsx)(l,{ref:a,children:n})});c.displayName=s;let d=e+"CollectionItemSlot",h="data-radix-collection-item",p=jl(d),f=u.forwardRef((e,t)=>{let{scope:r,children:n,...a}=e,i=u.useRef(null),s=rl(t,i),l=o(d,r);return u.useEffect(()=>(l.itemMap.set(i,{ref:i,...a}),()=>{l.itemMap.delete(i)})),(0,m.jsx)(p,{[h]:"",ref:s,children:n})});function g(t){let r=o(e+"CollectionConsumer",t);return u.useCallback(()=>{let e=r.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${h}]`));return Array.from(r.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current))},[r.collectionRef,r.itemMap])}return f.displayName=d,bb(g,"useCollection"),[{Provider:i,Slot:c,ItemSlot:f},g,n]}bb(wb,"createCollection");var Sb=new WeakMap,kb=class e extends Map{static{bb(this,"OrderedDict")}#e;constructor(e){super(e),this.#e=[...super.keys()],Sb.set(this,!0)}set(e,t){return Sb.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=Tb(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=Cb(this.#e,e);if(void 0!==t)return this.get(t)}entryAt(e){let t=Cb(this.#e,e);if(void 0!==t)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return Cb(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 Cb(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);let r=jb(e,t);return-1===r?void 0:e[r]}function jb(e,t){let r=e.length,n=Tb(t),a=n>=0?n:r+n;return a<0||a>=r?-1:a}function Tb(e){return e!=e||0===e?0:Math.trunc(e)}function Nb(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 Mb(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function Eb(e,t){return e[1].element&&t[1].element?Mb(e[1].element,t[1].element)?-1:1:0}function Ab(e){return new MutationObserver(t=>{for(let r of t)if("childList"===r.type)return void e()})}bb(Cb,"at"),bb(jb,"toSafeIndex"),bb(Tb,"toSafeInteger"),bb(function(e){let t=e+"CollectionProvider",[r,n]=ol(t),[a,o]=r(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new kb,setItemMap:bb(()=>{},"setItemMap")}),i=bb(({state:e,...t})=>e?(0,m.jsx)(l,{...t,state:e}):(0,m.jsx)(s,{...t}),"CollectionProvider");i.displayName=t;let s=bb(e=>{let t=x();return(0,m.jsx)(l,{...e,state:t})},"CollectionInit");s.displayName=t+"Init";let l=bb(e=>{let{scope:t,children:r,state:n}=e,o=u.useRef(null),[i,s]=u.useState(null),l=rl(o,s),[c,d]=n;return u.useEffect(()=>{if(!i)return;let e=Ab(()=>{});return e.observe(i,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[i]),(0,m.jsx)(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=jl(c),h=u.forwardRef((e,t)=>{let{scope:r,children:n}=e,a=rl(t,o(c,r).collectionRef);return(0,m.jsx)(d,{ref:a,children:n})});h.displayName=c;let p=e+"CollectionItemSlot",f=jl(p),g=u.forwardRef((e,t)=>{let{scope:r,children:n,...a}=e,i=u.useRef(null),[s,l]=u.useState(null),c=rl(t,i,l),{setItemMap:d}=o(p,r),h=u.useRef(a);Nb(h.current,a)||(h.current=a);let g=h.current;return u.useEffect(()=>{let e=g;return d(t=>s?t.has(s)?t.set(s,{...e,element:s}).toSorted(Eb):(t.set(s,{...e,element:s}),t.toSorted(Eb)):t),()=>{d(e=>s&&e.has(s)?(e.delete(s),new kb(e)):e)}},[s,g,d]),(0,m.jsx)(f,{"data-radix-collection-item":"",ref:c,children:n})});function x(){return u.useState(new kb)}function v(t){let{itemMap:r}=o(e+"CollectionConsumer",t);return r}return g.displayName=p,bb(x,"useInitCollection"),bb(v,"useCollection"),[{Provider:i,Slot:h,ItemSlot:g},{createCollectionScope:n,useCollection:v,useInitCollection:x}]},"createCollection"),bb(Nb,"shallowEqual"),bb(Mb,"isElementPreceding"),bb(Eb,"sortByDocumentPosition"),bb(Ab,"getChildListObserver");var Rb=Object.defineProperty,Db=u.createContext(void 0);function Ib(e){let t=u.useContext(Db);return e||t||"ltr"}((e,t)=>{Rb(e,"name",{value:t,configurable:!0})})(Ib,"useDirection");var zb=Object.defineProperty,_b=(e,t)=>zb(e,"name",{value:t,configurable:!0}),Pb=!1;function Ob(){let[e,t]=u.useState(Pb);return u.useEffect(()=>{Pb||(Pb=!0,t(!0))},[]),e}_b(Ob,"useIsHydrated");var Lb=u.useSyncExternalStore;function Fb(){return()=>{}}function Bb(){return Lb(Fb,()=>!0,()=>!1)}_b(Fb,"subscribe"),_b(Bb,"useIsHydratedModern");var Hb="function"==typeof Lb?Bb:Ob,Vb=Object.defineProperty,$b=(e,t)=>Vb(e,"name",{value:t,configurable:!0}),qb="rovingFocusGroup.onEntryFocus",Ub={bubbles:!1,cancelable:!0},Gb="RovingFocusGroup",[Wb,Kb,Yb]=wb(Gb),[Xb,Zb]=ol(Gb,[Yb]),[Jb,Qb]=Xb(Gb),ew=u.forwardRef($b(function(e,t){return(0,m.jsx)(Wb.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,m.jsx)(Wb.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,m.jsx)(tw,{...e,ref:t})})})},"RovingFocusGroup")),tw=u.forwardRef($b(function(e,t){let{__scopeRovingFocusGroup:r,orientation:n,loop:a=!1,dir:o,currentTabStopId:i,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:d=!1,...h}=e,p=u.useRef(null),f=rl(t,p),g=Ib(o),[x,v]=yl({prop:i,defaultProp:s??null,onChange:l,caller:Gb}),[y,b]=u.useState(!1),w=$l(c),S=Kb(r),k=u.useRef(!1),[C,j]=u.useState(0);return u.useEffect(()=>{let e=p.current;if(e)return e.addEventListener(qb,w),()=>e.removeEventListener(qb,w)},[w]),(0,m.jsx)(Jb,{scope:r,orientation:n,dir:g,loop:a,currentTabStopId:x,onItemFocus:u.useCallback(e=>v(e),[v]),onItemShiftTab:u.useCallback(()=>b(!0),[]),onFocusableItemAdd:u.useCallback(()=>j(e=>e+1),[]),onFocusableItemRemove:u.useCallback(()=>j(e=>e-1),[]),children:(0,m.jsx)(Bl.div,{tabIndex:y||0===C?-1:0,"data-orientation":n,...h,ref:f,style:{outline:"none",...e.style},onMouseDown:Ys(e.onMouseDown,()=>{k.current=!0}),onFocus:Ys(e.onFocus,e=>{let t=!k.current;if(e.target===e.currentTarget&&t&&!y){let t=new CustomEvent(qb,Ub);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=S().filter(e=>e.focusable);iw([e.find(e=>e.active),e.find(e=>e.id===x),...e].filter(Boolean).map(e=>e.ref.current),d)}}k.current=!1}),onBlur:Ys(e.onBlur,()=>b(!1))})})},"RovingFocusGroupImpl")),rw=u.forwardRef($b(function(e,t){let{__scopeRovingFocusGroup:r,focusable:n=!0,active:a=!1,tabStopId:o,children:i,...s}=e,l=ul(),c=o||l,d=Qb("RovingFocusGroupItem",r),h=d.currentTabStopId===c,p=Kb(r),{onFocusableItemAdd:f,onFocusableItemRemove:g,currentTabStopId:x}=d,v=Hb();return sl(()=>{if(v&&n)return f(),()=>g()},[v,n,f,g]),u.useEffect(()=>{if(!v&&n)return f(),()=>g()},[v,n,f,g]),(0,m.jsx)(Wb.ItemSlot,{scope:r,id:c,focusable:n,active:a,children:(0,m.jsx)(Bl.span,{tabIndex:h?0:-1,"data-orientation":d.orientation,...s,ref:t,onMouseDown:Ys(e.onMouseDown,e=>{n?d.onItemFocus(c):e.preventDefault()}),onFocus:Ys(e.onFocus,()=>d.onItemFocus(c)),onKeyDown:Ys(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void d.onItemShiftTab();if(e.target!==e.currentTarget)return;let t=ow(e,d.orientation,d.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let r=p().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?sw(r,n+1):r.slice(n+1)}setTimeout(()=>iw(r))}}),children:"function"==typeof i?i({isCurrentTabStop:h,hasTabStop:null!=x}):i})})},"RovingFocusGroupItem")),nw={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function aw(e,t){return"rtl"===t?"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e:e}function ow(e,t,r){let n=aw(e.key,r);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(n)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(n)))return nw[n]}function iw(e,t=!1){let r=document.activeElement;for(let n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function sw(e,t){return e.map((r,n)=>e[(t+n)%e.length])}$b(aw,"getDirectionAwareKey"),$b(ow,"getFocusIntent"),$b(iw,"focusFirst"),$b(sw,"wrapArray");var lw=ew,cw=rw,dw=Object.defineProperty,uw=(e,t)=>dw(e,"name",{value:t,configurable:!0}),hw=["Enter"," "],pw=["ArrowUp","PageDown","End"],mw=["ArrowDown","PageUp","Home",...pw],fw={ltr:[...hw,"ArrowRight"],rtl:[...hw,"ArrowLeft"]},gw={ltr:["ArrowLeft"],rtl:["ArrowRight"]},xw="Menu",[vw,yw,bw]=wb(xw),[ww,Sw]=ol(xw,[bw,By,Zb]),kw=By(),Cw=Zb(),[jw,Tw]=ww(xw),[Nw,Mw]=ww(xw),Ew=uw(e=>{let{__scopeMenu:t,open:r=!1,children:n,dir:a,onOpenChange:o,modal:i=!0}=e,s=kw(t),[l,c]=u.useState(null),d=u.useRef(!1),h=$l(o),p=Ib(a);return u.useEffect(()=>{let e=uw(()=>{d.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},"handleKeyDown"),t=uw(()=>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})}},[]),u.useEffect(()=>{if(!r)return;let e=uw(()=>h(!1),"handleBlur");return window.addEventListener("blur",e),()=>window.removeEventListener("blur",e)},[r,h]),(0,m.jsx)(Jy,{...s,children:(0,m.jsx)(jw,{scope:t,open:r,onOpenChange:h,content:l,onContentChange:c,children:(0,m.jsx)(Nw,{scope:t,onClose:u.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:d,dir:p,modal:i,children:n})})})},"Menu"),Aw=u.forwardRef(uw(function(e,t){let{__scopeMenu:r,...n}=e,a=kw(r);return(0,m.jsx)(Qy,{...a,...n,ref:t})},"MenuAnchor")),Rw="MenuPortal",[Dw,Iw]=ww(Rw,{forceMount:void 0}),zw=uw(e=>{let{__scopeMenu:t,forceMount:r,children:n,container:a}=e,o=Tw(Rw,t);return(0,m.jsx)(Dw,{scope:t,forceMount:r,children:(0,m.jsx)(Cc,{present:r||o.open,children:(0,m.jsx)(bc,{asChild:!0,container:a,children:n})})})},"MenuPortal"),_w="MenuContent",[Pw,Ow]=ww(_w),Lw=u.forwardRef(uw(function(e,t){let r=Iw(_w,e.__scopeMenu),{forceMount:n=r.forceMount,...a}=e,o=Tw(_w,e.__scopeMenu),i=Mw(_w,e.__scopeMenu);return(0,m.jsx)(vw.Provider,{scope:e.__scopeMenu,children:(0,m.jsx)(Cc,{present:n||o.open,children:(0,m.jsx)(vw.Slot,{scope:e.__scopeMenu,children:i.modal?(0,m.jsx)(Fw,{...a,ref:t}):(0,m.jsx)(Bw,{...a,ref:t})})})})},"MenuContent")),Fw=u.forwardRef(uw(function(e,t){let r=Tw(_w,e.__scopeMenu),n=u.useRef(null),a=rl(t,n);return u.useEffect(()=>{let e=n.current;if(e)return Md(e)},[]),(0,m.jsx)(Vw,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Ys(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentModal")),Bw=u.forwardRef(uw(function(e,t){let r=Tw(_w,e.__scopeMenu);return(0,m.jsx)(Vw,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentNonModal")),Hw=jl("MenuContent.ScrollLock"),Vw=u.forwardRef(uw(function(e,t){let{__scopeMenu:r,loop:n=!1,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:p,onDismiss:f,disableOutsideScroll:g,...x}=e,v=Tw(_w,r),y=Mw(_w,r),b=kw(r),w=Cw(r),S=yw(r),[k,C]=u.useState(null),j=u.useRef(null),T=rl(t,j,v.onContentChange),N=u.useRef(0),M=u.useRef(""),E=u.useRef(0),A=u.useRef(null),R=u.useRef("right"),D=u.useRef(0),I=g?wd:u.Fragment,z=g?{as:Hw,allowPinchZoom:!0}:void 0,_=uw(e=>{let t=M.current+e,r=S().filter(e=>!e.disabled),n=document.activeElement,a=r.find(e=>e.ref.current===n)?.textValue,o=fS(r.map(e=>e.textValue),t,a),i=r.find(e=>e.textValue===o)?.ref.current;uw(function e(t){M.current=t,window.clearTimeout(N.current),""!==t&&(N.current=window.setTimeout(()=>e(""),1e3))},"updateSearch")(t),i&&setTimeout(()=>i.focus())},"handleTypeaheadSearch");u.useEffect(()=>()=>window.clearTimeout(N.current),[]),zc();let P=u.useCallback(e=>R.current===A.current?.side&&xS(e,A.current?.area),[]);return(0,m.jsx)(Pw,{scope:r,searchRef:M,onItemEnter:u.useCallback(e=>{P(e)&&e.preventDefault()},[P]),onItemLeave:u.useCallback(e=>{P(e)||(j.current?.focus(),C(null))},[P]),onTriggerLeave:u.useCallback(e=>{P(e)&&e.preventDefault()},[P]),pointerGraceTimerRef:E,onPointerGraceIntentChange:u.useCallback(e=>{A.current=e},[]),children:(0,m.jsx)(I,{...z,children:(0,m.jsx)(sc,{asChild:!0,trapped:a,onMountAutoFocus:Ys(o,e=>{e.preventDefault(),j.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:(0,m.jsx)(Yl,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:p,onDismiss:f,children:(0,m.jsx)(lw,{asChild:!0,...w,dir:y.dir,orientation:"vertical",loop:n,currentTabStopId:k,onCurrentTabStopIdChange:C,onEntryFocus:Ys(l,e=>{y.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,m.jsx)(eb,{role:"menu","aria-orientation":"vertical","data-state":dS(v.open),"data-radix-menu-content":"",dir:y.dir,...b,...x,ref:T,style:{outline:"none",...x.style},onKeyDown:Ys(x.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&&_(e.key));let a=j.current;if(e.target!==a||!mw.includes(e.key))return;e.preventDefault();let o=S().filter(e=>!e.disabled).map(e=>e.ref.current);pw.includes(e.key)&&o.reverse(),pS(o)}),onBlur:Ys(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(N.current),M.current="")}),onPointerMove:Ys(e.onPointerMove,vS(e=>{let t=e.target,r=D.current!==e.clientX;if(e.currentTarget.contains(t)&&r){let t=e.clientX>D.current?"right":"left";R.current=t,D.current=e.clientX}}))})})})})})})},"MenuContentImpl")),$w=u.forwardRef(uw(function(e,t){let{__scopeMenu:r,...n}=e;return(0,m.jsx)(Bl.div,{...n,ref:t})},"MenuLabel")),qw="MenuItem",Uw="menu.itemSelect",Gw=u.forwardRef(uw(function(e,t){let{disabled:r=!1,onSelect:n,...a}=e,o=u.useRef(null),i=Mw(qw,e.__scopeMenu),s=Ow(qw,e.__scopeMenu),l=rl(t,o),c=u.useRef(!1),d=uw(()=>{let e=o.current;if(!r&&e){let t=new CustomEvent(Uw,{bubbles:!0,cancelable:!0});e.addEventListener(Uw,e=>n?.(e),{once:!0}),Hl(e,t),t.defaultPrevented?c.current=!1:i.onClose()}},"handleSelect");return(0,m.jsx)(Ww,{...a,ref:l,disabled:r,onClick:Ys(e.onClick,d),onPointerDown:t=>{e.onPointerDown?.(t),c.current=!0},onPointerUp:Ys(e.onPointerUp,e=>{c.current||e.currentTarget?.click()}),onKeyDown:Ys(e.onKeyDown,e=>{r||e.target!==e.currentTarget||(""===s.searchRef.current||" "!==e.key)&&hw.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},"MenuItem")),Ww=u.forwardRef(uw(function(e,t){let{__scopeMenu:r,disabled:n=!1,textValue:a,...o}=e,i=Ow(qw,r),s=Cw(r),l=u.useRef(null),c=rl(t,l),[d,h]=u.useState(!1),[p,f]=u.useState("");return u.useEffect(()=>{let e=l.current;e&&f((e.textContent??"").trim())},[o.children]),(0,m.jsx)(vw.ItemSlot,{scope:r,disabled:n,textValue:a??p,children:(0,m.jsx)(cw,{asChild:!0,...s,focusable:!n,children:(0,m.jsx)(Bl.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...o,ref:c,onPointerMove:Ys(e.onPointerMove,vS(e=>{n?i.onItemLeave(e):(i.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ys(e.onPointerLeave,vS(e=>i.onItemLeave(e))),onFocus:Ys(e.onFocus,()=>h(!0)),onBlur:Ys(e.onBlur,()=>h(!1))})})})},"MenuItemImpl")),Kw=u.forwardRef(uw(function(e,t){let{checked:r=!1,onCheckedChange:n,...a}=e;return(0,m.jsx)(Qw,{scope:e.__scopeMenu,checked:r,children:(0,m.jsx)(Gw,{role:"menuitemcheckbox","aria-checked":uS(r)?"mixed":r,...a,ref:t,"data-state":hS(r),onSelect:Ys(a.onSelect,()=>n?.(!!uS(r)||!r),{checkForDefaultPrevented:!1})})})},"MenuCheckboxItem")),[Yw,Xw]=ww("MenuRadioGroup",{value:void 0,onValueChange:uw(()=>{},"onValueChange")}),Zw=u.forwardRef(uw(function(e,t){let{value:r,...n}=e,a=Xw("MenuRadioItem",e.__scopeMenu),o=r===a.value;return(0,m.jsx)(Qw,{scope:e.__scopeMenu,checked:o,children:(0,m.jsx)(Gw,{role:"menuitemradio","aria-checked":o,...n,ref:t,"data-state":hS(o),onSelect:Ys(n.onSelect,()=>a.onValueChange?.(r),{checkForDefaultPrevented:!1})})})},"MenuRadioItem")),Jw="MenuItemIndicator",[Qw,eS]=ww(Jw,{checked:!1}),tS=u.forwardRef(uw(function(e,t){let{__scopeMenu:r,forceMount:n,...a}=e,o=eS(Jw,r);return(0,m.jsx)(Cc,{present:n||uS(o.checked)||!0===o.checked,children:(0,m.jsx)(Bl.span,{...a,ref:t,"data-state":hS(o.checked)})})},"MenuItemIndicator")),rS=u.forwardRef(uw(function(e,t){let{__scopeMenu:r,...n}=e;return(0,m.jsx)(Bl.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})},"MenuSeparator")),nS="MenuSub",[aS,oS]=ww(nS),iS=uw(e=>{let{__scopeMenu:t,children:r,open:n=!1,onOpenChange:a}=e,o=Tw(nS,t),i=kw(t),[s,l]=u.useState(null),[c,d]=u.useState(null),h=$l(a);return u.useEffect(()=>(!1===o.open&&h(!1),()=>h(!1)),[o.open,h]),(0,m.jsx)(Jy,{...i,children:(0,m.jsx)(jw,{scope:t,open:n,onOpenChange:h,content:c,onContentChange:d,children:(0,m.jsx)(aS,{scope:t,contentId:ul(),triggerId:ul(),trigger:s,onTriggerChange:l,children:r})})})},"MenuSub"),sS="MenuSubTrigger",lS=u.forwardRef(uw(function(e,t){let r=Tw(sS,e.__scopeMenu),n=Mw(sS,e.__scopeMenu),a=oS(sS,e.__scopeMenu),o=Ow(sS,e.__scopeMenu),i=u.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:l}=o,c={__scopeMenu:e.__scopeMenu},d=u.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);u.useEffect(()=>d,[d]),u.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),l(null)}},[s,l]);let h=rl(t,a.onTriggerChange);return(0,m.jsx)(Aw,{asChild:!0,...c,children:(0,m.jsx)(Ww,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?a.contentId:void 0,"data-state":dS(r.open),...e,ref:h,onClick:t=>{e.onClick?.(t),!e.disabled&&!t.defaultPrevented&&(t.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:Ys(e.onPointerMove,vS(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:Ys(e.onPointerLeave,vS(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:Ys(e.onKeyDown,t=>{e.disabled||t.target!==t.currentTarget||(""===o.searchRef.current||" "!==t.key)&&fw[n.dir].includes(t.key)&&(r.onOpenChange(!0),r.content?.focus(),t.preventDefault())})})})},"MenuSubTrigger")),cS=u.forwardRef(uw(function(e,t){let r=Iw(_w,e.__scopeMenu),{forceMount:n=r.forceMount,align:a="start",...o}=e,i=Tw(_w,e.__scopeMenu),s=Mw(_w,e.__scopeMenu),l=oS("MenuSubContent",e.__scopeMenu),c=u.useRef(null),d=rl(t,c);return(0,m.jsx)(vw.Provider,{scope:e.__scopeMenu,children:(0,m.jsx)(Cc,{present:n||i.open,children:(0,m.jsx)(vw.Slot,{scope:e.__scopeMenu,children:(0,m.jsx)(Vw,{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:Ys(e.onFocusOutside,e=>{e.target!==l.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Ys(e.onEscapeKeyDown,e=>{s.onClose(),e.preventDefault()}),onKeyDown:Ys(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),r=gw[s.dir].includes(e.key);t&&r&&(i.onOpenChange(!1),l.trigger?.focus(),e.preventDefault())})})})})})},"MenuSubContent"));function dS(e){return e?"open":"closed"}function uS(e){return"indeterminate"===e}function hS(e){return uS(e)?"indeterminate":e?"checked":"unchecked"}function pS(e){let t=document.activeElement;for(let r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function mS(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function fS(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=mS(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 gS(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 xS(e,t){return!!t&&gS({x:e.clientX,y:e.clientY},t)}function vS(e){return t=>"mouse"===t.pointerType?e(t):void 0}uw(dS,"getOpenState"),uw(uS,"isIndeterminate"),uw(hS,"getCheckedState"),uw(pS,"focusFirst"),uw(mS,"wrapArray"),uw(fS,"getNextMatch"),uw(gS,"isPointInPolygon"),uw(xS,"isPointerInGraceArea"),uw(vS,"whenMouse");var yS=Ew,bS=Aw,wS=zw,SS=Lw,kS=$w,CS=Gw,jS=Kw,TS=Zw,NS=tS,MS=rS,ES=iS,AS=lS,RS=cS,DS=(Object.defineProperty,"DropdownMenu"),[IS,zS]=ol(DS,[Sw]),[_S,PS]=(Sw(),IS(DS)),OS=Bs(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,x=t?Symbol.for("react.fundamental"):60117,v=t?Symbol.for("react.responder"):60118,y=t?Symbol.for("react.scope"):60119;function b(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 b(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)||b(e)===c},e.isConcurrentMode=w,e.isContextConsumer=function(e){return b(e)===l},e.isContextProvider=function(e){return b(e)===s},e.isElement=function(e){return"object"==typeof e&&!!e&&e.$$typeof===r},e.isForwardRef=function(e){return b(e)===u},e.isFragment=function(e){return b(e)===a},e.isLazy=function(e){return b(e)===f},e.isMemo=function(e){return b(e)===m},e.isPortal=function(e){return b(e)===n},e.isProfiler=function(e){return b(e)===i},e.isStrictMode=function(e){return b(e)===o},e.isSuspense=function(e){return b(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===x||e.$$typeof===v||e.$$typeof===y||e.$$typeof===g)},e.typeOf=b}),LS=Bs(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,x=t?Symbol.for("react.fundamental"):60117,v=t?Symbol.for("react.responder"):60118,y=t?Symbol.for("react.scope"):60119;function b(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,j=r,T=u,N=a,M=f,E=m,A=n,R=i,D=o,I=h,z=!1;function _(e){return b(e)===d}e.AsyncMode=w,e.ConcurrentMode=S,e.ContextConsumer=k,e.ContextProvider=C,e.Element=j,e.ForwardRef=T,e.Fragment=N,e.Lazy=M,e.Memo=E,e.Portal=A,e.Profiler=R,e.StrictMode=D,e.Suspense=I,e.isAsyncMode=function(e){return z||(z=!0),_(e)||b(e)===c},e.isConcurrentMode=_,e.isContextConsumer=function(e){return b(e)===l},e.isContextProvider=function(e){return b(e)===s},e.isElement=function(e){return"object"==typeof e&&!!e&&e.$$typeof===r},e.isForwardRef=function(e){return b(e)===u},e.isFragment=function(e){return b(e)===a},e.isLazy=function(e){return b(e)===f},e.isMemo=function(e){return b(e)===m},e.isPortal=function(e){return b(e)===n},e.isProfiler=function(e){return b(e)===i},e.isStrictMode=function(e){return b(e)===o},e.isSuspense=function(e){return b(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===x||e.$$typeof===v||e.$$typeof===y||e.$$typeof===g)},e.typeOf=b}()}),FS=Bs((e,t)=>{t.exports="production"===process.env.NODE_ENV?OS():LS()}),BS=Bs((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=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}}),HS=Bs((e,t)=>{t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}),VS=Bs((e,t)=>{t.exports=Function.call.bind(Object.prototype.hasOwnProperty)}),$S=Bs((e,t)=>{var r=function(){};if("production"!==process.env.NODE_ENV){var n=HS(),a={},o=VS();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}),qS=Bs((e,t)=>{var r=FS(),n=BS(),a=HS(),o=VS(),i=$S(),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 `"+v(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 `"+v(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 `"+v(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 x(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=v(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"===y(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 "+b(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=v(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,y(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=v(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,y(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=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 v(s)!==e?new p("Invalid "+a+" `"+o+"` of type `"+y(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 x(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(x);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(!x(n.value))return!1}else for(;!(n=a.next()).done;){var o=n.value;if(o&&!x(o[1]))return!1}return!0;default:return!1}}function v(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 y(e){if(null==e)return""+e;var t=v(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function b(e){var t=y(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}}),US=Bs((e,t)=>{var r=HS();function n(){}function a(){}a.resetWarningCache=n,t.exports=function(){function e(e,t,n,a,o,i){if(i!==r){var s=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}}),GS=Hs(Bs((e,t)=>{if("production"!==process.env.NODE_ENV){var r=FS();t.exports=qS()(r.isElement,!0)}else t.exports=US()()})()),WS={grad:.9,turn:360,rad:360/(2*Math.PI)},KS=function(e){return"string"==typeof e?e.length>0:"number"==typeof e},YS=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=10**t),Math.round(r*e)/r+0},XS=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=1),e>r?r:e>t?e:t},ZS=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},JS=function(e){return{r:XS(e.r,0,255),g:XS(e.g,0,255),b:XS(e.b,0,255),a:XS(e.a)}},QS=function(e){return{r:YS(e.r),g:YS(e.g),b:YS(e.b),a:YS(e.a,3)}},ek=/^#([0-9a-f]{3,8})$/i,tk=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},rk=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}},nk=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}},ak=function(e){return{h:ZS(e.h),s:XS(e.s,0,100),l:XS(e.l,0,100),a:XS(e.a)}},ok=function(e){return{h:YS(e.h),s:YS(e.s),l:YS(e.l),a:YS(e.a,3)}},ik=function(e){return nk((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},sk=function(e){return{h:(t=rk(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},lk=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ck=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,dk=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,uk=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,hk={string:[[function(e){var t=ek.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?YS(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?YS(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=dk.exec(e)||uk.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:JS({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=lk.exec(e)||ck.exec(e);return n?ik(ak({h:(t=n[1],r=n[2],void 0===r&&(r="deg"),Number(t)*(WS[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 KS(t)&&KS(r)&&KS(n)?JS({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 KS(t)&&KS(r)&&KS(n)?ik(ak({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 KS(t)&&KS(r)&&KS(n)?nk(function(e){return{h:ZS(e.h),s:XS(e.s,0,100),v:XS(e.v,0,100),a:XS(e.a)}}({h:Number(t),s:Number(r),v:Number(n),a:Number(o)})):null},"hsv"]]},pk=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]},mk=function(e,t){var r=sk(e);return{h:r.h,s:XS(r.s+100*t,0,100),l:r.l,a:r.a}},fk=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},gk=function(e,t){var r=sk(e);return{h:r.h,s:r.s,l:XS(r.l+100*t,0,100),a:r.a}},xk=function(){function e(e){this.parsed=function(e){return"string"==typeof e?pk(e.trim(),hk.string):"object"==typeof e&&e?pk(e,hk.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 YS(fk(this.rgba),2)},e.prototype.isDark=function(){return fk(this.rgba)<.5},e.prototype.isLight=function(){return fk(this.rgba)>=.5},e.prototype.toHex=function(){return t=(e=QS(this.rgba)).r,r=e.g,n=e.b,o=(a=e.a)<1?tk(YS(255*a)):"","#"+tk(t)+tk(r)+tk(n)+o;var e,t,r,n,a,o},e.prototype.toRgb=function(){return QS(this.rgba)},e.prototype.toRgbString=function(){return t=(e=QS(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 ok(sk(this.rgba))},e.prototype.toHslString=function(){return t=(e=ok(sk(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=rk(this.rgba),{h:YS(e.h),s:YS(e.s),v:YS(e.v),a:YS(e.a,3)};var e},e.prototype.invert=function(){return vk({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),vk(mk(this.rgba,e))},e.prototype.desaturate=function(e){return void 0===e&&(e=.1),vk(mk(this.rgba,-e))},e.prototype.grayscale=function(){return vk(mk(this.rgba,-1))},e.prototype.lighten=function(e){return void 0===e&&(e=.1),vk(gk(this.rgba,e))},e.prototype.darken=function(e){return void 0===e&&(e=.1),vk(gk(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?vk({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):YS(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=sk(this.rgba);return"number"==typeof e?vk({h:e,s:t.s,l:t.l,a:t.a}):YS(t.h)},e.prototype.isEqual=function(e){return this.toHex()===vk(e).toHex()},e}(),vk=function(e){return e instanceof xk?e:new xk(e)},yk=[];var bk={"3d":u.default.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:u.default.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:u.default.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:u.default.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:u.default.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:u.default.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:u.default.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:u.default.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:u.default.createElement("path",{d:"M12 4H0v2h12V4zM0 10h18V8H0v2zM0 0v2h18V0H0z",transform:"translate(15 15)",fillRule:"evenodd"}),drive:u.default.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:u.default.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:u.default.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:u.default.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:u.default.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:u.default.createElement("path",{d:"M0 8h6V5H0v3zm0 5h6v-3H0v3zM0 3h6V0H0v3zm8 5h12V5H8v3zm0 5h12v-3H8v3zM8 0v3h12V0H8z",transform:"translate(14 14)",fillRule:"evenodd"}),vector:u.default.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:u.default.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){yk.indexOf(e)<0&&(e(xk,hk),yk.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 wk={color:GS.default.string,extension:GS.default.string,fold:GS.default.bool,foldColor:GS.default.string,glyphColor:GS.default.string,gradientColor:GS.default.string,gradientOpacity:GS.default.number,labelColor:GS.default.string,labelTextColor:GS.default.string,labelUppercase:GS.default.bool,radius:GS.default.number,type:GS.default.oneOf(["3d","acrobat","android","audio","binary","code","code2","compressed","document","drive","font","image","presentation","settings","spreadsheet","vector","video"])},Sk=40,kk=48,Ck={WIDTH:Sk,HEIGHT:kk,X_OFFSET:0},jk=12,Tk=u.default.useId||function(){var e=0;return function(){return e++}}(),Nk=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,h=void 0===d?.25:d,p=e.labelColor,m=e.labelTextColor,f=void 0===m?"white":m,g=e.labelUppercase,x=void 0!==g&&g,v=e.radius,y=void 0===v?4:v,b=e.type,w=Tk(),S=typeof jest>"u"?w:"";return u.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 "+Sk+" "+kk,width:"100%",style:{maxWidth:"100%"}},u.default.createElement("defs",null,u.default.createElement("clipPath",{id:"pageRadius"+S},u.default.createElement("rect",{x:Ck.X_OFFSET,y:"0",rx:y,ry:y,width:Ck.WIDTH,height:Ck.HEIGHT})),u.default.createElement("clipPath",{id:"foldCrop"+S},u.default.createElement("rect",{width:Ck.WIDTH,height:jk,transform:"rotate(-45 0 "+jk+")"})),u.default.createElement("linearGradient",{x1:"100%",y1:"0%",y2:"100%",id:"pageGradient"+S},u.default.createElement("stop",{stopColor:c,stopOpacity:h,offset:"0%"}),u.default.createElement("stop",{stopColor:c,stopOpacity:"0",offset:"66.67%"}))),u.default.createElement("g",{id:"file",clipPath:"url(#pageRadius"+S+")"},o?u.default.createElement(u.default.Fragment,null,u.default.createElement("path",{d:"M"+Ck.X_OFFSET+" 0 h "+(Ck.WIDTH-jk)+" L "+(Ck.WIDTH+Ck.X_OFFSET)+" "+jk+" v "+(Ck.HEIGHT-jk)+" H "+Ck.X_OFFSET+" Z",fill:r}),u.default.createElement("path",{d:"M"+Ck.X_OFFSET+" 0 h "+(Ck.WIDTH-jk)+" L "+(Ck.WIDTH+Ck.X_OFFSET)+" "+jk+" v "+(Ck.HEIGHT-jk)+" H "+Ck.X_OFFSET+" Z",fill:"url(#pageGradient"+S+")"})):u.default.createElement(u.default.Fragment,null,u.default.createElement("rect",{x:Ck.X_OFFSET,y:"0",width:Ck.WIDTH,height:Ck.HEIGHT,fill:r}),u.default.createElement("rect",{x:Ck.X_OFFSET,y:"0",width:Ck.WIDTH,height:Ck.HEIGHT,fill:"url(#pageGradient"+S+")"}))),o&&u.default.createElement("g",{transform:"translate(28 "+jk+") rotate(-90)"},u.default.createElement("rect",{width:Ck.WIDTH,height:Ck.HEIGHT,fill:i||vk(r).darken(.1).toHex(),rx:y,ry:y,clipPath:"url(#foldCrop"+S+")"})),n&&u.default.createElement(u.default.Fragment,null,u.default.createElement("g",{id:"label"+S},u.default.createElement("rect",{fill:p||vk(r).darken(.3).toHex(),x:Ck.X_OFFSET,y:Ck.HEIGHT-14,width:Ck.WIDTH,height:14,clipPath:"url(#pageRadius"+S+")"})),u.default.createElement("g",{id:"labelText"+S,transform:"translate("+Ck.X_OFFSET+" 34)"},u.default.createElement("text",{x:Ck.WIDTH/2,y:"10",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif",fontSize:"9",fill:f,textAnchor:"middle",style:{fontWeight:"bold",textAlign:"center",pointerEvents:"none",textTransform:x?"uppercase":"none",userSelect:"none"}},n))),b&&u.default.createElement("g",{transform:"translate(-4 "+(n?0:6)+")",fill:s||vk(r).darken(.15).toHex()},bk[b]))};Nk.propTypes=wk;var Mk={"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"}},Ek={sm:14,md:18,lg:24};function Ak({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:Ek[t],a=r?Mk[r]??{}:{};return(0,m.jsx)("span",{className:"shrink-0 inline-flex",style:{width:n,height:n},"aria-hidden":!0,children:(0,m.jsx)(Nk,{extension:r||void 0,...a})})}var Rk=[{type:"openTabs",label:"Open Tabs",icon:Gu},{type:"files",label:"Files",icon:zu},{type:"outline",label:"Outline",icon:fh},{type:"related",label:"Related",icon:Yu},{type:"ai",label:"AI",icon:dh}],Dk=Object.defineProperty,Ik=Object.defineProperties,zk=Object.getOwnPropertyDescriptors,_k=Object.getOwnPropertySymbols,Pk=Object.prototype.hasOwnProperty,Ok=Object.prototype.propertyIsEnumerable,Lk=(e,t,r)=>t in e?Dk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Fk=(e,t)=>{for(var r in t||={})Pk.call(t,r)&&Lk(e,r,t[r]);if(_k)for(var r of _k(t))Ok.call(t,r)&&Lk(e,r,t[r]);return e},Bk=(e,t)=>Ik(e,zk(t)),Hk=(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 Vk(e,t){return"function"==typeof e?e(t):e}function $k(e,t){return r=>{t.setState(t=>Bk(Fk({},t),{[e]:Vk(r,t[e])}))}}var qk=(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)}),Uk=e=>Error("Headless Tree: "+e),Gk={key:"tree",getInitialState:e=>Fk({expandedItems:[],focusedItem:null},e),getDefaultConfig:(e,t)=>Fk({setExpandedItems:$k("expandedItems",t),setFocusedItem:$k("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(()=>Hk(null,null,function*(){var t,r,n,a;let o=e.getFocusedItem();null==(r=(t=e.getConfig()).scrollToItem)||r.call(t,o),yield qk(()=>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)=>Bk(Fk({},e?.()),{role:"tree","aria-label":r??"",ref:t.registerElement}),isSearchOpen:()=>!1},itemInstance:{scrollTo:(e,t)=>Hk(null,[e,t],function*({tree:e,item:t},r){var n,a,o;null==(a=(n=e.getConfig()).scrollToItem)||a.call(n,t),yield qk(()=>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 Bk(Fk({},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()}}}},Wk=(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(Bk(Fk({},a),{prev:r}),...e)}}}]},Kk=(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)),Yk=e=>{let t=e.instanceBuilder??Wk,r=[Gk,...Kk(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 Uk(`${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)=>Fk(Fk({},e),t.stateHandlerNames),{}),d={current:{}},u=!1,h={},p=[],m={},f={},g={},x={},v=()=>{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},y=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?(v(),null==(e=l.setState)||e.call(l,s)):(t.waitingForMount??=[],t.waitingForMount.push(()=>{var e;v(),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=Fk(Fk({},s),n.state)),a&&(v(),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&&v(),p),registerElement:({},e)=>{n!==e&&(n&&!e?y(e=>e.onTreeUnmount?.call(e,o,n)):!n&&e&&y(t=>t.onTreeMount?.call(t,o,e)),n=e)},getElement:()=>n,getDataRef:()=>d,getHotkeyPresets:()=>x},itemInstance:{registerElement:({itemId:e,item:t},r)=>{if(m[e]===r)return;let n=m[e];n&&!r?y(e=>e.onItemUnmount?.call(e,t,n,o)):!n&&r&&y(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 b of a)Object.assign(x,b.hotkeys??{});return i(),o},Xk=(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))(Xk||{}),Zk={key:"selection",getInitialState:e=>Fk({selectedItems:[]},e),getDefaultConfig:(e,t)=>Fk({setSelectedItems:$k("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=[...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})=>Bk(Fk({},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()))}}}},Jk=e=>""!==e.code&&"Unidentified"!==e.code?e.code:e.key,Qk={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)$/},eC=new Set(["MetaLeft","MetaRight","Meta","ControlLeft","ControlRight","Control","AltLeft","AltRight","Alt","ShiftLeft","ShiftRight","Shift"]),tC=(e,t,r,n)=>Object.entries(Fk(Fk({},r),n)).find(([,r])=>((e,t,r)=>{let n=r.hotkey.toLowerCase().split("+"),a=n.every(t=>{if(t in Qk)return[...e].some(e=>Qk[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],rC=e=>{e.current.pressedKeys=new Set},nC=(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=Jk({code:r.code??"",key:r.key??""});(a=t.current).pressedKeys??(a.pressedKeys=new Set);let h=!t.current.pressedKeys.has(u);u&&t.current.pressedKeys.add(u);let p=tC(t.current.pressedKeys,e,e.getHotkeyPresets(),d);if(s&&u&&t.current.pressedKeys.delete(u),!p)return;let m=Fk(Fk({},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))},aC=(e,t)=>{var r;let n=Jk({code:t.code??"",key:t.key??""});n&&((r=e.current).pressedKeys??(r.pressedKeys=new Set),eC.has(n)&&(e.current.pressedKeys=new Set([...e.current.pressedKeys].filter(e=>eC.has(e)))),e.current.pressedKeys.delete(n))},oC={key:"hotkeys-core",onTreeMount:(e,t)=>{let r=e.getDataRef(),n=t=>{let n=t.target instanceof HTMLInputElement;nC(e,r,t,{isInputFocused:n,releaseAfterDispatch:n})},a=e=>{aC(r,e)},o=()=>{rC(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)}},iC=e=>{if(!e)throw Uk("sync dataLoader returned undefined");if("object"==typeof e&&"then"in e)throw Uk("sync dataLoader returned promise");return e},sC={key:"sync-data-loader",getInitialState:e=>Fk({loadingItemData:[],loadingItemChildrens:[]},e),getDefaultConfig:(e,t)=>Fk({setLoadingItemData:$k("loadingItemData",t),setLoadingItemChildrens:$k("loadingItemChildrens",t)},e),stateHandlerNames:{loadingItemData:"setLoadingItemData",loadingItemChildrens:"setLoadingItemChildrens"},treeInstance:{waitForItemDataLoaded:()=>Hk(null,null,function*(){}),waitForItemChildrenLoaded:()=>Hk(null,null,function*(){}),retrieveItemData:({tree:e},t)=>iC(e.getConfig().dataLoader.getItem(t)),retrieveChildrenIds:({tree:e},t)=>{let{dataLoader:r}=e.getConfig();return"getChildren"in r?iC(r.getChildren(t)):iC(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}},lC=e=>"childIndex"in e,cC=(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))},dC=e=>e.isExpanded()?1:e.getParent()&&e.getIndexInParent()===e.getItemMeta().setSize-1?2:0,uC=(e,t,r)=>t-(e.slice(0,t).reduce((e,t)=>t&&r?.some(e=>e.getId()===t.getId())?++e:e,0)??0),hC=(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=dC(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}},pC=(e,t)=>t===e.getItemMeta().level?e:pC(e.getParent(),t),mC=(e,t,r)=>{let n=e.getItemMeta(),a=pC(e,t-1),o=pC(e,t).getIndexInParent()+1;return{item:a,childIndex:o,insertionIndex:uC(a.getChildren(),o,r),dragLineIndex:n.index+1,dragLineLevel:t}},fC=(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&&cC(o,d,r),h=hC(e,t,r,cC(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 fC(e,l,r,n,!1);if(!l)return c;if(!u)return fC(e,l,r,n,!1);if(3===h.type)return mC(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:uC(l.getChildren(),m,i)}},gC=()=>!1,xC={key:"drag-and-drop",getDefaultConfig:(e,t)=>Fk({canDrop:(e,t)=>t.item.isFolder(),canDropForeignDragObject:gC,canDragForeignDragObjectOver:e.canDropForeignDragObject===gC?()=>!1:e=>"none"!==e.effectAllowed,setDndState:$k("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||!lC(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 Bk(Fk({},n),{onDragOver:e=>{e.preventDefault()},onDrop:e=>Hk(null,null,function*(){let r=t.getDataRef(),n={item:t.getRootItem()};if(!cC(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:Bk(Fk({},n?.style),{position:"relative"})})}},itemInstance:{getProps:({tree:e,item:t,prev:r})=>Bk(Fk(Fk({},r?.()),e.getConfig().seperateDragHandle?{}:t.getDragHandleProps()),{onDragEnter:e=>e.preventDefault(),onDragOver:r=>{var n;r.stopPropagation();let a=e.getDataRef(),o=hC(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=fC(r,t,e,!1);(e.getState().dnd?.draggedItems||r.dataTransfer&&(n=e.getConfig()).canDragForeignDragObjectOver?.call(n,r.dataTransfer,s))&&cC(null,s,e)?(e.applySubStateUpdate("dnd",e=>Bk(Fk({},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=>Bk(Fk({},e),{draggingOverItem:void 0,dragTarget:void 0})))},100)},onDrop:r=>Hk(null,null,function*(){r.stopPropagation();let n=e.getDataRef(),a=fC(r,t,e,!0),o=e.getState().dnd?.draggedItems,i=cC(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})=>Bk(Fk({},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=fC(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&&(!lC(r)&&r.item.getId()===t.getId())},isDragTargetAbove:({tree:e,item:t})=>{let r=e.getDragTarget();return!(!r||!lC(r)||r.item!==t.getParent())&&r.childIndex===t.getItemMeta().posInSet},isDragTargetBelow:({tree:e,item:t})=>{let r=e.getDragTarget();return!(!r||!lC(r)||r.item!==t.getParent())&&r.childIndex-1===t.getItemMeta().posInSet},isDraggingOver:({tree:e,item:t})=>(e.getState().dnd?.draggingOverItem)?.getId()===t.getId()}},vC=(e,t,r=(()=>e.getState().dnd?.dragTarget)())=>{if(!r)return;let n=((e,t,r)=>{let n=+!t,a=e.getState().dnd?.draggedItems;if(lC(r)){let o=r.item.getParent(),i=e.getItems()[r.dragLineIndex-1],s=i?dC(i):0,l=i?.getItemMeta().level??0,c=(i?.getItemBelow())?.getItemMeta().level??0;if(2===s){if(t&&r.dragLineLevel<l)return mC(i,r.dragLineLevel+1,a);if(!t&&r.dragLineLevel>c&&o)return mC(i,r.dragLineLevel-1,a)}let d=r.dragLineIndex-1+n,u=e.getItems()[d];return u?{item:u}:void 0}if(1===dC(r.item)&&!t)return{item:r.item,childIndex:0,insertionIndex:uC(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:uC(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?cC(a,n,e)?n:vC(e,t,n):void 0},yC=e=>{let t=e.getState().dnd;t?.dragTarget&&!lC(t.dragTarget)&&t.dragTarget.item.scrollTo({block:"nearest",inline:"nearest"})},bC=(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=vC(e,!1,{item:o});s&&(e.applySubStateUpdate("dnd",{draggedItems:t,dragTarget:s}),e.applySubStateUpdate("assistiveDndState",1),yC(e))},wC=(e,t)=>{let r=vC(e,t);r&&(e.applySubStateUpdate("dnd",{draggedItems:e.getState().dnd?.draggedItems,dragTarget:r}),e.applySubStateUpdate("assistiveDndState",2),lC(r)||r.item.setFocused(),yC(e))},SC={key:"keyboard-drag-and-drop",deps:["drag-and-drop"],getDefaultConfig:(e,t)=>Fk({setAssistiveDndState:$k("assistiveDndState",t)},e),stateHandlerNames:{assistiveDndState:"setAssistiveDndState"},treeInstance:{startKeyboardDrag:({tree:e},t)=>{bC(e,t,void 0)},startKeyboardDragOnForeignObject:({tree:e},t)=>{bC(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)=>{wC(t,!0)}},dragDown:{hotkey:"ArrowDown",preventDefault:!0,isEnabled:e=>!!e.getState().dnd,handler:(e,t)=>{wC(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)=>Hk(null,null,function*(){e.stopPropagation();let r=t.getDataRef(),n=t.getDragTarget(),a=r.current.kDndDataTransfer??null;if(!n||!cC(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)})}}},kC={key:"renaming",overwrites:["drag-and-drop"],getDefaultConfig:(e,t)=>Fk({setRenamingItem:$k("renamingItem",t),setRenamingValue:$k("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?Bk(Fk({},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()}}}},CC=Object.defineProperty,jC=Object.defineProperties,TC=Object.getOwnPropertyDescriptors,NC=Object.getOwnPropertySymbols,MC=Object.prototype.hasOwnProperty,EC=Object.prototype.propertyIsEnumerable,AC=(e,t,r)=>t in e?CC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,RC=(e,t)=>{for(var r in t||={})MC.call(t,r)&&AC(e,r,t[r]);if(NC)for(var r of NC(t))EC.call(t,r)&&AC(e,r,t[r]);return e},DC=(e,t)=>jC(e,TC(t)),IC={position:"absolute",margin:"-1px",width:"1px",height:"1px",overflow:"hidden",clip:"rect(0 0 0 0)"},zC=(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 Xk.Started:return n?`Dragging ${n}. Current position: ${a}. ${o}`:`Current position: ${a}. ${o}`;case Xk.Dragging:return n?`${n}, ${a}`:a;case Xk.Completed:return`Drag completed. Press ${r.startDrag?.hotkey} to move selected items`;case Xk.Aborted:return`Drag cancelled. Press ${r.startDrag?.hotkey} to move selected items`;case Xk.None:default:return`Press ${r.startDrag?.hotkey} to move selected items`}},_C=e=>{var t=e,{tree:r,getLabel:n=zC}=t,a=((e,t)=>{var r={};for(var n in e)MC.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&NC)for(var n of NC(e))t.indexOf(n)<0&&EC.call(e,n)&&(r[n]=e[n]);return r})(t,["tree","getLabel"]);let o=r.getState();return u.default.createElement("span",DC(RC({"aria-live":"assertive"},a),{style:RC(RC({},IC),a.style)}),n(o.dnd,o.assistiveDndState??Xk.None,r.getHotkeyPresets()))},PC=u.createContext({currentItem:void 0,indent:20,tree:void 0});function OC(){return u.useContext(PC)}function LC({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`};return(0,m.jsx)(PC.Provider,{value:{indent:e,tree:t},children:(0,m.jsx)("div",{className:$p("flex flex-col",r),"data-slot":"tree",style:s,...i})})}function FC({item:e,className:t,asChild:r,children:n,...a}){let{indent:o}=OC(),i="function"==typeof e.getProps?e.getProps():{},{style:s,...l}={...a,...i},c={...s,"--tree-padding":e.getItemMeta().level*o+"px"},d=r?Tl:"button";return(0,m.jsx)(PC.Provider,{value:{currentItem:e,indent:o},children:(0,m.jsx)(d,{"aria-expanded":e.isExpanded(),className:$p("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 BC({item:e,children:t,className:r,...n}){let{currentItem:a}=OC(),o=e||a;return o?(0,m.jsxs)("span",{className:$p("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()?(0,m.jsx)(pu,{className:"in-aria-[expanded=false]:-rotate-90 size-4 shrink-0 text-muted-foreground"}):(0,m.jsx)("span",{className:"size-4 shrink-0","aria-hidden":!0}),t||("function"==typeof o.getItemName?o.getItemName():null)]}):null}function HC({className:e,...t}){let{tree:r}=OC();if(!r||"function"!=typeof r.getDragLineStyle)return null;let n=r.getDragLineStyle();return(0,m.jsx)("div",{className:$p("-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 VC=Object.defineProperty,$C=(e,t)=>VC(e,"name",{value:t,configurable:!0}),[qC,UC]=ol("AlertDialog",[Id]),GC=Id(),WC=$C(e=>{let{__scopeAlertDialog:t,...r}=e,n=GC(t);return(0,m.jsx)(Pd,{...n,...r,modal:!0})},"AlertDialog");u.forwardRef($C(function(e,t){let{__scopeAlertDialog:r,...n}=e,a=GC(r);return(0,m.jsx)(Od,{...a,...n,ref:t})},"AlertDialogTrigger"));var KC=$C(e=>{let{__scopeAlertDialog:t,...r}=e,n=GC(t);return(0,m.jsx)(Hd,{...n,...r})},"AlertDialogPortal"),YC=u.forwardRef($C(function(e,t){let{__scopeAlertDialog:r,...n}=e,a=GC(r);return(0,m.jsx)($d,{...a,...n,ref:t})},"AlertDialogOverlay")),[XC,ZC]=qC("AlertDialogContent"),JC=u.forwardRef($C(function(e,t){let{__scopeAlertDialog:r,children:n,...a}=e,o=GC(r),i=rl(t,u.useRef(null)),s=u.useRef(null);return(0,m.jsx)(XC,{scope:r,cancelRef:s,children:(0,m.jsx)(Wd,{role:"alertdialog",...o,...a,ref:i,onOpenAutoFocus:Ys(a.onOpenAutoFocus,e=>{e.preventDefault(),s.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:n})})},"AlertDialogContent")),QC=u.forwardRef($C(function(e,t){let{__scopeAlertDialog:r,...n}=e,a=GC(r);return(0,m.jsx)(Zd,{...a,...n,ref:t})},"AlertDialogTitle")),ej=u.forwardRef($C(function(e,t){let{__scopeAlertDialog:r,...n}=e,a=GC(r);return(0,m.jsx)(Jd,{...a,...n,ref:t})},"AlertDialogDescription")),tj=u.forwardRef($C(function(e,t){let{__scopeAlertDialog:r,...n}=e,a=GC(r);return(0,m.jsx)(Qd,{...a,...n,ref:t})},"AlertDialogAction")),rj=u.forwardRef($C(function(e,t){let{__scopeAlertDialog:r,...n}=e,{cancelRef:a}=ZC("AlertDialogCancel",r),o=GC(r),i=rl(t,a);return(0,m.jsx)(Qd,{...o,...n,ref:i})},"AlertDialogCancel")),nj=WC,aj=KC,oj=YC,ij=JC,sj=tj,lj=rj,cj=QC,dj=ej;function uj({...e}){return(0,m.jsx)(nj,{"data-slot":"alert-dialog",...e})}function hj({...e}){return(0,m.jsx)(aj,{"data-slot":"alert-dialog-portal",...e})}function pj({className:e,...t}){return(0,m.jsx)(oj,{"data-slot":"alert-dialog-overlay",className:$p("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 mj({className:e,...t}){return(0,m.jsxs)(hj,{children:[(0,m.jsx)(pj,{}),(0,m.jsx)(ij,{"data-slot":"alert-dialog-content",className:$p("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 fj({className:e,...t}){return(0,m.jsx)("div",{"data-slot":"alert-dialog-header",className:$p("flex flex-col gap-2 text-center sm:text-left",e),...t})}function gj({className:e,...t}){return(0,m.jsx)("div",{"data-slot":"alert-dialog-footer",className:$p("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function xj({className:e,...t}){return(0,m.jsx)(cj,{"data-slot":"alert-dialog-title",className:$p("text-lg font-semibold",e),...t})}function vj({className:e,...t}){return(0,m.jsx)(dj,{"data-slot":"alert-dialog-description",className:$p("text-muted-foreground text-sm",e),...t})}function yj({className:e,...t}){return(0,m.jsx)(sj,{className:$p(Zx(),e),...t})}function bj({className:e,...t}){return(0,m.jsx)(lj,{className:$p(Zx({variant:"outline"}),e),...t})}var wj=Object.defineProperty,Sj=(e,t)=>wj(e,"name",{value:t,configurable:!0}),kj="ContextMenu",[Cj,jj]=ol(kj,[Sw]),Tj=Sw(),[Nj,Mj]=Cj(kj),Ej=Sj(e=>{let{__scopeContextMenu:t,children:r,onOpenChange:n,open:a,dir:o,modal:i=!0}=e,s=u.useRef(!1),[l,c]=yl({prop:a,defaultProp:!1,onChange:n,caller:kj}),d=Tj(t);return(0,m.jsx)(Nj,{scope:t,open:l,onOpenChange:c,modal:i,hasInteractedRef:s,children:(0,m.jsx)(yS,{...d,dir:o,open:l,onOpenChange:c,modal:i,children:r})})},"ContextMenu"),Aj=u.forwardRef(Sj(function(e,t){let{__scopeContextMenu:r,disabled:n=!1,...a}=e,o=Mj("ContextMenuTrigger",r),i=Tj(r),[s,l]=u.useState({x:0,y:0}),c=u.useMemo(()=>({current:{getBoundingClientRect:Sj(()=>DOMRect.fromRect({width:0,height:0,...s}),"getBoundingClientRect")}}),[s]),d=u.useRef(0),h=u.useCallback(()=>window.clearTimeout(d.current),[]),p=Sj(e=>{o.hasInteractedRef.current=!0,l({x:e.clientX,y:e.clientY}),o.onOpenChange(!0)},"handleOpen");return u.useEffect(()=>h,[h]),u.useEffect(()=>{n&&h()},[n,h]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(bS,{...i,virtualRef:c}),(0,m.jsx)(Bl.span,{"data-state":o.open?"open":"closed","data-disabled":n?"":void 0,...a,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:n?e.onContextMenu:Ys(e.onContextMenu,e=>{h(),p(e),e.preventDefault()}),onPointerDown:n?e.onPointerDown:Ys(e.onPointerDown,Vj(e=>{h(),o.open&&o.onOpenChange(!1),d.current=window.setTimeout(()=>p(e),700)})),onPointerMove:n?e.onPointerMove:Ys(e.onPointerMove,Vj(h)),onPointerCancel:n?e.onPointerCancel:Ys(e.onPointerCancel,Vj(h)),onPointerUp:n?e.onPointerUp:Ys(e.onPointerUp,Vj(h))})]})},"ContextMenuTrigger")),Rj=Sj(e=>{let{__scopeContextMenu:t,...r}=e,n=Tj(t);return(0,m.jsx)(wS,{...n,...r})},"ContextMenuPortal"),Dj=u.forwardRef(Sj(function(e,t){let{__scopeContextMenu:r,...n}=e,a=Mj("ContextMenuContent",r),o=Tj(r),i=u.useRef(!1);return(0,m.jsx)(SS,{...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")),Ij=u.forwardRef(Sj(function(e,t){let{__scopeContextMenu:r,...n}=e,a=Tj(r);return(0,m.jsx)(kS,{...a,...n,ref:t})},"ContextMenuLabel")),zj=u.forwardRef(Sj(function(e,t){let{__scopeContextMenu:r,...n}=e,a=Tj(r);return(0,m.jsx)(CS,{...a,...n,ref:t})},"ContextMenuItem")),_j=u.forwardRef(Sj(function(e,t){let{__scopeContextMenu:r,...n}=e,a=Tj(r);return(0,m.jsx)(jS,{...a,...n,ref:t})},"ContextMenuCheckboxItem")),Pj=u.forwardRef(Sj(function(e,t){let{__scopeContextMenu:r,...n}=e,a=Tj(r);return(0,m.jsx)(TS,{...a,...n,ref:t})},"ContextMenuRadioItem")),Oj=u.forwardRef(Sj(function(e,t){let{__scopeContextMenu:r,...n}=e,a=Tj(r);return(0,m.jsx)(NS,{...a,...n,ref:t})},"ContextMenuItemIndicator")),Lj=u.forwardRef(Sj(function(e,t){let{__scopeContextMenu:r,...n}=e,a=Tj(r);return(0,m.jsx)(MS,{...a,...n,ref:t})},"ContextMenuSeparator")),Fj=Sj(e=>{let{__scopeContextMenu:t,children:r,onOpenChange:n,open:a,defaultOpen:o}=e,i=Tj(t),[s,l]=yl({prop:a,defaultProp:o??!1,onChange:n,caller:"ContextMenuSub"});return(0,m.jsx)(ES,{...i,open:s,onOpenChange:l,children:r})},"ContextMenuSub"),Bj=u.forwardRef(Sj(function(e,t){let{__scopeContextMenu:r,...n}=e,a=Tj(r);return(0,m.jsx)(AS,{...a,...n,ref:t})},"ContextMenuSubTrigger")),Hj=u.forwardRef(Sj(function(e,t){let{__scopeContextMenu:r,...n}=e,a=Tj(r);return(0,m.jsx)(RS,{...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 Vj(e){return t=>"mouse"===t.pointerType?void 0:e(t)}Sj(Vj,"whenTouchOrPen");var $j=Rj,qj=Dj,Uj=Ij,Gj=zj,Wj=_j,Kj=Pj,Yj=Oj,Xj=Lj,Zj=Bj,Jj=Hj,Qj=Ej,eT=Aj,tT=Fj,rT=u.forwardRef(({className:e,inset:t,children:r,...n},a)=>(0,m.jsxs)(Zj,{ref:a,className:$p("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,(0,m.jsx)(fu,{className:"ml-auto h-4 w-4"})]}));rT.displayName=Zj.displayName;var nT=u.forwardRef(({className:e,...t},r)=>(0,m.jsx)(Jj,{ref:r,className:$p("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}));nT.displayName=Jj.displayName;var aT=u.forwardRef(({className:e,...t},r)=>(0,m.jsx)($j,{children:(0,m.jsx)(qj,{ref:r,className:$p("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})}));aT.displayName=qj.displayName;var oT=u.forwardRef(({className:e,inset:t,...r},n)=>(0,m.jsx)(Gj,{ref:n,className:$p("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}));oT.displayName=Gj.displayName;var iT=u.forwardRef(({className:e,children:t,checked:r,...n},a)=>(0,m.jsxs)(Wj,{ref:a,className:$p("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:[(0,m.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,m.jsx)(Yj,{children:(0,m.jsx)(uu,{className:"h-4 w-4"})})}),t]}));iT.displayName=Wj.displayName;var sT=u.forwardRef(({className:e,children:t,...r},n)=>(0,m.jsxs)(Kj,{ref:n,className:$p("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:[(0,m.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,m.jsx)(Yj,{children:(0,m.jsx)(bu,{className:"h-2 w-2 fill-current"})})}),t]}));sT.displayName=Kj.displayName;var lT=u.forwardRef(({className:e,inset:t,...r},n)=>(0,m.jsx)(Uj,{ref:n,className:$p("px-2 py-1.5 text-sm font-semibold text-foreground",t&&"pl-8",e),...r}));lT.displayName=Uj.displayName;var cT=u.forwardRef(({className:e,...t},r)=>(0,m.jsx)(Xj,{ref:r,className:$p("-mx-1 my-1 h-px bg-border",e),...t}));cT.displayName=Xj.displayName;var dT=({className:e,...t})=>(0,m.jsx)("span",{className:$p("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});dT.displayName="ContextMenuShortcut";var uT=({children:e,itemId:t,isFolder:r,hasCopiedItem:n,onAddChild:a,onAddChildFolder:o,onAddSibling:i,onAddSiblingFolder:s,onRename:l,onDuplicate:c,onCopy:d,onPaste:h,onDelete:p,onManageTags:f})=>{let g=(0,u.useRef)(null),x=(0,u.useRef)(null),v=()=>{g.current&&=(clearTimeout(g.current),null)};return(0,m.jsxs)(Qj,{children:[(0,m.jsx)(eT,{asChild:!0,children:(0,m.jsx)("div",{className:"contents",onTouchStart:e=>{let t=e.touches[0];x.current={x:t.clientX,y:t.clientY};let r=e.currentTarget,n=t.clientX,a=t.clientY;g.current=setTimeout(()=>{r.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,clientX:n,clientY:a}))},500)},onTouchEnd:v,onTouchCancel:v,onTouchMove:e=>{if(!x.current)return;let t=e.touches[0],r=Math.abs(t.clientX-x.current.x),n=Math.abs(t.clientY-x.current.y);(r>10||n>10)&&v()},children:e})}),(0,m.jsxs)(aT,{className:"w-56",onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:[(0,m.jsxs)(oT,{onClick:()=>r?a?.(t):i?.(t),disabled:r?!a:!i,children:[(0,m.jsx)(zu,{className:"mr-2 h-4 w-4"}),"Add Note"]}),(0,m.jsxs)(oT,{onClick:()=>r?o?.(t):s?.(t),disabled:r?!o:!s,children:[(0,m.jsx)(Fu,{className:"mr-2 h-4 w-4"}),"Add Folder"]}),(0,m.jsxs)(oT,{onClick:()=>l?.(t),disabled:!l,children:[(0,m.jsx)(ah,{className:"mr-2 h-4 w-4"}),"Rename",(0,m.jsx)(dT,{children:"F2"})]}),(0,m.jsxs)(oT,{onClick:()=>c?.(t),disabled:!c,children:[(0,m.jsx)(Mu,{className:"mr-2 h-4 w-4"}),"Duplicate",(0,m.jsx)(dT,{children:"⌘D"})]}),(0,m.jsx)(cT,{}),(0,m.jsxs)(oT,{onClick:()=>d?.(t),disabled:!d,children:[(0,m.jsx)(Cu,{className:"mr-2 h-4 w-4"}),"Copy",(0,m.jsx)(dT,{children:"⌘C"})]}),(0,m.jsxs)(oT,{onClick:()=>{h?.(r?t:null)},disabled:!n||!h,children:[(0,m.jsx)(Su,{className:"mr-2 h-4 w-4"}),"Paste",(0,m.jsx)(dT,{children:"⌘V"})]}),(0,m.jsxs)(oT,{onClick:()=>f?.(t),disabled:!f,children:[(0,m.jsx)(ph,{className:"mr-2 h-4 w-4"}),"Manage Tags"]}),(0,m.jsx)(cT,{}),(0,m.jsxs)(oT,{onClick:()=>p?.(t),disabled:!p,className:"text-destructive focus:text-destructive",children:[(0,m.jsx)(xh,{className:"mr-2 h-4 w-4"}),"Delete",(0,m.jsx)(dT,{children:"Del"})]})]})]})},hT="__root__";var pT=(0,u.forwardRef)(({activeId:e,documents:t,onMove:r,onRename:n,onSelect:a,onDelete:o,onDuplicate:i,onAddChild:s,onAddChildFolder:l,onAddSibling:c,onAddSiblingFolder:d,onCopy:h,onPaste:p,onNewFile:f,onNewFolder:g,onManageTags:x,onExpandStateChange:v,onExpandedFoldersChange:y},b)=>{let w=(0,u.useMemo)(()=>function(e){let t={[hT]:{children:[],documentId:hT,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:hT;t[e].children=[...t[e].children??[],r.id]}for(let r of Object.keys(t))r!==hT&&(t[r].children?.length??0)>0&&(t[r].isFolder=!0);return t}(t),[t]),S=(0,u.useMemo)(()=>t.filter(e=>w[e.id]?.isFolder&&e.isExpanded).map(e=>e.id),[t,w]),[k,C]=(0,u.useState)({expandedItems:S,selectedItems:e?[e]:[]}),[j,T]=(0,u.useState)(null),[N,M]=(0,u.useState)(null),E=(e=>{let[t]=(0,u.useState)(()=>({current:Yk(e)})),[r,n]=(0,u.useState)(()=>t.current.getState());return(0,u.useEffect)(()=>(t.current.setMounted(!0),t.current.rebuildTree(),()=>{t.current.setMounted(!1)}),[t]),t.current.setConfig(t=>DC(RC(RC({},t),e),{state:RC(RC({},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=w[e];return t?t.children??[]:[]},getItem:e=>w[e]||{children:[],documentId:e,isFolder:!1,name:"Deleted Item"}},features:[sC,Zk,oC,kC,xC,SC],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!==hT);if(0===n.length)return;let a=[...n].reverse();if("childIndex"in t){let e=t.item.getId()===hT?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"}}(w[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()===hT?null:t.item.getId())},rootItemId:hT,setState:C,state:k});(0,u.useEffect)(()=>{C(t=>({...t,selectedItems:e&&w[e]?[e]:[]}))},[e,w]);let A=S.join("\n");(0,u.useEffect)(()=>{C(e=>({...e,expandedItems:S}))},[A]);let R=(0,u.useMemo)(()=>$s(w,hT),[w]),D=(0,u.useMemo)(()=>Us(w,hT,k.expandedItems??[]),[w,k.expandedItems]),I=(0,u.useRef)(v);(0,u.useEffect)(()=>{I.current=v},[v]),(0,u.useEffect)(()=>{I.current?.({level:D,maxLevel:R})},[D,R]),(0,u.useEffect)(()=>()=>I.current?.({level:0,maxLevel:0}),[]);let z=k.expandedItems??[],_=(0,u.useRef)(y);(0,u.useEffect)(()=>{_.current=y},[y]);let P=z.join("\n");(0,u.useEffect)(()=>{_.current?.(z)},[P]),(0,u.useImperativeHandle)(b,()=>({collapseAll:()=>{C(e=>({...e,expandedItems:[]}))},edit:e=>{n&&E.getItemInstance(e).startRenaming()},expandAll:()=>{let e=qs(w,hT,R);C(t=>({...t,expandedItems:e}))},expandToLevel:e=>{let t=qs(w,hT,Math.min(e,R));C(e=>({...e,expandedItems:t}))},getExpandLevel:()=>D,getMaxExpandLevel:()=>R}));let O=N?w[N]?.name:"",L=(0,u.useRef)(null);L.current!==w&&(L.current=w,E.scheduleRebuildTree());let F=E.getItems();return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("div",{className:"flex h-full flex-col gap-2 overflow-auto",children:(0,m.jsxs)(LC,{indent:20,tree:E,children:[(0,m.jsx)(_C,{tree:E}),F.map(t=>{let r=t.getId();return r===hT?null:(0,m.jsx)(FC,{item:t,children:(0,m.jsx)(uT,{itemId:r,isFolder:t.isFolder(),hasCopiedItem:!!j,onAddChild:s,onAddChildFolder:l,onAddSibling:c,onAddSiblingFolder:d,onRename:n?()=>t.startRenaming():void 0,onDuplicate:i,onCopy:h?e=>{T(e),h(e)}:void 0,onPaste:p?()=>{j&&p(t.isFolder()?r:null)}:void 0,onDelete:o?()=>M(r):void 0,onManageTags:x,children:t.isRenaming()?(0,m.jsx)(BC,{className:"w-full text-left",onClick:e=>e.stopPropagation(),children:(0,m.jsx)("input",{...t.getRenameInputProps(),className:"flex-1 w-full rounded border bg-background px-1 text-sm outline-none focus:ring-2 focus:ring-ring"})}):(0,m.jsx)(BC,{className:$p("w-full text-left",e===r&&"bg-accent text-accent-foreground"),onClick:()=>a(r),onDoubleClick:()=>n&&t.startRenaming(),children:(0,m.jsxs)("span",{className:"flex items-center gap-2 w-full min-w-0",children:[t.isFolder()?t.isExpanded()?(0,m.jsx)(Pu,{className:"pointer-events-none size-4 shrink-0 text-muted-foreground"}):(0,m.jsx)(Fu,{className:"pointer-events-none size-4 shrink-0 text-muted-foreground"}):(0,m.jsx)(Ak,{filename:t.getItemName(),size:16}),(0,m.jsx)("span",{className:"flex-1 truncate",children:t.getItemName()})]})})})},r)}),(0,m.jsx)(HC,{})]})}),(0,m.jsx)(uj,{open:!!N,onOpenChange:e=>!e&&M(null),children:(0,m.jsxs)(mj,{children:[(0,m.jsxs)(fj,{children:[(0,m.jsx)(xj,{children:"Move to Trash?"}),(0,m.jsxs)(vj,{children:['Are you sure you want to move "',O,'" to trash? You can restore it later from the trash.']})]}),(0,m.jsxs)(gj,{children:[(0,m.jsx)(bj,{children:"Cancel"}),(0,m.jsx)(yj,{onClick:()=>{N&&o&&(o(N),M(null),C(e=>({...e,selectedItems:e.selectedItems?.filter(e=>e!==N)??[]})))},children:"Move to Trash"})]})]})})]})});pT.displayName="FileTree";var mT="outline-collapse-preferences";(0,u.forwardRef)(({headings:e=[],onNavigate:t,onReorder:r,searchQuery:n="",editorRef:a},o)=>{let[i,s]=(0,u.useState)(new Set),[l,c]=(0,u.useState)(null),d=function(e,t){let[r,n]=(0,u.useState)(null),a=(0,u.useRef)(null);return(0,u.useEffect)(()=>{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),h=(0,u.useRef)(null),p=(0,u.useRef)(new Map);(0,u.useEffect)(()=>{if(!d)return;let e=h.current,t=p.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 f=(0,u.useMemo)(()=>e.map(([e,t,r],n)=>({id:e,level:parseInt(r[1],10),text:t,line:n})),[e]),g=(0,u.useMemo)(()=>{let e=new Map;return f.forEach((t,r)=>e.set(t.id,r)),e},[f]);(0,u.useImperativeHandle)(o,()=>({expandAll:()=>{s(new Set)},collapseAll:()=>{let e=new Set;f.forEach(t=>{1===t.level&&e.add(t.id)}),s(e)}})),(0,u.useEffect)(()=>{try{let e=localStorage.getItem(mT);if(e){let t=JSON.parse(e);c(t.defaultCollapseLevel||null),t.defaultCollapseLevel&&b(t.defaultCollapseLevel)}}catch(e){}},[]);let x=e=>{try{localStorage.setItem(mT,JSON.stringify({defaultCollapseLevel:e})),c(e)}catch(e){}},v=(0,u.useMemo)(()=>{if(!n.trim())return f;let e=n.toLowerCase();return f.filter(t=>t.text.toLowerCase().includes(e))},[f,n]),y=e=>{s(t=>{let r=new Set(t);return r.has(e)?(r.delete(e),(e=>{let t=f.findIndex(t=>t.id===e);if(-1===t)return[];let r=f[t].level,n=[];for(let a=t+1;a<f.length&&!(f[a].level<=r);a++)n.push(f[a].id);return n})(e).forEach(e=>r.delete(e))):r.add(e),r})},b=e=>{let t=new Set;f.forEach(r=>{r.level===e&&t.add(r.id)}),s(t)};return 0===f.length?(0,m.jsx)("div",{className:"flex h-full items-center justify-center p-6 text-center",children:(0,m.jsxs)("div",{children:[(0,m.jsx)($u,{className:"mx-auto h-12 w-12 text-muted-foreground opacity-50 mb-3"}),(0,m.jsx)("p",{className:"text-sm text-muted-foreground",children:"No headings found in this document"}),(0,m.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Use the heading buttons in the toolbar"})]})}):(0,m.jsx)("div",{ref:h,className:"flex h-full flex-col overflow-auto",children:v.map(e=>{let r=g.get(e.id),n=f[r+1],a=n&&n.level>e.level,o=i.has(e.id),c=e.id===d;return(e=>{let t=f[e].level;for(let r=e-1;r>=0;r--)if(f[r].level<t){if(i.has(f[r].id))return!0;if(1===f[r].level)break}return!1})(r)?null:(0,m.jsxs)(Qj,{children:[(0,m.jsx)(eT,{children:(0,m.jsxs)("div",{ref:t=>{t?p.current.set(e.id,t):p.current.delete(e.id)},"data-active":c||void 0,className:$p("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:[(0,m.jsx)("button",{className:$p("h-4 w-4 p-0 shrink-0 flex items-center justify-center hover:bg-transparent",!a&&"invisible"),onClick:t=>{t.stopPropagation(),y(e.id)},children:(0,m.jsx)(fu,{className:$p("h-3 w-3 transition-transform text-muted-foreground",!o&&"rotate-90")})}),(0,m.jsx)($u,{className:$p("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")}),(0,m.jsx)("span",{className:$p("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})]})}),(0,m.jsxs)(aT,{children:[(0,m.jsxs)(tT,{children:[(0,m.jsx)(rT,{children:"Collapse to..."}),(0,m.jsxs)(nT,{children:[(0,m.jsx)(oT,{onClick:()=>b(1),children:"Heading 1"}),(0,m.jsx)(oT,{onClick:()=>b(2),children:"Heading 2"}),(0,m.jsx)(oT,{onClick:()=>b(3),children:"Heading 3"}),(0,m.jsx)(oT,{onClick:()=>b(4),children:"Heading 4"}),(0,m.jsx)(oT,{onClick:()=>s(new Set),children:"Expand All"})]})]}),(0,m.jsx)(cT,{}),(0,m.jsx)(iT,{checked:null!==l,onCheckedChange:e=>{if(e){let e=f.find(e=>i.has(e.id));e&&x(e.level)}else x(null)},children:"Keep this collapse level as default"})]})]},e.id)})})}),Xx("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 fT=[{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"}],gT="REASON-rewrite-modes",xT=()=>{try{let e=localStorage.getItem(gT);if(e)return JSON.parse(e)}catch(e){}return fT},vT=e=>{try{localStorage.setItem(gT,JSON.stringify(e))}catch(e){}};typeof window>"u"||window.localStorage;(0,u.forwardRef)(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(0,m.jsx)("div",{ref:t,className:u,style:d,"data-pane":"true",...c,children:a})});function yT({...e}){return(0,m.jsx)(g.Root,{"data-slot":"sheet",...e})}function bT({...e}){return(0,m.jsx)(g.Portal,{"data-slot":"sheet-portal",...e})}function wT({className:e,...t}){return(0,m.jsx)(g.Overlay,{"data-slot":"sheet-overlay",className:ts("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 ST({className:e,children:t,side:r="right",...n}){return(0,m.jsxs)(bT,{children:[(0,m.jsx)(wT,{}),(0,m.jsxs)(g.Content,{"data-slot":"sheet-content",className:ts("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,(0,m.jsxs)(g.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:[(0,m.jsx)(f.XIcon,{className:"size-4"}),(0,m.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function kT({className:e,...t}){return(0,m.jsx)("div",{"data-slot":"sheet-header",className:ts("flex flex-col gap-1.5 p-4",e),...t})}function CT({className:e,...t}){return(0,m.jsx)(g.Title,{"data-slot":"sheet-title",className:ts("text-foreground font-semibold",e),...t})}function jT({className:e,...t}){return(0,m.jsx)(g.Description,{"data-slot":"sheet-description",className:ts("text-muted-foreground text-sm",e),...t})}var TT="bg-white/10 dark:bg-black/20 backdrop-blur-md border-white/15 dark:border-white/10",NT={top:!1,right:!1,bottom:!1,left:!0,topRight:!1,bottomRight:!1,bottomLeft:!1,topLeft:!1},MT=Object.fromEntries(Rk.map(({type:e,label:t})=>[e,t]));function ET({SidebarContentComponent:e,panels:t,documents:r,activeId:n,activeDocument:a,onSelect:o,onAdd:i,onDelete:s,onDuplicate:l,onSetExpandedFolders:c,onMove:d,onManageTags:h,onRename:p,headings:g,onNavigate:x,openTabs:v,activeTab:y,onTabChange:b,onTabClose:w,onTabsClose:S,onTabRename:k,onSplitRight:C,onReopenLastClosed:j,canReopenLastClosed:T,outlineRef:M,editorRef:E,tabItems:A,onNewChat:R,aiProps:D,tipsProps:I,topicsProps:z,onClose:_,isMobile:P,isOpen:O,onOpenChange:L}){const[F,B]=(0,u.useState)(320),H=1===t.length?MT[t[0]]:"Right Panel",V=(0,m.jsxs)("div",{className:"h-full overflow-hidden flex flex-col",children:[(0,m.jsxs)("div",{className:"px-3 py-2 border-b border-sidebar-border/60 flex items-center justify-between select-none shrink-0",children:[(0,m.jsx)("h3",{className:"text-sm font-semibold text-sidebar-foreground",children:H}),(0,m.jsx)(is,{variant:"ghost",size:"sm",className:"h-7 px-2",onClick:_,children:(0,m.jsx)(f.X,{className:"h-4 w-4"})})]}),(0,m.jsx)("div",{className:"flex-1 min-h-0",children:(0,m.jsx)(e,{panels:t,persistenceKey:"right",activeDocuments:r,activeId:n,activeDocument:a,headings:g,onSelect:o,onAdd:i,onDelete:s,onDuplicate:l,onSetExpandedFolders:c,onMove:d,onManageTags:h,onRename:p,outlineRef:M,editorRef:E,openTabs:v,activeTab:y,onTabChange:b,onTabClose:w,onTabsClose:S,onTabRename:k,onSplitRight:C,onReopenLastClosed:j,canReopenLastClosed:T,onNavigate:x,tabItems:A,onNewChat:R,aiProps:D,tipsProps:I,topicsProps:z})})]});return P?(0,m.jsx)(yT,{open:O,onOpenChange:L,children:(0,m.jsx)(ST,{side:"right",className:ts("w-80 p-0",TT),children:(0,m.jsx)("aside",{className:"h-full flex flex-col",children:V})})}):(0,m.jsx)(N.Resizable,{size:{width:F,height:"100%"},onResizeStop:(e,t,r)=>B(r.offsetWidth),minWidth:260,maxWidth:640,enable:NT,className:ts("h-full flex flex-col border-l shrink-0",TT),children:V})}function AT({...e}){return(0,m.jsx)(g.Root,{"data-slot":"dialog",...e})}function RT({...e}){return(0,m.jsx)(g.Portal,{"data-slot":"dialog-portal",...e})}function DT({className:e,...t}){return(0,m.jsx)(g.Overlay,{"data-slot":"dialog-overlay",className:ts("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 IT({className:e,children:t,hideCloseButton:r=!1,...n}){return(0,m.jsxs)(RT,{"data-slot":"dialog-portal",children:[(0,m.jsx)(DT,{}),(0,m.jsxs)(g.Content,{"data-slot":"dialog-content","aria-describedby":n["aria-describedby"]??void 0,className:ts("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&&(0,m.jsxs)(g.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:[(0,m.jsx)(f.XIcon,{}),(0,m.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function zT({className:e,...t}){return(0,m.jsx)("div",{"data-slot":"dialog-header",className:ts("flex flex-col gap-2 text-center sm:text-left",e),...t})}function _T({className:e,...t}){return(0,m.jsx)("div",{"data-slot":"dialog-footer",className:ts("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function PT({className:e,...t}){return(0,m.jsx)(g.Title,{"data-slot":"dialog-title",className:ts("text-lg leading-none font-semibold",e),...t})}function OT({className:e,...t}){return(0,m.jsx)(g.Description,{"data-slot":"dialog-description",className:ts("text-muted-foreground text-sm",e),...t})}function LT({className:e,type:t,...r}){return(0,m.jsx)("input",{type:t,"data-slot":"input",className:ts("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 FT({className:e,children:t,...r}){return(0,m.jsxs)(bt,{"data-slot":"scroll-area",className:ts("relative",e),...r,children:[(0,m.jsx)(wt,{"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}),(0,m.jsx)(BT,{}),(0,m.jsx)(BT,{orientation:"horizontal"}),(0,m.jsx)(St,{})]})}function BT({className:e,orientation:t="vertical",...r}){return(0,m.jsx)(Ke,{"data-slot":"scroll-area-scrollbar",orientation:t,className:ts("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:(0,m.jsx)(ot,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}var HT=u.forwardRef(({className:e,...t},r)=>(0,m.jsx)("span",{ref:r,className:ts("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}));HT.displayName="VisuallyHidden";var VT={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'","&nbsp;":" "};function $T(e){return e.replace(/<[^>]*>/g," ").replace(/&(?:amp|lt|gt|quot|#39|nbsp);/g,e=>VT[e]??e).replace(/\s+/g," ").trim()}function qT(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 UT=({open:e,onOpenChange:t,documents:r,onSelectDocument:n,onOpenSettings:a,onOpenTeams:o,onToggleTheme:i,currentTheme:s="light"})=>{const[l,c]=(0,u.useState)(""),d=(0,u.useRef)(null),h=(0,u.useMemo)(()=>{const e=[];return a&&e.push({id:"settings",label:"Open Settings",icon:(0,m.jsx)(f.Settings,{className:"h-4 w-4"}),action:()=>{a(),t(!1)},keywords:["settings","preferences","config"]}),o&&e.push({id:"teams",label:"Manage Teams",icon:(0,m.jsx)(f.Users,{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:"dark"===s?(0,m.jsx)(f.Sun,{className:"h-4 w-4"}):(0,m.jsx)(f.Moon,{className:"h-4 w-4"}),action:()=>{i()},keywords:["theme","dark","light","mode","appearance"]}),e},[a,o,i,s,t]),p=(0,u.useMemo)(()=>function(e,t){const r=t.trim();if(!r)return[];const n=r.toLowerCase(),a=[];for(const o of e){const e=$T(o.content),t=e.toLowerCase(),i=qT(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]),g=(0,u.useMemo)(()=>{if(!l.trim())return h;const e=l.toLowerCase();return h.filter(t=>{const r=t.label.toLowerCase().includes(e),n=t.keywords?.some(t=>t.toLowerCase().includes(e));return r||n})},[l,h]);(0,u.useEffect)(()=>{e?setTimeout(()=>d.current?.focus(),100):c("")},[e]),(0,u.useEffect)(()=>{const r=r=>{e&&"Escape"===r.key&&t(!1)};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[e,t]);const x=g.length>0,v=p.length>0,y=""!==l.trim()&&!x&&!v;return(0,m.jsx)(AT,{open:e,onOpenChange:t,children:(0,m.jsxs)(IT,{className:"max-w-2xl w-[95vw] sm:w-full p-0 gap-0 max-h-[90vh] sm:max-h-[85vh]",children:[(0,m.jsx)(HT,{children:(0,m.jsx)(PT,{children:"Search notes and commands"})}),(0,m.jsx)(zT,{className:"px-4 py-4 border-b border-border",children:(0,m.jsxs)("div",{className:"relative",children:[(0,m.jsx)(f.Command,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),(0,m.jsx)(LT,{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&&(0,m.jsx)("button",{onClick:()=>c(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:(0,m.jsx)(f.X,{className:"h-4 w-4"})})]})}),(0,m.jsx)(FT,{className:"max-h-[50vh] sm:max-h-[60vh]",children:""===l.trim()?(0,m.jsxs)("div",{className:"py-2",children:[h.length>0&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("div",{className:"px-4 py-2",children:(0,m.jsx)("h3",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Quick Actions"})}),h.map(e=>(0,m.jsx)("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:(0,m.jsxs)("div",{className:"flex items-center gap-3",children:[(0,m.jsx)("div",{className:"flex-shrink-0 text-muted-foreground",children:e.icon}),(0,m.jsx)("span",{className:"text-sm font-medium",children:e.label})]})},e.id))]}),(0,m.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[(0,m.jsx)(f.Search,{className:"h-12 w-12 text-muted-foreground mb-4 opacity-50"}),(0,m.jsx)("p",{className:"text-sm text-muted-foreground",children:"Type to search across all your notes"})]})]}):y?(0,m.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[(0,m.jsx)(f.FileText,{className:"h-12 w-12 text-muted-foreground mb-4 opacity-50"}),(0,m.jsxs)("p",{className:"text-sm text-muted-foreground",children:['No results found for "',l,'"']})]}):(0,m.jsxs)("div",{className:"py-2",children:[x&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("div",{className:"px-4 py-2",children:(0,m.jsx)("h3",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Commands"})}),g.map(e=>(0,m.jsx)("button",{onClick:e.action,className:"w-full px-4 py-3 text-left hover:bg-muted/50 transition-colors border-b border-border",children:(0,m.jsxs)("div",{className:"flex items-center gap-3",children:[(0,m.jsx)("div",{className:"flex-shrink-0 text-muted-foreground",children:e.icon}),(0,m.jsx)("span",{className:"text-sm font-medium",children:e.label})]})},e.id))]}),v&&(0,m.jsxs)(m.Fragment,{children:[x&&(0,m.jsx)("div",{className:"px-4 py-2 mt-2",children:(0,m.jsx)("h3",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Notes"})}),p.map(e=>(0,m.jsx)("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:(0,m.jsxs)("div",{className:"flex items-start gap-3",children:[(0,m.jsx)(f.FileText,{className:"h-4 w-4 mt-1 flex-shrink-0 text-muted-foreground"}),(0,m.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,m.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,m.jsx)("h3",{className:"font-medium text-sm truncate",children:e.document.title||"Untitled"}),"content"===e.matchType&&e.matchCount>1&&(0,m.jsxs)("span",{className:"flex-shrink-0 text-xs text-muted-foreground tabular-nums",children:[e.matchCount," matches"]})]}),e.preview&&(0,m.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2",children:e.preview})]})]})},e.document.id))]})]})}),(0,m.jsxs)("div",{className:"px-4 py-3 border-t border-border bg-muted/30",children:[(0,m.jsxs)("p",{className:"text-xs text-muted-foreground text-center hidden sm:block",children:["Press ",(0,m.jsx)("kbd",{className:"px-1.5 py-0.5 rounded bg-background border border-border",children:"⌘K"})," or ",(0,m.jsx)("kbd",{className:"px-1.5 py-0.5 rounded bg-background border border-border",children:"Ctrl+K"})," to open • ",(0,m.jsx)("kbd",{className:"px-1.5 py-0.5 rounded bg-background border border-border",children:"ESC"})," to close"]}),(0,m.jsxs)("p",{className:"text-xs text-muted-foreground text-center sm:hidden",children:["Tap ",(0,m.jsx)("kbd",{className:"px-1.5 py-0.5 rounded bg-background border border-border",children:"ESC"})," to close"]})]})]})})};function GT({...e}){return(0,m.jsx)("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",...e})}function WT({className:e,...t}){return(0,m.jsx)("ol",{"data-slot":"breadcrumb-list",className:ts("text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",e),...t})}function KT({className:e,...t}){return(0,m.jsx)("li",{"data-slot":"breadcrumb-item",className:ts("inline-flex items-center gap-1.5",e),...t})}function YT({asChild:e,className:t,...r}){return(0,m.jsx)(e?h.Slot:"a",{"data-slot":"breadcrumb-link",className:ts("hover:text-foreground transition-colors",t),...r})}function XT({className:e,...t}){return(0,m.jsx)("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:ts("text-foreground font-normal",e),...t})}function ZT({children:e,className:t,...r}){return(0,m.jsx)("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:ts("[&>svg]:size-3.5",t),...r,children:e??(0,m.jsx)(f.ChevronRight,{})})}function JT(){const[e,t]=u.useState(void 0);return u.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 QT({className:e,orientation:t="horizontal",decorative:r=!0,...n}){return(0,m.jsx)(S.Root,{"data-slot":"separator",decorative:r,orientation:t,className:ts("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 eN({delayDuration:e=0,...t}){return(0,m.jsx)(k.Provider,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function tN({...e}){return(0,m.jsx)(eN,{children:(0,m.jsx)(k.Root,{"data-slot":"tooltip",...e})})}function rN({...e}){return(0,m.jsx)(k.Trigger,{"data-slot":"tooltip-trigger",...e})}function nN({className:e,sideOffset:t=0,children:r,...n}){return(0,m.jsx)(k.Portal,{children:(0,m.jsxs)(k.Content,{"data-slot":"tooltip-content","data-richtext-portal":!0,sideOffset:t,className:ts("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,(0,m.jsx)(k.Arrow,{className:"bg-popover fill-popover z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}var aN=u.createContext(null);function oN(){const e=u.useContext(aN);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function iN({defaultOpen:e=!0,open:t,onOpenChange:r,className:n,style:a,children:o,...i}){const s=JT(),[l,c]=u.useState(!1),[d,h]=u.useState(e),p=t??d,f=u.useCallback(e=>{const t="function"==typeof e?e(p):e;r?r(t):h(t),document.cookie=`sidebar_state=${t}; path=/; max-age=604800`},[r,p]),g=u.useCallback(()=>s?c(e=>!e):f(e=>!e),[s,f,c]);u.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(),g())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[g,null]);const x=p?"expanded":"collapsed",v=u.useMemo(()=>({state:x,open:p,setOpen:f,isMobile:s,openMobile:l,setOpenMobile:c,toggleSidebar:g}),[x,p,f,s,l,c,g]);return(0,m.jsx)(aN.Provider,{value:v,children:(0,m.jsx)(eN,{delayDuration:0,children:(0,m.jsx)("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":"420px","--sidebar-width-icon":"5.2875rem",...a},className:ts("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",n),...i,children:o})})})}function sN({side:e="left",variant:t="sidebar",collapsible:r="offcanvas",className:n,children:a,...o}){const{isMobile:i,state:s,openMobile:l,setOpenMobile:c}=oN();return"none"===r?(0,m.jsx)("div",{"data-slot":"sidebar",className:ts("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",n),...o,children:a}):i?(0,m.jsx)(yT,{open:l,onOpenChange:c,...o,children:(0,m.jsxs)(ST,{"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:[(0,m.jsxs)(kT,{className:"sr-only",children:[(0,m.jsx)(CT,{children:"Sidebar"}),(0,m.jsx)(jT,{children:"Displays the mobile sidebar."})]}),(0,m.jsx)("div",{className:"flex h-full w-full flex-col",children:a})]})}):(0,m.jsxs)("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:[(0,m.jsx)("div",{"data-slot":"sidebar-gap",className:ts("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)]")}),(0,m.jsx)("div",{"data-slot":"sidebar-container",className:ts("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:(0,m.jsx)("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 lN({className:e,...t}){return(0,m.jsx)("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:ts("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t})}function cN({className:e,...t}){return(0,m.jsx)("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:ts("relative flex w-full min-w-0 flex-col p-2",e),...t})}function dN({className:e,...t}){return(0,m.jsx)("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:ts("w-full text-sm",e),...t})}function uN({className:e,...t}){return(0,m.jsx)("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:ts("flex w-full min-w-0 flex-col gap-1",e),...t})}function hN({className:e,...t}){return(0,m.jsx)("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:ts("group/menu-item relative",e),...t})}var pN=t.cva("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 mN({asChild:e=!1,isActive:t=!1,variant:r="default",size:n="default",tooltip:a,className:o,...i}){const s=e?h.Slot:"button",{isMobile:l,state:c}=oN(),d=(0,m.jsx)(s,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":n,"data-active":t,className:ts(pN({variant:r,size:n}),o),...i});return a?("string"==typeof a&&(a={children:a}),(0,m.jsxs)(tN,{children:[(0,m.jsx)(rN,{asChild:!0,children:d}),(0,m.jsx)(nN,{side:"right",align:"center",hidden:"collapsed"!==c||l,...a})]})):d}var fN=(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){}},gN=u.createContext(void 0),xN={setTheme:e=>{},themes:[]},vN=()=>{var e;return null!=(e=u.useContext(gN))?e:xN};u.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 u.createElement("script",{...c,suppressHydrationWarning:!0,nonce:"undefined"==typeof window?l:"",dangerouslySetInnerHTML:{__html:`(${fN.toString()})(${d})`}})});function yN({className:e,...t}){return(0,m.jsx)(b.Root,{"data-slot":"label",className:ts("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 bN({className:e,...t}){return(0,m.jsx)(Me,{"data-slot":"radio-group",className:ts("grid gap-3",e),...t})}function wN({className:e,...t}){return(0,m.jsx)(Re,{"data-slot":"radio-group-item",className:ts("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:(0,m.jsx)(Ie,{"data-slot":"radio-group-indicator",className:"relative flex items-center justify-center",children:(0,m.jsx)(f.CircleIcon,{className:"fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2"})})})}function SN({...e}){return(0,m.jsx)(y.Root,{"data-slot":"dropdown-menu",...e})}function kN({...e}){return(0,m.jsx)(y.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function CN({className:e,sideOffset:t=4,...r}){return(0,m.jsx)(y.Portal,{children:(0,m.jsx)(y.Content,{collisionPadding:8,"data-richtext-menu":!0,"data-slot":"dropdown-menu-content",sideOffset:t,className:ts("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 jN({className:e,inset:t,variant:r="default",...n}){return(0,m.jsx)(y.Item,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":r,className:ts("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 TN({className:e,inset:t,...r}){return(0,m.jsx)(y.Label,{"data-slot":"dropdown-menu-label","data-inset":t,className:ts("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...r})}function NN({className:e,...t}){return(0,m.jsx)(y.Separator,{"data-slot":"dropdown-menu-separator",className:ts("bg-border -mx-1 my-1 h-px",e),...t})}var MN=["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"],EN={"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 AN(){const{theme:e,setTheme:t}=vN(),[r,n]=(0,u.useState)("modern-minimal"),[a,o]=(0,u.useState)(!1),[s,l]=(0,u.useState)(null);(0,u.useEffect)(()=>{o(!0);const e=localStorage.getItem("color-theme");e&&MN.includes(e)&&n(e)},[]);const c=()=>{s&&(MN.forEach(e=>document.documentElement.classList.remove(`theme-${e}`)),document.documentElement.classList.add(`theme-${r}`),l(null))};return a?(0,m.jsxs)(SN,{onOpenChange:e=>!e&&c(),children:[(0,m.jsx)(kN,{asChild:!0,children:(0,m.jsx)(is,{variant:"ghost",size:"icon",className:"relative",children:(0,m.jsx)(i.IconComponent,{name:"icon-themes",className:"h-5 w-5"})})}),(0,m.jsxs)(CN,{align:"end",className:"w-56 max-h-[400px] overflow-y-auto",children:[(0,m.jsxs)(TN,{className:"flex items-center justify-between",children:[(0,m.jsx)("span",{children:"Theme"}),(0,m.jsx)(is,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:r=>{r.stopPropagation(),t("dark"===e?"light":"dark")},children:"dark"===e?(0,m.jsx)(f.Moon,{className:"h-4 w-4"}):(0,m.jsx)(f.Sun,{className:"h-4 w-4"})})]}),(0,m.jsx)(NN,{}),MN.map(e=>{const t=EN[e];return(0,m.jsx)(jN,{onClick:()=>{return n(t=e),localStorage.setItem("color-theme",t),document.cookie=`color-theme=${t}; path=/; max-age=31536000`,MN.forEach(e=>document.documentElement.classList.remove(`theme-${e}`)),document.documentElement.classList.add(`theme-${t}`),void l(null);var t},onMouseEnter:()=>(e=>{l(e),MN.forEach(e=>document.documentElement.classList.remove(`theme-${e}`)),document.documentElement.classList.add(`theme-${e}`)})(e),onMouseLeave:c,className:"cursor-pointer "+(r===e?"bg-accent":""),children:(0,m.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[t&&(0,m.jsxs)("div",{className:"flex items-center gap-1",children:[(0,m.jsx)("div",{className:"w-3 h-3 rounded-full border border-border",style:{backgroundColor:t.primary}}),(0,m.jsx)("div",{className:"w-3 h-3 rounded-full border border-border",style:{backgroundColor:t.secondary}})]}),(0,m.jsx)("span",{children:(a=e,a.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "))})]}),r===e&&(0,m.jsx)("span",{className:"text-xs",children:"✓"})]})},e);var a})]})]}):null}var RN=[{value:"light",label:"Light",icon:(0,m.jsx)(f.Sun,{className:"h-4 w-4"}),description:"Clean and bright interface"},{value:"dark",label:"Dark",icon:(0,m.jsx)(f.Moon,{className:"h-4 w-4"}),description:"Easy on the eyes in low light"},{value:"system",label:"System",icon:(0,m.jsx)(f.Monitor,{className:"h-4 w-4"}),description:"Sync with your system preferences"}],DN=({defaultSidebarView:e,onDefaultSidebarViewChange:t})=>{const{theme:r,setTheme:n}=vN();return(0,m.jsxs)("div",{className:"space-y-6",children:[(0,m.jsxs)("div",{children:[(0,m.jsx)("h2",{className:"text-xl font-semibold mb-2",children:"Appearance"}),(0,m.jsx)("p",{className:"text-sm text-muted-foreground",children:"Choose how REASON looks to you"})]}),(0,m.jsx)(QT,{}),(0,m.jsxs)("div",{className:"space-y-4",children:[(0,m.jsx)(yN,{className:"text-base",children:"Theme"}),(0,m.jsx)(bN,{value:r,onValueChange:n,className:"space-y-3",children:RN.map(e=>(0,m.jsxs)("div",{className:"flex items-start space-x-3",children:[(0,m.jsx)(wN,{value:e.value,id:e.value,className:"mt-1"}),(0,m.jsxs)("label",{htmlFor:e.value,className:"flex-1 cursor-pointer",children:[(0,m.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,m.jsx)("div",{className:"text-muted-foreground",children:e.icon}),(0,m.jsx)("span",{className:"font-medium",children:e.label})]}),(0,m.jsx)("p",{className:"text-sm text-muted-foreground",children:e.description})]})]},e.value))})]}),(0,m.jsxs)("div",{className:"space-y-4",children:[(0,m.jsx)(yN,{className:"text-base",children:"Color Theme"}),(0,m.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:"Choose from various color themes to customize your interface"}),(0,m.jsx)("div",{className:"flex items-center",children:(0,m.jsx)(AN,{})})]}),(0,m.jsx)(QT,{}),(0,m.jsxs)("div",{className:"space-y-4",children:[(0,m.jsx)(yN,{className:"text-base",children:"Default Sidebar View"}),(0,m.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:"Choose the default view when opening the application"}),(0,m.jsx)(bN,{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=>(0,m.jsxs)("div",{className:"flex items-start space-x-3",children:[(0,m.jsx)(wN,{value:e.value,id:e.value,className:"mt-1"}),(0,m.jsxs)("label",{htmlFor:e.value,className:"flex-1 cursor-pointer",children:[(0,m.jsx)("div",{className:"flex items-center gap-2 mb-1",children:(0,m.jsx)("span",{className:"font-medium",children:e.label})}),(0,m.jsx)("p",{className:"text-sm text-muted-foreground",children:e.desc})]})]},e.value))})]})]})};Array(12).fill(0);var IN=1,zN=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:IN++},_N=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=zN(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],u.default.isValidElement(e))o=!1,this.create({id:r,type:"default",message:e});else if(PN(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||u.default.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||u.default.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||u.default.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||u.default.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=zN(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=new Set,this.pendingDismissals=new Map}},PN=e=>e&&"object"==typeof e&&"ok"in e&&"boolean"==typeof e.ok&&"status"in e&&"number"==typeof e.status,ON=(e,t)=>_N.message(e,t),LN=Object.assign(ON,{success:_N.success,info:_N.info,warning:_N.warning,error:_N.error,custom:_N.custom,message:_N.message,promise:_N.promise,dismiss:_N.dismiss,loading:_N.loading},{getHistory:()=>_N.toasts,getToasts:()=>_N.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 FN={name:"",type:"local",credentials:{}},BN=({open:e,enableDatabaseSync:t=!1,onEnableDatabaseSyncChange:r})=>{const[n,a]=(0,u.useState)([]),[o,i]=(0,u.useState)(null),[s,l]=(0,u.useState)(FN);(0,u.useEffect)(()=>{e&&a(Wp())},[e]);const c=()=>{s.name.trim()?(o&&"new"!==o?(!function(e,t){Kp(Wp().map(r=>r.id===e?{...r,...t,updatedAt:(new Date).toISOString()}:r))}(o,{name:s.name,credentials:"local"!==s.type?s.credentials:void 0}),LN.success("Source updated")):(!function(e){let t={...e,id:`${e.type}-${Date.now()}`,createdAt:(new Date).toISOString(),updatedAt:(new Date).toISOString()};Kp([...Wp(),t])}({name:s.name,type:s.type,credentials:"local"!==s.type?s.credentials:void 0}),LN.success("Source added")),a(Wp()),i(null),l(FN)):LN.error("Please enter a source name")},d=e=>{!function(e){"local-default"!==e&&(Kp(Wp().filter(t=>t.id!==e)),Yp()===e&&Xp("local-default"))}(e),a(Wp()),LN.success("Source deleted")},h=()=>{i(null),l(FN)},p=e=>s.credentials[e],g=e=>l(t=>({...t,credentials:{...t.credentials,...e}})),x=({type:e})=>"local"===e?(0,m.jsx)(f.HardDrive,{className:"h-4 w-4"}):"ssh"===e?(0,m.jsx)(f.Server,{className:"h-4 w-4"}):"s3"===e||"b2"===e?(0,m.jsx)(f.Cloud,{className:"h-4 w-4"}):"r2"===e?(0,m.jsx)(f.Database,{className:"h-4 w-4"}):"gdocs"===e?(0,m.jsx)(f.FileText,{className:"h-4 w-4"}):"turso"===e?(0,m.jsx)(f.Workflow,{className:"h-4 w-4"}):null,v=e=>"ssh"===e?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(HN,{label:"Host",children:(0,m.jsx)(LT,{value:p("host")||"",onChange:e=>g({host:e.target.value}),placeholder:"example.com"})}),(0,m.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,m.jsx)(HN,{label:"Port",children:(0,m.jsx)(LT,{type:"number",value:p("port")||22,onChange:e=>g({port:parseInt(e.target.value)}),placeholder:"22"})}),(0,m.jsx)(HN,{label:"Username",children:(0,m.jsx)(LT,{value:p("username")||"",onChange:e=>g({username:e.target.value}),placeholder:"user"})})]}),(0,m.jsx)(HN,{label:"Password (Optional)",children:(0,m.jsx)(LT,{type:"password",value:p("password")||"",onChange:e=>g({password:e.target.value}),placeholder:"••••••••"})}),(0,m.jsx)(HN,{label:"Base Path (Optional)",children:(0,m.jsx)(LT,{value:p("basePath")||"",onChange:e=>g({basePath:e.target.value}),placeholder:"/home/user/documents"})})]}):"s3"===e?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(HN,{label:"Access Key ID",children:(0,m.jsx)(LT,{value:p("accessKeyId")||"",onChange:e=>g({accessKeyId:e.target.value}),placeholder:"AKIAIOSFODNN7EXAMPLE"})}),(0,m.jsx)(HN,{label:"Secret Access Key",children:(0,m.jsx)(LT,{type:"password",value:p("secretAccessKey")||"",onChange:e=>g({secretAccessKey:e.target.value}),placeholder:"••••••••"})}),(0,m.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,m.jsx)(HN,{label:"Region",children:(0,m.jsx)(LT,{value:p("region")||"",onChange:e=>g({region:e.target.value}),placeholder:"us-east-1"})}),(0,m.jsx)(HN,{label:"Bucket",children:(0,m.jsx)(LT,{value:p("bucket")||"",onChange:e=>g({bucket:e.target.value}),placeholder:"my-bucket"})})]})]}):"r2"===e?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(HN,{label:"Account ID",children:(0,m.jsx)(LT,{value:p("accountId")||"",onChange:e=>g({accountId:e.target.value}),placeholder:"your-account-id"})}),(0,m.jsx)(HN,{label:"Access Key ID",children:(0,m.jsx)(LT,{value:p("accessKeyId")||"",onChange:e=>g({accessKeyId:e.target.value}),placeholder:"your-access-key-id"})}),(0,m.jsx)(HN,{label:"Secret Access Key",children:(0,m.jsx)(LT,{type:"password",value:p("secretAccessKey")||"",onChange:e=>g({secretAccessKey:e.target.value}),placeholder:"••••••••"})}),(0,m.jsx)(HN,{label:"Bucket",children:(0,m.jsx)(LT,{value:p("bucket")||"",onChange:e=>g({bucket:e.target.value}),placeholder:"my-bucket"})})]}):"b2"===e?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(HN,{label:"Access Key ID",children:(0,m.jsx)(LT,{value:p("accessKeyId")||"",onChange:e=>g({accessKeyId:e.target.value}),placeholder:"your-key-id"})}),(0,m.jsx)(HN,{label:"Secret Access Key",children:(0,m.jsx)(LT,{type:"password",value:p("secretAccessKey")||"",onChange:e=>g({secretAccessKey:e.target.value}),placeholder:"••••••••"})}),(0,m.jsx)(HN,{label:"Bucket",children:(0,m.jsx)(LT,{value:p("bucket")||"",onChange:e=>g({bucket:e.target.value}),placeholder:"my-bucket"})}),(0,m.jsx)(HN,{label:"Endpoint (Optional)",children:(0,m.jsx)(LT,{value:p("endpoint")||"",onChange:e=>g({endpoint:e.target.value}),placeholder:"https://s3.us-west-004.backblazeb2.com"})})]}):"gdocs"===e?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(HN,{label:"Email",children:(0,m.jsx)(LT,{value:p("email")||"",onChange:e=>g({email:e.target.value}),placeholder:"user@gmail.com",disabled:!0})}),(0,m.jsxs)(HN,{label:"Folder IDs (comma-separated)",children:[(0,m.jsx)(ss,{value:p("folderIds")?.join(", ")||"",onChange:e=>g({folderIds:e.target.value.split(",").map(e=>e.trim()).filter(Boolean)}),placeholder:"folder-id-1, folder-id-2",rows:3}),(0,m.jsx)("p",{className:"text-xs text-muted-foreground",children:"Enter Google Drive folder IDs to sync (one per line or comma-separated)"})]}),(0,m.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-md",children:[(0,m.jsx)("div",{className:"flex-1",children:(0,m.jsx)("p",{className:"text-sm font-medium",children:p("isAuthenticated")?"Connected to Google":"Not authenticated"})}),(0,m.jsxs)(is,{size:"sm",variant:"outline",children:[(0,m.jsx)(f.LogIn,{className:"h-4 w-4 mr-2"}),p("isAuthenticated")?"Reconnect":"Authenticate"]})]})]}):"turso"===e?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(HN,{label:"Database Endpoint",children:(0,m.jsx)(LT,{value:p("endpoint")||"",onChange:e=>g({endpoint:e.target.value}),placeholder:"https://your-db.turso.io"})}),(0,m.jsx)(HN,{label:"Auth Token (Optional)",children:(0,m.jsx)(LT,{type:"password",value:p("authToken")||"",onChange:e=>g({authToken:e.target.value}),placeholder:"••••••••"})}),(0,m.jsx)(HN,{label:"Database Name (Optional)",children:(0,m.jsx)(LT,{value:p("database")||"",onChange:e=>g({database:e.target.value}),placeholder:"my-database"})}),(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)("input",{type:"checkbox",id:"gdocs-sync",checked:p("enableGoogleDocsSync")||!1,onChange:e=>g({enableGoogleDocsSync:e.target.checked}),className:"h-4 w-4"}),(0,m.jsx)(yN,{htmlFor:"gdocs-sync",className:"cursor-pointer",children:"Enable Google Docs Sync"})]}),p("enableGoogleDocsSync")&&(0,m.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-md",children:[(0,m.jsx)("div",{className:"flex-1",children:(0,m.jsx)("p",{className:"text-sm",children:"Authenticate with Google to sync documents"})}),(0,m.jsxs)(is,{size:"sm",variant:"outline",children:[(0,m.jsx)(f.LogIn,{className:"h-4 w-4 mr-2"}),"Login with Google"]})]})]}):null;return(0,m.jsxs)("div",{className:"space-y-6",children:[(0,m.jsxs)("div",{children:[(0,m.jsx)("h2",{className:"text-xl font-semibold mb-2",children:"Storage Sources"}),(0,m.jsx)("p",{className:"text-sm text-muted-foreground",children:"Choose where documents are stored (local, SQL database, SSH, S3, R2, B2, Google Docs, Turso DB)"})]}),(0,m.jsx)(QT,{}),(0,m.jsxs)("div",{className:"flex items-start justify-between",children:[(0,m.jsxs)("div",{className:"space-y-1",children:[(0,m.jsxs)(yN,{className:"text-base flex items-center gap-2",children:[(0,m.jsx)(f.Database,{className:"h-4 w-4"}),"Database Sync"]}),(0,m.jsx)("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."})]}),(0,m.jsx)("input",{type:"checkbox",id:"database-sync",checked:t,onChange:e=>r?.(e.target.checked),className:"h-4 w-4 rounded border-gray-300"})]}),(0,m.jsx)(QT,{}),(0,m.jsxs)("div",{className:"space-y-3",children:[n.map(e=>{return(0,m.jsx)("div",{className:"border rounded-lg p-3 space-y-2",children:o===e.id?(0,m.jsxs)("div",{className:"space-y-3",children:[(0,m.jsx)(HN,{label:"Source Name",children:(0,m.jsx)(LT,{value:s.name,onChange:e=>l(t=>({...t,name:e.target.value})),placeholder:"My Remote Files"})}),v(e.type),(0,m.jsx)(VN,{onSave:c,onCancel:h,label:"Save"})]}):(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between",children:[(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)(x,{type:e.type}),(0,m.jsx)("span",{className:"font-medium",children:e.name}),(0,m.jsx)(cs,{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&&(0,m.jsxs)("div",{className:"flex gap-1",children:[(0,m.jsx)(is,{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:(0,m.jsx)(f.Edit2,{className:"h-3 w-3"})}),(0,m.jsx)(is,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-destructive",onClick:()=>d(e.id),children:(0,m.jsx)(f.Trash2,{className:"h-3 w-3"})})]})]}),(0,m.jsx)($N,{source:e})]})},e.id);var t}),"new"===o&&(0,m.jsxs)("div",{className:"border rounded-lg p-3 space-y-3",children:[(0,m.jsx)(HN,{label:"Source Name",children:(0,m.jsx)(LT,{value:s.name,onChange:e=>l(t=>({...t,name:e.target.value})),placeholder:"My Remote Files"})}),(0,m.jsx)(HN,{label:"Source Type",children:(0,m.jsxs)("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:[(0,m.jsx)("option",{value:"ssh",children:"SSH"}),(0,m.jsx)("option",{value:"s3",children:"Amazon S3"}),(0,m.jsx)("option",{value:"r2",children:"Cloudflare R2"}),(0,m.jsx)("option",{value:"b2",children:"Backblaze B2"}),(0,m.jsx)("option",{value:"gdocs",children:"Google Docs"}),(0,m.jsx)("option",{value:"turso",children:"Turso DB"})]})}),v(s.type),(0,m.jsx)(VN,{onSave:c,onCancel:h,label:"Add Source"})]})]}),"new"!==o&&(0,m.jsxs)(is,{variant:"outline",size:"sm",onClick:()=>{i("new"),l({name:"",type:"ssh",credentials:{port:22}})},className:"w-full gap-2",children:[(0,m.jsx)(f.Plus,{className:"h-4 w-4"}),"Add New Storage Source"]})]})},HN=({label:e,children:t})=>(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)(yN,{children:e}),t]}),VN=({onSave:e,onCancel:t,label:r})=>(0,m.jsxs)("div",{className:"flex gap-2",children:[(0,m.jsx)(is,{size:"sm",onClick:e,children:r}),(0,m.jsx)(is,{size:"sm",variant:"outline",onClick:t,children:"Cancel"})]}),$N=({source:e})=>{if("ssh"===e.type&&e.credentials){const t=e.credentials;return(0,m.jsxs)("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;return(0,m.jsxs)("p",{className:"text-xs text-muted-foreground",children:[t.bucket," (",t.region,")"]})}if("r2"===e.type&&e.credentials){const t=e.credentials;return(0,m.jsx)("p",{className:"text-xs text-muted-foreground",children:t.bucket})}if("b2"===e.type&&e.credentials){const t=e.credentials;return(0,m.jsxs)("p",{className:"text-xs text-muted-foreground",children:[t.bucket," (",t.endpoint||"default endpoint",")"]})}if("gdocs"===e.type&&e.credentials){const t=e.credentials;return(0,m.jsx)("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;return(0,m.jsxs)("p",{className:"text-xs text-muted-foreground",children:[t.endpoint,t.enableGoogleDocsSync&&" (Google Docs sync enabled)"]})}return null},qN=["blue","purple","green","orange","pink"],UN=({open:e})=>{const[t,r]=(0,u.useState)([]),[n,a]=(0,u.useState)(null),[o,i]=(0,u.useState)({});(0,u.useEffect)(()=>{e&&r(xT())},[e]);const s=({modeId:e,onSave:t,onCancel:r})=>(0,m.jsxs)("div",{className:"space-y-3",children:[(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)(yN,{htmlFor:`name-${e}`,children:"Mode Name"}),(0,m.jsx)(LT,{id:`name-${e}`,value:o.name||"",onChange:e=>i(t=>({...t,name:e.target.value})),placeholder:"Mode name"})]}),(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)(yN,{htmlFor:`prompt-${e}`,children:"Prompt"}),(0,m.jsx)(ss,{id:`prompt-${e}`,value:o.prompt||"",onChange:e=>i(t=>({...t,prompt:e.target.value})),placeholder:"Rewrite prompt...",rows:4})]}),(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)(yN,{htmlFor:`color-${e}`,children:"Color"}),(0,m.jsx)("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:qN.map(e=>(0,m.jsx)("option",{value:e,children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]}),(0,m.jsxs)("div",{className:"flex gap-2",children:[(0,m.jsx)(is,{size:"sm",onClick:t,children:"Save"}),(0,m.jsx)(is,{size:"sm",variant:"outline",onClick:r,children:"Cancel"})]})]});return(0,m.jsxs)("div",{className:"space-y-6",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between",children:[(0,m.jsxs)("div",{children:[(0,m.jsx)("h2",{className:"text-xl font-semibold mb-2",children:"AI Rewrite Modes"}),(0,m.jsx)("p",{className:"text-sm text-muted-foreground",children:"Customize AI rewrite prompts and add your own modes"})]}),(0,m.jsxs)(is,{variant:"outline",size:"sm",onClick:()=>{vT(fT),r(xT()),LN.success("Modes reset to defaults")},className:"gap-2",children:[(0,m.jsx)(f.RotateCcw,{className:"h-4 w-4"}),"Reset"]})]}),(0,m.jsx)(QT,{}),(0,m.jsxs)("div",{className:"space-y-3",children:[t.map(e=>(0,m.jsx)("div",{className:"border rounded-lg p-3 space-y-2",children:n===e.id?(0,m.jsx)(s,{modeId:e.id,onSave:()=>(e=>{const n=t.map(t=>t.id===e.id?e:t);r(n),vT(n),a(null),i({}),LN.success("Mode updated")})(o),onCancel:()=>{a(null),i({})}}):(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between",children:[(0,m.jsx)(cs,{variant:"outline",className:"text-sm",children:e.name}),(0,m.jsxs)("div",{className:"flex gap-1",children:[(0,m.jsx)(is,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>{a(e.id),i(e)},children:(0,m.jsx)(f.Edit2,{className:"h-3 w-3"})}),(0,m.jsx)(is,{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),vT(n),LN.success("Mode deleted")})(e.id),children:(0,m.jsx)(f.Trash2,{className:"h-3 w-3"})})]})]}),(0,m.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2",children:e.prompt})]})},e.id)),"new"===n&&(0,m.jsx)("div",{className:"border rounded-lg p-3",children:(0,m.jsx)(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),vT(n),a(null),i({}),LN.success("Mode added")},onCancel:()=>{a(null),i({})}})})]}),"new"!==n&&(0,m.jsxs)(is,{variant:"outline",size:"sm",onClick:()=>{a("new"),i({name:"",prompt:"",color:"blue"})},className:"w-full gap-2",children:[(0,m.jsx)(f.Plus,{className:"h-4 w-4"}),"Add New Mode"]})]})};function GN({keys:e,muted:t=!1}){return(0,m.jsx)("span",{className:"inline-flex items-center gap-1",children:e.map((e,n)=>(0,m.jsx)("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:r.getShortcutKey(e)},`${e}-${n}`))})}function WN({action:e,recording:t,conflict:n,onStartRecording:a}){const o=r.getShortcutBinding(e.id),i=r.isShortcutOverridden(e.id);return(0,m.jsxs)("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:[(0,m.jsx)("span",{className:"flex-1 truncate text-sm",children:e.label}),n&&(0,m.jsx)("span",{className:"text-xs text-red-500 dark:text-red-400",children:n}),(0,m.jsx)("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?(0,m.jsx)("span",{className:"animate-pulse text-xs text-blue-600 dark:text-blue-400",children:"Press keys…"}):(0,m.jsx)(GN,{keys:o})}),(0,m.jsx)("button",{type:"button",onClick:()=>r.setShortcutBinding(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:(0,m.jsx)(f.RotateCcw,{size:13})})]})}var KN=({compact:e=!1}={})=>{r.useShortcutOverrides();const[t,n]=(0,u.useState)(null),[a,o]=(0,u.useState)(null),i=(0,u.useMemo)(()=>{const e=new Map;for(const t of r.SHORTCUT_ACTIONS){const r=e.get(t.group)??[];r.push(t),e.set(t.group,r)}return[...e.entries()]},[]);(0,u.useEffect)(()=>{if(!t)return;const e=e=>{if(e.preventDefault(),e.stopPropagation(),"Escape"===e.key)return void n(null);const a=r.keysFromEvent(e);if(!a)return;if(!r.hasCommandModifier(a)&&!/^F\d{1,2}$/.test(a[a.length-1]))return void o({id:t,message:"Include Ctrl/⌘ or Alt"});const i=r.findActionByCurrentKeys(a);i&&i.id!==t?o({id:t,message:`Already used by “${i.label}”`}):(r.setShortcutBinding(t,a),o(null),n(null))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[t]);const s=r.SHORTCUT_ACTIONS.some(e=>r.isShortcutOverridden(e.id));return(0,m.jsxs)("div",{className:"space-y-6",children:[(0,m.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,m.jsxs)("div",{children:[!e&&(0,m.jsx)("h2",{className:"text-xl font-semibold mb-2",children:"Keyboard Shortcuts"}),(0,m.jsx)("p",{className:"text-sm text-muted-foreground",children:"Click a shortcut, then press the new key combination. Esc cancels recording."})]}),(0,m.jsxs)("button",{type:"button",onClick:()=>{r.resetAllShortcuts(),o(null),n(null)},disabled:!s,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:[(0,m.jsx)(f.RotateCcw,{size:12}),"Reset all"]})]}),i.map(([e,r])=>(0,m.jsxs)("div",{className:"space-y-1",children:[(0,m.jsx)("h3",{className:"px-2 text-[11px] font-semibold uppercase tracking-wide text-gray-400",children:e}),r.map(e=>(0,m.jsx)(WN,{action:e,recording:t===e.id,conflict:a?.id===e.id?a.message:void 0,onStartRecording:()=>{o(null),n(t=>t===e.id?null:e.id)}},e.id))]},e))]})},YN=()=>(0,m.jsxs)("div",{className:"space-y-6",children:[(0,m.jsxs)("div",{children:[(0,m.jsx)("h2",{className:"text-xl font-semibold mb-2",children:"About"}),(0,m.jsx)("p",{className:"text-sm text-muted-foreground",children:"Application information"})]}),(0,m.jsx)(QT,{}),(0,m.jsxs)("div",{className:"text-sm space-y-3",children:[(0,m.jsxs)("div",{className:"space-y-1",children:[(0,m.jsx)("p",{className:"font-medium",children:"REASON"}),(0,m.jsx)("p",{className:"text-muted-foreground",children:"A powerful note-taking application"})]}),(0,m.jsxs)("div",{className:"space-y-1",children:[(0,m.jsx)("p",{className:"font-medium",children:"Version"}),(0,m.jsx)("p",{className:"text-muted-foreground",children:"1.0.0"})]})]})]}),XN=[{name:"Appearance",icon:f.Paintbrush},{name:"Storage Sources",icon:f.Database},{name:"AI Rewrite Modes",icon:f.Wand2},{name:"Keyboard Shortcuts",icon:f.Keyboard},{name:"About",icon:f.Info}],ZN={Storage:"Storage Sources","File Sources":"Storage Sources"},JN=e=>e&&(ZN[e]??e)||"Appearance",QN=({open:e,onOpenChange:t,initialSection:r,defaultSidebarView:n="last-used",onDefaultSidebarViewChange:a,enableDatabaseSync:o=!1,onEnableDatabaseSyncChange:i})=>{const[s,l]=(0,u.useState)(()=>JN(r));(0,u.useEffect)(()=>{e&&l(JN(r))},[e,r]);return(0,m.jsx)(AT,{open:e,onOpenChange:t,children:(0,m.jsxs)(IT,{className:"overflow-hidden p-0 md:max-h-[500px] md:max-w-[700px] lg:max-w-[800px]",children:[(0,m.jsx)(PT,{className:"sr-only",children:"Settings"}),(0,m.jsx)(OT,{className:"sr-only",children:"Customize your settings here."}),(0,m.jsxs)(iN,{className:"items-start",children:[(0,m.jsx)(sN,{collapsible:"none",className:"hidden md:flex",children:(0,m.jsx)(lN,{children:(0,m.jsx)(cN,{children:(0,m.jsx)(dN,{children:(0,m.jsx)(uN,{children:XN.map(e=>(0,m.jsx)(hN,{children:(0,m.jsx)(mN,{asChild:!0,isActive:e.name===s,onClick:()=>l(e.name),children:(0,m.jsxs)("a",{href:"#",children:[(0,m.jsx)(e.icon,{}),(0,m.jsx)("span",{children:e.name})]})})},e.name))})})})})}),(0,m.jsxs)("main",{className:"flex h-[480px] flex-1 flex-col overflow-hidden",children:[(0,m.jsx)("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:(0,m.jsx)("div",{className:"flex items-center gap-2 px-4",children:(0,m.jsx)(GT,{children:(0,m.jsxs)(WT,{children:[(0,m.jsx)(KT,{className:"hidden md:block",children:(0,m.jsxs)(YT,{href:"#",children:[(0,m.jsx)(f.Settings,{className:"h-4 w-4 inline mr-1"}),"Settings"]})}),(0,m.jsx)(ZT,{className:"hidden md:block"}),(0,m.jsx)(KT,{children:(0,m.jsx)(XT,{children:s})})]})})})}),(0,m.jsx)("div",{className:"flex flex-1 flex-col gap-4 overflow-y-auto p-4 pt-0",children:(()=>{switch(s){case"Appearance":return(0,m.jsx)(DN,{defaultSidebarView:n,onDefaultSidebarViewChange:a});case"Storage Sources":return(0,m.jsx)(BN,{open:e,enableDatabaseSync:o,onEnableDatabaseSyncChange:i});case"AI Rewrite Modes":return(0,m.jsx)(UN,{open:e});case"Keyboard Shortcuts":return(0,m.jsx)(KN,{});case"About":return(0,m.jsx)(YN,{});default:return null}})()})]})]})]})})};function eM({className:e,...t}){return(0,m.jsx)(j.Root,{"data-slot":"tabs",className:ts("flex flex-col gap-2",e),...t})}function tM({className:e,...t}){return(0,m.jsx)(j.List,{"data-slot":"tabs-list",className:ts("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-2xl p-[3px]",e),...t})}function rM({className:e,...t}){return(0,m.jsx)(j.Trigger,{"data-slot":"tabs-trigger",className:ts("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 nM({className:e,...t}){return(0,m.jsx)(j.Content,{"data-slot":"tabs-content",className:ts("flex-1 outline-none",e),...t})}var aM=w.Root,oM=w.Value,iM=u.forwardRef(({className:e,children:t,...r},n)=>(0,m.jsxs)(w.Trigger,{ref:n,className:ts("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,(0,m.jsx)(w.Icon,{asChild:!0,children:(0,m.jsx)(f.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));iM.displayName=w.Trigger.displayName;var sM=u.forwardRef(({className:e,...t},r)=>(0,m.jsx)(w.ScrollUpButton,{ref:r,className:ts("flex cursor-default items-center justify-center py-1",e),...t,children:(0,m.jsx)(f.ChevronUp,{className:"h-4 w-4"})}));sM.displayName=w.ScrollUpButton.displayName;var lM=u.forwardRef(({className:e,...t},r)=>(0,m.jsx)(w.ScrollDownButton,{ref:r,className:ts("flex cursor-default items-center justify-center py-1",e),...t,children:(0,m.jsx)(f.ChevronDown,{className:"h-4 w-4"})}));lM.displayName=w.ScrollDownButton.displayName;var cM=u.forwardRef(({className:e,children:t,position:r="popper",...n},a)=>(0,m.jsx)(w.Portal,{children:(0,m.jsxs)(w.Content,{ref:a,className:ts("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:[(0,m.jsx)(sM,{}),(0,m.jsx)(w.Viewport,{className:ts("p-1","popper"===r&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),(0,m.jsx)(lM,{})]})}));cM.displayName=w.Content.displayName,u.forwardRef(({className:e,...t},r)=>(0,m.jsx)(w.Label,{ref:r,className:ts("px-2 py-1.5 text-sm font-semibold",e),...t})).displayName=w.Label.displayName;var dM=u.forwardRef(({className:e,children:t,...r},n)=>(0,m.jsxs)(w.Item,{ref:n,className:ts("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:[(0,m.jsx)("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,m.jsx)(w.ItemIndicator,{children:(0,m.jsx)(f.Check,{className:"h-4 w-4"})})}),(0,m.jsx)(w.ItemText,{children:t})]}));function uM({...e}){return(0,m.jsx)($,{"data-slot":"alert-dialog",...e})}function hM({...e}){return(0,m.jsx)(q,{"data-slot":"alert-dialog-portal",...e})}function pM({className:e,...t}){return(0,m.jsx)(U,{"data-slot":"alert-dialog-overlay",className:ts("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 mM({className:e,...t}){return(0,m.jsxs)(hM,{children:[(0,m.jsx)(pM,{}),(0,m.jsx)(G,{"data-slot":"alert-dialog-content",className:ts("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 fM({className:e,...t}){return(0,m.jsx)("div",{"data-slot":"alert-dialog-header",className:ts("flex flex-col gap-2 text-center sm:text-left",e),...t})}function gM({className:e,...t}){return(0,m.jsx)("div",{"data-slot":"alert-dialog-footer",className:ts("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function xM({className:e,...t}){return(0,m.jsx)(Y,{"data-slot":"alert-dialog-title",className:ts("text-lg font-semibold",e),...t})}function vM({className:e,...t}){return(0,m.jsx)(X,{"data-slot":"alert-dialog-description",className:ts("text-muted-foreground text-sm",e),...t})}function yM({className:e,...t}){return(0,m.jsx)(W,{className:ts(os(),e),...t})}function bM({className:e,...t}){return(0,m.jsx)(K,{className:ts(os({variant:"outline"}),e),...t})}function wM(e,t){const[r,n]=(0,u.useState)(()=>{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){}}]}dM.displayName=w.Item.displayName,u.forwardRef(({className:e,...t},r)=>(0,m.jsx)(w.Separator,{ref:r,className:ts("-mx-1 my-1 h-px bg-muted",e),...t})).displayName=w.Separator.displayName;var SM={owner:(0,m.jsx)(f.Crown,{className:"h-3 w-3"}),admin:(0,m.jsx)(f.Shield,{className:"h-3 w-3"}),member:(0,m.jsx)(f.Users,{className:"h-3 w-3"}),viewer:(0,m.jsx)(f.Eye,{className:"h-3 w-3"})},kM={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"},CM=({open:e,onOpenChange:t})=>{const[r,n]=wM("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:new Date}],createdAt:new Date,updatedAt:new Date}],createdAt:new Date,updatedAt:new Date}]),[a,o]=(0,u.useState)(r[0]?.id||null),[i,s]=(0,u.useState)(null),[l,c]=(0,u.useState)(!1),[d,h]=(0,u.useState)(null),[p,g]=(0,u.useState)(""),[x,v]=(0,u.useState)("member"),y=r.find(e=>e.id===a),b=y?.teams.find(e=>e.id===i);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(AT,{open:e,onOpenChange:t,children:(0,m.jsxs)(IT,{className:"max-w-4xl max-h-[85vh]",children:[(0,m.jsxs)(zT,{children:[(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)(f.Building2,{className:"h-5 w-5"}),(0,m.jsx)(PT,{children:"Teams & Organizations"})]}),(0,m.jsx)(OT,{children:"Manage your teams and collaborate with others"})]}),(0,m.jsxs)(eM,{defaultValue:"teams",className:"flex-1",children:[(0,m.jsxs)(tM,{className:"grid w-full grid-cols-2",children:[(0,m.jsx)(rM,{value:"teams",children:"Teams"}),(0,m.jsx)(rM,{value:"organizations",children:"Organizations"})]}),(0,m.jsxs)(nM,{value:"teams",className:"space-y-4 mt-4",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between",children:[(0,m.jsxs)("div",{className:"space-y-1",children:[(0,m.jsx)("h3",{className:"font-semibold",children:"Your Teams"}),(0,m.jsx)("p",{className:"text-sm text-muted-foreground",children:"Collaborate with team members"})]}),(0,m.jsxs)(is,{onClick:()=>{if(!a)return;const e={id:Date.now().toString(),name:"New Team",members:[],createdAt:new Date,updatedAt:new Date};n(t=>t.map(t=>t.id===a?{...t,teams:[...t.teams,e],updatedAt:new Date}:t)),s(e.id),LN.success("Team created")},size:"sm",children:[(0,m.jsx)(f.Plus,{className:"h-4 w-4 mr-2"}),"New Team"]})]}),(0,m.jsx)(QT,{}),(0,m.jsx)(FT,{className:"h-[50vh]",children:y&&y.teams.length>0?(0,m.jsx)("div",{className:"space-y-4",children:y.teams.map(e=>(0,m.jsxs)("div",{className:"border rounded-lg p-4 space-y-4",children:[(0,m.jsxs)("div",{className:"flex items-start justify-between",children:[(0,m.jsxs)("div",{className:"space-y-1",children:[(0,m.jsxs)("h4",{className:"font-semibold flex items-center gap-2",children:[(0,m.jsx)(f.Users,{className:"h-4 w-4"}),e.name]}),e.description&&(0,m.jsx)("p",{className:"text-sm text-muted-foreground",children:e.description}),(0,m.jsxs)("p",{className:"text-xs text-muted-foreground",children:[e.members.length," member",1!==e.members.length?"s":""]})]}),(0,m.jsxs)(is,{variant:"outline",size:"sm",onClick:()=>{s(e.id),c(!0)},children:[(0,m.jsx)(f.UserPlus,{className:"h-4 w-4 mr-2"}),"Invite"]})]}),(0,m.jsx)("div",{className:"space-y-2",children:e.members.map(e=>(0,m.jsxs)("div",{className:"flex items-center justify-between p-2 rounded-lg hover:bg-muted/50",children:[(0,m.jsxs)("div",{className:"flex items-center gap-3",children:[(0,m.jsxs)(rs,{className:"h-8 w-8",children:[(0,m.jsx)(ns,{src:e.avatarUrl}),(0,m.jsx)(as,{children:e.name.substring(0,2).toUpperCase()})]}),(0,m.jsxs)("div",{children:[(0,m.jsx)("p",{className:"text-sm font-medium",children:e.name}),(0,m.jsx)("p",{className:"text-xs text-muted-foreground",children:e.email})]})]}),(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsxs)(cs,{variant:"secondary",className:kM[e.role],children:[(0,m.jsx)("span",{className:"mr-1",children:SM[e.role]}),e.role]}),"owner"!==e.role&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(aM,{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:new Date}:e)}:e)),LN.success("Role updated")));var r,o},children:[(0,m.jsx)(iM,{className:"h-8 w-28",children:(0,m.jsx)(oM,{})}),(0,m.jsxs)(cM,{children:[(0,m.jsx)(dM,{value:"admin",children:"Admin"}),(0,m.jsx)(dM,{value:"member",children:"Member"}),(0,m.jsx)(dM,{value:"viewer",children:"Viewer"})]})]}),(0,m.jsx)(is,{variant:"ghost",size:"sm",onClick:()=>h(e),children:(0,m.jsx)(f.Trash2,{className:"h-4 w-4 text-destructive"})})]})]})]},e.id))})]},e.id))}):(0,m.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[(0,m.jsx)(f.Users,{className:"h-12 w-12 text-muted-foreground mb-4 opacity-50"}),(0,m.jsx)("p",{className:"text-sm text-muted-foreground",children:"No teams yet. Create your first team to get started."})]})})]}),(0,m.jsxs)(nM,{value:"organizations",className:"space-y-4 mt-4",children:[(0,m.jsxs)("div",{className:"space-y-1",children:[(0,m.jsx)("h3",{className:"font-semibold",children:"Your Organizations"}),(0,m.jsx)("p",{className:"text-sm text-muted-foreground",children:"Manage organization settings and details"})]}),(0,m.jsx)(QT,{}),(0,m.jsx)(FT,{className:"h-[50vh]",children:r.map(e=>(0,m.jsx)("div",{className:"border rounded-lg p-4 space-y-4 mb-4",children:(0,m.jsxs)("div",{className:"flex items-start gap-4",children:[(0,m.jsxs)(rs,{className:"h-16 w-16",children:[(0,m.jsx)(ns,{src:e.logoUrl}),(0,m.jsx)(as,{className:"text-lg",children:e.name.substring(0,2).toUpperCase()})]}),(0,m.jsxs)("div",{className:"flex-1 space-y-1",children:[(0,m.jsx)("h4",{className:"font-semibold text-lg",children:e.name}),(0,m.jsx)("p",{className:"text-sm text-muted-foreground",children:e.slug}),e.description&&(0,m.jsx)("p",{className:"text-sm",children:e.description}),(0,m.jsxs)("div",{className:"flex gap-4 text-xs text-muted-foreground pt-2",children:[(0,m.jsxs)("span",{children:[e.teams.length," teams"]}),(0,m.jsxs)("span",{children:[e.teams.reduce((e,t)=>e+t.members.length,0)," ","members"]})]})]})]})},e.id))})]})]})]})}),(0,m.jsx)(AT,{open:l,onOpenChange:c,children:(0,m.jsxs)(IT,{children:[(0,m.jsxs)(zT,{children:[(0,m.jsx)(PT,{children:"Invite Team Member"}),(0,m.jsxs)(OT,{children:["Send an invitation to join ",b?.name]})]}),(0,m.jsxs)("div",{className:"space-y-4 py-4",children:[(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)(yN,{htmlFor:"email",children:"Email Address"}),(0,m.jsxs)("div",{className:"relative",children:[(0,m.jsx)(f.Mail,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,m.jsx)(LT,{id:"email",type:"email",placeholder:"colleague@example.com",value:p,onChange:e=>g(e.target.value),className:"pl-9"})]})]}),(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)(yN,{htmlFor:"role",children:"Role"}),(0,m.jsxs)(aM,{value:x,onValueChange:e=>v(e),children:[(0,m.jsx)(iM,{children:(0,m.jsx)(oM,{})}),(0,m.jsxs)(cM,{children:[(0,m.jsx)(dM,{value:"admin",children:"Admin"}),(0,m.jsx)(dM,{value:"member",children:"Member"}),(0,m.jsx)(dM,{value:"viewer",children:"Viewer"})]})]})]})]}),(0,m.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,m.jsx)(is,{variant:"outline",onClick:()=>c(!1),children:"Cancel"}),(0,m.jsx)(is,{onClick:()=>{if(!p.trim()||!a||!i)return;const e={id:Date.now().toString(),name:p.split("@")[0],email:p,role:x,joinedAt: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:new Date}:t)}:t)),g(""),v("member"),c(!1),LN.success("Member invited")},children:"Send Invitation"})]})]})}),(0,m.jsx)(uM,{open:!!d,onOpenChange:()=>h(null),children:(0,m.jsxs)(mM,{children:[(0,m.jsxs)(fM,{children:[(0,m.jsx)(xM,{children:"Remove Team Member"}),(0,m.jsxs)(vM,{children:["Are you sure you want to remove ",d?.name," from the team? They will lose access to all team resources."]})]}),(0,m.jsxs)(gM,{children:[(0,m.jsx)(bM,{children:"Cancel"}),(0,m.jsx)(yM,{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:new Date}:t)}:t)),h(null),LN.success("Member removed"))));var e},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]})})]})};function jM({className:e,...t}){return(0,m.jsx)(C.Root,{"data-slot":"switch",className:ts("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:(0,m.jsx)(C.Thumb,{"data-slot":"switch-thumb",className:ts("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 TM=({open:e,onOpenChange:t,documentTitle:r,documentId:n,sharingInfo:a,teams:o=[],onUpdateSharing:i})=>{const[s,l]=(0,u.useState)(""),[c,d]=(0,u.useState)("editor"),[h,p]=(0,u.useState)(a?.isPublic||!1),[g,x]=(0,u.useState)(a?.sharedWith||[]),[v,y]=(0,u.useState)(a?.shareLink||null),[b,w]=(0,u.useState)(!1),S=()=>{if(!s.trim())return;if(g.find(e=>e.email===s))return void LN.error("Already shared with this user");const e={email:s,role:c,sharedAt:(new Date).toISOString()},t=[...g,e];x(t),i&&i({...a,isPublic:h,sharedWith:t}),l(""),LN.success(`Invited ${s}`)},k=async()=>{if(!b){w(!0);try{const e=await(0,T.default)("doc/share",{method:"POST",headers:{"Content-Type":"application/json"},body:{documentId:n}});return e.success?(y(e.data.shareUrl),i&&i({...a,isPublic:h,sharedWith:g,shareLink:e.data.shareUrl}),e.data.shareUrl):(LN.error(e.error||"Failed to generate share link"),null)}catch(e){return LN.error(e.message||"Failed to generate share link"),null}finally{w(!1)}}};return(0,m.jsx)(AT,{open:e,onOpenChange:t,children:(0,m.jsxs)(IT,{className:"max-w-2xl max-h-[85vh]",children:[(0,m.jsxs)(zT,{children:[(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)(f.UserPlus,{className:"h-5 w-5"}),(0,m.jsxs)(PT,{children:['Share "',r,'"']})]}),(0,m.jsx)(OT,{children:"Invite people or share with teams"})]}),(0,m.jsxs)("div",{className:"space-y-6",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between p-4 rounded-lg border bg-muted/30",children:[(0,m.jsxs)("div",{className:"flex items-center gap-3",children:[h?(0,m.jsx)(f.Globe,{className:"h-5 w-5 text-primary"}):(0,m.jsx)(f.Lock,{className:"h-5 w-5 text-muted-foreground"}),(0,m.jsxs)("div",{children:[(0,m.jsx)("p",{className:"font-medium text-sm",children:h?"Public Access":"Private"}),(0,m.jsx)("p",{className:"text-xs text-muted-foreground",children:h?"Anyone with the link can view":"Only invited people can access"})]})]}),(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[h&&(0,m.jsx)(is,{variant:"ghost",size:"sm",onClick:async()=>{let e=v;(e||(e=await k(),e))&&(navigator.clipboard.writeText(e),LN.success("Link copied to clipboard"))},className:"h-8",children:(0,m.jsx)(f.Link2,{className:"h-4 w-4"})}),(0,m.jsx)(jM,{checked:h,onCheckedChange:async e=>{p(e),e&&!v&&await k(),i&&i({...a,isPublic:e,sharedWith:g,shareLink:v??void 0}),LN.success(e?"Document is now public":"Document is now private")}})]})]}),(0,m.jsxs)("div",{className:"space-y-3",children:[(0,m.jsx)(yN,{children:"Invite by email"}),(0,m.jsxs)("div",{className:"flex gap-2",children:[(0,m.jsxs)("div",{className:"relative flex-1",children:[(0,m.jsx)(f.Mail,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,m.jsx)(LT,{type:"email",placeholder:"colleague@example.com",value:s,onChange:e=>l(e.target.value),onKeyPress:e=>"Enter"===e.key&&S(),className:"pl-9"})]}),(0,m.jsxs)(aM,{value:c,onValueChange:e=>d(e),children:[(0,m.jsx)(iM,{className:"w-36",children:(0,m.jsx)(oM,{})}),(0,m.jsxs)(cM,{children:[(0,m.jsx)(dM,{value:"editor",children:(0,m.jsxs)("span",{className:"flex items-center gap-2",children:[(0,m.jsx)(f.Edit3,{className:"h-3 w-3"}),"Editor"]})}),(0,m.jsx)(dM,{value:"commentor",children:(0,m.jsxs)("span",{className:"flex items-center gap-2",children:[(0,m.jsx)(f.MessageSquare,{className:"h-3 w-3"}),"Commentor"]})}),(0,m.jsx)(dM,{value:"viewer",children:(0,m.jsxs)("span",{className:"flex items-center gap-2",children:[(0,m.jsx)(f.Eye,{className:"h-3 w-3"}),"Viewer"]})})]})]}),(0,m.jsx)(is,{onClick:S,children:"Invite"})]})]}),(0,m.jsx)(QT,{}),o.length>0&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("div",{className:"space-y-3",children:[(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)(f.Users,{className:"h-4 w-4 text-muted-foreground"}),(0,m.jsx)("h4",{className:"text-sm font-semibold",children:"Teams with access"})]}),(0,m.jsx)("div",{className:"space-y-2",children:o.map(e=>(0,m.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-card hover:bg-muted/50 transition-colors",children:[(0,m.jsxs)("div",{className:"flex items-center gap-3",children:[(0,m.jsx)(rs,{className:"h-8 w-8",children:(0,m.jsx)(as,{className:"bg-primary/10 text-primary",children:(0,m.jsx)(f.Users,{className:"h-4 w-4"})})}),(0,m.jsxs)("div",{children:[(0,m.jsx)("p",{className:"text-sm font-medium",children:e.name}),(0,m.jsxs)("p",{className:"text-xs text-muted-foreground",children:[e.members.length," member",1!==e.members.length?"s":""]})]})]}),(0,m.jsxs)(cs,{variant:"secondary",className:"bg-blue-500/10 text-blue-700 dark:text-blue-400",children:[(0,m.jsx)(f.Edit3,{className:"h-3 w-3 mr-1"}),"Team"]})]},e.id))})]}),(0,m.jsx)(QT,{})]}),(0,m.jsxs)("div",{className:"space-y-3",children:[(0,m.jsx)("h4",{className:"text-sm font-semibold",children:"People with access"}),(0,m.jsx)(FT,{className:"max-h-[300px]",children:g.length>0?(0,m.jsx)("div",{className:"space-y-2 pr-4",children:g.map(e=>{return(0,m.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-card hover:bg-muted/50 transition-colors",children:[(0,m.jsxs)("div",{className:"flex items-center gap-3",children:[(0,m.jsx)(rs,{className:"h-8 w-8",children:(0,m.jsx)(as,{className:"bg-gradient-to-br from-primary/20 to-primary/10",children:(t=e.email,t.substring(0,2).toUpperCase())})}),(0,m.jsxs)("div",{children:[(0,m.jsx)("p",{className:"text-sm font-medium",children:e.email}),(0,m.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Added ",new Date(e.sharedAt).toLocaleDateString()]})]})]}),(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsxs)(aM,{value:e.role||"viewer",onValueChange:t=>((e,t)=>{const r=g.map(r=>r.email===e?{...r,role:t}:r);x(r),i&&i({...a,isPublic:h,sharedWith:r}),LN.success("Role updated")})(e.email,t),children:[(0,m.jsx)(iM,{className:"h-8 w-32",children:(0,m.jsx)(oM,{})}),(0,m.jsxs)(cM,{children:[(0,m.jsx)(dM,{value:"editor",children:(0,m.jsxs)("span",{className:"flex items-center gap-2",children:[(0,m.jsx)(f.Edit3,{className:"h-3 w-3"}),"Editor"]})}),(0,m.jsx)(dM,{value:"commentor",children:(0,m.jsxs)("span",{className:"flex items-center gap-2",children:[(0,m.jsx)(f.MessageSquare,{className:"h-3 w-3"}),"Commentor"]})}),(0,m.jsx)(dM,{value:"viewer",children:(0,m.jsxs)("span",{className:"flex items-center gap-2",children:[(0,m.jsx)(f.Eye,{className:"h-3 w-3"}),"Viewer"]})})]})]}),(0,m.jsx)(is,{variant:"ghost",size:"sm",onClick:()=>(e=>{const t=g.filter(t=>t.email!==e);x(t),i&&i({...a,isPublic:h,sharedWith:t}),LN.success("Access removed")})(e.email),className:"h-8 w-8 p-0",children:(0,m.jsx)(f.X,{className:"h-4 w-4 text-muted-foreground hover:text-destructive"})})]})]},e.email);var t})}):(0,m.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[(0,m.jsx)(f.UserPlus,{className:"h-12 w-12 text-muted-foreground mb-3 opacity-50"}),(0,m.jsx)("p",{className:"text-sm text-muted-foreground",children:"No one else has access yet"}),(0,m.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Invite people to collaborate"})]})})]})]})]})})},NM=({open:e,onOpenChange:t,currentTags:r,onUpdateTags:n})=>{const[a,o]=(0,u.useState)(""),[i,s]=(0,u.useState)(r),l=()=>{if(a.trim()&&!i.includes(a.trim())){const e=[...i,a.trim()];s(e),o("")}};return(0,m.jsx)(AT,{open:e,onOpenChange:t,children:(0,m.jsxs)(IT,{className:"sm:max-w-md",children:[(0,m.jsx)(zT,{children:(0,m.jsx)(PT,{children:"Manage Tags"})}),(0,m.jsxs)("div",{className:"space-y-4",children:[(0,m.jsxs)("div",{className:"flex gap-2",children:[(0,m.jsx)(LT,{value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),l())},placeholder:"Enter tag name...",className:"flex-1"}),(0,m.jsxs)(is,{onClick:l,size:"sm",children:[(0,m.jsx)(f.Plus,{className:"h-4 w-4 mr-1"}),"Add"]})]}),(0,m.jsx)("div",{className:"flex flex-wrap gap-2 min-h-[60px] p-3 border border-border rounded-md bg-muted/20",children:0===i.length?(0,m.jsx)("p",{className:"text-sm text-muted-foreground",children:"No tags added yet"}):i.map(e=>(0,m.jsxs)(cs,{variant:"secondary",className:"gap-1 pl-2 pr-1",children:[e,(0,m.jsx)("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:(0,m.jsx)(f.X,{className:"h-3 w-3"})})]},e))}),(0,m.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,m.jsx)(is,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),(0,m.jsx)(is,{onClick:()=>{n(i),t(!1)},children:"Save Tags"})]})]})]})})};function MM({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:f,setDefaultSidebarView:g,enableDatabaseSync:x,setEnableDatabaseSync:v,setDocuments:y,onSelectDocument:b,onToggleTheme:w,currentTheme:S,onUpdateTags:k}){return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(UT,{open:e,onOpenChange:t,documents:u,onSelectDocument:b,onOpenSettings:()=>n(!0),onOpenTeams:()=>i(!0),onToggleTheme:w,currentTheme:S}),(0,m.jsx)(QN,{open:r,onOpenChange:n,initialSection:a,defaultSidebarView:f,onDefaultSidebarViewChange:g,enableDatabaseSync:x,onEnableDatabaseSyncChange:v}),(0,m.jsx)(CM,{open:o,onOpenChange:i}),(0,m.jsx)(TM,{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))}}),(0,m.jsx)(NM,{open:c,onOpenChange:d,currentTags:p&&u.find(e=>e.id===p)?.tags||[],onUpdateTags:k})]})}function EM(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 AM(e,t){const r=new Set([t,...EM(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 RM(e){const t=JT(),[r,n]=(0,u.useState)(!1),[a,o]=(0,u.useState)(!1),[i,s]=(0,u.useState)(!1),[l,c]=(0,u.useState)(!1),[d,h]=(0,u.useState)(!1),[p,m]=(0,u.useState)(!1),[f,g]=(0,u.useState)(!1),[x,v]=(0,u.useState)(null),[y,b]=wM("REASON-default-sidebar-view","last-used"),[w,S]=wM("REASON-left-panels",["openTabs","files"]),[k,C]=wM("REASON-right-panels",[]),[j,N]=wM("REASON-show-dynamic-island",!1),[M,E]=wM("REASON-sidebar-width",25),[A,R]=(0,u.useState)(null),[D,I]=(0,u.useState)(!1),z=(0,u.useRef)(null),[_,P]=(0,u.useState)([]),[O,L]=wM("REASON-documents",Wx),[F,B]=wM("REASON-active-doc",O.length>0?O[0].id:null),[H,V]=wM("REASON-open-tabs",O.length>0?[O[0].id]:[]),[$,q]=(0,u.useState)([]),[U,G]=(0,u.useState)(null),[W,K]=(0,u.useState)(""),[Y,X]=(0,u.useState)(null),[Z,J]=(0,u.useState)(Yp()),[Q,ee]=wM("REASON-enable-db-sync",!1),{isSyncing:te,lastSyncTime:re,saveDocument:ne,deleteDocument:ae,queueDocumentForSync:oe}=function(e,t,r={}){const{enableSync:n=!1,syncInterval:a=5e3}=r,[o,i]=(0,u.useState)(!1),[s,l]=(0,u.useState)(null),c=(0,u.useRef)(new Map),d=(0,u.useRef)(void 0),h=(0,u.useCallback)(async()=>{if(n)try{const e=(await(0,T.default)("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(new Date),e}catch(e){return LN.error("Failed to load documents from database"),null}},[n,t]),p=(0,u.useCallback)(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(0,T.default)("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(0,T.default)(`doc/documents/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:r})}catch(r){return LN.error("Failed to save document to database"),null}},[n,t]),m=(0,u.useCallback)(async()=>{if(n&&0!==c.current.size){i(!0);try{const e=Array.from(c.current.values());await Promise.all(e.map(e=>p(e))),c.current.clear(),l(new Date)}catch(e){}finally{i(!1)}}},[n,p]),f=(0,u.useCallback)(e=>{n&&(c.current.set(e.id,e),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{m()},2e3))},[n,m]),g=(0,u.useCallback)(async e=>{if(n)try{return await(0,T.default)(`doc/documents/${e}`,{method:"DELETE"}),!0}catch(t){return LN.error("Failed to delete document from database"),!1}},[n]);return(0,u.useEffect)(()=>{if(!n||a<=0)return;const e=setInterval(()=>{c.current.size>0&&m()},a);return()=>clearInterval(e)},[n,a,m]),(0,u.useEffect)(()=>()=>{d.current&&clearTimeout(d.current)},[]),{isSyncing:o,lastSyncTime:s,loadFromDatabase:h,saveDocument:p,deleteDocument:g,queueDocumentForSync:f,syncPendingChanges:m}}(0,L,{enableSync:Q,syncInterval:5e3}),ie=e=>{const t=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},se=(0,u.useMemo)(()=>ie(O),[O]),le=O.find(e=>e.id===F);(0,u.useEffect)(()=>{document.title=le?.title?`${le.title} - Reason Docs`:"Reason - Powerful Note-Taking App"},[le?.title]),(0,u.useEffect)(()=>{P([])},[F]);const ce=(0,u.useMemo)(()=>{const e=O.filter(e=>!e.isDeleted);if(!W.trim())return e;const t=W.toLowerCase();return e.filter(e=>e.title.toLowerCase().includes(t)||e.content.toLowerCase().includes(t))},[O,W]),de=(0,u.useMemo)(()=>W.trim()?ie(ce):se,[ce,W]),ue=async(e,t=!1)=>{let r=null;if(e){const t=O.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:[]};L([...O,n]),Q&&await ne(n),t||(B(n.id),V([...H,n.id])),X(n.id),setTimeout(()=>X(null),500),r&&L(e=>e.map(e=>e.id===r?{...e,isExpanded:!0}:e)),LN.success(t?"Folder created":"Note created")},he=async e=>{const t=e=>[e,...O.filter(t=>t.parentId===e).flatMap(e=>t(e.id))],r=t(e),n=O.filter(e=>!r.includes(e.id));if(L(n),Q)for(const o of r)await ae(o);const a=H.filter(e=>!r.includes(e));V(a),F&&r.includes(F)&&B(a.length>0?a[0]:n.length>0?n[0].id:null),LN.success("Note deleted")},pe=e=>{L(t=>t.map(t=>t.id===e?{...t,isExpanded:!t.isExpanded}:t))};(0,u.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&"k"===e.key&&(e.preventDefault(),s(!0))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),(0,u.useEffect)(()=>{e&&(S(e=>e.includes("files")?e:["files",...e]),n(!0))},[e]),(0,u.useEffect)(()=>{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&&S(e=>e.includes("openTabs")?e:[...e,"openTabs"])},[]),(0,u.useEffect)(()=>{"tree"===y?S(["files"]):"outline"===y?S(["outline"]):"split"===y&&S(["openTabs","files","outline"])},[]);const me=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}}(H,F,e);0!==t.closed.length&&(q([...t.closed,...$].slice(0,10)),V(t.openTabs),t.activeTabId!==F&&B(t.activeTabId))},fe=e=>{me([e])},ge=()=>{if(0===$.length)return;const[e,...t]=$;O.find(t=>t.id===e)?(H.includes(e)||V([...H,e]),B(e),q(t),LN.success("Tab reopened")):(q(t),t.length>0&&ge())},xe=()=>{C(e=>e.filter(e=>"ai"!==e)),S(e=>e.length>1?e.filter(e=>"ai"!==e):e)};return(0,u.useEffect)(()=>{F&&!O.find(e=>e.id===F)&&B(O.length>0?O[0].id:null)},[O,F,B]),{isMobile:t,isSidebarOpen:r,setIsSidebarOpen:n,isRightSidebarOpen:a,setIsRightSidebarOpen:o,isSearchModalOpen:i,setIsSearchModalOpen:s,isSettingsOpen:l,setIsSettingsOpen:c,isTeamsOpen:d,setIsTeamsOpen:h,isInviteModalOpen:p,setIsInviteModalOpen:m,isTagDialogOpen:f,setIsTagDialogOpen:g,tagManagementDocId:x,defaultSidebarView:y,setDefaultSidebarView:b,leftPanels:w,setLeftPanels:S,rightPanels:k,setRightPanels:C,showDynamicIsland:j,setShowDynamicIsland:N,sidebarWidth:M,setSidebarWidth:E,aiSuggestion:A,setAiSuggestion:R,isAiLoading:D,setIsAiLoading:I,editorRef:z,headings:_,setHeadings:P,documents:O,setDocuments:L,activeDocId:F,setActiveDocId:B,openTabs:H,setOpenTabs:V,closedTabsHistory:$,splitViewDocId:U,setSplitViewDocId:G,searchQuery:W,setSearchQuery:K,newDocumentId:Y,activeFileSourceId:Z,enableDatabaseSync:Q,setEnableDatabaseSync:ee,isSyncing:te,lastSyncTime:re,documentTree:se,activeDocument:le,filteredDocuments:ce,filteredTree:de,handleAddDocument:ue,handleDeleteDocument:he,handleDuplicateDocument:e=>{const t=O.find(t=>t.id===e);if(!t)return;const r={...t,id:Date.now().toString(),title:t.title+" (Copy)",children:[]};L([...O,r]),B(r.id),V([...H,r.id]),LN.success("Note duplicated")},handleUpdateDocument:(e,t)=>{L(r=>r.map(r=>{if(r.id===e){const e={...r,...t};return Q&&oe(e),e}return r}))},handleToggleExpand:pe,handleSetExpandedFolders:e=>{const t=new Set(e);L(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&&EM(O,e).includes(t))return void LN.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=new Set([t,...EM(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?AM(l,r):l.length,c<0&&(c=l.length),[...l.slice(0,c),...s,...l.slice(c)]}(O,e,t,r);if(n!==O){if(L(n),Q){const t=n.find(t=>t.id===e);t&&oe(t)}LN.success("Note moved")}},handleAddTag:(e,t)=>{L(r=>r.map(r=>r.id===e?{...r,tags:[...r.tags||[],t]}:r))},handleRemoveTag:(e,t)=>{L(r=>r.map(r=>r.id===e?{...r,tags:(r.tags||[]).filter(e=>e!==t)}:r))},handleManageTags:e=>{v(e),g(!0)},handleFileSourceChange:async e=>{J(e),Xp(e);const t=function(){let e=Wp(),t=Yp();return e.find(e=>e.id===t)||Gp}();try{"local"!==t.type?LN.info(`Source switching for ${t.type} not yet implemented in standalone mode`):LN.success("Switched to local storage")}catch(r){LN.error("Failed to load documents from source")}},handleUpdateTags:e=>{x&&(L(t=>t.map(t=>t.id===x?{...t,tags:e}:t)),LN.success("Tags updated"))},handleRestoreDocument:e=>{L(t=>t.map(t=>t.id===e?{...t,isDeleted:!1}:t)),LN.success("Note restored")},handlePermanentDelete:e=>{const t=e=>[e,...O.filter(t=>t.parentId===e).flatMap(e=>t(e.id))],r=t(e),n=O.filter(e=>!r.includes(e.id));L(n);const a=H.filter(e=>!r.includes(e));V(a),F&&r.includes(F)&&B(a.length>0?a[0]:n.length>0?n[0].id:null),LN.success("Note permanently deleted")},handleTabChange:e=>{B(e)},handleTabClose:fe,handleTabsClose:me,handleTabAdd:()=>{ue(null)},handleTabDelete:e=>{fe(e),he(e)},handleReopenLastClosed:ge,handleSplitRight:e=>{G(e),LN.success("Split view enabled")},handleSelectDocument:e=>{O.find(t=>t.id===e)?.isFolder?pe(e):(H.includes(e)||V([...H,e]),B(e))},handleAIRewrite:async(e,t)=>{LN.info("AI rewrite is not yet available for this editor")},handleAIApprove:()=>{R(null),xe()},handleAIReject:()=>{R(null),xe()},handleAIRegenerate:async e=>{LN.info("AI rewrite is not yet available for this editor")}}}var DM=(0,u.createContext)({});function IM(e){const t=(0,u.useRef)(null);return null===t.current&&(t.current=e()),t.current}var zM="undefined"!=typeof window?u.useLayoutEffect:u.useEffect,_M=(0,u.createContext)(null);function PM(e,t){-1===e.indexOf(t)&&e.push(t)}function OM(e,t){const r=e.indexOf(t);r>-1&&e.splice(r,1)}var LM=(e,t,r)=>r>t?t:r<e?e:r;var FM=()=>{},BM=()=>{};"undefined"!=typeof process&&"production"!==process.env.NODE_ENV&&(FM=(e,t,r)=>{},BM=(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 HM={},VM=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),$M=e=>"object"==typeof e&&null!==e,qM=e=>/^0[^.\s]+$/u.test(e);function UM(e){let t;return()=>(void 0===t&&(t=e()),t)}var GM=e=>e,WM=(...e)=>e.reduce((e,t)=>r=>t(e(r))),KM=(e,t,r)=>{const n=t-e;return n?(r-e)/n:1},YM=class{constructor(){this.subscriptions=[]}add(e){return PM(this.subscriptions,e),()=>OM(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}},XM=e=>1e3*e,ZM=e=>e/1e3,JM=(e,t)=>t?e*(1e3/t):0,QM=new Set;function eE(e,t,r){e||QM.has(t)||QM.add(t)}var tE=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e;function rE(e,t,r,n){if(e===t&&r===n)return GM;const a=t=>function(e,t,r,n,a){let o,i,s=0;do{i=t+(r-t)/2,o=tE(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:tE(a(e),t,n)}var nE=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,aE=e=>t=>1-e(1-t),oE=rE(.33,1.53,.69,.99),iE=aE(oE),sE=nE(iE),lE=e=>e>=1?1:(e*=2)<1?.5*iE(e):.5*(2-Math.pow(2,-10*(e-1))),cE=e=>1-Math.sin(Math.acos(e)),dE=aE(cE),uE=nE(cE),hE=rE(.42,0,1,1),pE=rE(0,0,.58,1),mE=rE(.42,0,.58,1),fE=e=>Array.isArray(e)&&"number"==typeof e[0],gE={linear:GM,easeIn:hE,easeInOut:mE,easeOut:pE,circIn:cE,circInOut:uE,circOut:dE,backIn:iE,backInOut:sE,backOut:oE,anticipate:lE},xE=e=>{if(fE(e)){BM(4===e.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[t,r,n,a]=e;return rE(t,r,n,a)}return"string"==typeof e?(BM(void 0!==gE[e],`Invalid easing type '${e}'`,"invalid-easing-type"),gE[e]):e},vE=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function yE(e,t){let r=!1,n=!0;const a={delta:0,timestamp:0,isProcessing:!1},o=()=>r=!0,i=vE.reduce((e,t)=>(e[t]=function(e){let t=new Set,r=new Set,n=!1,a=!1;const o=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=HM.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:vE.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<vE.length;t++)i[vE[t]].cancel(e)},state:a,steps:i}}var bE,{schedule:wE,cancel:SE,state:kE,steps:CE}=yE("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:GM,!0);function jE(){bE=void 0}var TE={now:()=>(void 0===bE&&TE.set(kE.isProcessing||HM.useManualTiming?kE.timestamp:performance.now()),bE),set:e=>{bE=e,queueMicrotask(jE)}},NE=e=>t=>"string"==typeof t&&t.startsWith(e),ME=NE("--"),EE=NE("var(--"),AE=e=>!!EE(e)&&RE.test(e.split("/*")[0].trim()),RE=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function DE(e){return"string"==typeof e&&e.split("/*")[0].includes("var(--")}var IE={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},zE={...IE,transform:e=>LM(0,1,e)},_E={...IE,default:1},PE=e=>Math.round(1e5*e)/1e5,OE=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;var LE=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,FE=(e,t)=>r=>Boolean("string"==typeof r&&LE.test(r)&&r.startsWith(e)||t&&!function(e){return null==e}(r)&&Object.prototype.hasOwnProperty.call(r,t)),BE=(e,t,r)=>n=>{if("string"!=typeof n)return n;const[a,o,i,s]=n.match(OE);return{[e]:parseFloat(a),[t]:parseFloat(o),[r]:parseFloat(i),alpha:void 0!==s?parseFloat(s):1}},HE={...IE,transform:e=>Math.round((e=>LM(0,255,e))(e))},VE={test:FE("rgb","red"),parse:BE("red","green","blue"),transform:({red:e,green:t,blue:r,alpha:n=1})=>"rgba("+HE.transform(e)+", "+HE.transform(t)+", "+HE.transform(r)+", "+PE(zE.transform(n))+")"};var $E={test:FE("#"),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:VE.transform},qE=e=>({test:t=>"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),UE=qE("deg"),GE=qE("%"),WE=qE("px"),KE=qE("vh"),YE=qE("vw"),XE=(()=>({...GE,parse:e=>GE.parse(e)/100,transform:e=>GE.transform(100*e)}))(),ZE={test:FE("hsl","hue"),parse:BE("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:r,alpha:n=1})=>"hsla("+Math.round(e)+", "+GE.transform(PE(t))+", "+GE.transform(PE(r))+", "+PE(zE.transform(n))+")"},JE={test:e=>VE.test(e)||$E.test(e)||ZE.test(e),parse:e=>VE.test(e)?VE.parse(e):ZE.test(e)?ZE.parse(e):$E.parse(e),transform:e=>"string"==typeof e?e:e.hasOwnProperty("red")?VE.transform(e):ZE.transform(e),getAnimatableNone:e=>{const t=JE.parse(e);return t.alpha=0,JE.transform(t)}},QE=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;var eA="number",tA="color",rA=/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 nA(e){const t=e.toString(),r=[],n={color:[],number:[],var:[]},a=[];let o=0;return{values:r,split:t.replace(rA,e=>(JE.test(e)?(n.color.push(o),a.push(tA),r.push(JE.parse(e))):e.startsWith("var(")?(n.var.push(o),a.push("var"),r.push(e)):(n.number.push(o),a.push(eA),r.push(parseFloat(e))),++o,"${}")).split("${}"),indexes:n,types:a}}function aA({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===eA?PE(n[o]):e===tA?JE.transform(n[o]):n[o]}return a}}var oA=(e,t)=>{return"number"==typeof e?t?.trim().endsWith("/")?e:0:"number"==typeof(r=e)?0:JE.test(r)?JE.getAnimatableNone(r):r;var r};var iA={test:function(e){return isNaN(e)&&"string"==typeof e&&(e.match(OE)?.length||0)+(e.match(QE)?.length||0)>0},parse:function(e){return nA(e).values},createTransformer:function(e){return aA(nA(e))},getAnimatableNone:function(e){const t=nA(e);return aA(t)(t.values.map((e,r)=>oA(e,t.split[r])))}};function sA(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 lA(e,t){return r=>r>0?t:e}var cA=(e,t,r)=>e+(t-e)*r,dA=(e,t,r)=>{const n=e*e,a=r*(t*t-n)+n;return a<0?0:Math.sqrt(a)},uA=[$E,VE,ZE];function hA(e){const t=(r=e,uA.find(e=>e.test(r)));var r;if(FM(Boolean(t),`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!Boolean(t))return!1;let n=t.parse(e);return t===ZE&&(n=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=sA(s,n,e+1/3),o=sA(s,n,e),i=sA(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}}(n)),n}var pA=(e,t)=>{const r=hA(e),n=hA(t);if(!r||!n)return lA(e,t);const a={...r};return e=>(a.red=dA(r.red,n.red,e),a.green=dA(r.green,n.green,e),a.blue=dA(r.blue,n.blue,e),a.alpha=cA(r.alpha,n.alpha,e),VE.transform(a))},mA=new Set(["none","hidden"]);function fA(e,t){return r=>cA(e,t,r)}function gA(e){return"number"==typeof e?fA:"string"==typeof e?AE(e)?lA:JE.test(e)?pA:yA:Array.isArray(e)?xA:"object"==typeof e?JE.test(e)?pA:vA:lA}function xA(e,t){const r=[...e],n=r.length,a=e.map((e,r)=>gA(e)(e,t[r]));return e=>{for(let t=0;t<n;t++)r[t]=a[t](e);return r}}function vA(e,t){const r={...e,...t},n={};for(const a in r)void 0!==e[a]&&void 0!==t[a]&&(n[a]=gA(e[a])(e[a],t[a]));return e=>{for(const t in n)r[t]=n[t](e);return r}}var yA=(e,t)=>{const r=iA.createTransformer(t),n=nA(e),a=nA(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?mA.has(e)&&!a.values.length||mA.has(t)&&!n.values.length?function(e,t){return mA.has(e)?r=>r<=0?e:t:r=>r>=1?t:e}(e,t):WM(xA(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):(FM(!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"),lA(e,t))};function bA(e,t,r){return"number"==typeof e&&"number"==typeof t&&"number"==typeof r?cA(e,t,r):gA(e)(e,t)}var wA=e=>{const t=({timestamp:t})=>e(t);return{start:(e=!0)=>wE.update(t,e),stop:()=>SE(t),now:()=>kE.isProcessing?kE.timestamp:TE.now()}},SA=(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)})`},kA=2e4;function CA(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 jA=100,TA=10,NA=1,MA=0,EA=800,AA=.3,RA=.3,DA={granular:.01,default:2},IA={granular:.005,default:.5},zA=.01,_A=10,PA=.05,OA=1;function LA(e,t){return e*Math.sqrt(1-t*t)}var FA=["duration","bounce"],BA=["stiffness","damping","mass"];function HA(e,t){return t.some(t=>void 0!==e[t])}function VA(e){let t={velocity:MA,stiffness:jA,damping:TA,mass:NA,isResolvedFromDuration:!1,...e};if(!HA(e,BA)&&HA(e,FA))if(t.velocity=0,e.visualDuration){const r=e.visualDuration,n=2*Math.PI/(1.2*r),a=n*n,o=2*LM(.05,1,1-(e.bounce||0))*Math.sqrt(a);t={...t,mass:NA,stiffness:a,damping:o}}else{const r=function({duration:e=EA,bounce:t=AA,velocity:r=MA,mass:n=NA}){let a,o;FM(e<=XM(_A),"Spring duration must be 10 seconds or less","spring-duration-limit");let i=1-t;i=LM(PA,OA,i),e=LM(zA,_A,ZM(e)),i<1?(a=t=>{const n=t*i,a=n*e;return.001-(n-r)/LA(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=LA(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=XM(e),isNaN(s))return{stiffness:jA,damping:TA,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:NA},t.isResolvedFromDuration=!0}return t}function $A(e=RA,t=AA){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}=VA({...r,velocity:-ZM(r.velocity||0)}),m=h||0,f=c/(2*Math.sqrt(l*d)),g=i-o,x=ZM(Math.sqrt(l/d)),v=f*x,y=Math.abs(g)<5;let b,w;if(n||(n=y?DA.granular:DA.default),a||(a=y?IA.granular:IA.default),f<1){const e=LA(x,f),t=(m+v*g)/e,r=v*t+g*e,n=v*g-t*e;let a=-1,o=0,s=0;const l=l=>{if(l!==a){a=l;const c=Math.exp(-v*l),d=Math.sin(e*l),u=Math.cos(e*l);o=i-c*(t*d+g*u),s=c*(r*d+n*u)}};b=e=>(l(e),o),w=e=>(l(e),s)}else if(1===f){b=e=>i-Math.exp(-x*e)*(g+(m+x*g)*e);const e=m+x*g;w=t=>Math.exp(-x*t)*(x*e*t-m)}else{const e=x*Math.sqrt(f*f-1);b=t=>{const r=Math.exp(-v*t),n=Math.min(e*t,300);return i-r*((m+v*g)*Math.sinh(n)+e*g*Math.cosh(n))/e};const t=(m+v*g)/e,r=v*t-g*e,n=v*g-t*e;w=t=>{const a=Math.exp(-v*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=>XM(w(e)),next:e=>{const t=b(e);if(p)s.done=e>=u;else{const r=XM(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(CA(S),kA),t=SA(t=>S.next(e*t).value,e,30);return e+"ms "+t},toTransition:()=>{}};return S}function qA({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 x=e=>-m*Math.exp(-e/n),v=e=>{const t=x(e);h.done=Math.abs(t)<=c,h.value=h.done?g:g+t};let y,b;const w=e=>{var t;((t=h.value)<s||t>l)&&(y=e,b=$A({keyframes:[h.value,p(h.value)],velocity:-x(e)/n*1e3,damping:a,stiffness:o,restDelta:c,restSpeed:d}))};return w(0),{calculatedDuration:null,next:e=>{let t=!1;return b||void 0!==y||(t=!0,v(e),w(e)),void 0!==y&&e>=y?b.next(e-y):(!t&&v(e),h)}}}function UA(e,t,{clamp:r=!0,ease:n,mixer:a}={}){const o=e.length;if(BM(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||HM.mix||bA,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]||GM:t;r=WM(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=KM(e[n],e[n+1],r);return s[n](a)};return r?t=>c(LM(e[0],e[o-1],t)):c}function GA(e){const t=[0];return function(e,t){const r=e[e.length-1];for(let n=1;n<=t;n++){const a=KM(0,t,n);e.push(cA(r,1,a))}}(t,e.length-1),t}function WA({duration:e=300,keyframes:t,times:r,ease:n="easeInOut"}){const a=(e=>Array.isArray(e)&&"number"!=typeof e[0])(n)?n.map(xE):xE(n),o={done:!1,value:t[0]},i=function(e,t){return e.map(e=>e*t)}(r&&r.length===t.length?r:GA(t),e),s=UA(i,t,{ease:Array.isArray(a)?a:(l=t,c=a,l.map(()=>c||mE).splice(0,l.length-1))});var l,c;return{calculatedDuration:e,next:t=>(o.value=s(t),o.done=t>=e,o)}}$A.applyToOptions=e=>{const t=function(e,t=100,r){const n=r({...e,keyframes:[0,t]}),a=Math.min(CA(n),kA);return{type:"keyframes",ease:e=>n.next(a*e).value/t,duration:ZM(a)}}(e,100,$A);return e.ease=t.ease,e.duration=XM(t.duration),e.type="keyframes",e};var KA=e=>null!==e;function YA(e,{repeat:t,repeatType:r="loop"},n,a=1){const o=e.filter(KA),i=a<0||t&&"loop"!==r&&t%2==1?0:o.length-1;return i&&void 0!==n?n:o[i]}var XA={decay:qA,inertia:qA,tween:WA,keyframes:WA,spring:$A};function ZA(e){"string"==typeof e.type&&(e.type=XA[e.type])}var JA=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)}},QA=e=>e/100,eR=class extends JA{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!==TE.now()&&this.tick(TE.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;ZA(e);const{type:t=WA,repeat:r=0,repeatDelay:n=0,repeatType:a,velocity:o=0}=e;let{keyframes:i}=e;const s=t||WA;"production"!==process.env.NODE_ENV&&s!==WA&&BM(i.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${i}`,"spring-two-frames"),s!==WA&&"number"!=typeof i[0]&&(this.mixKeyframes=WM(QA,bA(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=CA(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),x=this.playbackSpeed>=0?g<0:g>n;this.currentTime=Math.max(g,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=n);let v,y=this.currentTime,b=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&&(b=o)),y=LM(0,1,r)*i}x?(this.delayState.value=c[0],v=this.delayState):v=b.next(y),a&&!x&&(v.value=a(v.value));let{done:w}=v;x||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!==qA&&(v.value=YA(c,this.options,f,this.speed)),m&&m(v.value),S&&this.finish(),v}then(e,t){return this.finished.then(e,t)}get duration(){return ZM(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+ZM(e)}get time(){return ZM(this.currentTime)}set time(e){e=XM(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 JM(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(TE.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=ZM(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=wA,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(TE.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 tR=e=>180*e/Math.PI,rR=e=>{const t=tR(Math.atan2(e[1],e[0]));return aR(t)},nR={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:rR,rotateZ:rR,skewX:e=>tR(Math.atan(e[1])),skewY:e=>tR(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},aR=e=>((e%=360)<0&&(e+=360),e),oR=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),iR=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),sR={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:oR,scaleY:iR,scale:e=>(oR(e)+iR(e))/2,rotateX:e=>aR(tR(Math.atan2(e[6],e[5]))),rotateY:e=>aR(tR(Math.atan2(-e[2],e[0]))),rotateZ:rR,rotate:rR,skewX:e=>tR(Math.atan(e[4])),skewY:e=>tR(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function lR(e){return e.includes("scale")?1:0}function cR(e,t){if(!e||"none"===e)return lR(t);const r=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let n,a;if(r)n=sR,a=r;else{const t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);n=nR,a=t}if(!a)return lR(t);const o=n[t],i=a[1].split(",").map(dR);return"function"==typeof o?o(i):i[o]}function dR(e){return parseFloat(e.trim())}var uR=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],hR=(()=>new Set([...uR,"pathRotation"]))(),pR=e=>e===IE||e===WE,mR=new Set(["x","y","z"]),fR=uR.filter(e=>!mR.has(e));var gR={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})=>cR(t,"x"),y:(e,{transform:t})=>cR(t,"y")};gR.translateX=gR.x,gR.translateY=gR.y;var xR=new Set,vR=!1,yR=!1,bR=!1;function wR(){if(yR){const e=Array.from(xR).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),r=new Map;t.forEach(e=>{const t=function(e){const t=[];return fR.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)})}yR=!1,vR=!1,xR.forEach(e=>e.complete(bR)),xR.clear()}function SR(){xR.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(yR=!0)})}var kR=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?(xR.add(this),vR||(vR=!0,wE.read(SR),wE.resolveKeyframes(wR))):(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),xR.delete(this)}cancel(){"scheduled"===this.state&&(xR.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}};function CR(e,t,r){(e=>e.startsWith("--"))(t)?e.style.setProperty(t,r):e.style[t]=r}var jR={};function TR(e,t){const r=UM(e);return()=>jR[t]??r()}var NR=TR(()=>void 0!==window.ScrollTimeline,"scrollTimeline"),MR=TR(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(e){return!1}return!0},"linearEasing"),ER=([e,t,r,n])=>`cubic-bezier(${e}, ${t}, ${r}, ${n})`,AR={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ER([0,.65,.55,1]),circOut:ER([.55,0,1,.45]),backIn:ER([.31,.01,.66,-.59]),backOut:ER([.33,1.53,.69,.99])};function RR(e,t){return e?"function"==typeof e?MR()?SA(e,t):"ease-out":fE(e)?ER(e):Array.isArray(e)?e.map(e=>RR(e,t)||AR.easeOut):AR[e]:void 0}function DR(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=RR(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 IR(e){return"function"==typeof e&&"applyToOptions"in e}var zR=class extends JA{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,BM("string"!=typeof e.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:e,...t}){return IR(e)&&MR()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}(e);this.animation=DR(t,r,n,l,a),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!a){const e=YA(n,this.options,i,this.speed);this.updateMotionValue&&this.updateMotionValue(e),CR(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 ZM(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+ZM(e)}get time(){return ZM(Number(this.animation.currentTime)||0)}set time(e){const t=null!==this.finishedTime;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=XM(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&&NR()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),r&&(this.animation.rangeEnd=r),GM):n(this)}},_R={anticipate:lE,backInOut:sE,circInOut:uE};function PR(e){"string"==typeof e.ease&&e.ease in _R&&(e.ease=_R[e.ease])}var OR=class extends zR{constructor(e){PR(e),ZA(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 eR({...o,autoplay:!1}),s=Math.max(10,TE.now()-this.startTime),l=LM(0,10,s-10),c=i.sample(s).value,{name:d}=this.options;a&&d&&CR(a,d,c),t.setWithVelocity(i.sample(Math.max(0,s-l)).value,c,l),i.stop()}},LR=(e,t)=>"zIndex"!==t&&(!("number"!=typeof e&&!Array.isArray(e))||!("string"!=typeof e||!iA.test(e)&&"0"!==e||e.startsWith("url(")));function FR(e){e.duration=0,e.type="keyframes"}var BR=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),HR=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;var VR=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),$R=UM(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function qR(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 $R()&&r&&(BR.has(r)||VR.has(r)&&function(e){for(let t=0;t<e.length;t++)if("string"==typeof e[t]&&HR.test(e[t]))return!0;return!1}(s))&&("transform"!==r||!d)&&!c&&!n&&"mirror"!==a&&0!==o&&"inertia"!==i}var UR=class extends JA{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=TE.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||kR;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=TE.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=LR(a,t),s=LR(o,t);return FM(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||IR(r))&&n)})(e,a,o,i)||(d=!1,!HM.instantAnimations&&s||c?.(YA(e,r,t)),e[0]=e[e.length-1],FR(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&&qR(u),p=u.motionValue?.owner?.current;let m;if(h)try{m=new OR({...u,element:p})}catch{m=new eR(u)}else m=new eR(u);m.finished.then(()=>{this.notifyFinished()}).catch(GM),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(),bR=!0,SR(),wR(),bR=!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 GR(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 WR={current:void 0},KR=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{const t=TE.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=TE.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&&eE(!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 YM);const r=this.events[e].add(t);return"change"===e?()=>{r(),wE.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=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return WR.current&&WR.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const e=TE.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||e-this.updatedAt>30)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,30);return JM(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 YR(e,t){return new KR(e,t)}function XR(e,t){if(e?.inherit&&t){const{inherit:r,...n}=e;return{...t,...n}}return e}function ZR(e,t){const r=e?.[t]??e?.default??e;return r!==e?XR(r,e):r}var JR={type:"spring",stiffness:500,damping:25,restSpeed:10},QR={type:"keyframes",duration:.8},eD={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},tD=(e,{keyframes:t})=>t.length>2?QR:hR.has(e)?e.startsWith("scale")?(e=>({type:"spring",stiffness:550,damping:0===e?2*Math.sqrt(550):30,restSpeed:10}))(t[1]):JR:eD,rD=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);var nD=(e,t,r,n={},a,o)=>i=>{const s=ZR(n,e)||{},l=s.delay||n.delay||0;let{elapsed:c=0}=n;c-=XM(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(!rD.has(t))return!0;return!1})(s)||Object.assign(d,tD(e,d)),d.duration&&(d.duration=XM(d.duration)),d.repeatDelay&&(d.repeatDelay=XM(d.repeatDelay)),void 0!==d.from&&(d.keyframes[0]=d.from);let u=!1;if((!1===d.type||0===d.duration&&!d.repeatDelay)&&(FR(d),0===d.delay&&(u=!0)),(HM.instantAnimations||HM.skipAnimations||a?.shouldSkipAnimations||s.skipAnimations)&&(u=!0,FR(d),d.delay=0),d.allowFlatten=!s.type&&!s.ease,u&&!o&&void 0!==t.get()){const e=YA(d.keyframes,s);if(void 0!==e)return void wE.update(()=>{d.onUpdate(e),d.onComplete()})}return s.isSync?new eR(d):new UR(d)},aD=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function oD(e,t,r=1){BM(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=aD.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 VM(e)?parseFloat(e):e}return AE(a)?oD(a,t,r+1):a}function iD(e){const t=[{},{}];return e?.values.forEach((e,r)=>{t[0][r]=e.get(),t[1][r]=e.getVelocity()}),t}function sD(e,t,r,n){if("function"==typeof t){const[a,o]=iD(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]=iD(n);t=t(void 0!==r?r:e.custom,a,o)}return t}function lD(e,t,r){const n=e.getProps();return sD(n,t,void 0!==r?r:n.custom,e)}var cD=new Set(["width","height","top","left","right","bottom",...uR]),dD=e=>Array.isArray(e);function uD(e,t,r){e.hasValue(t)?e.getValue(t).set(r):e.addValue(t,YR(r))}function hD(e){return dD(e)?e[e.length-1]||0:e}var pD=e=>Boolean(e&&e.getVelocity);function mD(e,t){const r=e.getValue("willChange");if(function(e){return Boolean(pD(e)&&e.add)}(r))return r.add(t);if(!r&&HM.WillChange){const r=new HM.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function fD(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var gD="data-"+fD("framerAppearId");function xD(e){return e.props[gD]}var vD="undefined"!=typeof window;function yD({protectedKeys:e,needsAnimating:t},r){const n=e.hasOwnProperty(r)&&!0!==t[r];return t[r]=!1,n}function bD(e,t,{delay:r=0,transitionOverride:n,type:a}={}){let{transition:o,transitionEnd:i,...s}=t;const l=e.getDefaultTransition();o=o?XR(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&&yD(h,m))continue;const a={delay:r,...ZR(o||{},m)};d&&(a.skipAnimations=!0);const i=t.get();if(void 0!==i&&!t.isAnimating()&&!Array.isArray(n)&&n===i&&!a.velocity){wE.update(()=>t.set(n));continue}let l=!1;if(vD&&window.MotionHandoffAnimation){const t=xD(e);if(t){const e=window.MotionHandoffAnimation(t,m,wE);null!==e&&(a.startTime=e,l=!0)}}mD(e,m);const p=c??e.shouldReduceMotion;t.start(nD(m,t,n,p&&cD.has(m)?{type:!1}:a,e,l));const f=t.animation;f&&u.push(f)}if(i){const t=()=>wE.update(()=>{i&&function(e,t){let{transitionEnd:r={},transition:n={},...a}=lD(e,t)||{};a={...a,...r};for(const o in a)uD(e,o,hD(a[o]))}(e,i)});u.length?Promise.all(u).then(t):t()}return u}function wD(e,t,r={}){const n=lD(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(bD(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(wD(l,t,{...i,delay:r+("function"==typeof n?0:n)+GR(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 SD=e=>t=>t.test(e),kD=[IE,WE,GE,UE,YE,KE,{test:e=>"auto"===e,parse:e=>e}],CD=e=>kD.find(SD(e));function jD(e){return"number"==typeof e?0===e:null===e||("none"===e||"0"===e||qM(e))}var TD=new Set(["brightness","contrast","saturate","opacity"]);function ND(e){const[t,r]=e.slice(0,-1).split("(");if("drop-shadow"===t)return e;const[n]=r.match(OE)||[];if(!n)return e;const a=r.replace(n,"");let o=TD.has(t)?1:0;return n!==r&&(o*=100),t+"("+o+a+")"}var MD=/\b([a-z-]*)\(.*?\)/gu,ED={...iA,getAnimatableNone:e=>{const t=e.match(MD);return t?t.map(ND).join(" "):e}},AD={...iA,getAnimatableNone:e=>{const t=iA.parse(e);return iA.createTransformer(e)(t.map(e=>"number"==typeof e?0:"object"==typeof e?{...e,alpha:1}:e))}},RD={...IE,transform:Math.round},DD={borderWidth:WE,borderTopWidth:WE,borderRightWidth:WE,borderBottomWidth:WE,borderLeftWidth:WE,borderRadius:WE,borderTopLeftRadius:WE,borderTopRightRadius:WE,borderBottomRightRadius:WE,borderBottomLeftRadius:WE,width:WE,maxWidth:WE,height:WE,maxHeight:WE,top:WE,right:WE,bottom:WE,left:WE,inset:WE,insetBlock:WE,insetBlockStart:WE,insetBlockEnd:WE,insetInline:WE,insetInlineStart:WE,insetInlineEnd:WE,padding:WE,paddingTop:WE,paddingRight:WE,paddingBottom:WE,paddingLeft:WE,paddingBlock:WE,paddingBlockStart:WE,paddingBlockEnd:WE,paddingInline:WE,paddingInlineStart:WE,paddingInlineEnd:WE,margin:WE,marginTop:WE,marginRight:WE,marginBottom:WE,marginLeft:WE,marginBlock:WE,marginBlockStart:WE,marginBlockEnd:WE,marginInline:WE,marginInlineStart:WE,marginInlineEnd:WE,fontSize:WE,backgroundPositionX:WE,backgroundPositionY:WE,...{rotate:UE,pathRotation:UE,rotateX:UE,rotateY:UE,rotateZ:UE,scale:_E,scaleX:_E,scaleY:_E,scaleZ:_E,skew:UE,skewX:UE,skewY:UE,distance:WE,translateX:WE,translateY:WE,translateZ:WE,x:WE,y:WE,z:WE,perspective:WE,transformPerspective:WE,opacity:zE,originX:XE,originY:XE,originZ:WE},zIndex:RD,fillOpacity:zE,strokeOpacity:zE,numOctaves:RD},ID={...DD,color:JE,backgroundColor:JE,outlineColor:JE,fill:JE,stroke:JE,borderColor:JE,borderTopColor:JE,borderRightColor:JE,borderBottomColor:JE,borderLeftColor:JE,filter:ED,WebkitFilter:ED,mask:AD,WebkitMask:AD},zD=e=>ID[e],_D=new Set([ED,AD]);function PD(e,t){let r=zD(e);return _D.has(r)||(r=iA),r.getAnimatableNone?r.getAnimatableNone(t):void 0}var OD=new Set(["auto","none","0"]);var LD=class extends kR{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(),AE(r))){const n=oD(r,t.current);void 0!==n&&(e[s]=n),s===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!cD.has(r)||2!==e.length)return;const[n,a]=e,o=CD(n),i=CD(a);if(DE(n)!==DE(a)&&gR[r])this.needsMeasurement=!0;else if(o!==i)if(pR(o)&&pR(i))for(let s=0;s<e.length;s++){const t=e[s];"string"==typeof t&&(e[s]=parseFloat(t))}else gR[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:t}=this,r=[];for(let n=0;n<e.length;n++)(null===e[n]||jD(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&&!OD.has(t)&&nA(t).values.length&&(n=e[a]),a++}if(n&&r)for(const o of t)e[o]=PD(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=gR[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]=gR[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()}},FD=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function BD(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 HD=(e,t)=>t&&"number"==typeof e?t.transform(e):e;function VD(e){return $M(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}var{schedule:$D,cancel:qD}=yE(queueMicrotask,!1),UD={x:!1,y:!1};function GD(){return UD.x||UD.y}function WD(e,t){const r=BD(e),n=new AbortController;return[r,{passive:!0,...t,signal:n.signal},()=>n.abort()]}function KD(e,t,r={}){const[n,a,o]=WD(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||GD())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 YD=(e,t)=>!!t&&(e===t||YD(e,t.parentElement)),XD=e=>"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary,ZD=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);var JD=new Set(["INPUT","SELECT","TEXTAREA"]);var QD=new WeakSet;function eI(e){return t=>{"Enter"===t.key&&e(t)}}function tI(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}function rI(e){return XD(e)&&!GD()}var nI=new WeakSet;function aI(e,t,r={}){const[n,a,o]=WD(e,r),i=e=>{const n=e.currentTarget;if(!rI(e))return;if(nI.has(e))return;QD.add(n),r.stopPropagation&&nI.add(e);const o=t(n,e),i={...a,capture:!0},s=(e,t)=>{window.removeEventListener("pointerup",l,i),window.removeEventListener("pointercancel",c,i),QD.has(n)&&QD.delete(n),rI(e)&&"function"==typeof o&&o(e,{success:t})},l=e=>{s(e,n===window||n===document||r.useGlobalTarget||YD(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),VD(e)&&(e.addEventListener("focus",e=>((e,t)=>{const r=e.currentTarget;if(!r)return;const n=eI(()=>{if(QD.has(r))return;tI(r,"down");const e=eI(()=>{tI(r,"up")});r.addEventListener("keyup",e,t),r.addEventListener("blur",()=>tI(r,"cancel"),t)});r.addEventListener("keydown",n,t),r.addEventListener("blur",()=>r.removeEventListener("keydown",n),t)})(e,a)),t=e,ZD.has(t.tagName)||!0===t.isContentEditable||e.hasAttribute("tabindex")||(e.tabIndex=0))}),o}function oI(e){return $M(e)&&"ownerSVGElement"in e}var iI,sI=new WeakMap,lI=(e,t,r)=>(n,a)=>a&&a[0]?a[0][e+"Size"]:oI(n)&&"getBBox"in n?n.getBBox()[t]:n[r],cI=lI("inline","width","offsetWidth"),dI=lI("block","height","offsetHeight");function uI({target:e,borderBoxSize:t}){sI.get(e)?.forEach(r=>{r(e,{get width(){return cI(e,t)},get height(){return dI(e,t)}})})}function hI(e){e.forEach(uI)}function pI(e,t){iI||"undefined"!=typeof ResizeObserver&&(iI=new ResizeObserver(hI));const r=BD(e);return r.forEach(e=>{let r=sI.get(e);r||(r=new Set,sI.set(e,r)),r.add(t),iI?.observe(e)}),()=>{r.forEach(e=>{const r=sI.get(e);r?.delete(t),r?.size||iI?.unobserve(e)})}}var mI,fI=new Set;function gI(e){return fI.add(e),mI||(mI=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};fI.forEach(t=>t(e))},window.addEventListener("resize",mI)),()=>{fI.delete(e),fI.size||"function"!=typeof mI||(window.removeEventListener("resize",mI),mI=void 0)}}function xI(e,t){return"function"==typeof e?gI(e):pI(e,t)}var vI={value:null,addProjectionMetrics:null};var yI=[...kD,JE,iA],bI=()=>({x:{min:0,max:0},y:{min:0,max:0}}),wI=new WeakMap;function SI(e){return null!==e&&"object"==typeof e&&"function"==typeof e.start}function kI(e){return"string"==typeof e||Array.isArray(e)}var CI=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],jI=["initial",...CI];function TI(e){return SI(e.animate)||jI.some(t=>kI(e[t]))}function NI(e){return Boolean(TI(e)||e.variants)}var MI={current:null},EI={current:!1},AI="undefined"!=typeof window;var RI=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],DI={};function II(e){DI=e}var zI=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=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=kR,this.features={},this.valueSubscriptions=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=TE.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,wE.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=TI(t),this.isVariantNode=NI(t),this.isVariantNode&&(this.variantChildren=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]&&pD(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,wI.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:(EI.current||function(){if(EI.current=!0,AI)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>MI.current=e.matches;e.addEventListener("change",t),t()}else MI.current=!1}(),this.shouldReduceMotion=MI.current),"production"!==process.env.NODE_ENV&&eE(!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(),SE(this.notifyUpdate),SE(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=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&&BR.has(e)&&this.current instanceof HTMLElement){const{factory:r,keyframes:n,times:a,ease:o,duration:i}=t.accelerate,s=new zR({element:this.current,name:e,keyframes:n,times:a,ease:o,duration:XM(i)}),l=r(s);return void this.valueSubscriptions.set(e,()=>{l(),s.cancel()})}const r=hR.has(e);r&&this.onBindTransform&&this.onBindTransform();const n=t.on("change",t=>{this.latestValues[e]=t,this.props.onUpdate&&wE.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 DI){const t=DI[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<RI.length;r++){const t=RI[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(pD(a))e.addValue(n,a);else if(pD(o))e.addValue(n,YR(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,YR(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=YR(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];var n;return null!=r&&("string"==typeof r&&(VM(r)||qM(r))?r=parseFloat(r):(n=r,!yI.find(SD(n))&&iA.test(t)&&(r=PD(e,t))),this.setBaseTarget(e,pD(r)?r.get():r)),pD(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=sD(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||pD(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 YM),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){$D.render(this.render)}},_I=class extends zI{constructor(){super(...arguments),this.KeyframeResolver=LD}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;pD(e)&&(this.childSubscription=e.on("change",e=>{this.current&&(this.current.textContent=`${e}`)}))}},PI=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function OI({top:e,left:t,right:r,bottom:n}){return{x:{min:t,max:r},y:{min:e,max:n}}}function LI(e){return void 0===e||1===e}function FI({scale:e,scaleX:t,scaleY:r}){return!LI(e)||!LI(t)||!LI(r)}function BI(e){return FI(e)||HI(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function HI(e){return VI(e.x)||VI(e.y)}function VI(e){return e&&"0%"!==e}function $I(e,t,r){return r+t*(e-r)}function qI(e,t,r,n,a){return void 0!==a&&(e=$I(e,a,n)),$I(e,r,n)+t}function UI(e,t=0,r=1,n,a){e.min=qI(e.min,t,r,n,a),e.max=qI(e.max,t,r,n,a)}function GI(e,{x:t,y:r}){UI(e.x,t.translate,t.scale,t.originPoint),UI(e.y,r.translate,r.scale,r.originPoint)}var WI=.999999999999,KI=1.0000000000001;function YI(e,t){e.min+=t,e.max+=t}function XI(e,t,r,n,a=.5){UI(e,t,r,cA(e.min,e.max,a),n)}function ZI(e,t){return"string"==typeof e?parseFloat(e)/100*(t.max-t.min):e}function JI(e,t,r){const n=r??e;XI(e.x,ZI(t.x,n.x),t.scaleX,t.scale,t.originX),XI(e.y,ZI(t.y,n.y),t.scaleY,t.scale,t.originY)}function QI(e,t){return OI(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 ez={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},tz=uR.length;function rz(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(hR.has(l))i=!0;else if(ME(l))a[l]=e;else{const t=HD(e,DD[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<tz;i++){const o=uR[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=HD(s,DD[o]);l||(a=!1,n+=`${ez[o]||o}(${e}) `),r&&(t[o]=e)}}const o=e.pathRotation;return o&&(a=!1,n+=`rotate(${HD(o,DD.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 nz(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 az(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var oz={correct:(e,t)=>{if(!t.target)return e;if("string"==typeof e){if(!WE.test(e))return e;e=parseFloat(e)}return`${az(e,t.target.x)}% ${az(e,t.target.y)}%`}},iz={correct:(e,{treeScale:t,projectionDelta:r})=>{const n=e,a=iA.parse(e);if(a.length>5)return n;const o=iA.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=cA(s,l,.5);return"number"==typeof a[2+i]&&(a[2+i]/=c),"number"==typeof a[3+i]&&(a[3+i]/=c),o(a)}},sz={borderRadius:{...oz,applyTo:[...FD]},borderTopLeftRadius:oz,borderTopRightRadius:oz,borderBottomLeftRadius:oz,borderBottomRightRadius:oz,boxShadow:iz};function lz(e,{layout:t,layoutId:r}){return hR.has(e)||e.startsWith("origin")||(t||void 0!==r)&&(!!sz[e]||"opacity"===e)}function cz(e,t,r){const n=e.style,a=t?.style,o={};if(!n)return o;for(const i in n)(pD(n[i])||a&&pD(a[i])||lz(i,e)||void 0!==r?.getValue(i)?.liveStyle)&&(o[i]=n[i]);return o}var dz=class extends _I{constructor(){super(...arguments),this.type="html",this.renderInstance=nz}mount(e){BM(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(hR.has(t))return this.projection?.isProjecting?lR(t):((e,t)=>{const{transform:r="none"}=getComputedStyle(e);return cR(r,t)})(e,t);{const n=(r=e,window.getComputedStyle(r)),a=(ME(t)?n.getPropertyValue(t):n[t])||0;return"string"==typeof a?a.trim():a}var r}measureInstanceViewportBox(e,{transformPagePoint:t}){return QI(e,t)}build(e,t,r){rz(e,t,r.transformTemplate)}scrapeMotionValuesFromProps(e,t,r){return cz(e,t,r)}},uz={offset:"stroke-dashoffset",array:"stroke-dasharray"},hz={offset:"strokeDashoffset",array:"strokeDasharray"};var pz=["transform","opacity","offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function mz(e,{attrX:t,attrY:r,attrScale:n,pathLength:a,pathSpacing:o=1,pathOffset:i=0,...s},l,c,d){if(rz(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 pz)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?uz:hz;e[o.offset]=""+-n,e[o.array]=`${t} ${r}`}(u,a,o,i,!1)}var fz=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"]),gz=e=>"string"==typeof e&&"svg"===e.toLowerCase();function xz(e,t,r){const n=cz(e,t,r);for(const a in e)if(pD(e[a])||pD(t[a])){n[-1!==uR.indexOf(a)?"attr"+a.charAt(0).toUpperCase()+a.substring(1):a]=e[a]}return n}var vz=class extends _I{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=bI}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(hR.has(t)){const e=zD(t);return e&&e.default||0}if(pz.includes(t)){const r=getComputedStyle(e)[t];if("string"==typeof r&&r)return r.trim()}return t=fz.has(t)?t:fD(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,r){return xz(e,t,r)}build(e,t,r){mz(e,t,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,t,r,n){!function(e,t,r,n){nz(e,t,void 0,n);for(const a in t.attrs)e.setAttribute(fz.has(a)?a:fD(a),t.attrs[a])}(e,t,0,n)}mount(e){this.isSVGTag=gz(e.tagName),super.mount(e)}},yz=jI.length;function bz(e){if(!e)return;if(!e.isControllingVariants){const t=e.parent&&bz(e.parent)||{};return void 0!==e.props.initial&&(t.initial=e.props.initial),t}const t={};for(let r=0;r<yz;r++){const n=jI[r],a=e.props[n];(kI(a)||!1===a)&&(t[n]=a)}return t}function wz(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 Sz=[...CI].reverse(),kz=CI.length;function Cz(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=>wD(e,t,r));n=Promise.all(a)}else if("string"==typeof t)n=wD(e,t,r);else{const a="function"==typeof t?lD(e,t,r.custom):t;n=Promise.all(bD(e,a,r))}return n.then(()=>{e.notify("AnimationComplete",t)})}(e,t,r)))}function jz(e){let t=Cz(e),r=Mz(),n=!0,a=!1;const o=t=>(r,n)=>{const a=lD(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=bz(e.parent)||{},c=[],d=new Set;let u={},h=1/0;for(let t=0;t<kz;t++){const p=Sz[t],m=r[p],f=void 0!==s[p]?s[p]:l[p],g=kI(f),x=p===i?m.isActive:null;!1===x&&(h=t);let v=f===l[p]&&f!==s[p]&&g;if(v&&(n||a)&&e.manuallyAnimateOnMount&&(v=!1),m.protectedKeys={...u},!m.isActive&&null===x||!f&&!m.prevProp||SI(f)||"boolean"==typeof f)continue;if("exit"===p&&m.isActive&&!0!==x){m.prevResolvedValues&&(u={...u,...m.prevResolvedValues});continue}const y=Tz(m.prevProp,f);let b=y||p===i&&m.isActive&&!v&&g||t>h&&g,w=!1;const S=Array.isArray(f)?f:[f];let k=S.reduce(o(p),{});!1===x&&(k={});const{prevResolvedValues:C={}}=m,j={...C,...k},T=t=>{b=!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 j){const t=k[e],r=C[e];if(u.hasOwnProperty(e))continue;let n=!1;n=dD(t)&&dD(r)?!wz(t,r)||y: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&&(b=!1);const N=v&&y;!b||N&&!w||c.push(...S.map(t=>{const r={type:p};if("string"==typeof t&&(n||a)&&!N&&e.manuallyAnimateOnMount&&e.parent){const{parent:n}=e,a=lD(n,t);if(n.enteringChildren&&a){const{delayChildren:t}=a.transition||{};r.delay=GR(n.enteringChildren,e,t)}}return{animation:t,options:r}}))}if(d.size){const t={};if("boolean"!=typeof s.initial){const r=lD(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=Mz(),a=!0}}}function Tz(e,t){return"string"==typeof t?t!==e:!!Array.isArray(t)&&!wz(t,e)}function Nz(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Mz(){return{animate:Nz(!0),whileInView:Nz(),whileHover:Nz(),whileTap:Nz(),whileDrag:Nz(),whileFocus:Nz(),exit:Nz()}}function Ez(e,t){e.min=t.min,e.max=t.max}function Az(e,t){Ez(e.x,t.x),Ez(e.y,t.y)}function Rz(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function Dz(e){return e.max-e.min}function Iz(e,t,r,n=.5){e.origin=n,e.originPoint=cA(t.min,t.max,e.origin),e.scale=Dz(r)/Dz(t),e.translate=cA(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 zz(e,t,r,n){Iz(e.x,t.x,r.x,n?n.originX:void 0),Iz(e.y,t.y,r.y,n?n.originY:void 0)}function _z(e,t,r,n=0){e.min=(n?cA(r.min,r.max,n):r.min)+t.min,e.max=e.min+Dz(t)}function Pz(e,t,r,n=0){const a=n?cA(r.min,r.max,n):r.min;e.min=t.min-a,e.max=e.min+Dz(t)}function Oz(e,t,r,n){Pz(e.x,t.x,r.x,n?.x),Pz(e.y,t.y,r.y,n?.y)}function Lz(e,t,r,n,a){return e=$I(e-=t,1/r,n),void 0!==a&&(e=$I(e,1/a,n)),e}function Fz(e,t,[r,n,a],o,i){!function(e,t=0,r=1,n=.5,a,o=e,i=e){if(GE.test(t)&&(t=parseFloat(t),t=cA(i.min,i.max,t/100)-i.min),"number"!=typeof t)return;let s=cA(o.min,o.max,n);e===o&&(s-=t),e.min=Lz(e.min,t,r,s,a),e.max=Lz(e.max,t,r,s,a)}(e,t[r],t[n],t[a],t.scale,o,i)}var Bz=["x","scaleX","originX"],Hz=["y","scaleY","originY"];function Vz(e,t,r,n){Fz(e.x,t,Bz,r?r.x:void 0,n?n.x:void 0),Fz(e.y,t,Hz,r?r.y:void 0,n?n.y:void 0)}function $z(e){return 0===e.translate&&1===e.scale}function qz(e){return $z(e.x)&&$z(e.y)}function Uz(e,t){return e.min===t.min&&e.max===t.max}function Gz(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Wz(e,t){return Gz(e.x,t.x)&&Gz(e.y,t.y)}function Kz(e){return Dz(e.x)/Dz(e.y)}function Yz(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Xz(e){return[e("x"),e("y")]}var Zz=FD.length,Jz=e=>"string"==typeof e?parseFloat(e):e,Qz=e=>"number"==typeof e||WE.test(e);function e_(e,t){return void 0!==e[t]?e[t]:e.borderRadius}var t_=n_(0,.5,dE),r_=n_(.5,.95,GM);function n_(e,t,r){return n=>n<e?0:n>t?1:r(KM(e,t,n))}function a_(e,t,r,n={passive:!0}){return e.addEventListener(t,r,n),()=>e.removeEventListener(t,r,n)}var o_=(e,t)=>e.depth-t.depth,i_=class{constructor(){this.children=[],this.isDirty=!1}add(e){PM(this.children,e),this.isDirty=!0}remove(e){OM(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(o_),this.isDirty=!1,this.children.forEach(e)}};function s_(e){return pD(e)?e.get():e}var l_=class{constructor(){this.members=[]}add(e){PM(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||(OM(this.members,r),r.unmount())}e.scheduleRender()}remove(e){if(OM(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)}},c_={hasAnimatedSinceResize:!0,hasEverUpdated:!1},d_={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},u_=["","X","Y","Z"],h_=0;function p_(e,t,r,n){const{latestValues:a}=t;a[e]&&(r[e]=a[e],t.setStaticValue(e,0),n&&(n[e]=0))}function m_(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const r=xD(t);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:t,layoutId:n}=e.options;window.MotionCancelOptimisedAnimation(r,"transform",wE,!(t||n))}const{parent:n}=e;n&&!n.hasCheckedOptimisedAppear&&m_(n)}function f_({attachResizeListener:e,defaultParent:t,measureScroll:r,checkIsScrollRoot:n,resetTransform:a}){return class{constructor(e={},r=t?.()){this.id=h_++,this.animationId=0,this.animationCommitId=0,this.children=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=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,vI.value&&(d_.nodes=d_.calculatedTargetDeltas=d_.calculatedProjections=0),this.nodes.forEach(v_),this.nodes.forEach(N_),this.nodes.forEach(M_),this.nodes.forEach(y_),vI.addProjectionMetrics&&vI.addProjectionMetrics(d_)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=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 i_)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new YM),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=oI(t)&&!(oI(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;wE.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=TE.now(),n=({timestamp:a})=>{const o=a-r;o>=t&&(SE(n),e(o-t))};return wE.setup(n,!0),()=>SE(n)}(a,250),c_.hasAnimatedSinceResize&&(c_.hasAnimatedSinceResize=!1,this.nodes.forEach(T_)))})}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()||z_,{onLayoutAnimationStart:i,onLayoutAnimationComplete:s}=o.getProps(),l=!this.targetLayout||!Wz(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={...ZR(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||T_(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(),SE(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(E_),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&&m_(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(S_),void this.nodes.forEach(w_)}if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(k_);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(C_),this.nodes.forEach(j_),this.nodes.forEach(g_),this.nodes.forEach(x_)):this.nodes.forEach(k_),this.clearAllSnapshots();const e=TE.now();kE.delta=LM(0,1e3/60,e-kE.timestamp),kE.timestamp=e,kE.isProcessing=!0,CE.update.process(kE),CE.preRender.process(kE),CE.render.process(kE),kE.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,$D.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(b_),this.sharedNodes.forEach(A_)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,wE.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){wE.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||Dz(this.snapshot.measuredBox.x)||Dz(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&&!qz(this.projectionDelta),r=this.getTransformTemplate(),n=r?r(this.latestValues,""):void 0,o=n!==this.prevTransformTemplateValue;e&&this.instance&&(t||BI(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)),O_((n=r).x),O_(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(F_)){const{scroll:e}=this.root;e&&(YI(t.x,e.offset.x),YI(t.y,e.offset.y))}return t}removeElementScroll(e){const t={x:{min:0,max:0},y:{min:0,max:0}};if(Az(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&&Az(t,e),YI(t.x,a.offset.x),YI(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}};Az(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&&(YI(n.x,-e.scroll.offset.x),YI(n.y,-e.scroll.offset.y)),BI(e.latestValues)&&JI(n,e.latestValues,e.layout?.layoutBox)}return BI(this.latestValues)&&JI(n,this.latestValues,this.layout?.layoutBox),n}removeTransform(e){const t={x:{min:0,max:0},y:{min:0,max:0}};Az(t,e);for(let r=0;r<this.path.length;r++){const e=this.path[r];if(!BI(e.latestValues))continue;let n;e.instance&&(FI(e.latestValues)&&e.updateSnapshot(),n=bI(),Az(n,e.measurePageBox())),Vz(t,e.latestValues,e.snapshot?.layoutBox,n)}return BI(this.latestValues)&&Vz(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!==kE.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=kE.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){_z(e.x,t.x,r.x,n?.x),_z(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):Az(this.target,this.layout.layoutBox),GI(this.target,this.targetDelta)):Az(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),vI.value&&d_.calculatedTargetDeltas++)}getClosestProjectingParent(){if(this.parent&&!FI(this.parent.latestValues)&&!HI(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}},Oz(this.relativeTargetOrigin,t,r,this.options.layoutAnchor||void 0),Az(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===kE.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;Az(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&&(YI(e.x,-o.scroll.offset.x),YI(e.y,-o.scroll.offset.y)),i&&(t.x*=i.x.scale,t.y*=i.y.scale,GI(e,i)),n&&BI(o.latestValues)&&JI(e,o.latestValues,o.layout?.layoutBox))}t.x<KI&&t.x>WI&&(t.x=1),t.y<KI&&t.y>WI&&(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?(Rz(this.prevProjectionDelta.x,this.projectionDelta.x),Rz(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),zz(this.projectionDelta,this.layoutCorrected,s,this.latestValues),this.treeScale.x===o&&this.treeScale.y===i&&Yz(this.projectionDelta.x,this.prevProjectionDelta.x)&&Yz(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",s)),vI.value&&d_.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(I_));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=cA(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=cA(e.y.scale,1,r),i.y.origin=e.y.origin,i.y.originPoint=e.y.originPoint):(R_(i.x,e.x,r),R_(i.y,e.y,r)),this.setTargetDelta(i),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Oz(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),function(e,t,r,n){D_(e.x,t.x,r.x,n),D_(e.y,t.y,r.y,n)}(this.relativeTarget,this.relativeTargetOrigin,s,r),h&&(c=this.relativeTarget,m=h,Uz(c.x,m.x)&&Uz(c.y,m.y))&&(this.isProjectionDirty=!1),h||(h={x:{min:0,max:0},y:{min:0,max:0}}),Az(h,this.relativeTarget)),l&&(this.animationValues=o,function(e,t,r,n,a,o){a?(e.opacity=cA(0,r.opacity??1,t_(n)),e.opacityExit=cA(t.opacity??1,0,r_(n))):o&&(e.opacity=cA(t.opacity??1,r.opacity??1,n));for(let i=0;i<Zz;i++){const a=FD[i];let o=e_(t,a),s=e_(r,a);void 0===o&&void 0===s||(o||(o=0),s||(s=0),0===o||0===s||Qz(o)===Qz(s)?(e[a]=Math.max(cA(Jz(o),Jz(s),n),0),(GE.test(s)||GE.test(o))&&(e[a]+="%")):e[a]=s)}(t.rotate||r.rotate)&&(e.rotate=cA(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&&(SE(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=wE.update(()=>{c_.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=YR(0)),this.motionValue.jump(0,!1),this.currentAnimation=function(e,t,r){const n=pD(e)?e:YR(e);return n.start(nD("",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=Dz(this.layout.layoutBox.x);r.x.min=e.target.x.min,r.x.max=r.x.min+t;const n=Dz(this.layout.layoutBox.y);r.y.min=e.target.y.min,r.y.max=r.y.min+n}Az(t,r),JI(t,a),zz(this.projectionDeltaWithTransform,this.layoutCorrected,t,a)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new l_),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&&p_("z",e,n,this.animationValues);for(let a=0;a<u_.length;a++)p_(`rotate${u_[a]}`,e,n,this.animationValues),p_(`skew${u_[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=s_(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=s_(t?.pointerEvents)||""),void(this.hasProjected&&!BI(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 sz){if(void 0===a[l])continue;const{correct:t,applyTo:r,isCSSVariable:i}=sz[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?s_(t?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(w_),this.root.sharedNodes.clear()}}}function g_(e){e.updateLayout()}function x_(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)Xz(e=>{const n=o?t.measuredBox[e]:t.layoutBox[e],a=Dz(n);n.min=r[e].min,n.max=n.min+a});else if("x"===a||"y"===a){const e="x"===a?"y":"x";Ez(o?t.measuredBox[e]:t.layoutBox[e],r[e])}else L_(a,t.layoutBox,r)&&Xz(n=>{const a=o?t.measuredBox[n]:t.layoutBox[n],i=Dz(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}};zz(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?zz(s,e.applyTransform(n,!0),t.measuredBox):zz(s,r,t.layoutBox);const l=!qz(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}};Oz(s,t.layoutBox,a.layoutBox,i);const l={x:{min:0,max:0},y:{min:0,max:0}};Oz(l,r,o.layoutBox,i),Wz(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 v_(e){vI.value&&d_.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 y_(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function b_(e){e.clearSnapshot()}function w_(e){e.clearMeasurements()}function S_(e){e.isLayoutDirty=!0,e.updateLayout()}function k_(e){e.isLayoutDirty=!1}function C_(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function j_(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function T_(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function N_(e){e.resolveTargetDelta()}function M_(e){e.calcProjection()}function E_(e){e.resetSkewAndRotation()}function A_(e){e.removeLeadSnapshot()}function R_(e,t,r){e.translate=cA(t.translate,0,r),e.scale=cA(t.scale,1,r),e.origin=t.origin,e.originPoint=t.originPoint}function D_(e,t,r,n){e.min=cA(t.min,r.min,n),e.max=cA(t.max,r.max,n)}function I_(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}var z_={duration:.45,ease:[.4,0,.1,1]},__=e=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),P_=__("applewebkit/")&&!__("chrome/")?Math.round:GM;function O_(e){e.min=P_(e.min),e.max=P_(e.max)}function L_(e,t,r){return"position"===e||"preserve-aspect"===e&&!function(e,t,r){return Math.abs(e-t)<=r}(Kz(t),Kz(r),.2)}function F_(e){return e!==e.root&&e.scroll?.wasRoot}var B_=f_({attachResizeListener:(e,t)=>a_(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),H_={current:void 0},V_=f_({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!H_.current){const e=new B_({});e.mount(window),e.setOptions({layoutScroll:!0}),H_.current=e}return H_.current},resetTransform:(e,t)=>{e.style.transform=void 0!==t?t:"none"},checkIsScrollRoot:e=>Boolean("fixed"===window.getComputedStyle(e).position)}),$_=(0,u.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function q_(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function U_(...e){return u.useCallback(function(...e){return t=>{let r=!1;const n=e.map(e=>{const n=q_(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():q_(e[t],null)}}}}(...e),e)}var G_=class extends u.Component{getSnapshotBeforeUpdate(e){const t=this.props.childRef.current;if(VD(t)&&e.isPresent&&!this.props.isPresent&&!1!==this.props.pop){const e=t.offsetParent,r=VD(e)&&e.offsetWidth||0,n=VD(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 W_({children:e,isPresent:t,anchorX:r,anchorY:n,root:a,pop:o}){const i=(0,u.useId)(),s=(0,u.useRef)(null),l=(0,u.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:c}=(0,u.useContext)($_),d=!1!==o?e.props?.ref??e?.ref:void 0,h=U_(s,d);return(0,u.useInsertionEffect)(()=>{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,x="left"===r?g?`right: ${p}`:`left: ${h}`:g?`left: ${h}`:`right: ${p}`,v="bottom"===n?`bottom: ${m}`:`top: ${u}`;s.current.dataset.motionPopId=i;const y=document.createElement("style");c&&(y.nonce=c);const b=a??document.head;return b.appendChild(y),y.sheet&&y.sheet.insertRule(`\n [data-motion-pop-id="${i}"] {\n position: absolute !important;\n width: ${e}px !important;\n height: ${d}px !important;\n ${x}px !important;\n ${v}px !important;\n }\n `),()=>{s.current?.removeAttribute("data-motion-pop-id"),b.contains(y)&&b.removeChild(y)}},[t]),(0,m.jsx)(G_,{isPresent:t,childRef:s,sizeRef:l,pop:o,children:!1===o?e:u.cloneElement(e,{ref:h})})}var K_=({children:e,initial:t,isPresent:r,onExitComplete:n,custom:a,presenceAffectsLayout:o,mode:i,anchorX:s,anchorY:l,root:c})=>{const d=IM(Y_),h=(0,u.useId)(),p=(0,u.useRef)(r),f=(0,u.useRef)(n);zM(()=>{p.current=r,f.current=n});let g=!0,x=(0,u.useMemo)(()=>(g=!1,{id:h,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),!p.current&&!d.size&&f.current?.()})}),[r,d,n]);return o&&g&&(x={...x}),(0,u.useMemo)(()=>{d.forEach((e,t)=>d.set(t,!1))},[r]),u.useEffect(()=>{!r&&!d.size&&n&&n()},[r]),e=(0,m.jsx)(W_,{pop:"popLayout"===i,isPresent:r,anchorX:s,anchorY:l,root:c,children:e}),(0,m.jsx)(_M.Provider,{value:x,children:e})};function Y_(){return new Map}function X_(e=!0){const t=(0,u.useContext)(_M);if(null===t)return[!0,null];const{isPresent:r,onExitComplete:n,register:a}=t,o=(0,u.useId)();(0,u.useEffect)(()=>{if(e)return a(o)},[e]);const i=(0,u.useCallback)(()=>e&&n&&n(o),[o,n,e]);return!r&&n?[!1,i]:[!0]}var Z_=e=>e.key||"";function J_(e){const t=[];return u.Children.forEach(e,e=>{(0,u.isValidElement)(e)&&t.push(e)}),t}var Q_=({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,h]=X_(i),p=(0,u.useMemo)(()=>J_(e),[e]),f=i&&!d?[]:p.map(Z_),g=(0,u.useRef)(!0),x=(0,u.useRef)(p),v=IM(()=>new Map),y=(0,u.useRef)(new Set),[b,w]=(0,u.useState)(p),[S,k]=(0,u.useState)(p);zM(()=>{!i||d||S.length||h?.()},[d,i,S.length,h]),zM(()=>{g.current=!1,x.current=p;for(let e=0;e<S.length;e++){const t=Z_(S[e]);f.includes(t)?(v.delete(t),y.current.delete(t)):!0!==v.get(t)&&v.set(t,!1)}},[S,f.length,f.join("-")]);const C=[];if(p!==b){let e=[...p],t=0;for(const r of S){const n=f.indexOf(Z_(r));-1===n?(e.splice(t++,0,r),C.push(r)):t=n+C.length+1}return"wait"===o&&C.length&&(e=C),k(J_(e)),w(p),null}"production"!==process.env.NODE_ENV&&"wait"===o&&S.length;const{forceRender:j}=(0,u.useContext)(DM);return(0,m.jsx)(m.Fragment,{children:S.map(e=>{const u=Z_(e),b=!(i&&!d)&&(p===S||f.includes(u));return(0,m.jsx)(K_,{isPresent:b,initial:!(g.current&&!r)&&void 0,custom:t,presenceAffectsLayout:a,mode:o,root:c,onExitComplete:b?void 0:()=>{if(y.current.has(u))return;if(!v.has(u))return;y.current.add(u),v.set(u,!0);let e=!0;v.forEach(t=>{t||(e=!1)}),e&&(j?.(),k(x.current),i&&h?.(),n&&n())},anchorX:s,anchorY:l,children:e},u)})})},eP=(0,u.createContext)({strict:!1}),tP={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"]},rP=!1;function nP(){return function(){if(rP)return;const e={};for(const t in tP)e[t]={isEnabled:e=>tP[t].some(t=>!!e[t])};II(e),rP=!0}(),DI}var aP=(0,u.createContext)({});function oP(e){const{initial:t,animate:r}=function(e,t){if(TI(e)){const{initial:t,animate:r}=e;return{initial:!1===t||kI(t)?t:void 0,animate:kI(r)?r:void 0}}return!1!==e.inherit?t:{}}(e,(0,u.useContext)(aP));return(0,u.useMemo)(()=>({initial:t,animate:r}),[iP(t),iP(r)])}function iP(e){return Array.isArray(e)?e.join(" "):e}var sP=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function lP(e,t,r){for(const n in t)pD(t[n])||lz(n,r)||(e[n]=t[n])}function cP(e,t){const r={};return lP(r,e.style||{},e),Object.assign(r,function({transformTemplate:e},t){return(0,u.useMemo)(()=>{const r={style:{},transform:{},transformOrigin:{},vars:{}};return rz(r,t,e),Object.assign({},r.vars,r.style)},[t])}(e,t)),r}function dP(e,t){const r={},n=cP(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 uP=()=>({style:{},transform:{},transformOrigin:{},vars:{},attrs:{}});function hP(e,t,r,n){const a=(0,u.useMemo)(()=>{const r={style:{},transform:{},transformOrigin:{},vars:{},attrs:{}};return mz(r,t,gz(n),e.transformTemplate,e.style),{...r.attrs,style:{...r.style}}},[t]);if(e.style){const t={};lP(t,e.style,e),a.style={...t,...a.style}}return a}var pP=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 mP(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||pP.has(e)}function fP(e,t){return e.startsWith("on")?!mP(e):t?.(e)??!mP(e)}var gP=["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 xP(e){return"string"==typeof e&&!e.includes("-")&&!!(gP.indexOf(e)>-1||/[A-Z]/u.test(e))}function vP(e,t,r,{latestValues:n},a,o=!1,i,s){const l=(i??xP(e)?hP:dP)(t,n,a,e),c=function(e,t,r,n){const a={};for(const o in e)"values"===o&&"object"==typeof e.values||pD(e[o])||(fP(o,n)||!0===r&&mP(o)||!t&&!mP(o)||e.draggable&&o.startsWith("onDrag"))&&(a[o]=e[o]);return a}(t,"string"==typeof e,o,s),d=e!==u.Fragment?{...c,...l,ref:r}:{},{children:h}=t,p=(0,u.useMemo)(()=>pD(h)?h.get():h,[h]);return(0,u.createElement)(e,{...d,children:p})}function yP(e,t,r,n){const a={},o=n(e,{});for(const h in o)a[h]=s_(o[h]);let{initial:i,animate:s}=e;const l=TI(e),c=NI(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&&!SI(u)){const t=Array.isArray(u)?u:[u];for(let r=0;r<t.length;r++){const n=sD(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 bP=e=>(t,r)=>{const n=(0,u.useContext)(aP),a=(0,u.useContext)(_M),o=()=>function({scrapeMotionValuesFromProps:e,createRenderState:t},r,n,a){return{latestValues:yP(r,n,a,e),renderState:t()}}(e,t,n,a);return r?o():IM(o)},wP=bP({scrapeMotionValuesFromProps:cz,createRenderState:sP}),SP=bP({scrapeMotionValuesFromProps:xz,createRenderState:uP}),kP=Symbol.for("motionComponentSymbol");function CP(e,t,r){const n=(0,u.useRef)(r);(0,u.useInsertionEffect)(()=>{n.current=r});const a=(0,u.useRef)(null);return(0,u.useCallback)(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 jP=(0,u.createContext)({});function TP(e){return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function NP(e,t,r,n,a,o){const{visualElement:i}=(0,u.useContext)(aP),s=(0,u.useContext)(eP),l=(0,u.useContext)(_M),c=(0,u.useContext)($_),d=c.reducedMotion,h=c.skipAnimations,p=(0,u.useRef)(null),m=(0,u.useRef)(!1);n=n||s.renderer,!p.current&&n&&(p.current=n(e,{visualState:t,parent:i,props:r,presenceContext:l,blockInitialAnimation:!!l&&!1===l.initial,reducedMotionConfig:d,skipAnimations:h,isSVG:o}),m.current&&p.current&&(p.current.manuallyAnimateOnMount=!0));const f=p.current,g=(0,u.useContext)(jP);!f||f.projection||!a||"html"!==f.type&&"svg"!==f.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:MP(e.parent)),e.projection.setOptions({layoutId:a,layout:o,alwaysMeasureLayout:Boolean(i)||s&&TP(s),visualElement:e,animationType:"string"==typeof o?o:"both",initialPromotionConfig:n,crossfade:u,layoutScroll:l,layoutRoot:c,layoutAnchor:d})}(p.current,r,a,g);const x=(0,u.useRef)(!1);(0,u.useInsertionEffect)(()=>{f&&x.current&&f.update(r,l)});const v=r[gD],y=(0,u.useRef)(Boolean(v)&&"undefined"!=typeof window&&!window.MotionHandoffIsComplete?.(v)&&window.MotionHasOptimisedAnimation?.(v));return zM(()=>{m.current=!0,f&&(x.current=!0,window.MotionIsMounted=!0,f.updateFeatures(),f.scheduleRenderMicrotask(),y.current&&f.animationState&&f.animationState.animateChanges())}),(0,u.useEffect)(()=>{f&&(!y.current&&f.animationState&&f.animationState.animateChanges(),y.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(v)}),y.current=!1),f.enteringChildren=void 0)}),f}function MP(e){if(e)return!1!==e.options.allowProjection?e.projection:MP(e.parent)}function EP(e,{forwardMotionProps:t=!1,type:r}={},n,a){n&&function(e){const t=nP();for(const r in e)t[r]={...t[r],...e[r]};II(t)}(n);const o=r?"svg"===r:xP(e),i=o?SP:wP;function s(r,s){let l;const c={...(0,u.useContext)($_),...r,layoutId:AP(r)},{isStatic:d,isValidProp:h}=c,p=oP(r),f=i(r,d);if(!d&&"undefined"!=typeof window){!function(e,t){const r=(0,u.useContext)(eP).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?FM(!1,t,"lazy-strict-mode"):BM(!1,t,"lazy-strict-mode")}}(c,n);const t=function(e){const{drag:t,layout:r}=nP();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,p.visualElement=NP(e,f,c,a,t.ProjectionNode,o)}return(0,m.jsxs)(aP.Provider,{value:p,children:[l&&p.visualElement?(0,m.jsx)(l,{visualElement:p.visualElement,...c}):null,vP(e,r,CP(f,p.visualElement,s),f,d,t,o,h)]})}s.displayName=`motion.${"string"==typeof e?e:`create(${e.displayName??e.name??""})`}`;const l=(0,u.forwardRef)(s);return l[kP]=e,l}function AP({layoutId:e}){const t=(0,u.useContext)(DM).id;return t&&void 0!==e?t+"-"+e:e}function RP(e,t){if("undefined"==typeof Proxy)return EP;const r=new Map,n=(r,n)=>EP(r,n,e,t);return new Proxy((e,t)=>("production"!==process.env.NODE_ENV&&eE(!1,"motion() is deprecated. Use motion.create() instead."),n(e,t)),{get:(a,o)=>"create"===o?n:(r.has(o)||r.set(o,EP(o,void 0,e,t)),r.get(o))})}var DP=(e,t)=>t.isSVG??xP(e)?new vz(t):new dz(t,{allowProjection:e!==u.Fragment}),IP=0,zP={animation:{Feature:class extends PI{constructor(e){super(e),e.animationState||(e.animationState=jz(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();SI(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 PI{constructor(){super(...arguments),this.id=IP++,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=lD(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 _P(e){return{point:{x:e.pageX,y:e.pageY}}}function PP(e,t,r,n){return a_(e,t,(e=>t=>XD(t)&&e(t,_P(t)))(r),n)}var OP=({current:e})=>e?e.ownerDocument.defaultView:null,LP=(e,t)=>Math.abs(e-t);var FP=new Set(["auto","scroll"]),BP=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=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=HP(this.lastRawMoveEventInfo,this.transformPagePoint));const e=$P(this.lastMoveEventInfo,this.history),t=null!==this.startEvent,r=function(e,t){const r=LP(e.x,t.x),n=LP(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}=kE;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=HP(t,this.transformPagePoint),wE.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=$P("pointercancel"===e.type?this.lastMoveEventInfo:HP(t,this.transformPagePoint),this.history);this.startEvent&&r&&r(e,o),n&&n(e,o)},!XD(e))return;this.dragSnapToOrigin=a,this.handlers=t,this.transformPagePoint=r,this.distanceThreshold=o,this.contextWindow=n||window;const s=HP(_P(e),this.transformPagePoint),{point:l}=s,{timestamp:c}=kE;this.history=[{...l,timestamp:c}];const{onSessionStart:d}=t;d&&d(e,$P(s,this.history));const u={passive:!0,capture:!0};this.removeListeners=WM(PP(this.contextWindow,"pointermove",this.handlePointerMove,u),PP(this.contextWindow,"pointerup",this.handlePointerUp,u),PP(this.contextWindow,"pointercancel",this.handlePointerUp,u)),i&&this.startScrollTracking(i)}startScrollTracking(e){let t=e.parentElement;for(;t;){const e=getComputedStyle(t);(FP.has(e.overflowX)||FP.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),wE.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),SE(this.updatePoint)}};function HP(e,t){return t?{point:t(e.point)}:e}function VP(e,t){return{x:e.x-t.x,y:e.y-t.y}}function $P({point:e},t){return{point:e,delta:VP(e,UP(t)),offset:VP(e,qP(t)),velocity:GP(t,.1)}}function qP(e){return e[0]}function UP(e){return e[e.length-1]}function GP(e,t){if(e.length<2)return{x:0,y:0};let r=e.length-1,n=null;const a=UP(e);for(;r>=0&&(n=e[r],!(a.timestamp-n.timestamp>XM(t)));)r--;if(!n)return{x:0,y:0};n===e[0]&&e.length>2&&a.timestamp-n.timestamp>2*XM(t)&&(n=e[1]);const o=ZM(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 WP(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 KP(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 YP=.35;function XP(e,t,r){return{min:ZP(e,t),max:ZP(e,r)}}function ZP(e,t){return"number"==typeof e?e:e[t]||0}var JP=new WeakMap,QP=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 BP(e,{onSessionStart:e=>{t&&this.snapToCursor(_P(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?UD[o]?null:(UD[o]=!0,()=>{UD[o]=!1}):UD.x||UD.y?null:(UD.x=UD.y=!0,()=>{UD.x=UD.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),Xz(e=>{let t=this.getAxisMotionValue(e).get()||0;if(GE.test(t)){const{projection:r}=this.visualElement;if(r&&r.layout){const n=r.layout.layoutBox[e];n&&(t=Dz(n)*(parseFloat(t)/100))}}this.originPoint[e]=t}),a&&wE.update(()=>a(e,t),!1,!0),mD(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&&wE.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:OP(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&&wE.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||!tO(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?cA(t,e,n.min):Math.max(e,t):void 0!==r&&e>r&&(e=n?cA(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&&TP(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!e||!r)&&function(e,{top:t,left:r,bottom:n,right:a}){return{x:WP(e.x,r,a),y:WP(e.y,t,n)}}(r.layoutBox,e),this.elastic=function(e=YP){return!1===e?e=0:!0===e&&(e=YP),{x:XP(e,"left","right"),y:XP(e,"top","bottom")}}(t),n!==this.constraints&&!TP(e)&&r&&this.constraints&&!this.hasMutatedConstraints&&Xz(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||!TP(e))return!1;const r=e.current;BM(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=QI(e,r),{scroll:a}=t;return a&&(YI(n.x,a.offset.x),YI(n.y,a.offset.y)),n}(r,n.root,this.visualElement.getTransformPagePoint());let o=function(e,t){return{x:KP(e.x,t.x),y:KP(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=OI(e))}return o}startAnimation(e){const{drag:t,dragMomentum:r,dragElastic:n,dragTransition:a,dragSnapToOrigin:o,onDragTransitionEnd:i}=this.getProps(),s=this.constraints||{},l=Xz(i=>{if(!tO(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 mD(this.visualElement,e),r.start(nD(e,r,0,t,this.visualElement,!1))}stopAnimation(){Xz(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){Xz(t=>{const{drag:r}=this.getProps();if(!tO(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]-cA(r,o,.5)+i)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:r}=this.visualElement;if(!TP(t)||!r||!this.constraints)return;this.stopAnimation();const n={x:0,y:0};Xz(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=Dz(e),a=Dz(t);return a>n?r=KM(t.min,t.max-n,e.min):n>a&&(r=KM(e.min,e.max-a,t.min)),LM(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(),Xz(t=>{if(!tO(t,e,null))return;const r=this.getAxisMotionValue(t),{min:a,max:o}=this.constraints[t];r.set(cA(a,o,n[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;JP.set(this.visualElement,this);const e=this.visualElement.current,t=PP(e,"pointerdown",t=>{const{drag:r,dragListener:n=!0}=this.getProps(),a=t.target,o=a!==e&&function(e){return JD.has(e.tagName)||!0===e.isContentEditable}(a);r&&n&&!o&&this.start(t)});let r;const n=()=>{const{dragConstraints:t}=this.getProps();TP(t)&&t.current&&(this.constraints=this.resolveRefConstraints(),r||(r=function(e,t,r){const n=xI(e,eO(r)),a=xI(t,eO(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()),wE.read(n);const i=a_(window,"resize",()=>this.scalePositionWithinConstraints()),s=a.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(Xz(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=YP,dragMomentum:i=!0}=e;return{...e,drag:t,dragDirectionLock:r,dragPropagation:n,dragConstraints:a,dragElastic:o,dragMomentum:i}}};function eO(e){let t=!0;return()=>{t?t=!1:e()}}function tO(e,t,r){return!(!0!==t&&t!==e||null!==r&&r!==e)}var rO=e=>(t,r)=>{e&&wE.update(()=>e(t,r),!1,!0)},nO=!1,aO=class extends u.Component{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),nO&&a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions({...a.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),c_.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}),nO=!0,n||e.layoutDependency!==t||void 0===t||e.isPresent!==a?o.willUpdate():this.safeToRemove(),e.isPresent!==a&&(a?o.promote():o.relegate()||wE.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(),$D.postRender(()=>{!r.currentAnimation&&r.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:r}=this.props,{projection:n}=e;nO=!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 oO(e){const[t,r]=X_(),n=(0,u.useContext)(DM);return(0,m.jsx)(aO,{...e,layoutGroup:n,switchLayoutGroup:(0,u.useContext)(jP),isPresent:t,safeToRemove:r})}var iO={pan:{Feature:class extends PI{constructor(){super(...arguments),this.removePointerDownListener=GM}onPointerDown(e){this.session=new BP(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:OP(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:r,onPanEnd:n}=this.node.getProps();return{onSessionStart:rO(e),onStart:rO(t),onMove:rO(r),onEnd:(e,t)=>{delete this.session,n&&wE.postRender(()=>n(e,t))}}}mount(){this.removePointerDownListener=PP(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 PI{constructor(e){super(e),this.removeGroupControls=GM,this.removeListeners=GM,this.controls=new QP(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||GM}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:V_,MeasureLayout:oO}};function sO(e,t,r){const{props:n}=e;e.animationState&&n.whileHover&&e.animationState.setActive("whileHover","Start"===r);const a=n["onHover"+r];a&&wE.postRender(()=>a(t,_P(t)))}function lO(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&&wE.postRender(()=>a(t,_P(t)))}var cO=new WeakMap,dO=new WeakMap,uO=e=>{const t=cO.get(e.target);t&&t(e)},hO=e=>{e.forEach(uO)};function pO(e,t,r){const n=function({root:e,...t}){const r=e||document;dO.has(r)||dO.set(r,{});const n=dO.get(r),a=JSON.stringify(t);return n[a]||(n[a]=new IntersectionObserver(hO,{root:e,...t})),n[a]}(t);return cO.set(e,r),n.observe(e),()=>{cO.delete(e),n.unobserve(e)}}var mO={some:0,all:1};var fO=RP({...zP,...{inView:{Feature:class extends PI{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:mO[n]};this.stopObserver=pO(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 PI{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:t,propagate:r}=this.node.props;this.unmount=aI(e,(e,t)=>(lO(this.node,t,"Start"),(e,{success:t})=>lO(this.node,e,t?"End":"Cancel")),{useGlobalTarget:t,stopPropagation:!1===r?.tap})}unmount(){}}},focus:{Feature:class extends PI{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=WM(a_(this.node.current,"focus",()=>this.onFocus()),a_(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends PI{mount(){const{current:e}=this.node;e&&(this.unmount=KD(e,(e,t)=>(sO(this.node,t,"Start"),e=>sO(this.node,e,"End"))))}unmount(){}}}},...iO,...{layout:{ProjectionNode:V_,MeasureLayout:oO}}},DP),gO={type:"tween",ease:[.22,1,.36,1],duration:.5};function xO({percentage:e}){const t=24,r=10.75,n=2*Math.PI*r,a=n-e/100*n;return(0,m.jsxs)("svg",{width:t,height:t,className:"-rotate-90 shrink-0",children:[(0,m.jsx)("circle",{cx:12,cy:12,r:r,fill:"none",stroke:"var(--muted)",strokeWidth:2.5}),(0,m.jsx)(fO.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 vO({headings:e,onNavigate:t,editorRef:r}){const[n,a]=(0,u.useState)(null),[o,i]=(0,u.useState)(null),[s,l]=(0,u.useState)(!1),[c,d]=(0,u.useState)(0),[h,p]=(0,u.useState)(44),g=(0,u.useRef)(null);(0,u.useEffect)(()=>{const e=()=>{const e=document.querySelector(".toolbar");e&&p(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 x=(0,u.useMemo)(()=>0===e.length?1:Math.min(...e.map(([,,e])=>parseInt(e[1],10))),[e]);if((0,u.useEffect)(()=>{(()=>{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(g.current=a);a=a.parentElement}g.current=null})()},[e,r]),(0,u.useEffect)(()=>{if(0===e.length)return;const t=e=>r?.current?.getElementByKey(e)??null,n=()=>{const r=g.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=g.current??window;return o.addEventListener("scroll",n,{passive:!0}),n(),()=>o.removeEventListener("scroll",n)},[e,r]),0===e.length)return null;const v=e.find(([e])=>e===n)?.[1]??"Contents";return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(Q_,{children:s&&(0,m.jsx)(fO.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:gO,className:"fixed inset-0 z-[9998] bg-black/20 backdrop-blur-[4px]",onClick:()=>l(!1)})}),(0,m.jsx)(fO.div,{initial:{y:-50,opacity:0},animate:{y:0,opacity:1},transition:{type:"spring",stiffness:300,damping:25},style:{top:h},className:"fixed left-1/2 z-[9999] flex -translate-x-1/2 flex-col items-center",children:(0,m.jsxs)(fO.div,{onClick:()=>{s||l(!0)},initial:!1,animate:{width:s?340:280,height:s?400:52,borderRadius:s?24:26},transition:gO,style:{cursor:s?"default":"pointer"},className:"relative overflow-hidden border border-foreground/10 bg-background text-foreground shadow-2xl",children:[(0,m.jsxs)(fO.div,{initial:!1,animate:{opacity:s?0:1,scale:s?.95:1,filter:s?"blur(4px)":"blur(0px)"},transition:{...gO,delay:s?0:.1},className:ts("absolute inset-0 flex items-center gap-4 px-4 sm:px-5",s&&"pointer-events-none"),children:[(0,m.jsx)("div",{className:"h-2 w-2 shrink-0 rounded-full bg-foreground"}),(0,m.jsx)("div",{className:"relative flex h-full flex-1 items-center overflow-hidden text-left",children:(0,m.jsx)(Q_,{mode:"popLayout",initial:!1,children:(0,m.jsx)(fO.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:v},n??"empty")})}),(0,m.jsx)(xO,{percentage:c})]}),(0,m.jsxs)(fO.div,{initial:!1,animate:{opacity:s?1:0,scale:s?1:1.05},transition:{...gO,delay:s?.1:0},className:ts("absolute inset-0 flex flex-col",!s&&"pointer-events-none"),children:[(0,m.jsxs)("div",{className:"flex shrink-0 items-center justify-between px-6 pb-3 pt-5",children:[(0,m.jsx)("span",{className:"text-[11px] font-semibold tracking-[0.08em] text-muted-foreground",children:"TABLE OF CONTENTS"}),(0,m.jsx)("button",{onClick:e=>{e.stopPropagation(),l(!1)},className:"text-muted-foreground transition-colors hover:text-foreground",children:(0,m.jsx)(f.X,{className:"h-5 w-5"})})]}),(0,m.jsx)("div",{className:"flex-1 overflow-y-auto px-3 pb-4",children:(0,m.jsx)("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-x)+12;return(0,m.jsxs)("button",{onMouseEnter:()=>i(e),onMouseLeave:()=>i(null),onClick:r=>{r.stopPropagation(),t(e),l(!1)},style:{paddingLeft:`${u}px`},className:ts("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:[(0,m.jsx)("span",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap transition-transform duration-300 group-hover:translate-x-1",children:r}),(0,m.jsx)(fO.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 yO="undefined"==typeof window?{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},key:()=>null,length:0}:window.localStorage;var bO=({state:e,onRequestAccess:t,onOpenChange:r,onSignIn:n})=>{const a="denied"===e.status||"not-found"===e.status||"sign-in-required"===e.status;return(0,m.jsx)(AT,{open:a,onOpenChange:r,children:(0,m.jsxs)(IT,{className:"sm:max-w-md",children:["denied"===e.status&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(zT,{children:[(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)(f.Lock,{className:"h-5 w-5 text-muted-foreground"}),(0,m.jsx)(PT,{children:"You don't have access to this document"})]}),(0,m.jsx)(OT,{children:"Ask the owner for access — they'll get a one-time email letting them know you'd like to view it."})]}),(0,m.jsxs)(_T,{children:[(0,m.jsx)(is,{variant:"outline",onClick:()=>r(!1),children:"Close"}),(0,m.jsx)(is,{onClick:t,disabled:e.accessRequested||e.requesting,children:e.accessRequested?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Check,{className:"h-4 w-4"}),"Request sent"]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Mail,{className:"h-4 w-4"}),e.requesting?"Sending…":"Request access"]})})]})]}),"sign-in-required"===e.status&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(zT,{children:[(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)(f.Lock,{className:"h-5 w-5 text-muted-foreground"}),(0,m.jsx)(PT,{children:"Sign in to open this document"})]}),(0,m.jsx)(OT,{children:"This document belongs to someone else. Sign in so we know who to request access for."})]}),(0,m.jsxs)(_T,{children:[(0,m.jsx)(is,{variant:"outline",onClick:()=>r(!1),children:"Close"}),n&&(0,m.jsx)(is,{onClick:n,children:"Sign in"})]})]}),"not-found"===e.status&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(zT,{children:[(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)(f.HelpCircle,{className:"h-5 w-5 text-muted-foreground"}),(0,m.jsx)(PT,{children:"Document not found"})]}),(0,m.jsx)(OT,{children:"This link doesn't point to a document that exists anymore."})]}),(0,m.jsx)(_T,{children:(0,m.jsx)(is,{onClick:()=>r(!1),children:"Close"})})]})]})})},wO=({SidebarComponent:e,SidebarContentComponent:t,mainContent:r,belowMainContent:n,openFilesSidebarSignal:a,editorEngine:o,extraTabs:i,activeExtraTabId:s,onExtraTabSelect:l,onExtraTabClose:c,onExtraTabsClose:d,onExtraTabAdd:h,onFileTabSelect:p,initialDocId:g,onActiveDocumentChange:x,onGenerateTips:v,onGenerateTopics:y,onSearchTopic:b,onSignIn:w})=>{const{theme:S,setTheme:k}=vN(),C=RM(a),[j,T]=(0,u.useState)(void 0),[N,M]=(0,u.useState)([]),[E,A]=(0,u.useState)(!1),[R,D]=(0,u.useState)([]),[I,z]=(0,u.useState)(!1),_=(0,u.useRef)(!1);(0,u.useEffect)(()=>{!_.current&&g&&C.documents.some(e=>e.id===g)&&(_.current=!0,g!==C.activeDocId&&C.handleSelectDocument(g))},[g,C.documents,C.activeDocId,C.handleSelectDocument]);const{state:P,requestAccess:O,dismiss:L}=function(e,t,r){const[n,a]=(0,u.useState)({status:"idle"}),o=(0,u.useRef)(t);o.current=t;const i=(0,u.useRef)(r);i.current=r;const s=(0,u.useRef)(null);return(0,u.useEffect)(()=>{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:(0,u.useCallback)(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:(0,u.useCallback)(()=>a({status:"idle"}),[])}}(g??null,C.documents,e=>{C.setDocuments(t=>t.some(t=>t.id===e.id)?t:[...t,e])});(0,u.useEffect)(()=>{x?.(C.activeDocId)},[C.activeDocId,x]),(0,u.useEffect)(()=>{M([]),D([])},[C.activeDocId]);const F=v?{tips:N,isTipsLoading:E,onGenerateTips:async()=>{if(v&&C.activeDocument){A(!0);try{const e=await v(C.activeDocument.title,C.activeDocument.content||"");M(e)}catch{M([])}finally{A(!1)}}}}:void 0,B=y?{topics:R,isTopicsLoading:I,onGenerateTopics:async()=>{if(y&&C.activeDocument){z(!0);try{const e=await y(C.activeDocument.title,C.activeDocument.content||"");D(e)}catch{D([])}finally{z(!1)}}},onSearchTopic:b}:void 0,[H,V]=function(e){const{key:t,storage:r=localStorage,debounce:n=300}=e,[a,o]=(0,u.useState)(()=>{try{const e=r.getItem(t);return e?JSON.parse(e):[]}catch{return[]}});return(0,u.useEffect)(()=>{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:yO}),$=(0,u.useMemo)(()=>{const e=C.openTabs.map(e=>({id:e,title:C.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]},[C.openTabs,C.documents,i]),q=s??C.activeDocId,U=e=>{i?.some(t=>t.id===e)?l?.(e):(C.handleTabChange(e),p?.())},G=e=>{i?.some(t=>t.id===e)?c?.(e):C.handleTabClose(e)},W=e=>{const t=e.filter(e=>i?.some(t=>t.id===e)),r=e.filter(e=>!t.includes(e));r.length>0&&C.handleTabsClose(r),t.length>0&&(d?d(t):t.forEach(e=>c?.(e)))},K=(e,t)=>{C.handleAddDocument(e,t),t||p?.()},Y=e=>{C.handleSelectDocument(e),p?.()},X={documents:C.documents,activeId:C.activeDocId,activeDocument:C.activeDocument,onSelect:Y,onAdd:K,onDelete:C.handleDeleteDocument,onDuplicate:C.handleDuplicateDocument,onToggleExpand:C.handleToggleExpand,onSetExpandedFolders:C.handleSetExpandedFolders,onMove:C.handleMoveDocument,onManageTags:C.handleManageTags,onRename:(e,t)=>C.handleUpdateDocument(e,{title:t}),searchQuery:C.searchQuery,onSearchChange:C.setSearchQuery,onSearchClear:()=>C.setSearchQuery(""),onSearchFocus:()=>C.setIsSearchModalOpen(!0),isOpen:C.isSidebarOpen,onOpenChange:C.setIsSidebarOpen,isMobile:C.isMobile,leftPanels:C.leftPanels,onLeftPanelsChange:C.setLeftPanels,rightPanels:C.rightPanels,onRightPanelsChange:C.setRightPanels,onSettingsClick:e=>{T(e),C.setIsSettingsOpen(!0)},onInviteClick:()=>C.setIsInviteModalOpen(!0),onRestore:C.handleRestoreDocument,onPermanentDelete:C.handlePermanentDelete,newDocumentId:C.newDocumentId,showDynamicIsland:C.showDynamicIsland,onToggleDynamicIsland:()=>C.setShowDynamicIsland(!C.showDynamicIsland),activeFileSourceId:C.activeFileSourceId,onFileSourceChange:C.handleFileSourceChange,onNavigate:e=>C.editorRef.current?.scrollToHeading(e),editorRef:C.editorRef,openTabs:C.openTabs,activeTab:q,onTabChange:U,onTabClose:G,onTabsClose:W,onTabRename:(e,t)=>C.handleUpdateDocument(e,{title:t}),onSplitRight:C.handleSplitRight,onReopenLastClosed:C.handleReopenLastClosed,canReopenLastClosed:C.closedTabsHistory.length>0,tabItems:$,onNewChat:h,aiProps:{isAiLoading:C.isAiLoading,aiSuggestion:C.aiSuggestion,onAiApprove:C.handleAIApprove,onAiReject:C.handleAIReject,onAiRegenerate:C.handleAIRegenerate},tipsProps:F,topicsProps:B},Z={activeDocument:C.activeDocument,engine:o,documents:C.documents,splitViewDocId:C.splitViewDocId,activeDocId:C.activeDocId,isMobile:C.isMobile,editorRef:C.editorRef,onUpdateDocument:C.handleUpdateDocument,onHeadingsChange:C.setHeadings,onCloseSplitView:()=>C.setSplitViewDocId(null),aiSuggestion:C.aiSuggestion,isAiLoading:C.isAiLoading,onAiRewrite:C.handleAIRewrite,onAiApprove:C.handleAIApprove,onAiReject:C.handleAIReject,onAiRegenerate:C.handleAIRegenerate,onInviteClick:()=>C.setIsInviteModalOpen(!0),onShareClick:()=>C.setIsInviteModalOpen(!0)},J=C.rightPanels.length>0&&(0,m.jsx)(ET,{panels:C.rightPanels,documents:C.documents,activeId:C.activeDocId,activeDocument:C.activeDocument,onSelect:Y,onAdd:K,onDelete:C.handleDeleteDocument,onDuplicate:C.handleDuplicateDocument,onSetExpandedFolders:C.handleSetExpandedFolders,onMove:C.handleMoveDocument,onManageTags:C.handleManageTags,onRename:(e,t)=>C.handleUpdateDocument(e,{title:t}),headings:C.headings,onNavigate:e=>C.editorRef.current?.scrollToHeading(e),editorRef:C.editorRef,openTabs:C.openTabs,activeTab:q,onTabChange:U,onTabClose:G,onTabsClose:W,onTabRename:(e,t)=>C.handleUpdateDocument(e,{title:t}),onSplitRight:C.handleSplitRight,onReopenLastClosed:C.handleReopenLastClosed,canReopenLastClosed:C.closedTabsHistory.length>0,tabItems:$,onNewChat:h,aiProps:{isAiLoading:C.isAiLoading,aiSuggestion:C.aiSuggestion,onAiApprove:C.handleAIApprove,onAiReject:C.handleAIReject,onAiRegenerate:C.handleAIRegenerate},tipsProps:F,topicsProps:B,onClose:()=>C.setRightPanels([]),isMobile:C.isMobile,isOpen:C.isRightSidebarOpen,onOpenChange:C.setIsRightSidebarOpen,SidebarContentComponent:t});return(0,m.jsxs)("div",{className:"h-screen w-screen flex flex-col overflow-hidden",children:[C.isMobile?(0,m.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between h-10 px-1 border-b border-sidebar-border/60 shrink-0",children:[(0,m.jsx)(is,{variant:"ghost",size:"sm",className:"size-8 p-0",onClick:()=>C.setIsSidebarOpen(!0),"aria-label":"Open sidebar",children:(0,m.jsx)(f.Menu,{className:"h-5 w-5"})}),C.rightPanels.length>0&&(0,m.jsx)(is,{variant:"ghost",size:"sm",className:"size-8 p-0",onClick:()=>C.setIsRightSidebarOpen(!0),"aria-label":"Open right panel",children:(0,m.jsx)(f.PanelRight,{className:"h-5 w-5"})})]}),(0,m.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[(0,m.jsx)(e,{...X,headings:C.headings}),(0,m.jsxs)("main",{className:"flex-1 overflow-hidden flex flex-col",children:[(0,m.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden flex flex-col",children:r??(0,m.jsx)(Is,{...Z})}),n&&(0,m.jsx)("div",{className:"shrink-0 px-2 pt-1 pb-[60px] sm:pb-2 sm:pr-56",children:n})]}),J]})]}):(0,m.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,m.jsxs)(Rs,{direction:"horizontal",onResize:V,children:[(0,m.jsx)(ws,{size:H?.[0]||"250px",minSize:"0px",maxSize:"600px",children:(0,m.jsx)("div",{className:"overflow-y-auto overflow-x-hidden bg-background",children:(0,m.jsx)(e,{...X,headings:C.headings})})}),(0,m.jsx)(ws,{children:(0,m.jsxs)("div",{className:"h-screen flex flex-col bg-background",children:[(0,m.jsxs)("div",{className:"flex-1 flex min-h-0",children:[(0,m.jsx)("div",{className:"flex-1 min-h-0 overflow-auto",children:r??(0,m.jsx)(Is,{...Z})}),J]}),n&&(0,m.jsx)("div",{className:"shrink-0 px-2 pb-2",children:n})]})})]})}),C.headings.length>0&&0===C.rightPanels.length&&C.showDynamicIsland&&(0,m.jsx)(vO,{headings:C.headings,onNavigate:e=>C.editorRef.current?.scrollToHeading(e),editorRef:C.editorRef}),(0,m.jsx)(MM,{isSearchModalOpen:C.isSearchModalOpen,setIsSearchModalOpen:C.setIsSearchModalOpen,isSettingsOpen:C.isSettingsOpen,setIsSettingsOpen:C.setIsSettingsOpen,settingsInitialSection:j,isTeamsOpen:C.isTeamsOpen,setIsTeamsOpen:C.setIsTeamsOpen,isInviteModalOpen:C.isInviteModalOpen,setIsInviteModalOpen:C.setIsInviteModalOpen,isTagDialogOpen:C.isTagDialogOpen,setIsTagDialogOpen:C.setIsTagDialogOpen,documents:C.documents,activeDocument:C.activeDocument,tagManagementDocId:C.tagManagementDocId,defaultSidebarView:C.defaultSidebarView,setDefaultSidebarView:C.setDefaultSidebarView,enableDatabaseSync:C.enableDatabaseSync,setEnableDatabaseSync:C.setEnableDatabaseSync,setDocuments:C.setDocuments,onSelectDocument:Y,onToggleTheme:()=>{k("dark"===S?"light":"dark")},currentTheme:S,onUpdateTags:C.handleUpdateTags}),(0,m.jsx)(bO,{state:P,onRequestAccess:O,onOpenChange:e=>{e||L()},onSignIn:w})]})};Object.defineProperty(exports,"Index",{enumerable:!0,get:function(){return wO}});