1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/worker-engine-BMhFn8Xf.js","assets/index-C07vmi2Q.js","assets/trucoAxios-Beh24t8i.js","assets/clinicalSiteSelection-C8_su46R.js","assets/chunk-JZWAC4HX-DJJ5eADP.js","assets/not_found-CIfm3S5x.js","assets/Integrations.variables-CPFSOL45.js","assets/index-CTowhCkP.js","assets/variables-BRJPNtug.js","assets/index-DDfnee-W.js","assets/dropdown-menu-CZnZ8KWd.js","assets/x-BIrYYYxn.js","assets/avatar-CCIawfUi.js","assets/search-DhtOc9In.js","assets/scroll-area-CY7J-tps.js","assets/Integrations.utils-D85Zetpl.js","assets/tooltip-BNa-lbEG.js","assets/CollaboratorAvatar-BAvyTsj1.js","assets/phone-CTlBVBdt.js","assets/activity-BW9wlDeu.js","assets/circle-check-C4wBSE-n.js","assets/index-CKB9C24I.js"])))=>i.map(i=>d[i]); 2var e,t,n,r,o,i,s,a,l,c,u,d,h,p,g,f,m,v,y,b,w,x,C,S,I,k,P,D,M,E,T,A,_,N,R,j,z,L,$,F,O,H,q,V,B,U,W,G,Z,K,Y,X,Q,J,ee,te,ne,re,oe,ie,se,ae,le,ce,ue,de,he,pe,ge,fe,me,ve,ye,be,we,xe,Ce,Se,Ie,ke,Pe,De,Me,Ee,Te,Ae,_e,Ne,Re,je,ze,Le,$e,Fe,Oe,He,qe,Ve,Be,Ue,We,Ge,Ze,Ke,Ye,Xe,Qe,Je,et,tt,nt,rt,ot,it,st,at,lt,ct,ut,dt,ht,pt,gt,ft,mt,vt,yt,bt,wt,xt,Ct,St,It,kt,Pt,Dt,Mt,Et,Tt,At,_t,Nt,Rt,jt,zt=Object.defineProperty,Lt=e=>{throw TypeError(e)},$t=(e,t,n)=>((e,t,n)=>t in e?zt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),Ft=(e,t,n)=>t.has(e)||Lt("Cannot "+n),Ot=(e,t,n)=>(Ft(e,t,"read from private field"),n?n.call(e):t.get(e)),Ht=(e,t,n)=>t.has(e)?Lt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),qt=(e,t,n,r)=>(Ft(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Vt=(e,t,n)=>(Ft(e,t,"access private method"),n);import{r as Bt,j as Ut,a as Wt}from"./index-C07vmi2Q.js";import{u as Gt,t as Zt}from"./trucoAxios-Beh24t8i.js";import{f as Kt}from"./clinicalSiteSelection-C8_su46R.js";import{c as Yt}from"./chunk-JZWAC4HX-DJJ5eADP.js";import{a as Xt,h as Qt,c as Jt,B as en}from"./not_found-CIfm3S5x.js";import{j as tn,m as nn,n as rn,k as on,D as sn,a as an,b as ln,c as cn,y as un,e as dn,_ as hn}from"./Integrations.variables-CPFSOL45.js";import{u as pn,P as gn,a as fn,c as mn,b as vn,i as yn,f as bn,m as wn}from"./index-CTowhCkP.js";import{S as xn,C as Cn}from"./search-DhtOc9In.js";import{r as Sn,w as In,y as kn,x as Pn,S as Dn,i as Mn,j as En,k as Tn,l as An,D as _n,a as Nn,b as Rn,A as jn,G as zn,H as Ln,g as $n,c as Fn,d as On,e as Hn,h as qn,P as Vn,m as Bn,n as Un,I as Wn}from"./dropdown-menu-CZnZ8KWd.js";import{u as Gn,a as Zn,b as Kn,c as Yn,s as Xn,S as Qn,d as Jn,e as er,f as tr,g as nr,h as rr}from"./scroll-area-CY7J-tps.js";import{e as or}from"./Integrations.utils-D85Zetpl.js";import{r as ir}from"./index-DDfnee-W.js";import{a as sr,b as ar,c as lr,d as cr}from"./tooltip-BNa-lbEG.js";import{g as ur,C as dr}from"./CollaboratorAvatar-BAvyTsj1.js";import{A as hr}from"./activity-BW9wlDeu.js";import{C as pr}from"./circle-check-C4wBSE-n.js";const gr=Xt("flag",[["path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z",key:"i9b6wo"}],["line",{x1:"4",x2:"4",y1:"22",y2:"15",key:"1cm3nv"}]]),fr=Xt("user-cog",[["path",{d:"M10 15H6a4 4 0 0 0-4 4v2",key:"1nfge6"}],["path",{d:"m14.305 16.53.923-.382",key:"1itpsq"}],["path",{d:"m15.228 13.852-.923-.383",key:"eplpkm"}],["path",{d:"m16.852 12.228-.383-.923",key:"13v3q0"}],["path",{d:"m16.852 17.772-.383.924",key:"1i8mnm"}],["path",{d:"m19.148 12.228.383-.923",key:"1q8j1v"}],["path",{d:"m19.53 18.696-.382-.924",key:"vk1qj3"}],["path",{d:"m20.772 13.852.924-.383",key:"n880s0"}],["path",{d:"m20.772 16.148.924.383",key:"1g6xey"}],["circle",{cx:"18",cy:"15",r:"3",key:"gjjjvw"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),mr=Xt("workflow",[["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"}]]);var vr=.999,yr=/[\\\/_+.#"@\[\(\{&]/,br=/[\\\/_+.#"@\[\(\{&]/g,wr=/[\s-]/,xr=/[\s-]/g;function Cr(e,t,n,r,o,i,s){if(i===t.length)return o===e.length?1:.99;var a=`${o},${i}`;if(void 0!==s[a])return s[a];for(var l,c,u,d,h=r.charAt(i),p=n.indexOf(h,o),g=0;p>=0;)(l=Cr(e,t,n,r,p+1,i+1,s))>g&&(p===o?l*=1:yr.test(e.charAt(p-1))?(l*=.8,(u=e.slice(o,p-1).match(br))&&o>0&&(l*=Math.pow(vr,u.length))):wr.test(e.charAt(p-1))?(l*=.9,(d=e.slice(o,p-1).match(xr))&&o>0&&(l*=Math.pow(vr,d.length))):(l*=.17,o>0&&(l*=Math.pow(vr,p-o))),e.charAt(p)!==t.charAt(i)&&(l*=.9999)),(l<.1&&n.charAt(p-1)===r.charAt(i+1)||r.charAt(i+1)===r.charAt(i)&&n.charAt(p-1)!==r.charAt(i))&&(.1*(c=Cr(e,t,n,r,p+1,i+2,s))>l&&(l=.1*c)),l>g&&(g=l),p=n.indexOf(h,p+1);return s[a]=g,g}function Sr(e){return e.toLowerCase().replace(xr," ")}function Ir(e,t,n){return Cr(e=n&&n.length>0?""+(e+" "+n.join(" ")):e,t,Sr(e),Sr(t),0,0,{})}var kr='[cmdk-group=""]',Pr='[cmdk-group-items=""]',Dr='[cmdk-item=""]',Mr=`${Dr}:not([aria-disabled="true"])`,Er="cmdk-item-select",Tr="data-value",Ar=(e,t,n)=>Ir(e,t,n),_r=Bt.createContext(void 0),Nr=()=>Bt.useContext(_r),Rr=Bt.createContext(void 0),jr=()=>Bt.useContext(Rr),zr=Bt.createContext(void 0),Lr=Bt.forwardRef((e,t)=>
2{let n=Xr(()=>{var t,n;return{search:"",value:null!=(n=null!=(t=e.value)?t:e.defaultValue)?n:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Xr(()=>new Set),o=Xr(()=>new Map),i=Xr(()=>new Map),s=Xr(()=>new Set),a=Kr(e),{label:l,children:c,value:u,onValueChange:d,filter:h,shouldFilter:p,loop:g,disablePointerSelection:f=!1,vimBindings:m=!0,...v}=e,y=pn(),b=pn(),w=pn(),x=Bt.useRef(null),C=eo();Yr(()=>{if(void 0!==u){let e=u.trim();n.current.value=e,S.emit()}},[u]),Yr(()=>{C(6,E)},[]);let S=Bt.useMemo(()=>({subscribe:e=>(s.current.add(e),()=>s.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var o,i,s,l;if(!Object.is(n.current[e],t)){if(n.current[e]=t,"search"===e)M(),P(),C(1,D);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(w);e?e.focus():null==(o=document.getElementById(y))||o.focus()}if(C(7,()=>{var e;n.current.selectedItemId=null==(e=T())?void 0:e.id,S.emit()}),r||C(5,E),void 0!==(null==(i=a.current)?void 0:i.value)){let e=null!=t?t:"";return void(null==(l=(s=a.current).onValueChange)||l.call(s,e))}}S.emit()}},emit:()=>{s.current.forEach(e=>e())}}),[]),I=Bt.useMemo(()=>({value:(e,t,r)=>{var o;t!==(null==(o=i.current.get(e))?void 0:o.value)&&(i.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,k(t,r)),C(2,()=>{P(),S.emit()}))},item:(e,t)=>(r.current.add(e),t&&(o.current.has(t)?o.current.get(t).add(e):o.current.set(t,new Set([e]))),C(3,()=>{M(),P(),n.current.value||D(),S.emit()}),()=>{i.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=T();C(4,()=>{M(),(null==t?void 0:t.getAttribute("id"))===e&&D(),S.emit()})}),group:e=>(o.current.has(e)||o.current.set(e,new Set),()=>{i.current.delete(e),o.current.delete(e)}),filter:()=>a.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>a.current.disablePointerSelection,listId:y,inputId:w,labelId:b,listInnerRef:x}),[]);function k(e,t){var r,o;let i=null!=(o=null==(r=a.current)?void 0:r.filter)?o:Ar;return e?i(e,n.current.search,t):0}function P(){if(!n.current.search||!1===a.current.shouldFilter)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=o.current.get(n),i=0;r.forEach(t=>{let n=e.get(t);i=Math.max(n,i)}),t.push([n,i])});let r=x.current;A().sort((t,n)=>{var r,o;let i=t.getAttribute("id"),s=n.getAttribute("id");return(null!=(r=e.get(s))?r:0)-(null!=(o=e.get(i))?o:0)}).forEach(e=>{let t=e.closest(Pr);t?t.appendChild(e.parentElement===t?e:e.closest(`${Pr} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${Pr} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let n=null==(t=x.current)?void 0:t.querySelector(`${kr}[${Tr}="${encodeURIComponent(e[0])}"]`);null==n||n.parentElement.appendChild(n)})}function D(){let e=A().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(Tr);S.setState("value",t||void 0)}function M(){var e,t,s,l;if(!n.current.search||!1===a.current.shouldFilter)return void(n.current.filtered.count=r.current.size);n.current.filtered.groups=new Set;let c=0;for(let o of r.current){let r=k(null!=(t=null==(e=i.current.get(o))?void 0:e.value)?t:"",null!=(l=null==(s=i.current.get(o))?void 0:s.keywords)?l:[]);n.current.filtered.items.set(o,r),r>0&&c++}for(let[r,i]of o.current)for(let e of i)if(n.current.filtered.items.get(e)>0){n.current.filtered.groups.add(r);break}n.current.filtered.count=c}function E(){var e,t,n;let r=T();r&&((null==(e=r.parentElement)?void 0:e.firstChild)===r&&(null==(n=null==(t=r.closest(kr))?void 0:t.querySelector('[cmdk-group-heading=""]'))||n.scrollIntoView({block:"nearest"})),r.scrollIntoView({block:"nearest"}))}function T(){var e;return null==(e=x.current)?void 0:e.querySelector(`${Dr}[aria-selected="true"]`)}function A(){var e;return Array.from((null==(e=x.current)?void 0:e.querySelectorAll(Mr))||[])}function _(e){let t=A()[e];t&&S.setState("value",t.getAttribute(Tr))}function N(e){var t;let n=T(),r=A(),o=r.findIndex(e=>e===n),i=r[o+e];null!=(t=a.current)&&t.loop&&(i=o+e<0?r[r.length-1]:o+e===r.length?r[0]:r[o+e]),i&&S.setState("value",i.getAttribute(Tr))}function R(e){let t,n=T(),r=null==n?void 0:n.closest(kr);for(;r&&!t;)r=e>0?Gr(r,kr):Zr(r,kr),t=null==r?void 0:r.querySelector(Mr);t?S.setState("value",t.getAttribute(Tr)):N(e)}let j=()=>_(A().length-1),z=e=>{e.preventDefault(),e.metaKey?j():e.altKey?R(1):N(1)},L=e=>{e.preventDefault(),e.metaKey?_(0):e.altKey?R(-1):N(-1)};return Bt.createElement(gn.div,{ref:t,tabIndex:-1,...v,"cmdk-root":"",onKeyDown:e=>{var t;null==(t=v.onKeyDown)||t.call(v,e);let n=e.nativeEvent.isComposing||229===e.keyCode;if(!e.defaultPrevented&&!n)switch(e.key){case"n":case"j":m&&e.ctrlKey&&z(e);break;case"ArrowDown":z(e);break;case"p":case"k":m&&e.ctrlKey&&L(e);break;case"ArrowUp":L(e);break;case"Home":e.preventDefault(),_(0);break;case"End":e.preventDefault(),j();break;case"Enter":{e.preventDefault();let t=T();if(t){let e=new Event(Er);t.dispatchEvent(e)}}}}},Bt.createElement("label",{"cmdk-label":"",htmlFor:I.inputId,id:I.labelId,style:no},l),to(e,e=>Bt.createElement(Rr.Provider,{value:S},Bt.createElement(_r.Provider,{value:I},e))))}),$r=Bt.forwardRef((e,t)=>
2{var n,r;let o=pn(),i=Bt.useRef(null),s=Bt.useContext(zr),a=Nr(),l=Kr(e),c=null!=(r=null==(n=l.current)?void 0:n.forceMount)?r:null==s?void 0:s.forceMount;Yr(()=>{if(!c)return a.item(o,null==s?void 0:s.id)},[c]);let u=Jr(o,i,[e.value,e.children,i],e.keywords),d=jr(),h=Qr(e=>e.value&&e.value===u.current),p=Qr(e=>!(!c&&!1!==a.filter())||(!e.search||e.filtered.items.get(o)>0));function g(){var e,t;f(),null==(t=(e=l.current).onSelect)||t.call(e,u.current)}function f(){d.setState("value",u.current,!0)}if(Bt.useEffect(()=>{let t=i.current;if(t&&!e.disabled)return t.addEventListener(Er,g),()=>t.removeEventListener(Er,g)},[p,e.onSelect,e.disabled]),!p)return null;let{disabled:m,value:v,onSelect:y,forceMount:b,keywords:w,...x}=e;return Bt.createElement(gn.div,{ref:Qt(i,t),...x,id:o,"cmdk-item":"",role:"option","aria-disabled":!!m,"aria-selected":!!h,"data-disabled":!!m,"data-selected":!!h,onPointerMove:m||a.getDisablePointerSelection()?void 0:f,onClick:m?void 0:g},e.children)}),Fr=Bt.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:o,...i}=e,s=pn(),a=Bt.useRef(null),l=Bt.useRef(null),c=pn(),u=Nr(),d=Qr(e=>!(!o&&!1!==u.filter())||(!e.search||e.filtered.groups.has(s)));Yr(()=>u.group(s),[]),Jr(s,a,[e.value,e.heading,l]);let h=Bt.useMemo(()=>({id:s,forceMount:o}),[o]);return Bt.createElement(gn.div,{ref:Qt(a,t),...i,"cmdk-group":"",role:"presentation",hidden:!d||void 0},n&&Bt.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:c},n),to(e,e=>Bt.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?c:void 0},Bt.createElement(zr.Provider,{value:h},e))))}),Or=Bt.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,o=Bt.useRef(null),i=Qr(e=>!e.search);return n||i?Bt.createElement(gn.div,{ref:Qt(o,t),...r,"cmdk-separator":"",role:"separator"}):null}),Hr=Bt.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,o=null!=e.value,i=jr(),s=Qr(e=>e.search),a=Qr(e=>e.selectedItemId),l=Nr();return Bt.useEffect(()=>{null!=e.value&&i.setState("search",e.value)},[e.value]),Bt.createElement(gn.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":a,id:l.inputId,type:"text",value:o?e.value:s,onChange:e=>{o||i.setState("search",e.target.value),null==n||n(e.target.value)}})}),qr=Bt.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,i=Bt.useRef(null),s=Bt.useRef(null),a=Qr(e=>e.selectedItemId),l=Nr();return Bt.useEffect(()=>{if(s.current&&i.current){let e,t=s.current,n=i.current,r=new ResizeObserver(()=>{e=requestAnimationFrame(()=>{let e=t.offsetHeight;n.style.setProperty("--cmdk-list-height",e.toFixed(1)+"px")})});return r.observe(t),()=>{cancelAnimationFrame(e),r.unobserve(t)}}},[]),Bt.createElement(gn.div,{ref:Qt(i,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":r,id:l.listId},to(e,e=>Bt.createElement("div",{ref:Qt(s,l.listInnerRef),"cmdk-list-sizer":""},e)))}),Vr=Bt.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:i,container:s,...a}=e;return Bt.createElement(tn,{open:n,onOpenChange:r},Bt.createElement(nn,{container:s},Bt.createElement(rn,{"cmdk-overlay":"",className:o}),Bt.createElement(on,{"aria-label":e.label,"cmdk-dialog":"",className:i},Bt.createElement(Lr,{ref:t,...a}))))}),Br=Bt.forwardRef((e,t)=>Qr(e=>0===e.filtered.count)?Bt.createElement(gn.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Ur=Bt.forwardRef((e,t)=>{let{progress:n,children:r,label:o="Loading...",...i}=e;return Bt.createElement(gn.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},to(e,e=>Bt.createElement("div",{"aria-hidden":!0},e)))}),Wr=Object.assign(Lr,{List:qr,Item:$r,Input:Hr,Group:Fr,Separator:Or,Dialog:Vr,Empty:Br,Loading:Ur});function Gr(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Zr(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Kr(e){let t=Bt.useRef(e);return Yr(()=>{t.current=e}),t}var Yr="undefined"==typeof window?Bt.useEffect:Bt.useLayoutEffect;function Xr(e){let t=Bt.useRef();return void 0===t.current&&(t.current=e()),t}function Qr(e){let t=jr(),n=()=>e(t.snapshot());return Bt.useSyncExternalStore(t.subscribe,n,n)}function Jr(e,t,n,r=[]){let o=Bt.useRef(),i=Nr();return Yr(()=>{var s;let a=(()=>{var e;
2for(let t of n){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():o.current}})(),l=r.map(e=>e.trim());i.value(e,a,l),null==(s=t.current)||s.setAttribute(Tr,a),o.current=a}),o}var eo=()=>{let[e,t]=Bt.useState(),n=Xr(()=>new Map);return Yr(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function to({asChild:e,children:t},n){return e&&Bt.isValidElement(t)?Bt.cloneElement(function(e){let t=e.type;return"function"==typeof t?t(e.props):"render"in t?t.render(e.props):e}(t),{ref:t.ref},n(t.props.children)):n(t)}var no={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function ro({className:e,...t}){return Ut.jsx(Wr,{"data-slot":"command",className:Jt("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function oo({className:e,...t}){return Ut.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[Ut.jsx(xn,{className:"size-4 shrink-0 opacity-50"}),Ut.jsx(Wr.Input,{"data-slot":"command-input",className:Jt("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...t})]})}function io({className:e,...t}){return Ut.jsx(Wr.List,{"data-slot":"command-list",className:Jt("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function so({...e}){return Ut.jsx(Wr.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function ao({className:e,...t}){return Ut.jsx(Wr.Group,{"data-slot":"command-group",className:Jt("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}function lo({className:e,...t}){return Ut.jsx(Wr.Item,{"data-slot":"command-item",className:Jt("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}var co="horizontal",uo=["horizontal","vertical"],ho=Bt.forwardRef((e,t)=>{const{decorative:n,orientation:r=co,...o}=e,i=function(e){return uo.includes(e)}(r)?r:co,s=n?{role:"none"}:{"aria-orientation":"vertical"===i?i:void 0,role:"separator"};return Ut.jsx(gn.div,{"data-orientation":i,...s,...o,ref:t})});ho.displayName="Separator";var po=ho;function go({className:e,orientation:t="horizontal",decorative:n=!0,...r}){return Ut.jsx(po,{"data-slot":"separator",decorative:n,orientation:t,className:Jt("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:min-h-full data-[orientation=vertical]:w-px","horizontal"===t&&"my-4",e),...r})}var fo="Tabs",[mo]=yn(fo,[Pn]),vo=Pn(),[yo,bo]=mo(fo),wo=Bt.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:l="automatic",...c}=e,u=Sn(a),[d,h]=fn({prop:r,onChange:o,defaultProp:i??"",caller:fo});return Ut.jsx(yo,{scope:n,baseId:pn(),value:d,onValueChange:h,orientation:s,dir:u,activationMode:l,children:Ut.jsx(gn.div,{dir:u,"data-orientation":s,...c,ref:t})})});wo.displayName=fo;var xo="TabsList",Co=Bt.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=bo(xo,n),s=vo(n);return Ut.jsx(In,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:r,children:Ut.jsx(gn.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});Co.displayName=xo;var So="TabsTrigger",Io=Bt.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=bo(So,n),a=vo(n),l=Do(s.baseId,r),c=Mo(s.baseId,r),u=r===s.value;return Ut.jsx(kn,{asChild:!0,...a,focusable:!o,active:u,children:Ut.jsx(gn.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:l,...i,ref:t,onMouseDown:mn(e.onMouseDown,e=>{o||0!==e.button||!1!==e.ctrlKey?e.preventDefault():s.onValueChange(r)}),onKeyDown:mn(e.onKeyDown,e=>
2{[" ","Enter"].includes(e.key)&&s.onValueChange(r)}),onFocus:mn(e.onFocus,()=>{const e="manual"!==s.activationMode;u||o||!e||s.onValueChange(r)})})})});Io.displayName=So;var ko="TabsContent",Po=Bt.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=bo(ko,n),l=Do(a.baseId,r),c=Mo(a.baseId,r),u=r===a.value,d=Bt.useRef(u);return Bt.useEffect(()=>{const e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),Ut.jsx(vn,{present:o||u,children:({present:n})=>Ut.jsx(gn.div,{"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!n,id:c,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:n&&i})})});function Do(e,t){return`${e}-trigger-${t}`}function Mo(e,t){return`${e}-content-${t}`}Po.displayName=ko;var Eo=wo,To=Co,Ao=Io,_o=Po;function No({className:e,...t}){return Ut.jsx(Eo,{"data-slot":"tabs",className:Jt("flex flex-col gap-2",e),...t})}function Ro({className:e,...t}){return Ut.jsx(To,{"data-slot":"tabs-list",className:Jt("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function jo({className:e,...t}){return Ut.jsx(Ao,{"data-slot":"tabs-trigger",className:Jt("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md 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 zo({className:e,...t}){return Ut.jsx(_o,{"data-slot":"tabs-content",className:Jt("flex-1 outline-none",e),...t})}const Lo=Bt.forwardRef(function(e,t){const{render:n,className:r,style:o,...i}=e,{computeThumbPosition:s}=Gn(),{hasMeasuredScrollbar:a,viewportState:l}=Zn(),c=Bt.useRef(null),u=Bt.useRef(a);Kn(()=>{if("undefined"==typeof ResizeObserver)return;let e=!1;const t=new ResizeObserver(()=>{(e||(e=!0,u.current))&&s()});return c.current&&t.observe(c.current),()=>{t.disconnect()}},[s]);return Yn("div",e,{ref:[t,c],state:l,stateAttributesMapping:Xn,props:[{role:"presentation",style:{minWidth:"fit-content"}},i]})});async function $o(){const e=(await Zt.get("/clinical_sites/structure")).data.data??[],[t,n]=await Promise.allSettled([Zt.get("/studies",{params:{page:1,pageSize:1e3}}),Zt.get("/sites",{params:{page:1,pageSize:1e3}})]);return"fulfilled"!==t.status||"fulfilled"!==n.status?e:function(e,t,n){const r=new Set;for(const i of e)for(const e of i.studies)for(const t of e.sites)r.add(t._id),r.add(t.siteId);const o=new Map;for(const i of n){if(!i.studyId||r.has(i._id))continue;const e=i.studyId,n=t.find(t=>Ho(t,e));if(!n)continue;const s=Oo(i),a=i.clinicalSiteId??`site:${s}`,l=o.get(s)??{_id:a,clinicalSiteId:a,name:i.name??s,studies:[]},c=l.studies.find(e=>e._id===n._id||e.studyId===(n.studyId??n._id))??{_id:n._id,studyId:n.studyId??n._id,name:n.name,sites:[]};c.sites.some(e=>e._id===i._id)||c.sites.push({_id:i._id,siteId:i.siteId??i._id,name:i.name}),l.studies.some(e=>e._id===c._id)||l.studies.push(c),o.set(s,l)}return[...e,...Array.from(o.values())]}(e,t.value.data.data??[],n.value.data.data??[])}function Fo(e,t){const n=null==e?void 0:e[t];return"string"==typeof n&&n.trim()?n.trim():void 0}function Oo(e){var t;return e.clinicalSiteId??Fo(e.customFields,"eclinpro_site_id")??Fo(e.customFields,"castor_site_id")??Fo(e.customFields,"medidata_rave_site_id")??(null==(t=e.name)?void 0:t.trim().toLowerCase())??e._id}function Ho(e,t){return Boolean(e&&(e._id===t||e.studyId===t))}const qo=Bt.createContext(null);function Vo({children:e,enabled:t}){var n;const r=Yt(),{clinicalSites:o,loading:i,error:s}=function(e=!0){const t=Gt({queryKey:["clinical-sites","structure"],queryFn:$o,enabled:e});return{clinicalSites:t.data??[],loading:t.isLoading,error:t.error}}(t),[a,l]=Bt.useState(null),c=null==(n=r.pathname.match(/^\/clinical\/sites\/([^/]+)\/studies\/[^/]+/))?void 0:n[1],u=Bt.useMemo(()=>{const e=c?Kt(o,decodeURIComponent(c)):null;return c?e:(a?Kt(o,a):null)??o[0]??null},[o,c,a]),d=Bt.useMemo(()=>({clinicalSites:o,selectedClinicalSite:u,selectClinicalSite:l,loading:i,error:s}),[o,s,i,u]);return Ut.jsx(qo.Provider,{value:d,children:e})}function Bo(){const e=Bt.useContext(qo);if(!e)throw new Error("useClinicalSiteNavigation must be used inside ClinicalSiteNavigationProvider");return e}const Uo=[["path",{d:"M18 9.00005C18 9.00005 13.5811 15 12 15C10.4188 15 6 9 6 9",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}]],Wo=[["path",{d:"M15 6C15 6 9.00001 10.4189 9 12C8.99999 13.5812 15 18 15 18",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}]],Go=[["path",{d:"M9.00005 6C9.00005 6 15 10.4189 15 12C15 13.5812 9 18 9 18",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}]],Zo=[["path",{d:"M17.9998 15C17.9998 15 13.5809 9.00001 11.9998 9C10.4187 8.99999 5.99985 15 5.99985 15",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}]],Ko=[["path",{d:"M16 2V6M8 2V6",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}],["path",{d:"M13 4H11C7.22876 4 5.34315 4 4.17157 5.17157C3 6.34315 3 8.22876 3 12V14C3 17.7712 3 19.6569 4.17157 20.8284C5.34315 22 7.22876 22 11 22H13C16.7712 22 18.6569 22 19.8284 20.8284C21 19.6569 21 17.7712 21 14V12C21 8.22876 21 6.34315 19.8284 5.17157C18.6569 4 16.7712 4 13 4Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}],["path",{d:"M3 10H21",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"2"}],["path",{d:"M12.1258 14H12.0008M12.1258 18H12.0008M7.625 14H7.5M7.625 18H7.5M16.625 14H16.5M12.2508 14C12.2508 14.1381 12.1389 14.25 12.0008 14.25C11.8628 14.25 11.7508 14.1381 11.7508 14C11.7508 13.8619 11.8628 13.75 12.0008 13.75C12.1389 13.75 12.2508 13.8619 12.2508 14ZM12.2508 18C12.2508 18.1381 12.1389 18.25 12.0008 18.25C11.8628 18.25 11.7508 18.1381 11.7508 18C11.7508 17.8619 11.8628 17.75 12.0008 17.75C12.1389 17.75 12.2508 17.8619 12.2508 18ZM7.75 14C7.75 14.1381 7.63807 14.25 7.5 14.25C7.36193 14.25 7.25 14.1381 7.25 14C7.25 13.8619 7.36193 13.75 7.5 13.75C7.63807 13.75 7.75 13.8619 7.75 14ZM7.75 18C7.75 18.1381 7.63807 18.25 7.5 18.25C7.36193 18.25 7.25 18.1381 7.25 18C7.25 17.8619 7.36193 17.75 7.5 17.75C7.63807 17.75 7.75 17.8619 7.75 18ZM16.75 14C16.75 14.1381 16.6381 14.25 16.5 14.25C16.3619 14.25 16.25 14.1381 16.25 14C16.25 13.8619 16.3619 13.75 16.5 13.75C16.6381 13.75 16.75 13.8619 16.75 14Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"3"}]],Yo=[["path",{d:"M18 6L6.00081 17.9992M17.9992 18L6 6.00085",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}]],Xo=[["path",{d:"M2.99969 17.0002C2.99969 17.9302 2.99969 18.3952 3.10192 18.7767C3.37932 19.8119 4.18796 20.6206 5.22324 20.898C5.60474 21.0002 6.06972 21.0002 6.99969 21.0002L16.9997 21.0002C17.9297 21.0002 18.3947 21.0002 18.7762 20.898C19.8114 20.6206 20.6201 19.8119 20.8975 18.7767C20.9997 18.3952 20.9997 17.9302 20.9997 17.0002",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}],["path",{d:"M16.4998 11.5002C16.4998 11.5002 13.1856 16.0002 11.9997 16.0002C10.8139 16.0002 7.49976 11.5002 7.49976 11.5002M11.9997 15.0002V3.00016",
2stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}]],Qo=[["path",{d:"M8 7L16 7",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}],["path",{d:"M8 11L12 11",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}],["path",{d:"M13 21.5V21C13 18.1716 13 16.7574 13.8787 15.8787C14.7574 15 16.1716 15 19 15H19.5M20 13.3431V10C20 6.22876 20 4.34315 18.8284 3.17157C17.6569 2 15.7712 2 12 2C8.22877 2 6.34315 2 5.17157 3.17157C4 4.34314 4 6.22876 4 10L4 14.5442C4 17.7892 4 19.4117 4.88607 20.5107C5.06508 20.7327 5.26731 20.9349 5.48933 21.1139C6.58831 22 8.21082 22 11.4558 22C12.1614 22 12.5141 22 12.8372 21.886C12.9044 21.8623 12.9702 21.835 13.0345 21.8043C13.3436 21.6564 13.593 21.407 14.0919 20.9081L18.8284 16.1716C19.4065 15.5935 19.6955 15.3045 19.8478 14.9369C20 14.5694 20 14.1606 20 13.3431Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"2"}]],Jo=[["path",{d:"M8.85746 12.5061C6.36901 10.6456 4.59564 8.59915 3.62734 7.44867C3.3276 7.09253 3.22938 6.8319 3.17033 6.3728C2.96811 4.8008 2.86701 4.0148 3.32795 3.5074C3.7889 3 4.60404 3 6.23433 3H17.7657C19.396 3 20.2111 3 20.672 3.5074C21.133 4.0148 21.0319 4.8008 20.8297 6.37281C20.7706 6.83191 20.6724 7.09254 20.3726 7.44867C19.403 8.60062 17.6261 10.6507 15.1326 12.5135C14.907 12.6821 14.7583 12.9567 14.7307 13.2614C14.4837 15.992 14.2559 17.4876 14.1141 18.2442C13.8853 19.4657 12.1532 20.2006 11.226 20.8563C10.6741 21.2466 10.0043 20.782 9.93278 20.1778C9.79643 19.0261 9.53961 16.6864 9.25927 13.2614C9.23409 12.9539 9.08486 12.6761 8.85746 12.5061Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}]],ei=[["path",{d:"M16 12H8",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}],["circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"1.5",key:"1"}]],ti=[["path",{d:"M6.00449 12.5V12M18.0045 12.5V12M12.0045 12.5V12M7.00449 12.5C7.00449 11.9477 6.55677 11.5 6.00449 11.5C5.4522 11.5 5.00449 11.9477 5.00449 12.5C5.00449 13.0523 5.4522 13.5 6.00449 13.5C6.55677 13.5 7.00449 13.0523 7.00449 12.5ZM19.0045 12.5C19.0045 11.9477 18.5568 11.5 18.0045 11.5C17.4522 11.5 17.0045 11.9477 17.0045 12.5C17.0045 13.0523 17.4522
213.5 18.0045 13.5C18.5568 13.5 19.0045 13.0523 19.0045 12.5ZM13.0045 12.5C13.0045 11.9477 12.5568 11.5 12.0045 11.5C11.4522 11.5 11.0045 11.9477 11.0045 12.5C11.0045 13.0523 11.4522 13.5 12.0045 13.5C12.5568 13.5 13.0045 13.0523 13.0045 12.5Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}]],ni=[["path",{d:"M11.9967 12.5V12M11.9967 6.5V6M11.9967 18.5V18M12.9967 12.5C12.9967 11.9477 12.549 11.5 11.9967 11.5C11.4444 11.5 10.9967 11.9477 10.9967 12.5C10.9967 13.0523 11.4444 13.5 11.9967 13.5C12.549 13.5 12.9967 13.0523 12.9967 12.5ZM12.9967 6.5C12.9967 5.94772 12.549 5.5 11.9967 5.5C11.4444 5.5 10.9967 5.94772 10.9967 6.5C10.9967 7.05228 11.4444 7.5 11.9967 7.5C12.549 7.5 12.9967 7.05228 12.9967 6.5ZM12.9967 18.5C12.9967 17.9477 12.549 17.5 11.9967 17.5C11.4444 17.5 10.9967 17.9477 10.9967 18.5C10.9967 19.0523 11.4444 19.5 11.9967 19.5C12.549 19.5 12.9967 19.0523 12.9967 18.5Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}]],ri=[["path",{d:"M12 8V16M16 12H8",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}],["circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"1.5",key:"1"}]],oi=[["path",{d:"M4 2V5.13219C4 5.42605 4.36724 5.55908 4.55527 5.33333C6.3854 3.2875 9.04499 2 12.0051 2C17.5251 2 22 6.47715 22 12C22 15.9582 19.7015 19.3793 16.367 21",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}],["path",{d:"M11.7347 22.0001C12.2016 22.0001 12.6611 21.9688 13.1111 21.9084M2.26537 8.66675C2.15297 9.06394 2.06477 9.46536 2 9.86901M2.03457 13.5381C2.10487 13.9381 2.19644 14.3343 2.30852 14.7245M3.83292 17.9963C4.07124 18.3497 4.3296 18.69 4.6071 19.0147M7.42857 21.3607C7.78228 21.5632 8.15042 21.7464 8.53228 21.9084",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}]],ii=[["path",{d:"M17 17L21 21",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}],["path",{d:"M19 11C19 6.58172 15.4183 3 11 3C6.58172 3 3 6.58172 3 11C3 15.4183 6.58172 19 11 19C15.4183 19 19 15.4183 19 11Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}]],si=[["path",{d:"M2 12C2 8.31087 2 6.4663 2.81382 5.15877C3.1149 4.67502 3.48891 4.25427 3.91891 3.91554C5.08116 3 6.72077 3 10 3H14C17.2792 3 18.9188 3 20.0811 3.91554C20.5111 4.25427 20.8851 4.67502 21.1862 5.15877C22 6.4663 22 8.31087 22 12C22 15.6891 22 17.5337 21.1862 18.8412C20.8851 19.325 20.5111 19.7457 20.0811 20.0845C18.9188 21 17.2792 21 14 21H10C6.72077 21 5.08116 21 3.91891 20.0845C3.48891 19.7457 3.1149 19.325 2.81382 18.8412C2 17.5337 2 15.6891 2 12Z",stroke:"currentColor",strokeWidth:"1.5",key:"0"}],["path",{d:"M9.5 3L9.5 21",stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}],["path",{d:"M5 7H6M5 10H6",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"2"}]],ai=[["path",{d:"M5 14L8.5 17.5L19 6.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}]],li=[["path",{d:"M2.99994 17C2.99994 17.93 2.99994 18.395 3.10216 18.7765C3.37956 19.8117 4.18821 20.6204 5.22348 20.8978C5.60498 21 6.06997 21 6.99994 21L16.9999 21C17.9299 21 18.3949 21 18.7764 20.8978C19.8117 20.6204 20.6203 19.8117 20.8977 18.7765C20.9999 18.395 20.9999 17.93 20.9999 17",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}],["path",{d:"M16.5 7.49993C16.5 7.49993 13.1858 2.99997 12 2.99996C10.8141 2.99995 7.50002 7.49996 7.50002 7.49996M12 3.99996V16",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}]],ci={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none"},ui=Bt.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n,absoluteStrokeWidth:r=!1,className:o="",altIcon:i,showAlt:s=!1,icon:a,primaryColor:l,secondaryColor:c,disableSecondaryOpacity:u=!1,...d},h)=>{const p=void 0!==n?r?24*Number(n)/Number(t):n:void 0,g=void 0!==p?{strokeWidth:p,stroke:"currentColor"}:{},f={ref:h,...ci,width:t,height:t,color:l||e,className:o,...g,...d},m=[...s&&i?i:a].sort(([,e],[,t])=>{const n=void 0!==e.opacity;return void 0!==t.opacity?1:n?-1:0}).map(([t,n])=>{const r=void 0!==n.opacity,o=r&&!u?n.opacity:void 0,i=c?{...void 0!==n.stroke?{stroke:r?c:l||e}:{fill:r?c:l||e}}:{};return Bt.createElement(t,{...n,...g,...i,opacity:o,key:n.key})});return Bt.createElement("svg",f,m)});ui.displayName="HugeiconsIcon";const di='<svg data-icon-sprite aria-hidden="true" width="0" height="0">
2\n <symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">\n <path d="M12.4697 5.46973C12.7626 5.17684 13.2374 5.17684 13.5303 5.46973C13.8232 5.76262 13.8232 6.23738 13.5303 6.53028L8.53028 11.5303C8.23738 11.8232 7.76262 11.8232 7.46973 11.5303L2.46973 6.53028C2.17684 6.23738 2.17684 5.76262 2.46973 5.46973C2.76262 5.17684 3.23738 5.17684 3.53028 5.46973L8 9.93946L12.4697 5.46973Z" fill="currentcolor"/>\n </symbol>\n <symbol id="file-tree-icon-dot" viewBox="0 0 6 6">\n <circle cx="3" cy="3" r="3" />\n </symbol>\n <symbol id="file-tree-icon-file" viewBox="0 0 16 16">\n <path fill="currentColor" d="M8 1v3a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1z" class="bg" opacity=".5"/>\n <path fill="currentColor" d="M9.5 1a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z" class="fg"/>\n </symbol>\n <symbol id="file-tree-icon-lock" viewBox="0 0 16 16">\n <path fill="currentcolor" d="M4 5.336V4a4 4 0 1 1 8 0v1.336c1.586.54 2 1.843 2 4.664v1c0 4.118-.883 5-5 5H7c-4.117 0-5-.883-5-5v-1c0-2.821.414-4.124 2-4.664M5.5 4v1.054Q6.166 4.998 7 5h2q.834-.002 1.5.054V4a2.5 2.5 0 0 0-5 0m-2 6v1c0 .995.055 1.692.167 2.193.107.483.246.686.35.79s.307.243.79.35c.5.112 1.198.167 2.193.167h2c.995 0 1.692-.055 2.193-.166.483-.108.686-.247.79-.35.104-.105.243-.308.35-.791.112-.5.167-1.198.167-2.193v-1c0-.995-.055-1.692-.166-2.193-.108-.483-.247-.686-.35-.79-.105-.104-.308-.243-.791-.35C10.693 6.555 9.995 6.5 9 6.5H7c-.995 0-1.692.055-2.193.167-.483.107-.686.246-.79.35s-.243.307-.35.79C3.555 8.307 3.5 9.005 3.5 10" />\n </symbol>\n <symbol id="file-tree-icon-ellipsis" viewBox="0 0 16 16">\n <path d="M5 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M9.5 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M14 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0" />\n </symbol>\n</svg>
2',hi=['<symbol id="file-tree-builtin-astro" viewBox="0 0 16 16">\n <path fill="currentColor" d="M6.08 13.92c-.63-.57-.81-1.79-.55-2.67.45.56 1.08.73 1.73.83 1 .15 1.99.1 2.92-.37l.32-.19q.13.38.08.78a2.1 2.1 0 0 1-.9 1.5q-.3.24-.61.43c-.64.44-.81.95-.57 1.69l.02.08a1.7 1.7 0 0 1-.74-.64 2 2 0 0 1-.3-.98q0-.27-.02-.52-.07-.61-.61-.62a.7.7 0 0 0-.75.6z" class="bg" opacity=".6"/>\n <path fill="currentColor" d="M2.5 11.1s1.86-.9 3.72-.9l1.4-4.39c.05-.21.2-.36.38-.36s.33.15.38.36l1.4 4.38c2.2 0 3.72.92 3.72.92l-3.16-8.69q-.13-.4-.45-.42H6.11q-.3.02-.45.42z" class="fg"/>\n</symbol>','<symbol id="file-tree-builtin-babel" viewBox="0 0 16 16">\n <path fill="currentColor" fill-rule="evenodd" d="M9.49.5q1.92.05 2.66.54 1.27.6 1.35 1.52v.23a4 4 0 0 1-.53 1.9l-1.38 1.24q-.74.38-.72.63c.77.82 1.33 1.29.85 2.42q-.47 1.1-2.04 2.28c-.5.32-1.88 1.35-2.96 1.86-1.64.77-3.1 1.4-4.65 1.89-.51.16-1.5.16-1.5.16L.5 15A76 76 0 0 0 5.76 3.49q-.1-.08-.1-.2.1 0 .32-.35l-.03-.09q-1.17.39-2.38 1.3l-.13.03q0-.1-.21-.16-.46.31-.82.7l-.13-.19.16-.06-.03-.16-.34.29L2 4.5q.36-.48.72-.54l.04-.1V3.8q.16 0 .15-.06l.13-.06a6 6 0 0 0 1.13-.9v-.03H4.1l-.12.07q0-.1-.1-.1l-.15.07-.04-.1q.93-.52 1.63-1.05Q7.89.65 9.5.5M8.46 7.83l-.32.04c-1.31.54-2.31.82-2.91.88a71 71 0 0 0-2.2 4.54h.07q.58-.04 3.04-1.42.13 0 1.66-1.05L9.18 9.7v.03q.45-.2.81-1.3v-.2q-.5-.46-1.53-.4m.28-5.75c-.5.1-.75.19-.72.38l-1.16 2.6q-.17.1-.34.95-.3.48-.25.77v.1l.22.05A15 15 0 0 1 8.86 6c1.1-.71 2.12-1.38 2.8-2.54q.24-.33.21-.54-.02-.33-.4-.54c-.54 0-1.07-.34-1.63-.28l-.94-.03z" clip-rule="evenodd"/>\n</symbol>','<symbol id="file-tree-builtin-biome" viewBox="0 0 16 16">\n <path fill="currentColor" d="M8 2 4.88 7.35a7 7 0 0 1 3.7-.13l1.04.25-.99 4.16-1.05-.25a2.7 2.7 0 0 0-3.07 1.45l-.98-.47a4 4 0 0 1 1.07-1.31 3.8 3.8 0 0 1 3.23-.71l.5-2.08a6 6 0 0 0-5.07 1.12A5.9 5.9 0 0 0 1 14h14z"/>\n</symbol>','<symbol id="file-tree-builtin-bootstrap" viewBox="0 0 16 16">\n <path fill="currentColor" fill-rule="evenodd" d="M11.72 1.5A2.5 2.5 0 0 1 14.2 4q.02 1.08.3 2.09c.22.73.56 1.24 1.08 1.45.22.08.4.27.4.5s-.18.43-.4.51q-.76.34-1.08 1.45c-.2.65-.27 1.32-.3 2a2.5 2.5 0 0 1-2.48 2.5H4.25A2.6 2.6 0 0 1 1.7 12c-.04-.85-.1-1.68-.22-2.04C1.26 9.23.92 8.7.4 8.5.18 8.42 0 8.23 0 8s.18-.42.4-.5q.77-.35 1.09-1.46c.1-.36.17-1.19.2-2.04a2.6 2.6 0 0 1 2.56-2.5z" class="bg" clip-rule="evenodd" opacity=".2"/>\n <path fill="currentColor" fill-rule="evenodd" d="M8.47 4.54c1.23 0 2.04.68 2.04 1.73 0 .73-.55 1.39-1.24 1.5v.04c.94.1 1.58.77 1.58 1.7 0 1.2-.9 1.95-2.37 1.95H5.97a.3.3 0 0 1-.2-.08.3.3 0 0 1-.08-.2V4.82a.3.3 0 0 1 .08-.2.3.3 0 0 1 .2-.08zm-1.7 6.04h1.49q1.47-.01 1.49-1.15Q9.74 8.31 8.2 8.3H6.77zm0-5.16v2.06h1.21c.93 0 1.45-.38 1.45-1.06 0-.65-.44-1-1.22-1z" class="fg" clip-rule="evenodd"/>\n</symbol>','<symbol id="file-tree-builtin-browserslist" viewBox="0 0 16 16">\n <path fill="currentColor" d="M8.88 6.96c0 3.82 3.72 4.7 5.7 3.74-.23.9-1.04 1.67-2.35 1.93-.02.4.42 1.28.82 1.63-.9.35-1.94-.12-2.51-.48a5 5 0 0 0-.32 1.87c-.68 0-1.57-1-1.8-1.37-.3.18-.85 1.15-.96 1.72a2.4 2.4 0 0 1-.81-.86 2.4 2.4 0 0 1-.3-1.15c-.38.27-1.48.95-1.99 1.18-.25-.58-.15-1.3 0-2.06-.21.12-1.8.27-2.43.12.32-.36.75-1.19.94-1.57A4.5 4.5 0 0 1 .44 10.6c.48-.22.97-.53 1.49-1.06C1.26 9.17.24 8.64 0 7.7a6 6 0 0 0 1.79-.32C1.28 7.08.44 6.15.6 5.01c.42.21 1.3.37 1.73.3a3.4 3.4 0 0 1-.25-2.75 5 5 0 0 0 1.48 1c-.08-.8.3-2.31.8-2.71.2.46.73 1.21 1.08 1.4.09-.61.87-2.06 1.57-2.25 0 .5.27 1.4.5 1.67.51-.54 2.25-1.44 3.64-1.13-.43.45-.75.61-.86.98 1.05 0 2.78.34 4.27 1.93-2.34-.89-5.69.56-5.69 3.5" class="bg" opacity=".5"/>\n <path fill="currentColor" d="M11.21 3.59a4.1 4.1 0 0 0 2.47 2.89c.24-.22.61-.38.95-.19.76.44.2 1.26-.34 1.66l-.07.06a13 13 0 0 1-4.49 1.61l-.3-.43a10.5 10.5 0 0 0 4.13-1.31 1 1 0 0 0 .23-.25.5.5 0 0 0-.21-.69l-.15-.06a4.5 4.5 0 0 1-1.77-1.31 4.5 4.5 0 0 1-.88-1.77q.2-.12.43-.21"/>\n <path fill="currentColor" d="M10.36 5.18a.4.4 0 0 0-.03.38c.09.2.3.3.46.23s.24-.3.15-.5l-.01-.02q.23.13.34.39a.83.83 0 0 1-.43 1.08.8.8 0 0 1-1.08-.43.83.83 0 0 1 .6-1.13"/>\n</symbol>','<symbol id="file-tree-builtin-bun" viewBox="0 0 16 16">
2\n <path fill="currentColor" d="M8 14c3.87 0 7-2.46 7-5.49 0-1.88-1.2-3.53-3.04-4.52q-1.1-.61-1.84-1.07C9.2 2.35 8.64 2 8 2s-1.36.45-2.31 1.03A29 29 0 0 1 4.04 4C2.2 4.98 1 6.63 1 8.51 1 11.54 4.13 14 8 14M7.18 3.88q.3-.66.3-1.37c0-.08.11-.1.13-.01.38 1.57-.53 2.35-1.2 2.61-.08.03-.12-.07-.06-.12a3 3 0 0 0 .83-1.12m1.2-.05a3 3 0 0 0-.45-1.3V2.5c-.04-.07.05-.15.1-.1 1.15 1.2.77 2.3.33 2.87-.05.05-.13 0-.11-.08q.21-.67.13-1.37m1.04-.32a3 3 0 0 0-.94-1.02v-.01c-.06-.05-.01-.16.07-.12 1.51.61 1.61 1.8 1.43 2.5l-.03.03a.07.07 0 0 1-.1-.06 3 3 0 0 0-.43-1.32m-2.97.32c-.36.3-.74.43-1.2.56q-.11 0-.1-.1a3.5 3.5 0 0 0 1.76-1.57s.09-.07.1.04c0 .18-.2.76-.56 1.07m2.89 6.36q-.13.52-.55.88a1.3 1.3 0 0 1-.75.35 1.3 1.3 0 0 1-.77-.35 1.7 1.7 0 0 1-.54-.88.13.13 0 0 1 .15-.15h2.31a.14.14 0 0 1 .15.15M6.15 8.95a1.1 1.1 0 0 1-1.39-.14A1.1 1.1 0 0 1 5.12 7a1.1 1.1 0 0 1 1.2.25 1.1 1.1 0 0 1-.17 1.69m4.96 0a1.1 1.1 0 0 1-1.4-.14 1.1 1.1 0 0 1 .37-1.8 1.1 1.1 0 0 1 1.2.25 1.1 1.1 0 0 1 .24 1.2 1 1 0 0 1-.41.5"/>\n</symbol>','<symbol id="file-tree-builtin-claude" viewBox="0 0 16 16">\n <path fill="currentColor" d="M3.75 10.31 6.5 8.77l.04-.14-.04-.07h-.14l-.46-.03-1.57-.04-1.38-.07-1.33-.07-.34-.07L1 7.86l.03-.21.28-.18.4.03.89.07 1.33.08.97.06 1.43.16h.22l.03-.1-.07-.05-.06-.06-1.39-.92-1.48-.98-.79-.57-.42-.28-.2-.28-.1-.6.39-.41.52.04.12.03.52.4 1.12.86L6.2 6.04l.2.17.09-.06.01-.04-.1-.15-.76-1.46-.85-1.46-.37-.6-.1-.36a1 1 0 0 1-.06-.42l.42-.59.25-.07.6.08.22.2.36.84.58 1.3.9 1.77.29.53.14.47.04.14h.1v-.07l.07-1 .14-1.22.14-1.57.04-.45.23-.53.42-.28.36.15.28.41-.04.25-.16 1.08-.36 1.7-.21 1.14h.12l.14-.15.58-.76.97-1.2.42-.5.5-.51.32-.25h.6l.44.66-.2.68-.61.79-.52.65-.74 1-.45.8.04.05h.1l1.68-.36.9-.16 1.06-.18.5.23.05.22-.2.48-1.15.28-1.34.28-2 .46-.04.01.03.04.9.09.4.03h.94l1.77.14.46.28.27.37-.04.28-.72.37-.95-.23-2.24-.53-.76-.18h-.11v.06l.64.63L12 10.86l1.48 1.35.07.34-.18.28-.2-.03-1.29-.98-.5-.42-1.12-.95h-.07v.1l.25.38 1.37 2.05.07.63-.1.2-.36.14-.38-.08-.8-1.12-.85-1.26-.66-1.15-.07.05-.4 4.23-.19.21-.42.17-.35-.28-.2-.42.2-.87.23-1.12.18
2-.9.17-1.1.1-.36v-.03h-.1l-.84 1.16-1.27 1.72-1 1.07-.24.1-.42-.22.04-.39.22-.32 1.4-1.8.84-1.1.57-.64-.02-.07h-.04l-3.7 2.4-.66.09-.28-.28.03-.42.14-.14 1.12-.77z"/>\n</symbol>','<symbol id="file-tree-builtin-docker" viewBox="0 0 16 16">\n <path fill="currentColor" d="M15.85 6.54c-.05-.04-.45-.36-1.31-.36q-.34 0-.68.06a2.7 2.7 0 0 0-1.14-1.79l-.23-.14-.15.23a3 3 0 0 0-.4 1q-.24 1.01.26 1.84c-.4.24-1.03.3-1.17.3H.5a.5.5 0 0 0-.5.52q-.01 1.46.46 2.83.55 1.5 1.6 2.18c.79.5 2.08.79 3.54.79q.96 0 1.94-.18a8 8 0 0 0 2.55-.97 7 7 0 0 0 1.73-1.5 10 10 0 0 0 1.7-3.06h.15a2.4 2.4 0 0 0 1.8-.7 2 2 0 0 0 .47-.74l.06-.2z"/>\n <path fill="currentColor" d="M1.48 7.36h1.4a.14.14 0 0 0 .14-.13V5.91q-.01-.12-.13-.14H1.48a.13.13 0 0 0-.13.14v1.32q.02.13.13.13m1.94 0h1.41a.14.14 0 0 0 .13-.13V5.91q-.01-.12-.13-.14h-1.4a.13.13 0 0 0-.13.14v1.32q0 .13.12.13m1.98 0h1.4q.13 0 .14-.13V5.91a.13.13 0 0 0-.14-.14H5.4q-.1.01-.12.14v1.32q0 .13.12.13m1.95 0h1.42q.1 0 .12-.13V5.91q0-.12-.12-.14H7.35q-.1.01-.12.14v1.32q.01.13.12.13M3.42 5.5h1.41c.07 0 .13-.08.13-.15V4.03a.13.13 0 0 0-.13-.14h-1.4q-.12 0-.13.14v1.31q0 .13.12.15m1.98 0h1.4c.08 0 .14-.08.14-.15V4.03q0-.13-.14-.14H5.4q-.1 0-.12.14v1.31q0 .13.12.15m1.95 0h1.42c.06 0 .12-.08.12-.15V4.03q-.01-.13-.12-.14H7.35q-.1 0-.12.14v1.31q.01.13.12.15m0-1.9h1.42q.1-.02.12-.14v-1.3Q8.88 2 8.77 2H7.35q-.1 0-.12.14v1.3q.01.13.12.14m1.97 3.78h1.4a.13.13 0 0 0 .14-.13V5.91q-.01-.12-.13-.14H9.32q-.1.01-.12.14v1.32q.01.13.12.13" opacity=".5"/>\n</symbol>','<symbol id="file-tree-builtin-eslint" viewBox="0 0 16 16">\n <path fill="currentColor" d="M11.16 6.1 8.12 4.35a.3.3 0 0 0-.24 0L4.84 6.1a.3.3 0 0 0-.12.2v3.5q0 .14.12.22l3.04 1.74q.12.08.24 0l3.04-1.74a.2.2 0 0 0 .13-.22V6.3a.3.3 0 0 0-.13-.2" opacity=".5"/>\n <path fill="currentColor" d="m.1 7.69 3.63-6.3A.8.8 0 0 1 4.37 1h7.26c.26 0 .5.17.64.4l3.63 6.27a.8.8 0 0 1 0 .75l-3.63 6.24a.7.7 0 0 1-.64.34H4.37a.7.7 0 0 1-.64-.34L.1 8.41a.7.7 0 0 1 0-.72m3 3.02q.01.15.14.23l4.63 2.66q.13.06.26 0l4.63-2.66a.3.3 0 0 0 .14-.23V5.4a.3.3 0 0 0-.14-.23L8.13 2.52a.3.3 0 0 0-.26 0L3.24 5.17a.3.3 0 0 0-.14.23z"/>\n</symbol>','<symbol id="file-tree-builtin-graphql" viewBox="0 0 16 16">\n <path fill="currentColor" fill-rule="evenodd" d="M8 1a1.25 1.25 0 0 1 1.18 1.65l2.8 1.61q.33-.25.77-.26a1.25 1.25 0 0 1 .48 2.4v3.2a1.25 1.25 0 1 1-1.25 2.13l-2.8 1.62A1.25 1.25 0 0 1 8 15a1.25 1.25 0 0 1-1.18-1.65l-2.8-1.62q-.33.26-.77.27a1.25 1.25 0 0 1-.48-2.4V6.4a1.25 1.25 0 1 1 1.25-2.14l2.8-1.61A1.25 1.25 0 0 1 8 1M4.44 11.14l-.06.13 2.75 1.58a1.25 1.25 0 0 1 1.74 0l2.74-1.58-.05-.13zm3.89-7.68a1.3 1.3 0 0 1-.66 0L4.03 9.77q.37.3.45.78h7.04q.08-.48.45-.78zM4.38 4.73a1.24 1.24 0 0 1-1.02 1.76v3.02l.13.01 3.67-6.35-.03-.02zm4.46-1.56 3.67 6.35.13-.01V6.49a1.25 1.25 0 0 1-1.03-1.76L8.87 3.15z" clip-rule="evenodd"/>\n</symbol>','<symbol id="file-tree-builtin-nextjs" viewBox="0 0 16 16">\n <defs>\n <linearGradient id="a" x1="4.522" x2="14" y1="3.943" y2="16" gradientUnits="userSpaceOnUse">\n <stop stop-color="currentColor"/>\n <stop offset="1" stop-color="currentColor" stop-opacity="0"/>\n </linearGradient>\n </defs>\n <path fill="currentColor" d="M3 2h1.522v9.09H3z"/>\n <path fill="url(#a)" d="M4.903 2 15 15.075q-.565.5-1.195.925L4.522 3.943z"/>\n <path fill="currentColor" d="M12.172 2h-1.508v9.094h1.508z"/>\n</symbol>','<symbol id="file-tree-builtin-npm" viewBox="0 0 16 16">\n <path fill="currentColor" d="M2 1a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1z" class="vector" opacity=".2"/>\n <path fill="currentColor" d="M10.5 13H13V3H3v10h5V5.5h2.5z"/>\n</symbol>
2','<symbol id="file-tree-builtin-oxc" viewBox="0 0 16 16">\n <path fill="currentColor" d="M9.5 1a.5.5 0 0 1 .5.5V3h3.5a.5.5 0 0 1 .38.83L10.5 7.69v1.44q.41.04.95-.16a4 4 0 0 0 .72-.35l.04-.03h.01a.5.5 0 0 1 .67.1l2 2.5a.5.5 0 0 1 0 .62c-.76.96-3.14 2.69-6.89 2.69s-6.13-1.73-6.89-2.69a.5.5 0 0 1 0-.62l2-2.5a.5.5 0 0 1 .67-.1l.05.03.16.09q.22.13.56.26.54.2.95.16V7.69L2.12 3.83A.5.5 0 0 1 2.5 3H6V1.5a.5.5 0 0 1 .5-.5zM7 3.5a.5.5 0 0 1-.5.5H3.6l2.78 3.17a.5.5 0 0 1 .12.33v2a.5.5 0 0 1-.28.45c-.7.35-1.5.15-2.02-.05a5 5 0 0 1-.58-.26l-1.46 1.84c.82.78 2.8 2.02 5.84 2.02s5.02-1.24 5.84-2.02l-1.46-1.83a5 5 0 0 1-.58.26c-.52.2-1.33.39-2.02.04a.5.5 0 0 1-.28-.45v-2a.5.5 0 0 1 .12-.33L12.4 4H9.5a.5.5 0 0 1-.5-.5V2H7z"/>\n</symbol>','<symbol id="file-tree-builtin-postcss" viewBox="0 0 16 16">\n <path fill="currentColor" d="M14.5 8a6.5 6.5 0 0 0-5.9-6.47l5.42 8.93A7 7 0 0 0 14.5 8M2.88 12A6.5 6.5 0 0 0 8 14.5c2.08 0 3.93-.98 5.12-2.5zm8.62-1h1.68L11.5 8.24zm-1-.55a4 4 0 0 1-.7.55h.7zM8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5M5.5 11h.7a4 4 0 0 1-.7-.55zm-2.68 0H4.5V8.24zm3.76-6.2A4 4 0 0 1 8 4.5q.76 0 1.42.3L8 2.46zM1.5 8q0 1.31.48 2.46L7.4 1.53A6.5 6.5 0 0 0 1.5 8m14 0a7.5 7.5 0 0 1-.99 3.72l-.01.03-.02.03A7.5 7.5 0 0 1 8 15.5a7.5 7.5 0 0 1-6.5-3.75l-.01-.03A7.5 7.5 0 1 1 15.5 8"/>\n</symbol>','<symbol id="file-tree-builtin-prettier" viewBox="0 0 16 16">\n <path fill="currentColor" d="M6 12v1H4.93v-1zm1-2v1H2v-1zm6-4v1h-3V6zm-1-4v1H9V2z"/>\n <path fill="currentColor" d="M11.5 10v1H8v-1zM5 6v1H2V6zm5-2v1H9V4z" opacity=".8"/>\n <path fill="currentColor" d="M6 14v1H2v-1zm-.5-6v1H2V8zM13 4v1h-3V4zM4.93 2v1H2V2z" opacity=".6"/>\n <path fill="currentColor" d="M4.93 12v1H2v-1zM13 8v1H9V8zM5.5 4v1H2V4zM9 2v1H4.93V2z" opacity=".4"/>\n</symbol>','<symbol id="file-tree-builtin-react" viewBox="0 0 16 16">\n <path fill="currentColor" d="M8 6.65c.73 0 1.31.6 1.31 1.35S8.73 9.35 8 9.35 6.69 8.75 6.69 8 7.27 6.65 8 6.65"/>\n <path fill="currentColor" fill-rule="evenodd" d="M8 2.55c1.3-.99 2.59-1.34 3.5-.8.92.55 1.27 1.87 1.08 3.53C14.06 5.94 15 6.9 15 8s-.94 2.06-2.42 2.72c.19 1.65-.16 2.98-1.08 3.52-.91.55-2.2.2-3.5-.8-1.3 1-2.58 1.35-3.5.8-.91-.54-1.27-1.87-1.08-3.52C1.94 10.06 1 9.1 1 8s.94-2.06 2.42-2.72c-.19-1.66.17-2.98 1.08-3.52s2.2-.2 3.5.8M4.26 11.2c-.08 1.34.28 2.03.68 2.26s1.15.22 2.25-.52l.11-.09a12 12 0 0 1-1.24-1.39 11 11 0 0 1-1.8-.41zm7.47-.15q-.83.27-1.79.41-.6.8-1.24 1.4l.11.08c1.1.74 1.86.76 2.25.52.4-.23.76-.92.68-2.26zm-3.04.54a14 14 0 0 1-1.38 0q.34.38.69.7.35-.32.7-.7M8 5.29q-.76 0-1.47.1A13 13 0 0 0 5.07 8a14 14 0 0 0 1.46 2.62 13 13 0 0 0 2.94 0A13 13 0 0 0 10.93 8a14 14 0 0 0-1.46-2.62A13 13 0 0 0 8 5.3M4.64 9.18q-.15.5-.25.96.44.16.94.27a15 15 0 0 1-.7-1.23m6.73 0a15 15 0 0 1-.7 1.23q.5-.11.95-.27a10 10 0 0 0-.25-.96M3.44 6.26C2.27 6.86 1.87 7.53 1.87 8s.4 1.14 1.57 1.74l.13.07q.18-.88.55-1.81a12 12 0 0 1-.55-1.8q-.07.02-.13.06m8.99-.07A12 12 0 0 1 11.88 8q.36.94.55 1.8l.13-.06c1.17-.6 1.56-1.27 1.56-1.74s-.39-1.14-1.56-1.74zm-7.1-.6q-.5.11-.94.27.1.46.25.96a15 15 0 0 1 .69-1.23m5.34 0a15 15 0 0 1 .7 1.23q.14-.5.24-.96-.44-.15-.94-.27M7.18 3.06c-1.09-.74-1.85-.76-2.24-.52s-.76.92-.69 2.26l.01.15a11 11 0 0 1 1.8-.41q.6-.8 1.24-1.4zm3.88-.52c-.4-.24-1.15-.22-2.25.52l-.12.08q.65.6 1.25 1.4.96.15 1.8.41v-.14c.08-1.35-.28-2.04-.68-2.27M8 3.7a10 10 0 0 0-.7.7 14 14 0 0 1 1.4 0 10 10 0 0 0-.7-.7" clip-rule="evenodd"/>\n</symbol>','<symbol id="file-tree-builtin-sass" viewBox="0 0 16 16">\n <path fill="currentColor" fill-rule="evenodd" d="M8.08 1.44c2.41-.91 4.96-.37 5.35 1.27.39 1.62-.92 3.56-2.6 4.25a5 5 0 0 1-3.26.35c-.58-.2-.92-.62-1-.85-.03-.09-.09-.24 0-.3.05-.03.08-.02.22.15s.7.6 1.75.48c2.78-.34 4.45-2.64 3.92-3.88-.37-.87-2.5-1.26-5.18.16C4.03 4.81 3.85 6.24 3.82 6.8c-.08 1.5 1.73 2.28 2.7 3.4q.04.03.07.08c.3-.12.7-.19 1.35-.2 1.58-.03 2.47 1.08 2.43 2.08-.03.78-.7 1.1-.82 1.13-.1.01-.14.02-.15-.06q-.03-.06.13-.15c.16-.09.42-.3.48-.72.05-.43-.24-1.44-1.76-1.63a3 3 0 0 0-1.33.08c.27.62.32 1.87-.29 2.83-.63 1-1.8 1.61-2.93 1.27-.37-.1-.93-.92-.45-2.05.46-1.07 2.4-2.12 2.66-2.26-.9-.83-3.08-1.95-3.4-3.65-.08-.49.13-1.65 1.46-2.98a12 12 0 0 1 4.11-2.52m-1.88 9.7c-.01.01-.9.47-1.52 1.17-.59.66-.75 1.48-.43 1.69.3.18 1-.04 1.51-.62a3 3 0 0 0 .5-.9q.2-.64.02-1.39z" clip-rule="evenodd"/>\n</symbol>','<symbol id="file-tree-builtin-stylelint" viewBox="0 0 16 16">
2\n <path fill="currentColor" d="M4 3v3.5l1.5-1L7 15 .5 6l1-1.5L0 3l2.5-2h1zm12 0-1.5 1.5 1 1.5L9 15l1.5-9.5 1.5 1V3l.5-2h1zm-8 8.5a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1m0-3a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1m0-3a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1"/>\n <path fill="currentColor" d="M6.5 2.5V4l-2 1.5v-4zm5 3L9.5 4V2.5l2-1zM9 4H7V2.5h2z"/>\n</symbol>','<symbol id="file-tree-builtin-svelte" viewBox="0 0 16 16">\n <path fill="currentColor" d="m3.98 3.7 3.36-2.08a4.5 4.5 0 0 1 5.9 1.23 4 4 0 0 1 .7 3.02q-.16.75-.58 1.4c.42.77.56 1.66.4 2.52a3.7 3.7 0 0 1-1.57 2.4l-.17.1-3.36 2.09a4.5 4.5 0 0 1-5.9-1.23 4 4 0 0 1-.66-1.44 4 4 0 0 1-.04-1.58 4 4 0 0 1 .58-1.4 4 4 0 0 1-.4-2.52 3.7 3.7 0 0 1 1.57-2.4zl3.36-2.08zm7.87 0a2.7 2.7 0 0 0-1.26-.95 2.7 2.7 0 0 0-1.6-.07 3 3 0 0 0-.52.2l-.16.09-3.36 2.08a2 2 0 0 0-.69.64 2 2 0 0 0-.36.86 2.3 2.3 0 0 0 .42 1.81A2.7 2.7 0 0 0 7.18 9.4q.28-.06.53-.2l.16-.09 1.28-.79.2-.09a.8.8 0 0 1 .87.31.7.7 0 0 1 .13.55.7.7 0 0 1-.24.4l-.08.05-3.36 2.08-.2.09a1 1 0 0 1-.49-.02 1 1 0 0 1-.38-.3 1 1 0 0 1-.13-.37v-.1l.01-.13-.13-.03a4 4 0 0 1-1.1-.5l-.2-.14-.18-.12-.07.18-.08.3a2.3 2.3 0 0 0 .43 1.82q.45.64 1.19.93.73.28 1.51.14l.16-.04q.27-.07.52-.2l.16-.09 3.36-2.08q.4-.25.69-.64.27-.4.36-.86a2.3 2.3 0 0 0-.42-1.82 2.7 2.7 0 0 0-1.27-.95 2.7 2.7 0 0 0-1.6-.08q-.27.07-.52.2l-.16.1-1.28.79-.2.09a1 1 0 0 1-.49-.03 1 1 0 0 1-.38-.29.7.7 0 0 1-.13-.54.7.7 0 0 1 .24-.4l.08-.06L9.33 4.4l.2-.1a.8.8 0 0 1 .87.32 1 1 0 0 1 .13.38v.22l.11.04q.6.18 1.12.5l.2.14.17.12.06-.19.08-.3a2.3 2.3 0 0 0-.42-1.81z"/>\n</symbol>','<symbol id="file-tree-builtin-svg" viewBox="0 0 16 16">\n <path fill="currentColor" d="M5 7a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2z"/>\n <path fill="currentColor" d="M6 1a5 5 0 0 1 4.58 3H7a3 3 0 0 0-3 3v3.58A5 5 0 0 1 6 1" opacity=".5"/>\n</symbol>','<symbol id="file-tree-builtin-svgo" viewBox="0 0 16 16">\n <path fill="currentColor" d="M9.43 4.8A.6.6 0 1 1 9.19 6l-.56.96a1.2 1.2 0 0 1 .32 1.58l.7.53a.89.89 0 1 1-.17.22l-.7-.52a1.2 1.2 0 0 1-1.4.25l-.56.87a.75.75 0 1 1-.57-.2 1 1 0 0 1 .32.05l.56-.87a1.2 1.2 0 0 1-.4-1.24l-1.2-.47a.56.56 0 1 1 .1-.28v.02l1.2.47a1.2 1.2 0 0 1 1.56-.55l.56-.97a.6.6 0 0 1-.15-.64.6.6 0 0 1 .63-.4"/>\n <path fill="currentColor" fill-rule="evenodd" d="M9.17 1q.16.63.27 1.26a6 6 0 0 1 1.61.67q.52-.38 1.08-.71l1.65 1.64q-.32.56-.68 1.05.48.78.72 1.67.6.09 1.18.25v2.32q-.55.15-1.11.24a6 6 0 0 1-.7 1.82q.31.44.59.91l-1.65 1.65-.85-.55a6 6 0 0 1-1.9.83q-.08.47-.2.95H6.84q-.12-.46-.2-.93a6 6 0 0 1-1.96-.81q-.39.27-.8.51l-1.65-1.65q.25-.43.53-.84a6 6 0 0 1-.75-1.9L1 9.16V6.83q.54-.14 1.09-.24a6 6 0 0 1 .77-1.74q-.33-.47-.63-.98l1.65-1.65q.54.32 1.03.68a6 6 0 0 1 1.66-.66q.1-.61.26-1.24zM7.96 3.73a4 4 0 0 0-1.74.36 4.5 4.5 0 0 0-2.3 2.3 4.4 4.4 0 0 0-.1 3.29l.03.06a4.4 4.4 0 0 0 2.4 2.47 4.4 4.4 0 0 0 3.48-.02l.03-.02a4.4 4.4 0 0 0 2.3-2.42l.06-.14a4.4 4.4 0 0 0-.2-3.4 4.4 4.4 0 0 0-2.13-2.07L9.47 4a4 4 0 0 0-1.51-.27" clip-rule="evenodd"/>\n</symbol>','<symbol id="file-tree-builtin-tailwind" viewBox="0 0 16 16">\n <path fill="currentColor" fill-rule="evenodd" d="M8 4Q5.2 4 4.5 6.67q1.05-1.34 2.45-1c.53.12.91.5 1.33.9C8.98 7.23 9.77 8 11.5 8q2.8 0 3.5-2.67-1.05 1.34-2.45 1c-.53-.12-.91-.5-1.33-.9C10.52 4.77 9.73 4 8 4M4.5 8Q1.7 8 1 10.67q1.05-1.34 2.45-1c.53.12.91.5 1.33.9C5.48 11.23 6.26 12 8 12q2.8 0 3.5-2.67-1.05 1.34-2.45 1c-.53-.12-.91-.5-1.33-.9C7.02 8.77 6.24 8 4.5 8" clip-rule="evenodd"/>\n</symbol>','<symbol id="file-tree-builtin-terraform" viewBox="0 0 16 16">\n <path fill="currentColor" d="M1 0v5.05l4.35 2.53V2.53zm9.18 5.34L5.83 2.82v5.05l4.35 2.53zm.47 5.06V5.34L15 2.82v5.05zm-.48 5.6-4.35-2.53V8.42l4.35 2.53z"/>\n</symbol>','<symbol id="file-tree-builtin-vite" viewBox="0 0 16 16">\n <path fill="currentColor" d="M8.57 14.87c-.18.26-.55.11-.55-.22v-3.18l-.05-.27-.13-.22-.2-.15-.24-.06H4.29c-.26 0-.4-.32-.26-.55L6.08 7c.3-.46 0-1.1-.5-1.1H1.8c-.25 0-.4-.32-.25-.56l2.65-4.2A.3.3 0 0 1 4.46 1h7.9c.26 0 .4.32.26.55l-2.05 3.23c-.29.46 0 1.1.5 1.1h3.12c.26 0 .4.34.24.57z"/>\n</symbol>','<symbol id="file-tree-builtin-vscode" viewBox="0 0 16 16">
2\n <path fill="currentColor" d="m5.11 9.68-2.4 1.84a.6.6 0 0 1-.75-.04l-.77-.7a.6.6 0 0 1 0-.87L3.28 8zm5.52-8.42a.51.51 0 0 1 .87.36V4.8L7.32 8 5.1 6.32z" opacity=".75"/>\n <path fill="currentColor" d="M11.1 14.99h.03zM1.96 4.52a.6.6 0 0 1 .75-.04l8.8 6.71v3.19a.51.51 0 0 1-.88.36L1.19 6.1a.6.6 0 0 1 0-.87z" opacity=".65"/>\n <path fill="currentColor" d="M11.62 14.91a.9.9 0 0 1-1-.17.51.51 0 0 0 .88-.36V1.62a.51.51 0 0 0-.87-.36.9.9 0 0 1 1-.17l2.87 1.39a.9.9 0 0 1 .5.8v9.44a.9.9 0 0 1-.5.8z"/>\n</symbol>','<symbol id="file-tree-builtin-vue" viewBox="0 0 16 16">\n <path fill="currentColor" d="M9.62 2.25 8 5.02 6.38 2.25H1l7 12 7-12z" opacity=".5"/>\n <path fill="currentColor" d="M9.54 2.25 8 4.95l-1.54-2.7H4l4 7 4-7z"/>\n</symbol>','<symbol id="file-tree-builtin-wasm" viewBox="0 0 16 16">\n <path fill="currentColor" d="M13 1a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h3a2 2 0 1 0 4 0z" class="subtract" opacity=".2"/>\n <path fill="currentColor" d="M4.64 11.4h.02l.8-3.4h.91l.73 3.45L7.88 8h.96l-1.25 5h-.97L5.9 9.6 5.1 13h-1L3 8h.98z"/>\n <path fill="currentColor" fill-rule="evenodd" d="M13 13h-1.02l-.33-1.11H9.9L9.64 13h-.97l1.26-5h1.54zm-2.49-3.77-.42 1.84h1.32l-.49-1.84z" clip-rule="evenodd"/>\n</symbol>','<symbol id="file-tree-builtin-webpack" viewBox="0 0 16 16">\n <path fill="currentColor" d="M14.1 11.79 8.26 15v-2.5l3.64-1.94zm.4-.35V4.73l-2.14 1.2v4.3zm-12.6.35L7.74 15v-2.5L4.1 10.56zm-.4-.35V4.73l2.14 1.2v4.3zm.25-7.15 6-3.29v2.42L3.9 5.47l-.03.01zm12.5 0L8.25 1v2.42l3.85 2.05.03.01z" class="bg" opacity=".4"/>\n <path fill="currentColor" d="m7.74 11.93-3.59-1.92v-3.8l3.6 2.02zm.52 0 3.59-1.92v-3.8l-3.6 2.02zM4.4 5.77 8 3.85l3.6 1.93L8 7.8z" class="fg"/>\n</symbol>','<symbol id="file-tree-builtin-yml" viewBox="0 0 16 16">\n <path fill="currentColor" d="M7.5 2A1.5 1.5 0 0 1 9 3.5v3A1.5 1.5 0 0 1 7.5 8h-2v2A1.5 1.5 0 0 0 7 11.5v-1A1.5 1.5 0 0 1 8.5 9h5a1.5 1.5 0 0 1 1.5 1.5v3a1.5 1.5 0 0 1-1.5 1.5h-5A1.5 1.5 0 0 1 7 13.5v-1A2.5 2.5 0 0 1 4.5 10V8h-2A1.5 1.5 0 0 1 1 6.5v-3A1.5 1.5 0 0 1 2.5 2zm1 8a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h5a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5zm-6-7a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h5a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5z"/>\n</symbol>','<symbol id="file-tree-builtin-zig" viewBox="0 0 16 16">\n <path fill="currentColor" d="m14.73 1.5-7.29 8.82h4.17l-1.73 2.04H5.76L1.27 14.5l7.3-8.91H4.39l1.73-2.05h4.12z"/>\n <path fill="currentColor" d="M5.21 3.54 3.56 5.6h-.55v4.73h.83L2.1 12.36H1V3.54zm9.79 0v8.82h-4.3l1.74-2.04h.55V5.68h-.83l1.74-2.14z"/>\n</symbol>'];function pi(e,t){return 0===t.length?e:e.replace("</svg>",`\n ${t.join("\n ")}\n</svg>`)}const gi=pi(di,['<symbol id="file-tree-builtin-bash" viewBox="0 0 16 16">\n <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>\n <path fill="currentColor" d="M11.5 11a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1zM7 6.75C7 6.42 6.64 6 6 6s-1 .42-1 .75q-.01.25.22.41.26.21.89.35.74.14 1.28.53c.37.29.61.7.61 1.21 0 .87-.68 1.5-1.5 1.7v.55a.5.5 0 0 1-1 0v-.56c-.82-.18-1.5-.82-1.5-1.69a.5.5 0 0 1 1 0c0 .33.36.75 1 .75s1-.42 1-.75q.01-.25-.22-.41a2 2 0 0 0-.89-.35q-.74-.14-1.28-.53A1.5 1.5 0 0 1 4 6.75c0-.87.68-1.5 1.5-1.7V4.5a.5.5 0 0 1 1 0v.56c.82.18 1.5.82 1.5 1.69a.5.5 0 0 1-1 0" class="fg-stroke"/>\n</symbol>','<symbol id="file-tree-builtin-c" viewBox="0 0 16 16">\n <path fill="currentColor" fill-rule="evenodd" d="M8 1q.084 0 .166.021.098.023.186.075c1.055.624 4.22 2.486 5.277 3.11.085.05.15.112.209.192h-.002l.028.037a.5.5 0 0 1 .103.21q.031.102.033.21v6.29a.71.71 0 0 1-.347.616l-5.307 3.144a.68.68 0 0 1-.693 0l-5.307-3.144A.72.72 0 0 1 2 11.145V4.832a.71.71 0 0 1 .346-.612l5.288-3.126A.7.7 0 0 1 7.992 1zm2.901 4.349a3.75 3.75 0 1 0 0 5.302l-1.06-1.06a2.25 2.25 0 1 1 0-3.182z" clip-rule="evenodd"/>\n</symbol>','<symbol id="file-tree-builtin-cpp" viewBox="0 0 16 16">\n <path fill="currentColor" fill-rule="evenodd" d="M8 1q.084 0 .166.021.098.023.186.075c1.055.624 4.22 2.486 5.277 3.11.085.05.15.112.209.192h-.002l.028.037a.5.5 0 0 1 .103.21q.031.102.033.21v6.29a.71.71 0 0 1-.347.616l-5.307 3.144a.68.68 0 0 1-.693 0l-5.307-3.144A.72.72 0 0 1 2 11.145V4.832a.71.71 0 0 1 .346-.612l5.288-3.126A.7.7 0 0 1 7.992 1zm2.901 4.349a3.75 3.75 0 1 0 0 5.302l-1.06-1.06a2.25 2.25 0 1 1 0-3.182z" clip-rule="evenodd"/>\n</symbol>
2','<symbol id="file-tree-builtin-css" viewBox="0 0 16 16">\n <path fill="currentColor" d="M8 15c-5.76 0-7-1.24-7-7V2a1 1 0 0 1 1-1h6c5.77 0 7 1.24 7 7s-1.24 7-7 7" class="vector" opacity=".2"/>\n <path fill="currentColor" d="M10.1 9.19h.73c.03.49.22.6 1 .6.76 0 .93-.12.93-.68 0-.52-.17-.67-.94-.85-1.38-.3-1.68-.56-1.68-1.47 0-1.05.3-1.29 1.67-1.29 1.29 0 1.57.2 1.6 1.13h-.74c-.01-.34-.17-.42-.85-.42-.77 0-.94.1-.94.58 0 .42.17.55.96.73 1.36.3 1.66.58 1.66 1.59 0 1.14-.31 1.39-1.73 1.39-1.39 0-1.69-.24-1.67-1.31m-3.9 0h.74c.03.49.21.6.99.6.76 0 .93-.12.93-.68 0-.52-.17-.67-.93-.85-1.39-.3-1.69-.56-1.69-1.47 0-1.05.3-1.29 1.67-1.29 1.3 0 1.58.2 1.6 1.13h-.73c-.02-.34-.18-.42-.85-.42-.78 0-.95.1-.95.58 0 .42.17.55.96.73 1.37.3 1.67.58 1.67 1.59 0 1.14-.32 1.39-1.74 1.39-1.38 0-1.68-.24-1.66-1.31m-1.22 0h.75c-.09 1.07-.37 1.31-1.56 1.31-1.37 0-1.68-.45-1.68-2.5 0-1.96.36-2.5 1.68-2.5 1.16 0 1.44.25 1.52 1.35h-.76c-.08-.52-.22-.64-.76-.64-.74 0-.9.33-.9 1.78 0 1.47.16 1.8.9 1.8.58 0 .74-.11.8-.6"/>\n</symbol>','<symbol id="file-tree-builtin-database" viewBox="0 0 16 16">\n <path fill="currentColor" d="M14.953 9.733a12.4 12.4 0 0 1-.244 1.936c-.207.933-.532 1.58-.996 2.044s-1.11.789-2.044.996C10.73 14.918 9.533 15 8 15s-2.73-.082-3.669-.291c-.933-.207-1.58-.532-2.044-.996s-.789-1.11-.996-2.044c-.122-.547-.2-1.182-.244-1.92q.23.364.532.667c.64.639 1.482 1.031 2.533 1.265 1.046.232 2.33.315 3.884.315 1.555 0 2.838-.083 3.884-.315 1.051-.234 1.893-.626 2.532-1.265a4 4 0 0 0 .541-.683"/>\n <path fill="currentColor" d="M14.93 5.924c-.046.663-.118 1.24-.23 1.743-.207.932-.532 1.579-.995 2.042s-1.11.789-2.042.996c-.938.209-2.135.291-3.667.291-1.531 0-2.729-.082-3.667-.29-.932-.208-1.579-.534-2.042-.997s-.789-1.11-.996-2.042a12 12 0 0 1-.227-1.683l.016-.188a4 4 0 0 0 .5.62c.638.639 1.48 1.031 2.532 1.265 1.046.232 2.33.315 3.884.315 1.555 0 2.838-.083 3.884-.315 1.051-.234 1.893-.626 2.532-1.265.192-.192.357-.404.506-.633z"/>\n <path fill="currentColor" d="M8 1c1.533 0 2.73.082 3.669.291.933.207 1.58.533 2.044.996.403.404.904.944.91 1.695.004.764-.509 1.318-.918 1.727-.463.463-1.11.789-2.042.996-.938.209-2.135.291-3.667.291-1.531 0-2.729-.082-3.667-.29-.932-.208-1.579-.534-2.042-.997-.406-.406-.915-.953-.915-1.71 0-.758.509-1.305.915-1.712.464-.463 1.11-.789 2.044-.996C5.27 1.082 6.467 1 8 1"/>\n</symbol>','<symbol id="file-tree-builtin-default" viewBox="0 0 16 16">\n <path fill="currentColor" d="M8 1v3a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1z" class="bg" opacity=".4"/>\n <path fill="currentColor" d="M9.5 1a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z" class="fg"/>\n</symbol>','<symbol id="file-tree-builtin-font" viewBox="0 0 16 16">\n <path fill="currentColor" d="M12.3 13c-1.59 0-2.68-.99-2.68-2.5 0-1.43 1-2.34 2.88-2.35h2.16v-.83c0-1.08-.62-1.68-1.73-1.68-1.05 0-1.66.54-1.73 1.36H9.93c.09-1.43 1.06-2.48 3.05-2.48 1.75 0 3.02.95 3.02 2.68v5.66h-1.29v-1.02h-.04c-.41.66-1.16 1.16-2.37 1.16m.36-1.12c1.14 0 2-.72 2-1.74v-.96H12.6c-1.12 0-1.6.54-1.6 1.28 0 .97.8 1.42 1.66 1.42m-11.24.98H0L3.8 2h1.39l3.8 10.86H7.54l-1.08-3.2H2.5zm3.09-9.25h-.04l-1.6 4.95H6.1z"/>\n</symbol>','<symbol id="file-tree-builtin-git" viewBox="0 0 16 16">\n <path fill="currentColor" d="M14.74 7.38 8.62 1.26a.9.9 0 0 0-1.27 0L6.08 2.53l1.61 1.61a1.07 1.07 0 0 1 1.36 1.37l1.55 1.55a1.07 1.07 0 0 1 1.1 1.77 1.07 1.07 0 0 1-1.74-1.16L8.5 6.22v3.8a1.07 1.07 0 1 1-.89-.02V6.15a1.07 1.07 0 0 1-.58-1.4l-1.58-1.6-4.2 4.2a.9.9 0 0 0 0 1.27l6.12 6.12a.9.9 0 0 0 1.27 0l6.09-6.09a.9.9 0 0 0 0-1.27"/>\n</symbol>','<symbol id="file-tree-builtin-go" viewBox="0 0 16 16">\n <path fill="currentColor" fill-rule="evenodd" d="M4.41 4.57A3.2 3.2 0 0 1 6.87 5q.74.49 1.08 1.29.08.12-.1.16l-1.55.4c-.14.03-.15.04-.27-.1a1 1 0 0 0-.44-.34 1.6 1.6 0 0 0-1.68.14q-.95.61-.94 1.73c0 .73.52 1.33 1.25 1.43q.95.1 1.58-.6l.25-.34h-1.8c-.19 0-.24-.12-.17-.27.12-.28.34-.76.47-1a.3.3 0 0 1 .24-.14h2.98a4 4 0 0 1 .64-1.19 4 4 0 0 1 2.6-1.52 3.5 3.5 0 0 1 2.64.46q1.13.73 1.31 2.04a3.5 3.5 0 0 1-1.06 3.09q-.93.92-2.23 1.17l-.74.08a3.5 3.5 0 0 1-2.27-.8 3 3 0 0 1-.93-1.42 4 4 0 0 1-.39.61 4 4 0 0 1-2.64 1.56 3.3 3.3 0 0 1-2.5-.6 3 3 0 0 1-1.18-2.03 3.5 3.5 0 0 1 .8-2.67 4 4 0 0 1 2.6-1.58M13.1 7.5a1.53 1.53 0 0 0-1.9-1.21q-1.3.3-1.62 1.59a1.5 1.5 0 0 0 .85 1.72q.77.33 1.52-.05a2 2 0 0 0 1.18-1.74q0-.17-.03-.3" clip-rule="evenodd"/>\n</symbol>','<symbol id="file-tree-builtin-html" viewBox="0 0 16 16">
2\n <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>\n <path fill="currentColor" d="M10.48 3.76a.5.5 0 0 1 .4.58L10.6 5.8h1.14a.5.5 0 0 1 0 1h-1.32L10 9.2h1.08a.5.5 0 0 1 0 1H9.8l-.3 1.64a.5.5 0 1 1-.98-.18l.27-1.46H6.4l-.3 1.64a.5.5 0 1 1-.98-.18l.27-1.46H4.25a.5.5 0 0 1 0-1h1.32L6 6.8H4.93a.5.5 0 0 1 0-1H6.2l.3-1.64a.5.5 0 1 1 .98.18L7.2 5.8h2.4l.3-1.64a.5.5 0 0 1 .58-.4M6.58 9.2h2.4l.44-2.4h-2.4z" class="fg"/>\n</symbol>','<symbol id="file-tree-builtin-image" viewBox="0 0 16 16">\n <path fill="currentColor" d="M12.5 2A2.5 2.5 0 0 1 15 4.5v4.67l-4.05-3.54-4.08 4.08-3-2L1 10.6V4.5A2.5 2.5 0 0 1 3.5 2z" opacity=".3"/>\n <path fill="currentColor" d="M15 10.5v1a2.5 2.5 0 0 1-2.5 2.5h-9a2.5 2.5 0 0 1-2.46-2.04L4 9l3 2 4-4zm-7-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0"/>\n</symbol>','<symbol id="file-tree-builtin-javascript" viewBox="0 0 16 16">\n <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>\n <path fill="currentColor" d="M8.1 9.64h.95c.04.62.28.76 1.28.76s1.2-.14 1.2-.85c0-.66-.2-.85-1.2-1.07-1.79-.38-2.18-.7-2.18-1.86C8.15 5.3 8.54 5 10.31 5c1.67 0 2.04.26 2.07 1.42h-.95c-.02-.43-.23-.53-1.1-.53-1 0-1.22.14-1.22.74 0 .52.22.7 1.24.92 1.76.38 2.15.73 2.15 2 0 1.44-.4 1.75-2.24 1.75-1.8 0-2.18-.3-2.15-1.66M3.5 9.5h.98c0 .76.15.92.85.92.77 0 .94-.18.94-1.02V5.1h1v4.34c0 1.54-.35 1.87-1.92 1.87-1.55 0-1.89-.32-1.86-1.8"/>\n</symbol>','<symbol id="file-tree-builtin-json" viewBox="0 0 16 16">\n <path fill="currentColor" d="M13.25 11.5V9.75a.5.5 0 0 1 .36-.48l.55-.15a1.16 1.16 0 0 0 0-2.24l-.55-.15a.5.5 0 0 1-.36-.48V4.5a2.5 2.5 0 0 0-2.5-2.5h-.25a.5.5 0 0 0 0 1h.25a1.5 1.5 0 0 1 1.5 1.5v1.75a1.5 1.5 0 0 0 1.09 1.44l.54.15a.16.16 0 0 1 0 .32l-.54.15a1.5 1.5 0 0 0-1.09 1.44v1.75a1.5 1.5 0 0 1-1.5 1.5h-.25a.5.5 0 0 0 0 1h.25a2.5 2.5 0 0 0 2.5-2.5m-10.5 0V9.75a.5.5 0 0 0-.36-.48l-.55-.15a1.16 1.16 0 0 1 0-2.24l.55-.15a.5.5 0 0 0 .36-.48V4.5A2.5 2.5 0 0 1 5.25 2h.25a.5.5 0 0 1 0 1h-.25a1.5 1.5 0 0 0-1.5 1.5v1.75a1.5 1.5 0 0 1-1.09 1.44l-.54.15a.16.16 0 0 0 0 .32l.54.15a1.5 1.5 0 0 1 1.09 1.45v1.74a1.5 1.5 0 0 0 1.5 1.5h.25a.5.5 0 0 1 0 1h-.25a2.5 2.5 0 0 1-2.5-2.5"/>\n</symbol>','<symbol id="file-tree-builtin-markdown" viewBox="0 0 16 16">\n <path fill="currentColor" d="M1 12V4h2l2 2.5L7 4h2v8H7V7.5l-2 2-2-2V12zm9-3 3 3.5L16 9h-2V4h-2v5z"/>\n</symbol>','<symbol id="file-tree-builtin-mcp" viewBox="0 0 16 16">\n <path fill="currentColor" d="M9.26-.04a3 3 0 0 1 2 .82 2.8 2.8 0 0 1 .8 2.35 2.9 2.9 0 0 1 2.41.8l.03.02a2.74 2.74 0 0 1 0 3.94l-5.8 5.69-.04.06-.02.07q0 .04.02.07.01.04.04.06l1.2 1.17a.55.55 0 0 1 0 .79.6.6 0 0 1-.81 0l-1.2-1.17a1.3 1.3 0 0 1 0-1.84L13.7 7.1a1.65 1.65 0 0 0 .37-1.82 2 2 0 0 0-.37-.54l-.03-.03a1.73 1.73 0 0 0-2.4 0L6.47 9.4l-.07.06a.58.58 0 0 1-.92-.18.6.6 0 0 1 .12-.6l4.85-4.76a1.65 1.65 0 0 0 0-2.36 1.73 1.73 0 0 0-2.4 0l-6.43 6.3a.6.6 0 0 1-.8 0 .55.55 0 0 1 0-.8L7.25.79a3 3 0 0 1 2-.82"/>\n <path fill="currentColor" d="M9.26 2.19a.6.6 0 0 1 .52.34.6.6 0 0 1 0 .43l-.12.18L4.9 7.79a1.65 1.65 0 0 0 0 2.36 1.73 1.73 0 0 0 2.4 0l4.75-4.66a.58.58 0 0 1 .93.18.6.6 0 0 1-.12.61l-4.75 4.66a2.9 2.9 0 0 1-4.01 0 2.75 2.75 0 0 1-.62-3.04A3 3 0 0 1 4.1 7l4.74-4.65a.6.6 0 0 1 .4-.16"/>\n</symbol>','<symbol id="file-tree-builtin-python" viewBox="0 0 16 16">\n <path fill="currentColor" d="M8.33 8.4H10c1.16 0 1.9-.73 1.9-1.86V5.08q0-.24.25-.24h.74c.75 0 1.33.32 1.66.97q.4.73.41 1.46c.09.9.09 1.78-.24 2.67-.25.73-.75 1.3-1.58 1.46h-4.8c-.08 0-.25 0-.25.08v.4s.17.09.25.09h2.82q.34-.02.33.32v1.06c0 .56-.25.97-.75 1.13-.41.16-.83.33-1.24.4a7 7 0 0 1-2.98-.07 3 3 0 0 1-1.16-.49c-.33-.32-.58-.65-.5-1.14v-2.91c0-1.13.67-1.78 1.82-1.78q.89-.1 1.66-.08m2.32 4.86a.65.65 0 0 0-.66-.65c-.34 0-.67.33-.67.65s.33.57.67.65a.65.65 0 0 0 .66-.65" class="bg" opacity=".8"/>\n <path fill="currentColor" d="M7.67 7.6H6c-1.16 0-1.9.73-1.9 1.86v1.46q0 .24-.25.24h-.74c-.75 0-1.33-.32-1.66-.97a3 3 0 0 1-.41-1.46 6 6 0 0 1 .24-2.67c.25-.73.75-1.3 1.58-1.46h4.8c.08 0 .25 0 .25-.08v-.4s-.17-.09-.25-.09H4.85c-.24 0-.33-.08-.33-.32V2.65c0-.56.25-.97.75-1.13.41-.16.83-.33 1.24
2-.4a7 7 0 0 1 2.98.07c.41.09.83.25 1.16.49.33.32.58.65.5 1.13v2.92c0 1.14-.67 1.78-1.82 1.78-.58.08-1.16.08-1.66.08M5.35 2.73c0 .33.25.65.66.65.33 0 .66-.32.66-.65 0-.32-.33-.56-.66-.64a.65.65 0 0 0-.66.64" class="fg"/>\n</symbol>','<symbol id="file-tree-builtin-ruby" viewBox="0 0 16 16">\n <path fill="currentColor" fill-rule="evenodd" d="M11.04 2c.48 0 .92.23 1.18.6l2.54 3.65c.37.52.3 1.23-.15 1.69l-5.58 5.64a1.47 1.47 0 0 1-2.06 0L1.39 7.94a1.3 1.3 0 0 1-.15-1.7l2.54-3.63q.2-.3.5-.45.33-.16.68-.16zm.84 2.17a.5.5 0 0 0-.7-.05L8 6.84 4.83 4.12a.5.5 0 0 0-.65.76L6.65 7H3.5a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1H9.35l2.48-2.12a.5.5 0 0 0 .05-.7" clip-rule="evenodd"/>\n</symbol>','<symbol id="file-tree-builtin-rust" viewBox="0 0 16 16">\n <path fill="currentColor" fill-rule="evenodd" d="M8 .8a.2.2 0 0 1 .18.1l.38.6.16.02.5-.53.01-.01a.2.2 0 0 1 .33.08l.25.68.16.05.59-.43h.02a.2.2 0 0 1 .3.14l.12.71.15.08.65-.3a.2.2 0 0 1 .2.02.2.2 0 0 1 .1.18l-.03.72.12.1.71-.16a.2.2 0 0 1 .25.25l-.17.7q.06.06.1.13l.73-.03A.2.2 0 0 1 14 4a.2.2 0 0 1 .02.2l-.3.66.08.14.71.12a.2.2 0 0 1 .14.32l-.43.59.05.16.68.25a.2.2 0 0 1 .07.35l-.53.49.01.16.62.38a.2.2 0 0 1 0 .36l-.62.38-.01.16.53.5a.2.2 0 0 1-.07.34l-.68.25-.05.16.43.59a.2.2 0 0 1-.14.32l-.72.12-.07.15.3.65a.2.2 0 0 1-.02.2.2.2 0 0 1-.18.1l-.72-.03-.1.13.16.7a.2.2 0 0 1-.25.25l-.7-.17-.13.1.03.73a.2.2 0 0 1-.1.18.2.2 0 0 1-.2.02l-.66-.3-.14.08-.12.71a.2.2 0 0 1-.32.14l-.59-.43-.16.05-.25.68a.2.2 0 0 1-.34.07l-.5-.53-.16.01-.38.62a.2.2 0 0 1-.36 0l-.38-.62-.16-.01-.5.53a.2.2 0 0 1-.34-.07l-.25-.68-.16-.05-.59.43a.2.2 0 0 1-.32-.14L5 13.78l-.15-.07-.65.3a.2.2 0 0 1-.2-.02.2.2 0 0 1-.1-.18l.03-.72-.13-.1-.7.16a.2.2 0 0 1-.25-.25l.17-.7-.1-.13-.73.03a.2.2 0 0 1-.2-.3l.3-.66-.08-.14-.71-.12a.2.2 0 0 1-.14-.32l.43-.59-.05-.16-.68-.25A.2.2 0 0 1 1 9.22l.53-.5-.02-.16-.6-.38A.2.2 0 0 1 .8 8a.2.2 0 0 1 .1-.18l.6-.38.02-.16-.53-.5a.2.2 0 0 1 .07-.34l.68-.25.05-.16-.43-.59a.2.2 0 0 1 .14-.32L2.2 5l.08-.15L2 4.2a.2.2 0 0 1 .2-.3l.72.03.1-.13-.16-.7a.2.2 0 0 1 .25-.25l.7.16.13-.1-.03-.72A.2.2 0 0 1 4 2a.2.2 0 0 1 .2-.02l.65.3L5 2.2l.12-.71v-.03a.2.2 0 0 1 .32-.1l.59.41.16-.04.25-.68.01-.02A.2.2 0 0 1 6.8.99l.49.53.16-.02.38-.61.02-.02A.2.2 0 0 1 8 .79M6.8 9.45h1.26l.06.01q.03.01.03.05v1.52q0 .07-.09.06h-4.5A5.4 5.4 0 0 0 8 13.42a5.4 5.4 0 0 0 4.45-2.33h-2.42c-.36 0-.68-.5-.77-.75-.08-.22-.2-.91-.25-1.12-.15-.61-.59-.71-.78-.73H6.8zM8 2.58a5.4 5.4 0 0 0-4.07 1.85h5.74l.17.02c.23.03.6.12.96.35.34.23.83.68.83 1.4 0 .66-.55 1.16-1.08 1.5.42.33.7.53.86 1.44.04.17.34.32.62.29.29-.03.62-.16.62-.75v-.24q0-.1.07-.1h.68A5.43 5.43 0 0 0 8 2.59M2.96 6.03a5.4 5.4 0 0 0-.19 3.37h1.66V6.03zM6.8 7.06h1.66c.35 0 .77-.12.77-.47 0-.42-.55-.53-.65-.53H6.8z" clip-rule="evenodd"/>\n</symbol>','<symbol id="file-tree-builtin-swift" viewBox="0 0 16 16">\n <path fill="currentColor" d="M9.63 1c6.15 4.35 4.16 9.15 4.16 9.15s1.75 2.05 1.04 3.85c0 0-.72-1.26-1.93-1.26-1.17 0-1.85 1.26-4.2 1.26C3.47 14 1 9.46 1 9.46c4.71 3.22 7.93.94 7.93.94C6.8 9.12 2.29 3 2.29 3c3.93 3.47 5.63 4.39 5.63 4.39-1.01-.87-3.86-5.13-3.86-5.13C6.34 4.66 10.86 8 10.86 8c1.28-3.7-1.23-7-1.23-7"/>\n</symbol>','<symbol id="file-tree-builtin-table" viewBox="0 0 16 16">\n <path fill="currentColor" d="M8 4a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1H8z" class="bg" opacity=".4"/>\n <path fill="currentColor" d="M11.5 8a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5h-7a.5.5 0 0 1-.5-.5v-4a.5.5 0 0 1 .5-.5zM5 12h2.5v-1H5zm3.5 0H11v-1H8.5zM5 10h2.5V9H5zm3.5 0H11V9H8.5zm1-9a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z" class="fg"/>\n</symbol>','<symbol id="file-tree-builtin-text" viewBox="0 0 16 16">\n <path fill="currentColor" fill-rule="evenodd" d="M8 4a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1H8z" class="bg" clip-rule="evenodd" opacity=".4"/>\n <path fill="currentColor" d="M8.5 11a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1zm2-2a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1zm-1-8a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z"/>\n</symbol>','<symbol id="file-tree-builtin-typescript" viewBox="0 0 16 16">
2\n <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>\n <path fill="currentColor" d="M8.1 9.64h.95c.04.62.28.76 1.28.76s1.2-.14 1.2-.85c0-.66-.2-.85-1.2-1.07-1.79-.38-2.18-.7-2.18-1.86C8.15 5.3 8.54 5 10.31 5c1.67 0 2.04.26 2.07 1.42h-.95c-.02-.43-.23-.53-1.1-.53-1 0-1.22.14-1.22.74 0 .52.22.7 1.24.92 1.76.38 2.15.73 2.15 2 0 1.44-.4 1.75-2.24 1.75-1.8 0-2.18-.3-2.15-1.66m-3 1.57V5.99H3.5v-.9h4.21v.9H6.1v5.22z"/>\n</symbol>','<symbol id="file-tree-builtin-zip" viewBox="0 0 16 16">\n <path fill="currentColor" d="M4.585 2a2 2 0 0 1 1.028.285l1.788 1.072a1 1 0 0 0 .514.143H12A2 2 0 0 1 13.935 5H0V4a2 2 0 0 1 2-2z" class="bg" opacity=".5"/>\n <path fill="currentColor" fill-rule="evenodd" d="M14 12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-1.25h1v-1H0V6h14zM9.9 8.25c-.883 0-1.9.5-1.9.5H7v1h1v1s1.017.5 1.9.5c.884 0 1.6-.672 1.6-1.5s-.716-1.5-1.6-1.5M2 9.75v1h1v-1zm2 0v1h1v-1zm2 0v1h1v-1zm-5-1v1h1v-1zm2 0v1h1v-1zm2 0v1h1v-1z" class="fg" clip-rule="evenodd"/>\n</symbol>']),fi={minimal:di,standard:gi,complete:pi(gi,hi)},mi={".babelrc":"babel",".babelrc.json":"babel",".bash_profile":"bash",".bashrc":"bash",".browserslistrc":"browserslist",".dockerignore":"docker",".eslintignore":"eslint",".eslintrc":"eslint",".eslintrc.cjs":"eslint",".eslintrc.js":"eslint",".eslintrc.json":"eslint",".eslintrc.yaml":"eslint",".eslintrc.yml":"eslint",".gitattributes":"git",".gitignore":"git",".gitkeep":"git",".gitmodules":"git",".oxlintrc.json":"oxc",".postcssrc":"postcss",".postcssrc.json":"postcss",".postcssrc.yaml":"postcss",".postcssrc.yml":"postcss",".prettierignore":"prettier",".prettierrc":"prettier",".prettierrc.cjs":"prettier",".prettierrc.js":"prettier",".prettierrc.json":"prettier",".prettierrc.mjs":"prettier",".prettierrc.toml":"prettier",".prettierrc.yaml":"prettier",".prettierrc.yml":"prettier",".stylelintignore":"stylelint",".stylelintrc":"stylelint",".stylelintrc.cjs":"stylelint",".stylelintrc.js":"stylelint",".stylelintrc.json":"stylelint",".stylelintrc.mjs":"stylelint",".stylelintrc.yaml":"stylelint",".stylelintrc.yml":"stylelint",".terraform.lock.hcl":"terraform",".zprofile":"bash",".zshenv":"bash",".zshrc":"bash","babel.config.cjs":"babel","babel.config.js":"babel","babel.config.json":"babel","babel.config.mjs":"babel","biome.json":"biome","biome.jsonc":"biome","bootstrap.bundle.js":"bootstrap","bootstrap.bundle.min.js":"bootstrap","bootstrap.css":"bootstrap","bootstrap.js":"bootstrap","bootstrap.min.css":"bootstrap","bootstrap.min.js":"bootstrap","bun.lock":"bun","bun.lockb":"bun","bunfig.toml":"bun","claude.md":"claude","compose.yaml":"docker","compose.yml":"docker","docker-compose.override.yml":"docker","docker-compose.yaml":"docker","docker-compose.yml":"docker",dockerfile:"docker","eslint.config.cjs":"eslint","eslint.config.js":"eslint","eslint.config.mjs":"eslint","eslint.config.mts":"eslint","eslint.config.ts":"eslint",gemfile:"ruby","next.config.js":"nextjs","next.config.mjs":"nextjs","next.config.mts":"nextjs","next.config.ts":"nextjs","postcss.config.cjs":"postcss","postcss.config.js":"postcss","postcss.config.mjs":"postcss","postcss.config.ts":"postcss","prettier.config.cjs":"prettier","prettier.config.js":"prettier","prettier.config.mjs":"prettier",rakefile:"ruby","readme.md":"markdown","stylelint.config.cjs":"stylelint","stylelint.config.js":"stylelint","stylelint.config.mjs":"stylelint","svgo.config.cjs":"svgo","svgo.config.js":"svgo","svgo.config.mjs":"svgo","svgo.config.ts":"svgo","tailwind.config.cjs":"tailwind","tailwind.config.js":"tailwind","tailwind.config.mjs":"tailwind","tailwind.config.ts":"tailwind","vite.config.js":"vite","vite.config.mjs":"vite","vite.config.mts":"vite","vite.config.ts":"vite","webpack.config.babel.js":"webpack","webpack.config.cjs":"webpack","webpack.config.js":"webpack","webpack.config.mjs":"webpack","webpack.config.ts":"webpack"},vi={"7z":"zip",astro:"astro",AUTHORS:"text",avif:"image",bash:"bash",bmp:"image",bz2:"zip",c:"c",cc:"cpp",cfg:"text",CHANGELOG:"text",cjs:"javascript","code-workspace":"vscode",conf:"text",CONTRIBUTORS:"text",cpp:"cpp",csh:"bash",css:"css",csv:"table",cts:"typescript",cxx:"cpp",db:"database",editorconfig:"text",env:"text","env.development":"text","env.local":"text","env.production":"text",eot:"font",erb:"ruby",fish:"bash",gemspec:"ruby",gif:"image",go:"go",gql:"graphql",graphql:"graphql",gz:"zip",h:"c",hh:"cpp",hpp:"cpp",htm:"html",html:"html",hxx:"cpp",icns:"image",ico:"image",ini:"text",inl:"cpp",jar:"zip",jpeg:"image",jpg:"image",js:"javascript",json:"json",json5:"json",jsonc:"json",jsonl:"json",jsx:"javascript",ksh:"bash",less:"css",LICENSE:"text",log:"text",markdown:"markdown",mcp:"mcp",md:"markdown",mdx:"markdown","mdx.tsx":"markdown",mjs:"javascript",mm:"cpp",mts:"typescript",ods:"table",otf:"font",png:"image",postcss:"css",py:"python",pyi:"python",pyw:"python",pyx:"python",rake:"ruby",rar:"zip",rb:"ruby",rs:"rust",rst:"text",rtf:"text",sass:"css",scss:"css",sh:"bash",sql:"database",sqlite:"database",sqlite3:"database",styl:"css",svelte:"svelte",svg:"svg",swift:"swift",tar:"zip",tf:"terraform",tfstate:"terraform",tfvars:"terraform",tgz:"zip",tif:"image",tiff:"image",ts:"typescript",t
2sv:"table",tsx:"typescript",ttf:"font",txt:"text",vue:"vue",war:"zip",wasm:"wasm",wast:"wasm",wat:"wasm",webp:"image",woff:"font",woff2:"font",xhtml:"html",xls:"table",xlsx:"table",xz:"zip",yaml:"yml",yml:"yml",zig:"zig",zip:"zip",zsh:"bash"},yi={jsx:"react",sass:"sass",scss:"sass",tsx:"react"},bi=new Set(["bash","c","cpp","css","database","default","font","git","go","html","image","javascript","json","markdown","mcp","python","ruby","rust","swift","table","text","typescript","zip"]),wi=new Set(["complete"]);function xi(e){return fi["none"===e?"minimal":e]}const Ci="file-tree-container",Si="data-file-tree-style",Ii="data-file-tree-unsafe-css",ki="data-file-tree-scrollbar-gutter-measured",Pi="header",Di="context-menu",Mi="context-menu-trigger";function Ei(e){return null!=e.spriteSheet||null!=e.remap||null!=e.byFileName||null!=e.byFileExtension||null!=e.byFileNameContains}function Ti(e){return null==e?{set:"complete",colored:!0}:"string"==typeof e?{set:e,colored:!0}:{...e,set:e.set??(Ei(e)?"none":"complete"),colored:e.colored??!0}}const Ai=e=>e.trim().toLowerCase();function _i(e,t){return"string"==typeof e?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function Ni(e){const t=Ti(e),n=t.remap,r=new Map;for(const[s,a]of Object.entries(t.byFileName??{}))r.set(s.toLowerCase(),a);const o=new Map;for(const[s,a]of Object.entries(t.byFileExtension??{}))o.set(Ai(s),a);const i=Object.entries(t.byFileNameContains??{}).map(([e,t])=>[e.toLowerCase(),t]);return{resolveIcon:(e,s)=>{if("file-tree-icon-file"===e&&null!=s){const n=(l=s).split("/").at(-1)??l,c=n.toLowerCase(),u=r.get(c);if(null!=u)return _i(u,e);for(const[t,r]of i)if(c.includes(t))return _i(r,e);const d=(e=>{const t=e.toLowerCase().split("."),n=[];for(let r=1;r<t.length;r+=1)n.push(t.slice(r).join("."));return n})(n);for(const t of d){const n=o.get(t);if(null!=n)return _i(n,e)}const h=function(e,t,n){if("minimal"===e||"none"===e)return;const r="complete"===e,o=mi[t.toLowerCase()];if(null!=o&&(r||bi.has(o)))return o;for(const i of n){if(r){const e=yi[i];if(null!=e)return e}const e=vi[i];if(null!=e&&(r||bi.has(e)))return e}return"default"}(t.set,n,d);if(null!=h&&"none"!==t.set)return{name:(a=h,`file-tree-builtin-${a}`),remappedFrom:e,token:h}}var a,l;const c=null==n?void 0:n[e];return null==c?{name:e}:_i(c,e)}}}function Ri(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function ji(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function zi(e,t){if(null!=t.childIdByNameId)return t.childIdByNameId;const n=new Map;for(const r of t.childIds){const t=e[r];null!=t&&n.set(t.nameId,r)}return t.childIdByNameId=n,n}function Li(e){if(null!=e.childPositionById)return e.childPositionById;const t=new Map;for(let n=0;n<e.childIds.length;n++){const r=e.childIds[n];null!=r&&t.set(r,n)}return e.childPositionById=t,t}function $i(e,t){null!=e.childPositionById&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function Fi(e,t){if(null!=e.childPositionById)for(let n=t;n<e.childIds.length;n++){const t=e.childIds[n];null!=t&&e.childPositionById.set(t,n)}}function Oi(e,t){let n=0,r=0;for(const o of t.childIds){const t=e[o];null!=t&&(n+=t.subtreeNodeCount,r+=t.visibleSubtreeCount)}t.totalChildSubtreeNodeCount=n,t.totalChildVisibleSubtreeCount=r,Bi(e,t)}function Hi(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,null==e.childVisibleChunkSums||0===r)return;const o=Li(e).get(t);if(void 0===o)return;const i=o>>5;e.childVisibleChunkSums[i]+=r}function qi(e,t,n){const r=t.childVisibleChunkSums;if(null!=r){let o=n,i=0;for(const s of r){if(o<s){const r=Ui(e,t,i,o);return{...r,childVisibleIndex:n-r.localVisibleIndex}}o-=s,i+=32}throw new Error(`Visible child index ${String(n)} is out of range`)}let o=n;for(let i=0;i<t.childIds.length;i++){const r=t.childIds[i];if(null==r)continue;const s=e[r];if(null!=s){if(o<s.visibleSubtreeCount)return{childIndex:i,childVisibleIndex:n-o,localVisibleIndex:o};
2o-=s.visibleSubtreeCount}}throw new Error(`Visible child index ${String(n)} is out of range`)}function Vi(e,t,n){let r=0;const o=t.childVisibleChunkSums;let i=0;if(null!=o){const e=n>>5;for(let t=0;t<e;t+=1)r+=o[t]??0;i=e<<5}for(let s=i;s<n;s+=1){const n=t.childIds[s];if(null==n)continue;const o=e[n];null!=o&&(r+=o.visibleSubtreeCount)}return r}function Bi(e,t){if(t.childIds.length<128)return void(t.childVisibleChunkSums=null);const n=Math.ceil(t.childIds.length/32),r=new Int32Array(n);for(let o=0;o<t.childIds.length;o++){const n=t.childIds[o];if(null==n)continue;const i=e[n];null!=i&&(r[o>>5]+=i.visibleSubtreeCount)}t.childVisibleChunkSums=r}function Ui(e,t,n,r){const o=Math.min(t.childIds.length,n+32);let i=r;for(let s=n;s<o;s++){const n=t.childIds[s];if(null==n)continue;const r=e[n];if(null!=r){if(i<r.visibleSubtreeCount)return{childIndex:s,localVisibleIndex:i};i-=r.visibleSubtreeCount}}throw new Error(`Visible child index ${String(r)} is out of range`)}function Wi(e,t,n=0){return e<<4|n<<3|t}function Gi(e){return e.depthAndFlags>>>4}function Zi(e){return(8&e.depthAndFlags)>>3}function Ki(e){return!!(8&e.depthAndFlags)}function Yi(e){return 7&e.depthAndFlags}function Xi(e,t){return 0!==(Yi(e)&t)}function Qi(e,t){e.depthAndFlags|=t}const Ji=Symbol("benchmarkInstrumentation");function es(e){return null==e?null:e[Ji]??null}function ts(e,t,n){return null==e?n():e.measurePhase(t,n)}function ns(e,t,n){Number.isFinite(n)&&null!=e&&e.setCounter(t,n)}function rs(e){return e>=48&&e<=57}function os(e){const t=[];let n=0,r=0;for(;r<e.length;){for(;r<e.length&&!rs(e.charCodeAt(r));)r+=1;if(r>=e.length)break;r>n&&t.push(e.slice(n,r));let o=0;for(;r<e.length&&rs(e.charCodeAt(r));)o=10*o+(e.charCodeAt(r)-48),r+=1;t.push(o),n=r}return(n<e.length||0===t.length)&&t.push(e.slice(n)),t}function is(e){const t=e.toLowerCase();return{lowerValue:t,tokens:os(t)}}function ss(e,t){if(1===e.tokens.length&&1===t.tokens.length&&"string"==typeof e.tokens[0]&&"string"==typeof t.tokens[0])return e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1;const n=function(e,t){const n=Math.min(e.length,t.length);for(let r=0;r<n;r++){const n=e[r],o=t[r];if(n===o)continue;if("number"==typeof n&&"number"==typeof o)return n<o?-1:1;const i=String(n),s=String(o);if(i!==s)return i<s?-1:1}return e.length!==t.length?e.length<t.length?-1:1:0}(e.tokens,t.tokens);return 0!==n?n:e.lowerValue!==t.lowerValue?e.lowerValue<t.lowerValue?-1:1:0}function as(e,t,n){const r=ss(n(e),n(t));return 0!==r?r:e===t?0:e<t?-1:1}function ls(e,t){return as(e,t,is)}function cs(e,t){return t!==e.segments.length-1||e.isDirectory?1:0}function us(e,t){return function(e,t){const n=Math.min(e.segments.length,t.segments.length);for(let r=0;r<n;r++){const n=e.segments[r],o=t.segments[r];if(n===o)continue;const i=cs(e,r);return i!==cs(t,r)?1===i?-1:1:ls(n,o)}return e.segments.length!==t.segments.length?e.segments.length<t.segments.length?-1:1:e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1}(e,t)}function ds(e,t){const n=e.sortKeyById[t];if(void 0!==n)return n;const r=is(e.valueById[t]);return e.sortKeyById[t]=r,r}function hs(e={}){return{flattenEmptyDirectories:!1!==e.flattenEmptyDirectories,sort:e.sort??"default"}}function ps(e){const t=e.length>0&&47===e.charCodeAt(e.length-1),n=t?e.length-1:e.length,r=[];let o=0;for(let i=0;i<n;i++)47===e.charCodeAt(i)&&(r.push(e.slice(o,i)),o=i+1);return r.push(e.slice(o,n)),{hasTrailingSlash:t,segments:r}}function gs(e){const{hasTrailingSlash:t,segments:n}=ps(e);return{basename:n[n.length-1]??"",isDirectory:t,path:e,segments:n}}function fs(e){if(0===e.length)return{requiresDirectory:!1,segments:[]};const{hasTrailingSlash:t,segments:n}=ps(e);return{requiresDirectory:t,segments:n}}function ms(){const e=new Map;return e.set("",0),{idByValue:e,valueById:[""],sortKeyById:[is("")]}}function vs(e,t){const n=e.idByValue.get(t);if(void 0!==n)return n;const r=e.valueById.length;return e.idByValue.set(t,r),e.valueById.push(t),r}function ys(e,t){const n=e.valueById[t];if(void 0===n)throw new Error(`Unknown segment ID: ${String(t)}`);return n}const bs=Symbol("pathStorePreparedInputKind");function ws(e,t){return e[bs]=t,e}function xs(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function Cs(e,t,n){return"default"===n?us(e,t):n(xs(e),xs(t))}function Ss(e){return e.isDirectory?e.segments.length:e.segments.length-1}function Is(e){const t=e,n=t.preparedPaths;if("prepared"===t[bs]&&null!=n)return n;if(r=n,!Array.isArray(r)||!r.every(e=>null!=e&&"object"==typeof e&&"string"==typeof e.path&&Array.isArray(e.segments)&&"string"==typeof e.basename&&"boolean"==typeof e.isDirectory))throw new Error("preparedInput must come from PathStore.prepareInput()");var r;return n}function ks(e){const t=e;return"presorted"===t[bs]&&null!=t.presortedPaths?t.presortedPaths:(n=t.presortedPaths,Array.isArray(n)&&n.every(e=>"string"==typeof e)?t.presortedPaths:null);var n}function Ps(e,t={}){const n=hs(t),r=es(t);ns(r,"workload.inputFiles",e.length);const o=ts(r,"store.preparePathEntries.parse",()=>e.map(e=>gs(e)));return ts(r,"store.preparePathEntries.sort",()=>o.sort((e,t)=>
2Cs(e,t,n.sort))),o}var Ds=class{constructor(e={}){$t(this,"directories",new Map),$t(this,"directoryStack",[0]),$t(this,"presortedDirectoryNodeIds",[]),$t(this,"initialExpandedPathSet"),$t(this,"createdDirectoriesAllExpanded",!1),$t(this,"createdDirectoryCount",0),$t(this,"lastPreparedPath",null),$t(this,"nodes",[{depthAndFlags:Wi(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}]),$t(this,"options"),$t(this,"instrumentation"),$t(this,"segmentSortKeyCache",new Map),$t(this,"segmentTable",ms()),$t(this,"hasDeferredDirectoryIndexes",!1),this.instrumentation=es(e),this.options=hs(e);const t=e.initialExpandedPaths??null;if(null==t||0===t.length)this.initialExpandedPathSet=null;else{const e=new Set,n=t.length;for(let r=0;r<n;r+=1){const n=t[r],o=n.length;e.add(o>0&&47===n.charCodeAt(o-1)?n.slice(0,o-1):n)}this.initialExpandedPathSet=e,this.createdDirectoriesAllExpanded=!0}this.directories.set(0,Ri())}appendPaths(e){return ts(this.instrumentation,"store.builder.appendPaths.parse",()=>this.appendPreparedPaths(e.map(e=>gs(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,ts(this.instrumentation,"store.builder.appendPreparedPaths",()=>{for(const n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return ts(this.instrumentation,"store.builder.appendPresortedPaths",()=>{if(!1===t)return void this.appendPresortedFilePaths(e);this.createdDirectoriesAllExpanded=!1;let n=null,r=0;const o=this.nodes,i=this.segmentTable,s=i.idByValue,a=i.valueById,l=this.directoryStack;let c=0,u="",d=0;for(const t of e){if(n===t)throw new Error(`Duplicate path: "${t}"`);const e=t.length>0&&47===t.charCodeAt(t.length-1),i=e?t.length-1:t.length;let h=0,p=0;if(null!=n)if(u.length>0&&t.length>u.length&&t.startsWith(u))h=d,p=u.length;else{const r=Math.min(i,n.length);let o=!0;for(let e=0;e<r;e++){const r=t.charCodeAt(e);if(r!==n.charCodeAt(e)){o=!1;break}47===r&&(h++,p=e+1)}o&&e&&r===i&&n.length>i&&47===n.charCodeAt(i)&&(h++,p=i+1)}c=h,r=h;let g=p,f=t.indexOf("/",g);for(;f>=0&&f<i;){const e=l[c];if(void 0===e)throw new Error("Directory stack underflow while building the path store");r++;const n=t.slice(g,f);let i=s.get(n);void 0===i&&(i=a.length,s.set(n,i),a.push(n));const u=o.length;o.push({depthAndFlags:Wi(r,0,1),nameId:i,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(t.slice(0,f)),c++,l[c]=u,g=f+1,f=t.indexOf("/",g)}if(e){if(g<i){const e=l[c];if(void 0===e)throw new Error(`Unable to resolve directory parent for "${t}"`);r++;const n=t.slice(g,i);let u=s.get(n);void 0===u&&(u=a.length,s.set(n,u),a.push(n));const d=o.length;o.push({depthAndFlags:Wi(r,0,1),nameId:u,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),c++,l[c]=d}const e=l[c];if(void 0===e)throw new Error(`Unable to resolve directory node for "${t}"`);this.promoteDirectoryToExplicit(e,t)}else{const e=l[c];if(void 0===e)throw new Error(`Unable to resolve file parent for "${t}"`);const n=t.slice(g);let i=s.get(n);void 0===i&&(i=a.length,s.set(n,i),a.push(n)),o.push({depthAndFlags:Wi(r+1,0),nameId:i,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1})}g!==u.length&&(u=t.substring(0,g),d=r),n=t}l.length=c+1,null!=n&&(this.lastPreparedPath=gs(n)),this.hasDeferredDirectoryIndexes=!0}),this}appendPresortedFilePaths(e){let t=null,n=0;const r=this.nodes,o=this.segmentTable,i=o.idByValue,s=o.valueById,a=this.directoryStack;let l=0,c="",u=0;for(const d of e){if(t===d)throw new Error(`Duplicate path: "${d}"`);const e=d.length;let o=0,h=0;if(null!=t)if(c.length>0&&d.length>c.length&&d.startsWith(c))o=u,h=c.length;else{const n=Math.min(e,t.length);for(let e=0;e<n;e++){const n=d.charCodeAt(e);if(n!==t.charCodeAt(e))break;47===n&&(o++,h=e+1)}}l=o,n=o;let p=h,g=d.indexOf("/",p);for(;g>=0;){const e=a[l];if(void 0===e)throw new Error("Directory stack underflow while building the path store");n++;const t=d.slice(p,g);let o=i.get(t);void 0===o&&(o=s.length,i.set(t,o),s.push(t));const c=r.length;r.push({depthAndFlags:Wi(n,0,1),nameId:o,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(d.slice(0,g)),this.presortedDirectoryNodeIds.push(c),l++,a[l]=c,p=g+1,g=d.indexOf("/",p)}const f=a[l];if(void 0===f)throw new Error(`Unable to resolve file parent for "${d}"`);const m=d.slice(p);let v=i.get(m);void 0===v&&(v=s.length,i.set(m,v),s.push(m)),r.push({depthAndFlags:Wi(n+1,0),nameId:v,parentId:f,subtreeNodeCount:1,visibleSubtree
2Count:1}),p!==c.length&&(c=d.substring(0,p),u=n),t=d}a.length=l+1,null!=t&&(this.lastPreparedPath=gs(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){const t=!0===e.skipSubtreeCountPass;return this.hasDeferredDirectoryIndexes?(ts(this.instrumentation,"store.builder.buildDirectoryIndexes",()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||ts(this.instrumentation,"store.builder.computeSubtreeCounts",()=>this.computeSubtreeCounts(0)),{directories:this.directories,nodes:this.nodes,options:this.options,rootId:0,segmentTable:this.segmentTable,presortedDirectoryNodeIds:this.presortedDirectoryNodeIds.length>0?this.presortedDirectoryNodeIds:null}}didMatchAllInitialExpandedPaths(){return this.createdDirectoriesAllExpanded&&null!=this.initialExpandedPathSet&&this.createdDirectoryCount===this.initialExpandedPathSet.size}appendPreparedPath(e,t){if(this.hasDeferredDirectoryIndexes&&(this.buildDirectoryIndexes(),this.hasDeferredDirectoryIndexes=!1),null!=this.lastPreparedPath){if(e.path===this.lastPreparedPath.path)throw new Error(`Duplicate path: "${e.path}"`);if(t&&("default"===this.options.sort?function(e,t,n){const r=e=>{const t=n.get(e);if(null!=t)return t;const r=is(e);return n.set(e,r),r},o=Math.min(e.segments.length,t.segments.length);for(let i=0;i<o;i++){const n=e.segments[i],o=t.segments[i];if(n===o)continue;const s=cs(e,i);return s!==cs(t,i)?1===s?-1:1:as(n,o,r)}return e.segments.length!==t.segments.length?e.segments.length<t.segments.length?-1:1:e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1}(this.lastPreparedPath,e,this.segmentSortKeyCache):Cs(this.lastPreparedPath,e,this.options.sort))>0)throw new Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}const n=this.lastPreparedPath,r=Ss(e),o=null==n?0:Ss(n),i=null==n?0:function(e,t){const n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return r;return n}(n.segments,e.segments),s=Math.min(i,r,o);this.directoryStack.length=s+1;for(let l=s;l<r;l++){const n=this.directoryStack[this.directoryStack.length-1];if(void 0===n)throw new Error("Directory stack underflow while building the path store");const r=t?this.getOrCreateDirectoryChild(n,e.segments[l]):this.createDirectoryChild(n,e.segments[l]);this.directoryStack.push(r)}if(e.isDirectory){const t=this.directoryStack[this.directoryStack.length-1];if(void 0===t)throw new Error(`Unable to resolve directory node for "${e.path}"`);return this.promoteDirectoryToExplicit(t,e.path),void(this.lastPreparedPath=e)}const a=this.directoryStack[this.directoryStack.length-1];if(void 0===a)throw new Error(`Unable to resolve file parent for "${e.path}"`);t?this.createFileChild(a,e.basename,e.path):this.createFileChildUnchecked(a,e.basename),this.lastPreparedPath=e}recordCreatedDirectoryPath(e){this.createdDirectoriesAllExpanded&&null!=this.initialExpandedPathSet&&(this.createdDirectoryCount+=1,this.initialExpandedPathSet.has(e)||(this.createdDirectoriesAllExpanded=!1))}createFileChild(e,t,n){const r=vs(this.segmentTable,t),o=this.getDirectoryIndex(e),i=o.childIdByNameId;if(null!=i&&void 0!==i.get(r))throw new Error(`Path collides with an existing entry: "${n}"`);const s=this.nodes[e];if(void 0===s)throw new Error(`Unknown parent node ID: ${String(e)}`);const a=this.nodes.length;return this.nodes.push({depthAndFlags:Wi(Gi(s)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),null!=i&&i.set(r,a),$i(o,a),a}createFileChildUnchecked(e,t){const n=vs(this.segmentTable,t),r=this.getDirectoryIndex(e),o=this.nodes[e];if(void 0===o)throw new Error(`Unknown parent node ID: ${String(e)}`);const i=this.nodes.length;return this.nodes.push({depthAndFlags:Wi(Gi(o)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),null!=r.childIdByNameId&&r.childIdByNameId.set(n,i),$i(r,i),i}getOrCreateDirectoryChild(e,t){const n=vs(this.segmentTable,t),r=this.getDirectoryIndex(e);if(null!=r.childIdByNameId){const e=r.childIdByNameId.get(n);if(void 0!==e){const n=this.nodes[e];if(null!=n&&!Ki(n))throw new Error(`Path collides with an existing file while creating directory "${t}"`);return e}}const o=this.nodes[e];if(void 0===o)throw new Error(`Unknown parent node ID: ${String(e)}`);const i=this.nodes.length;return this.nodes.push({depthAndFlags:Wi(Gi(o)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtree
2Count:1}),null!=r.childIdByNameId&&r.childIdByNameId.set(n,i),$i(r,i),this.directories.set(i,Ri()),i}createDirectoryChild(e,t){const n=vs(this.segmentTable,t),r=this.getDirectoryIndex(e),o=this.nodes[e];if(void 0===o)throw new Error(`Unknown parent node ID: ${String(e)}`);const i=this.nodes.length;return this.nodes.push({depthAndFlags:Wi(Gi(o)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),null!=r.childIdByNameId&&r.childIdByNameId.set(n,i),$i(r,i),this.directories.set(i,Ri()),i}promoteDirectoryToExplicit(e,t){const n=this.nodes[e];if(void 0===n)throw new Error(`Unknown directory node ID: ${String(e)}`);if(!Ki(n))throw new Error(`Path is not a directory: "${t}"`);if(Xi(n,1))throw new Error(`Duplicate path: "${t}"`);Qi(n,1)}getDirectoryIndex(e){const t=this.directories.get(e);if(void 0!==t)return t;throw new Error(`Unknown directory child index for node ${String(e)}`)}buildPresortedFinish(e){const t=this.nodes,n=this.directories;n.set(0,{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0});let r=-1,o=null;for(let i=1;i<t.length;i++){const e=t[i];if(null==e)continue;if(Ki(e)){const e=ji();n.set(i,e),r=i,o=e}let s;e.parentId===r?s=o:(s=n.get(e.parentId),r=e.parentId,o=s??null),null!=s&&s.childIds.push(i)}if(!e)for(let i=t.length-1;i>=1;i--){const e=t[i];if(null==e)continue;const n=t[e.parentId];null!=n&&(n.subtreeNodeCount+=e.subtreeNodeCount,n.visibleSubtreeCount+=e.visibleSubtreeCount)}}buildDirectoryIndexes(){const e=this.nodes;for(let t=1;t<e.length;t++){const n=e[t];if(null==n)continue;Ki(n)&&this.directories.set(t,Ri());const r=this.directories.get(n.parentId);null!=r&&(null!=r.childIdByNameId&&r.childIdByNameId.set(n.nameId,t),$i(r,t))}}computeSubtreeCounts(e){const t=this.nodes[e];if(void 0===t)throw new Error(`Unknown node ID: ${String(e)}`);if(!Ki(t))return t.subtreeNodeCount=1,t.visibleSubtreeCount=1,1;const n=this.getDirectoryIndex(e);let r=1;for(const o of n.childIds)r+=this.computeSubtreeCounts(o);return Oi(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function Ms(e,t="closed",n=null){const r=function(e){if("number"!=typeof e)return e;if(!Number.isInteger(e)||e<0)throw new Error(`initialExpansion must be "open", "closed", or a non-negative integer depth. Received: ${String(e)}`);return e}(t);return{activeNodeCount:e.nodes.length-1,collapsedDirectoryIds:new Set,collapseNewDirectoriesByDefault:!1,defaultExpansion:r,directoriesOpenByDefault:"open"===r,hasCollapsedDirectoryOverrides:!1,directoryLoadInfoById:new Map,expandedDirectoryIds:new Set,instrumentation:n,listeners:new Map,pathCacheByNodeId:new Map([[e.rootId,{path:"",version:0}]]),pathCacheVersion:0,snapshot:e,transactionStack:[]}}function Es(e,t){return!!Xi(t,2)||("open"===e.defaultExpansion||"closed"!==e.defaultExpansion&&Gi(t)<=e.defaultExpansion)}function Ts(e,t,n=e.snapshot.nodes[t]){return!(null==n||!Ki(n))&&(!(!e.directoriesOpenByDefault||e.hasCollapsedDirectoryOverrides)||!e.collapsedDirectoryIds.has(t)&&(!!e.expandedDirectoryIds.has(t)||Es(e,n)))}function As(e,t,n,r=e.snapshot.nodes[t]){if(null==r||!Ki(r))return;const o=Es(e,r);return n?o?(e.collapsedDirectoryIds.delete(t),void(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0)):void e.expandedDirectoryIds.add(t):o?(e.collapsedDirectoryIds.add(t),void(e.hasCollapsedDirectoryOverrides=!0)):void e.expandedDirectoryIds.delete(t)}function _s(e,t){const n=e.directoryLoadInfoById.get(t);if(null!=n)return n;const r={activeAttemptId:null,errorMessage:null,nextAttemptId:1,state:"loaded"};return e.directoryLoadInfoById.set(t,r),r}function Ns(e,t){var n;return(null==(n=e.directoryLoadInfoById.get(t))?void 0:n.state)??"loaded"}function Rs(e,t){e.directoryLoadInfoById.delete(t)}function js(e,t,n){return{...n,visibleCountDelta:Vs(e)-t}}function zs(e,t){const n=Vs(e),r={affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]};e.transactionStack.push(r);try{t()}catch(o){throw Fs(e,r,!1),o}Fs(e,r,!0,Vs(e)-n)}function Ls(e,t){const n=e.instrumentation;null!=n?ts(n,"store.events.record",()=>$s(e,t)):$s(e,t)}function $s(e,t){const n=e.transactionStack[e.transactionStack.length-1]??null;null!=n?(n.events.push(t),function(e,t){for(const n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(const n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}(n,t)):Hs(e,t)}function Fs(e,t,n,r=null){if(e.transactionStack.pop()!==t)throw new Error("Transaction stack underflow");if(!n)return;const o=e.transactionStack[e.transactionStack.length-1]??null;if(null!=o){const n=e.instrumentation;return void(null==n?Os(o,t):ts(n,"store.events.batch.merge",()=>Os(o,t)))}const i=function(e,t){return{affectedAncestorIds:[...e.affectedAncestorIds],affectedNodeIds:[...e.affectedNodeIds],canonicalChanged:e.events.some(e=>e.canonicalChanged),events:[...e.events],operation:"batch",projectionChanged:e.events.some(e=>e.projectionChanged),visibleCountDelta:t}}(t,r),s=e.instrumentation;null!=s?ts(s,"store.events.batch.commit",()=>Hs(e,i)):Hs(e,i)}function Os(e,t){for(const n of t.events)e.events.push(n);!function(e,t){for(const n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(const n of t.affectedNodeIds)e.affectedNodeIds.add(n)}(e,t)}function Hs(e,t){const n=e.instrumentation;null!=n?ts(n,"store.events.emit",()=>qs(e,t)):qs(e,t)}function qs(e,t){var n,r;
2null==(n=e.listeners.get(t.operation))||n.forEach(e=>e(t)),null==(r=e.listeners.get("*"))||r.forEach(e=>e(t))}function Vs(e){var t;return(null==(t=e.snapshot.nodes[e.snapshot.rootId])?void 0:t.visibleSubtreeCount)??0}function Bs(e,t){if(!0!==e.snapshot.options.flattenEmptyDirectories)return null;const n=e.snapshot.nodes[t];if(null==n||!Ki(n)||Xi(n,2))return null;const r=e.snapshot.directories.get(t);if(null==r||1!==r.childIds.length)return null;const o=r.childIds[0];if(null==o)return null;const i=e.snapshot.nodes[o];return null!=i&&Ki(i)?o:null}function Us(e,t){let n=t;for(;;){const t=Bs(e,n);if(null==t)return n;n=t}}function Ws(e,t){const n=[t];let r=t;for(;;){const t=Bs(e,r);if(null==t)return n;n.push(t),r=t}}function Gs(e,t){const n=null==t?e.snapshot.rootId:na(e,t);return null==n?[]:function(e,t){const n=e.snapshot.nodes[t];if(void 0===n||Xi(n,4))return[];if(!Ki(n))return[Qs(e,t)];if(0===oa(e,t).childIds.length)return Xi(n,1)&&!Xi(n,2)?[Qs(e,t)]:[];const r=[],o=[{childIndex:0,nodeId:t}];for(;o.length>0;){const t=o[o.length-1];if(null==t)break;const n=e.snapshot.nodes[t.nodeId];if(void 0===n||Xi(n,4)){o.pop();continue}if(!Ki(n)){r.push(Qs(e,t.nodeId)),o.pop();continue}const i=oa(e,t.nodeId);if(0===i.childIds.length){Xi(n,1)&&!Xi(n,2)&&r.push(Qs(e,t.nodeId)),o.pop();continue}const s=i.childIds[t.childIndex];null!=s?(t.childIndex++,o.push({childIndex:0,nodeId:s})):o.pop()}return r}(e,n)}function Zs(e,t){const n=gs(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),o=pa(e,function(e,t){let n=e.snapshot.rootId;for(const r of t){const t=e.snapshot.segmentTable.idByValue.get(r);if(null==t)break;const o=zi(e.snapshot.nodes,oa(e,n)).get(t);if(null==o)break;if(!Ki(ia(e,o)))break;n=o}return n}(e,r)),{createdNodeIds:i,directoryId:s}=function(e,t){const n=[];let r=e.snapshot.rootId;for(const o of t){const t=vs(e.snapshot.segmentTable,o),i=oa(e,r),s=zi(e.snapshot.nodes,i).get(t);if(void 0===s)r=sa(e,r,t),n.push(r);else{if(!Ki(ia(e,s)))throw new Error(`Cannot create a directory that collides with an existing file: "${o}"`);r=s}}return{createdNodeIds:n,directoryId:r}}(e,r),a=new Set(i);let l=s;if(n.isDirectory){const n=ia(e,s);if(Xi(n,1))throw new Error(`Path already exists: "${t}"`);Qi(n,1),e.pathCacheByNodeId.set(s,{path:t,version:e.pathCacheVersion}),a.add(s)}else l=function(e,t,n){const r=vs(e.snapshot.segmentTable,n),o=oa(e,t);if(zi(e.snapshot.nodes,o).has(r))throw new Error(`Path already exists: "${function(e,t,n){const r=Qs(e,t);return 0===r.length?n:`${r}${n}`}(e,t,n)}"`);const i=ia(e,t),s=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:Wi(Gi(i)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),aa(e,t,s),e.activeNodeCount++,s}(e,s,n.basename),a.add(l);Js(e,s);const c=pa(e,s);return{affectedAncestorIds:(u={affectedAncestorIds:ta(e,l),affectedNodeIds:[...a],path:t,projectionChanged:ga(o,c)}).affectedAncestorIds??[],affectedNodeIds:u.affectedNodeIds??[],canonicalChanged:!0,operation:"add",path:u.path,projectionChanged:u.projectionChanged,visibleCountDelta:null};var u}function Ks(e,t,n){const r=na(e,t);if(null==r)throw new Error(`Path does not exist: "${t}"`);const o=ia(e,r);if(Xi(o,2))throw new Error("The root node cannot be removed");if(Ki(o)&&oa(e,r).childIds.length>0&&!0!==n.recursive)throw new Error(`Cannot remove a non-empty directory without recursive: "${t}"`);const i=o.parentId,s=pa(e,i),a=da(e,r);la(e,i,r,o.nameId),ha(e,i),Js(e,i);const l=pa(e,i);return{affectedAncestorIds:(c={affectedAncestorIds:ta(e,i),affectedNodeIds:a,path:t,projectionChanged:ga(s,l),recursive:!0===n.recursive}).affectedAncestorIds??[],affectedNodeIds:c.affectedNodeIds??[],canonicalChanged:!0,operation:"remove",path:c.path,projectionChanged:c.projectionChanged,recursive:c.recursive,visibleCountDelta:null};var c}function Ys(e,t,n,r){const o=na(e,t);if(null==o)throw new Error(`Source path does not exist: "${t}"`);const i=ia(e,o);if(Xi(i,2))throw new Error("The root node cannot be moved");const s=r.collision??"error",a=function(e,t,n){const r=ia(e,t),o=na(e,n);if(null!=o){const t=ia(e,o);if(Ki(t))return{basename:ys(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:o};const i=fs(n).segments;return{basename:i[i.length-1]??"",existingNodeId:o,parentId:t.parentId}}const i=fs(n),s=i.segments[i.segments.length-1]??"",a=i.segments.slice(0,-1),l=0===a.length?e.snapshot.rootId:ra(e,a,!0);if(null==l)throw new Error(`Destination parent does not exist: "${n}"`);return{basename:s,existingNodeId:null,parentId:l}}(e,o,n),l=pa(e,i.parentId),c=pa(e,a.parentId),u=ys(e.snapshot.segmentTable,i.nameId),d=vs(e.snapshot.segmentTable,a.basename);if(a.parentId===i.parentId&&u===a.basename)return null;if(Ki(i)&&function(e,t,n){let r=n;for(;null!=r;){if(r===t)return!0;const n=ia(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}(e,o,a.parentId))throw new Error("Cannot move a directory into one of its desce
2ndants");const h=zi(e.snapshot.nodes,oa(e,a.parentId)).get(d),p=a.existingNodeId??h??null;if(null!=p&&p!==o&&"skip"===function(e,t,n,r){if("skip"===n)return"skip";if("error"===n)throw new Error(`Destination already exists: "${Qs(e,t)}"`);const o=ia(e,t);if(Zi(o)!==r)throw new Error("replace collision requires the same source and destination kinds");if(Ki(o)&&oa(e,t).childIds.length>0)throw new Error("replace collision does not support non-empty directories");const i=o.parentId,s=o.nameId;return da(e,t),la(e,i,t,s),ha(e,i),Js(e,i),"handled"}(e,p,s,Zi(i)))return null;const g=i.parentId;la(e,g,o,i.nameId),i.parentId=a.parentId,i.nameId=d,e.pathCacheByNodeId.delete(o),ma(e,o),aa(e,a.parentId,o),ha(e,g),e.pathCacheVersion++,Js(e,g),a.parentId!==g&&Js(e,a.parentId);const f=pa(e,g),m=pa(e,a.parentId);return{affectedAncestorIds:(v={affectedAncestorIds:[...new Set([...ta(e,g),...ta(e,a.parentId)])],affectedNodeIds:[o],from:t,projectionChanged:fa([l,c],[f,m]),to:Qs(e,o)}).affectedAncestorIds??[],affectedNodeIds:v.affectedNodeIds??[],canonicalChanged:!0,from:v.from,operation:"move",projectionChanged:v.projectionChanged,to:v.to,visibleCountDelta:null};var v}function Xs(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function Qs(e,t){const n=ia(e,t),r=function(e,t){const n=e.pathCacheByNodeId.get(t);return null!=n&&n.version===e.pathCacheVersion?n.path:null}(e,t);if(null!=r)return r;if(Xi(n,2))return Xs(e,t,"");const o=Qs(e,n.parentId),i=ys(e.snapshot.segmentTable,n.nameId),s=0===o.length?i:`${o}${i}`;return Xs(e,t,Ki(n)?`${s}/`:s)}function Js(e,t){const n=e.instrumentation;null!=n?ts(n,"store.recomputeCountsUpwardFrom",()=>ya(e,t)):ya(e,t)}function ea(e,t){const n=[[t,0]],{nodes:r,directories:o}=e.snapshot;for(;n.length>0;){const t=n[n.length-1],i=t[0],s=r[i];if(null==s||!Ki(s)){va(e,i,s,!0),n.pop();continue}const a=o.get(i);if(null==a||t[1]>=a.childIds.length){va(e,i,s,!0),n.pop();continue}const l=a.childIds[t[1]++];n.push([l,0])}}function ta(e,t){const n=[];let r=t;for(;null!=r;){const t=ia(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function na(e,t){if(0===t.length)return e.snapshot.rootId;const n=fs(t);return ra(e,n.segments,n.requiresDirectory)}function ra(e,t,n){let r=e.snapshot.rootId;for(const i of t){const t=e.snapshot.segmentTable.idByValue.get(i);if(void 0===t)return null;const n=oa(e,r),o=zi(e.snapshot.nodes,n).get(t);if(void 0===o)return null;r=o}const o=ia(e,r);return n&&!Ki(o)?null:r}function oa(e,t){const n=e.snapshot.directories.get(t);if(void 0===n)throw new Error(`Unknown directory child index for node ${String(t)}`);return n}function ia(e,t){const n=e.snapshot.nodes[t];
2if(void 0===n||Xi(n,4))throw new Error(`Unknown node ID: ${String(t)}`);return n}function sa(e,t,n){const r=ia(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:Wi(Gi(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(o,Ri()),aa(e,t,o),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(o),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,o}function aa(e,t,n){const r=oa(e,t),o=ia(e,n);zi(e.snapshot.nodes,r).set(o.nameId,n),Hi(r,n,o.subtreeNodeCount,o.visibleSubtreeCount);const i=function(e,t,n){let r=0,o=t.childIds.length;for(;r<o;){const i=r+o>>>1,s=t.childIds[i];null!=s?ca(e,n,s)<0?o=i:r=i+1:o=i}return r}(e,r,n);r.childIds.splice(i,0,n),Fi(r,i),Bi(e.snapshot.nodes,r)}function la(e,t,n,r){const o=oa(e,t),i=Li(o),s=i.get(n)??-1;zi(e.snapshot.nodes,o).delete(r),i.delete(n);const a=e.snapshot.nodes[n];null!=a&&Hi(o,n,-a.subtreeNodeCount,-a.visibleSubtreeCount),s>=0&&(o.childIds.splice(s,1),Fi(o,s),Bi(e.snapshot.nodes,o))}function ca(e,t,n){const r=e.snapshot.options.sort;return"default"===r?function(e,t,n){const r=ia(e,t),o=ia(e,n),i=Ki(r);if(i!==Ki(o))return i?-1:1;const s=ss(ds(e.snapshot.segmentTable,r.nameId),ds(e.snapshot.segmentTable,o.nameId));if(0!==s)return s;const a=ys(e.snapshot.segmentTable,r.nameId),l=ys(e.snapshot.segmentTable,o.nameId);return a!==l?a<l?-1:1:t<n?-1:1}(e,t,n):r(ua(e,t),ua(e,n))}function ua(e,t){const n=ia(e,t),r=Qs(e,t),o=Ki(n),i=o?r.slice(0,-1):r;return{basename:ys(e.snapshot.segmentTable,n.nameId),depth:Gi(n),isDirectory:o,path:r,segments:0===i.length?[]:i.split("/")}}function da(e,t){const n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){const t=r.pop();if(null==t)break;const o=ia(e,t.nodeId);if(t.visitedChildren||!Ki(o)){Ki(o)&&e.snapshot.directories.delete(t.nodeId),Qi(o,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),Rs(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});const i=oa(e,t.nodeId);for(let e=i.childIds.length-1;e>=0;e--){const t=i.childIds[e];null!=t&&r.push({nodeId:t,visitedChildren:!1})}}return n}function ha(e,t){let n=t;for(;null!=n;){const t=ia(e,n);if(!Ki(t)||Xi(t,2))return;if(oa(e,n).childIds.length>0)return;Qi(t,1),n=t.parentId===n?null:t.parentId}}function pa(e,t){const n=function(e,t){let n=t;for(;null!=n;){const t=ia(e,n);if(!Ki(t)||Xi(t,2))return null;if(!Ts(e,n,t))return n;n=t.parentId}return null}(e,t);if(null==n)return null;const r=Us(e,n),o=ia(e,r),i=n===r?null:Ws(e,n).map(t=>Qs(e,t));return JSON.stringify({flattenedSegmentPaths:i,hasChildren:oa(e,r).childIds.length>0,path:Qs(e,r),terminalKind:Zi(o)})}function ga(e,t){return fa([e],[t])}function fa(e,t){for(let n=0;n<e.length;n+=1){const r=e[n],o=t[n];if(null==r||null==o||r!==o)return!0}return!1}function ma(e,t){const n=ia(e,t);if(function(e,t){e.depthAndFlags=Wi(t,Yi(e),Zi(e))}(n,(t===e.snapshot.rootId?-1:Gi(ia(e,n.parentId)))+1),!Ki(n))return;const r=oa(e,t);for(const o of r.childIds)ma(e,o)}function va(e,t,n=ia(e,t),r=!1){const o=e.instrumentation;null!=o?ts(o,"store.recomputeNodeCounts",()=>ba(e,t,n,r)):ba(e,t,n,r)}function ya(e,t){let n=t;for(;null!=n;){const t=ia(e,n),r=t.subtreeNodeCount,o=t.visibleSubtreeCount;if(va(e,n,t),n===e.snapshot.rootId)return;const i=t.subtreeNodeCount-r,s=t.visibleSubtreeCount-o,a=t.parentId;0===i&&0===s||Hi(oa(e,a),n,i,s),n=a}}function ba(e,t,n,r){if(!Ki(n))return n.subtreeNodeCount=1,void(n.visibleSubtreeCount=1);const o=oa(e,t);if(r){const t=e.instrumentation;null==t?Oi(e.snapshot.nodes,o):ts(t,"store.recomputeNodeCounts.rebuildChildAggregates",()=>Oi(e.snapshot.nodes,o))}const i=1+o.totalChildSubtreeNodeCount,s=o.totalChildVisibleSubtreeCount;n.subtreeNodeCount=i,Xi(n,2)?n.visibleSubtreeCount=s:n.visibleSubtreeCount=null!=Bs(e,t)?s:Ts(e,t,n)?1+s:1}function wa(e){return null!=e&&!Xi(e,4)}function xa(e,t){const n=e.snapshot.nodes[t];return wa(n)&&Ki(n)&&!Xi(n,2)?n:null}function Ca(e){let t=0;for(const[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&wa(e.snapshot.no
2des[n])&&(t+=1);return t}function Sa(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:Ca(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:(t=e.snapshot.segmentTable,Math.max(0,t.valueById.length-1)),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)};var t}function Ia(e){const t=[],n=[];for(const r of e.collapsedDirectoryIds)null!=xa(e,r)&&t.push(Qs(e,r));for(const r of e.expandedDirectoryIds)null!=xa(e,r)&&n.push(Qs(e,r));return{collapsedPaths:t,expandedPaths:n}}function ka(e){const t=[];for(const[n,r]of e.directoryLoadInfoById)null!=xa(e,n)&&"loaded"!==Ns(e,n)&&t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:Qs(e,n)});return t}function Pa(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(const n of t.expandedPaths){const t=na(e,n);null!=t&&As(e,t,!0,ia(e,t))}for(const n of t.collapsedPaths){const t=na(e,n);null!=t&&As(e,t,!1,ia(e,t))}}function Da(e,t){e.directoryLoadInfoById.clear();for(const n of t){const t=na(e,n.path);null!=t&&(null!=xa(e,t)&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state}))}}function Ma(e){const t=Ia(e),n=ka(e);ts(e.instrumentation,"store.cleanup.stable.clearPathCaches",()=>function(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:"",version:e.pathCacheVersion})}(e)),ts(e.instrumentation,"store.cleanup.stable.rebuildSegmentTable",()=>function(e){const t=e.snapshot.segmentTable,n=ms();for(const r of e.snapshot.nodes)wa(r)&&(Xi(r,2)?r.nameId=0:r.nameId=vs(n,ys(t,r.nameId)));e.snapshot.segmentTable=n}(e)),ts(e.instrumentation,"store.cleanup.stable.rebuildDirectoryIndexes",()=>function(e){for(const[t,n]of e.snapshot.directories){const r=e.snapshot.nodes[t];
2if(!wa(r)||!Ki(r)){e.snapshot.directories.delete(t);continue}const o=n.childIds.filter(n=>{const r=e.snapshot.nodes[n];return wa(r)&&r.parentId===t});n.childIds=o,n.childIdByNameId=new Map(o.map(t=>[ia(e,t).nameId,t])),n.childPositionById=new Map(o.map((e,t)=>[e,t])),Oi(e.snapshot.nodes,n)}}(e)),ts(e.instrumentation,"store.cleanup.stable.trimTrailingRemovedNodeSlots",()=>function(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId&&!wa(e.snapshot.nodes[t]);)t-=1;e.snapshot.nodes.length=t+1}(e)),ts(e.instrumentation,"store.cleanup.stable.restoreExpansionOverrides",()=>Pa(e,t)),ts(e.instrumentation,"store.cleanup.stable.restoreDirectoryLoadInfos",()=>Da(e,n)),ts(e.instrumentation,"store.cleanup.stable.recomputeCounts",()=>ea(e,e.snapshot.rootId))}function Ea(e){const t=Ia(e),n=ka(e),r=ts(e.instrumentation,"store.cleanup.aggressive.listPaths",()=>Gs(e)),o=(i={...e.snapshot.options},null==(s=e.instrumentation)||Object.defineProperty(i,Ji,{configurable:!0,enumerable:!1,value:s,writable:!1}),i);var i,s;const a=ts(e.instrumentation,"store.cleanup.aggressive.rebuildSnapshot",()=>{const e=new Ds(o);return e.appendPaths(r),e.finish()});e.snapshot=a,e.activeNodeCount=a.nodes.length-1,e.pathCacheByNodeId=new Map([[a.rootId,{path:"",version:0}]]),e.pathCacheVersion=0,ts(e.instrumentation,"store.cleanup.aggressive.restoreExpansionOverrides",()=>Pa(e,t)),ts(e.instrumentation,"store.cleanup.aggressive.restoreDirectoryLoadInfos",()=>Da(e,n)),ts(e.instrumentation,"store.cleanup.aggressive.recomputeCounts",()=>ea(e,e.snapshot.rootId))}function Ta(e,t){const n=t+2;if(n<=e.length)return e;let r=e.length;for(;r<n;)r*=2;const o=new Int32Array(r);return o.fill(-1),o.set(e),o}function Aa(e){return ia(e,e.snapshot.rootId).visibleSubtreeCount}function _a(e,t,n,r){const o=ia(e,t.terminalNodeId),i=Math.max(1,o.visibleSubtreeCount);return Math.min(r-1,n+i-1)}function Na(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:Ua(e,t.cursor),setSize:t.setSize,subtreeEndIndex:_a(e,t.cursor,t.index,n)}}function Ra(e,t,n,r,o,i){const s=oa(e,t),{childIndex:a,childVisibleIndex:l,localVisibleIndex:c}=qi(e.snapshot.nodes,s,n),u=s.childIds[a];if(null==u)throw new Error(`Visible index ${String(n)} is out of range`);return function(e,t,n,r,o,i,s,a){if(!Ki(ia(e,t))){if(0===n)return{ancestors:a,cursor:{headNodeId:t,terminalNodeId:t,visibleDepth:o},index:r,posInSet:i,setSize:s};throw new Error(`Visible index ${String(n)} is out of range for file`)}const l=Ha(e,t,o);if(0===n)return{ancestors:a,cursor:l,index:r,posInSet:i,setSize:s};const c=ia(e,l.terminalNodeId);if(!Ki(c)||!Ts(e,l.terminalNodeId,c))throw new Error(`Visible index ${String(n)} is out of range for collapsed directory`);return Ra(e,l.terminalNodeId,n-1,r+1,l.visibleDepth,[...a,{cursor:l,index:r,posInSet:i,setSize:s}])}(e,u,c,r+l,o+1,a,s.childIds.length,i)}function ja(e,t,n){var r;const o=e.instrumentation,i=Aa(e);if(i<=0||n<t)return[];const s=Math.max(0,Math.min(t,i-1)),a=Math.max(s,Math.min(n,i-1));if(null==o){if(0===s)return function(e,t){const n=new Array(t);let r=0;const{nodes:o,directories:i,segmentTable:s}=e.snapshot,a=[[i.get(e.snapshot.rootId),0,-1]],l=s.valueById,c=e.snapshot.options.flattenEmptyDirectories,u=e.pathCacheByNodeId,d=e.pathCacheVersion;for(;a.length>0&&r<t;){const t=a[a.length-1],s=t[0];if(t[1]>=s.childIds.length){a.pop();continue}const h=s.childIds[t[1]++],p=o[h],g=t[2]+1;if(!Ki(p)){const t=u.get(h);n[r++]={depth:g,flattenedSegments:void 0,hasChildren:!1,id:h,isExpanded:!1,isFlattened:!1,isLoading:!1,kind:"file",loadState:void 0,name:l[p.nameId],path:null!=t&&t.version===d?t.path:Qs(e,h)};continue}const f=c?Us(e,h):h,m={headNodeId:h,terminalNodeId:f,visibleDepth:g};n[r++]=Ua(e,m);const v=o[f];null!=v&&Ki(v)&&Ts(e,f,v)&&a.push([i.get(f),0,g])}r<t&&(n.length=r);return n}(e,a+1);const t=[];let n=$a(e,s);for(let r=s;r<=a&&null!=n;r++){const r=Ua(e,n);t.push(r),n=Va(e,n)}return t}const l=[];let c=0,u=0,d=ts(o,"store.getVisibleSlice.selectFirstRow",()=>$a(e,s));for(let h=s;h<=a&&null!=d;h++){const t=ts(o,"store.getVisibleSlice.materializeRow",()=>Ua(e,d));l.push(t),t.isFlattened&&(c++,u+=(null==(r=t.flattenedSegments)?void 0:r.length)??0),d=ts(o,"store.getVisibleSlice.advanceCursor",()=>Va(e,d))}return ns(o,"workload.visibleRowsRead",l.length),ns(o,"workload.flattenedRowsRead",c),ns(o,"workload.flattenedSegmentsRead",u),l}function za(e,t=Aa(e)){const n=e.instrumentation;return null==n?Ba(e,t):ts(n,"store.getVisibleTreeProjection",()=>Ba(e,t))}function La(e){return function(e){const t=e.paths.length,n=new Array(t);for(let r=0;r<t;r+=1){const t=e.getParentIndex(r);n[r]={index:r,parentPath:t>=0?e.paths[t]??null:null,path:e.paths[r]??"",posInSet:e.posInSetByIndex[r]??0,setSize:e.setSizeByIndex[r]??0}}return{getParentIndex:e.getParentIndex,rows:n,get visibleIndexByPath(){return e.visibleIndexByPath}}}(za(e))}function $a(e,t){return t<0||t>=Aa(e)?null:Fa(e,e.snapshot.rootId,t,-1)}function Fa(e,t,n,r){const o=oa(e,t),i=e.instrumentation,{childIndex:s,localVisibleIndex:a}
2=null==i?qi(e.snapshot.nodes,o,n):ts(i,"store.getVisibleSlice.selectChildIndex",()=>qi(e.snapshot.nodes,o,n)),l=o.childIds[s];if(null!=l)return Oa(e,l,a,r+1);throw new Error(`Visible index ${String(n)} is out of range`)}function Oa(e,t,n,r){if(!Ki(ia(e,t))){if(0===n)return{headNodeId:t,terminalNodeId:t,visibleDepth:r};throw new Error(`Visible index ${String(n)} is out of range for file`)}const o=Ha(e,t,r);if(0===n)return o;const i=ia(e,o.terminalNodeId);if(!Ki(i)||!Ts(e,o.terminalNodeId,i))throw new Error(`Visible index ${String(n)} is out of range for collapsed directory`);return Fa(e,o.terminalNodeId,n-1,o.visibleDepth)}function Ha(e,t,n){return Ki(ia(e,t))?null==e.instrumentation?{headNodeId:t,terminalNodeId:Us(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:ts(e.instrumentation,"store.getVisibleSlice.flatten.resolveTerminalDirectory",()=>Us(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function qa(e,t){const n=ia(e,t);if(!Ki(n))return!0;const r=n.parentId;return r===e.snapshot.rootId||Bs(e,r)!==t}function Va(e,t){const n=ia(e,t.terminalNodeId);if(Ki(n)){const r=oa(e,t.terminalNodeId);if(Ts(e,t.terminalNodeId,n)&&r.childIds.length>0){const n=r.childIds[0];return null==n?null:Oa(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,o=t.visibleDepth;for(;;){const t=ia(e,r);if(r===e.snapshot.rootId)return null;const n=t.parentId,i=oa(e,n),s=Li(i).get(r)??-1;if(s<0)throw new Error(`Child ${String(r)} was not found in its parent index`);const a=i.childIds[s+1]??null;if(null!=a)return Oa(e,a,0,o);qa(e,r)&&o--,r=n}}function Ba(e,t){const n=new Array(t),r=new Int32Array(t),o=new Int32Array(t),i=new Int32Array(t);let s=new Int32Array(64);s.fill(-1);let a=0;const{nodes:l,directories:c,segmentTable:u}=e.snapshot,d=[[c.get(e.snapshot.rootId),0,-1,""]],h=e.snapshot.options.flattenEmptyDirectories,p=e.pathCacheByNodeId,g=e.pathCacheVersion,f=u.valueById;for(;d.length>0&&a<t;){const t=d[d.length-1],u=t[0];if(t[1]>=u.childIds.length){d.pop();continue}const m=t[1],v=u.childIds[t[1]++],y=l[v],b=t[2]+1,w=t[3];let x;s=Ta(s,b);let C=v;if(Ki(y))C=h?Us(e,v):v,x=C===v?`${w}${f[y.nameId]}/`:Qs(e,C);else{const e=p.get(v);x=null!=e&&e.version===g?e.path:`${w}${f[y.nameId]}`}r[a]=s[b],n[a]=x,o[a]=m,i[a]=u.childIds.length,s[b+1]=a,a+=1;const S=l[C];null!=S&&Ki(S)&&Ts(e,C,S)&&d.push([c.get(C),0,b,x])}a<t&&(n.length=a);const m=r.subarray(0,a),v=o.subarray(0,a),y=i.subarray(0,a);let b=null;return{getParentIndex:e=>e<0||e>=a?-1:m[e]??-1,paths:n,posInSetByIndex:v,setSizeByIndex:y,get visibleIndexByPath(){if(null==b){b=new Map;for(let e=0;e<a;e+=1)b.set(n[e]??"",e)}return b}}}function Ua(e,t){const n=ia(e,t.terminalNodeId),r=Ki(n)?function(e,t){if(t.headNodeId===t.terminalNodeId)return Ns(e,t.terminalNodeId);const n=Ws(e,t.headNodeId);let r=!1,o=!1;for(const i of n){const t=Ns(e,i);if("loading"===t)return"loading";"error"!==t?"unloaded"===t&&(r=!0):o=!0}return o?"error":r?"unloaded":"loaded"}(e,t):null,o=Qs(e,t.terminalNodeId),i=ys(e.snapshot.segmentTable,n.nameId),s=Ki(n)&&oa(e,t.terminalNodeId).childIds.length>0,a=t.headNodeId!==t.terminalNodeId,l=e.instrumentation,c=a?null==l?Ws(e,t.headNodeId).map(n=>{const r=ia(e,n);return{isTerminal:n===t.terminalNodeId,name:ys(e.snapshot.segmentTable,r.nameId),nodeId:n,path:Qs(e,n)}}):ts(l,"store.getVisibleSlice.flatten.collectSegments",()=>Ws(e,t.headNodeId).map(n=>{const r=ia(e,n);return{isTerminal:n===t.terminalNodeId,name:ys(e.snapshot.segmentTable,r.nameId),nodeId:n,path:Qs(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:c,hasChildren:s,id:t.terminalNodeId,isExpanded:Ki(n)&&Ts(e,t.terminalNodeId,n),isFlattened:a,isLoading:"loading"===r,kind:Ki(n)?"directory":"file",loadState:null==r||"loaded"===r?void 0:r,name:i,path:o}}var Wa=(t=class{constructor(t={}){var n;Ht(this,e);const r=es(t),o=ts(r,"store.builder.create",()=>new Ds(t));if(null!=t.preparedInput){const e=ks(t.preparedInput);null!=e?o.appendPresortedPaths(e,function(e){const t=e;return"boolean"==typeof t.presortedPathsContainDirectories?t.presortedPathsContainDirectories:null}(t.preparedInput)):o.appendPreparedPaths(Is(t.preparedInput),!1)}else{const e=t.paths??[];!0===t.presorted?o.appendPaths(e):o.appendPreparedPaths(ts(r,"store.preparePathEntries",()=>Ps(e,t)))}const i=ts(r,"store.builder.finish",()=>o.finish({skipSubtreeCountPass:!0})),s=ts(r,"store.state.detectAllDirectoriesExpanded",()=>"closed"===(t.initialExpansion??"closed")&&o.didMatchAllInitialExpandedPaths());qt(this,e,ts(r,"store.state.create",()=>
2Ms(i,s?"open":t.initialExpansion??"closed",r))),s&&(Ot(this,e).collapseNewDirectoriesByDefault=!0);const a=s?Ot(this,e).snapshot.directories.size-1:ts(r,"store.state.initializeExpandedPaths",()=>this.initializeExpandedPaths(t.initialExpandedPaths));s||function(e){return"open"===e.initialExpansion&&(null==e.initialExpandedPaths||0===e.initialExpandedPaths.length)}(t)||"closed"===(t.initialExpansion??"closed")&&a===Ot(this,e).snapshot.directories.size-1||((null==(n=t.initialExpandedPaths)?void 0:n.length)??0)>0&&ts(r,"store.state.checkAllDirectoriesExpanded",()=>this.hasAllDirectoriesExpanded())?ts(r,"store.state.initializeOpenVisibleCounts",()=>function(e){const{directories:t,nodes:n,options:r,rootId:o,presortedDirectoryNodeIds:i}=e.snapshot,s=!0===r.flattenEmptyDirectories,a=e=>{const r=n[e];if(null==r||!Ki(r))return;const o=t.get(e);if(null==o)throw new Error(`Unknown directory child index for node ${String(e)}`);const i=o.childIds,a=i.length;let l,c=0,u=0;for(let t=0;t<a;t++){const e=i[t];if(null==e)continue;const r=n[e];c+=r.subtreeNodeCount,u+=r.visibleSubtreeCount}if(o.totalChildSubtreeNodeCount=c,o.totalChildVisibleSubtreeCount=u,a>=128&&Bi(n,o),r.subtreeNodeCount=1+c,s&&1===a){const e=n[i[0]];l=null!=e&&Ki(e)?u:1+u}else l=1+u;r.visibleSubtreeCount=l};if(null!=i)for(let p=i.length-1;p>=0;p--)a(i[p]);else for(let p=n.length-1;p>=1;p--)a(p);const l=n[o],c=t.get(o);if(null==l||null==c)return;const u=c.childIds;let d=0,h=0;for(let p=0;p<u.length;p++){const e=u[p];if(null==e)continue;const t=n[e];d+=t.subtreeNodeCount,h+=t.visibleSubtreeCount}c.totalChildSubtreeNodeCount=d,c.totalChildVisibleSubtreeCount=h,Bi(n,c),l.subtreeNodeCount=1+d,l.visibleSubtreeCount=h}(Ot(this,e))):ts(r,"store.state.recomputeCounts",()=>ea(Ot(this,e),Ot(this,e).snapshot.rootId))}static preparePaths(e,t={}){return function(e,t={}){return Ps(e,t).map(e=>e.path)}(e,t)}static prepareInput(e,t={}){return function(e,t={}){const n=Ps(e,t);return ws({paths:n.map(e=>e.path),preparedPaths:n},"prepared")}(e,t)}static preparePresortedInput(e){return function(e){const t=e.length;let n=!1;for(let r=0;r<t;r+=1){const t=e[r];if(t.length>0&&47===t.charCodeAt(t.length-1)){n=!0;break}}return ws({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},"presorted")}(e)}list(t){return ts(Ot(this,e).instrumentation,"store.list",()=>Gs(Ot(this,e),t))}add(t){ts(Ot(this,e).instrumentation,"store.add",()=>{const n=Aa(Ot(this,e));Ls(Ot(this,e),js(Ot(this,e),n,Zs(Ot(this,e),t)))})}remove(t,n={}){ts(Ot(this,e).instrumentation,"store.remove",()=>{const r=Aa(Ot(this,e));Ls(Ot(this,e),js(Ot(this,e),r,Ks(Ot(this,e),t,n)))})}move(t,n,r={}){ts(Ot(this,e).instrumentation,"store.move",()=>{const o=Aa(Ot(this,e)),i=Ys(Ot(this,e),t,n,r);null!=i&&Ls(Ot(this,e),js(Ot(this,e),o,i))})}batch(t){zs(Ot(this,e),()=>{if("function"!=typeof t)for(const e of t)switch(e.type){case"add":this.add(e.path);break;case"remove":this.remove(e.path,{recursive:e.recursive});break;case"move":this.move(e.from,e.to,{collision:e.collision})}else t(this)})}getVisibleCount(){return ts(Ot(this,e).instrumentation,"store.getVisibleCount",()=>Aa(Ot(this,e)))}getVisibleSlice(t,n){return ts(Ot(this,e).instrumentation,"store.getVisibleSlice",()=>ja(Ot(this,e),t,n))}getVisibleRowContext(t){return ts(Ot(this,e).instrumentation,"store.getVisibleRowContext",()=>function(e,t){const n=Aa(e);if(t<0||t>=n)return null;const r=Ra(e,e.snapshot.rootId,t,0,-1,[]),o=r.ancestors.map(t=>Qs(e,t.cursor.terminalNodeId));let i=null;return{ancestorPaths:o,get ancestorRows(){if(null!=i)return i;const t=[],o=[];for(const i of r.ancestors){const r=Na(e,i,n,[...o]);t.push(r),o.push(r.row.path)}return i=t,i},index:r.index,posInSet:r.posInSet,row:Ua(e,r.cursor),setSize:r.setSize,subtreeEndIndex:_a(e,r.cursor,r.index,n)}}(Ot(this,e),t))}getVisibleTreeProjection(){return La(Ot(this,e))}getVisibleTreeProjectionData(t){return za(Ot(this,e),t)}getVisibleIndex(t){return ts(Ot(this,e).instrumentation,"store.getVisibleIndex",()=>function(e,t){const n=na(e,t);if(null==n||n===e.snapshot.rootId)return null;if(Ki(ia(e,n))&&Us(e,n)!==n)return null;let r=0,o=n;const{nodes:i,rootId:s}=e.snapshot;for(;o!==s;){const t=ia(e,o).parentId,n=oa(e,t),a=Li(n).get(o);if(null==a)throw new Error(`Child ${String(o)} was not found in its parent index`);if(r+=Vi(i,n,a),t!==s){const n=ia(e,t),i=Bs(e,t);if(!Ts(e,t,n)&&i!==o)return null;Us(e,t)===t&&(r+=1)}o=t}return r}(Ot(this,e),t))}getPathInfo(t){return ts(Ot(this,e).instrumentation,"store.getPathInfo",()=>{const n=na(Ot(this,e),t);if(null==n)return null;const r=ia(Ot(this,e),n);return{depth:Gi(r),kind:Ki(r)?"directory":"file",path:Qs(Ot(this,e),n)}})}isExpanded(t){return ts(Ot(this,e).instrumentation,"store.isExpanded",()=>{const n=this.requireDirectoryNodeId(t),r=ia(Ot(this,e),n);return Ts(Ot(this,e),n,r)})}expand(t){ts(Ot(this,e).instrumentation,"store.expand",()=>{const n=Aa(Ot(this,e)),r=function(e,t){const n=na(e,t);if(null==n)throw new Error(`Path does not exist: "${t}"`);const r=ia(e,n);if(!Ki(r))throw new Error(`Path is not a directory: "${t}"`);return Ts(e,n,r)?null:(As(e,n,!0,r),Js(e,n),{affectedAncestorIds:(o={affectedAncestorIds:ta(e,n),affectedNodeIds:[n],path:t}).affectedAncestorIds??[],affectedNodeIds:o.affectedNodeIds??[],canonicalChanged:!1,operation:"expand",path:o.path,projectionChanged:!0,visibleCountDelta:null});var o}(Ot(this,e),t);null!=r&&Ls(Ot(this,e),js(Ot(this,e),n,r))})}collapse(t){ts(Ot(this,e).instrumentation,"store.collapse",()=>{const n=Aa(Ot(this,e)),r=function(e,t){const n=na(e,t);if(null==n)throw new Error(`Path does not exist: "${t}"`);const r=ia(e,n);if(!Ki(r))throw new Error(`Path is not a directory: "${t}"`);return Ts(e,n,r)?(As(e,n,!1,r),Js(e,n),{affectedAncestorIds:(o={affectedAncestorIds:ta(e,n),affectedNodeIds:[n],path:t}).affectedAncestorIds??[],affectedNodeIds:o.affectedNodeIds??[],canonicalChanged:!1,operation:"collapse",path:o.path,projectionChanged:!0,visibleCountDelta:null}):null;var o}(Ot(this,e),t);null!=r&&Ls(Ot(this,e),js(Ot(this,e),n,r))})}on(t,n){return function(e,t,n){const r=n,o=e.listeners.get(t);return null!=o?o.add(r):e.listeners.set(t,new Set([r])),()=>{const n=e.listeners.get(t);null!=n&&(n.delete(r),0===n.size&&e.listeners.delete(t))}}(Ot(this,e),t,n)}getDirectoryLoadState(t){const n=this.requireDirectoryNodeId(t);return Ns(Ot(this,e),n)}markDirectoryUnloaded(t){ts(Ot(this,e).instrumentation,"store.markDirectoryUnloaded",()=>{const n=this.requireDirectoryNodeId(t);if(oa(Ot(this,e),n).childIds.length>0)throw new Error(`Cannot mark a directory with known children as unloaded: "${t}"`);const r=Aa(Ot(this,e));var o;!function(e,t){const n=_s(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state="unloaded"}(Ot(this,e),n),Ls(Ot(this,e),js(Ot(this,e),r,{affectedAncestorIds:(o={affectedAncestorIds:ta(Ot(this,e),n),affectedNodeIds:[n],path:t,projectionChanged:this.isDirectoryProjectionVisible(n)}).affectedAncestorIds??[],affectedNodeIds:o.affectedNodeIds??[],canonicalChanged:!1,operation:"mark-directory-unloaded",path:o.path,projectionChanged:o.projectionChanged,visibleCountDelta:null}))})}beginChildLoad(t){return ts(Ot(this,e).instrumentation,"store.beginChildLoad",()=>{const n=this.requireDirectoryNodeId(t),r=Aa(Ot(this,e)),o=function(e,t){const n=_s(e,t);if("loading"===n.state&&null!=n.activeAttemptId)return{attemptId:n.activeAttemptId,nodeId:t,reused:!0};const r=n.nextAttemptId;return n.activeAttemptId=r,n.errorMessage=null,n.nextAttemptId+=1,n.state="loading",{attemptId:r,nodeId:t,reused:!1}}(Ot(this,e),n);var i;return Ls(Ot(this,e),js(Ot(this,e),r,{affectedAncestorIds:(i={affectedAncestorIds:ta(Ot(this,e),n),affectedNodeIds:[n],attemptId:o.attemptId,path:t,projectionChanged:this.isDirectoryProjectionVisible(n),reused:o.reused}).affectedAncestorIds??[],affectedNodeIds:i.affectedNodeIds??[],attemptId:i.attemptId,canonicalChanged:!1,operation:"begin-child-load",path:i.path,projectionChanged:i.projectionChanged,reused:i.reused,visibleCountDelta:null})),o})}applyChildPatch(t,n){return ts(Ot(this,e).instrumentation,"store.a
2pplyChildPatch",()=>{const r=this.resolveActiveDirectoryNodeId(t.nodeId);if(null==r||"loading"!==Ns(Ot(this,e),r)||(o=Ot(this,e),i=r,s=t.attemptId,(null==(a=o.directoryLoadInfoById.get(i))?void 0:a.activeAttemptId)!==s))return!1;var o,i,s,a;const l=Qs(Ot(this,e),r);this.validateChildPatch(l,n);const c=Aa(Ot(this,e)),u=[];for(const t of n.operations){Ga(l,t);const n=Aa(Ot(this,e));switch(t.type){case"add":u.push(js(Ot(this,e),n,Zs(Ot(this,e),t.path)));break;case"remove":u.push(js(Ot(this,e),n,Ks(Ot(this,e),t.path,{recursive:t.recursive})));break;case"move":{const r=Ys(Ot(this,e),t.from,t.to,{collision:t.collision});null!=r&&u.push(js(Ot(this,e),n,r));break}}}const d=u.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(r);var h;return Ls(Ot(this,e),js(Ot(this,e),c,{affectedAncestorIds:(h={affectedAncestorIds:ta(Ot(this,e),r),affectedNodeIds:[r],attemptId:t.attemptId,childEvents:u,path:Qs(Ot(this,e),r),projectionChanged:d}).affectedAncestorIds??[],affectedNodeIds:h.affectedNodeIds??[],attemptId:h.attemptId,canonicalChanged:h.childEvents.some(e=>e.canonicalChanged),childEvents:h.childEvents,operation:"apply-child-patch",path:h.path,projectionChanged:h.projectionChanged,visibleCountDelta:null})),!0})}completeChildLoad(t){return ts(Ot(this,e).instrumentation,"store.completeChildLoad",()=>{const n=this.resolveActiveDirectoryNodeId(t.nodeId);if(null==n)return!1;const r=Aa(Ot(this,e)),o=function(e,t,n){const r=e.directoryLoadInfoById.get(t);return null!=r&&r.activeAttemptId===n&&(r.activeAttemptId=null,r.errorMessage=null,r.state="loaded",!0)}(Ot(this,e),n,t.attemptId);var i;return Ls(Ot(this,e),js(Ot(this,e),r,{affectedAncestorIds:(i={affectedAncestorIds:ta(Ot(this,e),n),affectedNodeIds:[n],attemptId:t.attemptId,path:Qs(Ot(this,e),n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!o}).affectedAncestorIds??[],affectedNodeIds:i.affectedNodeIds??[],attemptId:i.attemptId,canonicalChanged:!1,operation:"complete-child-load",path:i.path,projectionChanged:i.projectionChanged,stale:i.stale,visibleCountDelta:null})),o})}failChildLoad(t,n){return ts(Ot(this,e).instrumentation,"store.failChildLoad",()=>{const r=this.resolveActiveDirectoryNodeId(t.nodeId);if(null==r)return!1;const o=Aa(Ot(this,e)),i=function(e,t,n,r){const o=e.directoryLoadInfoById.get(t);return null!=o&&o.activeAttemptId===n&&(o.activeAttemptId=null,o.errorMessage=r??null,o.state="error",!0)}(Ot(this,e),r,t.attemptId,n);var s;return Ls(Ot(this,e),js(Ot(this,e),o,{affectedAncestorIds:(s={affectedAncestorIds:ta(Ot(this,e),r),affectedNodeIds:[r],attemptId:t.attemptId,errorMessage:n,path:Qs(Ot(this,e),r),projectionChanged:this.isDirectoryProjectionVisible(r),stale:!i}).affectedAncestorIds??[],affectedNodeIds:s.affectedNodeIds??[],attemptId:s.attemptId,canonicalChanged:!1,errorMessage:s.errorMessage,operation:"fail-child-load",path:s.path,projectionChanged:s.projectionChanged,stale:s.stale,visibleCountDelta:null})),i})}cleanup(t={}){return ts(Ot(this,e).instrumentation,"store.cleanup",()=>{if(Ot(this,e).transactionStack.length>0)throw new Error("Cleanup cannot run during an open batch or transaction.");if(function(e){for(const t of e.directoryLoadInfoById.values())if("loading"===t.state&&null!=t.activeAttemptId)return!0;return!1}(Ot(this,e)))throw new Error("Cleanup cannot run while directory loads are active.");const n=Aa(Ot(this,e)),r=function(e,t){const n=Sa(e);return"stable"===t?ts(e.instrumentation,"store.cleanup.stable",()=>Ma(e)):ts(e.instrumentation,"store.cleanup.aggressive",()=>Ea(e)),function(e,t,n,r){return{activeNodeCountAfter:r.activeNodeCount,activeNodeCountBefore:n.activeNodeCount,cachedPathEntryCountAfter:r.cachedPathEntryCount,cachedPathEntryCountBefore:n.cachedPathEntryCount,idsPreserved:t,loadInfoEntryCountAfter:r.loadInfoEntryCount,loadInfoEntryCountBefore:n.loadInfoEntryCount,mode:e,reclaimedCachedPathEntryCount:n.cachedPathEntryCount-r.cachedPathEntryCount,reclaimedLoadInfoEntryCount:n.loadInfoEntryCount-r.loadInfoEntryCount,reclaimedNodeSlotCount:n.totalNodeSlotCount-r.totalNodeSlotCount,reclaimedSegmentCount:n.segmentCount-r.segmentCount,segmentCountAfter:r.segmentCount,segmentCountBefore:n.segmentCount,totalNodeSlotCountAfter:r.totalNodeSlotCount,totalNodeSlotCountBefore:n.totalNodeSlotCount}}(t,"stable"===t,n,Sa(e))}(Ot(this,e),t.mode??"stable");var o;return Ls(Ot(this,e),js(Ot(this,e),n,{activeNodeCountAfter:(o={...r,affectedAncestorIds:[],affectedNodeIds:[],projectionChanged:!1===r.idsPreserved}).activeNodeCountAfter,activeNodeCountBefore:o.activeNodeCountBefore,affectedAncestorIds:o.affectedAncestorIds??[],affectedNodeIds:o.affectedNodeIds??[],cachedPathEntryCountAfter:o.cachedPathEntryCountAfter,cac
2hedPathEntryCountBefore:o.cachedPathEntryCountBefore,canonicalChanged:!1,idsPreserved:o.idsPreserved,loadInfoEntryCountAfter:o.loadInfoEntryCountAfter,loadInfoEntryCountBefore:o.loadInfoEntryCountBefore,mode:o.mode,operation:"cleanup",projectionChanged:o.projectionChanged,reclaimedCachedPathEntryCount:o.reclaimedCachedPathEntryCount,reclaimedLoadInfoEntryCount:o.reclaimedLoadInfoEntryCount,reclaimedNodeSlotCount:o.reclaimedNodeSlotCount,reclaimedSegmentCount:o.reclaimedSegmentCount,segmentCountAfter:o.segmentCountAfter,segmentCountBefore:o.segmentCountBefore,totalNodeSlotCountAfter:o.totalNodeSlotCountAfter,totalNodeSlotCountBefore:o.totalNodeSlotCountBefore,visibleCountDelta:null})),r})}getNodeCount(){return Ot(this,e).activeNodeCount}initializeExpandedPaths(t){if(null==t||0===t.length)return 0;let n=0;const r=[],o=[];let i=0,s=null;const a=Ot(this,e).snapshot.segmentTable,l=a.valueById,c=Ot(this,e).snapshot.nodes,u=new Map;for(const d of t){null!=s&&d<s&&(s=null,i=0,r.length=0,o.length=0);const t=d.length>0&&47===d.charCodeAt(d.length-1)?d.length-1:d.length;if(0===t){s=d,i=t,r.length=0,o.length=0;continue}let h=0,p=0;if(null!=s){const e=Math.min(t,i);let n=!0;for(let t=0;t<e;t+=1){const e=d.charCodeAt(t);if(e!==s.charCodeAt(t)){n=!1;break}47===e&&(h+=1,p=t+1)}n&&(e===i&&t>e&&47===d.charCodeAt(e)?(h+=1,p=e+1):e===t&&i>e&&47===s.charCodeAt(e)&&(h+=1,p=t+1)),h=Math.min(h,o.length)}let g=0===h?Ot(this,e).snapshot.rootId:o[h-1]??Ot(this,e).snapshot.rootId,f=h,m=!0,v=p;for(;v<=t;){const n=d.indexOf("/",v),i=-1===n||n>
2t?t:n,s=d.slice(v,i),p=oa(Ot(this,e),g).childIds,y=f===h?r[f]??0:0;let b,w=y;const x=u.get(s)??is(s);u.set(s,x);const C=(e,t)=>{for(w=e;w<t;w+=1){const e=p[w],t=c[e],n=l[t.nameId];if(n===s)return b=e,!0;const r=ss(ds(a,t.nameId),x);if(r>0||0===r&&n>s)return!1}return!1};if(!C(y,p.length)&&y>0&&C(0,y),void 0===b){m=!1;break}if(!Ki(ia(Ot(this,e),b))){m=!1;break}if(r[f]=w,o[f]=b,g=b,f+=1,i===t)break;v=i+1}if(s=d,i=t,r.length=f,o.length=f,m)for(let r=h;r<f;r+=1){const t=o[r];if(null==t)continue;const i=ia(Ot(this,e),t);Ts(Ot(this,e),t,i)||(As(Ot(this,e),t,!0,i),n+=1)}else s=null,i=0,r.length=0,o.length=0}return n}hasAllDirectoriesExpanded(){for(const t of Ot(this,e).snapshot.directories.keys()){if(t===Ot(this,e).snapshot.rootId)continue;const n=ia(Ot(this,e),t);if(!Ts(Ot(this,e),t,n))return!1}return!0}requireDirectoryNodeId(t){const n=na(Ot(this,e),t);if(null==n)throw new Error(`Path does not exist: "${t}"`);if(!Ki(ia(Ot(this,e),n)))throw new Error(`Path is not a directory: "${t}"`);return n}resolveActiveDirectoryNodeId(t){try{if(!Ki(ia(Ot(this,e),t)))throw new Error(`Node is not a directory: ${String(t)}`);return t}catch{return null}}isDirectoryProjectionVisible(t){let n=t;for(;n!==Ot(this,e).snapshot.rootId;){const t=ia(Ot(this,e),n).parentId;if(t!==Ot(this,e).snapshot.rootId){const r=ia(Ot(this,e),t),o=Bs(Ot(this,e),t);if(!Ts(Ot(this,e),t,r)&&o!==n)return!1}n=t}return!0}validateChildPatch(n,r){new t({paths:this.list(n),presorted:!0,sort:Ot(this,e).snapshot.options.sort}).batch(r.operations)}},e=new WeakMap,t);function Ga(e,t){switch(t.type){case"add":case"remove":if(!t.path.startsWith(e)||t.path===e)throw new Error(`Child patch operation must stay within ${e}: "${t.path}"`);break;case"move":if(!t.from.startsWith(e)||!t.to.startsWith(e)||t.from===e||t.to===e)throw new Error(`Child patch move must stay within ${e}: "${t.from}" -> "${t.to}"`)}}function Za(e,t={}){return Wa.prepareInput(e,t)}const Ka={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};const Ya=Ka.default.itemHeight;var Xa="@layer base, theme, unsafe;\n\n@layer base {\n :host {\n /*\n CSS variables use a fallback stack to ensure user and theme colors slot\n in with ease. User colors take precedence over theme colors, which take\n precedence over defaults.\n\n Fallback order:\n\n 1. --trees-*-override (explicit)\n 2. --trees-theme-* (e.g. Shiki/VS Code tokens)\n 3. defaults\n\n Theme variable names mirror Shiki/VS Code theme file JSON tokens.\n\n // Available CSS Color Overrides\n --trees-fg-override\n --trees-fg-muted-override\n --trees-bg-override\n --trees-bg-muted-override\n --trees-accent-override\n --trees-border-color-override\n\n --trees-focus-ring-color-override\n --trees-focus-ring-width-override\n --trees-focus-ring-offset-override\n\n --trees-search-fg-override\n --trees-search-font-weight-override\n --trees-search-bg-override\n\n --trees-selected-fg-override\n --trees-selected-bg-override\n --trees-selected-focused-border-color-override\n\n // Git Status Color Overrides\n --trees-status-added-override\n --trees-status-ignored-override\n --trees-status-modified-override\n --trees-status-renamed-override\n --trees-status-untracked-override\n --trees-status-deleted-override\n --trees-git-added-color-override\n --trees-git-ignored-color-override\n --trees-git-modified-color-override\n --trees-git-renamed-color-override\n --trees-git-untracked-color-override\n --trees-git-deleted-color-override\n\n // Built-in File Icon Color Overrides\n --trees-file-icon-color\n --trees-file-icon-color-astro\n --trees-file-icon-color-babel\n --trees-file-icon-color-bash\n --trees-file-icon-color-biome\n --trees-file-icon-color-bootstrap\n --trees-file-icon-color-browserslist\n --trees-file-icon-color-bun\n --trees-file-icon-color-c\n --trees-file-icon-color-cpp\n --trees-file-icon-color-claude\n --trees-file-icon-color-css\n --trees-file-icon-color-database\n --trees-file-icon-color-default\n --trees-file-icon-color-docker\n --trees-file-icon-color-eslint\n --trees-file-icon-color-git\n --trees-file-icon-color-go\n --trees-file-icon-color-graphql\n --trees-file-icon-color-html\n --trees-file-icon-color-image\n --trees-file-icon-color-javascript\n --trees-file-icon-color-json\n --trees-file-icon-color-markdown\n --trees-file-icon-color-mcp\n --trees-file-icon-color-npm\n --trees-file-icon-color-oxc\n --trees-file-icon-color-postcss\n --trees-file-icon-color-prettier\n --trees-file-icon-color-python\n --trees-file-icon-color-react\n --trees-file-icon-color-ruby\n --trees-file-icon-color-rust\n --trees-file-icon-color-sass\n --trees-file-icon-color-svg\n --trees-file-icon-color-svelte\n --trees-file-icon-color-svgo\n --trees-file-icon-color-swift\n --trees-file-icon-color-table\n --trees-file-icon-color-text\n --trees-file-icon-color-tailwind\n --trees-file-icon-color-terraform\n --trees-file-icon-color-typescript\n --trees-file-icon-color-vite\n --trees-file-icon-color-vscode\n --trees-file-icon-color-vue\n --trees-file-icon-color-wasm\n --trees-file-icon-color-webpack\n --trees-file-icon-color-yml\n --trees-file-icon-color-zig\n --trees-file-icon-color-zip\n\n // De
2nsity\n //\n // A unitless scale factor for padding, gaps, and indentation. Usually\n // set via `density` on useFileTree. Individual overrides take precedence.\n //\n // Compact: 0.8\n // Default: 1\n // Relaxed: 1.2\n //\n --trees-density-override\n\n // Available CSS Layout Overrides\n --trees-gap-override\n --trees-border-radius-override\n --trees-font-family-override\n --trees-font-size-override\n --trees-font-weight-regular-override\n --trees-font-weight-semibold-override\n --trees-level-gap-override\n --trees-item-padding-x-override\n --trees-item-margin-x-override\n --trees-item-row-gap-override\n --trees-icon-width-override\n --trees-icon-nudge-override\n --trees-scrollbar-gutter-override\n --trees-padding-inline-override\n */\n\n --trees-accent: var(--trees-accent-override, #009fff);\n --trees-fg: var(\n --trees-fg-override,\n var(--trees-theme-sidebar-fg, light-dark(#6c6c71, #adadb1))\n );\n --trees-fg-muted: var(\n --trees-fg-muted-override,\n var(--trees-theme-sidebar-header-fg, light-dark(#84848a, #84848a))\n );\n --trees-bg: var(\n --trees-bg-override,\n var(--trees-theme-sidebar-bg, light-dark(#f8f8f8, #141415))\n );\n /* var(--trees-theme-list-hover-bg, light-dark(#dfebff59, #19283c59)) */\n --trees-bg-muted: var(\n --trees-bg-muted-override,\n var(\n --trees-theme-list-hover-bg,\n light-dark(\n color-mix(\n in lab,\n var(--trees-accent) var(--trees-bg-alpha-light, 8%),\n var(--trees-bg)\n ),\n color-mix(\n in lab,\n var(--trees-accent) var(--trees-bg-alpha-dark, 10%),\n var(--trees-bg)\n )\n )\n )\n );\n --trees-input-bg: var(\n --trees-input-bg-override,\n light-dark(#f8f8f8, #070707)\n );\n\n --trees-added-light: #16a994;\n --trees-added-dark: #00cab1;\n --trees-ignored-light: #adadb1;\n --trees-ignored-dark: #4a4a4e;\n --trees-modified-light: #1ca1c7;\n --trees-modified-dark: #08c0ef;\n --trees-renamed-light: #d5a910;\n --trees-renamed-dark: #ffd452;\n --trees-untracked-light: #16a994;\n --trees-untracked-dark: #00cab1;\n --trees-deleted-light: #ff2e3f;\n --trees-deleted-dark: #ff6762;\n\n --trees-border-color: var(\n --trees-border-color-override,\n var(--trees-theme-sidebar-border, light-dark(#eeeeef, #070707))\n );\n --trees-indent-guide-bg: var(\n --trees-indent-guide-bg-override,\n color-mix(in lab, var(--trees-fg-muted) 25%, transparent)\n );\n --trees-density: var(--trees-density-override, 1);\n --trees-border-radius: var(\n --trees-border-radius-override,\n calc(6px * var(--trees-density))\n );\n\n --trees-font-family: var(--trees-font-family-override, system-ui);\n --trees-font-size: var(--trees-font-size-override, 13px);\n --trees-font-weight-regular: var(--trees-font-weight-regular-override, 400);\n --trees-font-weight-semibold: var(\n --trees-font-weight-semibold-override,\n 600\n );\n\n --trees-focus-ring-color: var(\n --trees-focus-ring-color-override,\n var(--trees-theme-focus-ring, var(--trees-accent))\n );\n --trees-focus-ring-width: var(--trees-focus-ring-width-override, 1px);\n --trees-focus-ring-offset: var(--trees-focus-ring-offset-override, -1px);\n\n --trees-search-fg: var(\n --trees-search-fg-override,\n var(--trees-theme-input-fg, var(--trees-fg))\n );\n --trees-search-font-weight: var(--trees-search-font-weight-override, 600);\n --trees-search-bg: var(\n --trees-search-bg-override,\n var(--trees-theme-input-bg, var(--trees-input-bg))\n );\n\n --trees-scrollbar-thumb: var(\n --trees-scrollbar-thumb-override,\n var(\n --trees-theme-scrollbar-thumb,\n color-mix(in lab, var(--trees-fg) 25%, var(--trees-bg))\n )\n );\n\n --trees-selected-fg: var(\n --trees-selected-fg-override,\n var(--trees-theme-list-active-selection-fg, var(--trees-fg))\n );\n --trees-selected-bg: var(\n --trees-selected-bg-override,\n var(\n --trees-theme-list-active-selection-bg,\n light-dark(\n color-mix(in lab, var(--trees-accent) 12%, var(--trees-bg)),\n color-mix(in lab, var(--trees-accent) 15%, var(--trees-bg))\n )\n )\n );\n --trees-selected-focused-border-color: var(\n --trees-selected-focused-border-color-override,\n var(--trees-theme-focus-ring, var(--trees-accent))\n );\n\n /* Git status (e.g. from Shiki theme gitDecoration.*) */\n --trees-status-added: var(\n --trees-status-added-override,\n var(\n --trees-theme-git-added-fg,\n light-dark(var(--trees-added-light), var(--trees-added-dark))\n )\n );\n --trees-status-ignored: var(\n --trees-status-ignored-override,\n var(\n --trees-theme-git-ignored-fg,\n light-dark(var(--trees-ignored-light), var(--trees-ignored-dark))\n )\n );\n --trees-status-modified: var(\n --trees-status-modified-override,\n var(\n --trees-theme-git-modified-fg,\n light-dark(var(--trees-modified-light), var(--trees-modified-dark))\n )\n );\n --trees-status-renamed: var(\n --trees-status-renamed-override,\n var(\n --trees-theme-git-renamed-fg,\n light-dark(var(--trees-renamed-light), var(--trees-renamed-dark))\n )\n );\n --trees-status-untracked: var(\n --trees-status-untracked-override,\n var(\n --trees-theme-git-untracked-fg,\n light-dark(var(--trees-untracked-light), var(--trees-untracked-dark))\n )\n );\n --trees-status-deleted: var(\n --trees-status-deleted-override,\n var(\n --trees-theme-git-deleted-fg,\n light-dark(var(--trees-deleted-light), var(--trees-deleted-dark))\n )\n );\n --trees-git-modified-color: var(\n --trees-git-modified-color-override,\n var(--trees-status-modified)\n );\n --trees-git-added-color: var(\n --trees-git-added-color-override,\n var(--trees-status-added)\n );\n --trees-git-ignored-color: var(\n --trees-git-ignored-color-override,\n var(--trees-status-ignored)\n );\n --trees-git-deleted-color: var(\n --trees-git-deleted-color-override,\n var(--trees-status-deleted)\n );\n --trees-git-renamed-color: var(\n --trees-git-renamed-color-override,\n var(--trees-status-renamed)\n );\n --trees-git-untracked-color: var(\n --trees-git-untracked-color-override,\n var(--trees-status-untracked)\n );\n\n --trees-icon-gray: light-dark(#84848a, #adadb1);\n --trees-icon-red: light-dark(#d52c36, #ff6762);\n --trees-icon-vermilion: light-dark(#ff8c5b, #d5512f);\n --trees-icon-orange: light-dark(#d47628, #ffa359);\n --trees-icon-yellow: light-dark(#d5a910, #ffd452);\n --trees-icon-green: light-dark(#199f43, #5ecc71);\n --trees-icon-teal: light-dark(#17a5af, #64d1db);\n --trees-icon-cyan: light-dark(#1ca1c7, #68cdf2);\n --trees-icon-blue: light-dark(#1a85d4, #69b1ff);\n --trees-icon-indigo: light-dark(#693acf, #9d6afb);\n --trees-icon-purple: light-dark(#a631be, #d568ea);\n --trees-icon-pink: light-dark(#d32a61, #ff678d);\n --trees-icon-mauve: light-dark(#594c5b, #79697b);\n\n --trees-file-icon-color-default: var(\n --trees-file-icon-color,\n var(--trees-icon-gray)\n );\n --trees-file-icon-color-astro: var(\n --trees-file-icon-color,\n var(--trees-icon-purple)\n );\n --trees-file-icon-color-babel: var(\n --trees-file-icon-color,\n var(--trees-icon-yellow)\n );\n --trees-file-icon-color-bash: var(\n --trees-file-icon-color,\n var(--trees-icon-green)\n );\n --trees-file-icon-color-biome: var(\n --trees-file-icon-color,\n var(--trees-icon-blue)\n );\n --trees-file-icon-color-bootstrap: var(\n --trees-file-icon-color,\n var(--trees-icon-indigo)\n );\n --trees-file-icon-color-browserslist: var(\n --trees-file-icon-color,\n var(--trees-icon-yellow)\n );\n --trees-file-icon-color-bun: var(\n --trees-file-icon-color,\n var(--trees-icon-mauve)\n );\n --trees-file-icon-color-c: var(\n --trees-file-icon-color,\n var(--trees-icon-blue)\n );\n --trees-file-icon-color-cpp: var(\n --trees-file-icon-color,\n var(--trees-icon-blue)\n );\n --trees-file-icon-color-claude: var(\n --trees-file-icon-color,\n var(--trees-icon-orange)\n );\n --trees-file-icon-color-css: var(\n --trees-file-icon-color,\n var(--trees-icon-indigo)\n );\n --trees-file-icon-color-database: var(\n --trees-file-icon-color,\n var(--trees-icon-purple)\n );\n --trees-file-icon-color-docker: var(\n --trees-file-icon-color,\n var(--trees-icon-blue)\n );\n --trees-file-icon-color-eslint: var(\n --trees-file-icon-color,\n var(--trees-icon-indigo)\n );\n --trees-file-icon-color-git: var(\n --trees-file-icon-vermilion,\n var(--trees-icon-vermilion)\n );\n --trees-file-icon-color-go: var(\n --trees-file-icon-color,\n var(--trees-icon-cyan)\n );\n --trees-file-icon-color-graphql: var(\n --trees-file-icon-color,\n var(--trees-icon-pink)\n );\n --trees-file-icon-color-html: var(\n --trees-file-icon-color,\n var(--trees-icon-orange)\n );\n --trees-file-icon-color-image: var(\n --trees-file-icon-color,\n var(--trees-icon-pink)\n );\n --trees-file-icon-color-javascript: var(\n --trees-file-icon-color,\n var(--trees-icon-yellow)\n );\n --trees-file-icon-color-json: var(\n --trees-file-icon-color,\n var(--trees-icon-orange)\n );\n --trees-file-icon-color-markdown: var(\n --trees-file-icon-color,\n var(--trees-icon-green)\n );\n --trees-file-icon-color-mcp: var(\n --trees-file-icon-color,\n var(--trees-icon-teal)\n );\n --trees-file-icon-color-npm: var(\n --trees-file-icon-color,\n var(--trees-icon-red)\n );\n --trees-file-icon-color-oxc: var(\n --trees-file-icon-cyan,\n var(--trees-icon-cyan)\n );\n --trees-file-icon-color-postcss: var(\n --trees-file-icon-color,\n var(--trees-icon-red)\n );\n --trees-file-icon-color-prettier: var(\n --trees-file-icon-color,\n var(--trees-icon-teal)\n );\n --trees-file-icon-color-python: var(\n --trees-file-icon-color,\n var(--trees-icon-blue)\n );\n --trees-file-icon-color-react: var(\n --trees-file-icon-color,\n var(--trees-icon-cyan)\n );\n --trees-file-icon-color-ruby: var(\n --trees-file-icon-color,\n var(--trees-icon-red)\n );\n --trees-file-icon-color-rust: var(\n --trees-file-icon-color,\n var(--trees-icon-orange)\n );\n --trees-file-icon-color-sass: var(\n --trees-file-icon-color,\n var(--trees-icon-pink)\n );\n --trees-file-icon-color-svg: var(\n --trees-file-icon-color,\n var(--trees-icon-orange)\n );\n --trees-file-icon-color-svelte: var(\n --trees-file-icon-color,\n var(--trees-icon-red)\n );\n --trees-file-icon-color-svgo: var(\n --trees-file-icon-color,\n var(--trees-icon-green)\n );\n --trees-file-icon-color-swift: var(\n --trees-file-icon-color,\n var(--trees-icon-orange)\n );\n --trees-file-icon-color-table: var(\n --trees-file-icon-color,\n var(--trees-icon-teal)\n );\n --trees-file-icon-color-text: var(\n --trees-file-icon-color,\n var(--trees-icon-gray)\n );\n --trees-file-icon-color-tailwind: var(\n --trees-file-icon-color,\n var(--trees-icon-cyan)\n );\n --trees-file-icon-color-terraform: var(\n --trees-file-icon-color,\n var(--trees-icon-indigo)\n );\n --trees-file-icon-color-typescript: var(\n --trees-file-icon-color,\n var(--trees-icon-blue)\n );\n --trees-file-icon-color-vite: var(\n --trees-file-icon-color,\n var(--trees-icon-purple)\n );\n --trees-file-icon-color-vscode: var(\n --trees-file-icon-color,\n var(--trees-icon-blue)\n );\n --trees-file-icon-color-vue: var(\n --trees-file-icon-color,\n var(--trees-icon-green)\n );\n --trees-file-icon-color-wasm: var(\n --trees-file-icon-color,\n var(--trees-icon-indigo)\n );\n --trees-file-icon-color-webpack: var(\n --trees-file-icon-color,\n var(--trees-icon-blue)\n );\n --trees-file-icon-color-yml: var(\n --trees-file-icon-color,\n var(--trees-icon-red)\n );\n --trees-file-icon-color-zig: var(\n --trees-file-icon-color,\n var(--trees-icon-orange)\n );\n --trees-file-icon-color-zip: var(\n --trees-file-icon-color,\n var(--trees-icon-orange)\n );\n\n --trees-level-gap: var(\n --trees-level-gap-override,\n calc(8px * var(--trees-density))\n );\n --trees-item-padding-x: var(\n --trees-item-padding-x-override,\n calc(8px * var(--trees-density))\n );\n --trees-item-margin-x: var(\n --trees-item-margin-x-override,\n calc(2px * var(--trees-density))\n );\n --trees-item-row-gap: var(\n --trees-item-row-gap-override,\n calc(6px * var(--trees-density))\n );\n --trees-icon-width: var(--trees-icon-width-override, 16px);\n --trees-icon-nudge: var(\n --trees-icon-nudge-override,\n calc(1px * var(--trees-density))\n );\n --trees-row-height: var(--trees-item-height, 30px);\n --trees-git-lane-width: var(--trees-git-lane-width-override, 12px);\n --trees-action-lane-width: var(\n --trees-action-lane-width-override,\n calc(var(--trees-icon-width) + 2px)\n );\n /* Keep the floating trigger aligned with the row's action lane. Going in\n from the root's right edge: the scroll container reserves\n `--trees-padding-inline` of effective inset on each side (its asymmetric\n padding formula cancels the scrollbar gutter on the right), the row\n sits inside that inset, and its trailing `--trees-item-padding-x` is the\n action lane itself. The trigger's own focus-ring margin then trims one\n pixel back so the button's visible right edge lines up with the lane. */\n --trees-context-menu-trigger-inline-offset: calc(\n var(--trees-padding-inline) + var(--trees-item-padding-x) -\n var(--trees-focus-ring-width)\n );\n\n --trees-scrollbar-gutter: var(--trees-scrollbar-gutter-override, 6px);\n --trees-padding-inline: var(--trees-padding-inline-override, 16px);\n\n color-scheme: light dark;\n display: flex;\n flex-direction: column;\n font-size: var(--trees-font-size);\n color: var(--trees-fg);\n background-color: var(--trees-bg);\n --truncate-marker-background-color: var(--trees-bg);\n --truncate-marker-background-overlay-color: transparent;\n font-family: var(--trees-font-family);\n font-weight: var(--trees-font-weight-regular);\n }\n\n :host([data-file-tree-virtualized='true']) {\n height: 100%;\n overflow: hidden;\n }\n\n [data-file-tree-virtualized-wrapper='true'] {\n height: 100%;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n }\n\n [data-file-tree-virtualized-root='true'] {\n height: 100%;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n }\n\n [data-file-tree-virtualized-scroll='true'],\n [data-file-tree-scrollbar-measure='true'] {\n --trees-scrollbar-thumb-current: transparent;\n overflow-y: auto;\n scrollbar-gutter: stable;\n\n &:hover {\n --trees-scrollbar-thumb-current: var(--trees-scrollbar-thumb);\n }\n\n &::-webkit-scrollbar {\n width: var(--trees-scrollbar-gutter);\n height: var(--trees-scrollbar-gutter);\n }\n\n &::-webkit-scrollbar-track {\n background: transparent;\n }\n\n &::-webkit-scrollbar-thumb {\n background-color: var(--trees-scrollbar-thumb-current);\n border: 1px solid transparent;\n background-clip: con
2tent-box;\n border-radius: calc(var(--trees-scrollbar-gutter) / 2);\n }\n\n &::-webkit-scrollbar-corner {\n background-color: transparent;\n }\n }\n\n /* These are styles for a temporarily generated element to measure the size\n * of the scrollbar. It's intended to be somewhat similar in scrollbar style\n * scope to the scrollable tree so `--trees-scrollbar-gutter-measured` is an\n * accurate reflection of the size the scrollbar gutter takes up. */\n [data-file-tree-scrollbar-measure='true'] {\n position: absolute;\n top: 0;\n left: 0;\n visibility: hidden;\n pointer-events: none;\n width: 100px;\n height: 100px;\n }\n\n @supports (-moz-appearance: none) {\n [data-file-tree-virtualized-scroll='true'],\n [data-file-tree-scrollbar-measure='true'] {\n scrollbar-width: thin;\n scrollbar-color: var(--trees-scrollbar-thumb-current) transparent;\n }\n }\n\n [data-file-tree-virtualized-scroll='true'] {\n position: relative;\n overflow-y: auto;\n flex: 1 1 0;\n min-height: 0;\n padding-inline: max(\n calc(var(--trees-padding-inline) - var(--trees-item-margin-x)),\n 0px\n )\n /* NOTE(amadeus): We can assume that all Webkit based browser gutters\n * will align to the value of '--trees-scrollbar-gutter', however if not, then\n * `--trees-scrollbar-gutter-measured` should correct it. Mostly we are\n * hoping to avoid SSR alignment jumps if possible. In non-SSR'd environments\n * `--trees-scrollbar-gutter-measured` should always be immediately available.\n */\n max(\n calc(\n var(--trees-padding-inline) - var(--trees-item-margin-x) -\n var(\n --trees-scrollbar-gutter-measured,\n var(--trees-scrollbar-gutter)\n )\n ),\n 0px\n );\n }\n\n @supports (-moz-appearance: none) {\n [data-file-tree-virtualized-scroll='true'] {\n padding-inline: max(\n calc(var(--trees-padding-inline) - var(--trees-item-margin-x)),\n 0px\n )\n /* NOTE(amadeus): However on Firefox it can vary a little bit, but most\n * likely the majority of cases will default to a 0px width scrollbar lets\n * inherit that first to avoid SSR jumps. In non-SSR'd environments\n * `--trees-scrollbar-gutter-measured` should always be immediately available.\n */\n max(\n calc(\n var(--trees-padding-inline) - var(--trees-item-margin-x) -\n var(--trees-scrollbar-gutter-measured, 0px)\n ),\n 0px\n );\n }\n }\n\n [data-file-tree-sticky-overlay='true'] {\n position: sticky;\n top: 0;\n height: 0;\n z-index: 4;\n overflow: visible;\n pointer-events: none;\n }\n\n /* The overlay DOM is kept populated even at scrollTop=0 so the browser has\n * the rendered rows on hand the moment scrolling begins â otherwise the\n * compositor paints a scrolled frame before React can mount the overlay,\n * and the topmost sticky folder jumps up by a couple of pixels before it\n * \"snaps\" into its pinned position. We hide it via CSS whenever the scroll\n * is at the top and no scroll is in progress, so the preview doesn't leak\n * through at rest. `data-overlay-reveal` is stamped on the root only when\n * the user initiates a scroll while already at the top â exactly the case\n * where we need the pre-mounted overlay to be visible through the first\n * compositor frame. It is deliberately distinct from the general\n * `data-is-scrolling` flag so a scroll that ends at the top (e.g. ArrowUp\n * navigation) re-hides the overlay the instant the scroll lands, rather\n * than waiting for the hover-suppression timer to elapse. */\n [data-file-tree-virtualized-root='true'][data-scroll-at-top='true']:not(\n [data-overlay-reveal]\n )\n [data-file-tree-sticky-overlay='true'] {\n visibility: hidden;\n }\n\n [data-file-tree-sticky-overlay-content='true'] {\n background-color: var(--trees-bg);\n position: relative;\n pointer-events: none;\n }\n\n [data-file-tree-virtualized-list='true'] {\n background-color: var(--trees-bg);\n position: relative;\n min-height: 100%;\n width: 100%;
2\n overflow-anchor: none;\n\n &[data-is-scrolling] {\n pointer-events: none;\n }\n }\n\n [data-file-tree-virtualized-sticky-offset='true'] {\n contain: layout size;\n }\n\n [data-file-tree-virtualized-sticky='true'] {\n position: sticky;\n top: 0;\n width: 100%;\n display: flex;\n flex-direction: column;\n isolation: isolate;\n /* Promote to its own compositor layer so text inside the window is\n * rasterized once and GPU-translated during scroll. Without this, the\n * browser re-paints the window (and its text) at every scroll frame,\n * which produces visible 1px shake / character tearing. */\n will-change: transform;\n }\n\n [data-file-tree-search-container] {\n display: flex;\n padding: 0;\n padding-inline: var(--trees-padding-inline);\n margin-bottom: var(--trees-item-row-gap);\n }\n\n [data-file-tree-search-input] {\n --trees-focus-ring-width: 2px;\n font-family: var(--trees-font-family);\n font-size: var(--trees-font-size);\n flex: 1;\n height: var(--trees-row-height);\n /* 1px breathing room so the focus-visible outline isn't clipped when the\n * input sits flush against the top of the scroll container. */\n margin-block: 1px;\n padding-inline: var(--trees-item-padding-x);\n line-height: var(--trees-row-height);\n color: var(--trees-search-fg);\n background-color: var(--trees-search-bg);\n border: 1px solid var(--trees-border-color);\n border-radius: var(--trees-border-radius);\n outline: none;\n\n &::placeholder {\n color: color-mix(\n in lab,\n var(--trees-search-fg) 65%,\n var(--trees-search-bg)\n );\n }\n\n &:focus-visible,\n &[data-file-tree-search-input-fake-focus='true'] {\n outline: var(--trees-focus-ring-width) solid var(--trees-focus-ring-color);\n outline-offset: var(--trees-focus-ring-offset);\n }\n }\n\n /* The wrapper for the tree items */\n [role='tree'] {\n position: relative;\n display: flex;\n flex-direction: column;\n gap: var(--trees-gap-override, 0);\n }\n\n /* LIST ITEM */\n [data-type='item'] {\n color: inherit;\n font-family: var(--trees-font-family);\n font-size: var(--trees-font-size);\n text-align: start;\n outline: none;\n background-color: var(--trees-bg);\n border: none;\n position: relative;\n\n padding: 0 var(--trees-item-padding-x);\n margin: 0 var(--trees-item-margin-x);\n cursor: pointer;\n -webkit-user-select: none;\n user-select: none;\n -webkit-touch-callout: none;\n touch-action: manipulation;\n display: flex;\n flex: 0 0 var(--trees-row-height);\n align-items: center;\n height: var(--trees-row-height);\n line-height: var(--trees-row-height);\n gap: var(--trees-item-row-gap);\n border-radius: var(--trees-border-radius);\n /* Row states may be translucent, so markers paint the tree background first\n * and then the state color on top to avoid compositing the same alpha twice. */\n --truncate-marker-background-color: var(--trees-bg);\n --truncate-marker-background-overlay-color: transparent;\n --truncate-marker-block-inset: 0px;\n\n &:hover,\n &[data-item-context-hover='true'] {\n background-color: var(--trees-bg-muted);\n --truncate-marker-background-overlay-color: var(--trees-bg-muted);\n }\n\n &[data-item-focused='true'],\n &:focus-visible {\n z-index: 2;\n\n /* Flattened segment markers sit high enough to cover the row outline unless\n * their painted background is inset by the focus ring width. */\n [data-item-flattened-subitems] {\n --truncate-marker-block-inset: var(--trees-focus-ring-width);\n }\n\n &::before {\n position: absolute;\n inset: 0;\n content: '';\n display: block;\n border-radius: var(--trees-border-radius);\n outline: var(--trees-focus-ring-width) solid\n var(--trees-focus-ring-color);\n outline-offset: var(--trees-focus-ring-offset);\n pointer-events: none;\n }\n\n &[data-item-selected='true']::before {\n outline-color: var(--trees-selected-focused-border-color);\n }\n }\n\n &[data-item-selected='true'] {\n color: var(--trees-selected-fg);\n background-color: var(--trees-selected-bg);\n --truncate-marker-background-overlay-color: var(--trees-selected-bg);\n z-index: 3;\n\n [data-item-section='icon'] {\n color: var(--trees-selected-fg);\n }\n }\n\n &[data-item-search-match='true'] {\n font-weight: var(--trees-search-font-weight);\n }\n }\n\n [data-type='item'][data-file-tree-sticky-row='true'] {\n pointer-events: auto;\n }\n\n /* Sticky rows opt back into pointer events because the overlay wrapper is\n * inert. During scroll, put them back under the same hover suppression as\n * the virtualized list so translucent hover states and menu triggers do not\n * paint over rows moving beneath the sticky
2stack. */\n [data-file-tree-virtualized-root='true'][data-is-scrolling]\n [data-type='item'][data-file-tree-sticky-row='true'] {\n pointer-events: none;\n }\n\n [data-file-tree-virtualized-root='true'][data-is-scrolling]\n [data-type='item'][data-file-tree-sticky-row='true']:hover:not(\n [data-item-selected='true']\n ),\n [data-file-tree-virtualized-root='true'][data-is-scrolling]\n [data-type='item'][data-file-tree-sticky-row='true'][data-item-context-hover='true']:not(\n [data-item-selected='true']\n ) {\n background-color: var(--trees-bg);\n --truncate-marker-background-overlay-color: transparent;\n }\n\n [data-item-selected='true']:has(+ [data-item-selected='true']) {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n [data-item-selected='true'] + [data-item-selected='true'] {\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n }\n\n /* Flattened Directory Parts */\n [data-item-flattened-subitems] {\n display: inline-flex;\n align-items: center;\n gap: 2px;\n }\n [data-item-flattened-subitem]:hover,\n [data-item-flattened-subitem-drag-target='true'] {\n text-decoration: underline;\n }\n\n /* Icon for each item */\n [data-item-section='icon'] {\n flex-shrink: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--trees-fg-muted);\n fill: currentColor;\n width: var(--trees-icon-width);\n }\n\n :where([data-item-section='icon'] > [data-icon-token]) {\n color: var(--trees-fg-muted);\n }\n\n [data-file-tree-colored-icons='true'] {\n [data-icon-token='astro'] {\n color: var(--trees-file-icon-color-astro);\n }\n [data-icon-token='babel'] {\n color: var(--trees-file-icon-color-babel);\n }\n [data-icon-token='bash'] {\n color: var(--trees-file-icon-color-bash);\n }\n [data-icon-token='biome'] {\n color: var(--trees-file-icon-color-biome);\n }\n [data-icon-token='bootstrap'] {\n color: var(--trees-file-icon-color-bootstrap);\n }\n [data-icon-token='browserslist'] {\n color: var(--trees-file-icon-color-browserslist);\n }\n [data-icon-token='bun'] {\n color: var(--trees-file-icon-color-bun);\n }\n [data-icon-token='c'] {\n color: var(--trees-file-icon-color-c);\n }\n [data-icon-token='cpp'] {\n color: var(--trees-file-icon-color-cpp);\n }\n [data-icon-token='claude'] {\n color: var(--trees-file-icon-color-claude);\n }\n [data-icon-token='css'] {\n color: var(--trees-file-icon-color-css);\n }\n [data-icon-token='database'] {\n color: var(--trees-file-icon-color-database);\n }\n [data-icon-token='default'] {\n color: var(--trees-file-icon-color-default);\n }\n [data-icon-token='docker'] {\n color: var(--trees-file-icon-color-docker);\n }\n [data-icon-token='eslint'] {\n color: var(--trees-file-icon-color-eslint);\n }\n [data-icon-token='git'] {\n color: var(--trees-file-icon-color-git);\n }\n [data-icon-token='go'] {\n color: var(--trees-file-icon-color-go);\n }\n [data-icon-token='graphql'] {\n color: var(--trees-file-icon-color-graphql);\n }\n [data-icon-token='html'] {\n color: var(--trees-file-icon-color-html);\n }\n [data-icon-token='image'] {\n color: var(--trees-file-icon-color-image);\n }\n [data-icon-token='javascript'] {\n color: var(--trees-file-icon-color-javascript);\n }\n [data-icon-token='json'] {\n color: var(--trees-file-icon-color-json);\n }\n [data-icon-token='markdown'] {\n color: var(--trees-file-icon-color-markdown);\n }\n [data-icon-token='mcp'] {\n color: var(--trees-file-icon-color-mcp);\n }\n [data-icon-token='npm'] {\n color: var(--trees-file-icon-color-npm);\n }\n [data-icon-token='oxc'] {\n color: var(--trees-file-icon-color-oxc);\n }\n [data-icon-token='postcss'] {\n color: var(--trees-file-icon-color-postcss);\n }\n [data-icon-token='prettier'] {\n color: var(--trees-file-icon-color-prettier);\n }\n [data-icon-token='python'] {\n color: var(--trees-file-icon-color-python);\n }\n [data-icon-token='react'] {\n color: var(--trees-file-icon-color-react);\n }\n [data-icon-token='ruby'] {\n color: var(--trees-file-icon-color-ruby);\n }\n [data-icon-token='rust'] {\n color: var(--trees-file-icon-color-rust);\n }\n [data-icon-token='sass'] {\n color: var(--trees-file-icon-color-sass);\n }\n [data-icon-token='svg'] {\n color: var(--trees-file-icon-color-svg);\n }\n [data-icon-token='svelte'] {\n color: var(--trees-file-icon-color-svelte);\n }\n [data-icon-token='svgo'] {\n color: var(--trees-file-icon-color-svgo);\n }\n [data-icon-token='swift'] {\n color: var(--trees-file-icon-color-swift);\n }\n [data-icon-token='table'] {\n color: var(--trees-file-icon-color-table);\n }\n [data-icon-token='text'] {\n color: var(--trees-file-icon-color-text);\n }\n [data-icon-token='tailwind'] {\n color: var(--trees-file-icon-color-tailwind);\n }\n [data-icon-token='terraform'] {\n color: var(--trees-file-icon-color-terraform);\n }\n [data-icon-token='typescript'] {\n color: var(--trees-file-icon-color-typescript);\n }\n [data-icon-token='vite'] {\n color: var(--trees-file-icon-color-vite);\n }\n [data-icon-token='vscode'] {\n color: var(--trees-file-icon-color-vscode);\n }\n [data-icon-token='vue'] {\n color: var(--trees-file-icon-color-vue);\n }\n [data-icon-token='wasm'] {\n color: var(--trees-file-icon-color-wasm);\n }\n [data-icon-token='webpack'] {\n color: var(--trees-file-icon-color-webpack);\n }\n [data-icon-token='yml'] {\n color: var(--trees-file-icon-color-yml);\n }\n [data-icon-token='zig'] {\n color: var(--trees-file-icon-color-zig);\n }\n [data-icon-token='zip'] {\n color: var(--trees-file-icon-color-zip);\n }\n }\n\n /* Chevron rotation and visual alignment */\n /* Chevron pointing down */\n [data-icon-name='file-tree-icon-chevron'] {\n &[data-align-capitals='false'] {\n transform: translate(0, var(--trees-icon-nudge));\n }\n &[data-align-capitals='true'] {\n transform: translate(0, 0);\n }\n }\n\n [data-item-section='content'] {\n flex: 0 1 auto;\n text-align: start;\n min-width: 0;\n max-width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n /* Breaks middle truncate component to also set this */\n /* white-space: nowrap; */\n }\n\n [data-item-section='decoration'] {\n flex: 1 1 0;\n min-width: 0;\n display: flex;\n justify-content: flex-end;\n text-align: end;\n overflow: hidden;\n color: var(--trees-fg-muted);\n }\n\n [data-item-section='decoration'] > span {\n min-width: 0;\n max-width: 100%;\n display: inline-flex;
2\n align-items: center;\n justify-content: flex-end;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n [data-item-section='git'],\n [data-item-section='action'] {\n flex: 0 0 auto;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n [data-item-section='git'] {\n width: var(--trees-git-lane-width);\n }\n\n [data-item-section='action'] {\n width: var(--trees-action-lane-width);\n color: var(--trees-fg-muted);\n fill: currentColor;\n pointer-events: none;\n }\n\n [data-item-section='git'] > span,\n [data-item-section='action'] > span {\n width: 100%;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n }\n\n [data-item-action-affordance='decorative'] {\n opacity: 0.85;\n }\n\n [data-item-rename-input] {\n appearance: none;\n width: 100%;\n min-width: 0;\n height: calc(var(--trees-row-height) - 4px);\n font-family: inherit;\n font-size: inherit;\n /* line-height: calc(var(--trees-row-height) - 8px); */\n color: inherit;\n background-color: transparent;\n border: 0;\n padding-inline: 6px;\n outline: none;\n box-sizing: border-box;\n }\n\n [data-item-section='content']:has([data-item-rename-input])\n ~ [data-item-section='action'],\n [data-item-section='content']:has([data-item-rename-input])\n ~ [data-item-section='decoration'] {\n display: none;\n }\n\n /* Chevron pointing right */\n [aria-expanded='false'][data-item-type='folder']\n > [data-item-section='icon']\n > [data-icon-name='file-tree-icon-chevron'] {\n &[data-align-capitals='true'] {\n transform: rotate(-90deg)\n translate(\n calc(var(--trees-icon-nudge) / 2),\n calc(var(--trees-icon-nudge) / 2)\n );\n }\n &[data-align-capitals='false'] {\n transform: rotate(-90deg)\n translate(\n calc(var(--trees-icon-nudge) / 2 * -1),\n calc(var(--trees-icon-nudge) / 2)\n );\n }\n }\n\n /* LIST IDENTATION */\n /* Spacing container */\n [data-item-section='spacing'] {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n height: var(--trees-row-height);\n padding-left: calc(calc(var(--trees-icon-width) / 2) - 0.5px);\n\n &:empty {\n padding-left: 0;\n }\n }\n\n /* Spacing per level */\n [data-item-section='spacing-item'] {\n transform: translateX(-0.25px);\n display: inline-block;\n border-left: 1px solid var(--trees-indent-guide-bg);\n height: 100%;\n margin-right: calc(var(--trees-level-gap) - 1px);\n opacity: 0;\n transition: opacity 150ms ease;\n\n & + & {\n margin-left: calc(\n var(--trees-item-row-gap) + calc(var(--trees-icon-width) / 2) - 0.5px\n );\n }\n }\n\n :host(:hover) [data-item-section='spacing-item'] {\n opacity: 0.75;\n }\n\n /* Git status indicator */\n\n /* This is a folder that contains a git change */\n [data-item-contains-git-change='true'] > [data-item-section='git'] {\n color: var(--trees-git-modified-color);\n opacity: 0.5;\n fill: currentColor;\n }\n\n /* These are files that have a git change */\n [data-item-git-status] {\n &\n > :where([data-item-section='icon'])\n > :where(:not([data-icon-name='file-tree-icon-chevron'])) {\n color: var(--trees-item-git-status-color);\n }\n & > [data-item-section='content'] {\n color: var(--trees-item-git-status-color);\n }\n & > [data-item-section='git'] {\n color: var(--trees-item-git-status-color);\n font-weight: var(--trees-font-weight-semibold);\n }\n }\n\n [data-item-git-status='added'] {\n --trees-item-git-status-color: var(--trees-git-added-color);\n }\n\n [data-item-git-status='deleted'] {\n --trees-item-git-status-color: var(--trees-git-deleted-color);\n }\n\n [data-item-git-status='ignored'] {\n --trees-item-git-status-color: var(--trees-git-ignored-color);\n\n & > [data-item-section='icon'] {\n opacity: 0.5;\n }\n }\n\n [data-item-section='git'] [data-icon-name='file-tree-icon-dot'] {\n /* this is a nudge to align the dot with the likely lowercase text. it's slightly\n generalizable, but other fonts are gonna need other nudges i assume */\n transform: translateY(calc(0.65ex - 50%));\n }\n\n [data-item-git-status='modified'] {\n --trees-item-git-status-color: var(--trees-git-modified-color);\n }\n\n [data-item-git-status='renamed'] {\n --trees-item-git-status-color: var(--trees-git-renamed-color);\n }\n\n [data-item-git-status='untracked'] {\n --trees-item-git-status-color: var(--trees-git-untracked-color);\n }\n\n /* Drag and drop */\n [data-item-drag-target='true'] {\n background-color: var(--trees-selected-bg);\n }\n\n [data-item-dragging='true'] {\n opacity: 0.5;\n }\n\n /* Lock icon for locked paths (sibling of content) */\n [data-item-section='lock'] {\n flex: 0 0 auto;\n margin-left: auto;\n display: flex;
2\n align-items: center;\n color: var(--trees-fg-muted);\n }\n [data-item-section='lock'] svg {\n display: block;\n }\n\n [data-type='header-slot'] {\n display: block;\n flex: 0 0 auto;\n }\n\n [data-type='context-menu-wash'] {\n position: absolute;\n inset: 0;\n z-index: 3;\n background-color: transparent;\n touch-action: none;\n }\n\n [data-type='context-menu-anchor'] {\n position: absolute;\n top: 0;\n right: var(--trees-context-menu-trigger-inline-offset);\n z-index: 4;\n display: none;\n align-items: center;\n\n &[data-visible='true'] {\n display: flex;\n }\n }\n\n /* Hide the floating trigger while the scroll container is actively moving.\n * The anchor is positioned against the root, not the scroll content, so its\n * `top` follows the row via a React state update â one frame behind the\n * compositor. That delay is visible as the trigger hovering over the wrong\n * row during the first frame of a scroll. The `data-is-scrolling` flag on\n * the root is flipped synchronously on `wheel`/`touchmove`/`keydown` before\n * the compositor commits the next paint, so this selector hides the anchor\n * in the same frame the scroll begins. */\n [data-file-tree-virtualized-root='true'][data-is-scrolling]\n [data-type='context-menu-anchor'] {\n display: none;\n }\n\n [data-type='context-menu-anchor'] > slot[name='context-menu'] {\n display: block;\n width: 0;\n min-width: 0;\n flex: 0 0 0;\n overflow: visible;\n }\n\n /* Single floating context menu trigger */\n [data-type='context-menu-trigger'] {\n all: unset;\n align-items: center;\n justify-content: center;\n width: var(--trees-action-lane-width);\n color: var(--trees-fg-muted);\n fill: currentColor;\n cursor: pointer;\n font-family: var(--trees-font-family);\n font-size: var(--trees-font-size);\n border-top-right-radius: var(--trees-border-radius);\n border-bottom-right-radius: var(--trees-border-radius);\n margin: var(--trees-focus-ring-width);\n height: calc(var(--trees-row-height) - var(--trees-focus-ring-width) * 2);\n border-width: 0;\n transition: color 120ms ease;\n\n display: flex;\n }\n\n [data-type='context-menu-trigger']:hover,\n [data-type='context-menu-trigger'][aria-expanded='true'] {\n color: var(--trees-fg);\n }\n\n /** @pierre/truncate css here, manually copy pasted for now */\n [data-truncate-container] {\n /* CUSTOM TO TREES, TO SUPPORT THE OUTLINE */\n margin-top: -1px;\n margin-bottom: -1px;\n\n /* Width of the fade from default marker to text */\n --truncate-internal-marker-fade-width: var(\n --truncate-marker-fade-width,\n 2px\n );\n /* Width of the solid color between the fade from the default marker to the text */\n --truncate-internal-marker-gap: var(--truncate-marker-gap, 0px);\n /* Opacity of the marker 'color' property, not of the element itself */\n --truncate-internal-marker-opacity: var(--truncate-marker-opacity, 50%);\n /* Opacity of the marker 'color' property specifically for the middle truncate, not opacity of the element itself */\n --truncate-internal-middle-marker-opacity: var(\n --truncate-middle-marker-opacity,\n 80%\n );\n /* Background color of the default marker */\n --truncate-internal-marker-background-color: var(\n --truncate-marker-background-color,\n light-dark(white, black)\n );\n --truncate-internal-marker-background-overlay-color: var(\n --truncate-marker-background-overlay-color,\n transparent\n );\n --truncate-internal-marker-block-inset: var(\n --truncate-marker-block-inset,\n 0px\n );\n /* Duration of the fade out animation for the marker */\n --truncate-internal-marker-fade-out-duration: var(\n --truncate-marker-fade-out-duration,\n 0ms\n );\n /* Duration of the fade in animation for the marker */\n --truncate-internal-marker-fade-in-duration: var(\n --truncate-marker-fade-in-duration,\n 100ms\n );\n\n /* FADE Variant specifics */\n --truncate-internal-fade-marker-color: var(\n --truncate-fade-marker-color,\n #000\n );\n --truncate-internal-fade-marker-width: var(\n --truncate-fade-marker-width,\n 0.2lh\n );\n\n /*\n In some special cases people might be adding spacing in other ways\n that would benefit from being able to override this, however the container\n query below can't use this and would need to be redeclared with the overridden\n value. It's a bad time, but better than nothing.\n */\n --truncate-internal-single-line-height: 1lh;\n\n height: var(--truncate-internal-single-line-height);\n min-width: 0;\n overflow: hidden;\n }\n\n [data-truncate-marker] {\n display: flex;\n position: absolute;\n height: var(--truncate-internal-single-line-height);\n padding-block: var(--truncate-internal-marker-block-inset);\n box-sizing: border-box;
2\n align-items: center;\n background-clip: content-box;\n z-index: 2;\n color: color-mix(\n in srgb,\n currentColor var(--truncate-internal-marker-opacity),\n transparent\n );\n\n /* Core trick for hiding the marker until overflow occurs */\n opacity: 0;\n transition: opacity var(--truncate-internal-marker-fade-out-duration)\n ease-in-out;\n }\n\n @container measure (height > 1lh) {\n [data-truncate-marker] {\n opacity: 1;\n transition: opacity var(--truncate-internal-marker-fade-in-duration)\n ease-in-out;\n }\n }\n\n [data-truncate-grid] {\n display: grid;\n position: relative;\n }\n\n [data-truncate-content='visible'] {\n white-space: nowrap;\n }\n\n [data-truncate-content='overflow'] {\n opacity: 0;\n pointer-events: none;\n -webkit-user-select: none;\n user-select: none;\n word-break: break-all;\n margin-top: calc(-1 * var(--truncate-internal-single-line-height));\n }\n\n [data-truncate-marker-cell] {\n container: measure / size;\n overflow: visible;\n -webkit-user-select: none;\n user-select: none;\n pointer-events: none;\n }\n\n [data-truncate-container='truncate'] {\n & [data-truncate-grid] {\n grid-template-columns: minmax(0, max-content) 0;\n }\n & [data-truncate-marker] {\n right: 0;\n }\n & [data-truncate-fade] {\n margin-right: calc(-2 * var(--truncate-internal-fade-marker-width));\n }\n }\n\n [data-truncate-container='fruncate'] {\n & [data-truncate-grid] {\n grid-template-columns: 0 minmax(0, max-content) auto;\n }\n & [data-truncate-content] {\n direction: rtl;\n }\n & [data-truncate-content] > span {\n unicode-bidi: plaintext;\n }\n & [data-truncate-fade] {\n margin-left: calc(-2 * var(--truncate-internal-fade-marker-width));\n }\n }\n\n [data-truncate-variant='default'] {\n & [data-truncate-marker] {\n background-color: var(--truncate-internal-marker-background-color);\n background-image: linear-gradient(\n var(--truncate-internal-marker-background-overlay-color),\n var(--truncate-internal-marker-background-overlay-color)\n );\n }\n & [data-truncate-marker]::after,\n & [data-truncate-marker]::before {\n content: '';\n position: absolute;\n width: calc(\n var(--truncate-internal-marker-fade-width) +\n var(--truncate-internal-marker-gap)\n );\n inset-block-start: var(--truncate-internal-marker-block-inset);\n height: max(\n 0px,\n calc(\n var(--truncate-internal-single-line-height) -\n var(--truncate-internal-marker-block-inset) * 2\n )\n );\n background-color: var(--truncate-internal-marker-background-color);\n background-image: linear-gradient(\n var(--truncate-internal-marker-background-overlay-color),\n var(--truncate-internal-marker-background-overlay-color)\n );\n mask-image: linear-gradient(\n var(--truncate-internal-fade-dir),\n #000 0%,\n #000 var(--truncate-internal-marker-gap),\n transparent 100%\n );\n }\n & [data-truncate-marker]::after {\n --truncate-internal-fade-dir: to right;\n right: calc(\n -1 *\n (\n var(--truncate-internal-marker-fade-width) +\n var(--truncate-internal-marker-gap)\n )\n );\n }\n & [data-truncate-marker]::before {\n --truncate-internal-fade-dir: to left;\n left: calc(\n -1 *\n (\n var(--truncate-internal-marker-fade-width) +\n var(--truncate-internal-marker-gap)\n )\n );\n }\n }\n\n [data-truncate-variant='fade'] {\n & [data-truncate-marker] {\n background: transparent;\n }\n }\n\n [data-truncate-fade] {\n box-shadow:\n 0 0 calc(var(--truncate-internal-fade-marker-width) / 2)\n var(--truncate-internal-fade-marker-color),\n 0 0 var(--truncate-internal-fade-marker-width)\n var(--truncate-internal-fade-marker-color);\n width: calc(var(--truncate-internal-fade-marker-width) * 2);\n height: calc(\n var(--truncate-internal-single-line-height) -\n (var(--truncate-internal-fade-marker-width) * 2)\n );\n margin: var(--truncate-internal-fade-marker-width) 0;\n }\n\n [data-truncate-group-container='middle'] {\n & [data-truncate-container] {\n --truncate-marker-opacity: var(--truncate-internal-middle-marker-opacity);\n }\n\n display: flex;\n min-width: 0;\n\n & > div {\n min-width: 0;\n }\n\n & > div[data-truncate-segment-priority='1'] {\n flex: 0 1 max-content;\n }\n & > div[data-truncate-segment-priority='2'] {\n flex: 0 999999 max-content;\n }\n }\n}\n";const Qa="@layer base, unsafe;";function Ja(e){return`${Qa}\n@layer base {\n ${e}\n}`}const el=new WeakMap;function tl(e,t){if(!e.isConnected)return;const n=function(e){const t=el.get(e);if(null!=t)return t;const n=document.createElement("div");n.setAttribute("data-file-tree-scrollbar-measure","true");const r=document.createElement("div");r.style.position="relative",r.style.height="200%",n.appendChild(r),e.a
2ppendChild(n);const o=Math.max(n.offsetWidth-n.clientWidth,0);return n.remove(),el.set(e,o),o}(t);if(null==n)return;const r=t.querySelector(`style[${ki}]`),o=r instanceof HTMLStyleElement?r:document.createElement("style");r instanceof HTMLStyleElement||(o.setAttribute(ki,""),t.appendChild(o)),o.textContent=`:host { --trees-scrollbar-gutter-measured: ${n}px; }`}let nl;function rl(e,t){!function(e,t){const n=e.querySelector('template[shadowrootmode="open"], template[data-file-tree-shadowrootmode="open"]');if(!(n instanceof HTMLTemplateElement))return;if(t.childNodes.length>0)return;t.appendChild(n.content.cloneNode(!0)),n.hasAttribute("shadowrootmode")&&n.remove()}(e,t),function(e){var t;if("undefined"!=typeof CSSStyleSheet&&"function"==typeof CSSStyleSheet.prototype.replaceSync&&"adoptedStyleSheets"in e){null==nl&&(nl=new CSSStyleSheet,nl.replaceSync(Ja(Xa)));let n=!1;try{e.adoptedStyleSheets=[nl],n=!0}catch{}if(n)return void(null==(t=e.querySelector(`style[${Si}]`))||t.remove())}if(null==e.querySelector(`style[${Si}]`)){const t=document.createElement("style");t.setAttribute(Si,""),t.textContent=Ja(Xa),e.prepend(t)}}(t),tl(e,t)}if("undefined"!=typeof HTMLElement&&null==customElements.get(Ci)){class e extends HTMLElement{constructor(){super()}connectedCallback(){rl(this,this.shadowRoot??this.attachShadow({mode:"open"}))}}if(customElements.define(Ci,e),"undefined"!=typeof document)for(const t of Array.from(document.querySelectorAll(Ci)))t instanceof HTMLElement&&rl(t,t.shadowRoot??t.attachShadow({mode:"open"}))}function ol(e){return e.endsWith("/")}function il(e,t){return t.includes(e)?function(e){const t=[],n=new Set;for(const o of e)n.has(o)||(n.add(o),t.push(o));const r=new Set;for(const o of t.toSorted((e,t)=>e.length!==t.length?e.length-t.length:e.localeCompare(t))){const e=(o.endsWith("/")?o.slice(0,-1):o).split("/");let t=!1;for(let n=0;n<e.length-1;n+=1){const o=`${e.slice(0,n+1).join("/")}/`;if(r.has(o)){t=!0;break}}t||r.add(o)}return t.filter(e=>r.has(e))}(t):[e]}function sl(e,t){return{draggedPaths:e,target:t}}function al(e,t){if("directory"!==t.kind||null==t.directoryPath)return!1;for(const n of e)if(ol(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function ll(e,t,n){const{paths:r,preparedInput:o}=e;if(null==o){if(null==r)throw new Error("FileTree requires paths or preparedInput");return{paths:r,preparedInput:void 0}}const i=o.paths;if(null==r)return{paths:i,preparedInput:o};if(!function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}(Wa.preparePaths(r,null==n?{}:{sort:n}),i))throw new Error(`FileTree ${t} received paths and preparedInput for different path lists`);return{paths:i,preparedInput:o}}function cl(e){return"add"===e.operation||"remove"===e.operation||"move"===e.operation||"batch"===e.operation}function ul(e,t,n=!1){if(null==e)return null;switch(t.operation){case"add":case"expand":case"collapse":case"mark-directory-unloaded":case"begin-child-load":case"apply-child-patch":case"complete-child-load":case"fail-child-load":case"cleanup":return e;case"remove":return function(e,t){if(e===t)return!0;const n=t.endsWith("/")?t:`${t}/`;return e.startsWith(n)}(e,t.path)?n?e:null:e;case"move":return function(e,t,n){if(e===t)return n;const r=t.endsWith("/")?t:`${t}/`;return e.startsWith(r)?`${n.endsWith("/")?n:`${n}/`}${e.slice(r.length)}`:e}(e,t.from,t.to);case"batch":{let r=e;for(const e of t.events)if(r=ul(r,e,n),null==r)return null;return r}}}function dl(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function hl(e){switch(e.operation){case"add":return{...dl(e),operation:"add",path:e.path};case"remove":return{...dl(e),operation:"remove",path:e.path,recursive:e.recursive};case"move":return{...dl(e),from:e.from,operation:"move",to:e.to}}}function pl(e){switch(e.operation){case"add":case"remove":case"move":return hl(e);case"batch":return function(e){return{...dl(e),events:e.events.filter(e=>"add"===e.operation||"remove"===e.operation||"move"===e.operation).map(e=>hl(e)),operation:"batch"}}(e);default:return null}}function gl(e,t){if(e.size!==t.length)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function fl(e){const t=e.endsWith("/")?e.slice(0,-1):e;if(0===t.length)return[];const n=t.split("/");return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join("/")}/`)}function ml(e){return fl(e).at(-1)??null}function vl(e,t){return null==t?e:e.startsWith(t)?e.slice(t.length):e}function yl(e){return e.endsWith("/")}const bl=e=>e.toLowerCase();function wl(e){return e.endsWith("/")?e.slice(0,-1):e}function xl(e,t){return t&&!e.endsWith("/")?`${e}/`:e}const Cl=Symbol("FILE_TREE_RENAME_VIEW");function Sl(e,t,n){if(0===e)return-1;if(null!=n){const e=t(n);if(null!=e)return e;const r=fl(n);for(let n=r.length-1;n>=0;n-=1){const e=r[n];if(null==e)continue;const o=t(e);if(null!=o)return o}}return 0}var Il=(Ve=class{constructor(e){Ht(this,K),Ht(this,n),Ht(this,r,new Set),Ht(this,o,new Map),Ht(this,i,null),Ht(this,s,null),Ht(this,a,new Map),Ht(this,l,new Map),Ht(this,c,-1),Ht(this,u,null),Ht(this,d,!1),Ht(this,h,e=>-1),Ht(this,p,new Map),Ht(this,g,null),Ht(this,f,null),Ht(this,m,null),Ht(this,v,null),Ht(this,y,null),Ht(this,b),Ht(this,w),Ht(this,x),Ht(this,C,[]),Ht(this,S,new Int32Array(0)),Ht(this,I,new Int32Array(0)),Ht(this,k),Ht(this,P,!1),Ht(this,D,null),Ht(this,M,""),Ht(this,E,!1),Ht(this,T,new Set),Ht(this,A,[]),Ht(this,_),Ht(this,N,null),Ht(this,R,null),Ht(this,j,null),Ht(this,z,null),Ht(this,L,null),Ht(this,$,null),Ht(this,F,null),Ht(this,O,0),Ht(this,H,null),Ht(this,q,new Set),Ht(this,V,0),Ht(this,B),Ht(this,U,0),Ht(this,W,!1),Ht(this,G,0),Ht(this,Z);const{dragAndDrop:t,fileTreeSearchMode:Y,initialSearchQuery:X,initialSelectedPaths:Q,renaming:J,onSearchChange:ee,paths:te,preparedInput
2:ne,...re}=e,oe=ll({paths:te,preparedInput:ne},"constructor",re.sort);qt(this,n,re),null!=t&&!1!==t&&qt(this,i,!0===t?{}:t),qt(this,P,null!=J&&!1!==J),null!=J&&!1!==J&&!0!==J&&(qt(this,k,J.canRename),qt(this,w,J.onError),qt(this,b,J.onRename)),qt(this,x,ee),qt(this,_,Y??"hide-non-matches"),qt(this,B,Vt(this,K,he).call(this,oe.paths,oe.preparedInput));const ie=(null==Q?void 0:Q.map(e=>Vt(this,K,ze).call(this,e)).filter(e=>null!=e))??[],se=ie.at(-1)??null;ie.length>0&&(qt(this,q,new Set(ie)),qt(this,H,se),qt(this,V,1)),Vt(this,K,Re).call(this,se,!1),null!=X&&Vt(this,K,Me).call(this,X,!1),qt(this,Z,Vt(this,K,He).call(this))}destroy(){var e;null==(e=Ot(this,Z))||e.call(this),qt(this,Z,null),Ot(this,o).clear(),Ot(this,r).clear(),Ot(this,p).clear(),qt(this,s,null),Vt(this,K,ye).call(this)}focusFirstItem(){Vt(this,K,Se).call(this).length>0&&Vt(this,K,$e).call(this,0)}focusLastItem(){Ot(this,G)<=0||(Vt(this,K,Fe).call(this),Vt(this,K,$e).call(this,Ot(this,G)-1))}focusNextItem(){Vt(this,K,Ne).call(this,1)}focusParentItem(){if(null==Ot(this,u))return;const e=ml(Ot(this,u));if(null==e)return;const t=Vt(this,K,ee).call(this,e);t>=0&&Vt(this,K,$e).call(this,t)}focusPath(e){var t;const n=(null==(t=Ot(this,B).getPathInfo(e))?void 0:t.path)??null;if(null==n)return;Vt(this,K,Fe).call(this);const r=Vt(this,K,ee).call(this,n);r>=0&&Vt(this,K,$e).call(this,r)}scrollToPath(e,t){var n;const r=(null==(n=Ot(this,B).getPathInfo(e))?void 0:n.path)??null;if(null==r)return;Vt(this,K,Fe).call(this);const o=Vt(this,K,Ie).call(this,r);var i;o<0||null!=Vt(this,K,je).call(this,o)&&(!1!==(null==t?void 0:t.focus)&&Vt(this,K,$e).call(this,o,!1),qt(this,F,{id:qt(this,O,Ot(this,O)+1),offset:(i=null==t?void 0:t.offset,"top"===i||"center"===i?i:"nearest"),visibleIndex:o}),Vt(this,K,Te).call(this))}focusMountedPathFromInput(e){var t;const n=(null==(t=Ot(this,B).getPathInfo(e))?void 0:t.path)??null;if(null==n)return;const r=Vt(this,K,ee).call(this,n);r>=0&&Vt(this,K,$e).call(this,r)}focusNearestPath(e){const t=this.resolveNearestVisiblePath(e);if(null==t)return null;const n=Vt(this,K,ee).call(this,t);return n>=0?(Vt(this,K,$e).call(this,n),Vt(this,K,Se).call(this)[n]??t):null}focusPreviousItem(){Vt(this,K,Ne).call(this,-1)}getFocusedIndex(){return Ot(this,c)}getFocusedItem(){return null==Ot(this,u)?null:Vt(this,K,te).call(this,Ot(this,u))}getFocusedPath(){return Ot(this,u)}getScrollRequest(){return Ot(this,F)}clearScrollRequest(e){var t;(null==(t=Ot(this,F))?void 0:t.id)===e&&qt(this,F,null)}resolveNearestVisiblePath(e){var t;const n=Vt(this,K,Se).call(this);if(0===Ot(this,G))return null;if(null==e)return Ot(this,u)??n[0]??null;const r=(null==(t=Ot(this,B).getPathInfo(e))?void 0:t.path)??e,o=Vt(this,K,ee).call(this,r);if(o>=0)return n[o]??r;const i=Vt(this,K,J).call(this,r);return null!=i?i:Ot(this,u)??n[0]??null}getSelectedPaths(){return[...Ot(this,q)]}getSelectionVersion(){return Ot(this,V)}getVisibleCount(){return Ot(this,G)}getVisibleRows(e,t){if(t<e||0===Ot(this,G))return[];const n=Math.max(0,e),r=Math.min(Ot(this,G)-1,t);if(r<n)return[];const o=r-n+1;if(null==Ot(this,L)&&!Ot(this,d)&&r>=Ot(this,C).length&&o<=512){const e=[];for(let t=n;t<=r;t+=1){const n=Ot(this,B).getVisibleRowContext(t);if(null==n)break;e.push(Vt(this,K,re).call(this,n))}return e}if(!Ot(this,d)&&r>=Ot(this,C).length&&Vt(this,K,Fe).call(this),null!=Ot(this,L)){const e=Array.from({length:r-n+1},(e,t)=>Vt(this,K,ke).call(this,n+t)),t=new Map;let o=e[0]??-1,i=o;for(let n=1;n<=e.length;n+=1){const r=e[n];null==r||r!==i+1?(o>=0&&Ot(this,B).getVisibleSlice(o,i).forEach((e,n)=>{t.set(o+n,e)}),null!=r?(o=r,i=r):(o=-1,i=-1)):i=r}return Array.from({length:r-n+1},(e,r)=>{const o=n+r,i=Vt(this,K,ke).call(this,o),s=t.get(i),a=Ot(this,C)[i];if(null==s||null==a)throw new Error(`Missing projection row for filtered visible index ${String(o)}`);return Vt(this,K,ne).call(this,s,o,i,{ancestorPaths:Vt(this,K,se).call(this,i),path:a})})}return Ot(this,B).getVisibleSlice(n,r).map((e,t)=>{const r=n+t,o=Ot(this,C)[r];if(null==o)throw new Error(`Missing projection path for visible index ${String(r)}`);return Vt(this,K,ne).call(this,e,r,r,{ancestorPaths:Vt(this,K,se).call(this,r),path:o})})}getStickyRowCandidates(e,t){if(null!=Ot(this,L))return null;if(0===Ot(this,G)||e<=0||t<=0)return[];const n=[];for(let r=0;r<Ot(this,G);r+=1){const o=e+r*t,i=Math.min(Ot(this,G)-1,Math.floor(o/t)),s=Vt(this,K,oe).call(this,i,r)??(i>0?Vt(this,K,oe).call(this,i-1,r):void 0);if(null==s)break;n.push({row:Vt(this,K,re).call(this,s),subtreeEndIndex:s.subtreeEndIndex})}return n}getItem(e){const t=Ot(this,B).getPathInfo(e);return null==t?null:Vt(this,K,te).call(this,t.path,t)}resolveMountedDirectoryPathFromInput(e){const t=Ot(this,B).getPathInfo(e);return"directory"===(null==t?void 0:t.kind)?t.path:null}toggleMountedDirectoryFromInput(e){const t=this.resolveMountedDirectoryPathFromInput(e);null!=t&&Vt(this,K,qe).call(this,t)}selectAllVisiblePaths(){Vt(this,K,Fe).call(this);const e=[...Vt(this,K,Se).call(this)];Vt(this,K,le).call(this,e,Ot(this,u)??Ot(this,H))}selectOnlyPath(e){const t=Vt(this,K,ze).call(this,e);null!=t&&Vt(this,K,le).call(this,[t],t)}selectOnlyMountedPathFromInput(e){Vt(this,K,le).call(this,[e],e)}selectPath(e){const t=Vt(this,K,ze).call(this,e);null==t||Ot(this,q).has(t)||Vt(this,K,le).call(this,[...Ot(this,q),t])}deselectPath(e){const t=Vt(this,K,ze).call(this,e);null!=t&&Ot(this,q).has(t)&&Vt(this,K,le).call(this,[...Ot(this,q)].filter(e=>e!==t))}toggleFocusedSelection(){null!=Ot(this,u)&&this.togglePathSelectionFromInput(Ot(this,u))}togglePathSelection(e){const t=Vt(this,K,ze).call(this,e);null!=t&&(Ot(this,q).has(t)?this.deselectPath(t):this.selectPath(t))}togglePathSelectionFromInput(e){const t=Vt(this,K,ze).call(this,e);null!=t&&(Ot(this,q).has(t)?Vt(this,K,le).call(this,[...Ot(this,q)].filter(e=>e!==t),t):Vt(this,K,le).call(this,[...Ot(this,q),t],t))}selectPathRange(e,t){const n=Vt(this,K,ze).call(this,e);if(null==n)return;Vt(this,K,Fe).call(this);const r=Ot(this,H),o=null==r?-1:Vt(this,K,Pe).call(this,r),i=Vt(this,K,Pe).call(this,n);if(-1===o||-1===i){const e=t?[...Ot(this,q),n]:[n];return void Vt(this,K,le).call(this,e,n)}const[s,a]=o<=i?[o,i]:[i,o],l=Vt(this,K,Se).call(this).slice(s,a+1),c=t?[...Ot(this,q),...l]:l;Vt(this,K,le).call(this,c,r)}extendSelectionFromFocused(e){if(null==Ot(this,u))return;const t=Ot(this,c);if(-1===t)return;const n=Math.min(Ot(this,G)-1,Math.max(0,t+e));if(n===t)return;!Ot(this,d)&&n>=Ot(this,C).length&&Vt(this,K,Fe).call(this);const r=Vt(this,K,Se).call(this),o=r[t]??null,i=r[n]??null;if(null==o||null==i)return;const s=new Set(Ot(this,q));s.has(o)&&s.has(i)?s.delete(o):s.add(i),Vt(this,K,le).call(this,[...s],Ot(this,H)??o,!1),Vt(this,K,$e).call(this,n)}getDragAndDropConfig(){return Ot(this,i)}isDragAndDropEnabled(){return null!=Ot(this,i)}getDragSession(){return null==Ot(this,s)?null:{draggedPaths:[...Ot(this,s).draggedPaths],primaryPath:Ot(this,s).primaryPath,target:null==Ot(this,s).target?null:{...Ot(this,s).target}}}startDrag(e){var t,n;if(null==Ot(this,i))return!1;const r=Vt(this,K,ze).call(this,e);if(null==r)return!1;if(null!=Ot(this,R)&&Ot(this,R).length>0)return!1;const o=this.getSelectedPaths(),a=il(r,o);return!1!==(null==(n=(t=Ot(this,i)).canDrag)?void 0:n.call(t,a))&&(o.includes(r)||Vt(this,K,le).call(this,[r],r,!1),Vt(this,K,Le).call(this,r),qt(this,s,{draggedPaths:a,primaryPath:r,target:null}),Vt(this,K,Te).call(this),!0)}setDragTarget(e){var t,n;const r=Ot(this,s);if(null==r)return;let o=e;if(null!=o){const e=sl(r.draggedPaths,o);(al(r.draggedPaths,o)||!1===(null==(n=null==(t=Ot(this,i))?void 0:t.canDrop)?void 0:n.call(t,e)))&&(o=null)}var a,l;(a=r.target)===(l=o)||null!=a&&null!=l&&a.kind===l.kind&&a.directoryPath===l.directoryPath&&a.flattenedSegmentPath===l.flattenedSegmentPath&&a.hoveredPath===l.hoveredPath||(qt(this,s,{...r,target:o}),Vt(this,K,Te).call(this))}cancelDrag(){null!=Ot(this,s)&&(qt(this,s,null),Vt(this,K,Te).call(this))}completeDrag(){var e,t,n,r,o,a;const l=Ot(this,s);if(null==l)return!1;qt(this,s,null);const c=null==l.target?null:{...l.target};if(null==c)return Vt(this,K,Te).call(this),!1;const u=sl(l.draggedPaths,c);if(al(l.draggedPaths,c)||!1===(null==(t=null==(e=Ot(this,i))?void 0:e.canDrop)?void 0:t.call(e,u)))return Vt(this,K,Te).call(this),!1;const d=function(e,t){const n=e.map(e=>{const n=function(e,t){return"root"===t.kind||null==t.directoryPath?function(e){const t=e.endsWith("/")?e.slice(0,-1):e,n=t.lastIndexOf("/"),r=n<0?t:t.slice(n+1);return e.endsWith("/")?`${r}/`:r}(e):t.directoryPath}(e,t);return n===e?null:{from:e,to:n,type:"move"}}).filter(e=>null!=e);return 0===n.length?null:{operations:n,result:{draggedPaths:e,operation:1===n.length?"move":"batch",target:t}}}(l.draggedPaths,c);if(null==d)return Vt(this,K,Te).call(this),!1;try{if(1===d.operations.length){const e=d.operations[0];if(null==e||"move"!==e.type)throw new Error("Expected a single move operation for one-item drops");Ot(this,B).move(e.from,e.to,{collision:e.collision})}else Vt(this,K,de).call(this,d.operations),Ot(this,B).batch(d.operations)}catch(h){return Vt(this,K,Te).call(this),null==(r=null==(n=Ot(this,i))?void 0:n.onDropError)||r.call(n,h instanceof Error?h.message:String(h),u),!1}return null==(a=null==(o=Ot(this,i))?void 0:o.onDropComplete)||a.call(o,d.result),!0}subscribe(e){return Ot(this,r).add(e),e(),()=>{Ot(this,r).delete(e)}}add(e){Ot(this,B).add(e)}remove(e,t={}){Ot(this,B).remove(e,t)}move(e,t,n={}){Ot(this,B).move(e,t,n)}batch(e){Ot(this,B).batch(e)}onMutation(e,t){const n=e,r=t;let i=Ot(this,o).get(n);return null==i&&(i=new Set,Ot(this,o).set(n,i)),i.add(r),()=>{const e=Ot(this,o).get(n);null==e||e.delete(r),0===(null==e?void 0:e.size)&&Ot(this,o).delete(n)}}setSearch(e){Vt(this,K,Me).call(this,e,!0)}openSearch(e=""){Vt(this,K,Me).call(this,e,!0)}closeSearch(){Vt(this,K,Me).call(this,null,!0)}isSearchOpen(){return null!==Ot(this,R)}getSearchValue(){return Ot(this,R)??""}getSearchMatchingPaths(){return Ot(this,A)}focusNextSearchMatch(){Vt(this,K,De).call(this,1)}focusPreviousSearchMatch(){Vt(this,K,De).call(this,-1)}startRenaming(e=Ot(this,u)??"",t={}){var n,r;if(!Ot(this,P))return!1;const o=Ot(this,B).getPathInfo(e);if(null==o)return!1;const i=o.path,s=yl(i),a=wl(i);if(!1===(null==(n=Ot(this,k))?void 0:n.call(this,{isFolder:s,path:a})))return!1;for(const l of fl(i))Ot(this,B).isExpanded(l)||Ot(this,B).expand(l);return Vt(this,K,le).call(this,[i],i,!1),null!=Ot(this,R)&&(Vt(this,K,Me).call(this,null,!1),null==(r=Ot(this,x))||r.call(this,Ot(this,R))),Vt(this,K,Le).call(this,i),qt(this,D,i),qt(this,M,function(e){const t=e.endsWith("/")?e.slice(0,-1):e,n=t.lastIndexOf("/");return n<0?t:t.slice(n+1)}(i)),qt(this,E,t.removeIfCanceled??!1),Vt(this,K,Te).call(this),!0}[Cl](){return{cancel:()=>{Vt(this,K,Y).call(this)},commit:()=>{Vt(this,K,X).call(this)},getPath:()=>Ot(this,D),getValue:()=>Ot(this,M),isActive:()=>null!=Ot(this,D),setValue:e=>{Vt(this,K,Q).call(this,e)}}}resetPaths(e,t={}){var r,o,i;const s=Ot(this,B).list().length,a=Ot(this,G),l=ll({paths:e,preparedInput
2:t.preparedInput},"resetPaths",Ot(this,n).sort),c=Vt(this,K,he).call(this,l.paths,l.preparedInput,t.initialExpandedPaths),d=Ot(this,u),h=Ot(this,D),g=this.getSelectedPaths(),f=Ot(this,H);null==(r=Ot(this,Z))||r.call(this),qt(this,B,c),Ot(this,p).clear(),Vt(this,K,ye).call(this);const m=g.map(e=>{var t;return(null==(t=c.getPathInfo(e))?void 0:t.path)??null}).filter(e=>null!=e),v=!gl(Ot(this,q),m);qt(this,q,new Set(m)),v&&qt(this,V,Ot(this,V)+1),qt(this,H,null==f?null:(null==(o=c.getPathInfo(f))?void 0:o.path)??null),qt(this,D,null==h?null:(null==(i=c.getPathInfo(h))?void 0:i.path)??null),null==Ot(this,D)&&(qt(this,M,""),qt(this,E,!1)),Vt(this,K,Re).call(this,d,null!=d||m.length>0||null!=Ot(this,H)),qt(this,Z,Vt(this,K,He).call(this)),Vt(this,K,Te).call(this),Vt(this,K,Ae).call(this,{canonicalChanged:!0,operation:"reset",pathCountAfter:l.paths.length,pathCountBefore:s,projectionChanged:!0,usedPreparedInput:null!=t.preparedInput,visibleCountDelta:Ot(this,G)-a})}},n=new WeakMap,r=new WeakMap,o=new WeakMap,i=new WeakMap,s=new WeakMap,a=new WeakMap,l=new WeakMap,c=new WeakMap,u=new WeakMap,d=new WeakMap,h=new WeakMap,p=new WeakMap,g=new WeakMap,f=new WeakMap,m=new WeakMap,v=new WeakMap,y=new WeakMap,b=new WeakMap,w=new WeakMap,x=new WeakMap,C=new WeakMap,S=new WeakMap,I=new WeakMap,k=new WeakMap,P=new WeakMap,D=new WeakMap,M=new WeakMap,E=new WeakMap,T=new WeakMap,A=new WeakMap,_=new WeakMap,N=new WeakMap,R=new WeakMap,j=new WeakMap,z=new WeakMap,L=new WeakMap,$=new WeakMap,F=new WeakMap,O=new WeakMap,H=new WeakMap,q=new WeakMap,V=new WeakMap,B=new WeakMap,U=new WeakMap,W=new WeakMap,G=new WeakMap,Z=new WeakMap,K=new WeakSet,Y=function(){if(null==Ot(this,D))return;const e=Ot(this,D),t=Ot(this,E);qt(this,D,null),qt(this,M,""),qt(this,E,!1),t?this.remove(e,yl(e)?{recursive:!0}:void 0):(Vt(this,K,Le).call(this,e),Vt(this,K,Te).call(this))},X=function(){var e,t;const n=Ot(this,D);if(null==n)return;if(Ot(this,E)&&0===Ot(this,M).trim().length)return qt(this,D,null),qt(this,M,""),qt(this,E,!1),void this.remove(n,yl(n)?{recursive:!0}:void 0);const r=yl(n),o=function({files:e,path:t,isFolder:n,nextBasename:r}){const o=(e=>e.startsWith("f::")?e.slice(3):e)(t),i=r.trim();if(0===i.length)return{error:"Name cannot be empty."};if(i.includes("/"))return{error:'Name cannot include "/".'};const{parentPath:s,baseName:a}=function(e){const t=e.lastIndexOf("/");return t<0?{parentPath:"",baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}(o);if(i===a)return{nextFiles:e,sourcePath:o,destinationPath:o,isFolder:n};const l=function(e,t){return""===e?t:`${e}/${t}`}(s,i),c=new Array(e.length),u=new Set;if(!n){const t=`${l}/`;let r=!1;for(let n=0;n<e.length;n++){const i=e[n];if(i!==o&&i.startsWith(t))return{error:`"${l}" already exists.`};const s=i===o?l:i;if(u.has(s))return{error:`"${l}" already exists.`};u.add(s),c[n]=s,i===o&&(r=!0)}return r?{nextFiles:c,sourcePath:o,destinationPath:l,isFolder:n}:{error:"Could not find the selected file to rename."}}const d=`${o}/`,h=`${l}/`;let p=0;for(let g=0;g<e.length;g++){const t=e[g],n=t===o||t.startsWith(d);if(!n&&(t===l||t.startsWith(h)))return{error:`"${l}" already exists.`};const r=n?`${l}${t.slice(o.length)}`:t;if(u.has(r))return{error:`"${l}" already exists.`};u.add(r),c[g]=r,n&&p++}return 0===p?{error:"Could not find the selected folder to rename."}:{nextFiles:c,sourcePath:o,destinationPath:l,isFolder:n}}({files:Ot(this,B).list(),isFolder:r,nextBasename:Ot(this,M),path:wl(n)});return qt(this,D,null),qt(this,M,""),qt(this,E,!1),"error"in o?(Vt(this,K,Le).call(this,n),null==(e=Ot(this,w))||e.call(this,o.error),void Vt(this,K,Te).call(this)):o.sourcePath===o.destinationPath?(Vt(this,K,Le).call(this,n),void Vt(this,K,Te).call(this)):(null==(t=Ot(this,b))||t.call(this,{destinationPath:o.destinationPath,isFolder:o.isFolder,sourcePath:o.sourcePath}),void this.move(xl(o.sourcePath,r),xl(o.destinationPath,r)))},Q=function(e){null!=Ot(this,D)&&Ot(this,M)!==e&&(qt(this,M,e),Vt(this,K,Te).call(this))},J=function(e){Vt(this,K,Fe).call(this);const t=ml(e),n=vl(e,t);let r=null,o=null;for(const i of Vt(this,K,Se).call(this)){if(ml(i)!==t)continue;const e=vl(i,t);if(e<n)r=i;else if(e>n){o=i;break}}return r??o},ee=function(e){const t=Vt(this,K,Pe).call(this,e);if(-1!==t)return t;const n=fl(e);for(let r=n.length-1;r>=0;r-=1){const e=n[r];if(null==e)continue;const t=Vt(this,K,Pe).call(this,e);if(-1!==t)return t}return Vt(this,K,Se).call(this).length>0?0:-1},te=function(e,t){const n=Ot(this,p).get(e);if(null!=n)return n;const r=t??Ot(this,B).getPathInfo(e);if(null==r)return null;const o="directory"===r.kind?Vt(this,K,ce).call(this,r.path):Vt(this,K,ue).call(this,r.path);return Ot(this,p).set(r.path,o),o},ne=function(e,t,n,r){var o;return{ancestorPaths:r.ancestorPaths,depth:e.depth,flattenedSegments:null==(o=e.flattenedSegments)?void 0:o.map(e=>({isTerminal:e.isTerminal,name:e.name,path:e.path})),hasChildren:e.hasChildren,index:t,isExpanded:e.isExpanded,isFlattened:e.isFlattened,isFocused:r.path===Ot(this,u),isSelected:Ot(this,q).has(r.path),kind:e.kind,level:e.depth,name:e.name,path:r.path,posInSet:r.posInSet??Ot(this,S)[n]??0,setSize:r.setSize??Ot(this,I)[n]??0}},re=function(e){return Vt(this,K,ne).call(this,e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})},oe=function(e,t){const n=Ot(this,B).getVisibleRowContext(e);if(null==n)return;const r=n.ancestorRows[t];return null!=r?r:t===n.ancestorRows.length&&"directory"===n.row.kind&&n.row.isExpanded?n:void 0},ie=function(e){const t=Ot(this,a).get(e);if(null!=t)return t;const n=Ot(this,h).call(this,e),r=n<0?[]:[...Vt(this,K,ie).call(this,n),n];return Ot(this,a).set(e,r),r},se=function(e){const t=Ot(this,l).get(e);if(null!=t)return t;const n=Vt(this,K,ie).call(this,e).map(e=>Ot(this,C)[e]??"").filter(e=>""!==e);return Ot(this,l).set(e,n),n},ae=function(e){Ot(this,B).collapse(e)},le=function(e,t=Ot(this,H),n=!0){const r=[...new Set(e)],o=!gl(Ot(this,q),r),i=Ot(this,H)!==t;(o||i)&&(qt(this,q,new Set(r)),qt(this,H,t),o&&qt(this,V,Ot(this,V)+1),n&&Vt(this,K,Te).call(this))},ce=function(e){return{collapse:()=>{Vt(this,K,ae).call(this,e)},deselect:()=>{this.deselectPath(e)},expand:()=>{Vt(this,K,_e).call(this,e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>Ot(this,B).isExpanded(e),isFocused:()=>Ot(this,u)===e,isSelected:()=>Ot(this,q).has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{Vt(this,K,qe).call(this,e)}}},ue=function(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>Ot(this,u)===e,isSelected:()=>Ot(this,q).has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}},de=function(e){const t=Ot(this,B).list();Vt(this,K,he).call(this,t).batch(e)},he=function(e,t,r){return new Wa({...Ot(this,n),paths:e,preparedInput
2:null==t?void 0:t,...void 0!==r?{initialExpandedPaths:r}:{}})},pe=function(){return null!=Ot(this,v)||qt(this,v,Ot(this,B).list()),Ot(this,v)},ge=function(){if(null!=Ot(this,m))return Ot(this,m);const e=new Set;for(const t of Vt(this,K,pe).call(this)){e.add(t);for(const n of fl(t))e.add(n)}return qt(this,m,[...e].sort()),Ot(this,m)},fe=function(){return null!=Ot(this,y)||qt(this,y,Vt(this,K,pe).call(this).map(bl)),Ot(this,y)},me=function(){return null!=Ot(this,g)||qt(this,g,Vt(this,K,ge).call(this).filter(e=>e.endsWith("/"))),Ot(this,g)},ve=function(){return null!=Ot(this,f)||qt(this,f,Vt(this,K,me).call(this).map(bl)),Ot(this,f)},ye=function(){qt(this,g,null),qt(this,f,null),qt(this,m,null),qt(this,v,null),qt(this,y,null)},be=function(){return Vt(this,K,me).call(this).filter(e=>Ot(this,B).isExpanded(e))},we=function(e){const t=new Set(Ot(this,N)??[]);if(e)for(const n of Ot(this,q))for(const e of fl(n))t.add(e);Vt(this,K,xe).call(this,t)},xe=function(e){qt(this,W,!0);try{for(const t of Vt(this,K,me).call(this)){const n=e.has(t),r=Ot(this,B).isExpanded(t);n&&!r?Ot(this,B).expand(t):!n&&r&&Ot(this,B).collapse(t)}}finally{qt(this,W,!1)}},Ce=function(){var e;if(null==Ot(this,R)||0===Ot(this,R).length)return qt(this,A,[]),qt(this,L,null),qt(this,$,null),qt(this,z,null),void qt(this,G,Ot(this,U));const t=Ot(this,C);if(qt(this,A,t.filter(e=>Ot(this,T).has(e))),"hide-non-matches"!==Ot(this,_)||0===Ot(this,T).size)return qt(this,L,null),qt(this,$,null),qt(this,z,null),void qt(this,G,Ot(this,U));const n=[],r=[],o=new Map;for(const[i,s]of t.entries())!0===(null==(e=Ot(this,j))?void 0:e.has(s))&&(o.set(s,r.length),n.push(i),r.push(s));qt(this,L,n),qt(this,$,r),qt(this,z,o),qt(this,G,r.length)},Se=function(){return Ot(this,$)??Ot(this,C)},Ie=function(e){var t;return null!=Ot(this,$)?(null==(t=Ot(this,z))?void 0:t.get(e))??-1:Ot(this,B).getVisibleIndex(e)??-1},ke=function(e){var t;return(null==(t=Ot(this,L))?void 0:t[e])??e},Pe=function(e){var t;const n=null==(t=Ot(this,z))?void 0:t.get(e);return null!=n?n:Ot(this,B).getVisibleIndex(e)??-1},De=function(e){const t=Ot(this,A);if(0===t.length)return;const n=Ot(this,u),r=null==n?-1:t.indexOf(n),o=t[r<0?e>0?0:t.length-1:Math.min(t.length-1,Math.max(0,r+e))];null!=o&&this.focusPath(o)},Me=function(e,t){var n;const r=null==e?null:(e=>{const t=e.trim();return 0===t.length?"":(t.includes("\\")?t.replaceAll("\\","/"):t).toLowerCase()})(e),o=Ot(this,R);if(o!==r){if(null==o&&null!=r&&qt(this,N,Vt(this,K,be).call(this)),qt(this,R,r),null==r)Vt(this,K,we).call(this,!0),qt(this,N,null),Ot(this,T).clear(),qt(this,j,null),Vt(this,K,Re).call(this,Ot(this,u),!0);else if(0===r.length)Vt(this,K,we).call(this,!1),Ot(this,T).clear(),qt(this,j,null),Vt(this,K,Re).call(this,Ot(this,u),!0);else{const e=Vt(this,K,Ee).call(this);Vt(this,K,Re).call(this,e,!0)}t&&(null==(n=Ot(this,x))||n.call(this,Ot(this,R)),Vt(this,K,Te).call(this))}},Ee=function(){if(null==Ot(this,R)||0===Ot(this,R).length)return Ot(this,T).clear(),Ot(this,u);const e=Ot(this,R),t=Vt(this,K,pe).call(this),n=Vt(this,K,fe).call(this),r=[],o=new Set;let i=null;for(let u=0;u<t.length;u+=1){if(!n[u].includes(e))continue;const s=t[u];r.push(s),o.add(s),i??(i=s)}const s=Vt(this,K,me).call(this),a=Vt(this,K,ve).call(this);for(let u=0;u<s.length;u+=1){if(!a[u].includes(e))continue;const t=s[u];o.has(t)||(r.push(t),o.add(t),i??(i=t))}qt(this,T,o);const l="hide-non-matches"===Ot(this,_)&&r.length>0?new Set:null;qt(this,j,l);const c="expand-matches"===Ot(this,_)?new Set(Ot(this,N)??[]):new Set;for(const u of r){null!=l&&l.add(u),u.endsWith("/")&&c.add(u);for(const e of fl(u))c.add(e),null!=l&&l.add(e)}return Vt(this,K,xe).call(this,c),i??Ot(this,u)},Te=function(){for(const e of Ot(this,r))e()},Ae=function(e){var t,n;null==(t=Ot(this,o).get(e.operation))||t.forEach(t=>{t(e)}),null==(n=Ot(this,o).get("*"))||n.forEach(t=>{t(e)})},_e=function(e){for(const t of fl(e))Ot(this,B).isExpanded(t)||Ot(this,B).expand(t);Ot(this,B).isExpanded(e)||Ot(this,B).expand(e)},Ne=function(e){const t=Ot(this,G);if(0===t)return;const n=-1===Ot(this,c)?0:Ot(this,c),r=Math.min(t-1,Math.max(0,n+e));r===n&&-1!==Ot(this,c)||(!Ot(this,d)&&null==Ot(this,L)&&r>=Ot(this,C).length&&Vt(this,K,Fe).call(this),Vt(this,K,$e).call(this,r))},Re=function(e,t=!0){const n=Ot(this,B).getVisibleCount();qt(this,U,n);const r=function(e,t,n){if(0===e.paths.length)return{focusedIndex:-1,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};if(null==t)return{focusedIndex:0,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};const r=n??(t=>e.visibleIndexByPath.get(t)??null);return{focusedIndex:Sl(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}(Ot(this,B).getVisibleTreeProjectionData(t?void 0:Math.min(n,512)),e,t?e=>Ot(this,B).getVisibleIndex(e):void 0);Ot(this,a).clear(),Ot(this,l).clear(),qt(this,d,r.paths.length>=n),qt(this,h,r.getParentIndex),qt(this,C,r.paths),qt(this,S,r.posInSetByIndex),qt(this,I,r.setSizeByIndex),Vt(this,K,Ce).call(this),qt(this,c,null==e?Vt(this,K,Se).call(this).length>0?0:-1:Vt(this,K,ee).call(this,e)),qt(this,u,Ot(this,c)<0?null:Vt(this,K,je).call(this,Ot(this,c)))},je=function(e){var t;const n=Vt(this,K,Se).call(this)[e];return null!=n?n:null!=Ot(this,L)?null:(null==(t=Ot(this,B).getVisibleRowContext(e))?void 0:t.row.path)??null},ze=function(e){var t;return(null==(t=Ot(this,B).getPathInfo(e))?void 0:t.path)??null},Le=function(e){if(null==e)return;const t=Vt(this,K,ee).call(this,e);t>=0&&Vt(this,K,$e).call(this,t,!1)},$e=function(e,t=!0){const n=Vt(this,K,je).call(this,e);null!=n&&(Ot(this,c)===e&&Ot(this,u)===n||(qt(this,c,e),qt(this,u,n),t&&Vt(this,K,Te).call(this)))},Fe=function(){Ot(this,d)||Vt(this,K,Re).call(this,Ot(this,u),!0)},Oe=function(e){var t;const n=ul(Ot(this,D),e);null==n&&null!=Ot(this,D)&&qt(this,M,""),qt(this,D,n);const r=ul(Ot(this,u),e,!0),o=[...Ot(this,q)].map(t=>ul(t,e)).filter(e=>null!=e).map(e=>{var t;return(null==(t=Ot(this,B).getPathInfo(e))?void 0:t.path)??null}).filter(e=>null!=e),i=ul(Ot(this,H),e),s=null==i?null:(null==(t=Ot(this,B).getPathInfo(i))?void 0:t.path)??null,a=[...new Set(o)];
2return gl(Ot(this,q),a)||(qt(this,q,new Set(a)),qt(this,V,Ot(this,V)+1)),qt(this,H,s),r},He=function(){return Ot(this,B).on("*",e=>{if(Ot(this,W))return;e.canonicalChanged&&(Ot(this,p).clear(),Vt(this,K,ye).call(this)),null!=Ot(this,s)&&cl(e)&&qt(this,s,null);const t=cl(e)?Vt(this,K,Oe).call(this,e):Ot(this,u),n=null!=Ot(this,R)&&Ot(this,R).length>0?Vt(this,K,Ee).call(this):""===Ot(this,R)?Ot(this,u):t,r=null!=Ot(this,R)||"expand"!==e.operation&&"collapse"!==e.operation;Vt(this,K,Re).call(this,n,r),Vt(this,K,Te).call(this);const o=pl(e);null!=o&&Vt(this,K,Ae).call(this,o)})},qe=function(e){Ot(this,B).isExpanded(e)?Vt(this,K,ae).call(this,e):Vt(this,K,_e).call(this,e)},Ve);function kl(e){const t=e.endsWith("/");let n="",r=-1;for(let o=0;o<=e.length;o+=1)"/"===e[o]||o===e.length?-1!==r&&(""!==n&&(n+="/"),n+=e.slice(r,o),r=-1):-1===r&&(r=o);return""===n?null:{isDirectory:t,path:n}}function Pl(e){const t=e.endsWith("/")?e.slice(0,-1):e;if(0===t.length)return[];const n=t.split("/");return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join("/")}/`)}function Dl(e,t){return t?`${e}/`:e}function Ml(e,t=null){const n=(e=>{if(null==e||0===e.length)return"0";let t=`${e.length}`;for(const n of e)t+=`\0${n.path}\0${n.status}`;return t})(null==e?void 0:[...e]);if("0"===n)return null;if((null==t?void 0:t.signature)===n)return t;const r=new Map,o=new Set,i=new Set;for(const s of e??[]){const e=kl(s.path);if(null==e)continue;const t=Dl(e.path,e.isDirectory);r.set(t,s.status),"ignored"===s.status&&e.isDirectory?i.add(t):e.isDirectory&&i.delete(t);for(const n of Pl(e.path))o.add(n)}return{directoriesWithChanges:o,ignoredDirectoryPaths:i,signature:n,statusByPath:r}}var El,Tl,Al,_l,Nl,Rl,jl,zl,Ll,$l,Fl={},Ol=[],Hl=Array.isArray,ql=Ol.slice,Vl=Object.assign;function Bl(e){e&&e.parentNode&&e.remove()}function Ul(e,t,n){var r,o,i,s={};for(i in t)"key"==i?r=t[i]:"ref"==i&&"function"!=typeof e?o=t[i]:s[i]=t[i];return arguments.length>2&&(s.children=arguments.length>3?ql.call(arguments,2):n),Wl(e,s,r,o,null)}function Wl(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==o?++Tl:o,__i:-1,__u:0};return null==o&&null!=El.vnode&&El.vnode(i),i}function Gl(e){return e.children}function Zl(e,t){this.props=e,this.context=t,this.__g=0}function Kl(e,t){if(null==t)return e.__?Kl(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?Kl(e):null}function Yl(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=n.__e;break}return Yl(e)}}function Xl(e){(8&e.__g||!(e.__g|=8)||!Al.push(e)||Nl++)&&_l==El.debounceRendering||((_l=El.debounceRendering)||queueMicrotask)(Ql)}function Ql(){for(var e,t,n,r,o,i,s,a,l=1;Al.length;)Al.length>l&&Al.sort(Rl),e=Al.shift(),l=Al.length,8&e.__g&&(n=void 0,o=(r=(t=e).__v).__e,i=[],s=[],(a=t.__P)&&((n=Vl({},r)).__v=r.__v+1,El.vnode&&El.vnode(n),ic(a,n,r,t.__n,a.namespaceURI,32&r.__u?[o]:null,i,null==o?Kl(r):o,!!(32&r.__u),s,a.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,ac(i,n,s),n.__e!=o&&Yl(n)));Nl=0}function Jl(e,t,n,r,o,i,s,a,l,c,u,d){var h,p,g,f,m,v,y,b=r&&r.__k||Ol,w=t.length;for(l=function(e,t,n,r,o){var i,s,a,l,c,u=n.length,d=u,h=0;for(e.__k=new Array(o),i=0;i<o;i++)null!=(s=t[i])&&"boolean"!=typeof s&&"function"!=typeof s?(l=i+h,(s=e.__k[i]="string"==typeof s||"number"==typeof s||"bigint"==typeof s||s.constructor==String?Wl(null,s,null,null,null):Hl(s)?Wl(Gl,{children:s},null,null,null):null==s.constructor&&s.__b>0?Wl(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=e,s.__b=e.__b+1,a=null,-1!=(c=s.__i=tc(s,n,l,d))&&(d--,(a=n[c])&&(a.__u|=2)),null==a||null==a.__v?(-1==c&&(o>u?h--:o<u&&h++),"function"!=typeof s.type&&(s.__u|=4)):c!=l&&(c==l-1?h--:c==l+1?h++:(c>l?h--:h++,s.__u|=4))):e.__k[i]=null;if(d)for(i=0;i<u;i++)null!=(a=n[i])&&!(2&a.__u)&&(a.__e==r&&(r=Kl(a)),uc(a,a));return r}(n,t,b,l,w),h=0;h<w;h++)null!=(g=n.__k[h])&&(p=-1==g.__i?Fl:b[g.__i]||Fl,g.__i=h,v=ic(e,g,p,o,i,s,a,l,c,u,d),f=g.__e,g.ref&&p.ref!=g.ref&&(p.ref&&cc(p.ref,null,g),u.push(g.ref,g.__c||f,g)),null==m&&null!=f&&(m=f),(y=!!(4&g.__u))||p.__k===g.__k?l=ec(g,l,e,y):"function"==typeof g.type&&void 0!==v?l=v:f&&(l=f.nextSibling),g.__u&=-7);return n.__e=m,l}function ec(e,t,n,r){var o,i;if("function"==typeof e.type){for(o=e.__k,i=0;o&&i<o.length;i++)o[i]&&(o[i].__=e,t=ec(o[i],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=Kl(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function tc(e,t,n,r){var o,i,s,a=e.key,l=e.type,c=t[n],u=null!=c&&!(2&c.__u);if(null===c&&null==e.key||u&&a==c.key&&l==c.type)return n;if(r>(u?1:0))for(o=n-1,i=n+1;o>
2=0||i<t.length;)if(null!=(c=t[s=o>=0?o--:i++])&&!(2&c.__u)&&a==c.key&&l==c.type)return s;return-1}function nc(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":n}function rc(e,t,n,r,o){var i;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||nc(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||nc(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])i=t!=(t=t.replace(jl,"$1")),(t=t.slice(2))[0].toLowerCase()!=t[0]&&(t=t.toLowerCase()),e.__l||(e.__l={}),e.__l[t+i]=n,n?r?n.l=r.l:(n.l=zl,e.addEventListener(t,i?$l:Ll,i)):e.removeEventListener(t,i?$l:Ll,i);else{if("http://www.w3.org/2000/svg"==o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==n?"":n;break e}catch(s){}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function oc(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(null==t.u)t.u=zl++;else if(t.u<n.l)return;return n(El.event?El.event(t):t)}}}function ic(e,t,n,r,o,i,s,a,l,c,u){var d,h,p,g,f,m,v,y,b,w,x,C,S,I,k,P,D,M,E,T,A,_=t.type;if(null!=t.constructor)return null;128&n.__u&&(l=!!(32&n.__u),n.__c.__z&&(a=t.__e=n.__e=(i=n.__c.__z)[0],n.__c.__z=null)),(d=El.__b)&&d(t);e:if("function"==typeof _)try{if(y=t.props,b="prototype"in _&&_.prototype.render,w=(d=_.contextType)&&r[d.__c],x=d?w?w.props.value:d.__:r,n.__c?2&(h=t.__c=n.__c).__g&&(h.__g|=1,v=!0):(b?t.__c=h=new _(y,x):(t.__c=h=new Zl(y,x),h.constructor=_,h.render=dc),w&&w.sub(h),h.props=y,h.state||(h.state={}),h.context=x,h.__n=r,p=!0,h.__g|=8,h.__h=[],h._sb=[]),b&&null==h.__s&&(h.__s=h.state),b&&null!=_.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=Vl({},h.__s)),Vl(h.__s,_.getDerivedStateFromProps(y,h.__s))),g=h.props,f=h.state,h.__v=t,p)b&&null==_.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),b&&null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(b&&null==_.getDerivedStateFromProps&&y!==g&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(y,x),!(4&h.__g)&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(y,h.__s,x)||t.__v==n.__v){for(t.__v!=n.__v&&(h.props=y,h.state=h.__s,h.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),C=0;C<h._sb.length;C++)h.__h.push(h._sb[C]);h._sb=[],h.__h.length&&s.push(h);break e}null!=h.componentWillUpdate&&h.componentWillUpdate(y,h.__s,x),b&&null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(g,f,m)})}if(h.context=x,h.props=y,h.__P=e,h.__g&=-5,S=El.__r,I=0,b){for(h.state=h.__s,h.__g&=-9,S&&S(t),d=h.render(h.props,h.state,h.context),k=0;k<h._sb.length;k++)h.__h.push(h._sb[k]);h._sb=[]}else do{h.__g&=-9,S&&S(t),d=h.render(h.props,h.state,h.context),h.state=h.__s}while(8&h.__g&&++I<25);h.state=h.__s,null!=h.getChildContext&&(r=Vl({},r,h.getChildContext())),b&&!p&&null!=h.getSnapshotBeforeUpdate&&(m=h.getSnapshotBeforeUpdate(g,f)),P=d,null!=d&&d.type===Gl&&null==d.key&&(P=lc(d.props.children)),a=Jl(e,Hl(P)?P:[P],t,n,r,o,i,s,a,l,c,u),t.__u&=-161,h.__h.length&&s.push(h),v&&(h.__g&=-4)}catch(N){if(t.__v=null,l||null!=i)if(N.then){for(D=0,M=!1,t.__u|=l?160:128,t.__c.__z=[],E=0;E<i.length;E++)null==(T=i[E])||M||(8==T.nodeType&&"$s"==T.data?(D>0&&t.__c.__z.push(T),D++,i[E]=null):8==T.nodeType&&"/$s"==T.data?(--D>0&&t.__c.__z.push(T),M=0===D,a=i[E],i[E]=null):D>0&&(t.__c.__z.push(T),i[E]=null));if(!M){for(;a&&8==a.nodeType&&a.nextSibling;)a=a.nextSibling;i[i.indexOf(a)]=null,t.__c.__z=[a]}t.__e=a}else{for(A=i.length;A--;)Bl(i[A]);sc(t)}else t.__e=n.__e,t.__k=n.__k,N.then||sc(t);El.__e(N,t,n)}else a=t.__e=function(e,t,n,r,o,i,s,a,l,c){var u,d,h,p,g,f,m,v,y=n.props,b=t.props,w=t.type;if("svg"==w?o="http://www.w3.org/2000/svg":"math"==w?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),null!=i)for(u=0;u<i.length;u++)if((g=i[u])&&"setAttribute"in g==!!w&&(w?g.localName==w:3==g.nodeType)){e=g,i[u]=null;break}if(null==e){if(null==w)return c.createTextNode(b);e=c.createElementNS(o,w,b.is&&b),a&&(El.__m&&El.__m(t,i),a=!1),i=null}if(null==w)y===b||a&&e.data==b||(e.data=b);else{if(i=i&&ql.call(e.childNodes),y=n.props||Fl,!a&&null!=i)for(y={},u=0;u<e.attributes.length;u++)y[(g=e.attributes[u]).name]=g.value;for(u in y)if(g=y[u],"children"==u);else if("dangerouslySetInnerHTML"==u)h=g;else if(!(u in b)){if("value"==u&&"defaultValue"in b||"checked"==u&&"defaultChecked"in b)continue;rc(e,u,null,g,o)}for(u in v=1&n.__u,b)g=b[u],"children"==u?p=g:"dangerouslySetInnerHTML"==u?d=g:"value"==u?f=g:"checked"==u?m=g:a&&"function"!=typeof g||y[u]===g&&!v||rc(e,u,g,y[u],o);if(d)a||h&&(d.__html==h.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(h&&(e.innerHTML=""),Jl("template"==w?e.content:e,Hl(p)?p:[p],t,n,r,"foreignObject"==w?"http://www.w3.org/1999/xhtml":o,i,s,i?i[0]:n.__k&&Kl(n,0),a,l,c),null!=i)for(u=i.length;u--;)Bl(i[u]);a||(u="value","progress"==w&&null==f?e.removeAttribute("value"):null==f||f===e[u]&&("progress"!==w||f)||rc(e,u,f,y[u],o),u="checked",null!=m&&m!=e[u]&&rc(e,u,m,y[u],o))}return e}(n.__e,t,n,r,o,i,s,l,c,u);return(d=El.diffed)&&d(t),128&t.__u?void 0:a}
2function sc(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(sc)}function ac(e,t,n){for(var r=0;r<n.length;r++)cc(n[r],n[++r],n[++r]);El.__c&&El.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(n){El.__e(n,t.__v)}})}function lc(e){return"object"!=typeof e||null==e||e.__b&&e.__b>0?e:Hl(e)?e.map(lc):Vl({},e)}function cc(e,t,n){try{if("function"==typeof e){var r="function"==typeof e.__u;r&&e.__u(),r&&null==t||(e.__u=e(t))}else e.current=t}catch(o){El.__e(o,n)}}function uc(e,t,n){var r,o;if(El.unmount&&El.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||cc(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(i){El.__e(i,t)}r.__P=null}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&uc(r[o],t,n||"function"!=typeof e.type);n||Bl(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function dc(e,t,n){return this.constructor(e,n)}function hc(e,t){var n,r,o,i;t==document&&(t=document.documentElement),El.__&&El.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=Ul(Gl,null,[e]),o=[],i=[],ic(t,e,r||Fl,Fl,t.namespaceURI,r?null:t.firstChild?ql.call(t.childNodes):null,o,r?r.__e:t.firstChild,n,i,t.ownerDocument),ac(o,e,i)}El={__e:function(e,t,n,r){for(var o,i,s;t=t.__;)if((o=t.__c)&&!(1&o.__g)){o.__g|=4;try{if((i=o.constructor)&&null!=i.getDerivedStateFromError&&(o.setState(i.getDerivedStateFromError(e)),s=8&o.__g),null!=o.componentDidCatch&&(o.componentDidCatch(e,r||{}),s=8&o.__g),s)return void(o.__g|=2)}catch(a){e=a}}throw Nl=0,e}},Tl=0,Zl.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=Vl({},this.state),"function"==typeof e&&(e=e(Vl({},n),this.props)),e&&Vl(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),Xl(this))},Zl.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),Xl(this))},Zl.prototype.render=Gl,Al=[],Nl=0,Rl=function(e,t){return e.__v.__b-t.__v.__b},jl=/(PointerCapture)$|Capture$/i,zl=0,Ll=oc(!1),$l=oc(!0);var pc=0;function gc(e,t,n,r,o,i){t||(t={});var s,a,l=t;if("ref"in l&&"function"!=typeof e)for(a in l={},t)"ref"==a?s=t[a]:l[a]=t[a];var c={type:e,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--pc,__i:-1,__u:0,__source:o,__self:i};return El.vnode&&El.vnode(c),c}const fc={};function mc({name:e,remappedFrom:t,token:n,width:r,height:o,viewBox:i,label:s,alignCapitals:a=!1}){const l=`#${e.replace(/^#/,"")}`,{width:c,height:u,viewBox:d}=fc[e]??{width:16,height:16};return gc("svg",{"data-icon-name":t??e,"data-icon-token":n,"data-align-capitals":a,...null!=s?{"aria-label":s,role:"img"}:{"aria-hidden":!0},viewBox:i??d??`0 0 ${c} ${u}`,width:r??c,height:o??u,children:gc("use",{href:l})})}const vc=e=>{if(e.length<2)return[e,""];const t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},yc=e=>{if(e.length<4)return[e,""];const t=e.lastIndexOf(".")+1,n=e.length-t>10,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},bc=e=>{if(e.length<4)return[e,""];const t=e.lastIndexOf("/")+1,n=e.length-t>25,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},wc=(e,{splitIndex:t}={})=>{if("number"!=typeof t){const t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}return[e.slice(0,t),e.slice(t)]},xc=(e,{splitOffset:t}={})=>
2{if("number"!=typeof t||t<=0||t>=e.length){const t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}const n=e.length-t;return[e.slice(0,n),e.slice(n)]},Cc=(e,{splitOffset:t}={})=>{if("number"!=typeof t||t<=0||t>=e.length){const t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}const n=t;return[e.slice(0,n),e.slice(n)]};function Sc({children:e,marker:t,variant:n="default"}){const r="fade"===n;return gc("div",{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:gc("div",{"data-truncate-marker":!0,children:"function"==typeof t?t({children:e}):r?gc("span",{"data-truncate-fade":!0}):t})})}function Ic(e){const{mode:t,children:n}=e;return gc("div",{children:[gc("div",{"data-truncate-content":"visible",children:"fruncate"===t?gc("span",{children:n}):n}),gc("div",{"data-truncate-content":"overflow","aria-hidden":!0,children:"fruncate"===t?gc("span",{children:n}):n})]})}function kc({children:e,mode:t="truncate",marker:n="â¦",variant:r="default",...o}){const i=gc(Ic,{mode:t,children:e},"content"),s=gc(Sc,{marker:n,mode:t,variant:r},"marker");return gc("div",{"data-truncate-container":t,"data-truncate-variant":r,...o,children:gc("div",{"data-truncate-grid":!0,children:"truncate"===t?[i,s]:[s,i,gc("div",{"data-truncate-fill":!0},"fill")]})})}function Pc({children:e,...t}){return gc(kc,{mode:"truncate",...t,children:e})}function Dc({children:e,...t}){return gc(kc,{mode:"fruncate",...t,children:e})}function Mc({children:e,contents:t,priority:n="end",split:r="center",minimumLength:o=12,className:i,style:s,...a}){let l=null,c=null;if(Array.isArray(t)){if(2!==t.length)return null;l=gc(Pc,{...a,children:t[0]}),c=gc(Dc,{...a,children:t[1]})}else{if("string"!=typeof e)return null;if(0===e.length)return gc("div",{className:i,style:s});if(e.length<o)return gc("end"===n?Dc:Pc,{...a,className:i,style:s,children:e});let t=null,u=null,d=null;if("string"==typeof r)"center"===r?t=vc:"extension"===r?t=yc:"leaf-path"===r&&(t=bc);else if("number"==typeof r)t=wc,u=r;else if(Array.isArray(r)){const[e,n]=r;d=n,"last"===e?t=xc:"first"===e&&(t=Cc)}else"function"==typeof r&&(t=r);t??(t=vc);const[h,p]=t(e,{priority:n,variant:a.variant,splitIndex:"number"==typeof u?u:void 0,splitOffset:"number"==typeof d?d:void 0}),g=h.length>=p.length,f="equal"===n&&g,m={},v={};"equal"===n&&!g&&(m.marker=""),f&&(v.marker=""),l=gc(Pc,{...a,...m,children:h}),c=gc(Dc,{...a,...v,children:p})}return gc("div",{"data-truncate-group-container":"middle",className:i,style:s,children:[gc("div",{"data-truncate-segment-priority":"start"===n||"equal"===n?"1":"2",children:l}),gc("div",{"data-truncate-segment-priority":"end"===n||"equal"===n?"1":"2",children:c})]})}const Ec={endIndex:-1,startIndex:-1};function Tc(e,t){return e<0||t<e?Ec:{endIndex:t,startIndex:e}}function Ac(e){return e.startIndex<0||e.endIndex<e.startIndex}function _c(e,t,n){if(t<=0)return-1;return e<=0?0:e>=t*n?t:Math.floor(e/n)}function Nc(e,t){let n=0,r=e.length-1,o=-1;for(;n<=r;){const i=Math.floor((n+r)/2),s=e[i];if(null==s)break;s<=t?(o=i,n=i+1):r=i-1}return o}function Rc(e,t,n){var r;if(0===e.length||t<=0)return[];const o=function(e){const t=new Map,n=[];for(let o=0;o<e.length;o+=1){const r=e[o];if(null==r)continue;const i="directory"===r.kind&&r.isExpanded?[...r.ancestorPaths,r.path]:r.ancestorPaths;let s=0;for(;s<n.length&&s<i.length&&n[s]===i[s];)s+=1;for(let e=n.length-1;e>=s;e-=1){const r=n[e];null!=r&&t.set(r,o-1)}n.length=s;for(let e=s;e<i.length;e+=1){const t=i[e];null!=t&&n.push(t)}}const r=e.length-1;for(const o of n)t.set(o,r);return t}(e),i=function(e){const t=new Map;return e.forEach((e,n)=>{if("directory"!==e.kind||!e.isExpanded)return;const r=e.ancestorPaths.length,o=t.get(r);null!=o?o.push(n):t.set(r,[n])}),t}(e),s=[];for(let a=0;a<e.length;a+=1){const o=i.get(a);if(null==o||0===o.length)break;const l=t+a*n;let c=Nc(o,Math.min(e.length-1,Math.floor(l/n))),u=null;for(;c>=0;){const t=o[c],n=null==t?null:e[t]??null;if(null!=n&&(0===a||n.ancestorPaths[a-1]===(null==(r=s[a-1])?void 0:r.path))){u=n;break}c-=1}if(null==u)break;s.push(u)}return s.map((r,i)=>{const s=i*n,a=(o.get(r.path)??e.length-1)+1;if(a>=e.length)return{row:r,top:s};const l=a*n-t;return{row:r,top:Math.min(s,l-n)}}).filter(e=>e.top+n>0)}function jc(e,t){const n=t.totalRowCount??e.length,r=n*t.itemHeight,o=Math.max(0,t.viewportHe
2ight),i=Math.max(0,Math.floor(t.overscan)),s=Math.max(0,r-o),a=(l=t.scrollTop,c=0,u=s,Math.min(Math.max(l,c),u));var l,c,u;const d=t.stickyRows??Rc(e,a,t.itemHeight),h=d.reduce((e,n)=>Math.max(e,n.top+t.itemHeight),0),p=Math.min(r,a+h),g=Math.max(0,o-h),f=Math.max(0,r-p),m=_c(a,n,t.itemHeight),v=_c(p,n,t.itemHeight),y=h<=0||m<0||m>=n?-1:m,b=-1===y?-1:Math.min(n-1,v-1),w=-1===y||b<y?0:b-y+1,x=g<=0||v>=n?Ec:Tc(v,(C=p+g,S=n,I=t.itemHeight,S<=0||C<=0?-1:C>=S*I?S-1:Math.ceil(C/I)-1));var C,S,I;const k=b+1,P=Ac(x)?Ec:Tc(Math.max(k,x.startIndex-i),Math.min(n-1,x.endIndex+i)),D=function(e,t){return Ac(e)?0:(e.endIndex-e.startIndex+1)*t}(P,t.itemHeight);return{occlusion:{firstOccludedIndex:y,lastOccludedIndex:b,occludedCount:w},physical:{itemHeight:t.itemHeight,maxScrollTop:s,overscan:i,scrollTop:a,totalHeight:r,totalRowCount:n,viewportHeight:o},projected:{contentHeight:f,paneHeight:g,paneTop:p},sticky:{height:h,rows:d},visible:x,window:{endIndex:P.endIndex,height:D,offsetTop:Ac(P)?0:P.startIndex*t.itemHeight,startIndex:P.startIndex}}}const zc={added:"A",deleted:"D",ignored:null,modified:"M",renamed:"R",untracked:"U"},Lc={added:"Git status: added",deleted:"Git status: deleted",ignored:"Git status: ignored",modified:"Git status: modified",renamed:"Git status: renamed",untracked:"Git status: untracked"};function $c(e){const{currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:o=0,viewportHeight:i}=e;if(n<0)return null;const s=Math.max(0,o),a=n*r,l=a+r;if(a<t+s){const e=Math.max(0,a-s);return e===t?null:e}if(l>t+i){const e=l-i;return e===t?null:e}return null}function Fc(e){if(null==e||!e.isConnected)return!1;if(e===document.body||e===document.documentElement)return!1;e.focus({preventScroll:!0});const t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement===e:document.activeElement===e}function Oc(e){const t=e.getRootNode();if(t instanceof ShadowRoot){const e=t.activeElement;return e instanceof HTMLElement?e:null}const n=document.activeElement;return n instanceof HTMLElement&&e.contains(n)?n:null}function Hc(e,t){if(null==e)return t;const n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function qc(e,t){return null!=e&&e>0?e:t}function Vc(e,t,n,r,o=0){const i=$c({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:o,viewportHeight:r});return null!=i&&(e.scrollTop=i,!0)}function Bc(e,t,n,r,o,i,s=0){const a=function(e){const{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:o,topInset:i=0,totalHeight:s,viewportHeight:a}=e;if("nearest"===o)return $c({currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:i,viewportHeight:a});if(n<0)return null;const l=Math.max(0,i),c=n*r,u=Math.max(0,a-l),d="center"===o?l+Math.max(0,(u-r)/2):l,h=Math.max(0,s-a),p=Math.max(0,Math.min(c-d,h));return p===t?null:p}({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:i,topInset:s,totalHeight:o,viewportHeight:r});return null!=a&&(e.scrollTop=a,!0)}function Uc(e,t,n,r,o,i){const s=function(e){const{currentScrollTop:t,focusedIndex:n,itemHeight:r,targetViewportOffset:o,totalHeight:i,viewportHeight:s}=e;if(n<0)return null;const a=Math.max(0,o),l=n*r;if(l>=t+a&&l+r<=t+s)return null;const c=Math.max(0,i-s),u=Math.max(0,Math.min(l-a,c));return u===t?null:u}({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:i,totalHeight:o,viewportHeight:r});return null!=s&&(e.scrollTop=s,!0)}function Wc(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function Gc({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:o,onInput:i}){return gc("input",{ref:n,"data-item-rename-input":!0,...t?{"data-item-flattened-rename-input":!0}:{},"aria-label":e,value:r,onBlur:o,onInput:i,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation()})}function Zc(e){const{row:t,mode:n,targetPath:r,ariaLabel:o,domId:i,isParked:s,itemHeight:a,features:l,state:c,extraStyle:u}=e,d="sticky"===n,h=t.ancestorPaths.at(-1)??"",p={};return c.isFocusRinged&&(p["data-item-focused"]=!0),t.isSelected&&(p["data-item-selected"]=!0),c.isContextHovered&&(p["data-item-context-hover"]="true"),c.isDragTarget&&(p["data-item-drag-target"]=!0),c.isDragging&&(p["data-item-dragging"]=!0),null!=c.effectiveGitStatus&&(p["data-item-git-status"]=c.effectiveGitStatus),c.containsGitChange&&(p["data-item-contains-git-change"]="true"),{"aria-expanded":d||"directory"!==t.kind?void 0:t.isExpanded,"aria-haspopup":l.contextMenuEnabled?"menu":void 0,"aria-label":o,"aria-level":d?void 0:t.level
2+1,"aria-posinset":d?void 0:t.posInSet+1,"aria-selected":d?void 0:t.isSelected?"true":"false","aria-setsize":d?void 0:t.setSize,"data-file-tree-sticky-path":d?r:void 0,"data-file-tree-sticky-row":d?"true":void 0,"data-item-context-menu-button-visibility":l.actionLaneEnabled?l.contextMenuButtonVisibility:void 0,"data-item-context-menu-trigger-mode":l.contextMenuEnabled?l.contextMenuTriggerMode:void 0,"data-item-has-context-menu-action-lane":l.actionLaneEnabled?"true":void 0,"data-item-has-git-lane":l.gitLaneActive?"true":void 0,"data-item-parent-path":h.length>0?h:void 0,"data-item-parked":s?"true":void 0,"data-item-path":r,"data-item-type":"directory"===t.kind?"folder":"file","data-type":"item",id:d?void 0:i,role:d?void 0:"treeitem",style:{minHeight:`${a}px`,...u},tabIndex:!d&&t.isFocused?0:-1,...p}}var Kc,Yc,Xc,Qc,Jc=Object.is,eu=0,tu=[],nu=El,ru=nu.__b,ou=nu.__r,iu=nu.diffed,su=nu.__c,au=nu.unmount,lu=nu.__;function cu(e,t){nu.__h&&nu.__h(Yc,e,eu||t),eu=0;var n=Yc.__H||(Yc.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function uu(e){return eu=1,function(e,t){var n=cu(Kc++,2);if(n.t=e,!n.__c&&(n.__=[Cu(void 0,t),function(e){var t=n.__N?n.__N[0]:n.__[0],r=n.t(t,e);Jc(t,r)||(n.__N=[r,n.__[1]],n.__c.setState({}))}],n.__c=Yc,!Yc.__f)){var r=function(e,t,r){if(!n.__c.__H)return!0;var i=n.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!o||o.call(this,e,t,r);var s=n.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,Jc(t,e.__[0])||(s=!0)}}),o&&o.call(this,e,t,r)||s};Yc.__f=!0;var o=Yc.shouldComponentUpdate,i=Yc.componentWillUpdate;Yc.componentWillUpdate=function(e,t,n){if(4&this.__g){var s=o;o=void 0,r(e,t,n),o=s}i&&i.call(this,e,t,n)},Yc.shouldComponentUpdate=r}return n.__N||n.__}(Cu,e)}function du(e,t){var n=cu(Kc++,3);!nu.__s&&xu(n.__H,t)&&(n.__=e,n.u=t,Yc.__H.__h.push(n))}function hu(e,t){var n=cu(Kc++,4);!nu.__s&&xu(n.__H,t)&&(n.__=e,n.u=t,Yc.__h.push(n))}function pu(e){return eu=5,gu(function(){return{current:e}},[])}function gu(e,t){var n=cu(Kc++,7);return xu(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function fu(e,t){return eu=8,gu(function(){return e},t)}function mu(){for(var e;e=tu.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(bu),e.__H.__h.forEach(wu),e.__H.__h=[]}catch(t){e.__H.__h=[],nu.__e(t,e.__v)}}nu.__b=function(e){Yc=null,ru&&ru(e)},nu.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),lu&&lu(e,t)},nu.__r=function(e){ou&&ou(e),Kc=0;var t=(Yc=e.__c).__H;t&&(Xc===Yc?(t.__h=[],Yc.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(bu),t.__h.forEach(wu),t.__h=[],Kc=0)),Xc=Yc},nu.diffed=function(e){iu&&iu(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==tu.push(t)&&Qc===nu.requestAnimationFrame||((Qc=nu.requestAnimationFrame)||yu)(mu)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),Xc=Yc=null},nu.__c=function(e,t){t.some(function(e){try{e.__h.forEach(bu),e.__h=e.__h.filter(function(e){return!e.__||wu(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],nu.__e(n,e.__v)}}),su&&su(e,t)},nu.unmount=function(e){au&&au(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{bu(e)}catch(n){t=n}}),n.__H=void 0,t&&nu.__e(t,n.__v))};var vu="function"==typeof requestAnimationFrame;function yu(e){var t,n=function(){clearTimeout(r),vu&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);vu&&(t=requestAnimationFrame(n))}function bu(e){var t=Yc,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),Yc=t}function wu(e){var t=Yc;e.__c=e.__(),Yc=t}function xu(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!Jc(t,e[n])})}function Cu(e,t){return"function"==typeof t?t(e):t}function Su(e,t=null,n=null){const r=e.flattenedSegments;return null==r||0===r.length?t??e.name:gc("span",{"data-item-flattened-subitems":!0,children:r.map((e,o)=>{const i=o===r.length-1;return gc(Gl,{children:[gc("span",{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?"true":void 0,children:i&&null!=t?t:gc(Pc,{children:e.name})}),o<r.length-1?" / ":""]},e.path)})})}function Iu(e){var t,n;return e.isFlattened?(null==(n=null==(t=e.flattenedSegments)?void 0:t.findLast(e=>e.isTerminal))?void 0:n.path)??e.path:e.path}function ku(e){const t=e.flattenedSegments;return null==t||0===t.length?e.name:t.map(e=>e.name).join(" / ")}function Pu(e,t,n,r){return e.map((e,o)=>{const i=o*n,s=e.subtreeEndIndex+1;if(s>=r)return{row:e.row,top:i};const a=s*n-t;return{row:e.row,top:Math.min(i,a-n)}}).filter(e=>e.top+n>0)}function Du({controller:e,itemHeight:t,overscan:n,scrollTop:r,stickyFolders:o,viewportHe
2ight:i}){const s=e.getVisibleCount(),a=o&&s>0?e.getStickyRowCandidates(r,t):[],l=null==a&&o&&s>0?e.getVisibleRows(0,s-1):[],c=jc(l,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:null==a?void 0:Pu(a,r,t,s),totalRowCount:s,viewportHeight:i}),u=o&&r<=0&&s>0?e.getStickyRowCandidates(1,t):[],d=null!=u&&r<=0?Pu(u,1,t,s):o&&r<=0&&l.length>0?Rc(l,1,t):c.sticky.rows;return{overlayHeight:d.reduce((e,n)=>Math.max(e,n.top+t),0),overlayRows:d,snapshot:c,visibleRows:l}}const Mu=40;function Eu(e,t,n){var r,o;const i=e,s=(null==(r=document.elementFromPoint)?void 0:r.bind(document))??null,a=(null==(o=i.elementFromPoint)?void 0:o.call(i,t,n))??(null==s?void 0:s(t,n))??null;return e instanceof ShadowRoot&&(null==a||!e.contains(a))?function(e,t,n){const r=Array.from(e.querySelectorAll('[data-type="item"], [data-item-flattened-subitem]'));for(let o=r.length-1;o>=0;o--){const e=r[o],i=e.getBoundingClientRect();if(t>=i.left&&t<=i.right&&n>=i.top&&n<=i.bottom)return e}return null}(e,t,n):a instanceof HTMLElement?a:null}function Tu(e){var t,n;const r=null==(t=null==e?void 0:e.closest)?void 0:t.call(e,'[data-type="item"]');if(!(r instanceof HTMLElement))return null;const o=r.dataset.itemPath??null;if(null==o)return null;const i=null==(n=null==e?void 0:e.closest)?void 0:n.call(e,"[data-item-flattened-subitem]"),s=i instanceof HTMLElement?i.getAttribute("data-item-flattened-subitem")??null:null;if(null!=s&&s.endsWith("/"))return{directoryPath:s,flattenedSegmentPath:s,hoveredPath:o,kind:"directory"};if("folder"===r.dataset.itemType)return{directoryPath:o,flattenedSegmentPath:null,hoveredPath:o,kind:"directory"};const a=r.dataset.itemParentPath??null;return null==a||0===a.length?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:o,kind:"root"}:{directoryPath:a,flattenedSegmentPath:null,hoveredPath:o,kind:"directory"}}function Au(e){const t=e.cloneNode(!0);return t.removeAttribute("id"),t.dataset.fileTreeDragPreview="true",t.setAttribute("aria-hidden","true"),t.tabIndex=-1,Object.assign(t.style,{boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",left:"0px",margin:"0",pointerEvents:"none",position:"fixed",top:"0px",willChange:"transform",zIndex:"10000"}),t}function _u(e){return null!=e&&"toggle"in e}function Nu(e){return"Space"===e.code||" "===e.key||"Spacebar"===e.key}function Ru(e){return e.shiftKey&&"F10"===e.key||"ContextMenu"===e.key}const ju=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Home","PageDown","PageUp"]);function zu(e){for(const t of e.composedPath())if(t instanceof HTMLElement){if("true"===t.dataset.fileTreeContextMenuRoot)return!0;if("context-menu-anchor"===t.dataset.type||t.dataset.type===Mi)return!0;if(t.getAttribute("slot")===Di)return!0}return!1}function Lu(e,t,n){null!=n?e.set(t,n):e.delete(t)}function $u(e,t,n){if(null==e)return null;const r=t.get(e)??null;if(null!=r)return r;const o=n.get(e)??null;return"true"===(null==o?void 0:o.dataset.itemParked)?null:o}function Fu(e,t,n,r,o,i,s){const a=Math.max(0,i-o),l=(null==t?void 0:t.getBoundingClientRect())??null,c=null==l||null==n?null:n.getBoundingClientRect().top-l.top,u=function(e,t){if(null==e||null==t)return null;for(const n of e.querySelectorAll('button[data-item-focused="true"][data-item-parked="true"]'))if(n instanceof HTMLElement&&n.dataset.itemPath===t)return n;return null}(e,r),d=null==l||null==u?null:u.getBoundingClientRect().top-l.top;return Math.max(0,Math.min(d??Math.max(c??0,a),Math.max(0,s-o)))}function Ou(e,t){return{kind:e.kind,name:ku(e),path:t}}function Hu(e,t,n){if(null!=e)return`${e}__focused-item-${encodeURIComponent(t)}${n?"__parked":""}`}function qu(e){return"file-tree-icon-chevron"===e||"file-tree-icon-dot"===e||"file-tree-icon-file"===e||"file-tree-icon-lock"===e}function Vu(e,t){if(null==e)return null;if("text"in e)return gc("span",{title:e.title,children:e.text});const n="string"==typeof e.icon?qu(e.icon)?t(e.icon):{name:e.icon}:qu(e.icon.name)?(()=>{const n=t(e.icon.name),{name:r,...o}=e.icon;return{...n,...o}})():e.icon;return gc("span",{title:e.title,children:gc(mc,{...n})})}function Bu(e){null!=e&&Fc(e.querySelector(["button:not([disabled])","[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not
2([tabindex="-1"])'].join(", "))??e)}function Uu(e,t,n,r={}){const{controller:o,renameView:i,visualFocusPath:s,contextHoverPath:a,draggedPathSet:l,dragTarget:c,dragAndDropEnabled:u,shouldSuppressContextMenu:d,handleRowDragStart:h,handleRowDragEnd:p,handleRowTouchStart:g,instanceId:f,itemHeight:m,gitStatusByPath:v,ignoredGitDirectories:y,ignoredInheritanceCache:b,directoriesWithGitChanges:w,gitLaneActive:x,contextMenuEnabled:C,contextMenuTriggerMode:S,contextMenuButtonTriggerEnabled:I,contextMenuButtonVisibility:k,contextMenuRightClickEnabled:P,registerRenameInput:D,registerButton:M,resolveIcon:E,renderDecorationForRow:T,openContextMenuForRow:A,onRowClick:_,onKeyDown:N}=e,R=Iu(t),{isParked:j=!1,mode:z="flow",style:L}=r,$="sticky"===z,F=(null==v?void 0:v.get(R))??null??function(e,t,n){if(null==t||0===t.size)return null;const r=[];for(let o=e.length-1;o>=0;o-=1){const i=e[o],s=n.get(i);if(null!=s){for(const e of r)n.set(e,s);return s?"ignored":null}if(t.has(i)){n.set(i,!0);for(const e of r)n.set(e,!0);return"ignored"}r.push(i)}for(const o of r)n.set(o,!1);return null}(t.ancestorPaths,y,b),O="directory"===t.kind&&((null==w?void 0:w.has(R))??!1),H=T(t,R),q=function(e,t){if(null!=e){const t=zc[e];return null==t?null:{text:t,title:Lc[e]}}return t?{icon:{name:"file-tree-icon-dot",width:6,height:6},title:"Contains git status items"}:null}(F,O),V=C&&I,B=null!=H||x||V,U=V&&"always"===k,W=i.getPath()===R,G=W?i.getValue():"",Z=$||!W?null:gc(Gc,{ref:D,ariaLabel:`Rename ${ku(t)}`,isFlattened:t.isFlattened,value:G,onBlur:()=>{i.commit()},onInput:e=>{i.setValue(e.currentTarget.value)}}),K=function(e,t,{actionLaneEnabled:n=!1,customDecoration:r=null,decorationLaneEnabled:o=!1,dragTargetFlattenedSegmentPath:i=null,gitDecoration:s=null,gitLaneActive:a=!1,renameInput:l=null,showDecorativeActionAffordance:c=!1}={}){const u=Iu(e);return gc(Gl,{children:[e.depth>0?gc("div",{"data-item-section":"spacing",children:Array.from({length:e.depth}).map((t,n)=>gc("div",{"data-item-section":"spacing-item","data-ancestor-path":e.ancestorPaths[n]},n))}):null,gc("div",{"data-item-section":"icon",children:"directory"===e.kind?gc(mc,{...t("file-tree-icon-chevron")}):gc(mc,{...t("file-tree-icon-file",u)})}),gc("div",{"data-item-section":"content",children:e.isFlattened?Su(e,l,i):l??gc(Mc,{minimumLength:5,split:"extension",children:e.name})}),o?gc("div",{"data-item-section":"decoration",children:null!=r?Vu(r,t):null}):null,a?gc("div",{"data-item-section":"git",children:Vu(s,t)}):null,n?gc("div",{"data-item-section":"action",children:c?gc("span",{"aria-hidden":"true","data-item-action-affordance":"decorative",children:gc(mc,{...t("file-tree-icon-ellipsis")})}):null}):null]})}(t,E,{actionLaneEnabled:V,customDecoration:H,decorationLaneEnabled:B,dragTargetFlattenedSegmentPath:(null==c?void 0:c.flattenedSegmentPath)??null,gitDecoration:q,gitLaneActive:x,renameInput:Z,showDecorativeActionAffordance:U}),Y={...Zc({ariaLabel:ku(t),domId:t.isFocused?Hu(f,R,j):void 0,extraStyle:L,features:{actionLaneEnabled:V,contextMenuButtonVisibility:V?k:null,contextMenuEnabled:C,contextMenuTriggerMode:C?S:null,gitLaneActive:x},isParked:j,itemHeight:m,mode:z,row:t,state:{containsGitChange:O,effectiveGitStatus:F,isContextHovered:a===R,isDragTarget:"directory"===(null==c?void 0:c.kind)&&c.directoryPath===R,isDragging:!0===(null==l?void 0:l.has(R)),isFocusRinged:t.isFocused&&s===R},targetPath:R}),key:n,onContextMenu:C||u?e=>{var n,r;d()?e.preventDefault():C&&(e.preventDefault(),P&&(o.focusMountedPathFromInput(R),A(t,R,{anchorRect:(n=e.clientX,r=e.clientY,{bottom:r,height:0,left:n,right:n,top:r,width:0,x:n,y:r}),source:"right-click"})))}:void 0,onFocus:$?void 0:()=>{o.focusMountedPathFromInput(R)},onKeyDown:$?void 0:N,ref:e=>{M(R,e)}};return!$&&W?gc("div",{...Y,children:K}):gc("button",{...Y,type:"button",draggable:u&&!j,onDragEnd:u&&!j?p:void 0,onDragStart:u&&!j?e=>{h(e,t,R)}:void 0,onMouseDown:e=>{($||o.isSearchOpen())&&e.preventDefault()},onTouchStart:u&&!j?e=>{g(e,t,R)}:void 0,onClick:e=>{_(e,t,R,z)},children:K})}function Wu(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(Iu(e))).map((n,r)=>Uu(e,n,t.start+r))}function Gu({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:o,icons:i,instanceId:s,itemHeight:a=Ya,overscan:l=10,renamingEnabled:c=!1,renderRowDecoration:u,searchBlurBehavior:d="close",searchEnabled:h=!1,searchFakeFocus:p=!1,slotHost:g,stickyFolders:f=!1,initialViewportHe
2ight:m=420}){var v,y,b,w,x,C,S;const I=pu(null),k=pu(null),P=pu(!1),D=pu(null),M=pu(null),E=pu(null),T=pu(null),A=pu(null),_=pu(new Map),N=pu(new Map),R=pu(()=>{}),j=pu(null),z=pu(0),L=pu(!1),$=pu(null);$.current!==t&&(L.current=!1,$.current=t);const F=pu(!1),O=pu(null),H=pu(null),q=pu(!1),V=pu(null),B=pu(null),U=pu(null),W=pu(null),G=pu(null),Z=pu(null),K=pu(null),Y=pu(null),X=pu(!1),Q=pu(null),J=pu(null),ee=pu(null),te=pu(null),ne=gu(()=>new Map,[]),[,re]=uu(0),[oe,ie]=uu(null),[se,ae]=uu(null),[le,ce]=uu(null),[ue,de]=uu(null),[he,pe]=uu(0),[ge,fe]=uu(null),me=pu(ge);me.current=ge;const ve=pu(null),ye=pu(null),be=pu(null),we=pu(null),xe=pu(null),Ce=pu(!1),Se=(e,t)=>{ye.current=e,be.current=null,we.current=null==t?null:{path:e,scrollTop:t}},Ie=pu("retain"===d&&t.isSearchOpen()),[ke,Pe]=uu(p);du(()=>{p||Pe(!1)},[p]);const De=pu(!1),Me=fu(()=>{De.current=!0,Pe(e=>!e&&e)},[]),[Ee,Te]=uu(()=>Du({controller:t,itemHeight:a,overscan:l,scrollTop:0,stickyFolders:f,viewportHeight:m})),[Ae,_e]=uu(!1);du(()=>{_e(!0)},[]);const Ne=!0===(null==(v=null==e?void 0:e.contextMenu)?void 0:v.enabled)||null!=(null==(y=null==e?void 0:e.contextMenu)?void 0:y.render)||null!=(null==(b=null==e?void 0:e.contextMenu)?void 0:b.onOpen)||null!=(null==(w=null==e?void 0:e.contextMenu)?void 0:w.onClose),Re=(null==(x=null==e?void 0:e.contextMenu)?void 0:x.triggerMode)??(Ne?"right-click":"both"),je="both"===Re||"button"===Re,ze=(null==(C=null==e?void 0:e.contextMenu)?void 0:C.buttonVisibility)??"when-needed",Le="both"===Re||"right-click"===Re;hu(()=>{const e=E.current;if(null==e)return;const t=e=>{var t;if(!(e instanceof CustomEvent))return;const n=(null==(t=e.detail)?void 0:t.path)??null;xe.current=n,ae(n),de(null==n?null:"pointer")},n=e=>{var t;e instanceof CustomEvent&&(Ce.current=!0===(null==(t=e.detail)?void 0:t.disabled))};return e.addEventListener("file-tree-debug-set-context-menu-trigger",t),e.addEventListener("file-tree-debug-set-scroll-suppression",n),()=>{e.removeEventListener("file-tree-debug-set-context-menu-trigger",t),e.removeEventListener("file-tree-debug-set-scroll-suppression",n)}},[]);const $e=fu((e,t)=>{Lu(_.current,e,t)},[]),Fe=fu((e,t)=>{Lu(N.current,e,t)},[]),Oe=fu(e=>{M.current=e},[]),He=fu(e=>$u(e,N.current,_.current),[]),qe=null!=n||null!=r||null!=o,{resolveIcon:Ve}=gu(()=>Ni(i),[i]),Be=t[Cl](),Ue=Be.getPath(),We=null!=Ue,Ge=t.isSearchOpen(),Ze=t.getSearchValue(),Ke=t.getFocusedPath(),Ye=t.getFocusedIndex(),Xe=t.getScrollRequest(),Qe=t.isDragAndDropEnabled(),Je=t.getDragSession(),et=gu(()=>null==Je?null:new Set(Je.draggedPaths),[Je]),tt=(null==Je?void 0:Je.target)??null,nt=(null==Je?void 0:Je.primaryPath)??null,rt=function(e){return null==e?void 0:`${e}__tree`}(s),{overlayHeight:ot,overlayRows:it,snapshot:st,visibleRows:at}=Ee,lt=st.physical.viewportHeight,ct=gu(()=>({end:st.window.endIndex,start:st.window.startIndex}),[st.window.endIndex,st.window.startIndex]),ut=it,dt=st.sticky.rows,ht=st.physical.totalHeight,pt=st.sticky.height,gt=gu(()=>new Set(dt.map(e=>Iu(e.row))),[dt]),ft=Ye>=0&&Ye>=ct.start&&Ye<=ct.end,mt=fu((e,t)=>(null==u?void 0:u({item:Ou(e,t),row:e}))??null,[u]),vt=fu(e=>!!Fc(null==e?null:_.current.get(e)??null)||Fc(E.current),[]),yt=fu(e=>{vt(t.focusNearestPath(e))},[t,vt]),bt=pu(yt);bt.current=yt;const wt=pu(!0),xt=pu(()=>{}),Ct=fu((t=!0)=>{var n,r;const o=me.current;null!=o&&(wt.current=wt.current&&t,fe(null),null==(r=null==(n=null==e?void 0:e.contextMenu)?void 0:n.onClose)||r.call(n),wt.current&&yt(o.path))},[null==e?void 0:e.contextMenu,yt]);xt.current=Ct;const St=fu(e=>{const t=null==e?null:function(e,t){if(null==e)return t.offsetTop;const n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}(E.current,e);ce(e=>e===t?e:t)},[]),It=fu((e,n,r)=>{const o=t.getItem(n);if(null==o)return;const i=He(n);if("true"===(null==i?void 0:i.dataset.fileTreeStickyRow)){const e=T.current;Se(n,(null==e?void 0:e.scrollTop)??null),F.current=!0,ie(e=>e===n?e:n)}o.focus(),St(i),wt.current=!0,fe({anchorRect:(null==r?void 0:r.anchorRect)??null,item:Ou(e,n),path:n,source:(null==r?void 0:r.source)??"keyboard"})},[t,He,St]),kt=fu(e=>{if(c){if(t.isSearchOpen()){const e=T.current,t=Hc(e,lt);V.current=Ye<0||null==e?null:Math.max(0,Math.min(Ye*a-e.scrollTop,Math.max(0,t-a))),q.current=!0}!1!==t.startRenaming(e)&&(de("focus"),re(e=>e+1))}},[t,Ye,a,c,lt]),Pt=fu((e,{restoreTreeFocus:n=!0,targetOffset:r="live-overlay"}={})=>{const o=T.current;if(null==o)return!1;t.focusPath(e);const i=t.getFocusedIndex();if(i<0)return!1;const s=t.getVisibleRows(i,i)[0]??null;if(null==s)return!1;const c=Hc(o,lt),u=t.getVisibleCount()*a,d="sticky-parents"===r?s.ancestorPaths.length*a:Du({controller:t,itemHeight:a,overscan:l,scrollTop:o.scrollTop,stickyFolders:f,viewportHe
2ight:c}).snapshot.sticky.height;return F.current=!0,Uc(o,i,a,c,u,d),R.current(),ve.current=n?e:null,!0},[t,a,l,lt,f]),Dt=e=>"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Mt=()=>{null!=W.current&&(clearTimeout(W.current),W.current=null),U.current=null},Et=()=>{var e;null==(e=Z.current)||e.remove(),Z.current=null},Tt=()=>{var e;null!=(e=B.current)&&("function"!=typeof window.cancelAnimationFrame?window.clearTimeout(e):window.cancelAnimationFrame(e)),B.current=null,G.current=null},At=e=>{var t;const n=null==(t=E.current)?void 0:t.getRootNode();n instanceof ShadowRoot?n.append(e):document.body.append(e)},_t=()=>{var e;null==(e=Y.current)||e.call(Y),Y.current=null,null!=te.current&&(clearTimeout(te.current),te.current=null),X.current=!1,Q.current=null,ee.current=null,null!=J.current&&(J.current.setAttribute("draggable","true"),J.current.style.removeProperty("touch-action"),J.current=null),Et(),Mt(),Tt(),K.current=null},Nt=(e,n)=>{var r,o;const i=null==(r=E.current)?void 0:r.getRootNode(),s=Tu(Eu(i instanceof ShadowRoot?i:document,e,n));return t.setDragTarget(s),(null==(o=t.getDragSession())?void 0:o.target)??null},Rt=e=>{var n;const r=(null==(n=t.getDragAndDropConfig())?void 0:n.openOnDropDelay)??800;if(null==e||"directory"!==e.kind||null==e.directoryPath||r<=0)return void Mt();const o=t.getItem(e.directoryPath),i=_u(o)?o:null;if(null==i||i.isExpanded())return void Mt();const s=`${e.directoryPath}::${e.flattenedSegmentPath??""}`;U.current!==s&&(Mt(),U.current=s,W.current=setTimeout(()=>{var n;const r=null==(n=t.getDragSession())?void 0:n.target;"directory"===(null==r?void 0:r.kind)&&r.directoryPath===e.directoryPath&&r.flattenedSegmentPath===e.flattenedSegmentPath&&i.expand()},r))},jt=()=>{B.current=null;const e=G.current,n=T.current;if(null==e||null==n||null==t.getDragSession())return;const r=n.getBoundingClientRect(),o=function(e,t){const n=e-t.top;if(n<Mu){const e=Math.max(0,n);
2return-Math.ceil((Mu-e)/Mu*18)}const r=t.bottom-e;if(r<Mu){const e=Math.max(0,r);return Math.ceil((Mu-e)/Mu*18)}return 0}(e.clientY,r);if(0===o)return;const i=Math.max(0,n.scrollHeight-n.clientHeight),s=Math.max(0,Math.min(i,n.scrollTop+o));s!==n.scrollTop&&(n.scrollTop=s,R.current()),Rt(Nt(e.clientX,e.clientY)),B.current=Dt(jt)},zt=(e,t)=>{G.current={clientX:e,clientY:t},B.current??(B.current=Dt(jt))},Lt=e=>{if(null!=ge)return"Escape"===e.key?(Ct(),e.preventDefault(),void e.stopPropagation()):void(ju.has(e.key)&&(e.preventDefault(),e.stopPropagation()));if(Be.isActive()){if("Escape"===e.key)Be.cancel();else{if("Enter"!==e.key)return;Be.commit()}return de("focus"),re(e=>e+1),e.preventDefault(),void e.stopPropagation()}if(c&&"F2"===e.key)return kt(Ke??void 0),e.preventDefault(),void e.stopPropagation();if(Ge){if("Escape"===e.key)q.current=!1,V.current=null,t.closeSearch();else if("Enter"===e.key){const e=t.getFocusedPath();null!=e&&t.selectOnlyPath(e);const n=T.current,r=Hc(n,lt);V.current=Ye<0||null==n?null:Math.max(0,Math.min(Ye*a-n.scrollTop,Math.max(0,r-a))),q.current=!0,t.closeSearch()}else if("ArrowDown"===e.key)t.focusNextSearchMatch();else{if("ArrowUp"!==e.key)return;t.focusPreviousSearchMatch()}return de("focus"),re(e=>e+1),e.preventDefault(),void e.stopPropagation()}if(h&&function(e){return 1===e.key.length&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}(e))return t.openSearch(e.key),re(e=>e+1),e.preventDefault(),void e.stopPropagation();const n=Ne&&Ru(e),r=function(e,t){return!(!t||!Ru(e))||!(!e.ctrlKey&&!e.metaKey||!Nu(e))||"ArrowDown"===e.key||"ArrowLeft"===e.key||"ArrowRight"===e.key||"ArrowUp"===e.key}(e,Ne),o=r&&null!=E.current?Oc(E.current):null,i=r?new Set(function(e){if(null==e)return[];const t=[];for(const n of e.querySelectorAll('button[data-file-tree-sticky-row="true"]')){if(!(n instanceof HTMLElement))continue;const e=n.dataset.fileTreeStickyPath;null!=e&&t.push(e)}return t}(E.current)):new Set,s=(null==o?void 0:o.dataset.fileTreeStickyPath)??null,l="true"===(null==o?void 0:o.dataset.fileTreeStickyRow)&&null!=s;if(l&&s!==Ke&&i.has(s)){const e=T.current;Se(s,(null==e?void 0:e.scrollTop)??null),t.focusPath(s)}const u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(null==p)return;const g=_u(p)?p:null,f=null!=u&&(gt.has(u)||l&&s===u&&i.has(u)),m="ArrowDown"===e.key||"ArrowUp"===e.key||"ArrowRight"===e.key&&null!=g&&g.isExpanded(),v="ArrowLeft"===e.key&&f&&null!=g&&g.isExpanded(),y=T.current;let b=!0;if(e.shiftKey&&"ArrowDown"===e.key)t.extendSelectionFromFocused(1);else if(e.shiftKey&&"ArrowUp"===e.key)t.extendSelectionFromFocused(-1);else if(n&&null!=u&&d>=0){const e=t.getVisibleRows(d,d)[0]??null,n=$u(u,N.current,_.current);null==e||null==n?b=!1:It(e,u)}else if((e.ctrlKey||e.metaKey)&&Nu(e))t.toggleFocusedSelection();else if((e.ctrlKey||e.metaKey)&&"a"===e.key.toLowerCase())t.selectAllVisiblePaths();else switch(e.key){case"ArrowDown":t.focusNextItem();break;case"ArrowUp":t.focusPreviousItem();break;case"ArrowRight":null==g||g.isExpanded()?t.focusNextItem():g.expand();break;case"ArrowLeft":null!=g&&g.isExpanded()?g.collapse():t.focusParentItem();break;case"Home":t.focusFirstItem();break;case"End":t.focusLastItem();break;default:b=!1}if(!b)return;de("focus");const w=t.getFocusedPath(),x=null!=w&&(gt.has(w)||i.has(w)),C=n&&l&&s===u&&w===u;if((f||C)&&null!=w&&(m&&w!==u&&x||C))Se(w,(null==y?void 0:y.scrollTop)??null),F.current=!0,ie(e=>e===w?e:w);else{const t="ArrowUp"===e.key&&f&&w!==u;null!=w&&(t||v&&w===u)?(S=w,I=Fu(E.current,y,o,u,a,pt,lt),ye.current=null,be.current={path:S,viewportOffset:I},we.current=null,F.current=!0,ie(e=>e===w?e:w)):(ye.current=null,be.current=null,we.current=null)}var S,I;re(e=>e+1),e.preventDefault(),e.stopPropagation()};hu(()=>{h&&Ge&&(Ie.current?Ie.current=!1:Fc(A.current))},[Ge,h]),hu(()=>{const e=M.current;switch(function(e){const{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return null==t?"reset":r?n===t?"ignore":"focus-input":"reveal-canonical"}({hasRenderedInput:null!=e,previousRenamingPath:H.current,renamingPath:Ue})){case"reset":return void(H.current=null);case"reveal-canonical":return void(null!=Ue&&Pt(Ue,{restoreTreeFocus:!1,targetOffset:"live-overlay"}));case"ignore":return;case"focus-input":return void(null!=e&&(ve.current=null,H.current=Ue,Fc(e),e.select()))}},[ct.end,ct.start,Ue,Pt,gt]),hu(()=>{const e=E.current;if(null==e)return;let t=null;const n=()=>{null!=t&&(clearTimeout(t),t=null)},r=()=>{var t;const n=(null==(t=Oc(e))?void 0:t.dataset.itemPath)??null;ie(e=>e===n?e:n)},o=()=>{n(),F.current=!0,r()},i=o=>{const i=o.relatedTarget;if(null==i)return n(),void(t=setTimeout(()=>{t=null,null==Oc(e)?(F.current=!1,ie(null)):r()},0));if(!(i instanceof Node&&e.contains(i)))return n(),F.current=!1,void ie(null);const s=i instanceof HTMLElement?i.dataset.itemPath??null:null;ie(e=>e===s?e:s)};return e.addEventListener("focusin",o),e.addEventListener("focusout",i),()=>{n(),e.removeEventListener("focusin",o),e.removeEventListener("focusout",i)}},[]),hu(()=>{const e=E.current;null!=e&&(st.physical.scrollTop<=0?e.dataset.scrollAtTop="true":delete e.dataset.scrollAtTop)},[st.physical.scrollTop]),hu(()=>{let e=null;const n=T.current,r=D.current,o=E.current;if(null==n)return;j.current=Hc(n,m);const i=()=>{const e=t.getVisibleCount(),r=qc(j.current,m),o=Math.max(0,e*a-r);n.scrollTop>o&&(n.scrollTop=o),Te(Du({controller:t,itemHeight:a,overscan:l,scrollTop:Math.min(n.scrollTop,o),stickyFolders:f,viewportHe
2ight:r}))};if(!L.current){L.current=!0;const e=t.getFocusedIndex();if(e>=0){const r=qc(j.current,m),o=t.getVisibleRows(e,e)[0]??null;Vc(n,e,a,r,f&&null!=o?Math.max(0,Math.min(o.ancestorPaths.length*a,Math.max(0,r-a))):0)}}R.current=i;let s=!1;const c=t.subscribe(()=>{s?re(e=>e+1):s=!0,i()}),u=()=>{var t,n;!0!==Ce.current&&(null!=r&&((t=r.dataset).isScrolling??(t.isScrolling="")),null!=o&&((n=o.dataset).isScrolling??(n.isScrolling="")),P.current=!0,null!=e&&clearTimeout(e),e=setTimeout(()=>{null!=r&&delete r.dataset.isScrolling,null!=o&&delete o.dataset.isScrolling,P.current=!1,pe(e=>e+1),e=null},50))};let d=null;const h=()=>{null!=o&&delete o.dataset.overlayReveal,null!=d&&(clearTimeout(d),d=null)},p=()=>{i(),n.scrollTop>0&&h(),null!=me.current&&P.current&&xt.current(),!0!==Ce.current?(ae(e=>null==e?e:null),u()):P.current=!1},g=()=>{u(),null!=o&&!0!==Ce.current&&(n.scrollTop>0||(o.dataset.overlayReveal="true",null!=d&&clearTimeout(d),d=setTimeout(()=>{h()},200)))},v=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End"," ","Spacebar"]),y=e=>{v.has(e.key)&&g()};n.addEventListener("scroll",p,{passive:!0}),n.addEventListener("wheel",g,{passive:!0}),n.addEventListener("touchmove",g,{passive:!0}),n.addEventListener("keydown",y);const b="undefined"!=typeof ResizeObserver?new ResizeObserver(e=>{j.current=(null==e[0]?null:function(e){const t=e.borderBoxSize,n=Array.isArray(t)?t[0]:t;return null!=n&&Number.isFinite(n.blockSize)&&n.blockSize>0?n.blockSize:e.contentRect.height>0?e.contentRect.height:null}(e[0]))??Hc(n,m),i()}):null;return null==b||b.observe(n),()=>{R.current=()=>{},c(),n.removeEventListener("scroll",p),n.removeEventListener("wheel",g),n.removeEventListener("touchmove",g),n.removeEventListener("keydown",y),null!=e&&clearTimeout(e),null!=d&&clearTimeout(d),null!=r&&delete r.dataset.isScrolling,null!=o&&(delete o.dataset.isScrolling,delete o.dataset.overlayReveal),P.current=!1,j.current=null,null==b||b.disconnect()}},[t,m,a,l,f]),hu(()=>{Ne||null==ge||Ct(!1)},[Ct,Ne,ge]);const $t=gu(()=>null==ge?null:`${ge.path}::${ge.source}`,[ge]);hu(()=>{var t,n,r,o;if(null==$t)return void(null==g||g.clearSlotContent(Di));const i=me.current;if(null==i)return;const s=k.current??I.current;if(null==s)return;const a={anchorElement:s,anchorRect:i.anchorRect??(l=s.getBoundingClientRect(),{bottom:l.bottom,height:l.height,left:l.left,right:l.right,top:l.top,width:l.width,x:l.x,y:l.y}),close:e=>{xt.current((null==e?void 0:e.restoreFocus)??!0)},restoreFocus:()=>{var e;wt.current&&bt.current((null==(e=me.current)?void 0:e.path)??null)}};var l;const c=(null==(n=null==(t=null==e?void 0:e.contextMenu)?void 0:t.render)?void 0:n.call(t,i.item,a))??null;return null==g||g.setSlotContent(Di,c),null==(o=null==(r=null==e?void 0:e.contextMenu)?void 0:r.onOpen)||o.call(r,i.item,a),Bu(c),queueMicrotask(()=>{null!=c&&c.isConnected&&document.activeElement===c&&Bu(c)}),()=>{null==g||g.clearSlotContent(Di)}},[$t,null==e?void 0:e.contextMenu,g]),hu(()=>{null!=ge&&null==t.getItem(ge.path)&&Ct()},[Ct,ge,t]),hu(()=>{var e;if(null==ge)return;const t=null==(e=E.current)?void 0:e.getRootNode(),n=t instanceof ShadowRoot?t.host:E.current,r=e=>{var t;const r=e.target;r instanceof Node&&(zu(e)||!0!==(null==(t=I.current)?void 0:t.contains(r))&&!0!==(null==n?void 0:n.contains(r))&&Ct())},o=e=>{"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),Ct())};return document.addEventListener("mousedown",r,!0),document.addEventListener("keydown",o,!0),()=>{document.removeEventListener("mousedown",r,!0),document.removeEventListener("keydown",o,!0)}},[Ct,ge]),hu(()=>{const e=T.current,n=E.current;if(null==e||null==n)return void(O.current=Ke);const r=null==Ke?null:_.current.get(Ke)??null,o=Oc(n),i=(null==o?void 0:o.dataset.itemPath)??null,s=We&&M.current===o,l=h&&A.current===o,c=q.current&&!Ge,u=V.current??0,d=ve.current,p=ye.current,g=be.current,m=we.current,v=null!=o,y=F.current||v,b=O.current!==Ke,w=null!=p&&p===Ke&&null!=Ke;let x=!1,C=!1;if(null!=Xe&&Xe.id!==z.current){z.current=Xe.id;const n=Xe.visibleIndex,r=t.getVisibleRows(n,n)[0]??null;if(null!=r){const t=f?Math.max(0,Math.min(r.ancestorPaths.length*a,Math.max(0,lt-a))):pt;x=!0,C=Bc(e,n,a,lt,ht,Xe.offset,t)}t.clearScrollRequest(Xe.id)}const S=!x&&c&&Uc(e,Ye,a,lt,ht,u),I=!x&&null!=d&&d===Ke&&Uc(e,Ye,a,lt,ht,pt),k=!x&&null!=g&&g.path===Ke&&Uc(e,Ye,a,lt,ht,g.viewportOffset),P=!x&&null!=m&&m.path===Ke&&e.scrollTop!==m.scrollTop;if(P&&(e.scrollTop=m.scrollTop),(P||C||I||k||S||y&&b&&d!==Ke&&!w&&Vc(e,Ye,a,lt,pt))&&R.current(),x)O.current=Ke;else if(y)if(s)O.current=Ke;else if(!l||c){if(null==r)return c&&Ye>=0&&(Uc(e,Ye,a,lt,ht,u),R.current()),void(O.current=Ke);(b||c||d===Ke||p===Ke||(null==g?void 0:g.path)===Ke||(null==m?void 0:m.path)===Ke||null==i||i!==Ke)&&(Fc(r),d===Ke&&(ve.current=null),p===Ke&&(ye.current=null),(null==g?void 0:g.path)===Ke&&(be.current=null),(null==m?void 0:m.path)===Ke&&(we.current=null),q.current=!1,V.current=null),O.current=Ke}else O.current=Ke;else O.current=Ke},[t,Ye,Ke,ft,a,We,Ge,ct,lt,h,Xe,f,pt,ht,at]);const Ft=Ye>=0&&Ye>=st.visible.startIndex&&Ye<=st.visible.endIndex,Ot=null!=Ke&&ut.some(e=>Iu(e.row)===Ke),Ht=Ft||Ot,qt=je&&!0===F.current&&Ht?Ke:null,Vt="pointer"===ue?se:null,Bt=(null==ge?void 0:ge.path)??xe.current??Vt??qt??se,Ut="right-click"===(null==ge?void 0:ge.source);hu(()=>{P.current&&null==ge||St(He(Bt))},[ge,He,ct,lt,he,ut,Bt,St,at]);const Wt=fu(e=>{var t,n,r;if(P.current)return;if(zu(e))return;const o=e.target;if(!(o instanceof HTMLElement))return;if(null!=(null==(t=o.closest)?void 0:t.call(o,`[data-type="${Mi}"]`)))return;const i=null==(n=o.closest)?void 0:n.call(o,'[data-file-tree-sticky-row="true"]'),s=null==(r=o.closest)?void 0:r.call(o,'[data-type="item"]'),a=i instanceof HTMLElement?i.dataset.f
2ileTreeStickyPath??null:s instanceof HTMLElement?s.dataset.itemPath??null:null;null!=a&&de(e=>"pointer"===e?e:"pointer"),ae(e=>e===a?e:a)},[]),Gt=fu(()=>{ae(null)},[]);hu(()=>{if(!Qe)return;const e=()=>{_t(),t.cancelDrag()};return window.addEventListener("dragend",e),()=>{window.removeEventListener("dragend",e),_t(),t.cancelDrag()}},[t,Qe]);const Zt=st.window.height,Kt=st.window.offsetTop,Yt=Math.min(0,lt-Zt),Xt=Math.min(0,lt-Zt-pt),Qt=oe===Ke||q.current,Jt=null!=Ke&&Qt&&!ft&&Ye>=0?at[Ye]??t.getVisibleRows(Ye,Ye)[0]??null:null,en=null==Jt?null:Wc(Ye,a,ct,Zt),tn=K.current,nn=null!=nt&&null!=tn&&tn.path===nt&&tn.index>=ct.start&&tn.index<=ct.end,rn=null==nt||null==tn||tn.path!==nt||nn||tn.path===(null==Jt?void 0:Jt.path)?null:tn,on=null==rn?null:Wc(rn.index,a,ct,Zt),sn=null==(an=(null==(S=Ye>=0?at[Ye]??t.getVisibleRows(Ye,Ye)[0]??null:null)?void 0:S.ancestorPaths.at(-1))??null)?"":`[data-item-section="spacing-item"][data-ancestor-path="${an.replaceAll("\\","\\\\").replaceAll('"','\\"')}"] { opacity: 1; }`;var an;const ln=Ge&&null!=Ke?Hu(s,Ke,!ft):void 0,cn=(null==ge?void 0:ge.path)??(Ge?Ke:oe),un=(null==ge?void 0:ge.path)??se,dn=He(Bt),hn=Ne&&je&&!Ut&&!We&&null!=dn&&null!=le&&null!=Bt,pn=Ne&&(hn||null!=ge),gn=null==ge?void 0:ge.anchorRect,fn=null!=gn||null==dn||null==le||null==ge&&!hn?null:le,mn=null!=gn?{left:`${gn.left}px`,position:"fixed",right:"auto",top:`${gn.top}px`}:null!=fn?{top:`${fn}px`}:void 0,vn=Ut?{opacity:"0"}:void 0,yn=fu((e,n,r,o)=>{const i=function(e){const{event:t,mode:n,isSearchOpen:r,isDirectory:o}=e,i=t.ctrlKey||t.metaKey,s=t.shiftKey||i;return{closeSearch:r,revealCanonical:"sticky"===n,selection:t.shiftKey?{additive:i,kind:"range"}:i?{kind:"toggle"}:{kind:"single"},toggleDirectory:!s&&o}}({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:"directory"===n.kind,isSearchOpen:Ge,mode:o}),s=i.toggleDirectory&&"directory"===n.kind,a=s?t.resolveMountedDirectoryPathFromInput(r):null;if(s&&null==a)return;const l=a??r;switch(i.selection.kind){case"range":t.selectPathRange(l,i.selection.additive);break;case"toggle":t.togglePathSelectionFromInput(l);break;case"single":t.selectOnlyMountedPathFromInput(l)}const c=e.currentTarget instanceof HTMLElement?e.currentTarget:null,u=n.index>=st.visible.startIndex&&n.index<=st.visible.endIndex,d="flow"===o&&u&&null!=c&&"true"!==c.dataset.itemParked;t.focusMountedPathFromInput(l),d&&(F.current=!0,ie(e=>e===l?e:l),de("focus")),s&&t.toggleMountedDirectoryFromInput(l),i.closeSearch&&t.closeSearch(),i.revealCanonical&&Pt(l,{targetOffset:"sticky-parents"})},[t,Ge,st.visible.endIndex,st.visible.startIndex,Pt]),bn={contextHoverPath:un,contextMenuButtonTriggerEnabled:je,contextMenuButtonVisibility:ze,contextMenuEnabled:Ne,contextMenuRightClickEnabled:Le,contextMenuTriggerMode:Re,controller:t,directoriesWithGitChanges:o,dragAndDropEnabled:Qe,draggedPathSet:et,dragTarget:tt,gitLaneActive:qe,gitStatusByPath:n,handleRowDragEnd:()=>{Et(),Mt(),Tt(),K.current=null,t.cancelDrag()},handleRowDragStart:(e,n,r)=>{const o=e.currentTarget;if(null!=o)if(_t(),Et(),Mt(),Tt(),!1!==t.startDrag(r)){if(K.current=n,null!=e.dataTransfer&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.dropEffect="move",e.dataTransfer.setData("text/plain",r),"Apple Computer, Inc."!==navigator.vendor)){const t=Au(o),n=o.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:"0.85",transform:"translate3d(-9999px, 0px, 0)",width:`${n.width}px`}),At(t),Z.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}else e.preventDefault()},handleRowTouchStart:(e,n,r)=>{if(null!=te.current||X.current)return;const o=e.touches[0],i=e.currentTarget;if(null==o||null==i)return;ee.current={clientX:o.clientX,clientY:o.clientY},J.current=i,i.setAttribute("draggable","false");const s=(e={})=>{const t=e.restoreNativeDraggable??!X.current;null!=te.current&&(clearTimeout(te.current),te.current=null),document.removeEventListener("touchmove",a),document.removeEventListener("touchend",l),document.removeEventListener("touchcancel",l),Y.current===s&&(Y.current=null),t&&(i.setAttribute("draggable","true"),J.current===i&&(J.current=null),ee.current=null)},a=e=>{const t=e.touches[0],n=ee.current;if(null==t||null==n)return;const r=t.clientX-n.clientX,o=t.clientY-n.clientY;r*r+o*o<=100||s()},l=()=>{s()};document.addEventListener("touchmove",a,{passive:!0}),document.addEventListener("touchend",l),document.addEventListener("touchcancel",l),Y.current=s,te.current=setTimeout(()=>{if(s({restoreNativeDraggable:!1}),!1===t.startDrag(r))return i.setAttribute("draggable","true"),J.current===i&&(J.current=null),void(ee.current=null);X.current=!0,J.current=i,i.setAttribute("draggable","false"),i.style.setProperty("touch-action","none"),K.current=n;const e=i.getBoundingClientRect(),a=Au(i);Object.assign(a.style,{height:`${e.height}px`,opacity:"0.85",transform:`translate3d(${e.left}px, ${e.top}px, 0)`,width:`${e.width}px`}),At(a),Z.current=a,Q.current={x:o.clientX-e.left,y:o.clientY-e.top};const l=e=>{const t=e.touches[0];if(null==t)return;e.preventDefault();const n=Q.current;null!=n&&null!=Z.current&&(Z.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),Rt(Nt(t.clientX,t.clientY)),zt(t.clientX,t.clientY)},c=e=>{const n=e.changedTouches[0];null!=n&&Nt(n.clientX,n.clientY),t.completeDrag(),_t()},u=()=>{t.cancelDrag(),_t()};Y.current=()=>{document.removeEventListener("touchmove",l),document.removeEventListener("touchend",c),document.removeEventListener("touchcancel",u)},document.addEventListener("touchmove",l,{passive:!1}),document.addEventListener("touchend",c),document.addEventListener("touchcancel",u)},400)},ignoredGitDirectories:r,ignoredInheritanceCache:ne,instanceId:s,itemHeight:a,onKeyDown:Lt,onRowClick:yn,openContextMenuForRow:It,registerButton:$e,registerRenameInput:Oe,renameView:Be,renderDecorationForRow:mt,resolveIcon:Ve,shouldSuppressContextMenu:()=>!0===P.current||null!=te.current||!0===X.current,visualFocusPath:cn},wn={...bn,registerButton:Fe};return gc("div",{ref:E,id:rt,"data-file-tree-context-menu-button-visibility":Ne&&je?ze:void 0,"data-file-tree-context-menu-trigger-mode":Ne?Re:void 0,"data-file-tree-has-context-menu-action-lane":Ne&&je?"true":void 0,"data-file-tree-has-git-lane"
2:qe?"true":void 0,"data-file-tree-virtualized-root":"true",onDragLeave:Qe?e=>{var n;if(!Qe||null==t.getDragSession()||X.current)return;const r=e.relatedTarget;r instanceof Node&&!0===(null==(n=E.current)?void 0:n.contains(r))||(Mt(),Tt(),t.setDragTarget(null))}:void 0,onDragOver:Qe?e=>{var n;if(!Qe||null==t.getDragSession()||X.current)return;const r=Tu(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(r),Rt((null==(n=t.getDragSession())?void 0:n.target)??null),zt(e.clientX,e.clientY),null!=e.dataTransfer&&(e.dataTransfer.dropEffect="move"),e.preventDefault()}:void 0,onDrop:Qe?e=>{Qe&&null!=t.getDragSession()&&!X.current&&(e.preventDefault(),Nt(e.clientX,e.clientY),t.completeDrag(),Et(),Mt(),Tt(),K.current=null)}:void 0,onKeyDown:Lt,onPointerLeave:Ne?Gt:void 0,onPointerOver:Ne?Wt:void 0,role:"tree",tabIndex:-1,style:{outline:"none",position:"relative"},children:[gc("style",{"data-file-tree-guide-style":"true",dangerouslySetInnerHTML:{__html:sn}}),gc("slot",{name:Pi,"data-type":"header-slot"}),h?gc("div",{"data-file-tree-search-container":!0,"data-open":Ge?"true":"false",children:gc("input",{ref:A,"aria-activedescendant":ln,"aria-controls":rt,placeholder:"Searchâ¦","data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":ke?"true":void 0,value:Ze,onBlur:()=>{("retain"!==d||De.current)&&t.closeSearch()},onFocus:Me,onPointerDown:Me,onInput:e=>{Me();const n=e.currentTarget;t.setSearch(n.value)}})}):null,gc("div",{ref:T,"data-file-tree-virtualized-scroll":"true",children:[f&&Ae&&ut.length>0?gc("div",{"aria-hidden":"true","data-file-tree-sticky-overlay":"true",children:gc("div",{"data-file-tree-sticky-overlay-content":"true",style:{height:`${ot}px`},children:ut.map((e,t)=>Uu(wn,e.row,`sticky:${Iu(e.row)}`,{mode:"sticky",style:{left:"0",position:"absolute",right:"0",top:`${e.top}px`,zIndex:""+(ut.length-t)}}))})}):null,gc("div",{ref:D,"data-file-tree-virtualized-list":"true",style:{height:`${ht}px`},children:[gc("div",{"data-file-tree-virtualized-sticky-offset":"true","aria-hidden":"true",style:{height:`${Kt}px`}}),gc("div",{"data-file-tree-virtualized-sticky":"true",style:{height:`${Zt}px`,top:`${Yt}px`,bottom:`${Xt}px`},children:[Wu(bn,ct,gt),null!=Jt&&null!=en?Uu(bn,Jt,`parked:${Jt.path}`,{isParked:!0,style:{left:"0",opacity:"0",pointerEvents:nt===Jt.path?"none":void 0,position:"absolute",right:"0",top:`${en}px`}}):null,null!=rn&&null!=on?Uu(bn,rn,`parked-drag:${rn.path}`,{isParked:!0,style:{left:"0",opacity:"0",pointerEvents:"none",position:"absolute",right:"0",top:`${on}px`}}):null]})]})]}),Ne?gc("div",{ref:I,"data-type":"context-menu-anchor","data-visible":pn?"true":"false",style:mn,children:[gc("button",{ref:k,type:"button","data-type":Mi,"aria-label":"Options","aria-haspopup":"menu","aria-expanded":null!=ge?"true":"false","data-visible":hn?"true":"false",onMouseDown:e=>{e.preventDefault()},onClick:e=>{e.preventDefault(),e.stopPropagation(),null==ge?(()=>{if(P.current)return;if(!je)return;if(null==Bt||null==dn)return;const e=t.getItem(Bt);null!=e&&(St(dn),wt.current=!0,fe({anchorRect:null,item:{kind:e.isDirectory()?"directory":"file",name:dn.getAttribute("aria-label")??Bt,path:e.getPath()},path:e.getPath(),source:"button"}))})():Ct()},tabIndex:-1,style:vn,children:gc(mc,{...Ve("file-tree-icon-ellipsis")})}),null!=ge?gc("slot",{name:Di}):null]}):null,null!=ge?gc("div",{"data-type":"context-menu-wash","aria-hidden":"true",onMouseDownCapture:e=>{e.preventDefault(),Ct()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),Ct()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}}):null]})}const Zu=(e,t)=>{var n,r;n=Ul(Gu,t),r=e,n.__u|=32,hc(n,r)},Ku=(e,t)=>{hc(Ul(Gu,t),e)},Yu=e=>{hc(null,e)};function Xu(e,t){Ku(e,t)}var Qu=(Ye=class{constructor(){Ht(this,We),Ht(this,Be,new Map),Ht(this,Ue,null)}clearAll(){for(const e of Ot(this,Be).values())e.remove();Ot(this,Be).clear()}clearSlotContent(e){const t=Vt(this,We,Ge).call(this,e);null!=t&&(t.remove(),Ot(this,Be).delete(e))}setHost(e){if(qt(this,Ue,e),null!=e){Vt(this,We,Ke).call(this,e);for(const[e,t]of Ot(this,Be))Vt(this,We,Ze).call(this,e,t)}}setSlotContent(e,t){const n=Vt(this,We,Ge).call(this,e);n!==t?(null==n||n.remove(),null!=t?(Ot(this,Be).set(e,t),Vt(this,We,Ze).call(this,e,t)):Ot(this,Be).delete(e)):null!=t&&(Ot(this,Be).set(e,t),Vt(this,We,Ze).call(this,e,t))}setSlotHtml(e,t){const n=(null==t?void 0:t.trim())??"";if(0===n.length)return void this.setSlotContent(e,null);const r=Vt(this,We,Ge).call(this,e);if(null!=r&&r.innerHTML===n)return Ot(this,Be).set(e,r),void Vt(this,We,Ze).call(this,e,r);const o=document.createElement("div");o.innerHTML=n,this.setSlotContent(e,o)}},Be=new WeakMap,Ue=new WeakMap,We=new WeakSet,Ge=function(e){const t=Ot(this,Be).get(e)??null;if(null!=t)return t;const n=Ot(this,Ue);if(null==n)return null;for(const r of Array.from(n.children))if(r instanceof HTMLElement&&r.dataset.f
2ileTreeManagedSlot===e)return r;return null},Ze=function(e,t){t.slot=e,t.dataset.fileTreeManagedSlot=e,null!=Ot(this,Ue)&&t.parentNode!==Ot(this,Ue)&&Ot(this,Ue).appendChild(t)},Ke=function(e){for(const t of Array.from(e.children)){if(!(t instanceof HTMLElement))continue;const e=t.dataset.fileTreeManagedSlot;null==e||Ot(this,Be).has(e)||Ot(this,Be).set(e,t)}},Ye);"function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout;let Ju=0;function ed({initialVisibleRowCount:e,itemHeight:t}){return null==e?420:Math.max(0,e)*(t??Ya)}function td(e){if("undefined"==typeof document)return;const t=document.createElement("div");t.innerHTML=e;const n=t.querySelector("svg");return n instanceof SVGElement?n:void 0}function nd(e){return e.querySelector("#file-tree-icon-chevron")instanceof SVGElement&&e.querySelector("#file-tree-icon-file")instanceof SVGElement&&e.querySelector("#file-tree-icon-dot")instanceof SVGElement&&e.querySelector("#file-tree-icon-lock")instanceof SVGElement}function rd(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var od=(Xe=class{constructor(e){Ht(this,xt),Ht(this,Qe),Ht(this,Je),Ht(this,et),Ht(this,tt),Ht(this,nt),Ht(this,rt),Ht(this,ot),Ht(this,it),Ht(this,st),Ht(this,at,new Qu),Ht(this,lt),Ht(this,ct),Ht(this,ut),Ht(this,dt),Ht(this,ht),Ht(this,pt),Ht(this,gt),Ht(this,ft),Ht(this,mt),Ht(this,vt,null),Ht(this,yt),Ht(this,bt,!1),Ht(this,wt,!1);const{composition:t,density:n,fileTreeSearchMode:r,gitStatus:o,id:i,initialSearchQuery:s,icons:a,itemHeight:l,onSearchChange:c,onSelectionChange:u,overscan:d,renderRowDecoration:h,renaming:p,search:g,searchBlurBehavior:f,searchFakeFocus:m,stickyFolders:v,unsafeCSS:y,initialVisibleRowCount:b,...w}=e;var x;qt(this,Qe,t),qt(this,et,null!=(x=i)&&x.length>0?x:(Ju+=1,`pst_ft_${Ju}`)),qt(this,dt,Ml(o)),qt(this,ht,a),qt(this,pt,y),qt(this,tt,u),qt(this,nt,h),qt(this,rt,null!=p&&!1!==p),qt(this,ot,f),qt(this,it,!0===g),qt(this,st,!0===m),qt(this,lt,function(e,t){if("number"==typeof e)return{itemHeight:t??Ka.default.itemHeight,factor:e};const n=Ka[e??"default"];return{itemHeight:t??n.itemHeight,factor:n.factor}}(n,l)),qt(this,ct,{itemHeight:Ot(this,lt).itemHeight,overscan:d,stickyFolders:v,initialVisibleRowCount:b}),qt(this,Je,new Il({...w,fileTreeSearchMode:r,initialSearchQuery:s,onSearchChange:c,renaming:p})),qt(this,mt,Ot(this,Je).getSelectionVersion()),qt(this,vt,null==Ot(this,tt)?null:this.subscribe(()=>{Vt(this,xt,Pt).call(this)}))}unmount(){var e;null!=Ot(this,yt)&&(e=Ot(this,yt),Yu(e),delete Ot(this,yt).dataset.fileTreeVirtualizedWrapper,qt(this,yt,void 0)),Ot(this,at).clearAll(),Ot(this,at).setHost(null),null!=Ot(this,ut)&&(delete Ot(this,ut).dataset.fileTreeVirtualized,Vt(this,xt,jt).call(this,Ot(this,ut)),qt(this,ut,void 0))}cleanUp(){var e;this.unmount(),null==(e=Ot(this,vt))||e.call(this),qt(this,vt,null),Ot(this,Je).destroy()}getFileTreeContainer(){return Ot(this,ut)}getItem(e){return Ot(this,Je).getItem(e)}getFocusedItem(){return Ot(this,Je).getFocusedItem()}getFocusedPath(){return Ot(this,Je).getFocusedPath()}getSelectedPaths(){return Ot(this,Je).getSelectedPaths()}getComposition(){return Ot(this,Qe)}getItemHeight(){return Ot(this,lt).itemHeight}getDensityFactor(){return Ot(this,lt).factor}subscribe(e){let t=!1;return Ot(this,Je).subscribe(()=>{t?e():t=!0})}focusPath(e){Ot(this,Je).focusPath(e)}scrollToPath(e,t){Ot(this,Je).scrollToPath(e,t)}focusNearestPath(e){return Ot(this,Je).focusNearestPath(e)}add(e){Ot(this,Je).add(e)}batch(e){Ot(this,Je).batch(e)}move(e,t,n){Ot(this,Je).move(e,t,n)}onMutation(e,t){return Ot(this,Je).onMutation(e,t)}setSearch(e){Ot(this,Je).setSearch(e)}openSearch(e){Ot(this,Je).openSearch(e)}closeSearch(){Ot(this,Je).closeSearch()}isSearchOpen(){return Ot(this,Je).isSearchOpen()}getSearchValue(){return Ot(this,Je).getSearchValue()}getSearchMatchingPaths(){return Ot(this,Je).getSearchMatchingPaths()}focusNextSearchMatch(){Ot(this,Je).focusNextSearchMatch()}focusPreviousSearchMatch(){Ot(this,Je).focusPreviousSearchMatch()}startRenaming(e,t){return Ot(this,Je).startRenaming(e,t)}remove(e,t){Ot(this,Je).remove(e,t)}resetPaths(e,t){Ot(this,Je).resetPaths(e,t)}setComposition(e){qt(this,Qe,e);const t=Vt(this,xt,It).call(this);null!=t&&(Vt(this,xt,Dt).call(this),Xu(t.wrapper,Vt(this,xt,St).call(this)))}setGitStatus(e){qt(this,dt,Ml(e,Ot(this,dt)));const t=Vt(this,xt,It).call(this);null!=t&&Xu(t.wrapper,Vt(this,xt,St).call(this))}setIcons(e){qt(this,ht,e);const t=Vt(this,xt,It).call(this);null!=t&&(Vt(this,xt,kt).call(this,t.host,t.wrapper),Xu(t.wrapper,Vt(this,xt,St).call(this)))}hydrate({fileTreeContainer:e}){const t=Vt(this,xt,Nt).call(this,e),n=Vt(this,xt,_t).call(this,t);var r,o;Vt(this,xt,Dt).call(this),r=n,o=Vt(this,xt,St).call(this),Zu(r,o)}render({containerWrapper:e,fileTreeContainer:t}){const n=Vt(this,xt,Nt).call(this,t??Ot(this,ut),e),r=Vt(this,xt,_t).call(this,n);Vt(this,xt,Dt).call(this),Xu(r,Vt(this,xt,St).call(this))}},Qe=new WeakMap,Je=new WeakMap,et=new WeakMap,tt=new WeakMap,nt=new WeakMap,rt=new WeakMap,ot=new WeakMap,it=new WeakMap,st=new WeakMap,at=new WeakMap,lt=new WeakMap,ct=new WeakMap,ut=new WeakMap,dt=new WeakMap,ht=new WeakMap,pt=new WeakMap,gt=new WeakMap,ft=new WeakMap,mt=new WeakMap,vt=new WeakMap,yt=new WeakMap,bt=new WeakMap,wt=new WeakMap,xt=new WeakSet,Ct=function(){return{initialViewportHe
2ight:ed({initialVisibleRowCount:Ot(this,ct).initialVisibleRowCount,itemHeight:Ot(this,ct).itemHeight}),itemHeight:Ot(this,ct).itemHeight,overscan:Ot(this,ct).overscan,stickyFolders:Ot(this,ct).stickyFolders}},St=function(){var e,t,n;return{composition:Ot(this,Qe),controller:Ot(this,Je),gitStatusByPath:null==(e=Ot(this,dt))?void 0:e.statusByPath,ignoredGitDirectories:null==(t=Ot(this,dt))?void 0:t.ignoredDirectoryPaths,directoriesWithGitChanges:null==(n=Ot(this,dt))?void 0:n.directoriesWithChanges,icons:Ot(this,ht),instanceId:Ot(this,et),renamingEnabled:Ot(this,rt),renderRowDecoration:Ot(this,nt),searchBlurBehavior:Ot(this,ot),searchEnabled:Ot(this,it),searchFakeFocus:Ot(this,st),slotHost:Ot(this,at),...Vt(this,xt,Ct).call(this)}},It=function(){const e=Ot(this,ut),t=Ot(this,yt);return null==e||null==t?null:{host:e,wrapper:t}},kt=function(e,t){const n=e.shadowRoot;null!=n&&(Vt(this,xt,Mt).call(this,n),Vt(this,xt,Et).call(this,n)),Vt(this,xt,Tt).call(this,t)},Pt=function(){const e=Ot(this,tt);if(null==e)return;const t=Ot(this,Je).getSelectionVersion();t!==Ot(this,mt)&&(qt(this,mt,t),e(Ot(this,Je).getSelectedPaths()))},Dt=function(){var e,t,n,r;const o=null==(t=null==(e=Ot(this,Qe))?void 0:e.header)?void 0:t.render;null==o?Ot(this,at).setSlotHtml(Pi,(null==(r=null==(n=Ot(this,Qe))?void 0:n.header)?void 0:r.html)??null):Ot(this,at).setSlotContent(Pi,o())},Mt=function(e){const t=rd(e).find(e=>nd(e)),n=td(xi(Ti(Ot(this,ht)).set));null!=n&&(null!=t&&t.outerHTML===n.outerHTML||(null!=t?t.replaceWith(n):e.prepend(n)))},Et=function(e){var t;const n=rd(e),r=n.find(e=>nd(e)),o=n.filter(e=>e!==r),i=(null==(t=Ti(Ot(this,ht)).spriteSheet)?void 0:t.trim())??"";if(0===i.length){for(const e of o)e.remove();return}const s=td(i);if(null!=s){if(1!==o.length||o[0].outerHTML!==s.outerHTML){for(const e of o)e.remove();e.appendChild(s)}}else for(const a of o)a.remove()},Tt=function(e){const t=Ti(Ot(this,ht));var n;t.colored&&("none"!==(n=t.set)&&wi.has(n))?e.dataset.fileTreeColoredIcons="true":delete e.dataset.fileTreeColoredIcons},At=function(e){var t,n;const r=e.querySelector(`style[${Ii}]`);if(null==Ot(this,gt)&&r instanceof HTMLStyleElement&&qt(this,gt,r),null==Ot(this,pt)||""===Ot(this,pt))return null==(t=Ot(this,gt))||t.remove(),qt(this,gt,void 0),void qt(this,ft,void 0);var o;(null==(n=Ot(this,gt))?void 0:n.parentNode)===e&&Ot(this,ft)===Ot(this,pt)||(Ot(this,gt)??qt(this,gt,document.createElement("style")),Ot(this,gt).setAttribute(Ii,""),Ot(this,gt).parentNode!==e&&e.appendChild(Ot(this,gt)),Ot(this,gt).textContent=(o=Ot(this,pt),`${Qa}\n@layer unsafe {\n ${o}\n}`),qt(this,ft,Ot(this,pt)))},_t=function(e){if(null!=Ot(this,yt))return Ot(this,yt);const t=e.shadowRoot;if(null==t)throw new Error("FileTree requires a shadow root");const n=Array.from(t.children).filter(e=>e instanceof HTMLDivElement&&"string"==typeof e.dataset.fileTreeId&&e.dataset.fileTreeId.length>0),r=n.find(e=>e.dataset.fileTreeId===Ot(this,et))??n[0];return null!=r&&qt(this,et,r.dataset.fileTreeId??Ot(this,et)),qt(this,yt,r??document.createElement("div")),Ot(this,yt).dataset.fileTreeId=Ot(this,et),Ot(this,yt).dataset.fileTreeVirtualizedWrapper="true",Vt(this,xt,kt).call(this,e,Ot(this,yt)),Ot(this,yt).parentNode!==t&&t.appendChild(Ot(this,yt)),Ot(this,yt)},Nt=function(e,t){const n=e??Ot(this,ut)??document.createElement(Ci);null!=t&&n.parentNode!==t&&t.appendChild(n);const r=n.shadowRoot??n.attachShadow({mode:"open"});return rl(n,r),Vt(this,xt,At).call(this,r),n.dataset.fileTreeVirtualized="true",n.style.display="flex",Vt(this,xt,Rt).call(this,n),Ot(this,at).setHost(n),qt(this,ut,n),n},Rt=function(e){""===e.style.getPropertyValue("--trees-item-height")&&(e.style.setProperty("--trees-item-height",`${String(Ot(this,lt).itemHeight)}px`),qt(this,bt,!0)),""===e.style.getPropertyValue("--trees-density-override")&&(e.style.setProperty("--trees-density-override",String(Ot(this,lt).factor)),qt(this,wt,!0))},jt=function(e){Ot(this,bt)&&(e.style.removeProperty("--trees-item-height"),qt(this,bt,!1)),Ot(this,wt)&&(e.style.removeProperty("--trees-density-override"),qt(this,wt,!1))},$t(Xe,"LoadedCustomComponent",!0),Xe);const id="undefined"==typeof window?Bt.useEffect:Bt.useLayoutEffect;function sd({header:e,id:t,model:n,preloadedData:r,renderContextMenu:o,...i}){const[s,a]=Bt.useState(null),[l,c]=Bt.useState(null),u=Bt.useRef(n.getComposition()),d=Bt.useRef(n);d.current!==n&&(d.current=n,u.current=n.getComposition());const h=null!=o,p=Bt.useCallback(()=>{a(null)},[]),g=Bt.useCallback((e,t)=>{a({context:t,item:e})},[]),f=u.current,m=Bt.useMemo(()=>function(e,t,n,r,o){const i={...e??{}};if(null!=t&&delete i.header,n){const t=null==e?void 0:e.contextMenu,n=null==t?void 0:t.onClose,s=null==t?void 0:t.onOpen;i.contextMenu={...t??{},enabled:!0,onClose:()=>{null==n||n(),r()},onOpen:(e,t)=>{o(e,t),null==s||s(e,t)}},delete i.contextMenu.render}return null!=i.header||null!=i.contextMenu?i:void 0}(f,e,h,p,g),[f,p,g,h,e]),v=Bt.useCallback(e=>{c(e)},[]);Bt.useEffect(()=>{h||a(null)},[h]),id(()=>{n.setComposition(m)},[m,n]),id(()=>
2{if(null!=l)return null!=r&&function(e){const t=e.shadowRoot;return(null==t?void 0:t.querySelector("[data-file-tree-id]"))instanceof HTMLElement||(null==t?void 0:t.querySelector("[data-file-tree-id]"))instanceof SVGElement||e.querySelector('template[shadowrootmode="open"]')instanceof HTMLTemplateElement}(l)?n.hydrate({fileTreeContainer:l}):n.render({fileTreeContainer:l}),()=>{n.unmount(),n.setComposition(f)}},[f,l,n,r]);const y=function(e,t){return"undefined"==typeof window&&null!=t?Ut.jsxs(Ut.Fragment,{children:[Ut.jsx("template",{shadowrootmode:"open",dangerouslySetInnerHTML:{__html:t.shadowHtml}}),e]}):Ut.jsx(Ut.Fragment,{children:e})}(function(e,t,n){const r=null!=e?Ut.jsx("div",{slot:Pi,children:e}):null,o=null!=t&&null!=n?Ut.jsx("div",{slot:Di,children:t(n.item,n.context)}):null;return null==r&&null==o?null:Ut.jsxs(Ut.Fragment,{children:[r,o]})}(e,o,s),r),b=t??(null==r?void 0:r.id),w={"--trees-item-height":`${String(n.getItemHeight())}px`,"--trees-density-override":n.getDensityFactor(),...i.style};return Ut.jsx(Ci,{...i,id:b,ref:v,style:w,suppressHydrationWarning:null!=r,children:y})}function ad(...e){return e.filter(Boolean).join(" ")}const ld=new Set;function cd(){return Ut.jsxs("div",{"aria-hidden":"true",className:"absolute inset-0 z-10 overflow-hidden bg-muted",children:[Ut.jsx("div",{className:"absolute inset-0 bg-muted"}),Ut.jsx("div",{className:"absolute inset-0 animate-pulse bg-background/55 motion-reduce:animate-none"})]})}function ud({className:e,previewAspectRatio:t,previewClassName:n,previewContent:r,previewImageUrl:o,isLoading:i=!1,hasError:s=!1}){const a=Bt.useRef(null),l=Bt.useRef(null),[c,u]=Bt.useState(()=>o&&ld.has(o)?o:null),[d,h]=Bt.useState(null),p=Boolean(o&&d===o),g=Boolean(o&&c!==o&&!p&&!ld.has(o)),f=i||g,m=Boolean(r),v=!f&&(s||p||!o&&!m),y=Bt.useCallback(()=>{null!==l.current&&(window.cancelAnimationFrame(l.current),l.current=null)},[]),b=Bt.useCallback((e,t)=>{if(!t)return;const n=e.naturalWidth>0&&e.naturalHeight>0;h(n?null:t),n&&(ld.add(t),y(),l.current=window.requestAnimationFrame(()=>{l.current=window.requestAnimationFrame(()=>{u(t),l.current=null})}))},[y]);return Bt.useEffect(()=>{y()},[y,o]),Bt.useEffect(()=>y,[y]),Bt.useEffect(()=>{const e=a.current;e&&o&&e.complete&&b(e,o)},[b,o]),Ut.jsx("div",{className:ad("group overflow-hidden rounded-lg border bg-background text-foreground",e),children:Ut.jsxs("div",{className:ad("relative aspect-square overflow-hidden bg-muted [contain:layout_paint]",n),style:t?{aspectRatio:String(t)}:void 0,children:[o?Ut.jsx("img",{ref:a,src:o,alt:"",draggable:!1,loading:"lazy",decoding:"async",className:ad("absolute inset-0 block size-full object-cover transition-[opacity,filter] duration-[160ms] ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none",f?"opacity-0 blur-sm":"blur-0 opacity-100"),onLoad:e=>{b(e.currentTarget,o)},onError:()=>{o&&(ld.delete(o),y(),h(o),u(e=>e===o?null:e))}}):null,r?Ut.jsx("div",{className:ad("absolute inset-0 size-full transition-[opacity,filter] duration-[160ms] ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none",f?"opacity-0 blur-sm":"blur-0 opacity-100"),children:r}):null,f?Ut.jsx(cd,{}):null,v?Ut.jsx("div",{className:"absolute inset-0 bg-muted","aria-hidden":"true"}):null]})})}function dd(e){return e&&"/"!==e?e.endsWith("/")?e:`${e}/`:""}function hd(e){const t=e.endsWith("/")?e.slice(0,-1):e,n=t.lastIndexOf("/");return(-1===n?t:t.slice(n+1)).replace(/%2[Ff]/g,"/").replace(/%5[Cc]/g,"\\").replace(/%25/g,"%")}const pd="â",gd=encodeURIComponent(pd);function fd(e){return e.replaceAll(pd,gd).replace(/%2[Ff]/g,pd)}function md(e){return hh(e).replace(/%2f/g,pd).replace(/\s\/\s/g,` ${pd} `)}function vd(e){const t=e.endsWith("/")?e.slice(0,-1):e,n=t.lastIndexOf("/");return-1===n?"":t.slice(0,n+1)}const yd="application/x-truco-fspath";function bd(e){return e?e.endsWith("/")?e.slice(0,-1):e:""}function wd(e,t){return function(e){return bd(vd(e))}(e)===bd(t)}function xd(e,t,n){if("root"===t.kind||!t.directoryPath)return bd(e);const r=n.get(t.directoryPath);return r?bd(`${e}${r}`):null}function Cd(e,t){const[n,r]=Bt.useState(null),o=Bt.useCallback((n,o)=>
2{if(n.preventDefault(),r(null),!e)return;const i=n.dataTransfer.getData(yd);if(!i)return;const s=t.files.get(i);s&&!wd(i,o)&&e({file:s,targetFolderPath:bd(o)})},[t.files,e]),i=Bt.useCallback(t=>e?{onDragOver:e=>{e.preventDefault(),r(t)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||r(null)},onDrop:e=>o(e,t)}:{},[o,e]),s=Bt.useCallback(t=>Boolean(e)&&bd(t)===bd(n??""),[n,e]);return{bindEntry:Bt.useCallback(t=>e?"file"===t.kind?{draggable:!0,onDragStart:e=>{e.dataTransfer.setData(yd,t.path),e.dataTransfer.effectAllowed="move"},onDragEnd:()=>r(null)}:{onDragOver:e=>{e.preventDefault(),e.stopPropagation(),r(t.path)},onDragLeave:e=>{e.stopPropagation(),e.currentTarget.contains(e.relatedTarget)||r(null)},onDrop:e=>{e.stopPropagation(),o(e,t.path)}}:{},[o,e]),isDropTarget:s,viewportMoveProps:i}}function Sd(e){return Array.from(e.types??[]).includes("Files")}function Id(e){const[t,n]=Bt.useState(null),r=Bt.useCallback((t,r)=>{if(!e)return;const o=Array.from(t.dataTransfer.files??[]);0!==o.length&&(t.preventDefault(),t.stopPropagation(),n(null),e({files:o,targetFolderPath:bd(r)}))},[e]),o=Bt.useCallback(t=>e?{onDragOver:e=>{Sd(e.dataTransfer)&&(e.preventDefault(),e.dataTransfer.dropEffect="copy",n(t))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||n(null)},onDrop:e=>r(e,t)}:{},[r,e]);return{bindEntry:Bt.useCallback(t=>e&&"folder"===t.kind?{onDragOver:e=>{Sd(e.dataTransfer)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy",n(t.path))},onDragLeave:e=>{e.stopPropagation(),e.currentTarget.contains(e.relatedTarget)||n(null)},onDrop:e=>r(e,t.path)}:{},[r,e]),isUploadTarget:Bt.useCallback(n=>Boolean(e)&&bd(n)===bd(t??""),[t,e]),viewportUploadProps:o}}function kd(e,t){return e?t?n=>{e(n),n.defaultPrevented||t(n)}:e:t}function Pd(e,t){return{...e,...t,onDragOver:kd(t.onDragOver,e.onDragOver),onDragLeave:kd(t.onDragLeave,e.onDragLeave),onDrop:kd(t.onDrop,e.onDrop)}}function Dd(e){const t=e.lastIndexOf(".");return-1===t?"":e.slice(t+1).toLowerCase()}const Md={css:"CSS Stylesheet",csv:"CSV Document",doc:"Word Document",docx:"Word Document",gif:"GIF Image",go:"Go Source",jpeg:"JPEG Image",jpg:"JPEG Image",js:"JavaScript Source",json:"JSON Document",jsx:"JavaScript Source",md:"Markdown Document",mdx:"MDX Document",pdf:"PDF Document",png:"PNG Image",ppt:"PowerPoint Presentation",pptx:"PowerPoint Presentation",py:"Python Script",rs:"Rust Source",sh:"Shell Script",sql:"SQL Script",svg:"SVG Image",ts:"Type
2Script Source",tsv:"TSV Document",tsx:"TypeScript Source",txt:"Plain Text",webp:"WebP Image",xls:"Excel Workbook",xlsx:"Excel Workbook",yaml:"YAML Document",yml:"YAML Document",zip:"ZIP Archive"};function Ed(e){var t;const n=Md[Dd(e.name)];return n||((null==(t=e.contentType)?void 0:t.startsWith("image/"))?"Image":e.contentType??"Document")}function Td(e){return"folder"===e.kind?"Folder":Ed(e)}const Ad={css:"text/css",csv:"text/csv",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",gif:"image/gif",go:"text/x-go",jpeg:"image/jpeg",jpg:"image/jpeg",js:"text/javascript",json:"application/json",jsx:"text/jsx",md:"text/markdown",mdx:"text/mdx",pdf:"application/pdf",png:"image/png",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",py:"text/x-python",rs:"text/x-rust",sh:"application/x-sh",sql:"application/sql",svg:"image/svg+xml",ts:"text/x-typescript",tsv:"text/tab-separated-values",tsx:"text/x-typescript",txt:"text/plain",webp:"image/webp",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",yaml:"text/yaml",yml:"text/yaml",zip:"application/zip"},_d="application/octet-stream",Nd={[_d]:"Binary","application/json":"JSON","application/msword":"Word document (legacy)","application/pdf":"PDF","application/sql":"SQL","application/vnd.ms-excel":"Excel workbook (legacy)","application/vnd.ms-powerpoint":"PowerPoint (legacy)","application/vnd.openxmlformats-officedocument.presentationml.presentation":"PowerPoint","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"Excel workbook","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"Word document","application/x-sh":"Shell script","application/zip":"ZIP archive","image/gif":"GIF image","image/jpeg":"JPEG image","image/png":"PNG image","image/svg+xml":"SVG image","image/webp":"WebP image","text/css":"CSS","text/csv":"CSV","text/javascript":"JavaScript","text/jsx":"JSX","text/markdown":"Markdown","text/mdx":"MDX","text/plain":"Plain text","text/tab-separated-values":"TSV","text/x-go":"Go","text/x-python":"Python","text/x-rust":"Rust","text/x-typescript":"TypeScript","text/yaml":"YAML"};function Rd(e){return e.contentType??Ad[Dd(e.name)]??_d}function jd(e){return"application/pdf"===e||"application/msword"===e||"application/vnd.ms-powerpoint"===e||"application/vnd.openxmlformats-officedocument.presentationml.presentation"===e||"application/vnd.openxmlformats-officedocument.wordprocessingml.document"===e?"Documents":"application/vnd.ms-excel"===e||"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"===e||"text/csv"===e||"text/tab-separated-values"===e?"Spreadsheets":e.startsWith("image/")?"Images":"application/json"===e||"application/sql"===e||"application/x-sh"===e||"text/css"===e||"text/javascript"===e||"text/jsx"===e||"text/x-go"===e||"text/x-python"===e||"text/x-rust"===e||"text/x-typescript"===e||"text/yaml"===e?"Code":"text/markdown"===e||"text/mdx"===e||"text/plain"===e?"Text":"Archives & binary"}function zd(e){if(void 0===e)return null;if(e<1e3)return`${e} bytes`;const t=["KB","MB","GB","TB"];let n=e;for(const r of t)if(n/=1e3,n<1e3||"TB"===r)return`${n>=100?Math.round(n):n.toFixed(n>=10?1:2).replace(/\.?0+$/,"")} ${r}`;return null}function Ld(e){if(!e)return null;const t=new Date(e);if(Number.isNaN(t.getTime()))return null;return`${t.toLocaleDateString("en-US",{day:"numeric",month:"short",year:"numeric"})} at ${t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit"})}`}function $d(e){const t=new Set;for(const n of e){let e=n.indexOf("/");for(;-1!==e;)t.add(n.slice(0,e)),e=n.indexOf("/",e+1)}return t}function Fd(e,t,n){for(const r of t.children.get(e)??[])if("file"!==r.kind){if(Fd(r.path,t,n))return!0}else if(!n||n(r))return!0;return!1}function Od(e,t){return e.name.localeCompare(t.name,void 0,{numeric:!0,sensitivity:"base"})}const Hd=[{defaultDirection:"asc",key:"name",label:"Name",triggerLabel:"Name"},{defaultDirection:"asc",key:"kind",label:"Kind",triggerLabel:"Kind"},{defaultDirection:"desc",key:"createdAt",label:"Date created",triggerLabel:"Created"},{defaultDirection:"desc",key:"updatedAt",label:"Date modified",triggerLabel:"Modified"},{defaultDirection:"desc",key:"size",label:"Size",triggerLabel:"Size"}],qd={direction:"asc",key:"name"};function Vd(e){var t;return(null==(t=Hd.find(t=>t.key===e))?void 0:t.defaultDirection)??"asc"}function Bd(e,t){const n=e[t],r=n?Date.parse(n):Number.NaN;return Number.isNaN(r)?0:r}function Ud(e,t,n){let r=0;if("name"===n.key)r=Od(e,t);else if("kind"===n.key)r=Td(e).localeCompare(Td(t),void 0,{sensitivity:"base"});else if("size"===n.key){r=("file"===e.kind?e.size??0:-1)-("file"===t.kind?t.size??0:-1)}else r=Bd(e,n.key)-Bd(t,n.key);return 0===r?Od(e,t):"asc"===n.direction?r<0?-1:1:r<0?1:-1}const Wd=["Documents","Spreadsheets","Images","Code","Text","Archives & binary"],Gd={dateCreated:"Date created",dateModified:"Date modified",fileType:"File type"},Zd={after:"after",before:"before","in-range":"in range",is:"is","is-any-of":"is any of","is-not":"is not","not-in-range":"not in range"},Kd=["1 day ago","3 days ago","1 week ago","1 month ago","3 months ago","6 months ago","1 year ago"];function Yd(e){return 2===e.length&&e.every(e=>!Kd.includes(e)&&!Number.isNaN(Date.parse(e)))}function Xd(e){return"fileType"===e.type?e.value.length>
21?["is-any-of","is-not"]:["is","is-not"]:Yd(e.value)?["in-range","not-in-range"]:["before","after"]}function Qd(e,t){if(0===t.value.length)return!0;if("fileType"===t.type){const n=t.value.includes(Rd(e));return"is-not"===t.operator?!n:n}const n="dateCreated"===t.type?e.createdAt:e.updatedAt,r=n?Date.parse(n):Number.NaN;if(Number.isNaN(r))return!1;if("in-range"===t.operator||"not-in-range"===t.operator){const e=Date.parse(t.value[0]),n=Date.parse(t.value[1]??t.value[0]),o=r>=e&&r<=n;return"not-in-range"===t.operator?!o:o}const o=function(e){const t=new Date;switch(e){case"1 day ago":t.setDate(t.getDate()-1);break;case"3 days ago":t.setDate(t.getDate()-3);break;case"1 week ago":t.setDate(t.getDate()-7);break;case"1 month ago":t.setMonth(t.getMonth()-1);break;case"3 months ago":t.setMonth(t.getMonth()-3);break;case"6 months ago":t.setMonth(t.getMonth()-6);break;case"1 year ago":t.setFullYear(t.getFullYear()-1);break;default:{const t=Date.parse(e);if(!Number.isNaN(t))return new Date(t)}}return t}(t.value[0]).getTime();return"before"===t.operator?r<=o:r>=o}function Jd(e,t){var n;return((null==(n=e.children.get(t.path))?void 0:n.length)??0)>0||!0===t.hasChildren}const eh=`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 50" width="64" height="50"><defs><linearGradient id="fs-folder-back" x1="0" x2="0" y1="0" y2="1"><stop offset="0" stop-color="#3dabf5"/><stop offset="1" stop-color="#1d84dd"/></linearGradient><linearGradient id="fs-folder-front" x1="0" x2="0" y1="0" y2="1"><stop offset="0" stop-color="#7accfb"/><stop offset="1" stop-color="#37a0ef"/></linearGradient></defs><path d="M5 10c0-3.31 2.69-6 6-6h10.9c1.6 0 3.13.7 4.18 1.9l1.5 1.73a3.5 3.5 0 0 0 2.64 1.22H54c2.76 0 5 2.24 5 5V40c0 3.87-3.13 7-7 7H12c-3.87 0-7-3.13-7-7V10Z" fill="url(#fs-folder-back)"/><path d="M5 15.5h54V40c0 3.87-3.13 7-7 7H12c-3.87 0-7-3.13-7-7V15.5Z" fill="url(#fs-folder-front)"/></svg>')}`;function th({className:e}){return Ut.jsx("img",{src:eh,alt:"","aria-hidden":"true",draggable:!1,className:e})}function nh(e){return e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""")}const rh=xi("complete"),{resolveIcon:oh}=Ni({colored:!0,set:"complete"}),ih={astro:["#a631be","#d568ea"],babel:["#d5a910","#ffd452"],bash:["#199f43","#5ecc71"],biome:["#1a85d4","#69b1ff"],bootstrap:["#693acf","#9d6afb"],browserslist:["#d5a910","#ffd452"],bun:["#594c5b","#79697b"],c:["#1a85d4","#69b1ff"],claude:["#d47628","#ffa359"],cpp:["#1a85d4","#69b1ff"],css:["#693acf","#9d6afb"],database:["#a631be","#d568ea"],default:["#84848a","#adadb1"],docker:["#1a85d4","#69b1ff"],eslint:["#693acf","#9d6afb"],git:["#ff8c5b","#d5512f"],go:["#1ca1c7","#68cdf2"],graphql:["#d32a61","#ff678d"],html:["#d47628","#ffa359"],image:["#d32a61","#ff678d"],javascript:["#d5a910","#ffd452"],json:["#d47628","#ffa359"],markdown:["#199f43","#5ecc71"],mcp:["#17a5af","#64d1db"],npm:["#d52c36","#ff6762"],oxc:["#1ca1c7","#68cdf2"],postcss:["#d52c36","#ff6762"],prettier:["#17a5af","#64d1db"],python:["#1a85d4","#69b1ff"],react:["#1ca1c7","#68cdf2"],ruby:["#d52c36","#ff6762"],rust:["#d47628","#ffa359"],sass:["#d32a61","#ff678d"],svelte:["#d52c36","#ff6762"],svg:["#d47628","#ffa359"],svgo:["#199f43","#5ecc71"],swift:["#d47628","#ffa359"],table:["#17a5af","#64d1db"],tailwind:["#1ca1c7","#68cdf2"],terraform:["#693acf","#9d6afb"],text:["#84848a","#adadb1"],typescript:["#1a85d4","#69b1ff"],vite:["#a631be","#d568ea"],vscode:["#1a85d4","#69b1ff"],vue:["#199f43","#5ecc71"],wasm:["#693acf","#9d6afb"],webpack:["#1a85d4","#69b1ff"],yml:["#d52c36","#ff6762"],zig:["#d47628","#ffa359"],zip:["#d47628","#ffa359"]};function sh(e){return Object.entries(ih).map(([t,n])=>`--fs-file-icon-${t}: ${n[e]};`).join(" ")}const ah=`\n:root { ${sh(0)} --fs-selected-color-scheme: dark; }\n.dark { ${sh(1)} --fs-selected-color-scheme: light; }\n.dark [data-file-system-on-light] { ${sh(0)} }\n[data-file-system-on-primary] { ${sh(1)} }\n.dark [data-file-system-on-primary] { ${sh(0)} }\n`;function lh(){return Ut.jsxs(Ut.Fragment,{children:[Ut.jsx("span",{"aria-hidden":"true",className:"hidden",dangerouslySetInnerHTML:{__html:rh}}),Ut.jsx("style",{children:ah})]})}function ch({fileName:e,className:t}){const n=oh("file-tree-icon-file",e);return Ut.jsx("svg",{"aria-hidden":"true",viewBox:n.viewBox??"0 0 16 16",className:Jt("shrink-0 text-muted-foreground",t),style:n.token?{color:`var(--fs-file-icon-${n.token}, var(--color-muted-foreground))`}:void 0,children:Ut.jsx("use",{href:`#${n.name}`})})}function uh({file:e}){const t=Dd(e.name);return Ut.jsxs("div",{"data-file-system-on-light":"",className:"flex size-full flex-col items-center justify-center gap-1.5 bg-white text-neutral-400 dark:bg-neutral-100",children:[Ut.jsx(ch,{fileName:e.name,className:"size-1/3 min-h-4 min-w-4"}),t?Ut.jsx("span",{className:"text-[min(0.625rem,18cqw)] font-semibold tracking-wide uppercase",children:t}):null]})}function dh(e){var t;return(null==(t=e.previewImageUrls)?void 0:t.length)?e.previewImageUrls:e.previewImageUrl?[e.previewImageUrl]:[]}function hh(e){const t=e.trim();return t?t.replaceAll("\\","/").toLowerCase():""}function ph({count:e,horizontal:t=!1,itemStride:n,leadingPx:r=0,overscan:o=8,viewportRef:i}){const[s,a]=Bt.useState(()=>({end:Math.min(e,2*o),start:0}));return Bt.useLayoutEffect(()=>
2{const s=i.current;if(!s||n<=0)return;const l=()=>{const i=(t?s.scrollLeft:s.scrollTop)-r,l=t?s.clientWidth:s.clientHeight,c=Math.max(0,Math.floor(i/n)),u=Math.min(e,Math.ceil((i+l)/n));a(t=>t.end<=e&&t.start<=Math.max(0,c-1)&&t.end>=Math.min(e,u+1)?t:{end:Math.min(e,u+o),start:Math.max(0,c-o)})};l(),s.addEventListener("scroll",l,{passive:!0});const c="undefined"==typeof ResizeObserver?null:new ResizeObserver(l);return null==c||c.observe(s),()=>{s.removeEventListener("scroll",l),null==c||c.disconnect()}},[e,t,n,r,o,i]),s}function gh({horizontal:e=!1,index:t,itemSize:n,itemStride:r,leadingPx:o=0,viewport:i}){if(!i||t<0)return;const s=o+t*r,a=s+n,l=e?i.scrollLeft:i.scrollTop,c=e?i.clientWidth:i.clientHeight;let u=null;s<l?u=s:a>l+c&&(u=a-c),null!==u&&(e?i.scrollLeft=u:i.scrollTop=u)}function fh({file:e,className:t,loadPreviewImageUrl:n,pageable:r=!1,pageUrlCache:o,previewAspectRatio:i,previewClassName:s,renderFilePreview:a}){const l=dh(e),c=r&&Boolean(n),u=Math.max(l.length,c?e.previewPageCount??0:0),[d,h]=Bt.useState(0),[p,g]=Bt.useState({}),f=Math.min(d,Math.max(u-1,0)),m=l[f]??p[f]??(null==o?void 0:o.get(`${e.path}#${f}`))??null,v=e.previewAspectRatio??i,y=c&&!m&&f<u,b=Bt.useRef(e);Bt.useEffect(()=>{b.current=e}),Bt.useEffect(()=>{h(0),g({})},[e.path]),Bt.useEffect(()=>{if(!y||!n)return;let t=!0;return n(b.current,f).then(n=>{n&&(null==o||o.set(`${e.path}#${f}`,n)),t&&n&&g(e=>({...e,[f]:n}))}).catch(()=>{}),()=>{t=!1}},[f,e.path,y,n,o]);const w=m||y?null:null==a?void 0:a(e),x=r&&u>1,C=Ut.jsx(ud,{file:{name:e.name,type:e.contentType??""},className:Jt("@container",!x&&t),previewAspectRatio:v,previewClassName:Jt("bg-white dark:bg-neutral-100",s),previewImageUrl:m??void 0,isLoading:y,previewContent:m||y?void 0:w??Ut.jsx(uh,{file:e})});return x?Ut.jsxs("div",{className:Jt("group/pager relative",t),children:[C,Ut.jsxs("div",{className:"absolute inset-x-0 bottom-1.5 flex items-center justify-center gap-1 opacity-0 transition-opacity group-focus-within/pager:opacity-100 group-hover/pager:opacity-100",children:[Ut.jsx("button",{type:"button","aria-label":"Previous page",tabIndex:-1,disabled:0===f,onClick:e=>{e.stopPropagation(),h(e=>Math.max(0,e-1))},onDoubleClick:e=>e.stopPropagation(),className:"flex size-6 items-center justify-center rounded-md bg-background/80 text-foreground shadow-xs backdrop-blur-sm transition-colors outline-none hover:bg-background focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-40",children:Ut.jsx(ui,{icon:Wo,className:"size-3.5"})}),Ut.jsxs("span",{className:"rounded-md bg-background/80 px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground tabular-nums shadow-xs backdrop-blur-sm",children:[f+1,"/",u]}),Ut.jsx("button",{type:"button","aria-label":"Next page",tabIndex:-1,disabled:f>=u-1,onClick:e=>{e.stopPropagation(),h(e=>Math.min(u-1,e+1))},onDoubleClick:e=>e.stopPropagation(),className:"flex size-6 items-center justify-center rounded-md bg-background/80 text-foreground shadow-xs backdrop-blur-sm transition-colors outline-none hover:bg-background focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-40",children:Ut.jsx(ui,{icon:Go,className:"size-3.5"})})]})]}):C}const mh=[{icon:[["path",{d:"M3.88884 9.66294C4.39329 10 5.09552 10 6.49998 10C7.90445 10 8.60668 10 9.11113 9.66294C9.32951 9.51702 9.51701 9.32952 9.66292 9.11114C9.99998 8.60669 9.99998 7.90446 9.99998 6.5C9.99998 5.09554 9.99998 4.39331 9.66292 3.88886C9.51701 3.67048 9.32951 3.48298 9.11113 3.33706C8.60668 3 7.90445 3 6.49998 3C5.09552 3 4.39329 3 3.88884 3.33706C3.67046 3.48298 3.48296 3.67048 3.33705 3.88886C2.99998 4.39331 2.99998 5.09554 2.99998 6.5C2.99998 7.90446 2.99998 8.60669 3.33705 9.11114C3.48296 9.32952 3.67046 9.51702 3.88884 9.66294Z",stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}],["path",{d:"M14.8888 9.66294C15.3933 10 16.0955 10 17.5 10C18.9044 10 19.6067 10 20.1111 9.66294C20.3295 9.51702 20.517 9.32952 20.6629 9.11114C21 8.60669 21 7.90446 21 6.5C21 5.09554 21 4.39331 20.6629 3.88886C20.517 3.67048 20.3295 3.48298 20.1111 3.33706C19.6067 3 18.9044 3 17.5 3C16.0955 3 15.3933 3 14.8888 3.33706C14.6705 3.48298 14.483 3.67048 14.337 3.88886C14 4.39331 14 5.09554 14 6.5C14 7.90446 14 8.60669 14.337 9.11114C14.483 9.32952 14.6705 9.51702 14.8888 9.66294Z",stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}],["path",{d:"M3.88884 20.6629C4.39329 21 5.09552 21 6.49998 21C7.90445 21 8.60668 21 9.11113 20.6629C9.32951 20.517 9.51701 20.3295 9.66292 20.1111C9.99998 19.6067 9.99998 18.9045 9.99998 17.5C9.99998 16.0955 9.99998 15.3933 9.66292 14.8889C9.51701 14.6705 9.32951 14.483 9.11113 14.3371C8.60668 14 7.90445 14 6.49998 14C5.09552 14 4.39329 14 3.88884 14.3371C3.67046 14.483 3.48296 14.6705 3.33705 14.8889C2.99998 15.3933 2.99998 16.0955 2.99998 17.5C2.99998 18.9045 2.99998 19.6067 3.33705 20.1111C3.48296 20.3295 3.67046 20.517 3.88884 20.6629Z",stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"1.5",key:"2"}],["path",{d:"M14.8888 20.6629C15.3933 21 16.0955 21 17.5 21C18.9044 21 19.6067 21 20.1111 20.6629C20.3295 20.517 20.517 20.3295 20.6629 20.1111C21 19.6067 21 18.9045 21 17.5C21 16.0955 21 15.3933 20.6629 14.8889C20.517 14.6705 20.3295 14.483 20.1111 14.3371C19.6067 14 18.9044 14 17.5 14C16.0955 14 15.3933 14 14.8888 14.3371C14.6705 14.483 14.483 14.6705 14.337 14.8889C14 15.3933 14 16.0955 14 17.5C14 18.9045 14 19.6067 14.337 20.1111C14.483 20.3295 14.6705 20.517 14.8888 20.6629Z",stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"1.5",key:"3"}]],label:"Grid",value:"icons"},{icon:[["path",{d:"M8 5.5L20 5.5",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"1.5",key:"0"}],["path",{d:"M8 12.5L20 12.5",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"1.5",key:"1"}],["path",{d:"M8 19.5L20 19.5",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"1.5",key:"2"}],["path",{d:"M4.375 5.5H4.25M4.5 5.5C4.5 5.63807 4.38807 5.75 4.25 5.75C4.11193 5.75 4 5.63807 4 5.5C4 5.36193 4.11193 5.25 4.25 5.25C4.38807 5.25 4.5 5.36193 4.5 5.5Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"3"}],["path",{d:"M4.375 12.5H4.25M4.5 12.5C4.5 12.6381 4.38807 12.75 4.25 12.75C4.11193 12.75 4 12.6381 4 12.5C4 12.3619 4.11193 12.25 4.25 12.25C4.38807 12.25 4.5 12.3619 4.5 12.5Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"4"}],["path",{d:"M4.375 19.5H4.25M4.5 19.5C4.5 19.6381 4.38807 19.75 4.25 19.75C4.11193 19.75 4 19.6381 4 19.5C4 19.3619 4.11193 19.25 4.25 19.25C4.38807 19.25 4.5 19.3619 4.5 19.5Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"5"}]],label:"List",value:"list"},{icon:[["path",{d:"M20.1088 3.89124C21.5 5.28249 21.5 7.52166 21.5 12C21.5 16.4783 21.5 18.7175 20.1088 20.1088C18.7175 21.5 16.4783 21.5 12 21.5C7.52166 21.5 5.28249 21.5 3.89124 20.1088C2.5 18.7175 2.5 16.4783 2.5 12C2.5 7.52166 2.5 5.28249 3.89124 3.89124C5.28249 2.5 7.52166 2.5 12 2.5C16.4783 2.5 18.7175 2.5 20.1088 3.89124Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}],["path",{d:"M8.5 2.5V21.5",stroke:"currentColor",strokeWidth:"1.5",key:"1"}],["path",{d:"M15.5 2.5V21.5",stroke:"currentColor",strokeWidth:"1.5",key:"2"}]],label:"Columns",value:"columns"}];
2function vh({items:e,className:t,title:n="Files",defaultView:r="icons",view:o,onViewChange:i,defaultPath:s="",onSelectionChange:a,onFileOpen:l,getFileUrl:c,loadChildren:u,loadPreviewImageUrl:d,renderFilePreview:h,showFilters:p=!0,showSearch:g=!0,searchMode:f="client",search:m,onSearchChange:v,showSort:y=!0,loadMore:b,sortMode:w="client",sort:x,onSortChange:C,allowedSortKeys:S,isRefreshing:I=!1,errorMessage:k,onFileMove:P,onFilesUpload:D,isUploadingFiles:M=!1}){const[E,T]=Bt.useState(r),A=o??E,_="list"===A||"columns"===A||"icons"===A?A:"icons",N=Bt.useCallback(e=>{T(e),null==i||i(e)},[i]),[R,j]=Bt.useState([]),z=Bt.useMemo(()=>R.length?[...e,...R]:e,[e,R]),L=Bt.useMemo(()=>function(e,t){const n=new Map,r=new Map,o=e=>{let t=dd(e);for(;t&&!n.has(t);)n.set(t,{kind:"folder",name:hd(t),parentPath:vd(t),path:t}),t=vd(t)};for(const l of e)if("folder"===l.kind){const e=dd(l.path);if(!e)continue;n.set(e,{...l,name:l.name??hd(e),parentPath:dd(l.parentPath??vd(e)),path:e}),o(vd(e))}else{if(!l.path)continue;r.set(l.path,{...l,key:l.key??l.path,name:l.name??hd(l.path),parentPath:dd(l.parentPath??vd(l.path))}),o(vd(l.path))}const i=new Map,s=e=>{const t=i.get(e.parentPath);t?t.push(e):i.set(e.parentPath,[e])};for(const l of n.values())s(l);for(const l of r.values())s(l);if(!(null==t?void 0:t.preserveChildOrder))for(const l of i.values())l.sort(Od);const a=[...n.values()].sort((e,t)=>t.path.length-e.path.length);for(const l of a){if(l.updatedAt)continue;let e,t=Number.NEGATIVE_INFINITY;for(const n of i.get(l.path)??[]){const r=n.updatedAt??n.createdAt,o=r?Date.parse(r):Number.NaN;!Number.isNaN(o)&&o>t&&(t=o,e=r)}e&&(l.updatedAt=e)}return{children:i,files:r,folders:n}}(z,{preserveChildOrder:"server"===w}),[z,w]),[$,F]=Bt.useState(()=>({index:0,stack:[dd(s)]})),O=$.stack[$.index]??"",H=$.index>0,q=$.index<$.stack.length-1,[V,B]=Bt.useState(null),U=Bt.useMemo(()=>null===V?null:L.files.get(V)??L.folders.get(V)??null,[L,V]),[W,G]=Bt.useState(""),Z=Bt.useRef(null),[K,Y]=Bt.useState(!1),X="server"===f,Q=X?m??"":W,J=Bt.useCallback(e=>{X?null==v||v(e):G(e)},[X,v]),ee=hh(Q),te=X?"":ee,ne=X?"":md(Q),re=te&&(te!==ne||te.includes("/")||te.includes(pd))?"":ne,oe=ee.length>0,ie=te.length>0,[se,ae]=Bt.useState(qd),le="server"===w,ce=le?x??qd:se,[ue,de]=Bt.useState([]),he=ue.length>0,pe=Bt.useMemo(()=>p&&0!==ue.length?e=>ue.every(t=>Qd(e,t)):null,[ue,p]),ge=Bt.useMemo(()=>{if(!ie&&!pe)return null;const e=new Set,t=t=>{for(;t&&t!==O&&!e.has(t);)e.add(t),t=vd(t)},n=e=>{if(!ie)return!0;const t=e.slice(O.length),n=hh(t),r=md(fd(t)),o=r.replaceAll(pd,"/");return n.includes(te)||r.includes(ne)||o.includes(te)||o.includes(ne)};for(const[r,o]of L.files)r!==O&&(O&&!r.startsWith(O)||n(r)&&(pe&&!pe(o)||t(r)));if(!pe)for(const r of L.folders.keys())r!==O&&(O&&!r.startsWith(O)||n(r)&&t(r));return e},[O,pe,L,ie,ne,te]),fe=Bt.useMemo(()=>{if(!ge)return L;const e=new Map;for(const[t,n]of L.children){const r=n.filter(e=>ge.has(e.path));r.length&&e.set(t,r)}return{...L,children:e}},[L,ge]),me=Bt.useMemo(()=>{if(le)return fe;if(ce.key===qd.key&&ce.direction===qd.direction)return fe;const e=new Map;for(const[t,n]of fe.children)e.set(t,[...n].sort((e,t)=>Ud(e,t,ce)));return{...fe,children:e}},[le,ce,fe]),ve=Bt.useRef(null),ye=Bt.useCallback(e=>{const t=(null==e?void 0:e.path)??null;ve.current!==t&&(ve.current=t,B(t),null==a||a(e))},[a]);Bt.useEffect(()=>{ge&&V&&(ge.has(V)||ye(null))},[ye,V,ge]);const be=Bt.useCallback(e=>{if(le){if(ce.key===e)return;null==C||C({direction:ce.direction,key:e})}else ae(t=>t.key===e?t:{direction:Vd(e),key:e})},[le,C,ce.direction,ce.key]),we=Bt.useCallback(e=>{ce.direction!==e&&(le?null==C||C({direction:e,key:ce.key}):ae(t=>({...t,direction:e})))},[le,C,ce.direction,ce.key]),xe=Bt.useCallback(e=>{le?null==C||C({direction:ce.key===e?"asc"===ce.direction?"desc":"asc":ce.direction,key:e}):ae(t=>t.key===e?{direction:"asc"===t.direction?"desc":"asc",key:e}:{direction:Vd(e),key:e})},[le,C,ce.direction,ce.key]),Ce=Bt.useMemo(()=>{const e=new Map;for(const t of L.files.values()){const n=Rd(t);if(!e.has(n)){const r=t.name.lastIndexOf("."),o=r>0?t.name.slice(r+1).toLowerCase():"";e.set(n,{group:jd(n),iconFileName:o?`file.${o}`:t.name,label:Nd[n]??n,mime:n})}}return[...e.values()].sort((e,t)=>
2e.label.localeCompare(t.label))},[L]),Se=Bt.useRef(0),[Ie,ke]=Bt.useState(null),Pe=Bt.useCallback((e,t)=>{const n="filter-"+ ++Se.current;de(r=>{const o=r.find(e=>"fileType"===e.type);if(!o)return t?[...r,{id:n,operator:"is",type:"fileType",value:[e]}]:r;const i=t?[...new Set([...o.value,e])]:o.value.filter(t=>t!==e);if(0===i.length)return r.filter(e=>e!==o);const s="is"===o.operator||"is-any-of"===o.operator?i.length>1?"is-any-of":"is":o.operator;return r.map(e=>e===o?{...e,operator:s,value:i}:e)})},[]),De=Bt.useCallback((e,t)=>{const n="filter-"+ ++Se.current;de(r=>[...r.filter(t=>t.type!==e),{id:n,operator:"after",type:e,value:[t]}])},[]),Me=Bt.useCallback(e=>{const t=ue.find(t=>t.type===e);ke({initialRange:t&&Yd(t.value)?{from:new Date(t.value[0]),to:new Date(t.value[1])}:void 0,type:e})},[ue]),Ee=Bt.useCallback((e,t,n)=>{const r="filter-"+ ++Se.current;de(o=>{const i=o.find(t=>t.type===e);return[...o.filter(t=>t.type!==e),{id:r,operator:"not-in-range"===(null==i?void 0:i.operator)?"not-in-range":"in-range",type:e,value:[t.toISOString(),n.toISOString()]}]})},[]),Te=Bt.useRef(null),[Ae,_e]=Bt.useState("full"),[Ne,Re]=Bt.useState(!1);Bt.useEffect(()=>{const e=Te.current;if(!e||"undefined"==typeof ResizeObserver)return;const t=e=>{void 0!==e&&(_e(e<360?"minimal":e<560?"compact":"full"),Re(e<768))},n=new ResizeObserver(e=>{var n;return t(null==(n=e[0])?void 0:n.contentRect.width)});return t(e.clientWidth),n.observe(e),()=>n.disconnect()},[]);const je=Bt.useRef(new Set),[ze,Le]=Bt.useState(()=>new Set),$e=Bt.useCallback(e=>{var t;if(!u)return;const n=L.folders.get(e);(null==n?void 0:n.hasChildren)&&((null==(t=L.children.get(e))?void 0:t.length)||je.current.has(e)||(je.current.add(e),Le(t=>new Set(t).add(e)),(async()=>{try{let t=null;do{const n=await u({cursor:t,path:e});n.items.length&&j(e=>[...e,...n.items]),t=n.nextCursor??null}while(t)}catch{je.current.delete(e)}finally{Le(t=>{const n=new Set(t);return n.delete(e),n})}})()))},[L,u]),Fe=Bt.useCallback(e=>{const t=dd(e);F(e=>{if(e.stack[e.index]===t)return e;const n=[...e.stack.slice(0,e.index+1),t];return{index:n.length-1,stack:n}}),J(""),ye(null),$e(t)},[$e,ye,J]);Bt.useEffect(()=>{$e(O)},[O,$e]);const Oe=Bt.useRef(O);Bt.useEffect(()=>{if(Oe.current===O)return;Oe.current=O;const e=Te.current;e&&document.activeElement===document.body&&e.focus({preventScroll:!0})},[O]);const[He]=Bt.useState(()=>new Map),[qe]=Bt.useState(()=>new Map),Ve=Bt.useCallback(e=>{l?l(e,e.url??He.get(e.path)??null):(async()=>{let t=e.url??He.get(e.path)??null;if(!t&&c)try{t=await c(e),t&&He.set(e.path,t)}catch{t=null}t&&"undefined"!=typeof window&&window.open(t,"_blank","noopener,noreferrer")})()},[c,l,He]),Be=Bt.useCallback(e=>{"folder"===e.kind?Fe(e.path):Ve(e)},[Fe,Ve]),Ue=Id(D),We=Bt.useRef(null),Ge="folder"===(null==U?void 0:U.kind)?U.path:O,Ze=Bt.useCallback(e=>{D&&0!==e.length&&!M&&D({files:e,targetFolderPath:bd(Ge)})},[M,D,Ge]),Ke=Bt.useCallback(e=>{ye(e),"folder"===(null==e?void 0:e.kind)&&$e(e.path)},[$e,ye]),Ye=Bt.useCallback(()=>{F(e=>({...e,index:Math.max(0,e.index-1)})),J(""),ye(null)},[ye,J]),Xe=Bt.useCallback(()=>{F(e=>({...e,index:Math.min(e.stack.length-1,e.index+1)})),J(""),ye(null)},[ye,J]),Qe=me.children.get(O)??[],Je=""===O?n:hd(O)||n,et=""===Ge?n:hd(Ge)||n,tt=ze.has(O),nt=Bt.useRef(new Map),rt={currentPath:O,entries:Qe,fileFilter:pe,getFileUrl:c,index:me,loadPreviewImageUrl:d,loadingFolders:ze,onOpen:Be,onSelect:Ke,onSortColumnClick:xe,pageUrlCache:qe,renderFilePreview:h,revealFilteredTreePaths:null!==pe||ie&&0===re.length,treeSearchQuery:re,selectedEntry:U,selectedPath:V,sort:ce,treeExpansionRef:nt,loadMore:b,showSort:y,preserveItemOrder:le,onFileMove:P,onFilesUpload:D},ot=mh.find(e=>e.value===_);return Ut.jsxs("div",{ref:Te,tabIndex:-1,"data-slot":"file-system",onKeyDown:e=>{var t;g&&(e.metaKey||e.ctrlKey)&&"f"===e.key&&(e.preventDefault(),Y(!0),null==(t=Z.current)||t.focus())},className:Jt("flex h-[480px] min-h-0 flex-col overflow-hidden rounded-xl border bg-background text-foreground outline-none",t),children:[Ut.jsx(lh,{}),D?Ut.jsx("input",{ref:We,type:"file",multiple:!0,className:"hidden",onChange:e=>{Ze(Array.from(e.currentTarget.files??[])),e.currentTarget.value=""}}):null,Ut.jsxs("div",{className:"relative grid h-12 shrink-0 grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center gap-2 border-b bg-muted/40 px-2",children:[Ut.jsxs("div",{className:"flex min-w-0 items-center gap-0.5",children:[Ut.jsx("button",{type:"button","aria-label":"Back",title:"Back",disabled:!H,onClick:Ye,className:"flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors outline-none hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-40",children:Ut.jsx(ui,{icon:Wo,className:"size-4.5"})}),Ut.jsx("button",{type:"button","aria-label":"Forward",title:"Forward",disabled:!q,onClick:Xe,className:"flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors outline-none hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-40",children:Ut.jsx(ui,{icon:Go,className:"size-4.5"})}),"minimal"!==Ae?Ut.jsx("span",{className:"ml-1.5 truncate text-sm font-semibold",children:Je}):null]}),"full"!==Ae||Ne?Ut.jsxs(Dn,{value:_,onValueChange:e=>N(e),children:[Ut.jsx(Mn,{size:"sm","aria-label":"View",className:"h-7 min-h-7 w-auto min-w-0 [&_svg]:size-4",children:Ut.jsx(En,{children:ot?Ut.jsx(ui,{icon:ot.icon,
2className:"size-4"}):null})}),Ut.jsx(Tn,{align:"center",children:mh.map(e=>Ut.jsx(An,{value:e.value,children:Ut.jsxs("span",{className:"flex items-center gap-2",children:[Ut.jsx(ui,{icon:e.icon,className:"size-4"}),e.label]})},e.value))})]}):Ut.jsx(No,{value:_,onValueChange:e=>N(e),className:"gap-0",children:Ut.jsx(Ro,{className:"h-8 p-0.5",children:mh.map(e=>Ut.jsx(jo,{value:e.value,"aria-label":`${e.label} view`,title:e.label,className:"h-7 grow-0 px-2.5 sm:h-7",children:Ut.jsx(ui,{icon:e.icon,className:"size-4"})},e.value))})}),Ut.jsxs("div",{className:"flex min-w-0 items-center justify-end gap-1",children:[D?Ut.jsx(en,{type:"button",variant:"outline",size:"icon-sm","aria-label":`Upload files to ${et}`,title:`Upload to ${et}`,disabled:M,onClick:()=>{var e;return null==(e=We.current)?void 0:e.click()},className:"relative size-7 sm:size-7",children:M?Ut.jsx(or,{className:"size-4"}):Ut.jsx(ui,{icon:li,className:"size-4"})}):null,y?Ut.jsx(xh,{allowedSortKeys:S,onSortDirectionChange:we,onSortKeyChange:be,sort:ce}):null,p?Ut.jsx(Sh,{fileTypeOptions:Ce,filters:ue,onOpenCustomRange:Me,onSelectDatePreset:De,onToggleFileType:Pe}):null,g?Ut.jsx(bh,{inputRef:Z,isExpanded:K,layout:Ae,onExpandedChange:Y,onValueChange:J,value:Q}):null]})]}),p&&he?Ut.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-1 border-b bg-muted/20 px-2 py-1.5 text-xs text-muted-foreground",children:[ue.map(e=>{const t="fileType"===e.type?null:e.type;return Ut.jsx(Ph,{fileTypeOptions:Ce,filter:e,onOpenCustomRange:t?()=>Me(t):void 0,onOperatorChange:t=>de(n=>n.map(n=>n.id===e.id?{...n,operator:t}:n)),onRemove:()=>de(t=>t.filter(t=>t.id!==e.id)),onSelectDatePreset:t=>de(n=>n.map(n=>n.id===e.id?{...n,operator:"before"===n.operator||"after"===n.operator?n.operator:"after",value:[t]}:n)),onToggleFileType:Pe},e.id)}),Ut.jsx("button",{type:"button",onClick:()=>de([]),className:"rounded-md px-1.5 py-0.5 transition-colors outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:"Clear"})]}):null,Ut.jsxs("div",{className:"relative min-h-0 flex-1",...Ue.viewportUploadProps(O),children:[k?Ut.jsx("div",{role:"alert",className:"absolute inset-x-0 top-0 z-20 border-b border-destructive/30 bg-destructive/10 px-4 py-2 text-center text-sm text-destructive",children:k}):null,M?Ut.jsxs("div",{"aria-live":"polite",className:"pointer-events-none absolute inset-x-0 top-0 z-20 flex items-center justify-center gap-2 border-b bg-background/95 px-4 py-1.5 text-sm text-muted-foreground backdrop-blur-sm",children:[Ut.jsx(or,{className:"size-4"}),"Uploading to ",et,"â¦"]}):I?Ut.jsxs("div",{"aria-live":"polite",className:"pointer-events-none absolute inset-x-0 top-0 z-20 flex items-center justify-center gap-2 border-b bg-background/95 px-4 py-1.5 text-sm text-muted-foreground backdrop-blur-sm",children:[Ut.jsx(or,{className:"size-4"}),"Refreshingâ¦"]}):null,M&&0===Qe.length?Ut.jsx(zh,{label:`Uploading to ${et}â¦`,isLoading:!0}):tt&&0===Qe.length?Ut.jsx(zh,{label:"Loadingâ¦",isLoading:!0}):0===Qe.length&&("columns"!==_||oe||he)?Ut.jsx(zh,{label:oe?`No results for â${Q.trim()}â`:he?"No items match the active filters":"This folder is empty"}):"icons"===_?Ut.jsx(Gh,{...rt}):"list"===_?Ut.jsx(Kh,{...rt}):Ut.jsx(Qh,{...rt})]}),Ut.jsxs("div",{"aria-live":"polite",className:"flex h-7 shrink-0 items-center justify-center gap-1 border-t bg-muted/40 px-3 text-xs text-muted-foreground",children:[Ut.jsxs("span",{children:[Qe.length," ",oe?1===Qe.length?"result":"results":1===Qe.length?"item":"items"]}),U?Ut.jsxs("span",{children:["· â",U.name,"â selected"]}):null]}),Ie?Ut.jsx(Nh,{initialRange:Ie.initialRange,onApply:(e,t)=>{Ee(Ie.type,e,t),ke(null)},onClose:()=>ke(null)}):null]})}const yh="flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors outline-none hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring";function bh({inputRef:e,isExpanded:t,layout:n,onExpandedChange:r,onValueChange:o,value:i}){const s="full"===n;Bt.useEffect(()=>{var n;!s&&t&&(null==(n=e.current)||n.focus())},[e,t,s]);const a=Ut.jsxs("div",{className:Jt("relative flex h-7 min-w-0 flex-1 items-center rounded-lg border border-input bg-popover text-sm text-foreground shadow-xs/5 transition-shadow outline-none not-dark:bg-clip-padding before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-focus-within:before:shadow-[0_1px_--theme(--color-black/4%)] focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-1 focus-within:ring-offset-background dark:bg-input/32 dark:not-focus-within:before:shadow-[0_-1px_--theme(--color-white/6%)]",s&&"max-w-56"),children:[Ut.jsx(ui,{icon:ii,className:"pointer-events-none absolute left-2 size-3.5 text-muted-foreground"}),Ut.jsx("input",{ref:e,type:"text",role:"searchbox","aria-label":"Search f
2iles",placeholder:"Search",value:i,onChange:e=>o(e.target.value),onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),i?o(""):(r(!1),e.currentTarget.blur()))},className:"h-full w-full min-w-0 rounded-[inherit] bg-transparent pr-6 pl-7 outline-none placeholder:text-muted-foreground"}),i?Ut.jsx("button",{type:"button","aria-label":"Clear search",onClick:()=>{var t;o(""),null==(t=e.current)||t.focus()},className:"absolute right-1 flex size-5 items-center justify-center rounded-sm text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:Ut.jsx(ui,{icon:Yo,className:"size-3"})}):null]});return s?Ut.jsx("div",{className:"flex w-56 min-w-32 items-center",children:a}):Ut.jsxs(Vn,{open:t,onOpenChange:r,children:[Ut.jsxs(Bn,{render:Ut.jsx("button",{type:"button","aria-label":"Search",title:"Search",className:Jt(yh,"relative")}),children:[Ut.jsx(ui,{icon:ii,className:"size-4"}),i?Ut.jsx("span",{className:"absolute top-1 right-1 size-1.5 rounded-full bg-primary"}):null]}),Ut.jsx(Un,{align:"end",sideOffset:6,className:"w-64 p-1",children:a})]})}const wh=[{label:"Ascending",value:"asc"},{label:"Descending",value:"desc"}];function xh({allowedSortKeys:e,onSortDirectionChange:t,onSortKeyChange:n,sort:r}){const o=e?Hd.filter(t=>e.includes(t.key)):Hd;return Ut.jsxs(_n,{children:[Ut.jsx(Nn,{render:Ut.jsx("button",{type:"button","aria-label":"More options",title:"More options",className:yh}),children:Ut.jsx(ui,{icon:ni,className:"size-4"})}),Ut.jsxs(Rn,{align:"end",className:"w-48",children:[Ut.jsx(jn,{children:"Sort by"}),Ut.jsx(zn,{value:r.key,onValueChange:e=>n(e),children:o.map(e=>Ut.jsx(Ln,{value:e.key,children:e.label},e.key))}),Ut.jsx($n,{}),Ut.jsx(jn,{children:"Order"}),Ut.jsx(zn,{value:r.direction,onValueChange:e=>t(e),children:wh.map(e=>Ut.jsx(Ln,{value:e.value,children:Ut.jsxs("span",{className:"flex items-center gap-2",children:[Ut.jsx(ui,{icon:"asc"===e.value?Zo:Uo,className:"size-4"}),e.label]})},e.value))})]})]})}function Ch({checkedMimes:e,onToggle:t,options:n}){const r=Bt.useRef(null);return Bt.useEffect(()=>{const e=requestAnimationFrame(()=>{var e;return null==(e=r.current)?void 0:e.focus()});return()=>cancelAnimationFrame(e)},[]),Ut.jsxs(ro,{className:"-m-1 h-auto max-h-72 w-[calc(100%+--spacing(2))] bg-transparent",onKeyDown:e=>{"Escape"!==e.key&&"Tab"!==e.key&&e.stopPropagation()},children:[Ut.jsx(oo,{ref:r,placeholder:"Search file typesâ¦",className:"h-9"}),Ut.jsxs(io,{className:"max-h-none",children:[Ut.jsx(so,{children:"No file types found."}),Ut.jsx(Qn,{orientation:"vertical",className:"h-auto max-h-64",children:Wd.map(r=>{const o=n.filter(e=>e.group===r);return 0===o.length?null:Ut.jsx(ao,{heading:r,children:o.map(n=>{const r=e.includes(n.mime);return Ut.jsxs(lo,{value:n.label,keywords:[n.mime],onSelect:()=>t(n.mime,!r),children:[Ut.jsx(ui,{icon:ai,className:Jt("size-4 text-foreground",!r&&"opacity-0")}),Ut.jsx(ch,{fileName:n.iconFileName,className:"size-4"}),n.label]},n.mime)})},r)})})]})]})}function Sh({fileTypeOptions:e,filters:t,onOpenCustomRange:n,onSelectDatePreset:r,onToggleFileType:o}){const i=t.find(e=>"fileType"===e.type);return Ut.jsxs(_n,{children:[Ut.jsxs(Nn,{render:Ut.jsx(en,{type:"button",variant:"outline",size:"icon-sm","aria-label":"Filter",title:"Filter",className:"relative size-7 sm:size-7"}),children:[Ut.jsx(ui,{icon:Jo,className:"size-4"}),t.length>0?Ut.jsx("span",{className:"absolute top-1 right-1 size-1.5 rounded-full bg-primary"}):null]}),Ut.jsxs(Rn,{align:"end",className:"min-w-44",children:[Ut.jsxs(Fn,{children:[Ut.jsxs(On,{children:[Ut.jsx(ui,{icon:Qo,className:"size-4 text-muted-foreground"}),"File type"]}),Ut.jsx(Hn,{className:"w-60",children:Ut.jsx(Ch,{checkedMimes:(null==i?void 0:i.value)??[],onToggle:o,options:e})})]}),["dateModified","dateCreated"].map(e=>Ut.jsxs(Fn,{children:[Ut.jsxs(On,{children:[Ut.jsx(ui,{icon:Ko,className:"size-4 text-muted-foreground"}),Gd[e]]}),Ut.jsx(Hn,{children:Ut.jsxs(Qn,{orientation:"vertical",className:"h-auto max-h-72",children:[Kd.map(t=>Ut.jsx(qn,{onClick:()=>r(e,t),children:t},t)),Ut.jsx(qn,{onClick:()=>n(e),children:"Custom date rangeâ¦"})]})})]},e))]})]})}const Ih="flex h-5 items-center gap-1 border border-l-0 bg-background px-1.5 whitespace-nowrap text-foreground",kh=Jt(Ih,"transition-colors outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring");function Ph({fileTypeOptions:e,filter:t,onOpenCustomRange:n,onOperatorChange:r,onRemove:o,onSelectDatePreset:i,onToggleFileType:s}){const a="fileType"!==t.type&&Yd(t.value),l="fileType"===t.type?t.value.map(t=>{var n;return(null==(n=e.find(e=>e.mime===t))?void 0:n.label)??t}):[];return Ut.jsxs("div",{className:"flex items-center text-xs",children:[Ut.jsxs("span",{className:Jt(Ih,"rounded-l-md border-l text-primary"),children:[Ut.jsx(ui,{icon:"fileType"===t.type?Qo:Ko,className:"size-3"}),Gd[t.type]]}),Ut.jsxs(_n,{children:[Ut.jsx(Nn,{render:Ut.jsx("button",{type:"button",className:Jt(kh,"text-primary")}),children:Zd[t.operator]}),Ut.jsx(Rn,{align:"start",className:"min-w-28",children:Xd(t).map(e=>Ut.jsx(qn,{onClick:()=>r(e),children:Zd[e]},e))})]}),"fileType"===t.type?Ut.jsxs(_n,{children:[Ut.jsx(Nn,{render:Ut.jsx("button",{type:"button",title:l.join(", "),className:kh}),children:1===t.value.length?l[0]:`${t.value.length} selected`}),Ut.jsx(Rn,{align:"start",className:"w-60",children:Ut.jsx(Ch,{checkedMimes:t.value,onToggle:s,options:e})})]}):a?Ut.jsx("button",{type:"button",onClick:n,className:kh,children:t.value.map(e=>new Date(e).toLocaleDateString("en-US")).join(" â ")}):Ut.jsxs(_n,{children:[Ut.jsx(Nn,{render:Ut.jsx("button",{type:"button",className:kh}),children:t.value[0]}),Ut.jsx(Rn,{align:"start",children:Ut.jsxs(Qn,{orientation:"vertical",className:"h-auto max-h-72",children:[Kd.map(e=>Ut.jsx(qn,{onClick:()=>i(e),children:e},e)),Ut.jsx(qn,{onClick:n,children:"Custom date rangeâ¦"})]})})]}),Ut.jsx("button",{type:"button","aria-label":`Remove ${Gd[t.type]} filter`,onClick:o,className:Jt(kh,"rounded-r-md px-1 text-muted-foreground hover:text-foreground"),children:Ut.jsx(ui,{icon:Yo,className:"size-3"})})]})}function Dh(e){if(!e)return"";const t=e=>String(e).padStart(2,"0");return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}function Mh(e){const t=e.trim();if(!t)return;const n=/^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(t);if(n){const e=new Date(Number(n[1]),Number(n[2])-1,Number(n[3]));return Number.isNaN(e.getTime())?void 0:e}const r=Date.parse(t);return Number.isNaN(r)?void 0:new Date(r)}const Eh=["Last 7 days","This month","Last 1 month","Last 3 months","This year","Last 12 months"];const Th=["Su","Mo","Tu","We","Th","Fr","Sa"];function Ah(e){return 1e4*e.getFullYear()+100*e.getMonth()+e.getDate()}function _h({onSelect:e,range:t}){const[n,r]=Bt.useState(()=>{const e=t.from??new Date;return new Date(e.getFullYear(),e.getMonth(),1)}
2),o=[n,new Date(n.getFullYear(),n.getMonth()+1,1)],i=t.from?Ah(t.from):null,s=t.to?Ah(t.to):null,a=Ah(new Date);return Ut.jsxs("div",{className:"relative",children:[Ut.jsx("button",{type:"button","aria-label":"Previous month",onClick:()=>r(e=>new Date(e.getFullYear(),e.getMonth()-1,1)),className:"absolute top-0 left-0 flex size-6 items-center justify-center rounded-md text-muted-foreground transition-colors outline-none hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:Ut.jsx(ui,{icon:Wo,className:"size-4"})}),Ut.jsx("button",{type:"button","aria-label":"Next month",onClick:()=>r(e=>new Date(e.getFullYear(),e.getMonth()+1,1)),className:"absolute top-0 right-0 flex size-6 items-center justify-center rounded-md text-muted-foreground transition-colors outline-none hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:Ut.jsx(ui,{icon:Go,className:"size-4"})}),Ut.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:o.map((n,r)=>{const o=n.getDay(),l=new Date(n.getFullYear(),n.getMonth()+1,0).getDate(),c=[...Array.from({length:o},()=>null),...Array.from({length:l},(e,t)=>new Date(n.getFullYear(),n.getMonth(),t+1))];return Ut.jsxs("div",{className:Jt(1===r&&"max-sm:hidden"),children:[Ut.jsx("div",{className:"text-center text-sm leading-6 font-medium",children:n.toLocaleDateString("en-US",{month:"long",year:"numeric"})}),Ut.jsx("div",{className:"mt-1 grid grid-cols-7 text-center text-xs text-muted-foreground",children:Th.map(e=>Ut.jsx("span",{className:"h-6 leading-6",children:e},e))}),Ut.jsx("div",{className:"grid grid-cols-7 gap-y-px",children:c.map((n,r)=>{if(!n)return Ut.jsx("span",{},r);const o=Ah(n),l=o===i,c=o===s,u=null!==i&&null!==s&&o>i&&o<s;return Ut.jsx("button",{type:"button",onClick:()=>(n=>{!t.from||t.to?e({from:n}):Ah(n)<Ah(t.from)?e({from:n,to:t.from}):e({from:t.from,to:n})})(n),className:Jt("flex h-7 items-center justify-center rounded-md text-xs tabular-nums transition-colors outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring",u&&"rounded-none bg-accent",(l||c)&&"bg-primary text-primary-foreground hover:bg-primary",l&&null!==s&&i!==s&&"rounded-r-none",c&&i!==s&&"rounded-l-none",o===a&&!l&&!c&&"font-semibold text-primary"),children:n.getDate()},r)})})]},`${n.getFullYear()}-${n.getMonth()}`)})})]})}function Nh({initialRange:e,onApply:t,onClose:n}){const[r,o]=Bt.useState(()=>e??{}),[i,s]=Bt.useState(()=>Dh(null==e?void 0:e.from)),[a,l]=Bt.useState(()=>Dh(null==e?void 0:e.to)),c=e=>{o(e),e.from&&s(Dh(e.from)),e.to&&l(Dh(e.to))},u=(e,t,n)=>Ut.jsxs("div",{className:"flex flex-1 flex-col gap-1.5",children:[Ut.jsx("span",{className:"text-xs font-medium",children:e}),Ut.jsxs("div",{className:"relative flex items-center",children:[Ut.jsx(ui,{icon:Ko,className:"pointer-events-none absolute left-2.5 size-3.5 text-muted-foreground"}),Ut.jsx(Wn,{type:"text",value:t,placeholder:"YYYY-MM-DD","aria-label":`${e} date`,onChange:e=>n(e.target.value),className:"h-8 pl-8 sm:h-8"})]})]});return Ut.jsx(sn,{open:!0,onOpenChange:e=>{e||n()},children:Ut.jsxs(an,{className:"w-[30rem] max-w-[calc(100vw-2rem)]",children:[Ut.jsx(ln,{children:Ut.jsx(cn,{children:"Custom date range"})}),Ut.jsxs(un,{className:"flex flex-col gap-4",children:[Ut.jsxs("div",{className:"flex gap-3",children:[u("From",i,e=>{s(e);const t=Mh(e);t&&o(e=>({...e,from:t}))}),u("To",a,e=>{l(e);const t=Mh(e);t&&o(e=>({...e,to:t}))})]}),Ut.jsx(_h,{range:r,onSelect:c}
2),Ut.jsx("div",{className:"grid grid-cols-3 gap-2",children:Eh.map(e=>Ut.jsx(en,{type:"button",variant:"outline",size:"sm",onClick:()=>c(function(e){const t=new Date,n=new Date;switch(t.setHours(0,0,0,0),n.setHours(23,59,59,999),e){case"Last 7 days":t.setDate(t.getDate()-6);break;case"This month":t.setDate(1);break;case"Last 1 month":t.setMonth(t.getMonth()-1);break;case"Last 3 months":t.setMonth(t.getMonth()-3);break;case"This year":t.setMonth(0,1);break;case"Last 12 months":t.setFullYear(t.getFullYear()-1)}return{from:t,to:n}}(e)),children:e},e))})]}),Ut.jsxs(dn,{children:[Ut.jsx(en,{type:"button",variant:"outline",onClick:n,children:"Cancel"}),Ut.jsx(en,{type:"button",disabled:!r.from||!r.to,onClick:()=>{if(!r.from||!r.to)return;const e=new Date(r.from),n=new Date(r.to);e.setHours(0,0,0,0),n.setHours(23,59,59,999),t(e,n)},children:"Apply"})]})]})})}function Rh(e,t){return""===t&&null!=e&&(e.hasNextPage||e.isFetchingNextPage)}function jh({rootRef:e,loadMore:t}){const n=Bt.useRef(null),{hasNextPage:r,isFetchingNextPage:o,onLoadMore:i}=t;return Bt.useEffect(()=>{if(!r)return;const t=n.current;if(!t)return;const s=new IntersectionObserver(e=>{var t;(null==(t=e[0])?void 0:t.isIntersecting)&&!o&&i()},{root:e.current,threshold:.1});return s.observe(t),()=>s.disconnect()},[r,o,i,e]),Ut.jsx("div",{ref:n,className:"flex min-h-px items-center justify-center py-2","aria-hidden":!t.isFetchingNextPage,children:t.isFetchingNextPage?Ut.jsx(or,{className:"size-4 text-muted-foreground"}):null})}function zh({label:e,isLoading:t=!1}){return Ut.jsx("div",{className:Jt("flex size-full items-center justify-center text-sm text-muted-foreground",t&&"animate-pulse motion-reduce:animate-none"),children:e})}const Lh=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp"]),$h=700;function Fh(e){return 1===e.key.length&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.altKey&&!e.ctrlKey&&!e.metaKey}function Oh(){const e=Bt.useRef({buffer:"",timeout:0});return Bt.useEffect(()=>{const t=e.current;return()=>window.clearTimeout(t.timeout)},[]),Bt.useCallback((t,n,r)=>{if(!Fh(t)||0===n.length)return null;const o=t.target;if(o instanceof HTMLElement&&(o.isContentEditable||"INPUT"===o.tagName||"TEXTAREA"===o.tagName||"SELECT"===o.tagName))return null;const i=e.current;window.clearTimeout(i.timeout),i.timeout=window.setTimeout(()=>{i.buffer=""},$h),i.buffer+=t.key.toLowerCase();const s=r<0?0:r+(1===i.buffer.length?1:0);for(let e=0;e<n.length;e+=1){const r=n[(s+e)%n.length];if(r.name.toLowerCase().startsWith(i.buffer))return t.preventDefault(),r}return t.preventDefault(),null},[])}const Hh=12,qh=104,Vh=4,Bh=102,Uh=12,Wh=Bh+Uh;function Gh({currentPath:e,entries:t,index:n,loadMore:r,onFileMove:o,onFilesUpload:i,onOpen:s,onSelect:a,renderFilePreview:l,selectedPath:c}){var u;const d=Bt.useRef(new Map),h=Bt.useRef(null),p=Oh(),g=Cd(o,n),f=Id(i),[m,v]=Bt.useState(null);Bt.useLayoutEffect(()=>{const e=h.current;if(!e||"undefined"==typeof ResizeObserver)return;const t=()=>{const t=e.clientWidth-2*Hh;v(Math.max(1,Math.floor((t+Vh)/(qh+Vh))))},n=new ResizeObserver(t);return t(),n.observe(e),()=>n.disconnect()},[]);const y=m??1,b=Math.ceil(t.length/y),{end:w,start:x}=ph({count:b,itemStride:Wh,leadingPx:Hh,overscan:4,viewportRef:h}),C=t.slice(x*y,w*y);Bt.useLayoutEffect(()=>{if(!c)return;const e=t.findIndex(e=>e.path===c);-1!==e&&gh({index:Math.floor(e/y),itemSize:Bh,itemStride:Wh,leadingPx:Hh,viewport:h.current})},[t,y,c]);const S=C.some(e=>e.path===c)?c:(null==(u=C[0])?void 0:u.path)??null;return Ut.jsxs(Qn,{orientation:"vertical",viewportRef:h,viewportClassName:"p-3",viewportProps:{onClick:e=>{e.target===e.currentTarget&&a(null)},...Pd(g.viewportMoveProps(e),f.viewportUploadProps(e))},children:[Ut.jsx("div",{className:"relative",style:{height:null!==m&&b?b*Wh-Uh:void 0},children:Ut.jsx("div",{role:"listbox","aria-label":"Files",className:"absolute inset-x-0 grid gap-x-1 gap-y-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(6.5rem, 1fr))",top:x*Wh},onKeyDown:e=>{if(!Lh.has(e.key)){const n=p(e,t,t.findIndex(e=>e.path===c));return void(n&&(a(n),requestAnimationFrame(()=>{var e;
2return null==(e=d.current.get(n.path))?void 0:e.focus()})))}(function({entries:e,itemRefs:t,key:n,onSelect:r,selectedPath:o}){var i,s;if(0===e.length)return!1;const a=e.findIndex(e=>e.path===o);let l;if(-1===a)l=e[0];else if("ArrowLeft"===n||"ArrowRight"===n)l=e[a+("ArrowLeft"===n?-1:1)];else{const r=t.get(e[a].path);if(!r)return!1;const s=r.getBoundingClientRect();let c=1/0;for(const a of e){if(a.path===o)continue;const e=null==(i=t.get(a.path))?void 0:i.getBoundingClientRect();if(!e)continue;const r="ArrowDown"===n?e.top-s.top:s.top-e.top;if(r<=1)continue;const u=1e3*r+Math.abs(e.left-s.left);u<c&&(c=u,l=a)}}return!!l&&(r(l),null==(s=t.get(l.path))||s.focus(),!0)})({entries:t,itemRefs:d.current,key:e.key,onSelect:a,selectedPath:c})&&e.preventDefault()},children:C.map(e=>{const t=e.path===c,n=Pd(g.bindEntry(e),f.bindEntry(e));return Ut.jsxs("button",{type:"button",role:"option","aria-selected":t,tabIndex:e.path===S?0:-1,ref:t=>{t?d.current.set(e.path,t):d.current.delete(e.path)},onClick:()=>a(e),onDoubleClick:()=>s(e),...n,onKeyDown:t=>{"Enter"===t.key&&s(e)},className:Jt("group flex h-[6.375rem] flex-col items-center gap-1.5 outline-none","folder"===e.kind&&(g.isDropTarget(e.path)||f.isUploadTarget(e.path))&&"ring-2 ring-ring"),children:[Ut.jsx("span",{className:Jt("flex h-16 w-20 shrink-0 items-center justify-center rounded-lg p-1 transition-colors group-focus-visible:ring-2 group-focus-visible:ring-ring",t&&"bg-accent"),children:"folder"===e.kind?Ut.jsx(th,{className:"h-13 w-auto drop-shadow-sm"}):Ut.jsx(fh,{file:e,className:Jt("rounded-sm shadow-xs",(e.previewAspectRatio??.78)>1.2?"w-[4.75rem]":"w-12"),previewAspectRatio:.78,renderFilePreview:l})}),Ut.jsx("span",{className:Jt("max-w-full rounded-sm px-1.5 py-px text-center text-xs leading-tight break-words",t?"bg-primary text-primary-foreground":"text-foreground"),children:Ut.jsx("span",{className:"line-clamp-2",children:e.name})})]},e.path)})})}),Rh(r,e)&&r?Ut.jsx(jh,{rootRef:h,loadMore:r}):null]})}function Zh({className:e,label:t,onClick:n,sort:r,sortKey:o}){const i=r.key===o;return Ut.jsxs("button",{type:"button",onClick:()=>n(o),className:Jt("flex items-center gap-0.5 rounded-sm py-0.5 transition-colors outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",i&&"text-foreground",e),children:[t,i?Ut.jsx(ui,{icon:"asc"===r.direction?Zo:Uo,className:"size-3 shrink-0"}):null]})}function Kh({currentPath:e,fileFilter:t,index:n,loadMore:r,onFileMove:o,onFilesUpload:i,onOpen:s,onSelect:a,onSortColumnClick:l,preserveItemOrder:c=!1,revealFilteredTreePaths:u,treeSearchQuery:d,selectedPath:h,sort:p,treeExpansionRef:g,showSort:f}){const m=Bt.useRef(null),v=Bt.useMemo(()=>function(e,t,n,r){const o=[],i=new Set,s=r=>{for(const a of t.children.get(r)??[]){if("folder"===a.kind){if(!Fd(a.path,t,n)){const t=a.path.slice(e.length);if(t){const e=t.replace(/\/$/,"");i.has(e)||(i.add(e),o.push(t))}}s(a.path);continue}const r=a.path.slice(e.length);r&&(n&&!n(a)||i.has(r)||(i.add(r),o.push(r)))}};return s(e),r?o:o.sort()}(e,n,t,c),[e,t,n,c]);return 0===v.length?Ut.jsx(zh,{label:t?"No items match the active filters":"This folder is empty"}):Ut.jsxs("div",{className:"flex size-full flex-col",children:[f?Ut.jsxs("div",{className:"flex shrink-0 items-center border-b py-1 pr-6 pl-[46px] text-xs font-medium text-muted-foreground",children:[Ut.jsx(Zh,{className:"flex-1 justify-start",label:"Name",onClick:l,sort:p,sortKey:"name"}),Ut.jsx(Zh,{className:"w-44 justify-start",label:"Date Modified",onClick:l,sort:p,sortKey:"updatedAt"}),Ut.jsx(Zh,{className:"w-20 justify-start",label:"Size",onClick:l,sort:p,sortKey:"size"})]}):null,Ut.jsxs(Qn,{orientation:"vertical",className:"min-h-0 flex-1",viewportRef:m,children:[Ut.jsx(Xh,{currentPath:e,index:n,initialSelectedPath:(null==h?void 0:h.startsWith(e))?fd(h.slice(e.length).replace(/\/$/,"")):null,onFileMove:o,onFilesUpload:i,onOpen:s,onSelect:a,preserveItemOrder:c,relativePaths:v,revealFilteredPaths:u,searchQuery:d,sort:p,treeExpansionRef:g},e),Rh(r,e)&&r?Ut.jsx(jh,{rootRef:m,loadMore:r}):null]})]})}const Yh=400;function Xh({currentPath:e,index:t,initialSelectedPath:n,onFileMove:r,onFilesUpload:o,onOpen:i,onSelect:s,preserveItemOrder:a=!1,relativePaths:l,revealFilteredPaths:c,searchQuery:u,sort:d,treeExpansionRef:h}){const p=Bt.useMemo(()=>function(e){const t=new Map,n=(e,n=!1)=>{const r=e.replace(/\/$/,"");if(!r)return;const o=fd(r);t.set(o,r),n&&t.set(`${o}/`,`${r}/`)};for(const r of e){const e=r.replace(/\/$/,"");n(e,r.endsWith("/"));let t=e.indexOf("/");for(;-1!==t;)n(e.slice(0,t),!0),t=e.indexOf("/",t+1)}return t}(l),[l]),g=t.files,f=t.folders,m=Bt.useMemo(()=>
2{if(a){const e=new Map(l.map((e,t)=>[fd(e).replace(/\/$/,""),t]));return(t,n)=>{const r=t.segments.join("/"),o=n.segments.join("/");return(e.get(r)??Number.MAX_SAFE_INTEGER)-(e.get(o)??Number.MAX_SAFE_INTEGER)}}if(d.key===qd.key&&d.direction===qd.direction)return"default";const t=(t,n)=>{const r=n<t.segments.length-1||t.isDirectory,o=`${t.segments.slice(0,n+1).join("/")}${r?"/":""}`,i=p.get(o);if(!i)return;const s=`${e}${i}`;return r?f.get(dd(s)):g.get(s)};return(e,n)=>{const r=Math.min(e.segments.length,n.segments.length);for(let o=0;o<r;o+=1){if(e.segments[o]===n.segments[o])continue;const r=o<e.segments.length-1||e.isDirectory;if(r!==(o<n.segments.length-1||n.isDirectory))return r?-1:1;const i=t(e,o),s=t(n,o);return i&&s?Ud(i,s,d):e.segments[o]<n.segments[o]?-1:1}return e.segments.length-n.segments.length}},[e,g,f,a,l,d,p]),v=Bt.useMemo(()=>Za(l.map(fd),{sort:m}),[l,m]),y=Bt.useMemo(()=>{const n={},r=['<symbol id="file-system-chevron" viewBox="0 0 24 24"><path d="M18 9.00005C18 9.00005 13.5811 15 12 15C10.4188 15 6 9 6 9" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/></symbol>'];let o=0;for(const i of l){if(o>=Yh)break;const s=t.files.get(`${e}${i}`),a=s?dh(s)[0]:void 0;if(!s||!a)continue;const l=s.name.toLowerCase();if(n[l])continue;const c=`file-system-thumbnail-${r.length}`;r.push(`<symbol id="${c}" viewBox="0 0 16 16"><clipPath id="${c}-clip"><rect width="16" height="16" rx="2.5"/></clipPath><image href="${nh(a)}" width="16" height="16" preserveAspectRatio="xMidYMid slice" clip-path="url(#${c}-clip)"/></symbol>`),n[l]={name:c,viewBox:"0 0 16 16"},o+=1}return{byFileName:n,colored:!0,remap:{"file-tree-icon-chevron":{name:"file-system-chevron",viewBox:"0 0 24 24"}},set:"complete",spriteSheet:`<svg data-icon-sprite aria-hidden="true" width="0" height="0">${r.join("")}</svg>`}},[e,t,l]),b=Bt.useRef({currentPath:"",indexFiles:new Map,model:null,preparedInput:Za([]),revert:()=>{},treePathMap:new Map}),w=Bt.useRef(void 0);r&&!w.current&&(w.current={canDrag:e=>e.every(e=>!e.endsWith("/")),canDrop:({draggedPaths:e,target:t})=>{const{currentPath:n,indexFiles:r,treePathMap:o}=b.current;if("directory"!==t.kind&&"root"!==t.kind)return!1;const i=xd(n,t,o);return null!==i&&e.every(e=>{const t=o.get(e);if(!t)return!1;const s=`${n}${t}`;return r.get(s)&&!wd(s,i)})},onDropComplete:({draggedPaths:e,target:t})=>{const{currentPath:n,indexFiles:r,onFileMove:o,treePathMap:i}=b.current,s=xd(n,t,i);if(o&&null!==s)for(const a of e){const e=i.get(a);if(!e)continue;const t=`${n}${e}`,l=r.get(t);l&&!wd(t,s)&&o({file:l,targetFolderPath:s})}b.current.revert()}}),b.current.currentPath=e,b.current.indexFiles=t.files,b.current.onFileMove=r,b.current.preparedInput=v,b.current.treePathMap=p;const{model:x}=function(e){const[t]=Bt.useState(()=>new od(e)),n=Bt.useRef({timeout:null,model:t});return Bt.useEffect(()=>{const{current:e}=n;return null!=e.timeout&&(clearTimeout(e.timeout),e.timeout=null),()=>{e.timeout=setTimeout(()=>e.model.cleanUp(),1)}},[]),{model:t}}({flattenEmptyDirectories:!1,icons:y,initialExpansion:"closed",dragAndDrop:w.current,initialSearchQuery:u||null,initialSelectedPaths:n?[n]:[],itemHeight:28,overscan:12,preparedInput:v,renderRowDecoration:({row:n})=>{var r;const o=p.get(n.path);if(!o)return null;const i="file"===n.kind?t.files.get(`${e}${o}`):t.folders.get(dd(`${e}${o}`));if(!i)return null;const s=Ld(i.updatedAt??i.createdAt)??"â";if("folder"===i.kind){const e=null==(r=t.children.get(i.path))?void 0:r.length;return{text:void 0===e?"â":`${e} ${1===e?"item":"items"}`,title:s}}return{text:zd(i.size)??"â",title:s}},unsafeCSS:`\n button[data-type='item']:not([data-item-selected]):hover {\n background: color-mix(in oklab, var(--color-accent) 50%, transparent);\n }\n button[data-type='item'][data-item-selected] {\n background: var(--color-primary);\n color: var(--color-primary-foreground);\n /* The primary surface is the opposite of the mode's background, so\n the row's light-dark() icon colors resolve against the opposite\n scheme â light-palette icons on the light pill in dark mode and\n vice versa. */\n color-scheme: var(--fs-selected-color-scheme, normal);\n }\n button[data-type='item'][data-item-selected] *:not([data-icon-token]):not([data-icon-token] *),\n button[data-type='item'][data-item-selected] [data-item-section]::before {\n color: var(--color-primary-foreground) !important;\n }\n [data-item-section='decoration'] > span {\n display: grid;\n grid-template-columns: 11rem 5rem;\n white-space: nowrap;\n /* The size cell is the span's anonymous text item, so alignment\n rides on text-align: the span's right applies to it while the\n date cell (::before) overrides back to left. */\n text-align: right;\n }\n [data-item-section='decoration'] > span::before {\n content: attr(title);\n text-align: left;\n }\n button[data-type='item'][data-item-type='folder'] [data-item-section='content'] {\n display: flex;\n align-items: center;\n min-width: 0;\n }\n button[data-type='item'][data-item-type='folder'] [data-item-section='content']::before {\n content: "";\n flex: none;\n width: 18px;\n height: 14px;\n margin-right: 4px;\n background: url("${eh}") center / contain no-repeat;\n }\n `,onSelectionChange:n=>{const r=n[0];if(!r)return void s(null);const o=p.get(r);if(!o)return void s(null);const i=`${e}${o}`,a=t.files.get(i)??t.folders.get(dd(i))??null;s(a)}});b.current.model=x,Bt.useEffect(()=>{x.setIcons(y)},[y,x]);const C=Bt.useCallback(e=>{const t=[];for(const n of $d(e)){const e=x.getItem(n)??x.getItem(`${n}/`);
2e&&"isExpanded"in e&&e.isExpanded()&&t.push(n)}return t},[x]);b.current.revert=()=>{const{model:e,preparedInput:t}=b.current;e&&e.resetPaths(void 0,{preparedInput:t,initialExpandedPaths:C(t.paths)})};const S=Bt.useCallback(e=>{for(const t of e){const e=x.getItem(t)??x.getItem(`${t}/`);e&&"isExpanded"in e&&!e.isExpanded()&&e.toggle()}},[x]),I=Bt.useRef(v),k=Bt.useRef(c),P=Bt.useRef(c),D=Bt.useRef(null);Bt.useEffect(()=>{k.current=c}),Bt.useEffect(()=>{const e=I.current;if(e===v)return;I.current=v;const t=P.current;let n;P.current=c,c?(t||(D.current=C(e.paths)),n=[...$d(v.paths)]):t?(n=D.current??[],D.current=null):n=C(e.paths);const r=x.getSearchValue();x.resetPaths(void 0,{initialExpandedPaths:n,preparedInput:v}),r&&x.setSearch(r)},[C,x,v,c]),Bt.useLayoutEffect(()=>{const t=h.current,n=t.get(e)??[];return k.current?(D.current=n,S($d(I.current.paths))):S(n),()=>{t.set(e,k.current?D.current??[]:C(I.current.paths))}},[C,e,S,h]),Bt.useEffect(()=>{x.setSearch(u||null)},[x,u]),Bt.useEffect(()=>{let e=x.getFocusedPath();return x.subscribe(()=>{var t;const n=x.getFocusedPath();if(n===e)return;if(e=n,!n)return;const r=x.getItem(n);if(r&&!r.isSelected()){for(const e of x.getSelectedPaths())null==(t=x.getItem(e))||t.deselect();r.select()}})},[x]);const M=n=>{var r;for(const o of n.nativeEvent.composedPath()){if(!(o instanceof HTMLElement))continue;const n=null==(r=o.dataset)?void 0:r.itemPath;if(!n)continue;const i=p.get(n);if(!i)continue;const s=`${e}${i}`;return t.files.get(s)??t.folders.get(dd(s))??null}return null},E=e=>{const t=fd(e);return x.getItem(t)??x.getItem(t.endsWith("/")?t.slice(0,-1):`${t}/`)},T=Oh(),A=t=>{const n=M(t);return"folder"===(null==n?void 0:n.kind)?n.path:e};return Ut.jsx(sd,{model:x,className:"block min-h-0 flex-1",onDragOver:e=>{o&&Sd(e.dataTransfer)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy")},onDrop:e=>{if(!o||!Sd(e.dataTransfer))return;const t=Array.from(e.dataTransfer.files??[]);0!==t.length&&(e.preventDefault(),e.stopPropagation(),o({files:t,targetFolderPath:bd(A(e))}))},onDoubleClick:e=>{const t=M(e);t&&i(t)},onKeyDown:n=>{var r;if("Enter"===n.key){const e=M(n);return void(e&&(n.preventDefault(),i(e)))}if(!Fh(n))return;const o=(()=>{const n=[],r=o=>{const i=t.children.get(o)??[];for(const t of i){if("folder"!==t.kind)continue;const o=E(t.path.slice(e.length));o&&(n.push(t),"isExpanded"in o&&o.isExpanded()&&r(t.path))}for(const e of i)"file"===e.kind&&n.push(e)};return r(e),n})(),s=(null==(r=x.getFocusedPath())?void 0:r.replace(/\/$/,""))??null,a=o.findIndex(t=>fd(t.path.slice(e.length).replace(/\/$/,""))===s),l=T(n,o,a);if(!l)return;const c=E(l.path.slice(e.length));c&&(x.scrollToPath(c.getPath()),c.focus())},style:{"--trees-bg-override":"transparent","--trees-border-color-override":"var(--color-border)","--trees-fg-override":"var(--color-foreground)","--trees-focus-ring-color-override":"var(--color-ring)","--trees-focus-ring-width-override":"2px","--trees-selected-bg-override":"var(--color-primary)","--trees-selected-focused-border-color-override":"var(--color-ring)"}})}function Qh(e){const{currentPath:t,index:n,loadMore:r,loadPreviewImageUrl:o,loadingFolders:i,onFileMove:s,onFilesUpload:a,onOpen:l,onSelect:c,pageUrlCache:u,renderFilePreview:d,selectedEntry:h,selectedPath:p}=e,g=Bt.useRef(null),f=Bt.useRef(new Map),m=Cd(s,n),v=Id(a),y=Bt.useDeferredValue(h),b=Bt.useDeferredValue(p),w=Bt.useRef(null),x=Oh();Bt.useEffect(()=>{const e=w.current;if(!e)return;const t=f.current.get(e);t&&(w.current=null,t.focus())});const C=Bt.useMemo(()=>{const e=[t];if(!(null==b?void 0:b.startsWith(t)))return e;const n=("folder"===(null==y?void 0:y.kind)?y.path:(null==y?void 0:y.parentPath)??t).slice(t.length);let r=t;for(const t of n.split("/"))t&&(r=`${r}${t}/`,e.push(r));return e},[t,y,b]),S=Bt.useMemo(()=>{var e,t,r;if(p)for(const o of C)if(null==(e=n.children.get(o))?void 0:e.some(e=>e.path===p))return p;return(null==(r=null==(t=n.children.get(C[0]??""))?void 0:t[0])?void 0:r.path)??null},[C,n,p]),I="file"===(null==y?void 0:y.kind)?y:null,k=I?zd(I.size):null;return Bt.useEffect(()=>{const e=g.current;e&&(e.scrollLeft=e.scrollWidth)},[C.length,b]),Ut.jsx(Qn,{orientation:"horizontal",viewportRef:g,viewportClassName:"overscroll-x-contain",children:Ut.jsxs(Lo,{className:"flex h-full w-max",style:{minWidth:"100%"},onKeyDown:e=>{var r,o;
2if(!Lh.has(e.key)){const r=h&&(null==p?void 0:p.startsWith(t))?n.children.get(h.parentPath)??[]:n.children.get(t)??[],o=x(e,r,r.findIndex(e=>e.path===p));if(o){c(o);const e=f.current.get(o.path);e?e.focus():w.current=o.path}return}let i;if(h&&(null==p?void 0:p.startsWith(t)))if("ArrowUp"===e.key||"ArrowDown"===e.key){const t=n.children.get(h.parentPath)??[],r=t.findIndex(e=>e.path===h.path);i=t[r+("ArrowUp"===e.key?-1:1)]}else"ArrowLeft"===e.key?h.parentPath!==t&&(i=n.folders.get(h.parentPath)):"folder"===h.kind&&(i=null==(o=n.children.get(h.path))?void 0:o[0]);else i=null==(r=n.children.get(t))?void 0:r[0];if(!i)return;c(i);const s=f.current.get(i.path);s?(w.current=null,s.focus()):w.current=i.path,e.preventDefault()},children:[C.map((e,o)=>Ut.jsx(Jh,{entries:n.children.get(e)??[],index:n,isLoading:i.has(e),loadMore:e===C.at(-1)&&Rh(r,t)?r:void 0,isDropTarget:m.isDropTarget,isUploadTarget:v.isUploadTarget,bindEntry:m.bindEntry,bindUploadEntry:v.bindEntry,viewportMoveProps:m.viewportMoveProps(e),viewportUploadProps:v.viewportUploadProps(e),onOpen:l,onSelect:c,rowRefs:f,selectedChildPath:p&&vd(p)===e?p:null,tabStopChildPath:S&&vd(S)===e?S:null,trailChildPath:C[o+1]??null},e||"(root)")),I?Ut.jsx(Qn,{orientation:"vertical",className:"min-w-60 flex-1 contain-inline-size",viewportClassName:"flex justify-center p-4",children:Ut.jsxs("div",{className:"flex w-full max-w-lg flex-col items-stretch gap-3",children:[Ut.jsx("div",{className:"mx-auto w-full shrink-0",style:{maxWidth:`min(100%, ${20*(I.previewAspectRatio??.78)}rem)`},children:Ut.jsx(fh,{file:I,className:"w-full",loadPreviewImageUrl:o,pageable:!0,pageUrlCache:u,previewAspectRatio:.78,renderFilePreview:d})}),Ut.jsxs("div",{className:"text-center",children:[Ut.jsx("div",{className:"text-sm font-semibold break-words",children:I.name}),Ut.jsxs("div",{className:"text-xs text-muted-foreground",children:[Ed(I),k?` - ${k}`:null]})]}),Ut.jsx(ep,{entry:I,index:n})]})}):null]})})}const Jh=Bt.memo(function({entries:e,index:t,isLoading:n,loadMore:r,isDropTarget:o,isUploadTarget:i,bindEntry:s,bindUploadEntry:a,viewportMoveProps:l,viewportUploadProps:c,onOpen:u,onSelect:d,rowRefs:h,selectedChildPath:p,tabStopChildPath:g,trailChildPath:f}){const m=Bt.useRef(null),{end:v,start:y}=ph({count:e.length,itemStride:29,leadingPx:6,overscan:10,viewportRef:m});return Bt.useLayoutEffect(()=>{p&&gh({index:e.findIndex(e=>e.path===p),itemSize:28,itemStride:29,leadingPx:6,viewport:m.current})},[e,p]),Ut.jsxs(Qn,{orientation:"vertical",className:"w-60 shrink-0 border-r",viewportRef:m,viewportClassName:"p-1.5",viewportProps:{"aria-label":"Files",role:"listbox",...Pd(l,c)},children:[n&&0===e.length?Ut.jsx("div",{className:"animate-pulse px-2 py-1.5 text-xs text-muted-foreground motion-reduce:animate-none",children:"Loadingâ¦"}):Ut.jsx("div",{className:"relative",style:{height:e.length?29*e.length-1:void 0},children:Ut.jsx("div",{className:"absolute inset-x-0 flex flex-col gap-px",style:{top:29*y},children:e.slice(y,v).map(e=>{const n=e.path===p,r="folder"===e.kind&&e.path===f,l=Pd(s(e),a(e)),c="file"===e.kind?dh(e)[0]:void 0;return Ut.jsxs("button",{type:"button",role:"option","aria-selected":n,"data-file-system-on-primary":n?"":void 0,tabIndex:e.path===g?0:-1,ref:t=>{t?h.current.set(e.path,t):h.current.delete(e.path)},...l,onPointerDown:t=>{"mouse"===t.pointerType&&0===t.button&&d(e)},onClick:()=>d(e),onDoubleClick:()=>u(e),onKeyDown:t=>{"Enter"===t.key&&u(e)},className:Jt("flex h-7 shrink-0 items-center gap-2 rounded-md px-2 py-1 text-left text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring",n?"bg-primary text-primary-foreground":r?"bg-accent":"hover:bg-accent/50","folder"===e.kind&&(o(e.path)||i(e.path))&&"ring-2 ring-ring"),children:["folder"===e.kind?Ut.jsx(th,{className:"h-3.5 w-auto shrink-0"}):c?Ut.jsx("img",{src:c,alt:"",draggable:!1,className:"size-4 shrink-0 rounded-[3px] bg-white object-cover"}):Ut.jsx(ch,{fileName:e.name,className:"size-4 shrink-0"}),Ut.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.name}),"folder"===e.kind&&Jd(t,e)?Ut.jsx(ui,{icon:Go,className:Jt("size-3.5 shrink-0",!n&&"text-muted-foreground
2/60")}):null]},e.path)})})}),r?Ut.jsx(jh,{rootRef:m,loadMore:r}):null]})});function ep({entry:e,index:t}){var n;const r=[],o=Ld(e.createdAt),i=Ld(e.updatedAt);if(o&&r.push(["Created",o]),i&&r.push(["Modified",i]),"file"===e.kind){const t=zd(e.size);t&&r.push(["Size",t])}else{const o=null==(n=t.children.get(e.path))?void 0:n.length;void 0!==o&&r.push(["Items",`${o}`])}return 0===r.length?null:Ut.jsxs("div",{className:"border-t pt-3",children:[Ut.jsx("div",{className:"mb-1.5 text-xs font-semibold",children:"Information"}),Ut.jsx("dl",{className:"space-y-1",children:r.map(([e,t])=>Ut.jsxs("div",{className:"flex items-baseline justify-between gap-3 text-xs",children:[Ut.jsx("dt",{className:"shrink-0 text-muted-foreground",children:e}),Ut.jsx("dd",{className:"text-right",suppressHydrationWarning:!0,children:t})]},e))})]})}const tp="h-7 w-7 shrink-0 rounded-lg border-0 bg-muted text-muted-foreground shadow-none hover:bg-muted/90 hover:text-foreground focus-visible:ring-1 focus-visible:ring-ring",np="h-7 shrink-0 rounded-lg border-0 bg-muted px-2.5 text-xs font-medium text-muted-foreground shadow-none hover:bg-muted/90 hover:text-foreground focus-visible:ring-1 focus-visible:ring-ring",rp=Bt.createContext(null),op=Bt.createContext(null),ip=Bt.createContext(null),sp=Bt.createContext(null),ap=Bt.createContext(null),lp=Bt.createContext(null);function cp({children:e}){const[t,n]=Wt.useState(null),[r,o]=Wt.useState(null),[i,s]=Wt.useState(null);return Ut.jsx(op.Provider,{value:n,children:Ut.jsx(sp.Provider,{value:o,children:Ut.jsx(lp.Provider,{value:s,children:Ut.jsx(rp.Provider,{value:t,children:Ut.jsx(ip.Provider,{value:r,children:Ut.jsx(ap.Provider,{value:i,children:e})})})})})})}function up(){return Bt.useContext(rp)}function dp(){const e=Bt.useContext(op);if(!e)throw new Error("useAppShellHeaderSetSlots must be used within AppShellHeaderProvider");return e}function hp(){return Bt.useContext(ip)}function pp(){const e=Bt.useContext(sp);if(!e)throw new Error("useAppShellSetFileToolbar must be used within AppShellHeaderProvider");return e}function gp(){return Bt.useContext(ap)}function fp(){const e=Bt.useContext(lp);if(!e)throw new Error("useAppShellSetFilePresence must be used within AppShellHeaderProvider");return e}const mp=Bt.createContext(null);function vp({children:e}){const[t,n]=Bt.useState(null),[r,o]=Bt.useState([]),i=Bt.useCallback(e=>n(e),[]),s=Bt.useCallback(e=>o(e),[]);return Ut.jsx(mp.Provider,{value:{entityTitle:t,setEntityTitle:i,entityBreadcrumbSegments:r,setEntityBreadcrumbSegments:s},children:e})}function yp(){return Bt.useContext(mp)}var bp=(e=>(e[e.Degree0=0]="Degree0",e[e.Degree90=1]="Degree90",e[e.Degree180=2]="Degree180",e[e.Degree270=3]="Degree270",e))(bp||{});function wp(e){const{width:t,height:n}=e;return{width:n,height:t}}function xp(e,t,n){return{width:(e=t%2==0?e:wp(e)).width*n,height:e.height*n}}function Cp(e,t,n){let r=t.x,o=t.y;switch(n){case 0:r=t.x,o=t.y;break;case 1:r=e.height-t.y,o=t.x;break;case 2:r=e.width-t.x,o=e.height-t.y;break;case 3:r=t.y,o=e.width-t.x}return{x:r,y:o}}function Sp(e,t){return{x:e.x*t,y:e.y*t}}function Ip(e,t,n){let r=t.origin.x,o=t.origin.y,i=t.size;switch(n){case 0:break;case 1:r=e.height-t.origin.y-t.size.height,o=t.origin.x,i=wp(t.size);break;case 2:r=e.width-t.origin.x-t.size.width,o=e.height-t.origin.y-t.size.height;break;case 3:r=t.origin.y,o=e.width-t.origin.x-t.size.width,i=wp(t.size)}return{origin:{x:r,y:o},size:{width:i.width,height:i.height}}}function kp(e,t){return{origin:{x:e.origin.x*t,y:e.origin.y*t},size:{width:e.size.width*t,height:e.size.height*t}}}function Pp(e){if(0===e.length)return null;let t=e[0].origin.x,n=e[0].origin.y,r=e[0].origin.x+e[0].size.width,o=e[0].origin.y+e[0].size.height;for(const i of e)t=Math.min(t,i.origin.x),n=Math.min(n,i.origin.y),r=Math.max(r,i.origin.x+i.size.width),o=Math.max(o,i.origin.y+i.size.height);return{origin:{x:t,y:n}
vendor: 4,121 bytes, line 2
2,size:{width:r-t,height:o-n}}}class Dp{isEnabled(){return!1}debug(){}info(){}warn(){}error(){}perf(){}}class Mp{isEnabled(){return!0}debug(e,t,...n){}info(e,t,...n){}warn(e,t,...n){}error(e,t,...n){}perf(e,t,n,r,...o){}}class Ep{constructor(e,t){this.logger=e,this.level=t}isEnabled(e){return this.level<={debug:0,info:1,warn:2,error:3}[e]}debug(e,t,...n){this.level<=0&&this.logger.debug(e,t,...n)}info(e,t,...n){this.level<=1&&this.logger.info(e,t,...n)}warn(e,t,...n){this.level<=2&&this.logger.warn(e,t,...n)}error(e,t,...n){this.level<=3&&this.logger.error(e,t,...n)}perf(e,t,n,r,...o){this.logger.perf(e,t,n,r,...o)}}class Tp{constructor(){this.marks=new Map}isEnabled(){return!1}debug(e,t,...n){}info(e,t,...n){}warn(e,t,...n){}error(e,t,...n){}perf(e,t,n,r,o,...i){const s=`${e}.${t}.${n}.${r}.${o}`;switch(r){case"Begin":globalThis.performance.mark(s,{detail:i}),this.marks.set(`${e}.${t}.${n}.${o}`,Date.now());break;case"End":globalThis.performance.mark(s,{detail:i});const r=`${e}.${t}.${n}.Measure.${o}`,a=`${e}.${t}.${n}.Begin.${o}`;globalThis.performance.measure(r,a,s);const l=this.marks.get(`${e}.${t}.${n}.${o}`);if(l){Date.now();this.marks.delete(`${e}.${t}.${n}.${o}`)}}}}class Ap{constructor(e){this.loggers=e}isEnabled(e){return this.loggers.some(t=>t.isEnabled(e))}debug(e,t,...n){for(const r of this.loggers)r.debug(e,t,...n)}info(e,t,...n){for(const r of this.loggers)r.info(e,t,...n)}warn(e,t,...n){for(const r of this.loggers)r.warn(e,t,...n)}error(e,t,...n){for(const r of this.loggers)r.error(e,t,...n)}perf(e,t,n,r,...o){for(const i of this.loggers)i.perf(e,t,n,r,...o)}}var _p=(e=>(e[e.Pending=0]="Pending",e[e.Resolved=1]="Resolved",e[e.Rejected=2]="Rejected",e[e.Aborted=3]="Aborted",e))(_p||{});class Np extends Error{constructor(e){super(`Task aborted: ${JSON.stringify(e)}`),this.name="TaskAbortedError",this.reason=e}}class Rp extends Error{constructor(e){super(`Task rejected: ${JSON.stringify(e)}`),this.name="TaskRejectedError",this.reason=e}}class jp{constructor(){this.state={stage:0},this.resolvedCallbacks=[],this.rejectedCallbacks=[],this._promise=null,this.progressCbs=[]}toPromise(){return this._promise||(this._promise=new Promise((e,t)=>{this.wait(t=>e(t),e=>{"abort"===e.type?t(new Np(e.reason)):t(new Rp(e.reason))})})),this._promise}wait(e,t){switch(this.state.stage){case 0:this.resolvedCallbacks.push(e),this.rejectedCallbacks.push(t);break;case 1:e(this.state.result);break;case 2:t({type:"reject",reason:this.state.reason});break;case 3:t({type:"abort",reason:this.state.reason})}}resolve(e){if(0===this.state.stage){this.state={stage:1,result:e};for(const n of this.resolvedCallbacks)try{n(e)}catch(t){}this.resolvedCallbacks=[],this.rejectedCallbacks=[]}}reject(e){if(0===this.state.stage){this.state={stage:2,reason:e};for(const n of this.rejectedCallbacks)try{n({type:"reject",reason:e})}catch(t){}this.resolvedCallbacks=[],this.rejectedCallbacks=[]}}abort(e){if(0===this.state.stage){this.state={stage:3,reason:e};for(const n of this.rejectedCallbacks)try{n({type:"abort",reason:e})}catch(t){}this.resolvedCallbacks=[],this.rejectedCallbacks=[]}}fail(e){"abort"===e.type?this.abort(e.reason):this.reject(e.reason)}onProgress(e){this.progressCbs.push(e)}progress(e){for(const t of this.progressCbs)t(e)}static all(e){const t=new jp;if(0===e.length)return t.resolve([]),t;const n=new Array(e.length);let r=0,o=!1;return e.forEach((i,s)=>{i.wait(i=>{o||(n[s]=i,r++,r===e.length&&(o=!0,t.resolve(n)))},e=>{o||(o=!0,"abort"===e.type?t.abort(e.reason):t.reject(e.reason))})}),t}static allSettled(e){const t=new jp;if(0===e.length)return t.resolve([]),t;const n=new Array(e.length);let r=0;return e.forEach((o,i)=>{o.wait(o=>{n[i]={status:"resolved",value:o},r++,r===e.length&&t.resolve(n)},o=>{n[i]={status:"abort"===o.type?"aborted":"rejected",reason:o.reason},r++,r===e.length&&t.resolve(n)})}),t}static race(e){const t=new jp;if(0===e.length)return t.reject("No tasks provided"),t;let n=!1;return e.forEach(e=>{e.wait(e=>{n||(n=!0,t.resolve(e))},e=>{n||(n=!0,"abort"===e.type?t.abort(e.reason):t.reject(e.reason))})}),t}static withProgress(e,t){const n=jp.all(e);
2if(t){let n=0;e.forEach(r=>{r.wait(()=>{n++,t(n,e.length)},()=>{n++,t(n,e.length)})})}return n}}const zp=Object.freeze(["Â","â","â ","\ufeff","￾","ï¿¿"]);new RegExp(`[${zp.join("")}]`,"g");var Lp=(e=>(e[e.Unknown=-1]="Unknown",e[e.Courier=0]="Courier",e[e.Courier_Bold=1]="Courier_Bold",e[e.Courier_BoldOblique=2]="Courier_BoldOblique",e[e.Courier_Oblique=3]="Courier_Oblique",e[e.Helvetica=4]="Helvetica",e[e.Helvetica_Bold=5]="Helvetica_Bold",e[e.Helvetica_BoldOblique=6]="Helvetica_BoldOblique",e[e.Helvetica_Oblique=7]="Helvetica_Oblique",e[e.Times_Roman=8]="Times_Roman",e[e.Times_Bold=9]="Times_Bold",e[e.Times_BoldItalic=10]="Times_BoldItalic",e[e.Times_Italic=11]="Times_Italic",e[e.Symbol=12]="Symbol",e[e.ZapfDingbats=13]="ZapfDingbats",e))(Lp||{}),$p=(e=>(e[e.Left=0]="Left",e[e.Center=1]="Center",e[e.Right=2]="Right",e))($p||{}),Fp=(e=>(e[e.Normal=0]="Normal",e[e.Multiply=1]="Multiply",e[e.Screen=2]="Screen",e[e.Overlay=3]="Overlay",e[e.Darken=4]="Darken",e[e.Lighten=5]="Lighten",e[e.ColorDodge=6]="ColorDodge",e[e.ColorBurn=7]="ColorBurn",e[e.HardLight=8]="HardLight",e[e.SoftLight=9]="SoftLight",e[e.Difference=10]="Difference",e[e.Exclusion=11]="Exclusion",e[e.Hue=12]="Hue",e[e.Saturation=13]="Saturation",e[e.Color=14]="Color",e[e.Luminosity=15]="Luminosity",e))(Fp||{});const Op=Object.freeze({1:"invisible",2:"hidden",4:"print",8:"noZoom",16:"noRotate",32:"noView",64:"readOnly",128:"locked",256:"toggleNoView",512:"lockedContents"});Object.entries(Op).reduce((e,[t,n])=>(e[n]=Number(t),e),{});var Hp=(e=>(e[e.Create=0]="Create",e[e.Read=1]="Read",e[e.Update=2]="Update",e[e.Delete=3]="Delete",e))(Hp||{}),qp=(e=>(e[e.Print=4]="Print",e[e.ModifyContents=8]="ModifyContents",e[e.CopyContents=16]="CopyContents",e[e.ModifyAnnotations=32]="ModifyAnnotations",e[e.FillForms=256]="FillForms",e[e.ExtractForAccessibility=512]="ExtractForAccessibility",e[e.AssembleDocument=1024]="AssembleDocument",e[e.PrintHighQuality=2048]="PrintHighQuality",e[e.AllowAll=3900]="AllowAll",e))(qp||{});class Vp extends Error{constructor(e,t){super(`Permission denied. Required: ${e.map(e=>qp[e]).join(", ")}`),this.requiredFlags=e,this.currentPermissions=t,this.name="PermissionDeniedError"}}var Bp=(e=>(e[e.Ok=0]="Ok",e[e.Unknown=1]="Unknown",e[e.NotFound=2]="NotFound",e[e.WrongFormat=3]="WrongFormat",e[e.Password=4]="Password",e[e.Security=5]="Security",e[e.PageError=6]="PageError",e[e.XFALoad=7]="XFALoad",e[e.XFALayout=8]="XFALayout",e[e.Cancelled=9]="Cancelled",e[e.Initialization=10]="Initialization",e[e.NotReady=11]="NotReady",e[e.NotSupport=12]="NotSupport",e[e.LoadDoc=13]="LoadDoc",e[e.DocNotOpen=14]="DocNotOpen",e[e.CantCloseDoc=15]="CantCloseDoc",e[e.CantCreateNewDoc=16]="CantCreateNewDoc",e[e.CantImportPages=17]="CantImportPages",e[e.CantCreateAnnot=18]="CantCreateAnnot",e[e.CantSetAnnotRect=19]="CantSetAnnotRect",e[e.CantSetAnnotContent=20]="CantSetAnnotContent",e[e.CantRemoveInkList=21]="CantRemoveInkList",e[e.CantAddInkStoke=22]="CantAddInkStoke",e[e.CantReadAttachmentSize=23]="CantReadAttachmentSize",e[e.CantReadAttachmentContent=24]="CantReadAttachmentContent",e[e.CantFocusAnnot=25]="CantFocusAnnot",e[e.CantSelectText=26]="CantSelectText",e[e.CantSelectOption=27]="CantSelectOption",e[e.CantCheckField=28]="CantCheckField",e[e.CantSetAnnotString=29]="CantSetAnnotString",e[e.CantDeletePage=30]="CantDeletePage",e))(Bp||{});class Up{static create(){return new jp}static resolve(e){const t=new jp;return t.resolve(e),t}static reject(e){const t=new jp;return t.reject(e),t}static abort(e){const t=new jp;return t.reject(e),t}}const Wp=Object.freeze([{id:$p.Left,label:"Left",css:"left"},{id:$p.Center,label:"Center",css:"center"},{id:$p.Right,label:"Right",css:"right"}]);Wp.reduce((e,t)=>(e[t.id]=t,e),{}),Wp.reduce((e,t)=>(e[t.css]=t.id,e),{}),Wp.map(e=>({value:e.id,label:e.label}));var Gp=(e=>(e.Courier="Courier",e.Helvetica="Helvetica",e.Times="Times",e.Symbol="Symbol",e.ZapfDingbats="ZapfDingbats",e.Unknown="Unknown",e))(Gp||{});Lp.Helvetica;const Zp={id:Lp.Helvetica,family:"Helvetica",bold:!1,italic:!1,label:"Helvetica",css:"Helvetica, Arial, sans-serif"},Kp=Object.freeze([{id:Lp.Courier,family:"Courier",bold:!1,italic:!1,label:"Courier",css:"Courier, monospace"},{id:Lp.Courier_Bold,family:"Courier",bold:!0,italic:!1,label:"Courier Bold",css:"Courier, monospace"},{id:Lp.Courier_BoldOblique,family:"Courier",bold:!0,italic:!0,label:"Courier Bold Oblique",css:"Courier, monospace"},{id:Lp.Courier_Oblique,family:"Courier",bold:!1,italic:!0,label:"Courier Oblique",css:"Courier, monospace"},Zp,{id:Lp.Helvetica_Bold,family:"Helvetica",bold:!0,italic:!1,label:"Helvetica Bold",css:"Helvetica, Arial, sans-serif"},{id:Lp.Helvetica_BoldOblique,family:"Helvetica",bold:!0,italic:!0,label:"Helvetica Bold Oblique",css:"Helvetica, Arial, sans-serif"},{id:Lp.Helvetica_Oblique,family:"Helvetica",bold:!1,italic:!0,label:"Helvetica Oblique",css:"Helvetica, Arial, sans-serif"},{id:Lp.Times_Roman,family:"Times",bold:!1,italic:!1,label:"Times Roman",css:'"Times New Roman", Times, serif'},{id:Lp.Times_Bold,family:"Times",bold:!0,italic:!1,label:"Times Bold",css:'"Times New Roman", Times, serif'},{id:Lp.Times_BoldItalic,family:"Times",bold:!0,italic:!0,label:"Times Bold Italic",css:'"Times New Roman", Times, serif'},{id:Lp.Times_Italic,family:"Times",bold:!1,italic:!0,label:"Times Italic",css:'"Times New Roman", Times, serif'},{id:Lp.Symbol,family:"Symbol",bold:!1,italic:!1,label:"Symbol",css:"Symbol, serif"},{id:Lp.ZapfDingbats,family:"ZapfDingbats",bold:!1,italic:!1,label:"Zapf Dingbats",css:"ZapfDingbats, serif"}]);Kp.reduce((e,t)=>
vendor: 36,881 bytes, line 2
2(e[t.id]=t,e),{});const Yp=new Map;for(const kw of Kp)Yp.set(`${kw.family}_${kw.bold}_${kw.italic}`,kw.id);Object.values(Gp).filter(e=>"Unknown"!==e).map(e=>({value:e,label:e})),new Set(Kp.map(e=>e.family));const Xp=Object.freeze([{id:Fp.Normal,label:"Normal",css:"normal"},{id:Fp.Multiply,label:"Multiply",css:"multiply"},{id:Fp.Screen,label:"Screen",css:"screen"},{id:Fp.Overlay,label:"Overlay",css:"overlay"},{id:Fp.Darken,label:"Darken",css:"darken"},{id:Fp.Lighten,label:"Lighten",css:"lighten"},{id:Fp.ColorDodge,label:"Color Dodge",css:"color-dodge"},{id:Fp.ColorBurn,label:"Color Burn",css:"color-burn"},{id:Fp.HardLight,label:"Hard Light",css:"hard-light"},{id:Fp.SoftLight,label:"Soft Light",css:"soft-light"},{id:Fp.Difference,label:"Difference",css:"difference"},{id:Fp.Exclusion,label:"Exclusion",css:"exclusion"},{id:Fp.Hue,label:"Hue",css:"hue"},{id:Fp.Saturation,label:"Saturation",css:"saturation"},{id:Fp.Color,label:"Color",css:"color"},{id:Fp.Luminosity,label:"Luminosity",css:"luminosity"}]);function Qp(e){if(e instanceof Dp)return{type:"noop"};if(e instanceof Mp)return{type:"console"};if(e instanceof Tp)return{type:"perf"};if(e instanceof Ep){const t=e;return{type:"level",config:{level:t.level,logger:Qp(t.logger)}}}if(e instanceof Ap){return{type:"all",config:{loggers:e.loggers.map(Qp)}}}return{type:"noop"}}Xp.reduce((e,t)=>(e[t.id]=t,e),{}),Xp.reduce((e,t)=>(e[t.css]=t.id,e),{}),Xp.map(e=>({value:e.id,label:e.label})),Xp.map(e=>e.id);class Jp extends jp{constructor(e={}){super(),this.children=new Map,this.childResults=[],this.completedCount=0,this.expectedCount=0,this.isFinalized=!1,this.config={aggregate:e.aggregate??(e=>e),onChildComplete:e.onChildComplete??(()=>{}),failFast:e.failFast??!0}}addChild(e,t){if(this.state.stage!==_p.Pending)return this.state.stage===_p.Aborted&&e.abort(this.state.reason),this;const n=t??this.expectedCount;return this.expectedCount=Math.max(this.expectedCount,n+1),this.children.set(e,n),e.wait(t=>this.handleChildSuccess(e,t,n),t=>this.handleChildError(e,t,n)),this}finalize(){return this.isFinalized||(this.isFinalized=!0,0===this.expectedCount&&this.resolve(this.config.aggregate([]))),this}handleChildSuccess(e,t,n){if(this.state.stage!==_p.Pending)return;this.childResults[n]=t,this.completedCount++,this.children.delete(e);const r=this.config.onChildComplete(this.completedCount,this.expectedCount,t,n);if(void 0!==r&&this.progress(r),this.completedCount===this.expectedCount){const e=this.config.aggregate(this.childResults);this.resolve(e)}}handleChildError(e,t,n){if(this.state.stage===_p.Pending)if(this.children.delete(e),this.config.failFast){for(const[e]of this.children)e.abort("Sibling task failed");this.children.clear(),this.fail(t)}else if(this.childResults[n]=void 0,this.completedCount++,this.completedCount===this.expectedCount){const e=this.config.aggregate(this.childResults);this.resolve(e)}}abort(e){for(const[t]of this.children)t.abort(e);this.children.clear(),super.abort(e)}reject(e){for(const[t]of this.children)t.abort(e);this.children.clear(),super.reject(e)}getPendingCount(){return this.children.size}getCompletedCount(){return this.completedCount}static gather(e){const t=new Jp({aggregate:e=>e,onChildComplete:(e,t)=>({completed:e,total:t})});return e.forEach((e,n)=>t.addChild(e,n)),t.finalize(),t}static gatherIndexed(e){const t=new Jp({aggregate:e=>{const t={};return e.forEach((e,n)=>{t[n]=e}),t},onChildComplete:(e,t,n,r)=>({page:r,result:n})});return e.forEach((e,n)=>t.addChild(e,n)),t.finalize(),t}static gatherFrom(e,t){const n=new Jp(t);return e.forEach((e,t)=>n.addChild(e,t)),n.finalize(),n}static first(e){let t=!1;const n=new Jp({aggregate:e=>e[0],failFast:!1});return n.handleChildSuccess=(e,r)=>{if(!t){t=!0;for(const[t]of n.children)t!==e&&t.abort("Race won by sibling");n.resolve(r)}},e.forEach((e,t)=>n.addChild(e,t)),n.finalize(),n}}function eg(){}class tg{constructor(){this.dependencyGraph=new Map}addNode(e,t=[]){this.dependencyGraph.set(e,new Set(t))}hasCircularDependencies(){const e=new Set,t=new Set,n=r=>{e.add(r),t.add(r);const o=this.dependencyGraph.get(r)||new Set;for(const i of o)if(e.has(i)){if(t.has(i))return!0}else if(n(i))return!0;return t.delete(r),!1};for(const r of this.dependencyGraph.keys())if(!e.has(r)&&n(r))return!0;return!1}resolveLoadOrder(){if(this.hasCircularDependencies())throw new Error("Circular dependencies detected");const e=[],t=new Set,n=new Set,r=o=>{if(n.has(o))throw new Error("Circular dependency");if(t.has(o))return;n.add(o);const i=this.dependencyGraph.get(o)||new Set;for(const e of i)r(e);n.delete(o),t.add(o),e.push(o)};for(const o of this.dependencyGraph.keys())t.has(o)||r(o);return e}}class ng extends Error{constructor(e){super(e),this.name="PluginRegistrationError"}}class rg extends Error{constructor(e){super(e),this.name="PluginNotFoundError"}}class og extends Error{constructor(e){super(e),this.name="CircularDependencyError"}}class ig extends Error{constructor(e){super(e),this.name="PluginConfigurationError"}}class sg{constructor(e,t){this.store=e,this.pluginId=t}getState(){return this.store.getState().plugins[this.pluginId]}dispatch(e){return this.store.dispatchToPlugin(this.pluginId,e)}subscribeToState(e){return this.store.subscribeToPlugin(this.pluginId,(t,n,r)=>{e(t,n,r)})}onAction(e,t){return this.store.onAction(e,(e,n,r)=>{t(e,n.plugins[this.pluginId],r.plugins[this.pluginId])})}}const ag="START_LOADING_DOCUMENT",lg="UPDATE_DOCUMENT_LOADING_PROGRESS",cg="SET_DOCUMENT_LOADED",ug="SET_DOCUMENT_ERROR",dg="RETRY_LOADING_DOCUMENT",hg="CLOSE_DOCUMENT",pg="SET_ACTIVE_DOCUMENT",gg="REORDER_DOCUMENTS",fg="MOVE_DOCUMENT",mg="UPDATE_DOCUMENT_SECURITY",vg="REFRESH_PAGES",yg="SET_SCALE",bg="SET_ROTATION",wg=[ag,lg,cg,hg,pg,ug,dg,"REFRESH_DOCUMENT",vg,"SET_PAGES",yg,bg,"SET_DEFAULT_SCALE","SET_DEFAULT_ROTATION",gg,fg,mg],xg=(e,t,n,r,o,i,s)=>({type:ag,payload:{documentId:e,name:t,scale:n,rotation:r,passwordProvided:o,autoActivate:i,permissions:s}}),Cg=(e,t)=>({type:hg,payload:{documentId:e,nextActiveDocumentId:t}}),Sg=(e,t)=>({type:bg,payload:{rotation:e,documentId:t}});class Ig{constructor(e,t){this.initialCoreState=t,this.pluginReducers={},this.listeners=[],this.pluginListeners={},this.isDispatching=!1,this.state={core:t,plugins:{}},this.coreReducer=e}addPluginReducer(e,t,n){this.state.plugins[e]=n,this.pluginReducers[e]=t}dispatchToCore(e){if(!this.coreReducer)return this.getState();if(this.isDispatching)throw new Error("Reducers may not dispatch actions. To trigger cascading actions, dispatch from a listener callback instead.");const t=this.getState();try{this.isDispatching=!0,this.state.core=this.coreReducer(this.state.core,e)}finally{this.isDispatching=!1}return this.listeners.forEach(n=>{const r=this.getState();n(e,r,t)}),this.getState()}dispatchToPlugin(e,t,n=!0){if(this.isDispatching)throw new Error("Reducers may not dispatch actions. To trigger cascading actions, dispatch from a listener callback instead.");const r=this.getState(),o=this.pluginReducers[e];if(!o)return r.plugins[e];const i=r.plugins[e];try{this.isDispatching=!0;const n=o(i,t);this.state.plugins[e]=n}finally{this.isDispatching=!1}return n&&this.listeners.forEach(e=>{const n=this.getState();e(t,n,r)}),this.pluginListeners[e]&&this.pluginListeners[e].forEach(n=>{const r=this.getState().plugins[e];n(t,r,i)}),this.getState().plugins[e]}dispatch(e){if(this.isDispatching)throw new Error("Reducers may not dispatch actions. To trigger cascading actions, dispatch from a listener callback instead.");const t=this.getState();try{this.isDispatching=!0,this.isCoreAction(e)&&(this.state.core=this.coreReducer(this.state.core,e));for(const n in this.pluginReducers){const r=this.pluginReducers[n],o=t.plugins[n];r&&(this.state.plugins[n]=r(o,e))}}finally{this.isDispatching=!1}return this.listeners.forEach(n=>{const r=this.getState();n(e,r,t)}),this.getState()}getState(){if(this.isDispatching)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return{core:{...this.state.core},plugins:{...this.state.plugins}}}subscribe(e){if(this.isDispatching)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state.");return this.listeners.push(e),()=>{if(this.isDispatching)throw new Error("You may not unsubscribe from a store listener while the reducer is executing.");this.listeners=this.listeners.filter(t=>t!==e)}}subscribeToPlugin(e,t){if(!(e in this.state.plugins))throw new Error(`Plugin state not found for plugin "${e}". Did you forget to call addPluginReducer?`);if(this.isDispatching)throw new Error("You may not call store.subscribeToPlugin() while the reducer is executing.");return this.pluginListeners[e]||(this.pluginListeners[e]=[]),this.pluginListeners[e].push(t),()=>{if(this.isDispatching)throw new Error("You may not unsubscribe from a store listener while the reducer is executing.");this.pluginListeners[e]=this.pluginListeners[e].filter(e=>e!==t),0===this.pluginListeners[e].length&&delete this.pluginListeners[e]}}onAction(e,t){return this.subscribe((n,r,o)=>{n.type===e&&t(n,r,o)})}getPluginStore(e){if(!(e in this.state.plugins))throw new Error(`Plugin state not found for plugin "${e}". Did you forget to call addPluginReducer?`);return new sg(this,e)}isCoreAction(e){return wg.includes(e.type)}destroy(){var e,t;this.listeners.length=0;for(const n in this.pluginListeners)null==(t=null==(e=this.pluginListeners[n])?void 0:e.splice)||t.call(e,0);this.pluginListeners={},this.pluginReducers={},this.state.plugins={},this.state.core={...this.initialCoreState}}}qp.Print,qp.ModifyContents,qp.CopyContents,qp.ModifyAnnotations,qp.FillForms,qp.ExtractForAccessibility,qp.AssembleDocument,qp.PrintHighQuality;const kg=[qp.Print,qp.ModifyContents,qp.CopyContents,qp.ModifyAnnotations,qp.FillForms,qp.ExtractForAccessibility,qp.AssembleDocument,qp.PrintHighQuality],Pg={[qp.Print]:"print",[qp.ModifyContents]:"modifyContents",[qp.CopyContents]:"copyContents",[qp.ModifyAnnotations]:"modifyAnnotations",[qp.FillForms]:"fillForms",[qp.ExtractForAccessibility]:"extractForAccessibility",[qp.AssembleDocument]:"assembleDocument",[qp.PrintHighQuality]:"printHighQuality"};function Dg(e,t){if(!e)return;if(t in e)return e[t];const n=Pg[t];return n&&n in e?e[n]:void 0}function Mg(e,t,n){var r;const o=e.documents[t],i=null==o?void 0:o.permissions,s=e.globalPermissions,a=(null==(r=null==o?void 0:o.document)?void 0:r.permissions)??qp.AllowAll,l=Dg(null==i?void 0:i.overrides,n);if(void 0!==l)return l;const c=Dg(null==s?void 0:s.overrides,n);if(void 0!==c)return c;return!((null==i?void 0:i.enforceDocumentPermissions)??(null==s?void 0:s.enforceDocumentPermissions)??!0)||0!==(a&n)}function Eg(e,t){return kg.reduce((n,r)=>Mg(e,t,r)?n|r:n,0)}function Tg(e,t,n){const r=e.activeDocumentId;if(r!==t)return r;if(void 0!==n)return n&&e.documents[n]?n:null;const o=e.documentOrder.indexOf(t);return-1===o?null:o>0?e.documentOrder[o-1]:o<e.documentOrder.length-1?e.documentOrder[o+1]:null}const Ag=(e,t)=>{switch(t.type){case ag:{const{documentId:n,name:r,scale:o,rotation:i,passwordProvided:s,autoActivate:a=!0,permissions:l}=t.payload,c={id:n,name:r,status:"loading",loadingProgress:0,error:null,document:null,scale:o??e.defaultScale,rotation:i??e.defaultRotation,passwordProvided:s??!1,pageRefreshVersions:{},permissions:l,loadStartedAt:Date.now()};return{...e,documents:{...e.documents,[n]:c},documentOrder:[...e.documentOrder,n],activeDocumentId:a||!e.activeDocumentId?n:e.activeDocumentId}}case lg:{const{documentId:n,progress:r}=t.payload,o=e.documents[n];return o&&"loading"===o.status?{...e,documents:{...e.documents,[n]:{...o,loadingProgress:r}}}:e}case cg:{const{documentId:n,document:r}=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,status:"loaded",document:r,error:null,errorCode:void 0,errorDetails:void 0,passwordProvided:void 0,loadedAt:Date.now()}}}:e}case ug:{const{documentId:n,error:r,errorCode:o,errorDetails:i}=t.payload,s=e.documents[n];return s?{...e,documents:{...e.documents,[n]:{...s,status:"error",error:r,errorCode:o,errorDetails:i}}}:e}case dg:{const{documentId:n,passwordProvided:r}=t.payload,o=e.documents[n];return o&&"error"===o.status?{...e,documents:{...e.documents,[n]:{...o,status:"loading",loadingProgress:0,error:null,errorCode:void 0,errorDetails:void 0,passwordProvided:r??!1,loadStartedAt:Date.now()}}}:e}case hg:{const{documentId:n,nextActiveDocumentId:r}=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i,documentOrder:e.documentOrder.filter(e=>e!==n),activeDocumentId:Tg(e,n,r)}}case fg:{const{documentId:n,toIndex:r}=t.payload,o=function(e,t,n){const r=e.indexOf(t);if(-1===r)return null;if(n<0||n>=e.length)return null;if(r===n)return null;const o=[...e];return o.splice(r,1),o.splice(n,0,t),o}(e.documentOrder,n,r);return o?{...e,documentOrder:o}:e}case gg:return{...e,documentOrder:t.payload};case pg:return{...e,activeDocumentId:t.payload};case yg:{const{scale:n,documentId:r}=t.payload,o=r??e.activeDocumentId;if(!o)return e;const i=e.documents[o];return i?{...e,documents:{...e.documents,[o]:{...i,scale:n}}}:e}case bg:{const{rotation:n,documentId:r}=t.payload,o=r??e.activeDocumentId;if(!o)return e;const i=e.documents[o];return i?{...e,documents:{...e.documents,[o]:{...i,rotation:n}}}:e}case vg:{const{documentId:n,pageIndexes:r}=t.payload,o=e.documents[n];if(!o)return e;const i={...o.pageRefreshVersions};for(const e of r)i[e]=(i[e]||0)+1;return{...e,documents:{...e.documents,[n]:{...o,pageRefreshVersions:i}}}}case mg:{const{documentId:n,permissions:r,isOwnerUnlocked:o}=t.payload,i=e.documents[n];return(null==i?void 0:i.document)?{...e,documents:{...e.documents,[n]:{...i,document:{...i.document,permissions:r,isOwnerUnlocked:o}}}}:e}default:return e}};class _g{constructor(e,t){this.plugins=new Map,this.manifests=new Map,this.capabilities=new Map,this.status=new Map,this.configurations=new Map,this.initPromise=null,this.pendingRegistrations=[],this.processingRegistrations=[],this.initialized=!1,this.isInitializing=!1,this.pluginsReadyPromise=null,this.destroyed=!1,this.resolver=new tg,this.engine=e,this.initialCoreState=(e=>({documents:{},documentOrder:[],activeDocumentId:null,defaultScale:(null==e?void 0:e.defaultScale)??1,defaultRotation:(null==e?void 0:e.defaultRotation)??bp.Degree0,globalPermissions:null==e?void 0:e.permissions}))(t),this.store=new Ig(Ag,this.initialCoreState),this.logger=(null==t?void 0:t.logger)??new Dp}getLogger(){return this.logger}registerPlugin(e,t){if(this.initialized&&!this.isInitializing)throw new ng("Cannot register plugins after initialization");this.validateManifest(e.manifest),this.store.addPluginReducer(e.manifest.id,e.reducer,"function"==typeof e.initialState?e.initialState(this.initialCoreState,{...e.manifest.defaultConfig,...t}):e.initialState),this.pendingRegistrations.push({package:e,config:t})}getStore(){return this.store}getEngine(){return this.engine}pluginsReady(){return this.pluginsReadyPromise||(this.pluginsReadyPromise=(async()=>{this.initialized||await this.initialize();const e=Array.from(this.plugins.values()).map(e=>"function"==typeof e.ready?e.ready():Promise.resolve());await Promise.all(e)})()),this.pluginsReadyPromise}async initialize(){if(this.destroyed)throw new ng("Registry has been destroyed");return this.initPromise||(this.initPromise=(async()=>{if(this.initialized)throw new ng("Registry is already initialized");this.isInitializing=!0;try{if(this.destroyed)return;for(;this.pendingRegistrations.length>0;){if(this.destroyed)return;this.processingRegistrations=[...this.pendingRegistrations],this.pendingRegistrations=[];for(const t of this.processingRegistrations){const e=new Set,n=[...t.package.manifest.requires,...t.package.manifest.optional];for(const t of n){const n=this.processingRegistrations.find(e=>e.package.manifest.provides.includes(t));n&&e.add(n.package.manifest.id)}this.resolver.addNode(t.package.manifest.id,[...e])}const e=this.resolver.resolveLoadOrder();for(const t of e){const e=this.processingRegistrations.find(e=>e.package.manifest.id===t);this.instantiatePlugin(e.package.manifest,e.package.create,e.config)}for(const t of e)await this.runPluginInitialization(t);this.processingRegistrations=[],this.resolver=new tg}this.initialized=!0}catch(e){if(e instanceof Error)throw new og(`Failed to resolve plugin dependencies: ${e.message}`);throw e}finally{this.isInitializing=!1}})()),this.initPromise}instantiatePlugin(e,t,n){const r={...e.defaultConfig,...n};this.validateConfig(e.id,r,e.defaultConfig);const o=t(this,r);this.validatePlugin(o);for(const i of e.provides){if(this.capabilities.has(i))throw new ng(`Capability ${i} is already provided by plugin ${this.capabilities.get(i)}`);this.capabilities.set(i,e.id)}this.plugins.set(e.id,o),this.manifests.set(e.id,e),this.status.set(e.id,"registered"),this.configurations.set(e.id,r)}async runPluginInitialization(e){const t=this.plugins.get(e);if(!t)return;const n=this.manifests.get(e),r=this.configurations.get(e);for(const i of n.requires)if(!this.capabilities.has(i))throw new ng(`Missing required capability: ${i} for plugin ${e}`);this.logger.debug("PluginRegistry","InitializePlugin",`Initializing plugin ${e}`);try{t.initialize&&await t.initialize(r),this.status.set(e,"active"),this.logger.info("PluginRegistry","PluginInitialized",`Plugin ${e} initialized successfully`)}catch(o){throw this.status.set(e,"error"),this.logger.error("PluginRegistry","InitializationFailed",`Plugin ${e} initialization failed`,{error:o}),o}}getPluginConfig(e){const t=this.configurations.get(e);if(!t)throw new rg(`Configuration for plugin ${e} not found`);return t}validateConfig(e,t,n){const r=Object.keys(n).filter(e=>!t.hasOwnProperty(e));if(r.length>0)throw new ig(`Missing required configuration keys for plugin ${e}: ${r.join(", ")}`)}async updatePluginConfig(e,t){const n=this.getPlugin(e);if(!n)throw new rg(`Plugin ${e} not found`);const r=this.manifests.get(e),o=this.configurations.get(e);if(!r||!o)throw new rg(`Plugin ${e} not found`);const i={...o,...t};this.validateConfig(e,i,r.defaultConfig),this.configurations.set(e,i),n.initialize&&await n.initialize(i)}registerPluginBatch(e){for(const t of e)this.registerPlugin(t.package,t.config)}async unregisterPlugin(e){const t=this.plugins.get(e);if(!t)throw new rg(`Plugin ${e} is not registered`);const n=this.manifests.get(e);if(!n)throw new rg(`Manifest for plugin ${e} not found`);for(const[o,i]of this.manifests.entries()){if(o===e)continue;if([...i.requires,...i.optional].some(e=>n.provides.includes(e)))throw new ng(`Cannot unregister plugin ${e}: plugin ${o} depends on it`)}try{t.destroy&&await t.destroy();for(const e of n.provides)this.capabilities.delete(e);this.plugins.delete(e),this.manifests.delete(e),this.status.delete(e)}catch(r){if(r instanceof Error)throw new Error(`Failed to unregister plugin ${e}: ${r.message}`);throw r}}getPlugin(e){const t=this.plugins.get(e);return t||null}getCapabilityProvider(e){const t=this.capabilities.get(e);return t?this.getPlugin(t):null}hasCapability(e){return this.capabilities.has(e)}getAllPlugins(){return Array.from(this.plugins.values())}getPluginStatus(e){const t=this.status.get(e);if(!t)throw new rg(`Plugin ${e} not found`);return t}validatePlugin(e){if(!e.id)throw new ng("Plugin must have an id")}validateManifest(e){if(!e.id)throw new ng("Manifest must have an id");if(!e.name)throw new ng("Manifest must have a name");if(!e.version)throw new ng("Manifest must have a version");if(!Array.isArray(e.provides))throw new ng("Manifest must have a provides array");if(!Array.isArray(e.requires))throw new ng("Manifest must have a requires array");if(!Array.isArray(e.optional))throw new ng("Manifest must have an optional array")}isDestroyed(){return this.destroyed}async destroy(){var e;if(this.destroyed)throw new ng("Registry has already been destroyed");this.destroyed=!0;try{await this.initPromise}catch{}for(const t of Array.from(this.plugins.values()).reverse())await(null==(e=t.destroy)?void 0:e.call(t));this.store.destroy(),this.plugins.clear(),this.manifests.clear(),this.capabilities.clear(),this.status.clear(),this.pendingRegistrations.length=0,this.processingRegistrations.length=0}}function Ng(e,t){return{package:e,config:t}}function Rg(e){return"autoMountElements"in e&&"function"==typeof e.autoMountElements}class jg{constructor(e,t){if(this.id=e,this.registry=t,this.cooldownActions={},this.debouncedTimeouts={},this.unsubscribeFromState=null,this.unsubscribeFromCoreStore=null,this.unsubscribeFromStartLoadingDocument=null,this.unsubscribeFromSetDocumentLoaded=null,this.unsubscribeFromCloseDocument=null,this.unsubscribeFromSetScale=null,this.unsubscribeFromSetRotation=null,e!==this.constructor.id)throw new Error(`Plugin ID mismatch: ${e} !== ${this.constructor.id}`);this.engine=this.registry.getEngine(),this.logger=this.registry.getLogger(),this.coreStore=this.registry.getStore(),this.pluginStore=this.coreStore.getPluginStore(this.id),this.unsubscribeFromState=this.pluginStore.subscribeToState((e,t,n)=>{this.onStoreUpdated(n,t)}),this.unsubscribeFromCoreStore=this.coreStore.subscribe((e,t,n)=>{this.onCoreStoreUpdated(n,t),t.core.activeDocumentId!==n.core.activeDocumentId&&this.onActiveDocumentChanged(n.core.activeDocumentId,t.core.activeDocumentId)}),this.unsubscribeFromStartLoadingDocument=this.coreStore.onAction(ag,e=>{this.onDocumentLoadingStarted(e.payload.documentId)}),this.unsubscribeFromSetDocumentLoaded=this.coreStore.onAction(cg,e=>{this.onDocumentLoaded(e.payload.documentId)}),this.unsubscribeFromCloseDocument=this.coreStore.onAction(hg,e=>{this.onDocumentClosed(e.payload.documentId)}),this.unsubscribeFromSetScale=this.coreStore.onAction(yg,(e,t)=>{const n=e.payload.documentId??t.core.activeDocumentId;n&&this.onScaleChanged(n,e.payload.scale)}),this.unsubscribeFromSetRotation=this.coreStore.onAction(bg,(e,t)=>{const n=e.payload.documentId??t.core.activeDocumentId;n&&this.onRotationChanged(n,e.payload.rotation)}),this.readyPromise=new Promise(e=>{this.readyResolve=e}),this.readyResolve()}provides(){if(!this._capability){const e=this.buildCapability();this._capability=Object.freeze(e)}return this._capability}get state(){return this.pluginStore.getState()}get coreState(){return this.coreStore.getState()}getState(){return this.pluginStore.getState()}getCoreState(){return this.coreStore.getState()}dispatchCoreAction(e){return this.coreStore.dispatchToCore(e)}dispatchToAllPlugins(e){return this.coreStore.dispatch(e)}dispatch(e){return this.pluginStore.dispatch(e)}cooldownDispatch(e,t=100){const n=Date.now();return n-(this.cooldownActions[e.type]||0)>=t&&(this.cooldownActions[e.type]=n,this.dispatch(e),!0)}debouncedDispatch(e,t=100){const n=e.type;this.debouncedTimeouts[n]&&clearTimeout(this.debouncedTimeouts[n]),this.debouncedTimeouts[n]=setTimeout(()=>{this.dispatch(e),delete this.debouncedTimeouts[n]},t)}cancelDebouncedDispatch(e){this.debouncedTimeouts[e]&&(clearTimeout(this.debouncedTimeouts[e]),delete this.debouncedTimeouts[e])}subscribe(e){return this.pluginStore.subscribeToState(e)}subscribeToCoreStore(e){return this.coreStore.subscribe(e)}onStoreUpdated(e,t){}onCoreStoreUpdated(e,t){}onDocumentLoadingStarted(e){}onDocumentLoaded(e){}onDocumentClosed(e){}onActiveDocumentChanged(e,t){}onScaleChanged(e,t){}onRotationChanged(e,t){}destroy(){Object.values(this.debouncedTimeouts).forEach(e=>{clearTimeout(e)}),this.debouncedTimeouts={},this.unsubscribeFromState&&(this.unsubscribeFromState(),this.unsubscribeFromState=null),this.unsubscribeFromCoreStore&&(this.unsubscribeFromCoreStore(),this.unsubscribeFromCoreStore=null),this.unsubscribeFromStartLoadingDocument&&(this.unsubscribeFromStartLoadingDocument(),this.unsubscribeFromStartLoadingDocument=null),this.unsubscribeFromSetDocumentLoaded&&(this.unsubscribeFromSetDocumentLoaded(),this.unsubscribeFromSetDocumentLoaded=null),this.unsubscribeFromCloseDocument&&(this.unsubscribeFromCloseDocument(),this.unsubscribeFromCloseDocument=null),this.unsubscribeFromSetScale&&(this.unsubscribeFromSetScale(),this.unsubscribeFromSetScale=null),this.unsubscribeFromSetRotation&&(this.unsubscribeFromSetRotation(),this.unsubscribeFromSetRotation=null)}ready(){return this.readyPromise}markReady(){this.readyResolve()}resetReady(){this.readyPromise=new Promise(e=>{this.readyResolve=e})}getActiveDocumentId(){const e=this.coreState.core.activeDocumentId;if(!e)throw new Error("No active document");return e}getActiveDocumentIdOrNull(){return this.coreState.core.activeDocumentId}getCoreDocument(e){const t=e??this.getActiveDocumentIdOrNull();return t?this.coreState.core.documents[t]??null:null}getCoreDocumentOrThrow(e){const t=this.getCoreDocument(e);if(!t)throw new Error(`Document not found: ${e??"active"}`);return t}getDocumentPermissions(e){const t=e??this.coreState.core.activeDocumentId;return t?Eg(this.coreState.core,t):qp.AllowAll}checkPermission(e,...t){const n=e??this.coreState.core.activeDocumentId;return!n||t.every(e=>Mg(this.coreState.core,n,e))}requirePermission(e,...t){const n=e??this.coreState.core.activeDocumentId;if(!n)return;const r=[];for(const o of t)Mg(this.coreState.core,n,o)||r.push(o);if(r.length>0){const e=Eg(this.coreState.core,n);throw new Vp(r,e)}}}class zg{constructor(e,t){this.handler=e,this.options=t,this.lastRun=0,this.handle=e=>{"debounce"===this.options.mode?this.debounce(e):this.throttle(e)}}debounce(e){this.timeoutId&&window.clearTimeout(this.timeoutId),this.timeoutId=window.setTimeout(()=>{this.handler(e),this.timeoutId=void 0},this.options.wait)}throttle(e){if("debounce"===this.options.mode)return;const t=Date.now(),n=this.options.throttleMode||"leading-trailing";t-this.lastRun>=this.options.wait&&("leading-trailing"===n&&this.handler(e),this.lastRun=t),this.timeoutId&&window.clearTimeout(this.timeoutId),this.timeoutId=window.setTimeout(()=>{this.handler(e),this.lastRun=Date.now(),this.timeoutId=void 0},this.options.wait-(t-this.lastRun))}destroy(){this.timeoutId&&window.clearTimeout(this.timeoutId)}}class Lg{constructor(e,t){this.handler=e,this.options=t,this.controls=new Map,this.handle=e=>{const t=String(this.options.keyExtractor(e));let n=this.controls.get(t);n||(n=new zg(this.handler,this.baseOptions),this.controls.set(t,n)),n.handle(e)},this.baseOptions={mode:t.mode,wait:t.wait,..."throttle"===t.mode&&"throttleMode"in t?{throttleMode:t.throttleMode}:{}}}destroy(){for(const e of this.controls.values())e.destroy();this.controls.clear()}}function $g(e){return"keyExtractor"in e}function Fg(e,t,n){return e<t?t:e>n?n:e}function Og(e,t,n){if(e===t)return!0;if(null==e||null==t)return e===t;const r=typeof e;if(r!==typeof t)return!1;if("object"===r){n||(n=new Set);const r=function(e,t){return`${Vg(e)}__${Vg(t)}`}(e,t);if(n.has(r))return!0;n.add(r);const o=Array.isArray(e),i=Array.isArray(t);return o&&i?function(e,t,n){if(e.length!==t.length)return!1;const r=new Array(t.length).fill(!1);e:for(let o=0;o<e.length;o++){const i=e[o];for(let e=0;e<t.length;e++)if(!r[e]&&Og(i,t[e],n)){r[e]=!0;continue e}return!1}return!0}(e,t,n):!o&&!i&&function(e,t,n){const r=Object.keys(e).sort(),o=Object.keys(t).sort();if(r.length!==o.length)return!1;for(let i=0;i<r.length;i++)if(r[i]!==o[i])return!1;for(const i of r){if(!Og(e[i],t[i],n))return!1}return!0}(e,t,n)}return!1}let Hg=0;const qg=new WeakMap;function Vg(e){return qg.has(e)||qg.set(e,++Hg),qg.get(e)}function Bg(){const e=new Set;return{emit:(t=void 0)=>e.forEach(e=>e(t)),on:t=>(e.add(t),()=>e.delete(t)),off:t=>e.delete(t),clear:()=>e.clear()}}function Ug(e,t=Og){const n=new Set,r=new Map;let o=e;const i=(e,t)=>{let i=e,s=()=>{};if(t){if($g(t)){const n=new Lg(e,t);i=n.handle,s=()=>n.destroy()}else{const n=new zg(e,t);i=n.handle,s=()=>n.destroy()}r.set(e,{wrapped:i,destroy:s})}return void 0!==o&&i(o),n.add(i),()=>{n.delete(i),s(),r.delete(e)}};return{get value(){return o},emit(e=void 0){void 0!==o&&t(o,e)||(o=e,(e=>{n.forEach(t=>t(e))})(e))},on:i,off(e){const t=r.get(e);t?(n.delete(t.wrapped),t.destroy(),r.delete(e)):n.delete(e)},clear(){n.clear(),r.forEach(e=>e.destroy()),r.clear()},select:(e,t=Og)=>(n,r)=>{let s;if(void 0!==o){const t=e(o);s=t,n(t)}return i(r=>{const o=e(r);void 0!==s&&t(s,o)||(s=o,n(o))},r)}}}function Wg(e,t){const n=(null==t?void 0:t.cache)??!0,r=(null==t?void 0:t.equality)??Og,o=new Map,i=new Map,s=new Map,a=new Set,l=new Map,c=e=>String(e);return{emit(t,s){const l=c(t);if(n){const e=o.get(l);if(void 0!==e&&r(e,s))return;o.set(l,s)}const u=i.get(l);u&&u.forEach(e=>e(s));const d=e(t,s);a.forEach(e=>e(d))},forScope(e){const t=c(e);return(e,r)=>{const a=(e=>{let t=i.get(e);return t||(t=new Set,i.set(e,t)),t})(t),l=(e=>{let t=s.get(e);return t||(t=new Map,s.set(e,t)),t})(t);let c=e,u=()=>{};if(r){if($g(r)){const t=new Lg(e,r);c=t.handle,u=()=>t.destroy()}else{const t=new zg(e,r);c=t.handle,u=()=>t.destroy()}l.set(e,{wrapped:c,destroy:u})}if(n){const e=o.get(t);void 0!==e&&c(e)}return a.add(c),()=>{a.delete(c),u(),l.delete(e),0===a.size&&i.delete(t),0===l.size&&s.delete(t)}}},onGlobal:(e,t)=>{let n=e,r=()=>{};if(t){if($g(t)){const o=new Lg(e,t);n=o.handle,r=()=>o.destroy()}else{const o=new zg(e,t);n=o.handle,r=()=>o.destroy()}l.set(e,{wrapped:n,destroy:r})}return a.add(n),()=>{a.delete(n),r(),l.delete(e)}},getValue:e=>n?o.get(c(e)):void 0,getScopes:()=>n?Array.from(o.keys()):Array.from(i.keys()),clearScope(e){const t=c(e);n&&o.delete(t);const r=i.get(t);r&&(r.clear(),i.delete(t));const a=s.get(t);a&&(a.forEach(e=>e.destroy()),a.clear(),s.delete(t))},clear(){n&&o.clear(),i.forEach(e=>e.clear()),i.clear(),s.forEach(e=>{e.forEach(e=>e.destroy()),e.clear()}),s.clear(),a.clear(),l.forEach(e=>e.destroy()),l.clear()}}}class Gg{constructor(e){this.autoMountElements=[],this.package=e}addUtility(e){return this.autoMountElements.push({component:e,type:"utility"}),this}addWrapper(e){return this.autoMountElements.push({component:e,type:"wrapper"}),this}build(){return{...this.package,autoMountElements:()=>this.autoMountElements}}}function Zg(e){return new Gg(e)}const Kg=Bt.createContext({registry:null,coreState:null,isInitializing:!0,pluginsReady:!1,activeDocumentId:null,activeDocument:null,documents:{},documentStates:[]});function Yg({plugins:e,children:t}){const{utilities:n,wrappers:r}=Bt.useMemo(()=>{const t=[],n=[];for(const r of e){const e=r.package;if(Rg(e)){const r=e.autoMountElements()||[];for(const e of r)"utility"===e.type?t.push(e.component):"wrapper"===e.type&&n.push(e.component)}}return{utilities:t,wrappers:n}},[e]),o=Ut.jsxs(Bt.Fragment,{children:[t,n.map((e,t)=>Ut.jsx(e,{},`utility-${t}`))]}),i=r.reduce((e,t)=>Ut.jsx(t,{children:e}),o);return Ut.jsx(Bt.Fragment,{children:i})}function Xg({engine:e,config:t,logger:n,onInitialized:r,plugins:o,children:i,autoMountDomElements:s=!0}){const[a,l]=Bt.useState(null),[c,u]=Bt.useState(null),[d,h]=Bt.useState(!0),[p,g]=Bt.useState(!1),f=Bt.useRef(r);Bt.useEffect(()=>{f.current=r},[r]),Bt.useEffect(()=>{const r={...t,logger:(null==t?void 0:t.logger)??n},i=new _g(e,r);i.registerPluginBatch(o);let s;return(async()=>{var e;if(await i.initialize(),i.isDestroyed())return;const t=i.getStore();u(t.getState().core);const n=t.subscribe((e,n,r)=>{t.isCoreAction(e)&&n.core!==r.core&&u(n.core)});if(await(null==(e=f.current)?void 0:e.call(f,i)),!i.isDestroyed())return i.pluginsReady().then(()=>{i.isDestroyed()||g(!0)}),l(i),h(!1),n;n()})().then(e=>{s=e}).catch(console.error),()=>{null==s||s(),i.destroy(),l(null),u(null),h(!0),g(!1)}},[e,o]);const m=Bt.useMemo(()=>{const e=(null==c?void 0:c.activeDocumentId)??null,t=(null==c?void 0:c.documents)??{},n=(null==c?void 0:c.documentOrder)??[],r=e&&t[e]?t[e]:null,o=n.map(e=>t[e]).filter(e=>null!=e);return{registry:a,coreState:c,isInitializing:d,pluginsReady:p,activeDocumentId:e,activeDocument:r,documents:t,documentStates:o}},[a,c,d,p]),v="function"==typeof i?i(m):i;return Ut.jsx(Kg.Provider,{value:m,children:p&&s?Ut.jsx(Yg,{plugins:o,children:v}):v})}function Qg(){const e=Bt.useContext(Kg);if(void 0===e)throw new Error("useCapability must be used within a PDFContext.Provider");const{registry:t,isInitializing:n}=e;if(n)return e;if(null===t)throw new Error("PDF registry failed to initialize properly");return e}function Jg(e){const{registry:t}=Qg();if(null===t)return{plugin:null,isLoading:!0,ready:new Promise(()=>{})};const n=t.getPlugin(e);if(!n)throw new Error(`Plugin ${e} not found`);return{plugin:n,isLoading:!1,ready:n.ready()}}function ef(e){const{plugin:t,isLoading:n,ready:r}=Jg(e);if(!t)return{provides:null,isLoading:n,ready:r};if(!t.provides)throw new Error(`Plugin ${e} does not provide a capability`);return{provides:t.provides(),isLoading:n,ready:r}}function tf(){const{coreState:e}=Bt.useContext(Kg);return e}function nf(e){const t=tf();return Bt.useMemo(()=>t&&e?t.documents[e]??null:null,[t,e])}qp.Print,qp.ModifyContents,qp.CopyContents,qp.ModifyAnnotations,qp.FillForms,qp.ExtractForAccessibility,qp.AssembleDocument,qp.PrintHighQuality,qp.Print,qp.ModifyContents,qp.CopyContents,qp.ModifyAnnotations,qp.FillForms,qp.ExtractForAccessibility,qp.AssembleDocument,qp.PrintHighQuality,qp.Print,qp.ModifyContents,qp.CopyContents,qp.ModifyAnnotations,qp.FillForms,qp.ExtractForAccessibility,qp.AssembleDocument,qp.PrintHighQuality;const rf=class extends jg{constructor(e,t,n){super(e,t),this.id=e,this.documentOpened$=Ug(),this.documentClosed$=Ug(),this.activeDocumentChanged$=Ug(),this.documentError$=Ug(),this.documentOrderChanged$=Ug(),this.openFileRequest$=Bg(),this.loadOptions=new Map,this.maxDocuments=null==n?void 0:n.maxDocuments}buildCapability(){return{openFileDialog:e=>this.openFileDialog(e),openDocumentUrl:e=>this.openDocumentUrl(e),openDocumentBuffer:e=>this.openDocumentBuffer(e),retryDocument:(e,t)=>this.retryDocument(e,t),closeDocument:e=>this.closeDocument(e),closeAllDocuments:()=>this.closeAllDocuments(),setActiveDocument:e=>{if(!this.isDocumentOpen(e))throw new Error(`Cannot set active document: ${e} is not open`);this.dispatchCoreAction((e=>({type:pg,payload:e}))(e))},getActiveDocumentId:()=>this.coreState.core.activeDocumentId,getActiveDocument:()=>{var e;const t=this.coreState.core.activeDocumentId;return t?(null==(e=this.coreState.core.documents[t])?void 0:e.document)??null:null},getDocumentOrder:()=>this.coreState.core.documentOrder,moveDocument:(e,t)=>{this.dispatchCoreAction(((e,t)=>({type:fg,payload:{documentId:e,toIndex:t}}))(e,t))},swapDocuments:(e,t)=>{const n=this.coreState.core.documentOrder,r=n.indexOf(e),o=n.indexOf(t);if(-1===r||-1===o)throw new Error("One or both documents not found in order");const i=[...n];[i[r],i[o]]=[i[o],i[r]],this.dispatchCoreAction((e=>({type:gg,payload:e}))(i))},getDocument:e=>{var t;return(null==(t=this.coreState.core.documents[e])?void 0:t.document)??null},getDocumentState:e=>this.coreState.core.documents[e]??null,getOpenDocuments:()=>this.coreState.core.documentOrder.map(e=>this.coreState.core.documents[e]).filter(e=>null!==e),isDocumentOpen:e=>this.isDocumentOpen(e),getDocumentCount:()=>Object.keys(this.coreState.core.documents).length,getDocumentIndex:e=>this.coreState.core.documentOrder.indexOf(e),setDocumentEncryption:(e,t)=>this.setDocumentEncryption(e,t),unlockOwnerPermissions:(e,t)=>this.unlockOwnerPermissions(e,t),removeEncryption:e=>this.removeEncryption(e),onDocumentOpened:this.documentOpened$.on,onDocumentClosed:this.documentClosed$.on,onDocumentError:this.documentError$.on,onActiveDocumentChanged:this.activeDocumentChanged$.on,onDocumentOrderChanged:this.documentOrderChanged$.on}}isDocumentOpen(e){return!!this.coreState.core.documents[e]}onDocumentLoaded(e){const t=this.coreState.core.documents[e];t&&"loaded"===t.status&&(this.loadOptions.delete(e),this.documentOpened$.emit(t),this.logger.info("DocumentManagerPlugin","DocumentOpened",`Document ${e} opened successfully`,{name:t.name}))}onDocumentClosed(e){this.loadOptions.delete(e),this.documentClosed$.emit(e),this.logger.info("DocumentManagerPlugin","DocumentClosed",`Document ${e} closed`)}onActiveDocumentChanged(e,t){this.activeDocumentChanged$.emit({previousDocumentId:e,currentDocumentId:t}),this.logger.info("DocumentManagerPlugin","ActiveDocumentChanged",`Active document changed from ${e} to ${t}`)}onCoreStoreUpdated(e,t){e.core.documentOrder!==t.core.documentOrder&&this.documentOrderChanged$.emit({order:t.core.documentOrder})}onOpenFileRequest(e){return this.openFileRequest$.on(e)}openDocumentUrl(e){const t=new jp,n=e.documentId||this.generateDocumentId(),r=this.checkDocumentLimit();if(r)return t.reject(r),t;const o=e.name??this.extractNameFromUrl(e.url);this.loadOptions.set(n,e),this.dispatchCoreAction(xg(n,o,e.scale,e.rotation,!!e.password,e.autoActivate,e.permissions)),this.logger.info("DocumentManagerPlugin","OpenD
2ocumentUrl",`Starting to load document from URL: ${e.url}`,{documentId:n,passwordProvided:!!e.password});const i={id:n,url:e.url},s=this.engine.openDocumentUrl(i,{password:e.password,mode:e.mode,requestOptions:e.requestOptions,normalizeRotation:!0});return t.resolve({documentId:n,task:s}),this.handleLoadTask(n,s,"OpenDocumentUrl"),t}openDocumentBuffer(e){const t=new jp,n=this.checkDocumentLimit();if(n)return t.reject(n),t;const r=e.documentId||this.generateDocumentId();this.loadOptions.set(r,e),this.dispatchCoreAction(xg(r,e.name,e.scale,e.rotation,!!e.password,e.autoActivate,e.permissions)),this.logger.info("DocumentManagerPlugin","OpenDocumentBuffer",`Starting to load document from buffer: ${e.name}`,{documentId:r,passwordProvided:!!e.password});const o={id:r,content:e.buffer},i=this.engine.openDocumentBuffer(o,{password:e.password,normalizeRotation:!0});return t.resolve({documentId:r,task:i}),this.handleLoadTask(r,i,"OpenDocumentBuffer"),t}retryDocument(e,t){const n=new jp,r=this.validateRetry(e);if(!r.valid)return n.reject(r.error),n;const o={...this.loadOptions.get(e),...(null==t?void 0:t.password)&&{password:t.password}};this.loadOptions.set(e,o),this.dispatchCoreAction(((e,t)=>({type:dg,payload:{documentId:e,passwordProvided:t}}))(e,!!(null==t?void 0:t.password))),this.logger.info("DocumentManagerPlugin","RetryDocument",`Retrying to load document ${e}`,{passwordProvided:!!(null==t?void 0:t.password)});const i="url"in o?this.retryUrlDocument(e,o):this.retryBufferDocument(e,o);return n.resolve({documentId:e,task:i}),this.handleLoadTask(e,i,"RetryDocument"),n}openFileDialog(e){const t=new jp;return this.openFileRequest$.emit({task:t,options:e}),t}closeDocument(e){const t=new jp,n=this.coreState.core.documents[e];return n?("loaded"===n.status&&n.document?this.engine.closeDocument(n.document).wait(()=>{this.dispatchCoreAction(Cg(e)),t.resolve()},n=>{this.logger.error("DocumentManagerPlugin","CloseDocument",`Failed to close document ${e}`,n),t.fail(n)}):(this.logger.info("DocumentManagerPlugin","CloseDocument",`Closing document ${e} in ${n.status} state (skipping engine close)`),this.dispatchCoreAction(Cg(e)),t.resolve()),t):(this.logger.warn("DocumentManagerPlugin","CloseDocument",`Cannot close document ${e}: not found in state`),t.resolve(),t)}closeAllDocuments(){const e=Object.keys(this.coreState.core.documents),t=e.map(e=>this.closeDocument(e));return this.logger.info("DocumentManagerPlugin","CloseAllDocuments",`Closing ${e.length} documents`),jp.all(t)}setDocumentEncryption(e,t){const n=new jp,r=this.coreState.core.documents[e];if(!(null==r?void 0:r.document))return n.reject({code:Bp.DocNotOpen,message:`Document ${e} is not open`}),n;this.logger.info("DocumentManagerPlugin","SetDocumentEncryption",`Setting encryption on document ${e}`,{hasUserPassword:!!t.userPassword,allowedFlags:t.allowedFlags});return this.engine.setDocumentEncryption(r.document,t.userPassword??"",t.ownerPassword,t.allowedFlags).wait(t=>{t&&this.logger.info("DocumentManagerPlugin","SetDocumentEncryption",`Encryption set successfully on document ${e}`),n.resolve(t)},t=>{this.logger.error("DocumentManagerPlugin","SetDocumentEncryption",`Failed to set encryption on document ${e}`,t),n.fail(t)}),n}unlockOwnerPermissions(e,t){const n=new jp,r=this.coreState.core.documents[e];if(!(null==r?void 0:r.document))return n.reject({code:Bp.DocNotOpen,message:`Document ${e} is not open`}),n;const o=r.document;this.logger.info("DocumentManagerPlugin","UnlockOwnerPermissions",`Attempting to unlock owner permissions on document ${e}`);return this.engine.unlockOwnerPermissions(o,t).wait(t=>{if(t){this.logger.info("DocumentManagerPlugin","UnlockOwnerPermissions",`Owner permissions unlocked on document ${e}`);const t=4294967295;this.dispatchCoreAction(((e,t,n)=>({type:mg,payload:{documentId:e,permissions:t,isOwnerUnlocked:n}}))(e,t,!0))}n.resolve(t)},t=>{this.logger.error("DocumentManagerPlugin","UnlockOwnerPermissions",`Failed to unlock owner permissions on document ${e}`,t),n.fail(t)}),n}removeEncryption(e){const t=new jp,n=this.coreState.core.documents[e];if(!(null==n?void 0:n.document))return t.reject({code:Bp.DocNotOpen,message:`Document ${e} is not open`}),t;this.logger.info("DocumentManagerPlugin","RemoveEncryption",`Marking document ${e} for encryption removal on save`);return this.engine.removeEncryption(n.document).wait(n=>{n&&this.logger.info("DocumentManagerPlugin","RemoveEncryption",`Document ${e} marked for encryption removal`),t.resolve(n)},n=>{this.logger.error("DocumentManagerPlugin","RemoveEncryption",`Failed to mark document ${e} for encryption removal`,n),t.fail(n)}),t}checkDocumentLimit(){return this.maxDocuments&&Object.keys(this.coreState.core.documents).length>=this.maxDocuments?{code:Bp.Unknown,message:`Maximum number of documents (${this.maxDocuments}) reached`}:null}validateRetry(e){const t=this.coreState.core.documents[e];return t?"loaded"===t.status?{valid:!1,error:{code:Bp.Unknown,message:`Document ${e} is already loaded successfully`}}:"error"!==t.status?{valid:!1,error:{code:Bp.Unknown,message:`Document ${e} is not in error state (current state: ${t.status})`}}:this.loadOptions.has(e)?{valid:!0}:{valid:!1,error:{code:Bp.Unknown,message:`No retry information available for document ${e}`}}:{valid:!1,error:{code:Bp.NotFound,message:`Document ${e} not found`}}}retryUrlDocument(e,t){const n={id:e,url:t.url};return this.engine.openDocumentUrl(n,{password:t.password,mode:t.mode,requestOptions:t.requestOptions})}retryBufferDocument(e,t){const n={id:e,content:t.buffer};return this.engine.openDocumentBuffer(n,{password:t.password,normalizeRotation:!0})}
vendor: 98,323 bytes, line 2
2handleLoadTask(e,t,n){t.wait(t=>{this.dispatchCoreAction(((e,t)=>({type:cg,payload:{documentId:e,document:t}}))(e,t))},t=>{this.handleLoadError(e,t,n)})}handleLoadError(e,t,n){var r,o,i;const s=(null==(r=t.reason)?void 0:r.message)||"Failed to load document";this.logger.error("DocumentManagerPlugin",n,"Failed to load document",t),this.dispatchCoreAction(((e,t,n,r)=>({type:ug,payload:{documentId:e,error:t,errorCode:n,errorDetails:r}}))(e,s,null==(o=t.reason)?void 0:o.code,t.reason)),this.documentError$.emit({documentId:e,message:s,code:null==(i=t.reason)?void 0:i.code,reason:t.reason})}generateDocumentId(){return`doc-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}extractNameFromUrl(e){try{const t=new URL(e),n=t.pathname.split("/").pop();if(!n)return;let r=decodeURIComponent(n);return r.toLowerCase().endsWith(".pdf")||(r+=".pdf"),r}catch{return}}async initialize(e){var t;if(this.logger.info("DocumentManagerPlugin","Initialize","Document Manager Plugin initialized",{maxDocuments:this.maxDocuments,initialDocumentsCount:(null==(t=e.initialDocuments)?void 0:t.length)??0}),e.initialDocuments&&e.initialDocuments.length>0)for(const r of e.initialDocuments)try{"buffer"in r?this.openDocumentBuffer(r):"url"in r&&this.openDocumentUrl(r)}catch(n){this.logger.error("DocumentManagerPlugin","Initialize","Failed to initiate initial document load",n)}}async destroy(){await this.closeAllDocuments().toPromise(),this.loadOptions.clear(),this.documentOpened$.clear(),this.documentClosed$.clear(),this.activeDocumentChanged$.clear(),this.documentOrderChanged$.clear(),this.documentError$.clear(),super.destroy()}};rf.id="document-manager";let of=rf;const sf="document-manager",af=()=>ef(of.id);const lf=Zg({manifest:{id:sf,name:"Document Manager Plugin",version:"1.0.0",provides:["document-manager"],requires:[],optional:[],defaultConfig:{maxDocuments:10}},create:(e,t)=>new of(sf,e,t),reducer:e=>e,initialState:{}}).addUtility(function(){const{plugin:e}=Jg(of.id),{provides:t}=af(),n=Bt.useRef(null),r=Bt.useRef(null),o=Bt.useRef(void 0);return Bt.useEffect(()=>{if(!(null==e?void 0:e.onOpenFileRequest))return;return e.onOpenFileRequest(({task:e,options:t})=>{var i;r.current=e,o.current=t,null==(i=n.current)||i.click()})},[e]),Ut.jsx("input",{ref:n,type:"file",accept:"application/pdf",style:{display:"none"},onChange:async e=>{var n,i,s,a,l;const c=null==(n=e.currentTarget.files)?void 0:n[0];if(!c||!t)return;const u=await c.arrayBuffer();t.openDocumentBuffer({name:c.name,buffer:u,documentId:null==(i=o.current)?void 0:i.documentId,scale:null==(s=o.current)?void 0:s.scale,rotation:null==(a=o.current)?void 0:a.rotation,autoActivate:null==(l=o.current)?void 0:l.autoActivate}).wait(e=>{var t;null==(t=r.current)||t.resolve(e)},e=>{var t;null==(t=r.current)||t.fail(e)})}})}).build(),cf="INTERACTION/INIT_STATE",uf="INTERACTION/CLEANUP_STATE",df="INTERACTION/ACTIVATE_MODE",hf="INTERACTION/PAUSE",pf="INTERACTION/RESUME",gf="INTERACTION/SET_CURSOR",ff="INTERACTION/SET_DEFAULT_MODE",mf="INTERACTION/SET_EXCLUSION_RULES",vf="INTERACTION/ADD_EXCLUSION_CLASS",yf="INTERACTION/REMOVE_EXCLUSION_CLASS",bf="INTERACTION/ADD_EXCLUSION_ATTRIBUTE",wf="INTERACTION/REMOVE_EXCLUSION_ATTRIBUTE";function xf(e){return{type:ff,payload:{mode:e}}}function Cf(e){return{type:mf,payload:{rules:e}}}const Sf="pointerMode",If=class extends jg{constructor(e,t,n){super(e,t),this.modes=new Map,this.cursorClaims=new Map,this.buckets=new Map,this.alwaysGlobal=new Map,this.alwaysPage=new Map,this.pageActivities=new Map,this.onModeChange$=Bg(),this.onHandlerChange$=Bg(),this.onCursorChange$=Bg(),this.onStateChange$=Ug(),this.onPageActivityChange$=Bg(),this.registerMode({id:Sf,scope:"page",exclusive:!1,cursor:"auto"}),this.dispatch(xf(Sf)),n.exclusionRules&&this.dispatch(Cf(n.exclusionRules))}onDocumentLoadingStarted(e){const t={activeMode:this.state.defaultMode,cursor:"auto",paused:!1};this.dispatch(function(e,t){return{type:cf,payload:{documentId:e,state:t}}}(e,t)),this.cursorClaims.set(e,new Map),this.buckets.set(e,new Map),this.alwaysGlobal.set(e,new Set),this.alwaysPage.set(e,new Map),this.pageActivities.set(e,new Map);const n=this.buckets.get(e);for(const r of this.modes.keys())n.set(r,{global:new Set,page:new Map});this.logger.debug("InteractionManagerPlugin","DocumentOpened",`Initialized interaction state for document: ${e}`)}onDocumentClosed(e){const t=this.pageActivities.get(e);if(t){const n=new Set(t.values());t.clear();for(const t of n)this.onPageActivityChange$.emit({documentId:e,pageIndex:t,hasActivity:!1})}this.cursorClaims.delete(e),this.buckets.delete(e),this.alwaysGlobal.delete(e),this.alwaysPage.delete(e),this.pageActivities.delete(e),this.dispatch(function(e){return{type:uf,payload:e}}(e)),this.logger.debug("InteractionManagerPlugin","DocumentClosed",`Cleaned up interaction state for document: ${e}`)}buildCapability(){return{getActiveMode:()=>this.getActiveMode(),getActiveInteractionMode:()=>this.getActiveInteractionMode(),activate:e=>this.activate(e),activateDefaultMode:()=>this.activateDefaultMode(),setCursor:(e,t,n)=>this.setCursor(e,t,n),getCurrentCursor:()=>this.getCurrentCursor(),removeCursor:e=>this.removeCursor(e),getHandlersForScope:e=>this.getHandlersForScope(e),activeModeIsExclusive:()=>this.activeModeIsExclusive(),pause:()=>this.pause(),resume:()=>this.resume(),isPaused:()=>this.registry.isDestroyed()||this.isPaused(),getState:()=>this.getDocumentStateOrThrow(),forDocument:e=>this.createInteractionScope(e),registerMode:e=>this.registerMode(e),registerHandlers:e=>this.registerHandlers(e),registerAlways:e=>this.registerAlways(e),setDefaultMode:e=>this.setDefaultMode(e),getDefaultMode:()=>this.state.defaultMode,getExclusionRules:()=>this.state.exclusionRules,setExclusionRules:e=>this.dispatch(Cf(e)),addExclusionClass:e=>this.dispatch(function(e){return{type:vf,payload:{className:e}}}(e)),removeExclusionClass:e=>this.dispatch(function(e){return{type:yf,payload:{className:e}}}(e)),addExclusionAttribute:e=>this.dispatch(function(e){return{type:bf,payload:{attribute:e}}}(e)),removeExclusionAttribute:e=>this.dispatch(function(e){return{type:wf,payload:{attribute:e}}}(e)),claimPageActivity:(e,t,n)=>this.claimPageActivity(e,t,n),releasePageActivity:(e,t)=>this.releasePageActivity(e,t),hasPageActivity:(e,t)=>this.hasPageActivity(e,t),onModeChange:this.onModeChange$.on,onCursorChange:this.onCursorChange$.on,onHandlerChange:this.onHandlerChange$.on,onStateChange:this.onStateChange$.on,onPageActivityChange:this.onPageActivityChange$.on}}createInteractionScope(e){return{getActiveMode:()=>this.getActiveMode(e),getActiveInteractionMode:()=>this.getActiveInteractionMode(e),activate:t=>this.activate(t,e),activateDefaultMode:()=>this.activateDefaultMode(e),setCursor:(t,n,r)=>this.setCursor(t,n,r,e),getCurrentCursor:()=>this.getCurrentCursor(e),removeCursor:t=>this.removeCursor(t,e),getHandlersForScope:e=>this.getHandlersForScope(e),activeModeIsExclusive:()=>this.activeModeIsExclusive(e),pause:()=>this.pause(e),resume:()=>this.resume(e),isPaused:()=>this.isPaused(e),getState:()=>this.getDocumentStateOrThrow(e),claimPageActivity:(t,n)=>this.claimPageActivity(e,t,n),releasePageActivity:t=>this.releasePageActivity(e,t),hasPageActivity:t=>this.hasPageActivity(e,t),onModeChange:t=>this.onModeChange$.on(n=>{n.documentId===e&&t(n.activeMode)}),onCursorChange:t=>this.onCursorChange$.on(n=>{n.documentId===e&&t(n.cursor)}),onStateChange:t=>this.onStateChange$.on(n=>{n.documentId===e&&t(n.state)}),onPageActivityChange:t=>this.onPageActivityChange$.on(n=>{n.documentId===e&&t({pageIndex:n.pageIndex,hasActivity:n.hasActivity})})}}getDocumentState(e){const t=e??this.getActiveDocumentId();return this.state.documents[t]??null}getDocumentStateOrThrow(e){const t=this.getDocumentState(e);if(!t)throw new Error(`Interaction state not found for document: ${e??"active"}`);return t}activate(e,t){var n;const r=t??this.getActiveDocumentId(),o=this.getDocumentStateOrThrow(r);if(!this.modes.has(e))throw new Error(`[interaction] unknown mode '${e}'`);if(e===o.activeMode)return;const i=o.activeMode;null==(n=this.cursorClaims.get(r))||n.clear(),this.notifyHandlersInactive(r,i),this.dispatch(function(e,t){return{type:df,payload:{documentId:e,mode:t}}}(r,e)),this.emitCursor(r),this.notifyHandlersActive(r,e),this.onModeChange$.emit({documentId:r,activeMode:e,previousMode:i})}activateDefaultMode(e){const t=e??this.getActiveDocumentIdOrNull();t&&this.activate(this.state.defaultMode,t)}setDefaultMode(e){if(!this.modes.has(e))throw new Error(`[interaction] cannot set unknown mode '${e}' as default`);this.dispatch(xf(e))}getActiveMode(e){return this.getDocumentStateOrThrow(e).activeMode}getActiveInteractionMode(e){const t=this.getDocumentState(e);return t?this.modes.get(t.activeMode)??null:null}activeModeIsExclusive(e){const t=this.getActiveInteractionMode(e);return!!(null==t?void 0:t.exclusive)}pause(e){const t=e??this.getActiveDocumentId();this.dispatch(function(e){return{type:hf,payload:e}}(t))}resume(e){const t=e??this.getActiveDocumentId();this.dispatch(function(e){return{type:pf,payload:e}}(t))}isPaused(e){return this.getDocumentStateOrThrow(e).paused}registerMode(e){this.modes.set(e.id,e);for(const t of this.buckets.keys()){const n=this.buckets.get(t);n.has(e.id)||n.set(e.id,{global:new Set,page:new Map})}}registerHandlers({documentId:e,modeId:t,handlers:n,pageIndex:r}){const o=Array.isArray(t)?t:[t],i=[],s=this.buckets.get(e);if(!s)throw new Error(`No buckets found for document: ${e}`);for(const a of o){const e=s.get(a);if(!e)throw new Error(`unknown mode '${a}'`);if(null==r)e.global.add(n);else{const t=e.page.get(r)??new Set;t.add(n),e.page.set(r,t)}i.push(()=>{if(null==r)e.global.delete(n);else{const t=e.page.get(r);t&&(t.delete(n),0===t.size&&e.page.delete(r))}})}return this.onHandlerChange$.emit({...this.state}),()=>{i.forEach(e=>e()),this.onHandlerChange$.emit({...this.state})}}registerAlways({scope:e,handlers:t}){if("global"===e.type){const n=this.alwaysGlobal.get(e.documentId)??new Set;return n.add(t),this.alwaysGlobal.set(e.documentId,n),this.onHandlerChange$.emit({...this.state}),()=>{n.delete(t),this.onHandlerChange$.emit({...this.state})}}const n=this.alwaysPage.get(e.documentId)??new Map,r=n.get(e.pageIndex)??new Set;return r.add(t),n.set(e.pageIndex,r),this.alwaysPage.set(e.documentId,n),this.onHandlerChange$.emit({...this.state}),()=>{r.delete(t),this.onHandlerChange$.emit({...this.state})}}getHandlersForScope(e){var t;const n=this.getDocumentState(e.documentId);if(!n)return null;const r=this.modes.get(n.activeMode);if(!r)return null;const o=this.buckets.get(e.documentId);if(!o)return null;const i=o.get(r.id);if(!i)return null;const s=(e,t)=>e.size||t.size?function(e){const t=["onPointerDown","onPointerUp","onPointerMove","onPointerEnter","onPointerLeave","onPointerCancel","onMouseDown","onMouseUp","onMouseMove","onMouseEnter","onMouseLeave","onMouseCancel","onClick","onDoubleClick"],n={};for(const r of t)n[r]=(t,n,o)=>{var i;for(const s of e){if(n.isImmediatePropagationStopped())break;null==(i=s[r])||i.call(s,t,n,o)}};return n}([...e,...t]):null;if("global"===e.type){return s(this.alwaysGlobal.get(e.documentId)??new Set,"global"===r.scope?i.global:new Set)}return s((null==(t=this.alwaysPage.get(e.documentId))?void 0:t.get(e.pageIndex))??new Set,"page"===r.scope?i.page.get(e.pageIndex)??new Set:new Set)}setCursor(e,t,n=0,r){const o=r??this.getActiveDocumentId(),i=this.cursorClaims.get(o);i&&(i.set(e,{cursor:t,priority:n}),this.emitCursor(o))}removeCursor(e,t){const n=t??this.getActiveDocumentId(),r=this.cursorClaims.get(n);r&&(r.delete(e),this.emitCursor(n))}getCurrentCursor(e){return this.getDocumentStateOrThrow(e).cursor}emitCursor(e){var t;const n=this.cursorClaims.get(e);if(!n)return;const r=this.getDocumentState(e);if(!r)return;const o=[...n.values()].sort((e,t)=>t.priority-e.priority)[0]??{cursor:(null==(t=this.modes.get(r.activeMode))?void 0:t.cursor)??"auto"};o.cursor!==r.cursor&&(this.dispatch(function(e,t){return{type:gf,payload:{documentId:e,cursor:t}}}(e,o.cursor)),this.onCursorChange$.emit({documentId:e,cursor:o.cursor}))}claimPageActivity(e,t,n){let r=this.pageActivities.get(e);r||(r=new Map,this.pageActivities.set(e,r));const o=r.get(t);o!==n&&(r.set(t,n),void 0===o||this.pageHasAnyTopic(e,o)||this.onPageActivityChange$.emit({documentId:e,pageIndex:o,hasActivity:!1}),1===this.countTopicsOnPage(e,n)&&this.onPageActivityChange$.emit({documentId:e,pageIndex:n,hasActivity:!0}))}releasePageActivity(e,t){const n=this.pageActivities.get(e);if(!n)return;const r=n.get(t);void 0!==r&&(n.delete(t),this.pageHasAnyTopic(e,r)||this.onPageActivityChange$.emit({documentId:e,pageIndex:r,hasActivity:!1}))}hasPageActivity(e,t){return this.pageHasAnyTopic(e,t)}pageHasAnyTopic(e,t){const n=this.pageActivities.get(e);if(!n)return!1;for(const r of n.values())if(r===t)return!0;return!1}countTopicsOnPage(e,t){const n=this.pageActivities.get(e);if(!n)return 0;let r=0;for(const o of n.values())o===t&&r++;return r}notifyHandlersActive(e,t){var n,r;null==(n=this.alwaysGlobal.get(e))||n.forEach(e=>{var n;null==(n=e.onHandlerActiveStart)||n.call(e,t)}),null==(r=this.alwaysPage.get(e))||r.forEach(e=>{e.forEach(e=>{var n;null==(n=e.onHandlerActiveStart)||n.call(e,t)})});const o=this.modes.get(t);if(!o)return;const i=this.buckets.get(e);if(!i)return;const s=i.get(t);s&&("global"===o.scope&&s.global.forEach(e=>{var n;null==(n=e.onHandlerActiveStart)||n.call(e,t)}),"page"===o.scope&&s.page.forEach(e=>{e.forEach(e=>{var n;null==(n=e.onHandlerActiveStart)||n.call(e,t)})}))}notifyHandlersInactive(e,t){var n,r;null==(n=this.alwaysGlobal.get(e))||n.forEach(e=>{var n;null==(n=e.onHandlerActiveEnd)||n.call(e,t)}),null==(r=this.alwaysPage.get(e))||r.forEach(e=>{e.forEach(e=>{var n;null==(n=e.onHandlerActiveEnd)||n.call(e,t)})});const o=this.modes.get(t);if(!o)return;const i=this.buckets.get(e);if(!i)return;const s=i.get(t);s&&("global"===o.scope&&s.global.forEach(e=>{var n;null==(n=e.onHandlerActiveEnd)||n.call(e,t)}),"page"===o.scope&&s.page.forEach(e=>{e.forEach(e=>{var n;null==(n=e.onHandlerActiveEnd)||n.call(e,t)})}))}onStoreUpdated(e,t){for(const n in t.documents){const r=e.documents[n],o=t.documents[n];r!==o&&this.onStateChange$.emit({documentId:n,state:o})}}async initialize(e){this.logger.info("InteractionManagerPlugin","Initialize","Interaction Manager Plugin initialized")}async destroy(){this.pageActivities.clear(),this.onModeChange$.clear(),this.onCursorChange$.clear(),this.onHandlerChange$.clear(),this.onStateChange$.clear(),this.onPageActivityChange$.clear(),await super.destroy()}};If.id="interaction-manager";let kf=If;const Pf="interaction-manager",Df={defaultMode:"pointerMode",exclusionRules:{classes:[],dataAttributes:["data-no-interaction"]},documents:{},activeDocumentId:null},Mf={manifest:{id:Pf,name:"Interaction Manager Plugin",version:"1.0.0",provides:["interaction-manager"],requires:[],optional:[],defaultConfig:{exclusionRules:{classes:[],dataAttributes:["data-no-interaction"]}}},create:(e,t)=>new kf(Pf,e,t),reducer:(e=Df,t)=>{switch(t.type){case cf:{const{documentId:n,state:r}=t.payload;return{...e,documents:{...e.documents,[n]:r},activeDocumentId:e.activeDocumentId??n}}case uf:{const n=t.payload,{[n]:r,...o}=e.documents;return{...e,documents:o,activeDocumentId:e.activeDocumentId===n?null:e.activeDocumentId}}case"INTERACTION/SET_ACTIVE_DOCUMENT":return{...e,activeDocumentId:t.payload};case df:{const{documentId:n,mode:r}=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,activeMode:r}}}:e}case gf:{const{documentId:n,cursor:r}=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,cursor:r}}}:e}case hf:{const n=t.payload,r=e.documents[n];return r?{...e,documents:{...e.documents,[n]:{...r,paused:!0}}}:e}case pf:{const n=t.payload,r=e.documents[n];return r?{...e,documents:{...e.documents,[n]:{...r,paused:!1}}}:e}case ff:return{...e,defaultMode:t.payload.mode};case mf:return{...e,exclusionRules:t.payload.rules};case vf:return{...e,exclusionRules:{...e.exclusionRules,classes:[...e.exclusionRules.classes||[],t.payload.className].filter((e,t,n)=>n.indexOf(e)===t)}};case yf:return{...e,exclusionRules:{...e.exclusionRules,classes:(e.exclusionRules.classes||[]).filter(e=>e!==t.payload.className)}};case bf:return{...e,exclusionRules:{...e.exclusionRules,dataAttributes:[...e.exclusionRules.dataAttributes||[],t.payload.attribute].filter((e,t,n)=>n.indexOf(e)===t)}};case wf:return{...e,exclusionRules:{...e.exclusionRules,dataAttributes:(e.exclusionRules.dataAttributes||[]).filter(e=>e!==t.payload.attribute)}};default:return e}},initialState:Df},Ef=()=>ef(kf.id);const Tf={pointerdown:"onPointerDown",pointerup:"onPointerUp",pointermove:"onPointerMove",pointerenter:"onPointerEnter",pointerleave:"onPointerLeave",pointercancel:"onPointerCancel",mousedown:"onMouseDown",mouseup:"onMouseUp",mousemove:"onMouseMove",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousecancel:"onMouseCancel",click:"onClick",dblclick:"onDoubleClick",touchstart:"onPointerDown",touchend:"onPointerUp",touchmove:"onPointerMove",touchcancel:"onPointerCancel"},Af=["pointerdown","pointerup","pointermove","pointerenter","pointerleave","pointercancel","mousedown","mouseup","mousemove","mouseenter","mouseleave","mousecancel","click","dblclick"],_f="undefined"!=typeof PointerEvent?Af:[...Af,"touchstart","touchend","touchmove","touchcancel"];function Nf(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent}function Rf(e,t,n,r){const o=e.forDocument(t.documentId);let i=e.getHandlersForScope(t);const s=()=>{var e;return!1!==(null==(e=o.getActiveInteractionMode())?void 0:e.wantsRawTouch)},a={};let l=s();const c=e=>{_f.forEach(t=>{const r=a[t]??(a[t]=v);var o;n.addEventListener(t,r,(o=e,t.startsWith("touch")?{passive:!o}:{passive:!1}))})},u=()=>{_f.forEach(e=>{const t=a[e];t&&n.removeEventListener(e,t)})};c(l),n.style.touchAction=l?"none":"";const d=o.onModeChange(()=>{if("global"===t.type){const e=o.getActiveInteractionMode();n.style.cursor="global"===(null==e?void 0:e.scope)?e.cursor??"auto":"auto"}i=e.getHandlersForScope(t);const r=s();r!==l&&(u(),c(r),l=r,n.style.touchAction=l?"none":"")}),h=e.onHandlerChange(()=>{i=e.getHandlersForScope(t)}),p=o.getActiveInteractionMode(),g=o.getCurrentCursor();n.style.cursor="global"===t.type&&"global"!==(null==p?void 0:p.scope)?"auto":g;const f=o.onCursorChange(e=>{var r;"global"===t.type&&"global"!==(null==(r=o.getActiveInteractionMode())?void 0:r.scope)||(n.style.cursor=e)}),m=(e,t)=>{if(r)return r(e,t);const n=t.getBoundingClientRect();return{x:e.clientX-n.left,y:e.clientY-n.top}};function v(t){var r;if(e.isPaused())return;const s=e.getExclusionRules();if(t.target&&function(e,t){var n,r,o;if(!e)return!1;let i=e;for(;i;){if(null==(n=t.classes)?void 0:n.length)for(const e of t.classes)if(null==(r=i.classList)?void 0:r.contains(e))return!0;if(null==(o=t.dataAttributes)?void 0:o.length)for(const e of t.dataAttributes)if(i.hasAttribute(e))return!0;i=i.parentElement}return!1}(t.target,s))return;const a=Tf[t.type];if(!a||!(null==i?void 0:i[a]))return;let c,u;Nf(t)&&l&&("touchmove"===t.type||"touchcancel"===t.type)&&t.preventDefault();let d=!1;if(Nf(t)){const e="touchend"===t.type||"touchcancel"===t.type?t.changedTouches[0]:t.touches[0];if(!e)return;c=m(e,n),u={clientX:e.clientX,clientY:e.clientY,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey,target:t.target,currentTarget:t.currentTarget,setPointerCapture:()=>{},releasePointerCapture:()=>{},stopImmediatePropagation:()=>{d=!0},isImmediatePropagationStopped:()=>d}}else{const e=t;c=m(e,n),u={clientX:e.clientX,clientY:e.clientY,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,target:e.target,currentTarget:e.currentTarget,setPointerCapture:()=>{var t,n;null==(n=null==(t=e.target)?void 0:t.setPointerCapture)||n.call(t,e.pointerId)},releasePointerCapture:()=>{var t,n;null==(n=null==(t=e.target)?void 0:t.releasePointerCapture)||n.call(t,e.pointerId)},stopImmediatePropagation:()=>{d=!0},isImmediatePropagationStopped:()=>d}}null==(r=i[a])||r.call(i,c,u,o.getActiveMode())}return()=>{u(),d(),f(),h()}}const jf=({children:e,documentId:t,style:n,...r})=>{const o=Bt.useRef(null),{provides:i}=Ef();return Bt.useEffect(()=>{if(i&&o.current)return Rf(i,{type:"global",documentId:t},o.current)},[i,t]),Ut.jsx("div",{ref:o,style:{width:"100%",height:"100%",...n},...r,children:e})},zf=({documentId:e,pageIndex:t,children:n,rotation:r,scale:o,convertEventToPoint:i,style:s,...a})=>{var l,c;const u=Bt.useRef(null),{provides:d}=Ef(),h=function(e){const{provides:t}=Ef(),[n,r]=Bt.useState(()=>{if(!t)return!1;const n=t.forDocument(e).getActiveInteractionMode();return"page"===(null==n?void 0:n.scope)&&!!n.exclusive});return Bt.useEffect(()=>{if(!t)return;const n=t.forDocument(e);return n.onModeChange(()=>{const e=n.getActiveInteractionMode();r("page"===(null==e?void 0:e.scope)&&!!(null==e?void 0:e.exclusive))})},[t,e]),n}(e),p=nf(e),g=null==(c=null==(l=null==p?void 0:p.document)?void 0:l.pages)?void 0:c[t],f=(null==g?void 0:g.size)??{width:0,height:0},m=(null==g?void 0:g.rotation)??0,v=(null==p?void 0:p.rotation)??0,y=void 0!==r?r:(m+v)%4,b=o??(null==p?void 0:p.scale)??1,w=xp(f,0,b),x=Bt.useCallback((e,t)=>{const n=t.getBoundingClientRect(),r={x:e.clientX-n.left,y:e.clientY-n.top};return function(e,t,n,r){return Sp(Cp(e,t,(4-n)%4),1/r)}(xp({width:w.width,height:w.height},y,1),r,y,b)},[f,y,b]);return Bt.useEffect(()=>{if(d&&u.current)return Rf(d,{type:"page",documentId:e,pageIndex:t},u.current,i||x)},[d,e,t,i,x]),Ut.jsxs("div",{ref:u,style:{position:"relative",width:w.width,height:w.height,...s},...a,children:[n,h&&Ut.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:10}})]})},Lf=class extends jg{constructor(e,t,n){super(e,t),this.config=n}buildCapability(){return{renderPage:e=>this.renderPage(e),renderPageRect:e=>this.renderPageRect(e),renderPageRaw:e=>this.renderPageRaw(e),renderPageRectRaw:e=>this.renderPageRectRaw(e),forDocument:e=>this.createRenderScope(e)}}createRenderScope(e){return{renderPage:t=>this.renderPage(t,e),renderPageRect:t=>this.renderPageRect(t,e),renderPageRaw:t=>this.renderPageRaw(t,e),renderPageRectRaw:t=>this.renderPageRectRaw(t,e)}}renderPage({pageIndex:e,options:t},n){const r=n??this.getActiveDocumentId(),o=this.coreState.core.documents[r];if(!(null==o?void 0:o.document))throw new Error(`Document ${r} not loaded`);const i=o.document.pages.find(t=>t.index===e);if(!i)throw new Error(`Page ${e} not found in document ${r}`);const s={...t??{},withForms:(null==t?void 0:t.withForms)??this.config.withForms??!1,withAnnotations:(null==t?void 0:t.withAnnotations)??this.config.withAnnotations??!1,imageType:(null==t?void 0:t.imageType)??this.config.defaultImageType??"image/png",imageQuality:(null==t?void 0:t.imageQuality)??this.config.defaultImageQuality??.92};return this.engine.renderPage(o.document,i,s)}renderPageRect({pageIndex:e,rect:t,options:n},r){const o=r??this.getActiveDocumentId(),i=this.coreState.core.documents[o];if(!(null==i?void 0:i.document))throw new Error(`Document ${o} not loaded`);const s=i.document.pages.find(t=>t.index===e);if(!s)throw new Error(`Page ${e} not found in document ${o}`);const a={...n??{},withForms:(null==n?void 0:n.withForms)??this.config.withForms??!1,withAnnotations:(null==n?void 0:n.withAnnotations)??this.config.withAnnotations??!1,imageType:(null==n?void 0:n.imageType)??this.config.defaultImageType??"image/png",imageQuality:(null==n?void 0:n.imageQuality)??this.config.defaultImageQuality??.92};return this.engine.renderPageRect(i.document,s,t,a)}renderPageRaw({pageIndex:e,options:t},n){const r=n??this.getActiveDocumentId(),o=this.coreState.core.documents[r];if(!(null==o?void 0:o.document))throw new Error(`Document ${r} not loaded`);const i=o.document.pages.find(t=>t.index===e);if(!i)throw new Error(`Page ${e} not found in document ${r}`);const s={...t??{},withForms:(null==t?void 0:t.withForms)??this.config.withForms??!1,withAnnotations:(null==t?void 0:t.withAnnotations)??this.config.withAnnotations??!1};return this.engine.renderPageRaw(o.document,i,s)}renderPageRectRaw({pageIndex:e,rect:t,options:n},r){const o=r??this.getActiveDocumentId(),i=this.coreState.core.documents[o];if(!(null==i?void 0:i.document))throw new Error(`Document ${o} not loaded`);const s=i.document.pages.find(t=>t.index===e);if(!s)throw new Error(`Page ${e} not found in document ${o}`);const a={...n??{},withForms:(null==n?void 0:n.withForms)??this.config.withForms??!1,withAnnotations:(null==n?void 0:n.withAnnotations)??this.config.withAnnotations??!1};return this.engine.renderPageRectRaw(i.document,s,t,a)}async initialize(e){this.logger.info("RenderPlugin","Initialize","Render plugin initialized")}async destroy(){super.destroy()}};Lf.id="render";let $f=Lf;const Ff="render",Of={manifest:{id:Ff,name:"Render Plugin",version:"1.0.0",provides:["render"],requires:[],optional:[],defaultConfig:{}},create:(e,t)=>new $f(Ff,e,t),reducer:()=>{},initialState:{}};function Hf({documentId:e,pageIndex:t,scale:n,dpr:r,style:o,...i}){const{provides:s}=ef($f.id),a=nf(e),[l,c]=Bt.useState(null),u=Bt.useRef(null),d=Bt.useMemo(()=>a&&a.pageRefreshVersions[t]||0,[a,t]),h=Bt.useMemo(()=>void 0!==n?n:(null==a?void 0:a.scale)??1,[n,null==a?void 0:a.scale]),p=Bt.useMemo(()=>void 0!==r?r:window.devicePixelRatio,[r]);Bt.useEffect(()=>{if(!s)return;const n=s.forDocument(e).renderPage({pageIndex:t,options:{scaleFactor:h,dpr:p}});return n.wait(e=>{const t=URL.createObjectURL(e);c(t),u.current=t},eg),()=>{u.current?(URL.revokeObjectURL(u.current),u.current=null):n.abort({code:Bp.Cancelled,message:"canceled render task"})}},[e,t,h,p,s,d]);return Ut.jsx(Bt.Fragment,{children:l&&Ut.jsx("img",{src:l,onLoad:()=>{u.current&&(URL.revokeObjectURL(u.current),u.current=null)},...i,style:{width:"100%",height:"100%",...o||{}}})})}const qf="rotate",Vf={id:qf,name:"Rotate Plugin",version:"1.0.0",provides:["rotate"],requires:[],optional:[],defaultConfig:{}};const Bf="ROTATE/INIT_STATE",Uf="ROTATE/CLEANUP_STATE",Wf="ROTATE/SET_ROTATION";const Gf=class extends jg{constructor(e,t,n){super(e,t),this.rotate$=Ug(),this.defaultRotation=n.defaultRotation??0}onDocumentLoadingStarted(e){const t={rotation:this.defaultRotation};this.dispatch(function(e,t){return{type:Bf,payload:{documentId:e,state:t}}}(e,t)),this.dispatchCoreAction(Sg(this.defaultRotation,e)),this.logger.debug("RotatePlugin","DocumentOpened",`Initialized rotation state for document: ${e}`)}onDocumentClosed(e){this.dispatch(function(e){return{type:Uf,payload:e}}(e)),this.logger.debug("RotatePlugin","DocumentClosed",`Cleaned up rotation state for document: ${e}`)}buildCapability(){return{setRotation:e=>this.setRotationForDocument(e),getRotation:()=>this.getRotationForDocument(),rotateForward:()=>this.rotateForward(),rotateBackward:()=>this.rotateBackward(),forDocument:e=>this.createRotateScope(e),onRotateChange:this.rotate$.on}}createRotateScope(e){return{setRotation:t=>this.setRotationForDocument(t,e),getRotation:()=>this.getRotationForDocument(e),rotateForward:()=>this.rotateForward(e),rotateBackward:()=>this.rotateBackward(e),onRotateChange:t=>this.rotate$.on(n=>{n.documentId===e&&t(n.rotation)})}}getDocumentState(e){const t=e??this.getActiveDocumentId();return this.state.documents[t]??null}getDocumentStateOrThrow(e){const t=this.getDocumentState(e);if(!t)throw new Error(`Rotation state not found for document: ${e??"active"}`);return t}setRotationForDocument(e,t){const n=t??this.getActiveDocumentId(),r=this.coreState.core.documents[n];if(!(null==r?void 0:r.document))throw new Error(`Document ${n} not loaded`);this.dispatch(function(e,t){return{type:Wf,payload:{documentId:e,rotation:t}}}(n,e)),this.dispatchCoreAction(Sg(e,n)),this.rotate$.emit({documentId:n,rotation:e})}getRotationForDocument(e){return this.getDocumentStateOrThrow(e).rotation}rotateForward(e){const t=e??this.getActiveDocumentId(),n=this.getRotationForDocument(t),r=(n+1)%4;this.setRotationForDocument(r,t)}rotateBackward(e){const t=e??this.getActiveDocumentId(),n=this.getRotationForDocument(t),r=(n+3)%4;this.setRotationForDocument(r,t)}getMatrixAsString(e){return function(e,t,n){const[r,o,i,s,a,l]=function(e,t,n){let r=1,o=0,i=0,s=1,a=0,l=0;switch(e){case 1:r=0,o=1,i=-1,s=0,a=n;break;case 2:r=-1,o=0,i=0,s=-1,a=t,l=n;break;case 3:r=0,o=-1,i=1,s=0,l=t}return[r,o,i,s,a,l]}(e,t,n);return`matrix(${r},${o},${i},${s},${a},${l})`}(e.rotation,e.width,e.height)}onStoreUpdated(e,t){for(const n in t.documents){const r=e.documents[n],o=t.documents[n];(null==r?void 0:r.rotation)!==o.rotation&&this.logger.debug("RotatePlugin","RotationChanged",`Rotation changed for document ${n}: ${(null==r?void 0:r.rotation)??0} -> ${o.rotation}`)}}async initialize(e){this.logger.info("RotatePlugin","Initialize","Rotate plugin initialized")}async destroy(){this.rotate$.clear(),super.destroy()}};Gf.id="rotate";let Zf=Gf;const Kf={documents:{},activeDocumentId:null},Yf={manifest:Vf,create:(e,t)=>new Zf(qf,e,t),reducer:(e=Kf,t)=>{switch(t.type){case Bf:{const{documentId:n,state:r}=t.payload;return{...e,documents:{...e.documents,[n]:r},activeDocumentId:e.activeDocumentId??n}}case Uf:{const n=t.payload,{[n]:r,...o}=e.documents;return{...e,documents:o,activeDocumentId:e.activeDocumentId===n?null:e.activeDocumentId}}case"ROTATE/SET_ACTIVE_DOCUMENT":return{...e,activeDocumentId:t.payload};case Wf:{const{documentId:n,rotation:r}=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,rotation:r}}}:e}default:return e}},initialState:Kf};function Xf({children:e,documentId:t,pageIndex:n,rotation:r,scale:o,style:i,...s}){var a,l,c,u;const{plugin:d}=Jg(Zf.id),h=nf(t),p=null==(l=null==(a=null==h?void 0:h.document)?void 0:a.pages)?void 0:l[n],g=(null==(c=null==p?void 0:p.size)?void 0:c.width)??0,f=(null==(u=null==p?void 0:p.size)?void 0:u.height)??0,m=(null==p?void 0:p.rotation)??0,v=(null==h?void 0:h.rotation)??0,y=void 0!==r?r:(m+v)%4,b=o??(null==h?void 0:h.scale)??1,w=(null==d?void 0:d.getMatrixAsString({width:g*b,height:f*b,rotation:y}))??"matrix(1, 0, 0, 1, 0, 0)";return p?Ut.jsx("div",{...s,style:{position:"absolute",transformOrigin:"0 0",transform:w,...i},children:e}):null}var Qf=(e=>(e.Vertical="vertical",e.Horizontal="horizontal",e))(Qf||{});class Jf{constructor(e){this.pageGap=e.pageGap??20,this.viewportGap=e.viewportGap??20,this.bufferSize=e.bufferSize??2}getCenteringOffsetX(e,t){return!t||e.width>=t.width?0:(t.width-e.width)/2}getCenteringOffsetY(e,t){return 0}getVisibleRange(e,t,n){const r=this.getScrollOffset(e),o=r,i=r+this.getClientSize(e);let s=0;for(;s<t.length&&(t[s].offset+this.getItemSizeAlongScrollAxis(t[s]))*n<=o;)s++;let a=s;for(;a<t.length&&t[a].offset*n<=i;)a++;return{start:Math.max(0,s-this.bufferSize),end:Math.min(t.length-1,a+this.bufferSize-1)}}handleScroll(e,t,n){const r=this.getVisibleRange(e,t,n),o=t.slice(r.start,r.end+1),i=this.getTotalContentSize(t),s=this.calculatePageVisibility(o,e,n,i),a=s.map(e=>e.pageNumber),l=t.slice(r.start,r.end+1).flatMap(e=>e.index),c=this.determineCurrentPage(s),u=t[r.start],d=t[r.end],h=u?u.offset*n:0,p=t[t.length-1],g=d?(p.offset+this.getItemSizeAlongScrollAxis(p))*n-(d.offset+this.getItemSizeAlongScrollAxis(d))*n:0;return{currentPage:c,visiblePages:a,pageVisibilityMetrics:s,renderedPageIndexes:l,scrollOffset:{x:e.scrollLeft,y:e.scrollTop},startSpacing:h,endSpacing:g}}calculatePageVisibility(e,t,n,r){const o=[];return e.forEach(e=>{const i=this.getCenteringOffsetX(e,r),s=this.getCenteringOffsetY(e,r);e.pageLayouts.forEach(r=>{const a=(e.x+i)*n,l=(e.y+s)*n,c=a+r.x*n,u=l+r.y*n,d=r.rotatedWidth*n,h=r.rotatedHeight*n,p=t.scrollLeft,g=t.scrollTop,f=p+t.clientWidth,m=g+t.clientHeight,v=Math.max(c,p),y=Math.max(u,g),b=Math.min(c+d,f),w=Math.min(u+h,m);if(v<b&&y<w){const e=b-v,t=w-y,i=d*h,s=e*t;o.push({pageNumber:r.pageNumber,viewportX:v-p,viewportY:y-g,visiblePercentage:s/i*100,original:{pageX:(v-c)/n,pageY:(y-u)/n,visibleWidth:e/n,visibleHeight:t/n,scale:1},scaled:{pageX:v-c,pageY:y-u,visibleWidth:e,visibleHeight:t,scale:n}})}})}),o}determineCurrentPage(e){if(0===e.length)return 1;const t=Math.max(...e.map(e=>e.visiblePercentage)),n=e.filter(e=>e.visiblePercentage===t);return 1===n.length?n[0].pageNumber:n.sort((e,t)=>e.pageNumber-t.pageNumber)[0].pageNumber}getRectLocationForPage(e,t,n){const r=t.find(t=>t.pageNumbers.includes(e));if(!r)return null;const o=r.pageLayouts.find(t=>t.pageNumber===e);if(!o)return null;const i=this.getCenteringOffsetX(r,n),s=this.getCenteringOffsetY(r,n);return{origin:{x:r.x+o.x+i,y:r.y+o.y+s},size:{width:o.width,height:o.height}}}getScrollPositionForPage(e,t,n,r,o){const i=this.getTotalContentSize(t),s=this.getRectLocationForPage(e,t,i);if(!s)return null;const a=Sp(s.origin,n);if(o){const e=function(e,t,n,r){return Sp(Cp(e,t,n),r)}({width:s.size.width,height:s.size.height},{x:o.x,y:o.y},r,n);return{x:a.x+e.x+this.viewportGap,y:a.y+e.y+this.viewportGap}}return{x:a.x+this.viewportGap,y:a.y+this.viewportGap}}getRectPositionForPage(e,t,n,r,o){const i=this.getTotalContentSize(t),s=this.getRectLocationForPage(e,t,i);if(!s)return null;const a=Sp(s.origin,n),l=function(e,t,n,r){return kp(Ip(e,t,n),r)}({width:s.size.width,height:s.size.height},o,r,n);return{origin:{x:a.x+l.origin.x,y:a.y+l.origin.y},size:l.size}}}class em extends Jf{constructor(e){super(e)}createVirtualItems(e){let t=0;return e.map((e,n)=>{let r=0;const o=e.map(e=>{const t={pageNumber:e.index+1,pageIndex:e.index,x:r,y:0,width:e.size.width,height:e.size.height,rotatedWidth:e.rotatedSize.width,rotatedHeight:e.rotatedSize.height,elevated:!1};return r+=e.rotatedSize.width+this.pageGap,t}),i=e.reduce((t,n,r)=>t+n.rotatedSize.width+(r<e.length-1?this.pageGap:0),0),s=Math.max(...e.map(e=>e.rotatedSize.height)),a={id:`item-${n}`,x:0,y:t,offset:t,width:i,height:s,pageLayouts:o,pageNumbers:e.map(e=>e.index+1),index:n};return t+=s+this.pageGap,a})}getTotalContentSize(e){if(0===e.length)return{width:0,height:0};return{width:Math.max(...e.map(e=>e.width)),height:e[e.length-1].y+e[e.length-1].height}}getScrollOffset(e){return e.scrollTop}getClientSize(e){return e.clientHeight}getItemSizeAlongScrollAxis(e){return e.height}}class tm extends Jf{constructor(e){super(e)}createVirtualItems(e){let t=0;return e.map((e,n)=>{let r=0;const o=e.map(e=>{const t={pageNumber:e.index+1,pageIndex:e.index,x:r,y:0,width:e.size.width,height:e.size.height,rotatedWidth:e.rotatedSize.width,rotatedHeight:e.rotatedSize.height,elevated:!1};return r+=e.rotatedSize.width+this.pageGap,t}),i=e.reduce((t,n,r)=>t+n.rotatedSize.width+(r<e.length-1?this.pageGap:0),0),s=Math.max(...e.map(e=>e.rotatedSize.height)),a={id:`item-${n}`,x:t,y:0,offset:t,width:i,height:s,pageLayouts:o,pageNumbers:e.map(e=>e.index+1),index:n};return t+=i+this.pageGap,a})}getTotalContentSize(e){if(0===e.length)return{width:0,height:0};return{width:e[e.length-1].x+e[e.length-1].width,height:Math.max(...e.map(e=>e.height))}}getScrollOffset(e){return e.scrollLeft}getClientSize(e){return e.clientWidth}getItemSizeAlongScrollAxis(e){return e.width}getCenteringOffsetX(e,t){return 0}getCenteringOffsetY(e,t){return!t||e.height>=t.height?0:(t.height-e.height)/2}}const nm="INIT_SCROLL_STATE",rm="CLEANUP_SCROLL_STATE",om="UPDATE_DOCUMENT_SCROLL_STATE",im="SET_SCROLL_STRATEGY";function sm(e,t){return{type:om,payload:{documentId:e,state:t}}}const am={isChanging:!1,targetPage:1,fromPage:1,startTime:0},lm=class extends jg{constructor(e,t,n){var r,o,i;super(e,t),this.id=e,this.config=n,this.elevatedPages=new Map,this.strategies=new Map,this.layoutReady=new Set,this.initialLayoutFired=new Set,this.scrollerLayoutEmitters=new Map,this.pageChange$=Ug(),this.scroll$=Ug(),this.layoutChange$=Ug(),this.pageChangeState$=Ug(),this.layoutReady$=Ug(),this.state$=Ug(),this.viewport=this.registry.getPlugin("viewport").provides(),this.spread=(null==(r=this.registry.getPlugin("spread"))?void 0:r.provides())??null,this.viewport.onScrollActivity(e=>{const t=this.getDocumentState(e.documentId);(null==t?void 0:t.pageChangeState.isChanging)&&!e.activity.isSmoothScrolling&&this.completePageChange(e.documentId)}),null==(o=this.spread)||o.onSpreadChange(e=>{this.refreshDocumentLayout(e.documentId)});const s=null==(i=this.registry.getPlugin("interaction-manager"))?void 0:i.provides();s&&s.onPageActivityChange(e=>{let t=this.elevatedPages.get(e.documentId);e.hasActivity?(t||(t=new Set,this.elevatedPages.set(e.documentId,t)),t.add(e.pageIndex)):null==t||t.delete(e.pageIndex),this.pushScrollerLayout(e.documentId)}),this.viewport.onViewportChange(e=>{const t=this.getDocumentState(e.documentId);if(!t)return;const n=this.computeMetrics(e.documentId,e.metrics);this.layoutReady.has(e.documentId)?this.commitMetrics(e.documentId,n):this.commitMetrics(e.documentId,{...n,scrollOffset:t.scrollOffset})})}onDocumentLoadingStarted(e){const t=this.getCoreDocument(e);if(!t)return;const n=this.createDocumentState(t);this.dispatch(function(e,t){return{type:nm,payload:{documentId:e,state:t}}}(e,n));const r=this.createStrategy(n.strategy);this.strategies.set(e,r),this.scrollerLayoutEmitters.set(e,Ug())}onDocumentLoaded(e){var t;const n=this.getCoreDocument(e);n&&(this.dispatch(sm(e,{totalPages:(null==(t=n.document)?void 0:t.pageCount)??0})),this.refreshDocumentLayout(e),this.logger.debug("ScrollPlugin","DocumentOpened",`Initialized scroll state for document: ${e}`))}onDocumentClosed(e){this.strategies.delete(e),this.layoutReady.delete(e),this.initialLayoutFired.delete(e),this.elevatedPages.delete(e);const t=this.scrollerLayoutEmitters.get(e);t&&(t.clear(),this.scrollerLayoutEmitters.delete(e)),this.dispatch(function(e){return{type:rm,payload:e}}(e)),this.logger.debug("ScrollPlugin","DocumentClosed",`Cleaned up scroll state for document: ${e}`)}onScaleChanged(e){const t=this.coreState.core.documents[e];if(!t||"loaded"!==t.status)return;const n=this.viewport.forDocument(e),r=this.computeMetrics(e,n.getMetrics());this.commitMetrics(e,r)}onRotationChanged(e){this.refreshDocumentLayout(e)}onScrollerData(e,t){const n=this.scrollerLayoutEmitters.get(e);if(!n)throw new Error(`No scroller layout emitter found for document: ${e}`);return n.on(t)}getScrollerLayout(e){const t=this.getDocumentState(e),n=this.getCoreDocumentOrThrow(e);if(!t||!n)throw new Error(`Cannot get scroller layout for document: ${e}`);return r=t,o=n.scale,i=this.elevatedPages.get(e),{startSpacing:r.startSpacing,endSpacing:r.endSpacing,totalWidth:r.totalContentSize.width*o,totalHeight:r.totalContentSize.height*o,pageGap:r.pageGap*o,strategy:r.strategy,items:r.renderedPageIndexes.map(e=>({...r.virtualItems[e],pageLayouts:r.virtualItems[e].pageLayouts.map(e=>({...e,rotatedWidth:e.rotatedWidth*o,rotatedHeight:e.rotatedHeight*o,width:e.width*o,height:e.height*o,elevated:(null==i?void 0:i.has(e.pageIndex))??!1}))}))};var r,o,i}setLayoutReady(e){if(this.layoutReady.has(e))return;const t=this.getDocumentState(e);if(!t)return;this.layoutReady.add(e);const n=!this.initialLayoutFired.has(e);n&&this.initialLayoutFired.add(e);this.viewport.forDocument(e).scrollTo({...t.scrollOffset,behavior:"instant"}),this.layoutReady$.emit({documentId:e,isInitial:n,pageNumber:t.currentPage,totalPages:t.totalPages})}clearLayoutReady(e){this.layoutReady.delete(e)}buildCapability(){return{getCurrentPage:()=>this.getCurrentPage(),getTotalPages:()=>this.getTotalPages(),getPageChangeState:()=>this.getPageChangeState(),scrollToPage:e=>this.scrollToPage(e),scrollToNextPage:e=>this.scrollToNextPage(e),scrollToPreviousPage:e=>this.scrollToPreviousPage(e),getMetrics:e=>this.getMetrics(e),getLayout:()=>this.getLayout(),getRectPositionForPage:(e,t,n,r)=>this.getRectPositionForPage(e,t,n,r),forDocument:e=>this.createScrollScope(e),setScrollStrategy:(e,t)=>this.setScrollStrategyForDocument(e,t),getPageGap:()=>this.state.defaultPageGap,onPageChange:this.pageChange$.on,onScroll:this.scroll$.on,onLayoutChange:this.layoutChange$.on,onLayoutReady:this.layoutReady$.on,onPageChangeState:this.pageChangeState$.on,onStateChange:this.state$.on}}createScrollScope(e){return{getCurrentPage:()=>this.getCurrentPage(e),getTotalPages:()=>this.getTotalPages(e),getPageChangeState:()=>this.getPageChangeState(e),scrollToPage:t=>this.scrollToPage(t,e),scrollToNextPage:t=>this.scrollToNextPage(t,e),scrollToPreviousPage:t=>this.scrollToPreviousPage(t,e),getSpreadPagesWithRotatedSize:()=>this.getSpreadPagesWithRotatedSize(e),getMetrics:t=>this.getMetrics(t,e),getLayout:()=>this.getLayout(e),getRectPositionForPage:(t,n,r,o)=>this.getRectPositionForPage(t,n,r,o,e),setScrollStrategy:t=>this.setScrollStrategyForDocument(t,e),onPageChange:t=>this.pageChange$.on(n=>{n.documentId===e&&t(n)}),onScroll:t=>this.scroll$.on(n=>{n.documentId===e&&t(n.metrics)}),onLayoutChange:t=>this.layoutChange$.on(n=>{n.documentId===e&&t(n.layout)})}}getDocumentState(e){const t=e??this.getActiveDocumentId();return this.state.documents[t]??null}getDocumentStateOrThrow(e){const t=this.getDocumentState(e);if(!t)throw new Error(`Scroll state not found for document: ${e??"active"}`);return t}getStrategy(e){const t=e??this.getActiveDocumentId(),n=this.strategies.get(t);if(!n)throw new Error(`Strategy not found for document: ${t}`);return n}createStrategy(e){const t={pageGap:this.state.defaultPageGap,viewportGap:this.viewport.getViewportGap(),bufferSize:this.state.defaultBufferSize};return e===Qf.Horizontal?new tm(t):new em(t)}createDocumentState(e){var t;return{virtualItems:[],totalPages:(null==(t=e.document)?void 0:t.pageCount)??0,currentPage:1,totalContentSize:{width:0,height:0},strategy:this.state.defaultStrategy,pageGap:this.state.defaultPageGap,visiblePages:[],pageVisibilityMetrics:[],renderedPageIndexes:[],scrollOffset:{x:0,y:0},startSpacing:0,endSpacing:0,pageChangeState:am}}startPageChange(e,t,n="smooth"){const r=this.getDocumentState(e);if(!r)return;const o={isChanging:!0,targetPage:t,fromPage:r.currentPage,startTime:Date.now()};this.dispatch(sm(e,{pageChangeState:o,currentPage:t})),this.pageChange$.emit({documentId:e,pageNumber:t,totalPages:r.totalPages}),"instant"===n&&this.completePageChange(e)}completePageChange(e){const t=this.getDocumentState(e);if(!t||!t.pageChangeState.isChanging)return;const n={isChanging:!1,targetPage:t.pageChangeState.targetPage,fromPage:t.pageChangeState.fromPage,startTime:t.pageChangeState.startTime};this.dispatch(sm(e,{pageChangeState:n}))}computeLayout(e,t){const n=this.getStrategy(e),r=n.createVirtualItems(t);return{virtualItems:r,totalContentSize:n.getTotalContentSize(r)}}computeMetrics(e,t,n){const r=this.getCoreDocumentOrThrow(e),o=this.getDocumentState(e),i=this.getStrategy(e);if(!o)throw new Error(`Document state not found: ${e}`);return i.handleScroll(t,n??o.virtualItems,r.scale)}commitMetrics(e,t){const n=this.getDocumentState(e);if(!n)return;const r=n.pageChangeState.isChanging,o=r&&t.currentPage!==n.currentPage?{...t,currentPage:n.currentPage}:t;this.dispatch(sm(e,o)),this.scroll$.emit({documentId:e,metrics:o}),r||t.currentPage===n.currentPage||this.pageChange$.emit({documentId:e,pageNumber:t.currentPage,totalPages:n.totalPages}),this.pushScrollerLayout(e)}pushScrollerLayout(e){const t=this.scrollerLayoutEmitters.get(e);if(t)try{const n=this.getScrollerLayout(e);t.emit(n)}catch(n){}}refreshDocumentLayout(e){const t=this.coreState.core.documents[e],n=this.getDocumentState(e);if(!t||!n||"loaded"!==t.status)return;const r=this.getSpreadPagesWithRotatedSize(e),o=this.computeLayout(e,r),i=this.viewport.forDocument(e),s=this.computeMetrics(e,i.getMetrics(),o.virtualItems);this.dispatch(sm(e,{...o,...s})),this.layoutChange$.emit({documentId:e,layout:o}),this.pushScrollerLayout(e)}getSpreadPagesWithRotatedSize(e){var t,n;const r=e??this.getActiveDocumentId(),o=this.coreState.core.documents[r];if(!o)throw new Error(`Document ${r} not loaded`);return((null==(t=this.spread)?void 0:t.forDocument(r).getSpreadPages())||(null==(n=o.document)?void 0:n.pages.map(e=>[e]))||[]).map(e=>e.map(e=>{const t=((e.rotation??0)+o.rotation)%4;return{...e,rotatedSize:xp(e.size,t,1)}}))}getCurrentPage(e){return this.getDocumentStateOrThrow(e).currentPage}getTotalPages(e){return this.getDocumentStateOrThrow(e).totalPages}getPageChangeState(e){return this.getDocumentStateOrThrow(e).pageChangeState}scrollToPage(e,t){var n;const r=t??this.getActiveDocumentId(),o=this.getDocumentStateOrThrow(r),i=this.getStrategy(r),s=this.getCoreDocumentOrThrow(r),{pageNumber:a,behavior:l="smooth",pageCoordinates:c,alignX:u,alignY:d}=e;this.startPageChange(r,a,l);const h=null==(n=s.document)?void 0:n.pages[a-1],p=(((null==h?void 0:h.rotation)??0)+s.rotation)%4,g=i.getScrollPositionForPage(a,o.virtualItems,s.scale,p,c);if(g){this.viewport.forDocument(r).scrollTo({...g,behavior:l,alignX:u,alignY:d})}else this.completePageChange(r)}scrollToNextPage(e="smooth",t){const n=t??this.getActiveDocumentId(),r=this.getDocumentStateOrThrow(n),o=this.getStrategy(n),i=this.getCoreDocumentOrThrow(n),s=r.virtualItems.findIndex(e=>e.pageNumbers.includes(r.currentPage));if(s>=0&&s<r.virtualItems.length-1){const t=r.virtualItems[s+1].pageNumbers[0];this.startPageChange(n,t,e);const a=o.getScrollPositionForPage(t,r.virtualItems,i.scale,i.rotation);if(a){this.viewport.forDocument(n).scrollTo({...a,behavior:e})}else this.completePageChange(n)}}scrollToPreviousPage(e="smooth",t){const n=t??this.getActiveDocumentId(),r=this.getDocumentStateOrThrow(n),o=this.getStrategy(n),i=this.coreState.core.documents[n],s=r.virtualItems.findIndex(e=>e.pageNumbers.includes(r.currentPage));if(s>0){const t=r.virtualItems[s-1].pageNumbers[0];this.startPageChange(n,t,e);const a=o.getScrollPositionForPage(t,r.virtualItems,i.scale,i.rotation);if(a){this.viewport.forDocument(n).scrollTo({...a,behavior:e})}else this.completePageChange(n)}}getMetrics(e,t){const n=t??this.getActiveDocumentId();if(e)return this.computeMetrics(n,e);const r=this.viewport.forDocument(n);return this.computeMetrics(n,r.getMetrics())}getLayout(e){const t=this.getDocumentStateOrThrow(e);return{virtualItems:t.virtualItems,totalContentSize:t.totalContentSize}}getRectPositionForPage(e,t,n,r,o){var i;const s=o??this.getActiveDocumentId(),a=this.getDocumentStateOrThrow(s),l=this.getStrategy(s),c=this.getCoreDocumentOrThrow(s);let u=r;if(void 0===u){const t=null==(i=c.document)?void 0:i.pages[e];u=(((null==t?void 0:t.rotation)??0)+c.rotation)%4}return l.getRectPositionForPage(e+1,a.virtualItems,n??c.scale,u,t)}setScrollStrategyForDocument(e,t){const n=t??this.getActiveDocumentId(),r=this.getDocumentState(n);if(!r||r.strategy===e)return;const o=this.createStrategy(e);this.strategies.set(n,o),this.dispatch(function(e,t){return{type:im,payload:{documentId:e,strategy:t}}}(n,e)),this.refreshDocumentLayout(n)}onStoreUpdated(e,t){for(const n in t.documents){const r=e.documents[n],o=t.documents[n];r!==o&&(this.state$.emit(o),(null==r?void 0:r.pageChangeState)!==o.pageChangeState&&this.pageChangeState$.emit({documentId:n,state:o.pageChangeState}),this.pushScrollerLayout(n))}}async initialize(){this.logger.info("ScrollPlugin","Initialize","Scroll plugin initialized")}async destroy(){this.strategies.clear(),this.layoutReady.clear(),this.initialLayoutFired.clear(),this.elevatedPages.clear();for(const e of this.scrollerLayoutEmitters.values())e.clear();this.scrollerLayoutEmitters.clear(),this.pageChange$.clear(),this.scroll$.clear(),this.layoutChange$.clear(),this.pageChangeState$.clear(),this.layoutReady$.clear(),this.state$.clear(),super.destroy()}};lm.id="scroll";let cm=lm;const um="scroll",dm={manifest:{id:um,name:"Scroll Plugin",version:"1.0.0",provides:["scroll"],requires:["viewport"],optional:["spread","interaction-manager"],defaultConfig:{defaultPageGap:10,defaultBufferSize:4,defaultStrategy:Qf.Vertical}},create:(e,t)=>new cm(um,e,t),reducer:(e,t)=>{switch(t.type){case nm:{const{documentId:n,state:r}=t.payload;return{...e,documents:{...e.documents,[n]:r}}}case rm:{const{[t.payload]:n,...r}=e.documents;return{...e,documents:r}}case om:{const{documentId:n,state:r}=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,...r}}}:e}case im:{const{documentId:n,strategy:r}=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,strategy:r}}}:e}default:return e}},initialState:(e,t)=>((e,t)=>({defaultStrategy:t.defaultStrategy??Qf.Vertical,defaultPageGap:t.defaultPageGap??10,defaultBufferSize:t.defaultBufferSize??2,documents:{}}))(0,t)},hm=e=>{const{provides:t}=ef(cm.id),[n,r]=Bt.useState(1),[o,i]=Bt.useState(1);return Bt.useEffect(()=>{if(!t||!e)return;const n=t.forDocument(e);return r(n.getCurrentPage()),i(n.getTotalPages()),t.onPageChange(t=>{t.documentId===e&&(r(t.pageNumber),i(t.totalPages))})},[t,e]),{provides:(null==t?void 0:t.forDocument(e))??null,state:{currentPage:n,totalPages:o}}},pm="SEARCH/INIT_STATE",gm="SEARCH/CLEANUP_STATE",fm="SEARCH/START_SEARCH_SESSION",mm="SEARCH/STOP_SEARCH_SESSION",vm="SEARCH/SET_SEARCH_FLAGS",ym="SEARCH/SET_SHOW_ALL_RESULTS",bm="SEARCH/START_SEARCH",wm="SEARCH/SET_SEARCH_RESULTS",xm="SEARCH/APPEND_SEARCH_RESULTS",Cm="SEARCH/SET_ACTIVE_RESULT_INDEX";function Sm(e,t){return{type:ym,payload:{documentId:e,showAll:t}}}function Im(e,t,n,r){return{type:wm,payload:{documentId:e,results:t,total:n,activeResultIndex:r}}}function km(e,t){return{type:Cm,payload:{documentId:e,index:t}}}const Pm={flags:[],results:[],total:0,activeResultIndex:-1,showAllResults:!0,query:"",loading:!1,active:!1},Dm={documents:{}},Mm=(e,t,n)=>{const r=e.documents[t]||Pm;return{...e,documents:{...e.documents,[t]:{...r,...n}}}},Em=class extends jg{constructor(e,t,n){super(e,t),this.searchStop$=Ug(),this.searchStart$=Ug(),this.searchResult$=Ug(),this.searchActiveResultChange$=Ug(),this.searchResultState$=Ug(),this.searchState$=Ug(),this.currentTask=new Map,this.pluginConfig=n}onDocumentLoadingStarted(e){const t={...Pm,flags:this.pluginConfig.flags||[],showAllResults:this.pluginConfig.showAllResults??!0};this.dispatch(function(e,t){return{type:pm,payload:{documentId:e,state:t}}}(e,t))}onDocumentClosed(e){this.stopSearchSession(e),this.dispatch(function(e){return{type:gm,payload:e}}(e)),this.currentTask.delete(e)}async initialize(){}onStoreUpdated(e,t){for(const n in t.documents){const r=e.documents[n],o=t.documents[n];r!==o&&(this.searchState$.emit({documentId:n,state:o}),r&&r.results===o.results&&r.activeResultIndex===o.activeResultIndex&&r.showAllResults===o.showAllResults&&r.active===o.active||this.searchResultState$.emit({documentId:n,state:{results:o.results,activeResultIndex:o.activeResultIndex,showAllResults:o.showAllResults,active:o.active}}))}}buildCapability(){const e=e=>e??this.getActiveDocumentId(),t=t=>{const n=e(t),r=this.state.documents[n];if(!r)throw new Error(`Search state not found for document ${n}`);return r};return{startSearch:t=>this.startSearchSession(e(t)),stopSearch:t=>this.stopSearchSession(e(t)),searchAllPages:(t,n)=>this.searchAllPages(t,e(n)),nextResult:t=>this.nextResult(e(t)),previousResult:t=>this.previousResult(e(t)),goToResult:(t,n)=>this.goToResult(t,e(n)),setShowAllResults:(t,n)=>this.dispatch(Sm(e(n),t)),getShowAllResults:e=>t(e).showAllResults,getFlags:e=>t(e).flags,setFlags:(t,n)=>this.setFlags(t,e(n)),getState:e=>t(e),forDocument:this.createSearchScope.bind(this),onSearchResult:this.searchResult$.on,onSearchStart:this.searchStart$.on,onSearchStop:this.searchStop$.on,onActiveResultChange:this.searchActiveResultChange$.on,onSearchResultStateChange:this.searchResultState$.on,onStateChange:this.searchState$.on}}createSearchScope(e){const t=()=>{const t=this.state.documents[e];if(!t)throw new Error(`Search state not found for document ${e}`);return t};return{startSearch:()=>this.startSearchSession(e),stopSearch:()=>this.stopSearchSession(e),searchAllPages:t=>this.searchAllPages(t,e),nextResult:()=>this.nextResult(e),previousResult:()=>this.previousResult(e),goToResult:t=>this.goToResult(t,e),setShowAllResults:t=>this.dispatch(Sm(e,t)),getShowAllResults:()=>t().showAllResults,getFlags:()=>t().flags,setFlags:t=>this.setFlags(t,e),getState:t,onSearchResult:t=>this.searchResult$.on(n=>{n.documentId===e&&t(n.results)}),onSearchStart:t=>this.searchStart$.on(n=>{n.documentId===e&&t()}),onSearchStop:t=>this.searchStop$.on(n=>{n.documentId===e&&t()}),onActiveResultChange:t=>this.searchActiveResultChange$.on(n=>{n.documentId===e&&t(n.index)}),onSearchResultStateChange:t=>this.searchResultState$.on(n=>{n.documentId===e&&t(n.state)}),onStateChange:t=>this.searchState$.on(n=>{n.documentId===e&&t(n.state)})}}setFlags(e,t){this.dispatch(function(e,t){return{type:vm,payload:{documentId:e,flags:t}}}(t,e));const n=this.state.documents[t];(null==n?void 0:n.active)&&this.searchAllPages(n.query,t,!0)}notifySearchStart(e){this.searchStart$.emit({documentId:e})}notifySearchStop(e){this.searchStop$.emit({documentId:e})}notifyActiveResultChange(e,t){this.searchActiveResultChange$.emit({documentId:e,index:t})}startSearchSession(e){this.getCoreDocument(e)&&(this.dispatch(function(e){return{type:fm,payload:{documentId:e}}}(e)),this.notifySearchStart(e))}stopSearchSession(e){var t;const n=this.state.documents[e];if(!(null==n?void 0:n.active))return;const r=this.currentTask.get(e);if(r){try{null==(t=r.abort)||t.call(r,{code:Bp.Cancelled,message:"search stopped"})}catch{}this.currentTask.delete(e)}this.dispatch(function(e){return{type:mm,payload:{documentId:e}}}(e)),this.notifySearchStop(e)}searchAllPages(e,t,n=!1){var r;const o=this.state.documents[t];if(!o)return Up.reject({code:Bp.NotFound,message:"Search state not initialized"});const i=this.getCoreDocument(t);if(!(null==i?void 0:i.document))return Up.reject({code:Bp.NotFound,message:"Document not loaded"});const s=e.trim();if(o.query===s&&!n)return Up.resolve({results:o.results,total:o.total});const a=this.currentTask.get(t);if(a){try{null==(r=a.abort)||r.call(a,{code:Bp.Cancelled,message:"new search"})}catch{}this.currentTask.delete(t)}if(this.dispatch(function(e,t){return{type:bm,payload:{documentId:e,query:t}}}(t,s)),!s)return this.dispatch(Im(t,[],0,-1)),Up.resolve({results:[],total:0});o.active||this.startSearchSession(t);const l=this.engine.searchAllPages(i.document,s,{flags:o.flags});return this.currentTask.set(t,l),l.onProgress(e=>{var n;(null==(n=null==e?void 0:e.results)?void 0:n.length)&&this.currentTask.get(t)===l&&(this.dispatch(function(e,t){return{type:xm,payload:{documentId:e,results:t}}}(t,e.results)),-1===this.state.documents[t].activeResultIndex&&(this.dispatch(km(t,0)),this.notifyActiveResultChange(t,0)))}),l.wait(e=>{this.currentTask.delete(t);const n=e.total>0?0:-1;this.dispatch(Im(t,e.results,e.total,n)),this.searchResult$.emit({documentId:t,results:e}),e.total>0&&this.notifyActiveResultChange(t,0)},e=>{var n;(null==(n=null==e?void 0:e.reason)?void 0:n.code)!==Bp.Cancelled&&this.dispatch(Im(t,[],0,-1)),this.currentTask.delete(t)}),l}nextResult(e){const t=this.state.documents[e];if(!t||0===t.results.length)return-1;const n=t.activeResultIndex>=t.results.length-1?0:t.activeResultIndex+1;return this.goToResult(n,e)}previousResult(e){const t=this.state.documents[e];if(!t||0===t.results.length)return-1;const n=t.activeResultIndex<=0?t.results.length-1:t.activeResultIndex-1;return this.goToResult(n,e)}goToResult(e,t){const n=this.state.documents[t];return!n||0===n.results.length||e<0||e>=n.results.length?-1:(this.dispatch(km(t,e)),this.notifyActiveResultChange(t,e),e)}async destroy(){for(const e of Object.keys(this.state.documents))this.stopSearchSession(e);this.searchResult$.clear(),this.searchStart$.clear(),this.searchStop$.clear(),this.searchActiveResultChange$.clear(),this.searchResultState$.clear(),this.searchState$.clear(),super.destroy()}};Em.id="search";let Tm=Em;const Am="search",_m={manifest:{id:Am,name:"Search Plugin",version:"1.0.0",provides:["search"],requires:[],optional:[],defaultConfig:{flags:[]}},create:(e,t)=>new Tm(Am,e,t),reducer:(e=Dm,t)=>{switch(t.type){case pm:return{...e,documents:{...e.documents,[t.payload.documentId]:t.payload.state}};case gm:{const n=t.payload,{[n]:r,...o}=e.documents;return{...e,documents:o}}case fm:return Mm(e,t.payload.documentId,{active:!0});case mm:return Mm(e,t.payload.documentId,{results:[],total:0,activeResultIndex:-1,query:"",loading:!1,active:!1});case vm:return Mm(e,t.payload.documentId,{flags:t.payload.flags});case ym:return Mm(e,t.payload.documentId,{showAllResults:t.payload.showAll});case bm:return Mm(e,t.payload.documentId,{loading:!0,query:t.payload.query,results:[],total:0,activeResultIndex:-1});case xm:{const{documentId:n,results:r}=t.payload,o=e.documents[n];if(!o)return e;const i=[...o.results,...r],s=-1===o.activeResultIndex&&i.length>0?0:o.activeResultIndex;return Mm(e,n,{results:i,total:i.length,activeResultIndex:s,loading:!0})}case wm:{const{documentId:n,results:r,total:o,activeResultIndex:i}=t.payload;return Mm(e,n,{results:r,total:o,activeResultIndex:i,loading:!1})}case Cm:return Mm(e,t.payload.documentId,{activeResultIndex:t.payload.index});default:return e}},initialState:Dm},Nm=()=>ef(Tm.id);function Rm({documentId:e,pageIndex:t,scale:n,style:r,highlightColor:o="#FFFF00",activeHighlightColor:i="#FFBF00",...s}){const{provides:a}=Nm(),[l,c]=Bt.useState(null),u=nf(e),d=Bt.useMemo(()=>null==a?void 0:a.forDocument(e),[a,e]),h=Bt.useMemo(()=>void 0!==n?n:(null==u?void 0:u.scale)??1,[n,null==u?void 0:u.scale]);if(Bt.useEffect(()=>{if(!d)return void c(null);const e=d.getState();return c({results:e.results,activeResultIndex:e.activeResultIndex,showAllResults:e.showAllResults,active:e.active}),d.onSearchResultStateChange(e=>{c(e)})},[d]),!l||!l.active)return null;const p=l.results.map((e,t)=>({result:e,originalIndex:t})).filter(({result:e})=>e.pageIndex===t).filter(({originalIndex:e})=>l.showAllResults||e===l.activeResultIndex);return Ut.jsx("div",{style:{...r,pointerEvents:"none"},...s,children:p.map(({result:e,originalIndex:t})=>e.rects.map((e,n)=>Ut.jsx("div",{style:{position:"absolute",top:e.origin.y*h,left:e.origin.x*h,width:e.size.width*h,height:e.size.height*h,backgroundColor:t===l.activeResultIndex?i:o,mixBlendMode:"multiply",transform:"scale(1.02)",transformOrigin:"center",transition:"opacity .3s ease-in-out",opacity:1}},`${t}-${n}`)))})}const jm="selection",zm={id:jm,name:"Selection Plugin",version:"1.0.0",provides:["selection"],requires:["interaction-manager"],optional:["viewport","scroll"],defaultConfig:{menuHeight:40}},Lm="SELECTION/INIT_STATE",$m="SELECTION/CLEANUP_STATE",Fm="SELECTION/CACHE_PAGE_GEOMETRY",Om="SELECTION/SET_SELECTION",Hm="SELECTION/START_SELECTION",qm="SELECTION/END_SELECTION",Vm="SELECTION/CLEAR_SELECTION",Bm="SELECTION/SET_RECTS",Um="SELECTION/SET_SLICES",Wm="SELECTION/EVICT_PAGE_GEOMETRY",Gm=(e,t)=>({type:Om,payload:{documentId:e,selection:t}}),Zm=e=>({type:Hm,payload:{documentId:e}}),Km=e=>({type:qm,payload:{documentId:e}}),Ym=(e,t)=>({type:Bm,payload:{documentId:e,rects:t}}),Xm=(e,t)=>({type:Um,payload:{documentId:e,slices:t}}),Qm={geometry:{},rects:{},slices:{},selection:null,active:!1,selecting:!1},Jm={documents:{}},ev=(e,t,n)=>({...e,documents:{...e.documents,[t]:n}});function tv(e,t){return e.rects[t]??[]}function nv(e,t){return Pp(tv(e,t))}function rv(e){const t=[],n=e.rects;for(const r in n){const e=Number(r),o=Pp(n[e]);o&&t.push({page:e,rect:o})}return t}function ov(e,t){const n=e.rects[t]||[];if(0===n.length)return null;const r=nv(e,t);return r?{pageIndex:t,rect:r,segmentRects:n}:null}function iv(e){const t=[],n=Object.keys(e.rects).map(Number);for(const r of n){const n=e.rects[r]||[];if(0===n.length)continue;const o=nv(e,r);o&&t.push({pageIndex:r,rect:o,segmentRects:n})}return t}function sv(e,t,n=1.5){for(const a of e.runs){if(!(t.y>=a.rect.y&&t.y<=a.rect.y+a.rect.height&&t.x>=a.rect.x&&t.x<=a.rect.x+a.rect.width))continue;const e=a.glyphs.findIndex(e=>{const n=e.tightX??e.x,r=e.tightY??e.y,o=e.tightWidth??e.width,i=e.tightHeight??e.height;return t.x>=n&&t.x<=n+o&&t.y>=r&&t.y<=r+i});if(-1!==e)return a.charStart+e}if(n<=0)return-1;const r=function(e,t){let n=0,r=0;for(const o of e.runs)for(const e of o.glyphs)2!==e.flags&&(n+=e.height,r++);return 0===r?0:n/r*t}(e,n),o=r/2;let i=-1,s=1/0;for(const a of e.runs)if(!(t.y<a.rect.y-o||t.y>a.rect.y+a.rect.height+o||t.x<a.rect.x-o||t.x>a.rect.x+a.rect.width+o))for(let e=0;e<a.glyphs.length;e++){const n=a.glyphs[e];if(2===n.flags)continue;const r=n.tightX??n.x,l=n.tightY??n.y,c=n.tightWidth??n.width,u=n.tightHeight??n.height,d=r-o,h=r+c+o,p=l-o,g=l+u+o;if(t.x<d||t.x>h||t.y<p||t.y>g)continue;const f=Math.min(Math.abs(t.x-r),Math.abs(t.x-(r+c)))+Math.min(Math.abs(t.y-l),Math.abs(t.y-(l+u)));f<s&&(s=f,i=a.charStart+e)}return i}function av(e,t,n){if(!e||!t)return null;if(n<e.start.page||n>e.end.page)return null;const r=n===e.start.page?e.start.index:0,o=t.runs[t.runs.length-1],i=o.charStart+o.glyphs.length-1;return{from:r,to:n===e.end.page?e.end.index:i}}function lv(e,t,n,r=!0){const o=[];for(const i of e.runs){const e=i.charStart,r=e+i.glyphs.length-1;if(r<t||e>n)continue;const s=Math.max(t,e)-e,a=Math.min(n,r)-e;let l=1/0,c=-1/0,u=1/0,d=-1/0,h=0,p=0,g=-1/0;const f=()=>{l!==1/0&&h>0&&o.push({rect:{origin:{x:l,y:u},size:{width:c-l,height:d-u}},charCount:h,fontSize:i.fontSize}),l=1/0,c=-1/0,u=1/0,d=-1/0,h=0,p=0,g=-1/0};for(let t=s;t<=a;t++){const e=i.glyphs[t];if(2!==e.flags){if(h>0&&g>-1/0){const t=Math.abs(e.x-g),n=p/h;n>0&&t>2.5*n&&f()}l=Math.min(l,e.x),c=Math.max(c,e.x+e.width),u=Math.min(u,e.y),d=Math.max(d,e.y+e.height),h++,p+=e.width,g=e.x+e.width}}f()}return r?function(e){const t=[];let n=null,r=null;for(const o of e)n&&r?hv(n,o)?r=cv(r,o.rect):(t.push(r),r=o.rect):r=o.rect,n=o;r&&!uv(r)&&t.push(r);return t}(o):o.map(e=>e.rect)}function cv(e,t){const n=Math.min(e.origin.x,t.origin.x),r=Math.min(e.origin.y,t.origin.y);return{origin:{x:n,y:r},size:{width:Math.max(e.origin.x+e.size.width,t.origin.x+t.size.width)-n,height:Math.max(e.origin.y+e.size.height,t.origin.y+t.size.height)-r}}}function uv(e){return e.size.width<=0||e.size.height<=0}function dv(e,t){if(uv(e)||uv(t))return 0;const n=cv(e,t);if(n.size.height===e.size.height||n.size.height===t.size.height)return 1;const r=function(e,t){const n=Math.max(e.origin.x,t.origin.x),r=Math.max(e.origin.y,t.origin.y),o=Math.min(e.origin.x+e.size.width,t.origin.x+t.size.width),i=Math.min(e.origin.y+e.size.height,t.origin.y+t.size.height);return{origin:{x:n,y:r},size:{width:Math.max(0,o-n),height:Math.max(0,i-r)}}}(e,t);return r.size.height/n.size.height}function hv(e,t){if(null!=e.fontSize&&null!=t.fontSize&&e.fontSize>0&&t.fontSize>0){if(Math.max(e.fontSize,t.fontSize)/Math.min(e.fontSize,t.fontSize)>1.5)return!1}const n=e.rect,r=t.rect;if(dv(n,r)<.8)return!1;const o=1*n.size.width/e.charCount,i=1*r.size.width/t.charCount,s=n.origin.x-o,a=n.origin.x+n.size.width+o,l=r.origin.x-i;return s<r.origin.x+r.size.width+i&&a>l}function pv(e,t){for(let n=0;n<e.runs.length;n++){const r=e.runs[n],o=t-r.charStart;if(o>=0&&o<r.glyphs.length)return{runIdx:n,localIdx:o}}return null}function gv(e){return 1===e||2===e}function fv(e){return 0===e.rect.width&&0===e.rect.height}function mv(e,t,n,r){const o=Math.max(t,r)-Math.min(e,n),i=Math.max(0,Math.min(t,r)-Math.max(e,n));return 0!==o&&i/o>=.5}const vv=class extends jg{constructor(e,t,n){var r,o,i;super(e,t),this.enabledModesPerDoc=new Map,this.selecting=new Map,this.anchor=new Map,this.hasTextAnchor=new Map,this.marqueePage=new Map,this.pageCallbacks=new Map,this.geoAccessOrder=new Map,this.menuPlacement$=Wg((e,t)=>({documentId:e,placement:t})),this.selChange$=Wg((e,t)=>({documentId:e,selection:t,modeId:this.interactionManagerCapability.forDocument(e).getActiveMode()})),this.textRetrieved$=Wg((e,t)=>({documentId:e,text:t})),this.copyToClipboard$=Wg((e,t)=>({documentId:e,text:t}),{cache:!1}),this.beginSelection$=Wg((e,t)=>({documentId:e,page:t.page,index:t.index,modeId:t.modeId}),{cache:!1}),this.endSelection$=Wg((e,t)=>({documentId:e,modeId:t.modeId}),{cache:!1}),this.marqueeChange$=Wg((e,t)=>({documentId:e,pageIndex:t.pageIndex,rect:t.rect,modeId:t.modeId}),{cache:!1}),this.marqueeEnd$=Wg((e,t)=>({documentId:e,pageIndex:t.pageIndex,rect:t.rect,modeId:t.modeId}),{cache:!1}),this.emptySpaceClick$=Wg((e,t)=>({documentId:e,pageIndex:t.pageIndex,modeId:t.modeId}),{cache:!1}),this.viewportCapability=null,this.scrollCapability=null,this.config=n,this.menuHeight=n.menuHeight??40;const s=t.getPlugin("interaction-manager");if(!s)throw new Error("SelectionPlugin: InteractionManagerPlugin is required.");this.interactionManagerCapability=s.provides(),this.viewportCapability=(null==(r=t.getPlugin("viewport"))?void 0:r.provides())??null,this.scrollCapability=(null==(o=t.getPlugin("scroll"))?void 0:o.provides())??null,this.coreStore.onAction(vg,e=>{const{documentId:t,pageIndexes:n}=e.payload,r=n.map(e=>this.getNewPageGeometryAndCache(t,e));jp.all(r).wait(()=>{n.forEach(e=>{this.notifyPage(t,e)})},eg)}),null==(i=this.viewportCapability)||i.onViewportChange(e=>{this.recalculateMenuPlacement(e.documentId)},{mode:"throttle",wait:100})}onDocumentLoadingStarted(e){var t;this.dispatch(((e,t)=>({type:Lm,payload:{documentId:e,state:t}}))(e,Qm));const n=!1!==(null==(t=this.config.marquee)?void 0:t.enabled);this.enabledModesPerDoc.set(e,new Map([["pointerMode",{enableSelection:!0,showSelectionRects:!0,enableMarquee:n,showMarqueeRects:!0}]])),this.pageCallbacks.set(e,new Map),this.geoAccessOrder.set(e,[]),this.selecting.set(e,!1),this.anchor.set(e,void 0),this.hasTextAnchor.set(e,!1)}onDocumentClosed(e){this.dispatch((e=>({type:$m,payload:e}))(e)),this.enabledModesPerDoc.delete(e),this.pageCallbacks.delete(e),this.geoAccessOrder.delete(e),this.selecting.delete(e),this.hasTextAnchor.delete(e),this.anchor.delete(e),this.marqueePage.delete(e),this.selChange$.clearScope(e),this.textRetrieved$.clearScope(e),this.copyToClipboard$.clearScope(e),this.beginSelection$.clearScope(e),this.endSelection$.clearScope(e),this.menuPlacement$.clearScope(e),this.marqueeChange$.clearScope(e),this.marqueeEnd$.clearScope(e),this.emptySpaceClick$.clearScope(e)}async initialize(){}async destroy(){this.selChange$.clear(),this.textRetrieved$.clear(),this.copyToClipboard$.clear(),this.beginSelection$.clear(),this.endSelection$.clear(),this.menuPlacement$.clear(),this.marqueeChange$.clear(),this.marqueeEnd$.clear(),this.emptySpaceClick$.clear(),super.destroy()}buildCapability(){const e=e=>e??this.getActiveDocumentId();return{getFormattedSelection:t=>iv(this.getDocumentState(e(t))),getFormattedSelectionForPage:(t,n)=>ov(this.getDocumentState(e(n)),t),getHighlightRectsForPage:(t,n)=>tv(this.getDocumentState(e(n)),t),getHighlightRects:t=>this.getDocumentState(e(t)).rects,getBoundingRectForPage:(t,n)=>nv(this.getDocumentState(e(n)),t),getBoundingRects:t=>rv(this.getDocumentState(e(t))),getSelectedText:t=>this.getSelectedText(e(t)),clear:t=>this.clearSelection(e(t)),copyToClipboard:t=>this.copyToClipboard(e(t)),getState:t=>this.getDocumentState(e(t)),enableForMode:(t,n,r)=>{var o;return null==(o=this.enabledModesPerDoc.get(e(r)))?void 0:o.set(t,{...n})},isEnabledForMode:(t,n)=>{var r;return(null==(r=this.enabledModesPerDoc.get(e(n)))?void 0:r.has(t))??!1},setMarqueeEnabled:(t,n)=>this.setMarqueeEnabled(e(n),t),isMarqueeEnabled:t=>this.isMarqueeEnabled(e(t)),forDocument:this.createSelectionScope.bind(this),onCopyToClipboard:this.copyToClipboard$.onGlobal,onSelectionChange:this.selChange$.onGlobal,onTextRetrieved:this.textRetrieved$.onGlobal,onBeginSelection:this.beginSelection$.onGlobal,onEndSelection:this.endSelection$.onGlobal,onMarqueeChange:this.marqueeChange$.onGlobal,onMarqueeEnd:this.marqueeEnd$.onGlobal,onEmptySpaceClick:this.emptySpaceClick$.onGlobal}}createSelectionScope(e){return{getFormattedSelection:()=>iv(this.getDocumentState(e)),getFormattedSelectionForPage:t=>ov(this.getDocumentState(e),t),getHighlightRectsForPage:t=>tv(this.getDocumentState(e),t),getHighlightRects:()=>this.getDocumentState(e).rects,getBoundingRectForPage:t=>nv(this.getDocumentState(e),t),getBoundingRects:()=>rv(this.getDocumentState(e)),getSelectedText:()=>this.getSelectedText(e),clear:()=>this.clearSelection(e),copyToClipboard:()=>this.copyToClipboard(e),getState:()=>this.getDocumentState(e),setMarqueeEnabled:t=>this.setMarqueeEnabled(e,t),isMarqueeEnabled:()=>this.isMarqueeEnabled(e),onSelectionChange:this.selChange$.forScope(e),onTextRetrieved:this.textRetrieved$.forScope(e),onCopyToClipboard:this.copyToClipboard$.forScope(e),onBeginSelection:this.beginSelection$.forScope(e),onEndSelection:this.endSelection$.forScope(e),onMarqueeChange:this.marqueeChange$.forScope(e),onMarqueeEnd:this.marqueeEnd$.forScope(e),onEmptySpaceClick:this.emptySpaceClick$.forScope(e)}}getDocumentState(e){const t=this.state.documents[e];if(!t)throw new Error(`Selection state not found for document: ${e}`);return t}onMenuPlacement(e,t){return this.menuPlacement$.forScope(e)(t)}registerSelectionOnPage(e){var t;const{documentId:n,pageIndex:r,onRectsChange:o}=e,i=this.state.documents[n];if(!i)return this.logger.warn("SelectionPlugin","RegisterFailed",`Cannot register selection on page ${r} for document ${n}: document state not initialized.`),()=>{};null==(t=this.pageCallbacks.get(n))||t.set(r,o);const s=this.getOrLoadGeometry(n,r),a=this.interactionManagerCapability.forDocument(n),l=this.enabledModesPerDoc.get(n);o({rects:tv(i,r),boundingRect:nv(i,r)}),s.wait(e=>{const t=this.getDocumentState(n),o=t.selection;if(!o||r<o.start.page||r>o.end.page)return;const i=av(o,e,r);if(!i)return;const s=lv(e,i.from,i.to);this.dispatch(Ym(n,{...t.rects,[r]:s})),this.dispatch(Xm(n,{...t.slices,[r]:{start:i.from,count:i.to-i.from+1}})),this.notifyPage(n,r)},eg);const c=function(e){const t=e.minDragDistance??3,n=e.toleranceFactor??1.5;let r=null,o=null,i=!1,s=0;function a(){var t;r=null,o=null,i=!1,null==(t=e.setHasTextAnchor)||t.call(e,!1)}return{onPointerDown:(t,a,l)=>{var c,u;if(a.target===a.currentTarget&&(null==(c=e.onEmptySpaceClick)||c.call(e,l)),!e.isEnabled(l))return;const d=Date.now();(0===s||d-s>=500)&&e.onClear(l);const h=e.getGeometry();if(!h)return;const p=sv(h,t,n);-1!==p&&(r=p,o=t,i=!1,null==(u=e.setHasTextAnchor)||u.call(e,!0))},onPointerMove:(s,a,l)=>{if(!e.isEnabled(l))return;const c=e.getGeometry();if(!c)return;const u=sv(c,s,n);if(e.setCursor(-1!==u?"text":null),null!==r&&o&&!i){const n=s.x-o.x,a=s.y-o.y;return void(Math.sqrt(n*n+a*a)>=t&&(i=!0,e.onBegin(r,l),-1!==u&&e.onUpdate(u,l)))}e.isSelecting()&&-1!==u&&e.onUpdate(u,l)},onPointerUp:(t,n,r)=>{e.isEnabled(r)?(i&&e.onEnd(r),a()):a()},onDoubleClick:(t,r,o)=>{var i;if(!e.isEnabled(o))return;const a=e.getGeometry();if(!a)return;const l=sv(a,t,n);-1!==l&&(s=Date.now(),null==(i=e.onWordSelect)||i.call(e,l,o))},onClick:(t,r,o)=>{var i;if(!e.isEnabled(o))return;if(0===s)return;if(Date.now()-s>500)return void(s=0);s=0;const a=e.getGeometry();if(!a)return;const l=sv(a,t,n);-1!==l&&(null==(i=e.onLineSelect)||i.call(e,l,o))},onHandlerActiveEnd:t=>{a(),e.isEnabled(t)&&e.onClear(t)}}}({getGeometry:()=>this.getDocumentState(n).geometry[r],isEnabled:e=>{const t=null==l?void 0:l.get(e);return!!t&&!1!==t.enableSelection},onBegin:(e,t)=>this.beginSelection(n,r,e,t),onUpdate:(e,t)=>this.updateSelection(n,r,e,t),onEnd:e=>this.endSelection(n,e),onClear:e=>this.clearSelection(n,e),isSelecting:()=>this.selecting.get(n)??!1,setCursor:e=>e?a.setCursor("selection-text",e,10):a.removeCursor("selection-text"),onEmptySpaceClick:e=>this.emptySpaceClick$.emit(n,{pageIndex:r,modeId:e}),onWordSelect:(e,t)=>this.selectWord(n,r,e,t),onLineSelect:(e,t)=>this.selectLine(n,r,e,t),setHasTextAnchor:e=>this.hasTextAnchor.set(n,e),minDragDistance:this.config.minSelectionDragDistance,toleranceFactor:this.config.toleranceFactor}),u=this.interactionManagerCapability.registerAlways({scope:{type:"page",documentId:n,pageIndex:r},handlers:c});return()=>{var e;u(),null==(e=this.pageCallbacks.get(n))||e.delete(r),s.abort({code:Bp.Cancelled,message:"Cleanup"})}}registerMarqueeOnPage(e){var t;const{documentId:n,pageIndex:r,scale:o,onRectChange:i}=e;if(!this.state.documents[n])return this.logger.warn("SelectionPlugin","RegisterMarqueeFailed",`Cannot register marquee on page ${r} for document ${n}: document state not initialized.`),()=>{};const s=this.coreState.core.documents[n];if(!s||!s.document)return this.logger.warn("SelectionPlugin","DocumentNotFound",`Cannot register marquee on page ${r}: document not found`),()=>{};const a=s.document.pages[r];if(!a)return this.logger.warn("SelectionPlugin","PageNotFound",`Cannot register marquee on page ${r}: page not found`),()=>{};const l=a.size,c=(null==(t=this.config.marquee)?void 0:t.minDragPx)??5,u=()=>{var e;const t=this.interactionManagerCapability.forDocument(n).getActiveMode(),r=null==(e=this.enabledModesPerDoc.get(n))?void 0:e.get(t);return!1!==(null==r?void 0:r.showMarqueeRects)},d=function(e){const{pageSize:t,scale:n,minDragPx:r=5}=e;let o=null,i=null;return{onPointerDown:(t,n,r)=>{var s,a;e.isEnabled(r)&&((null==(s=e.isTextSelecting)?void 0:s.call(e))||(o=t,i={origin:{x:t.x,y:t.y},size:{width:0,height:0}},e.onBegin(t,r),null==(a=n.setPointerCapture)||a.call(n)))},onPointerMove:(n,r,s)=>{if(!o||!e.isEnabled(s))return;const a=Fg(n.x,0,t.width),l=Fg(n.y,0,t.height);i={origin:{x:Math.min(o.x,a),y:Math.min(o.y,l)},size:{width:Math.abs(a-o.x),height:Math.abs(l-o.y)}},e.onChange(i,s)},onPointerUp:(t,s,a)=>{var l;e.isEnabled(a)&&(i&&o&&(Math.max(i.size.width,i.size.height)*n>r?e.onEnd(i,a):e.onCancel(a)),o=null,i=null,null==(l=s.releasePointerCapture)||l.call(s))},onPointerCancel:(t,n,r)=>{var s;e.isEnabled(r)&&(o=null,i=null,e.onCancel(r),null==(s=n.releasePointerCapture)||s.call(n))}}}({pageSize:l,scale:o,minDragPx:c,isEnabled:e=>{var t;const r=null==(t=this.enabledModesPerDoc.get(n))?void 0:t.get(e);return!0===(null==r?void 0:r.enableMarquee)},isTextSelecting:()=>(this.selecting.get(n)??!1)||(this.hasTextAnchor.get(n)??!1),onBegin:(e,t)=>this.beginMarquee(n,r,e,t),onChange:(e,t)=>{this.updateMarquee(n,r,e,t),i(u()?e:null)},onEnd:(e,t)=>{this.endMarquee(n,r,e,t),i(null)},onCancel:e=>{this.cancelMarquee(n,e),i(null)}});return this.interactionManagerCapability.registerAlways({scope:{type:"page",documentId:n,pageIndex:r},handlers:d})}getPlacementMetrics(e,t,n,r){var o;const i=null==(o=this.scrollCapability)?void 0:o.forDocument(e),s=null==i?void 0:i.getRectPositionForPage(t,n);if(!s)return null;const a=s.origin.y-r.scrollTop,l=s.origin.y+s.size.height-r.scrollTop;return{pageIndex:t,rect:n,spaceAbove:a,spaceBelow:r.clientHeight-l,isBottomVisible:l>0&&l<=r.clientHeight,isTopVisible:a>=0&&a<r.clientHeight}}emitMenuPlacement(e,t){this.menuPlacement$.emit(e,t),t?this.interactionManagerCapability.claimPageActivity(e,"selection-menu",t.pageIndex):this.interactionManagerCapability.releasePageActivity(e,"selection-menu")}recalculateMenuPlacement(e){const t=this.state.documents[e];if(!t)return;if(t.selecting||null===t.selection)return void this.emitMenuPlacement(e,null);const n=rv(t);if(0===n.length)return void this.emitMenuPlacement(e,null);const r=n[n.length-1];if(!this.viewportCapability||!this.scrollCapability)return void this.emitMenuPlacement(e,{pageIndex:r.page,rect:r.rect,spaceAbove:0,spaceBelow:1/0,suggestTop:!1,isVisible:!0});const o=this.viewportCapability.forDocument(e).getMetrics(),i=n[0],s=this.getPlacementMetrics(e,r.page,r.rect,o),a=this.getPlacementMetrics(e,i.page,i.rect,o);s&&s.isBottomVisible&&s.spaceBelow>this.menuHeight?this.emitMenuPlacement(e,{...s,suggestTop:!1,isVisible:!0}):a&&a.isTopVisible?this.emitMenuPlacement(e,{...a,suggestTop:!0,isVisible:!0}):s&&s.isBottomVisible?this.emitMenuPlacement(e,{...s,suggestTop:!1,isVisible:!0}):this.emitMenuPlacement(e,null)}notifyPage(e,t){var n,r;const o=null==(n=this.pageCallbacks.get(e))?void 0:n.get(t);if(o){const n=this.getDocumentState(e),i=this.interactionManagerCapability.forDocument(e).getActiveMode(),s=null==(r=this.enabledModesPerDoc.get(e))?void 0:r.get(i);o(s&&!1!==(s.showSelectionRects??s.showRects)?{rects:tv(n,t),boundingRect:nv(n,t)}:{rects:[],boundingRect:null})}}notifyAllPages(e){var t;null==(t=this.pageCallbacks.get(e))||t.forEach((t,n)=>{this.notifyPage(e,n)})}getNewPageGeometryAndCache(e,t){const n=this.getCoreDocument(e);if(!n||!n.document)return Up.reject({code:Bp.NotFound,message:"Doc Not Found"});const r=n.document.pages.find(e=>e.index===t),o=this.engine.getPageGeometry(n.document,r);return o.wait(n=>{this.dispatch(((e,t,n)=>({type:Fm,payload:{documentId:e,page:t,geo:n}}))(e,t,n)),this.touchGeometry(e,t)},eg),o}getOrLoadGeometry(e,t){const n=this.getDocumentState(e).geometry[t];return n?(this.touchGeometry(e,t),Up.resolve(n)):this.getNewPageGeometryAndCache(e,t)}touchGeometry(e,t){const n=this.geoAccessOrder.get(e);if(!n)return;const r=n.indexOf(t);r>-1&&n.splice(r,1),n.push(t),this.evictGeometryIfNeeded(e)}evictGeometryIfNeeded(e){const t=this.config.maxCachedGeometries??50,n=this.geoAccessOrder.get(e);if(!n||n.length<=t)return;const r=this.pageCallbacks.get(e),o=[];for(;n.length-o.length>t;){const e=n.find(e=>!o.includes(e)&&!(null==r?void 0:r.has(e)));if(void 0===e)break;o.push(e)}if(0!==o.length){for(const e of o){const t=n.indexOf(e);t>-1&&n.splice(t,1)}this.dispatch(((e,t)=>({type:Wm,payload:{documentId:e,pages:t}}))(e,o))}}beginSelection(e,t,n,r){this.selecting.set(e,!0),this.anchor.set(e,{page:t,index:n}),this.dispatch(Zm(e)),this.beginSelection$.emit(e,{page:t,index:n,modeId:r}),this.recalculateMenuPlacement(e)}endSelection(e,t){this.selecting.set(e,!1),this.anchor.set(e,void 0),this.dispatch(Km(e)),this.endSelection$.emit(e,{modeId:t}),this.recalculateMenuPlacement(e)}clearSelection(e,t){this.selecting.set(e,!1),this.anchor.set(e,void 0),this.dispatch((e=>({type:Vm,payload:{documentId:e}}))(e)),this.selChange$.emit(e,null),this.emitMenuPlacement(e,null),this.notifyAllPages(e)}selectWord(e,t,n,r){const o=this.getDocumentState(e).geometry[t];if(!o)return;const i=function(e,t){if(!pv(e,t))return null;const n=function(e){if(0===e.runs.length)return 0;const t=e.runs[e.runs.length-1];return t.charStart+t.glyphs.length}(e);if(0===n)return null;let r=t;for(;r>0;){const t=pv(e,r-1);if(!t)break;if(gv(e.runs[t.runIdx].glyphs[t.localIdx].flags))break;r--}let o=t;for(;o<n-1;){const t=pv(e,o+1);if(!t)break;if(gv(e.runs[t.runIdx].glyphs[t.localIdx].flags))break;o++}return{from:r,to:o}}(o,n);i&&this.applyInstantSelection(e,t,i.from,i.to,r)}selectLine(e,t,n,r){const o=this.getDocumentState(e).geometry[t];if(!o)return;const i=function(e,t){const n=pv(e,t);if(!n)return null;const r=e.runs[n.runIdx],o=r.rect.y,i=r.rect.y+r.rect.height;let s=r.charStart,a=r.charStart+r.glyphs.length-1;for(let l=n.runIdx-1;l>=0;l--){const t=e.runs[l];if(!fv(t)){if(!mv(t.rect.y,t.rect.y+t.rect.height,o,i))break;s=t.charStart}}for(let l=n.runIdx+1;l<e.runs.length;l++){const t=e.runs[l];if(!fv(t)){if(!mv(t.rect.y,t.rect.y+t.rect.height,o,i))break;a=t.charStart+t.glyphs.length-1}}return{from:s,to:a}}(o,n);i&&this.applyInstantSelection(e,t,i.from,i.to,r)}applyInstantSelection(e,t,n,r,o){const i={start:{page:t,index:n},end:{page:t,index:r}};this.selecting.set(e,!1),this.anchor.set(e,void 0),this.dispatch(Zm(e)),this.dispatch(Gm(e,i)),this.updateRectsAndSlices(e,i),this.dispatch(Km(e)),this.selChange$.emit(e,i),this.beginSelection$.emit(e,{page:t,index:n,modeId:o}),this.endSelection$.emit(e,{modeId:o});for(let s=i.start.page;s<=i.end.page;s++)this.notifyPage(e,s);this.recalculateMenuPlacement(e)}updateSelection(e,t,n,r){if(!this.selecting.get(e)||!this.anchor.get(e))return;const o=this.anchor.get(e),i=t>o.page||t===o.page&&n>=o.index,s={start:i?o:{page:t,index:n},end:i?{page:t,index:n}:o};this.dispatch(Gm(e,s)),this.updateRectsAndSlices(e,s),this.selChange$.emit(e,s);for(let a=s.start.page;a<=s.end.page;a++)this.notifyPage(e,a)}updateRectsAndSlices(e,t){const n=this.getDocumentState(e),r={},o={};for(let i=t.start.page;i<=t.end.page;i++){const e=n.geometry[i],s=av(t,e,i);s&&(r[i]=lv(e,s.from,s.to),o[i]={start:s.from,count:s.to-s.from+1})}this.dispatch(Ym(e,r)),this.dispatch(Xm(e,o))}getSelectedText(e){if(!this.checkPermission(e,qp.CopyContents))return this.logger.debug("SelectionPlugin","GetSelectedText",`Cannot get selected text: document ${e} lacks CopyContents permission`),Up.reject({code:Bp.Security,message:"Document lacks CopyContents permission"});const t=this.getCoreDocument(e),n=this.getDocumentState(e);if(!(null==t?void 0:t.document)||!n.selection)return Up.reject({code:Bp.NotFound,message:"Doc Not Found or No Selection"});const r=n.selection,o=[];for(let s=r.start.page;s<=r.end.page;s++){const e=n.slices[s];e&&o.push({pageIndex:s,charIndex:e.start,charCount:e.count})}if(0===o.length)return Up.resolve([]);const i=this.engine.getTextSlices(t.document,o);return i.wait(t=>{this.textRetrieved$.emit(e,t)},eg),i}copyToClipboard(e){if(!this.checkPermission(e,qp.CopyContents))return void this.logger.debug("SelectionPlugin","CopyToClipboard",`Cannot copy to clipboard: document ${e} lacks CopyContents permission`);this.getSelectedText(e).wait(t=>{this.copyToClipboard$.emit(e,t.join("\n"))},eg)}beginMarquee(e,t,n,r){this.marqueePage.set(e,t)}updateMarquee(e,t,n,r){this.marqueeChange$.emit(e,{pageIndex:t,rect:n,modeId:r})}endMarquee(e,t,n,r){this.marqueeEnd$.emit(e,{pageIndex:t,rect:n,modeId:r}),this.marqueeChange$.emit(e,{pageIndex:t,rect:null,modeId:r}),this.marqueePage.delete(e)}cancelMarquee(e,t){const n=this.marqueePage.get(e);void 0!==n&&(this.marqueeChange$.emit(e,{pageIndex:n,rect:null,modeId:t}),this.marqueePage.delete(e))}setMarqueeEnabled(e,t){const n=this.enabledModesPerDoc.get(e);if(!n)return;const r=n.get("pointerMode");r?r.enableMarquee=t:t&&n.set("pointerMode",{enableMarquee:!0})}isMarqueeEnabled(e){var t;const n=null==(t=this.enabledModesPerDoc.get(e))?void 0:t.get("pointerMode");return!1!==(null==n?void 0:n.enableMarquee)}};vv.id="selection";let yv=vv;const bv=()=>ef(yv.id),wv=()=>Jg(yv.id);function xv(){const{provides:e}=bv();return Bt.useEffect(()=>{if(e)return e.onCopyToClipboard(({text:e})=>{navigator.clipboard.writeText(e)})},[e]),null}const Cv=Zg({manifest:zm,create:(e,t)=>new yv(jm,e,t),reducer:(e=Jm,t)=>{switch(t.type){case Lm:{const{documentId:n,state:r}=t.payload;return ev(e,n,r)}case $m:{const n=t.payload,{[n]:r,...o}=e.documents;return{...e,documents:o}}case Fm:{const{documentId:n,page:r,geo:o}=t.payload,i=e.documents[n];return i?ev(e,n,{...i,geometry:{...i.geometry,[r]:o}}):e}case Om:{const{documentId:n,selection:r}=t.payload,o=e.documents[n];return o?ev(e,n,{...o,selection:r,active:!0}):e}case Hm:{const{documentId:n}=t.payload,r=e.documents[n];return r?ev(e,n,{...r,selecting:!0,selection:null,rects:{}}):e}case qm:{const{documentId:n}=t.payload,r=e.documents[n];return r?ev(e,n,{...r,selecting:!1}):e}case Vm:{const{documentId:n}=t.payload,r=e.documents[n];return r?ev(e,n,{...r,selecting:!1,selection:null,rects:{},active:!1}):e}case Bm:{const{documentId:n,rects:r}=t.payload,o=e.documents[n];return o?ev(e,n,{...o,rects:r}):e}case Um:{const{documentId:n,slices:r}=t.payload,o=e.documents[n];return o?ev(e,n,{...o,slices:r}):e}case Wm:{const{documentId:n,pages:r}=t.payload,o=e.documents[n];if(!o)return e;const i={...o.geometry},s={...o.rects},a={...o.slices};for(const e of r)delete i[e],delete s[e],delete a[e];return ev(e,n,{...o,geometry:i,rects:s,slices:a})}case"SELECTION/RESET":{const{documentId:n}=t.payload;return e.documents[n]?ev(e,n,Qm):e}default:return e}},initialState:Jm}).addUtility(xv).build(),Sv="thumbnail",Iv={id:Sv,name:"Thumbnail Plugin",version:"1.0.0",provides:["thumbnail"],requires:["render"],optional:["scroll"],defaultConfig:{width:150,gap:10,buffer:3,labelHeight:16,autoScroll:!0,scrollBehavior:"smooth",imagePadding:0,paddingY:0}},kv="THUMBNAIL/INIT_STATE",Pv="THUMBNAIL/CLEANUP_STATE",Dv="THUMBNAIL/SET_WINDOW_STATE",Mv="THUMBNAIL/UPDATE_VIEWPORT_METRICS";function Ev(e,t){return{type:kv,payload:{documentId:e,state:t}}}const Tv={thumbs:[],window:null,viewportH:0,scrollY:0},Av={documents:{},activeDocumentId:null},_v=class extends jg{constructor(e,t,n){var r;super(e,t),this.cfg=n,this.scrollCapability=null,this.taskCaches=new Map,this.canAutoScroll=new Map,this.window$=Wg((e,t)=>({documentId:e,window:t})),this.scrollTo$=Wg((e,t)=>({documentId:e,options:t})),this.refreshPages$=Wg((e,t)=>({documentId:e,pages:t}),{cache:!1}),this.renderCapability=this.registry.getPlugin("render").provides(),this.scrollCapability=(null==(r=this.registry.getPlugin("scroll"))?void 0:r.provides())??null,this.coreStore.onAction(vg,e=>{const t=e.payload.documentId??this.getActiveDocumentId(),n=e.payload.pageIndexes;this.refreshPages$.emit(t,n);const r=this.taskCaches.get(t);if(r)for(const o of n)r.delete(o)}),this.scrollCapability&&!1!==this.cfg.autoScroll&&(this.scrollCapability.onPageChangeState(({documentId:e,state:t})=>{this.canAutoScroll.set(e,!t.isChanging),t.isChanging||this.scrollToThumb(t.targetPage-1,e)}),this.scrollCapability.onPageChange(({documentId:e,pageNumber:t})=>{!1!==this.canAutoScroll.get(e)&&this.scrollToThumb(t-1,e)}))}onDocumentLoadingStarted(e){this.dispatch(Ev(e,{...Tv})),this.taskCaches.set(e,new Map),this.canAutoScroll.set(e,!0),this.logger.debug("ThumbnailPlugin","DocumentOpened",`Initialized thumbnail state for document: ${e}`)}onDocumentLoaded(e){this.calculateWindowState(e)}onDocumentClosed(e){this.dispatch(function(e){return{type:Pv,payload:e}}(e));const t=this.taskCaches.get(e);t&&(t.forEach(e=>{e.abort({code:"cancelled",message:"Document closed"})}),t.clear(),this.taskCaches.delete(e)),this.canAutoScroll.delete(e),this.window$.clearScope(e),this.scrollTo$.clearScope(e),this.refreshPages$.clearScope(e),this.logger.debug("ThumbnailPlugin","DocumentClosed",`Cleaned up thumbnail state for document: ${e}`)}onRotationChanged(e){this.calculateWindowState(e)}buildCapability(){return{scrollToThumb:e=>this.scrollToThumb(e),renderThumb:(e,t)=>this.renderThumb(e,t),updateWindow:(e,t)=>this.updateWindow(e,t),getWindow:()=>this.getWindow(),forDocument:e=>this.createThumbnailScope(e),onWindow:this.window$.onGlobal,onScrollTo:this.scrollTo$.onGlobal,onRefreshPages:this.refreshPages$.onGlobal}}createThumbnailScope(e){return{scrollToThumb:t=>this.scrollToThumb(t,e),renderThumb:(t,n)=>this.renderThumb(t,n,e),updateWindow:(t,n)=>this.updateWindow(t,n,e),getWindow:()=>this.getWindow(e),onWindow:this.window$.forScope(e),onScrollTo:this.scrollTo$.forScope(e),onRefreshPages:this.refreshPages$.forScope(e)}}getDocumentState(e){const t=e??this.getActiveDocumentId();return this.state.documents[t]??null}calculateWindowState(e){const t=this.coreState.core.documents[e];if(!(null==t?void 0:t.document))return;const n=this.cfg.width??120,r=this.cfg.labelHeight??16,o=this.cfg.gap??8,i=this.cfg.imagePadding??0,s=this.cfg.paddingY??0,a=Math.max(1,n-2*i);let l=s;const c=t.document.pages.map(e=>{const t=e.rotation%2==1,n=t?e.size.height:e.size.width,s=(t?e.size.width:e.size.height)/n,c=Math.round(a*s),u=i+c+i+r,d={pageIndex:e.index,width:a,height:c,wrapperHeight:u,top:l,labelHeight:r,padding:i};return l+=u+o,d}),u={start:-1,end:-1,items:[],totalHeight:l-o+s},d=this.getDocumentState(e);d&&(this.dispatch(Ev(e,{...d,thumbs:c,window:u})),d.viewportH>0?this.updateWindow(d.scrollY,d.viewportH,e):this.window$.emit(e,u))}updateWindow(e,t,n){const r=n??this.getActiveDocumentId(),o=this.getDocumentState(r);if(!o||!o.window||0===o.thumbs.length)return;const i=this.cfg.buffer??3;this.dispatch(function(e,t,n){return{type:Mv,payload:{documentId:e,scrollY:t,viewportH:n}}}(r,e,t));let s=0,a=o.thumbs.length-1,l=0;for(;s<=a;){const t=s+a>>1,n=o.thumbs[t];n.top+n.wrapperHeight<e?s=t+1:(l=t,a=t-1)}let c=l;const u=e+t;for(;c+1<o.thumbs.length&&o.thumbs[c].top<u;)c++;c=Math.min(o.thumbs.length-1,c+i);const d=Math.max(0,l-i);if(d===o.window.start&&c===o.window.end)return;const h={start:d,end:c,items:o.thumbs.slice(d,c+1),totalHeight:o.window.totalHeight};this.dispatch(function(e,t){return{type:Dv,payload:{documentId:e,window:t}}}(r,h)),this.window$.emit(r,h)}getWindow(e){const t=this.getDocumentState(e);return(null==t?void 0:t.window)??null}scrollToThumb(e,t){const n=t??this.getActiveDocumentId(),r=this.getDocumentState(n);if(!r||!r.window)return;const o=r.thumbs[e];if(!o)return;const i=this.cfg.scrollBehavior??"smooth",s=this.cfg.paddingY??0;if(r.viewportH<=0){const e=Math.max(s,o.top-o.wrapperHeight);return void this.scrollTo$.emit(n,{top:e,behavior:i})}const a=o.top,l=o.top+o.wrapperHeight,c=a<r.scrollY+8+s,u=l>r.scrollY+r.viewportH-8;c?this.scrollTo$.emit(n,{top:Math.max(0,a-s),behavior:i}):u&&this.scrollTo$.emit(n,{top:Math.max(0,l-r.viewportH+s),behavior:i})}renderThumb(e,t,n){const r=n??this.getActiveDocumentId(),o=this.taskCaches.get(r);if(!o)throw new Error(`Task cache not found for document: ${r}`);if(o.has(e))return o.get(e);const i=this.coreState.core.documents[r];if(!(null==i?void 0:i.document))throw new Error(`Document not found: ${r}`);const s=i.document.pages[e];if(!s)throw new Error(`Page ${e} not found in document: ${r}`);const a=this.cfg.width??120,l=this.cfg.imagePadding??0,c=Math.max(1,a-2*l)/s.size.width,u=this.renderCapability.forDocument(r).renderPageRect({pageIndex:e,rect:{origin:{x:0,y:0},size:s.size},options:{scaleFactor:c,dpr:t,rotation:s.rotation}});return o.set(e,u),u.wait(eg,()=>o.delete(e)),u}async initialize(){this.logger.info("ThumbnailPlugin","Initialize","Thumbnail plugin initialized")}async destroy(){this.window$.clear(),this.refreshPages$.clear(),this.scrollTo$.clear(),this.taskCaches.forEach(e=>{e.forEach(e=>{e.abort({code:"cancelled",message:"Plugin destroyed"})}),e.clear()}),this.taskCaches.clear(),this.canAutoScroll.clear(),super.destroy()}};_v.id="thumbnail";let Nv=_v;const Rv={manifest:Iv,create:(e,t)=>new Nv(Sv,e,t),reducer:(e=Av,t)=>{switch(t.type){case kv:{const{documentId:n,state:r}=t.payload;return{...e,documents:{...e.documents,[n]:r},activeDocumentId:e.activeDocumentId??n}}case Pv:{const n=t.payload,{[n]:r,...o}=e.documents;return{...e,documents:o,activeDocumentId:e.activeDocumentId===n?null:e.activeDocumentId}}case"THUMBNAIL/SET_ACTIVE_DOCUMENT":return{...e,activeDocumentId:t.payload};case Dv:{const{documentId:n,window:r}=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,window:r}}}:e}case Mv:{const{documentId:n,scrollY:r,viewportH:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,scrollY:r,viewportH:o}}}:e}default:return e}},initialState:Av},jv=()=>Jg(Nv.id),zv=()=>ef(Nv.id);function Lv({documentId:e,meta:t,style:n,...r}){const{provides:o}=zv(),{plugin:i}=jv(),[s,a]=Bt.useState(),l=Bt.useRef(null),[c,u]=Bt.useState(0);Bt.useEffect(()=>{if(!i)return;return i.provides().forDocument(e).onRefreshPages(e=>{e.includes(t.pageIndex)&&u(e=>e+1)})},[i,e,t.pageIndex]),Bt.useEffect(()=>{const n=null==o?void 0:o.forDocument(e),r=null==n?void 0:n.renderThumb(t.pageIndex,window.devicePixelRatio);return null==r||r.wait(e=>{const t=URL.createObjectURL(e);l.current=t,a(t)},eg),()=>{l.current?(URL.revokeObjectURL(l.current),l.current=null):null==r||r.abort({code:Bp.Cancelled,message:"canceled render task"})}},[o,e,t.pageIndex,c]);return s?Ut.jsx("img",{src:s,onLoad:()=>{l.current&&(URL.revokeObjectURL(l.current),l.current=null)},style:n,...r}):null}const $v="tiling",Fv={id:$v,name:"Tiling Plugin",version:"1.0.0",provides:["tiling"],requires:["render","scroll","viewport"],optional:[],defaultConfig:{tileSize:768,overlapPx:2.5,extraRings:0}},Ov="TILING/INIT_STATE",Hv="TILING/CLEANUP_STATE",qv="TILING/UPDATE_VISIBLE_TILES",Vv="TILING/MARK_TILE_STATUS",Bv=(e,t)=>({type:qv,payload:{documentId:e,tiles:t}}),Uv=(e,t,n,r)=>({type:Vv,payload:{documentId:e,pageIndex:t,tileId:n,status:r}}),Wv={visibleTiles:{}};function Gv({tileSize:e=768,overlapPx:t=2.5,extraRings:n=0,scale:r,rotation:o,page:i,metric:s}){const a=i.size.width*r,l=i.size.height*r,c=e-t,u=function(e,t,n,r){return kp(Ip(e,t,(4-n)%4),1/r)}(xp(i.size,o,r),{origin:{x:s.scaled.pageX,y:s.scaled.pageY},size:{width:s.scaled.visibleWidth,height:s.scaled.visibleHeight}},o,1),d=u.origin.x,h=u.origin.y,p=d+u.size.width,g=h+u.size.height,f=Math.floor((a-1)/c),m=Math.floor((l-1)/c),v=Math.max(0,Math.floor(d/c)-n),y=Math.min(f,Math.floor((p-1)/c)+n),b=Math.max(0,Math.floor(h/c)-n),w=Math.min(m,Math.floor((g-1)/c)+n),x=[];for(let C=v;C<=y;C++){const t=C*c,n=Math.min(e,a-t),o=t/r,s=n/r;for(let a=b;a<=w;a++){const u=a*c,d=Math.min(e,l-u),h=u/r,p=d/r;x.push({id:`p${i.index}-${r}-x${t}-y${u}-w${n}-h${d}`,col:C,row:a,pageRect:{origin:{x:o,y:h},size:{width:s,height:p}},screenRect:{origin:{x:t,y:u},size:{width:n,height:d}},status:"queued",srcScale:r,isFallback:!1})}}return x}const Zv=class extends jg{constructor(e,t,n){super(e,t),this.tileRendering$=Ug(),this.config=n,this.renderCapability=this.registry.getPlugin("render").provides(),this.scrollCapability=this.registry.getPlugin("scroll").provides(),this.viewportCapability=this.registry.getPlugin("viewport").provides(),this.scrollCapability.onScroll(e=>this.calculateVisibleTiles(e.documentId,e.metrics),{mode:"throttle",wait:50,throttleMode:"trailing"}),this.coreStore.onAction(vg,e=>this.recalculateTiles(e.payload))}onDocumentLoadingStarted(e){this.dispatch(((e,t)=>({type:Ov,payload:{documentId:e,state:t}}))(e,Wv))}onDocumentClosed(e){this.dispatch((e=>({type:Hv,payload:e}))(e))}onScaleChanged(e){this.recalculateTilesForDocument(e)}onRotationChanged(e){this.recalculateTilesForDocument(e)}recalculateTilesForDocument(e){const t=this.scrollCapability.forDocument(e),n=this.viewportCapability.forDocument(e),r=t.getMetrics(n.getMetrics());this.calculateVisibleTiles(e,r)}async recalculateTiles(e){const{documentId:t,pageIndexes:n}=e,r=this.getCoreDocument(t);if(!r||!r.document)return;const o=this.scrollCapability.forDocument(t),i=this.viewportCapability.forDocument(t),s=o.getMetrics(i.getMetrics()),a={},l=Date.now(),c=r.scale;for(const u of n){const e=s.pageVisibilityMetrics.find(e=>e.pageNumber===u+1);if(!e)continue;const t=r.document.pages[u];if(!t)continue;const n=((t.rotation??0)+r.rotation)%4;a[u]=Gv({page:t,metric:e,scale:c,rotation:n,tileSize:this.config.tileSize,overlapPx:this.config.overlapPx,extraRings:this.config.extraRings}).map(e=>({...e,id:`${e.id}-r${l}`}))}Object.keys(a).length>0&&this.dispatch(Bv(t,a))}async initialize(){}calculateVisibleTiles(e,t){const n=this.getCoreDocument(e);if(!n||!n.document)return;const r=n.scale,o={};for(const i of t.pageVisibilityMetrics){const e=i.pageNumber-1,t=n.document.pages[e];if(!t)continue;const s=Gv({page:t,metric:i,scale:r,rotation:((t.rotation??0)+n.rotation)%4,tileSize:this.config.tileSize,overlapPx:this.config.overlapPx,extraRings:this.config.extraRings});o[e]=s}this.dispatch(Bv(e,o))}onStoreUpdated(e,t){for(const n in t.documents){const r=e.documents[n],o=t.documents[n];r!==o&&this.tileRendering$.emit({documentId:n,tiles:o.visibleTiles})}}buildCapability(){return{renderTile:this.renderTile.bind(this),forDocument:this.createTilingScope.bind(this),onTileRendering:this.tileRendering$.on}}createTilingScope(e){return{renderTile:t=>this.renderTile(t,e),onTileRendering:t=>this.tileRendering$.on(n=>{n.documentId===e&&t(n.tiles)})}}renderTile(e,t){const n=t??this.getActiveDocumentId();if(!this.renderCapability)throw new Error("Render capability not available.");this.dispatch(Uv(n,e.pageIndex,e.tile.id,"rendering"));const r=this.renderCapability.forDocument(n).renderPageRect({pageIndex:e.pageIndex,rect:e.tile.pageRect,options:{scaleFactor:e.tile.srcScale,dpr:e.dpr,...e.imageType||this.config.defaultImageType?{imageType:e.imageType??this.config.defaultImageType}:{}}});return r.wait(()=>{this.dispatch(Uv(n,e.pageIndex,e.tile.id,"ready"))},eg),r}};Zv.id="tiling";let Kv=Zv;const Yv={manifest:Fv,create:(e,t)=>new Kv($v,e,t),reducer:(e,t)=>((e,t)=>{var n,r;switch(t.type){case Ov:{const{documentId:n,state:r}=t.payload;return{...e,documents:{...e.documents,[n]:r}}}case Hv:{const n=t.payload,{[n]:r,...o}=e.documents;return{...e,documents:o}}case qv:{const{documentId:r,tiles:o}=t.payload,i=e.documents[r];if(!i)return e;const s={...i.visibleTiles};for(const e in o){const t=Number(e),r=o[t],i=s[t]??[],a=null==(n=i.find(e=>!e.isFallback))?void 0:n.srcScale,l=r.length>0?r[0].srcScale:a;if(void 0!==a&&a!==l){const e=i.filter(e=>!e.isFallback&&"ready"===e.status).map(e=>({...e,isFallback:!0})),n=e.length>0?[]:i.filter(e=>e.isFallback);s[t]=[...n,...e,...r]}else{const e=new Set(r.map(e=>e.id)),n=[],o=new Set;for(const t of i)(t.isFallback||e.has(t.id))&&(n.push(t),o.add(t.id));for(const t of r)o.has(t.id)||n.push(t);s[t]=n}}return{...e,documents:{...e.documents,[r]:{...i,visibleTiles:s}}}}case Vv:{const{documentId:n,pageIndex:o,tileId:i,status:s}=t.payload,a=e.documents[n];if(!a)return e;const l=(null==(r=a.visibleTiles[o])?void 0:r.map(e=>e.id===i?{...e,status:s}:e))??[],c=l.filter(e=>!e.isFallback),u=c.length>0&&c.every(e=>"ready"===e.status)?c:l;return{...e,documents:{...e.documents,[n]:{...a,visibleTiles:{...a.visibleTiles,[o]:u}}}}}default:return e}})(e,t),initialState:{documents:{}}},Xv=()=>ef(Kv.id);function Qv({documentId:e,pageIndex:t,tile:n,dpr:r,scale:o}){const{provides:i}=Xv(),s=Bt.useMemo(()=>null==i?void 0:i.forDocument(e),[i,e]),[a,l]=Bt.useState(),c=Bt.useRef(null),u=o/n.srcScale;Bt.useEffect(()=>{if("ready"===n.status&&c.current)return;if(!s)return;const e=s.renderTile({pageIndex:t,tile:n,dpr:r});return e.wait(e=>{const t=URL.createObjectURL(e);c.current=t,l(t)},eg),()=>{c.current?(URL.revokeObjectURL(c.current),c.current=null):e.abort({code:Bp.Cancelled,message:"canceled render task"})}},[s,t,n.id]);return a?Ut.jsx("img",{src:a,onLoad:()=>{c.current&&(URL.revokeObjectURL(c.current),c.current=null)},style:{position:"absolute",left:n.screenRect.origin.x*u,top:n.screenRect.origin.y*u,width:n.screenRect.size.width*u,height:n.screenRect.size.height*u,display:"block"}}):null}function Jv({documentId:e,pageIndex:t,scale:n,style:r,...o}){const{provides:i}=Xv(),s=nf(e),[a,l]=Bt.useState([]);Bt.useEffect(()=>{if(i)return i.onTileRendering(n=>{n.documentId===e&&l(n.tiles[t]??[])})},[i,e,t]);const c=Bt.useMemo(()=>void 0!==n?n:(null==s?void 0:s.scale)??1,[n,null==s?void 0:s.scale]);return Ut.jsx("div",{style:{...r},...o,children:null==a?void 0:a.map(n=>Ut.jsx(Qv,{documentId:e,pageIndex:t,tile:n,dpr:window.devicePixelRatio,scale:c},n.id))})}const ey="viewport",ty={id:ey,name:"Viewport Plugin",version:"1.0.0",provides:["viewport"],requires:[],optional:[],defaultConfig:{viewportGap:10,scrollEndDelay:300}},ny="INIT_VIEWPORT_STATE",ry="CLEANUP_VIEWPORT_STATE",oy="REGISTER_VIEWPORT",iy="UNREGISTER_VIEWPORT",sy="SET_VIEWPORT_METRICS",ay="SET_VIEWPORT_SCROLL_METRICS",ly="SET_VIEWPORT_GAP",cy="SET_SCROLL_ACTIVITY",uy="SET_S
2MOOTH_SCROLL_ACTIVITY",dy="ADD_VIEWPORT_GATE",hy="REMOVE_VIEWPORT_GATE";function py(e,t){return{type:uy,payload:{documentId:e,isSmoothScrolling:t}}}const gy={viewportMetrics:{width:0,height:0,scrollTop:0,scrollLeft:0,clientWidth:0,clientHeight:0,scrollWidth:0,scrollHeight:0,clientLeft:0,clientTop:0,relativePosition:{x:0,y:0}},isScrolling:!1,isSmoothScrolling:!1,gates:new Set},fy={viewportGap:0,documents:{},activeViewports:new Set,activeDocumentId:null},my=class extends jg{constructor(e,t,n){var r;super(e,t),this.id=e,this.viewportResize$=Ug(),this.viewportMetrics$=Ug(),this.scrollMetrics$=Ug(),this.scrollActivity$=Ug(),this.gateState$=Ug(),this.scrollRequests$=new Map,n.viewportGap&&this.dispatch((r=n.viewportGap,{type:ly,payload:r})),this.scrollEndDelay=n.scrollEndDelay||100}onDocumentLoadingStarted(e){this.dispatch(function(e){return{type:ny,payload:{documentId:e}}}(e)),this.scrollRequests$.set(e,Bg()),this.logger.debug("ViewportPlugin","DocumentOpened",`Initialized viewport state for document: ${e}`)}onDocumentClosed(e){var t;this.dispatch(function(e){return{type:ry,payload:{documentId:e}}}(e)),null==(t=this.scrollRequests$.get(e))||t.clear(),this.scrollRequests$.delete(e),this.logger.debug("ViewportPlugin","DocumentClosed",`Cleaned up viewport state for document: ${e}`)}buildCapability(){return{getViewportGap:()=>this.state.viewportGap,getMetrics:()=>this.getMetrics(),scrollTo:e=>this.scrollTo(e),isScrolling:()=>this.isScrolling(),isSmoothScrolling:()=>this.isSmoothScrolling(),isGated:e=>this.isGated(e),hasGate:(e,t)=>this.hasGate(e,t),getGates:e=>this.getGates(e),forDocument:e=>this.createViewportScope(e),gate:(e,t)=>this.gate(e,t),releaseGate:(e,t)=>
vendor: 19,735 bytes, line 2
2this.releaseGate(e,t),isViewportMounted:e=>this.state.activeViewports.has(e),onViewportChange:this.viewportMetrics$.on,onViewportResize:this.viewportResize$.on,onScrollChange:this.scrollMetrics$.on,onScrollActivity:this.scrollActivity$.on,onGateChange:this.gateState$.on}}createViewportScope(e){return{getMetrics:()=>this.getMetrics(e),scrollTo:t=>this.scrollTo(t,e),isScrolling:()=>this.isScrolling(e),isSmoothScrolling:()=>this.isSmoothScrolling(e),isGated:()=>this.isGated(e),hasGate:t=>this.hasGate(t,e),getGates:()=>this.getGates(e),gate:t=>this.gate(t,e),releaseGate:t=>this.releaseGate(t,e),onViewportChange:t=>this.viewportMetrics$.on(n=>{n.documentId===e&&t(n.metrics)}),onScrollChange:t=>this.scrollMetrics$.on(n=>{n.documentId===e&&t(n.scrollMetrics)}),onScrollActivity:t=>this.scrollActivity$.on(n=>{n.documentId===e&&t(n.activity)}),onGateChange:t=>this.gateState$.on(n=>{(null==n?void 0:n.documentId)===e&&t(n)})}}registerViewport(e){if(!this.state.documents[e])throw new Error(`Cannot register viewport for ${e}: document state not found. Document must be opened before registering viewport.`);this.state.activeViewports.has(e)||(this.dispatch(function(e){return{type:oy,payload:{documentId:e}}}(e)),this.logger.debug("ViewportPlugin","RegisterViewport",`Registered viewport (DOM mounted) for document: ${e}`))}unregisterViewport(e){this.registry.isDestroyed()||this.state.activeViewports.has(e)&&(this.dispatch(function(e){return{type:iy,payload:{documentId:e}}}(e)),this.logger.debug("ViewportPlugin","UnregisterViewport",`Unregistered viewport (DOM unmounted) for document: ${e}. State preserved.`))}setViewportResizeMetrics(e,t){if(this.registry.isDestroyed())return;this.dispatch(function(e,t){return{type:sy,payload:{documentId:e,metrics:t}}}(e,t));const n=this.state.documents[e];n&&this.viewportResize$.emit({documentId:e,metrics:n.viewportMetrics})}setViewportScrollMetrics(e,t){if(this.registry.isDestroyed())return;const n=this.state.documents[e];n&&(t.scrollTop===n.viewportMetrics.scrollTop&&t.scrollLeft===n.viewportMetrics.scrollLeft||(this.dispatch(function(e,t){return{type:ay,payload:{documentId:e,scrollMetrics:t}}}(e,t)),this.bumpScrollActivity(e),this.scrollMetrics$.emit({documentId:e,scrollMetrics:t})))}onScrollRequest(e,t){const n=this.scrollRequests$.get(e);if(!n)throw new Error(`Cannot subscribe to scroll requests for ${e}: document state not initialized`);return n.on(t)}gate(e,t){const n=this.state.documents[t];n?n.gates.has(e)||(this.dispatch(function(e,t){return{type:dy,payload:{documentId:e,key:t}}}(t,e)),this.logger.debug("ViewportPlugin","GateAdded",`Added gate '${e}' for document: ${t}. Total gates: ${n.gates.size+1}`)):this.logger.warn("ViewportPlugin","GateViewport",`Cannot gate viewport for ${t}: document not found`)}releaseGate(e,t){const n=this.state.documents[t];n?n.gates.has(e)&&(this.dispatch(function(e,t){return{type:hy,payload:{documentId:e,key:t}}}(t,e)),this.logger.debug("ViewportPlugin","GateReleased",`Released gate '${e}' for document: ${t}. Remaining gates: ${n.gates.size-1}`)):this.logger.warn("ViewportPlugin","ReleaseGate",`Cannot release gate for ${t}: document not found`)}getViewportState(e){const t=e??this.getActiveDocumentId(),n=this.state.documents[t];if(!n)throw new Error(`Viewport state not found for document: ${t}`);return n}getMetrics(e){return this.getViewportState(e).viewportMetrics}isScrolling(e){return this.getViewportState(e).isScrolling}isSmoothScrolling(e){return this.getViewportState(e).isSmoothScrolling}isGated(e){return this.getViewportState(e).gates.size>0}hasGate(e,t){return this.getViewportState(t).gates.has(e)}getGates(e){const t=this.getViewportState(e);return Array.from(t.gates)}scrollTo(e,t){const n=t??this.getActiveDocumentId(),r=this.getViewportState(n),{x:o,y:i,alignX:s,alignY:a,behavior:l="auto"}=e;"smooth"===l&&this.dispatch(py(n,!0));const c=r.viewportMetrics;let u=o,d=i;void 0!==s&&(u=o-c.clientWidth*(s/100)),void 0!==a&&(d=i-c.clientHeight*(a/100));const h=this.scrollRequests$.get(n);h&&h.emit({x:u,y:d,behavior:l})}bumpScrollActivity(e){this.debouncedDispatch(function(e,t){return{type:cy,payload:{documentId:e,isScrolling:t}}}(e,!1),this.scrollEndDelay),this.debouncedDispatch(py(e,!1),this.scrollEndDelay)}onStoreUpdated(e,t){for(const n in t.documents){const r=e.documents[n],o=t.documents[n];if(r!==o&&(this.viewportMetrics$.emit({documentId:n,metrics:o.viewportMetrics}),!r||r.isScrolling===o.isScrolling&&r.isSmoothScrolling===o.isSmoothScrolling||this.scrollActivity$.emit({documentId:n,activity:{isScrolling:o.isScrolling,isSmoothScrolling:o.isSmoothScrolling}}),r&&r.gates!==o.gates)){const e=Array.from(r.gates),t=Array.from(o.gates),i=t.find(t=>!e.includes(t)),s=e.find(e=>!t.includes(e));this.gateState$.emit({documentId:n,isGated:o.gates.size>0,gates:t,addedGate:i,removedGate:s}),this.logger.debug("ViewportPlugin","GateStateChanged",`Gate state changed for document ${n}. Gates: [${t.join(", ")}], Gated: ${o.gates.size>0}`)}}}async initialize(e){this.logger.info("ViewportPlugin","Initialize","Viewport plugin initialized")}async destroy(){this.viewportMetrics$.clear(),this.viewportResize$.clear(),this.scrollMetrics$.clear(),this.scrollActivity$.clear(),this.gateState$.clear(),this.scrollRequests$.forEach(e=>e.clear()),this.scrollRequests$.clear(),super.destroy()}};my.id="viewport";let vy=my;const yy={manifest:ty,create:(e,t)=>new vy(ey,e,t),reducer:(e=fy,t)=>{switch(t.type){case ny:{const{documentId:n}=t.payload;return{...e,documents:{...e.documents,[n]:{...gy,gates:new Set}}}}case ry:{const{documentId:n}=t.payload,{[n]:r,...o}=e.documents,i=new Set(e.activeViewports);return i.delete(n),{...e,documents:o,activeViewports:i,activeDocumentId:e.activeDocumentId===n?null:e.activeDocumentId}}case oy:{const{documentId:n}=t.payload,r=new Set(e.activeViewports);return r.add(n),{...e,activeViewports:r,activeDocumentId:e.activeDocumentId??n}}case iy:{const{documentId:n}=t.payload,r=new Set(e.activeViewports);return r.delete(n),{...e,activeViewports:r}}case"SET_ACTIVE_VIEWPORT_DOCUMENT":return{...e,activeDocumentId:t.payload};case ly:return{...e,viewportGap:t.payload};case sy:{const{documentId:n,metrics:r}=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,viewportMetrics:{width:r.width,height:r.height,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft,clientWidth:r.clientWidth,clientHeight:r.clientHeight,scrollWidth:r.scrollWidth,scrollHeight:r.scrollHeight,clientLeft:r.clientLeft,clientTop:r.clientTop,relativePosition:{x:r.scrollWidth<=r.clientWidth?0:r.scrollLeft/(r.scrollWidth-r.clientWidth),y:r.scrollHeight<=r.clientHeight?0:r.scrollTop/(r.scrollHeight-r.clientHeight)}}}}}:e}case ay:{const{documentId:n,scrollMetrics:r}=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,viewportMetrics:{...o.viewportMetrics,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft},isScrolling:!0}}}:e}case cy:{const{documentId:n,isScrolling:r}=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,isScrolling:r}}}:e}case uy:{const{documentId:n,isSmoothScrolling:r}=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,isSmoothScrolling:r}}}:e}case dy:{const{documentId:n,key:r}=t.payload,o=e.documents[n];if(!o)return e;const i=new Set(o.gates);return i.add(r),{...e,documents:{...e.documents,[n]:{...o,gates:i}}}}case hy:{const{documentId:n,key:r}=t.payload,o=e.documents[n];if(!o)return e;const i=new Set(o.gates);return i.delete(r),{...e,documents:{...e.documents,[n]:{...o,gates:i}}}}default:return e}},initialState:fy},by=Bt.createContext(null),wy=()=>ef(vy.id);function xy(e){const{plugin:t}=Jg(vy.id),n=Bt.useRef(null);return Bt.useLayoutEffect(()=>{if(!t)return;const r=n.current;if(!r)return;try{t.registerViewport(e)}catch(a){return}const o=()=>{t.setViewportScrollMetrics(e,{scrollTop:r.scrollTop,scrollLeft:r.scrollLeft})};r.addEventListener("scroll",o);const i=new ResizeObserver(()=>{t.setViewportResizeMetrics(e,{width:r.offsetWidth,height:r.offsetHeight,clientWidth:r.clientWidth,clientHeight:r.clientHeight,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft,scrollWidth:r.scrollWidth,scrollHeight:r.scrollHeight,clientLeft:r.clientLeft,clientTop:r.clientTop})});i.observe(r);const s=t.onScrollRequest(e,({x:e,y:t,behavior:n="auto"})=>{requestAnimationFrame(()=>{r.scrollTo({left:e,top:t,behavior:n})})});return()=>{t.unregisterViewport(e),i.disconnect(),r.removeEventListener("scroll",o),s()}},[t,e]),n}var Cy=(e=>(e.Automatic="automatic",e.FitPage="fit-page",e.FitWidth="fit-width",e))(Cy||{}),Sy=(e=>(e[e.Center=0]="Center",e[e.Top=1]="Top",e))(Sy||{});const Iy="zoom",ky={id:Iy,name:"Zoom Plugin",version:"1.0.0",provides:["zoom"],requires:["viewport","scroll"],optional:["interaction-manager","spread"],defaultConfig:{defaultZoomLevel:Cy.Automatic,minZoom:.2,maxZoom:60,zoomStep:.1,zoomRanges:[{min:.2,max:.5,step:.05},{min:.5,max:1,step:.1},{min:1,max:2,step:.2},{min:2,max:4,step:.4},{min:4,max:10,step:.8},{min:10,max:20,step:1.6},{min:20,max:40,step:3.2},{min:40,max:60,step:6.4}],presets:[{name:"Fit Page",value:Cy.FitPage},{name:"Fit Width",value:Cy.FitWidth},{name:"Automatic",value:Cy.Automatic},{name:"25%",value:.25},{name:"50%",value:.5},{name:"100%",value:1},{name:"125%",value:1.25},{name:"150%",value:1.5},{name:"200%",value:2},{name:"400%",value:4},{name:"800%",value:8},{name:"1600%",value:16}]}},Py="ZOOM/INIT_STATE",Dy="ZOOM/CLEANUP_STATE",My="ZOOM/SET_ZOOM_LEVEL",Ey="ZOOM/SET_MARQUEE_ZOOM_ACTIVE";const Ty={zoomLevel:Cy.Automatic,currentZoomLevel:1,isMarqueeZoomActive:!1},Ay={documents:{},activeDocumentId:null};const _y=class extends jg{constructor(e,t,n){var r,o,i;super(e,t),this.zoom$=Bg(),this.state$=Ug(),this.viewportPlugin=t.getPlugin("viewport"),this.viewport=this.viewportPlugin.provides(),this.scroll=t.getPlugin("scroll").provides();const s=t.getPlugin("interaction-manager");this.interactionManager=(null==s?void 0:s.provides())??null;const a=t.getPlugin("spread");this.spread=(null==a?void 0:a.provides())??null,this.minZoom=n.minZoom??.25,this.maxZoom=n.maxZoom??10,this.zoomStep=n.zoomStep??.1,this.defaultZoomLevel=n.defaultZoomLevel,this.presets=n.presets??[],this.zoomRanges=this.normalizeRanges(n.zoomRanges??[]),this.viewport.onViewportResize(e=>this.recalcAuto(e.documentId,Sy.Top),{mode:"debounce",wait:150,keyExtractor:e=>e.documentId}),null==(r=this.spread)||r.onSpreadChange(e=>{this.recalcAuto(e.documentId,Sy.Top)}),null==(o=this.interactionManager)||o.registerMode({id:"marqueeZoom",scope:"page",exclusive:!0,cursor:"zoom-in"}),null==(i=this.interactionManager)||i.onModeChange(e=>{const t="marqueeZoom"===e.activeMode,n=this.getDocumentState(e.documentId);var r;n&&n.isMarqueeZoomActive!==t&&this.dispatch((r=e.documentId,{type:Ey,payload:{documentId:r,isActive:t}}))})}onDocumentLoadingStarted(e){this.viewport.gate("zoom",e);const t={...Ty,zoomLevel:this.defaultZoomLevel};this.dispatch(function(e,t){return{type:Py,payload:{documentId:e,state:t}}}(e,t)),this.logger.debug("ZoomPlugin","DocumentOpened",`Initialized zoom state for document: ${e}`)}onDocumentLoaded(e){this.recalcAuto(e,Sy.Top)}onDocumentClosed(e){this.dispatch(function(e){return{type:Dy,payload:e}}(e)),this.logger.debug("ZoomPlugin","DocumentClosed",`Cleaned up zoom state for document: ${e}`)}onRotationChanged(e){this.recalcAuto(e,Sy.Top)}buildCapability(){return{requestZoom:(e,t)=>this.requestZoom(e,t),requestZoomBy:(e,t)=>this.requestZoomBy(e,t),zoomIn:()=>this.zoomIn(),zoomOut:()=>this.zoomOut(),zoomToArea:(e,t)=>this.zoomToArea(e,t),enableMarqueeZoom:()=>this.enableMarqueeZoom(),disableMarqueeZoom:()=>this.disableMarqueeZoom(),toggleMarqueeZoom:()=>this.toggleMarqueeZoom(),isMarqueeZoomActive:()=>this.isMarqueeZoomActive(),getState:()=>this.getDocumentStateOrThrow(),forDocument:e=>this.createZoomScope(e),registerMarqueeOnPage:e=>this.registerMarqueeOnPage(e),getPresets:()=>this.presets,onZoomChange:this.zoom$.on,onStateChange:this.state$.on}}createZoomScope(e){return{requestZoom:(t,n)=>this.requestZoom(t,n,e),requestZoomBy:(t,n)=>this.requestZoomBy(t,n,e),zoomIn:()=>this.zoomIn(e),zoomOut:()=>this.zoomOut(e),zoomToArea:(t,n)=>this.zoomToArea(t,n,e),enableMarqueeZoom:()=>this.enableMarqueeZoom(e),disableMarqueeZoom:()=>this.disableMarqueeZoom(e),toggleMarqueeZoom:()=>this.toggleMarqueeZoom(e),isMarqueeZoomActive:()=>this.isMarqueeZoomActive(e),getState:()=>this.getDocumentStateOrThrow(e),onZoomChange:t=>this.zoom$.on(n=>{n.documentId===e&&t(n)}),onStateChange:t=>this.state$.on(n=>{n.documentId===e&&t(n.state)})}}getDocumentState(e){const t=e??this.getActiveDocumentId();return this.state.documents[t]??null}getDocumentStateOrThrow(e){const t=this.getDocumentState(e);if(!t)throw new Error(`Zoom state not found for document: ${e??"active"}`);return t}requestZoom(e,t,n){this.handleRequest({level:e,center:t},n)}requestZoomBy(e,t,n){const r=n??this.getActiveDocumentId(),o=this.getDocumentStateOrThrow(r).currentZoomLevel,i=this.toZoom(o+e);this.handleRequest({level:i,center:t},r)}zoomIn(e){const t=e??this.getActiveDocumentId(),n=this.getDocumentStateOrThrow(t).currentZoomLevel;this.handleRequest({level:n,delta:this.stepFor(n)},t)}zoomOut(e){const t=e??this.getActiveDocumentId(),n=this.getDocumentStateOrThrow(t).currentZoomLevel;this.handleRequest({level:n,delta:-this.stepFor(n)},t)}zoomToArea(e,t,n){const r=n??this.getActiveDocumentId();this.handleZoomToArea(r,e,t)}enableMarqueeZoom(e){var t;const n=e??this.getActiveDocumentId();null==(t=this.interactionManager)||t.forDocument(n).activate("marqueeZoom")}disableMarqueeZoom(e){var t;const n=e??this.getActiveDocumentId();null==(t=this.interactionManager)||t.forDocument(n).activateDefaultMode()}toggleMarqueeZoom(e){var t;const n=e??this.getActiveDocumentId(),r=null==(t=this.interactionManager)?void 0:t.forDocument(n);"marqueeZoom"===(null==r?void 0:r.getActiveMode())?r.activateDefaultMode():null==r||r.activate("marqueeZoom")}isMarqueeZoomActive(e){var t;const n=e??this.getActiveDocumentId();return"marqueeZoom"===(null==(t=this.interactionManager)?void 0:t.forDocument(n).getActiveMode())}handleRequest({level:e,delta:t=0,center:n,focus:r=Sy.Center,align:o="keep"},i){const s=i??this.getActiveDocumentId(),a=this.getDocumentStateOrThrow(s);if(!this.coreState.core.documents[s])return;const l=this.viewport.forDocument(s),c=l.getMetrics(),u=a.currentZoomLevel;if(0===c.clientWidth||0===c.clientHeight)return;const d="number"==typeof e?e:this.computeZoomForMode(s,e,c);if(!1===d)return;const h=Fg(d+t,this.minZoom,this.maxZoom),p=Math.floor(1e3*h)/1e3,g=n??{vx:c.clientWidth/2,vy:r===Sy.Top?0:c.clientHeight/2},{desiredScrollLeft:f,desiredScrollTop:m}=this.computeScrollForZoomChange(s,c,u,p,g,o);isNaN(f)||isNaN(m)||this.viewportPlugin.setViewportScrollMetrics(s,{scrollLeft:f,scrollTop:m}),this.dispatch(function(e,t,n){return{type:My,payload:{documentId:e,zoomLevel:t,currentZoomLevel:n}}}(s,"number"==typeof e?p:e,p)),this.dispatchCoreAction(((e,t)=>({type:yg,payload:{scale:e,documentId:t}}))(p,s)),this.viewport.isGated(s)&&this.viewport.releaseGate("zoom",s),l.scrollTo({x:f,y:m,behavior:"instant"});const v={documentId:s,oldZoom:u,newZoom:p,level:e,center:g,desiredScrollLeft:f,desiredScrollTop:m,viewport:c};this.zoom$.emit(v)}computeZoomForMode(e,t,n){if(!this.coreState.core.documents[e])return!1;const r=this.scroll.forDocument(e),o=r?this.scroll.getPageGap():0,i=this.viewport.getViewportGap(),s=r.getSpreadPagesWithRotatedSize();if(!s.length)return!1;if(0===n.clientWidth||0===n.clientHeight)return!1;const a=n.clientWidth-2*i,l=n.clientHeight-2*i;if(a<=0||l<=0)return!1;let c=0,u=0;switch(s.forEach(e=>{const t=e.reduce((e,t,n)=>e+t.rotatedSize.width+(n?o:0),0),n=Math.max(...e.map(e=>e.rotatedSize.height));c=Math.max(c,t),u=Math.max(u,n)}),t){case Cy.FitWidth:return a/c;case Cy.FitPage:return Math.min(a/c,l/u);case Cy.Automatic:return Math.min(a/c,1);default:return 1}}computeScrollForZoomChange(e,t,n,r,o,i="keep"){const s=this.scroll.forDocument(e).getLayout(),a=this.viewport.getViewportGap(),l=s.totalContentSize.width,c=s.totalContentSize.height,u=t.clientWidth-2*a,d=t.clientHeight-2*a,h=(e,t,n)=>t*n<e?(e-t*n)/2:0,p=h(u,l,n),g=h(d,c,n),f=h(u,l,r),m=h(d,c,r),v=(t.scrollLeft+o.vx-a-p)/n*r+a+f,y=(t.scrollTop+o.vy-a-g)/n*r+a+m,b="center"===i?v-t.clientWidth/2:v-o.vx,w="center"===i?y-t.clientHeight/2:y-o.vy;return{desiredScrollLeft:Math.max(0,b),desiredScrollTop:Math.max(0,w)}}handleZoomToArea(e,t,n){const r=this.coreState.core.documents[e];if(!r)return;const o=r.rotation,i=this.viewport.forDocument(e).getMetrics(),s=this.viewport.getViewportGap(),a=this.getDocumentStateOrThrow(e).currentZoomLevel,l=i.clientWidth-2*s,c=i.clientHeight-2*s,u=this.scroll.forDocument(e).getLayout(),d=u.virtualItems.find(e=>e.pageLayouts.some(e=>e.pageIndex===t));if(!d)return;const h=d.pageLayouts.find(e=>e.pageIndex===t),p=Ip({width:h.width,height:h.height},n,o),g=this.toZoom(Math.min(l/p.size.width,c/p.size.height)),f=d.x+h.x,m=d.y+h.y,v=f+p.origin.x+p.size.width/2,y=m+p.origin.y+p.size.height/2,b=(e,t,n)=>t*n<e?(e-t*n)/2:0,w=b(l,u.totalContentSize.width,a),x=b(c,u.totalContentSize.height,a),C=s+w+v*a-i.scrollLeft,S=s+x+y*a-i.scrollTop;this.handleRequest({level:g,center:{vx:C,vy:S},align:"center"},e)}recalcAuto(e,t){const n=this.getDocumentState(e);n&&(n.zoomLevel!==Cy.Automatic&&n.zoomLevel!==Cy.FitPage&&n.zoomLevel!==Cy.FitWidth||this.handleRequest({level:n.zoomLevel,focus:t},e))}normalizeRanges(e){return[...e].filter(e=>e.step>0&&e.max>e.min).sort((e,t)=>e.min-t.min)}stepFor(e){const t=this.zoomRanges.find(t=>e>=t.min&&e<t.max);return t?t.step:this.zoomStep}toZoom(e){return parseFloat(Fg(e,this.minZoom,this.maxZoom).toFixed(2))}registerMarqueeOnPage(e){if(!this.interactionManager)return this.logger.warn("ZoomPlugin","MissingDependency","Interaction manager plugin not loaded, marquee zoom disabled"),()=>{};const t=this.coreState.core.documents[e.documentId];if(!t||!t.document)return this.logger.warn("ZoomPlugin","DocumentNotFound","Document not found"),()=>{};const n=t.document.pages[e.pageIndex];if(!n)return this.logger.warn("ZoomPlugin","PageNotFound",`Page ${e.pageIndex} not found`),()=>{};const r=function(e){const{pageSize:t,scale:n,minDragPx:r=5,onPreview:o,onCommit:i,onSmallDrag:s}=e;let a=null,l=null;return{onPointerDown:(e,t)=>{var n;a=e,l={origin:{x:e.x,y:e.y},size:{width:0,height:0}},null==o||o(l),null==(n=t.setPointerCapture)||n.call(t)},onPointerMove:e=>{if(!a)return;const n=Fg(e.x,0,t.width),r=Fg(e.y,0,t.height);l={origin:{x:Math.min(a.x,n),y:Math.min(a.y,r)},size:{width:Math.abs(n-a.x),height:Math.abs(r-a.y)}},null==o||o(l)},onPointerUp:(e,t)=>{var c;l&&(Math.max(l.size.width,l.size.height)*n>r?null==i||i(l):null==s||s()),a=null,l=null,null==o||o(null),null==(c=t.releasePointerCapture)||c.call(t)},onPointerCancel:(e,t)=>{var n;a=null,l=null,null==o||o(null),null==(n=t.releasePointerCapture)||n.call(t)}}}({pageSize:n.size,scale:e.scale,onPreview:e.callback.onPreview,onCommit:t=>{var n,r;this.zoomToArea(e.pageIndex,t,e.documentId),null==(r=(n=e.callback).onCommit)||r.call(n,t)},onSmallDrag:()=>{var t,n;this.zoomIn(e.documentId),null==(n=(t=e.callback).onSmallDrag)||n.call(t)}});return this.interactionManager.registerHandlers({documentId:e.documentId,modeId:"marqueeZoom",handlers:r,pageIndex:e.pageIndex})}onStoreUpdated(e,t){for(const n in t.documents){const r=e.documents[n],o=t.documents[n];r&&o&&(r.currentZoomLevel!==o.currentZoomLevel||r.zoomLevel!==o.zoomLevel||r.isMarqueeZoomActive!==o.isMarqueeZoomActive)&&this.state$.emit({documentId:n,state:o})}}async initialize(){this.logger.info("ZoomPlugin","Initialize","Zoom plugin initialized")}async destroy(){this.zoom$.clear(),this.state$.clear(),super.destroy()}};_y.id="zoom";let Ny=_y;const Ry={manifest:ky,create:(e,t)=>
2new Ny(Iy,e,t),reducer:(e=Ay,t)=>{switch(t.type){case Py:{const{documentId:n,state:r}=t.payload;return{...e,documents:{...e.documents,[n]:r},activeDocumentId:e.activeDocumentId??n}}case Dy:{const n=t.payload,{[n]:r,...o}=e.documents;return{...e,documents:o,activeDocumentId:e.activeDocumentId===n?null:e.activeDocumentId}}case"ZOOM/SET_ACTIVE_DOCUMENT":return{...e,activeDocumentId:t.payload};case My:{const{documentId:n,zoomLevel:r,currentZoomLevel:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,zoomLevel:r,currentZoomLevel:o}}}:e}case Ey:{const{documentId:n,isActive:r}=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,isMarqueeZoomActive:r}}}:e}default:return e}},initialState:Ay},jy=e=>{const{provides:t}=ef(Ny.id),[n,r]=Bt.useState(Ty);return Bt.useEffect(()=>{if(!t)return;const n=t.forDocument(e);return r(n.getState()),n.onStateChange(e=>{r(e)})},[t,e]),{state:n,provides:(null==t?void 0:t.forDocument(e))??null}};function zy({children:e,className:t,closedInlineClassName:n="-ml-40",inline:r,open:o,widthClassName:i="w-40"}){const[s,a]=Bt.useState(!1),l=s&&o;return Bt.useEffect(()=>{let e=0;const t=window.requestAnimationFrame(()=>{e=window.requestAnimationFrame(()=>{a(!0)})});return()=>{window.cancelAnimationFrame(t),window.cancelAnimationFrame(e)}},[]),Ut.jsx("aside",{"data-document-thumbnail-sidebar":"","data-sidebar-mode":r?"inline":"overlay","data-sidebar-open":o?"true":"false",className:Jt("absolute inset-y-0 left-0 z-30 shrink-0 overflow-hidden border-r bg-sidebar shadow-lg",i,l?"transition-[translate,margin-left,border-color] duration-200 ease-out":"transition-none",r&&"relative z-auto translate-x-0 shadow-none",o?"ml-0 translate-x-0":r?Jt("pointer-events-auto border-r-0",n):"pointer-events-none -translate-x-full border-r-0",t),children:e})}function Ly({className:e,inline:t}){return t?Ut.jsxs("div",{className:Jt("w-40 shrink-0 border-r bg-sidebar p-4",e),children:[Ut.jsx("div",{className:"mx-auto h-28 w-20 overflow-hidden rounded-md bg-background shadow-xs",children:Ut.jsx("div",{className:"h-full animate-pulse bg-muted"})}),Ut.jsx("div",{className:"mx-auto mt-3 h-3 w-10 rounded-full bg-muted"})]}):null}function $y({className:e,children:t,orientation:n="both",scrollFade:r=!1,scrollbarGutter:o=!1,scrollbarOverflowOnly:i=!1,viewportClassName:s,viewportProps:a,viewportRef:l,...c}){const{className:u,key:d,ref:h,...p}=a??{};return Ut.jsxs(Jn,{className:Jt("size-full min-h-0",i&&"scrollbar-overflow-only",e),...c,children:[Ut.jsx(er,{...p,ref:Fy(h,l),className:Jt("transition-shadows h-full rounded-[inherit] outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background data-has-overflow-x:overscroll-x-contain data-has-overflow-y:overscroll-y-contain",r&&"mask-t-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-start)))] mask-r-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-end)))] mask-b-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-end)))] mask-l-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-start)))] [--fade-size:1.5rem]",o&&"data-has-overflow-x:pb-2.5 data-has-overflow-y:pe-2.5",u,s),"data-slot":"scroll-area-viewport",children:t},d),"horizontal"!==n?Ut.jsx(Oy,{orientation:"vertical"}):null,"vertical"!==n?Ut.jsx(Oy,{orientation:"horizontal"}):null,"both"===n?Ut.jsx(tr,{"data-slot":"scroll-area-corner"}):null]})}function Fy(...e){return t=>{e.forEach(e=>{e&&("function"!=typeof e?e.current=t:e(t))})}}function Oy({className:e,orientation:t="vertical",...n}){return Ut.jsx(nr,{className:Jt("m-1 flex opacity-0 transition-opacity delay-300 data-hovering:opacity-100 data-hovering:delay-0 data-hovering:duration-100 data-scrolling:opacity-100 data-scrolling:delay-0 data-scrolling:duration-100 data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:flex-col data-[orientation=vertical]:w-1.5",e),"data-slot":"scroll-area-scrollbar",orientation:t,...n,children:Ut.jsx(rr,{className:"relative flex-1 rounded-full bg-foreground
2/20","data-slot":"scroll-area-thumb"})})}let Hy=null;const qy=[.1,.25,.5,.75,1,1.25,1.5,2],Vy="w-40";function By(e){return(e%4+4)%4}function Uy(){const[e,t]=Bt.useState(null),[n,r]=Bt.useState(null);return Bt.useEffect(()=>{let e=!1;return(Hy??(Hy=hn(async()=>{const{createPdfiumEngine:e}=await import("./worker-engine-BMhFn8Xf.js");return{createPdfiumEngine:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20])).then(({createPdfiumEngine:e})=>e("https://cdn.jsdelivr.net/npm/@embedpdf/[email protected]/dist/pdfium.wasm",{}))),Hy).then(n=>{e||t(n)},t=>{e||r(t)}),()=>{e=!0}},[]),{engine:e,error:n}}function Wy(e){return 90*e}function Gy(e){return e.toLowerCase().endsWith(".pdf")?e:`${e}.pdf`}function Zy(e,t){if(null==e?void 0:e.trim())return Gy(e.trim());const n=(t.split(/[?#]/)[0]??"").split("/").pop()||"document.pdf";try{return Gy(decodeURIComponent(n))}catch{return Gy(n)}}function Ky(e,t){const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,r.rel="noopener",document.body.append(r),r.click(),r.remove(),window.setTimeout(()=>URL.revokeObjectURL(n),0)}function Yy({basePageRotations:e,pageRotationDeltas:t,pdfDocument:n,width:r,gap:o,imagePadding:i,labelHeight:s,paddingY:a}){if(!n)return null;let l=a;const c=n.pages.map((n,a)=>{const c=e[a]??By(n.rotation),u=function({page:e,pageIndex:t,rotation:n,width:r,imagePadding:o,labelHeight:i,top:s}){const a=Math.max(1,r-2*o),l=n%2==1?e.size.height:e.size.width,c=n%2==1?e.size.width:e.size.height,u=Math.round(a*(c/l));return{pageIndex:t,width:a,height:u,wrapperHeight:o+u+o+i,top:s,labelHeight:i,padding:o}}({page:n,pageIndex:a,rotation:By(c+(t.get(a)??0)),width:r,imagePadding:i,labelHeight:s,top:l});return l+=u.wrapperHeight+o,u});return{items:c,totalHeight:c.length?l-o+a:2*a}}function Xy({sidebarOpen:e,sidebarInline:t}){return Ut.jsxs("div",{className:"absolute inset-0 z-20 flex bg-muted/30",children:[e?Ut.jsx(Ly,{className:Vy,inline:t}):null,Ut.jsx("div",{className:"grid min-w-0 flex-1 place-items-center",children:Ut.jsx(or,{className:"size-4"})})]})}function Qy({className:e,showToolbar:t,showUpload:n,sidebarOpen:r,state:o,onUploadFile:i}){return Ut.jsxs("div",{"data-slot":"pdf-viewer",className:Jt("flex h-full max-h-full min-h-0 w-full flex-col overflow-hidden bg-background",e),children:[t?Ut.jsx("div",{className:"flex min-h-12 flex-wrap items-center justify-end gap-2 border-b bg-background px-3 py-2",children:n&&i?Ut.jsx(eb,{onUploadFile:i,showUpload:!0}):null}):null,Ut.jsxs("div",{className:"relative flex min-h-0 flex-1 overflow-hidden bg-muted/30",children:["loading"===o?Ut.jsx(Xy,{sidebarInline:!0,sidebarOpen:r}):null,"error"===o?Ut.jsx("div",{className:"absolute inset-0 z-20 grid place-items-center bg-background p-6 text-sm text-muted-foreground",children:"Unable to load the PDF preview."}):null,"empty"===o?Ut.jsx("div",{className:"absolute inset-0 z-20 grid place-items-center bg-background p-6 text-center text-sm text-muted-foreground",children:Ut.jsxs("div",{className:"max-w-sm space-y-3",children:[Ut.jsx("div",{className:"font-medium text-foreground",children:"Upload a PDF to preview"}),Ut.jsxs("div",{children:["Pass a PDF URL with the ",Ut.jsx("code",{children:"src"})," prop or use the upload control."]})]})}):null]})]})}function Jy({label:e,children:t}){return Ut.jsxs(ar,{children:[Ut.jsx(lr,{asChild:!0,children:Ut.jsx("span",{className:"inline-flex",children:t})}),Ut.jsx(cr,{side:"bottom",children:e})]})}function eb({downloadDisabled:e,isPreparingDownload:t=!1,onDownload:n,onUploadFile:r,showDownload:o=!1,showUpload:i=!1}){const s=Bt.useRef(null);return o||i?Ut.jsxs(Ut.Fragment,{children:[i&&r?Ut.jsx("input",{ref:s,type:"file",accept:"application/pdf,.pdf",className:"sr-only",tabIndex:-1,onChange:e=>{var t;const n=null==(t=e.target.files)?void 0:t[0];n&&(r(n),e.currentTarget.value="")}}):null,Ut.jsxs(_n,{children:[Ut.jsx(Nn,{asChild:!0,children:Ut.jsx(en,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Open PDF actions",children:Ut.jsx(ui,{icon:ti,className:"size-4"})})}),Ut.jsxs(Rn,{align:"end",className:"w-40",children:[o&&n?Ut.jsxs(qn,{disabled:e,onClick:n,children:[t?Ut.jsx(or,{className:"size-4"}):Ut.jsx(ui,{icon:Xo,className:"size-4"}),"Download"]}):null,i&&r?Ut.jsxs(qn,{onClick:()=>{var e;return null==(e=s.current)?void 0:e.click()},children:[Ut.jsx(ui,{icon:li,className:"size-4"}),"Upload"]}):null]})]})]}):null}function tb({activePage:e,controlsDisabled:t,numPages:n,onPageChange:r}){const o=Bt.useRef(null),i=n?e:1,[s,a]=Bt.useState(!1),[l,c]=Bt.useState(()=>String(i));Bt.useEffect(()=>{var e,t;s&&(null==(e=o.current)||e.focus(),null==(t=o.current)||t.select())},[s]);const u=Bt.useCallback(e=>{const t=e.trim();if(!t)return;const o=Number(t);Number.isInteger(o)&&r(Math.min(Math.max(o,1),Math.max(n,1)))},[n,r]);return Ut.jsxs("div",{className:"flex items-center text-sm whitespace-nowrap text-primary",children:[Ut.jsx("span",{children:"Page"}),s?Ut.jsx(Wn,{ref:o,"aria-label":"Page number",inputMode:"numeric",pattern:"[0-9]*",value:l,className:"mx-1 h-8 w-14 min-w-14 roun
2ded-md text-xs [&_[data-slot=input]]:text-center",onBlur:()=>a(!1),onChange:e=>{const t=e.target.value;c(t),u(t)},onKeyDown:e=>{"Enter"!==e.key&&"Escape"!==e.key||e.currentTarget.blur()}}):Ut.jsx(en,{type:"button",variant:"ghost",size:"sm",className:"font-normal","aria-label":`Current page ${i}. Edit page number`,disabled:t||!n,onClick:()=>{c(String(i)),a(!0)},children:i}),Ut.jsxs("span",{children:["of ",n||"â"]})]})}function nb({documentId:e,controlsDisabled:t}){const{state:n,provides:r}=(e=>{const{provides:t}=Nm(),[n,r]=Bt.useState(Pm),o=Bt.useMemo(()=>null==t?void 0:t.forDocument(e),[t,e]);return Bt.useEffect(()=>{if(o)return r(o.getState()),o.onStateChange(e=>r(e));r(Pm)},[o]),{state:n,provides:o??null}})(e),{provides:o}=hm(e),[i,s]=Bt.useState(""),[a,l]=Bt.useState(""),[c,u]=Bt.useState(!1),d=Bt.useRef(r),h=Bt.useRef(o),p=Bt.useRef(0),g=Boolean(a.trim()),f=c?"Searching":g?n.total?`${n.activeResultIndex+1} / ${n.total}`:"No results":"No search",m=Bt.useCallback(e=>{const t=n.results[e];if(!t||!o)return;const r=t.rects[0];o.scrollToPage({pageNumber:t.pageIndex+1,...r?{pageCoordinates:{x:r.origin.x,y:r.origin.y},alignY:30}:{},behavior:"auto"})},[o,n.results]);Bt.useEffect(()=>{d.current=r,h.current=o},[r,o]);const v=Bt.useCallback(e=>{const t=e.trim(),n=p.current+1;p.current=n,l(t);const r=d.current,o=h.current;if(r){if(!t)return r.stopSearch(),void u(!1);u(!0),r.startSearch(),r.searchAllPages(t).wait(e=>{if(p.current!==n)return;const t=e.results[0];if(t&&o){r.goToResult(0);const e=t.rects[0];o.scrollToPage({pageNumber:t.pageIndex+1,...e?{pageCoordinates:{x:e.origin.x,y:e.origin.y},alignY:30}:{},behavior:"auto"})}u(!1)},()=>{p.current===n&&u(!1)})}else u(!1)},[]);Bt.useEffect(()=>{if(!i.trim())return;const e=window.setTimeout(()=>{v(i)},300);return()=>window.clearTimeout(e)},[v,i]);const y=Bt.useCallback(e=>{const t=e.target.value;s(t),t.trim()?u(!0):(p.current+=1,l(""),u(!1),null==r||r.stopSearch())},[r]),b=Bt.useCallback(()=>{p.current+=1,s(""),l(""),u(!1),null==r||r.stopSearch()},[r]),w=Bt.useCallback(e=>{if(!r||0===n.total)return;const t=1===e?r.nextResult():r.previousResult();m(t)},[r,m,n.total]);return Ut.jsxs(Vn,{children:[Ut.jsx(Jy,{label:"Search text",children:Ut.jsx(Bn,{asChild:!0,children:Ut.jsx(en,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Search text",disabled:t,children:Ut.jsx(ui,{icon:ii,className:"size-4"})})})}),Ut.jsx(Un,{align:"end",className:"w-72",children:Ut.jsxs("div",{className:"space-y-3",children:[Ut.jsx(Wn,{placeholder:"Search text",value:i,onChange:y,onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),e.shiftKey&&n.total?w(-1):n.total?w(1):i.trim()&&v(i))}}),Ut.jsxs("div",{className:"flex items-center justify-between gap-2",children:[Ut.jsx("div",{className:"min-w-0 text-xs text-muted-foreground",children:Ut.jsx("div",{className:"truncate",children:n.total?Ut.jsxs(Ut.Fragment,{children:[Ut.jsx("span",{className:"text-primary",children:n.activeResultIndex+1}),` / ${n.total}`]}):f})}),Ut.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[Ut.jsx(en,{type:"button",variant:"outline",size:"icon-sm","aria-label":"Previous result",disabled:c||0===n.total,onClick:()=>w(-1),children:Ut.jsx(ui,{icon:Wo,className:"size-4"})}),Ut.jsx(en,{type:"button",variant:"outline",size:"icon-sm","aria-label":"Next result",disabled:c||0===n.total,onClick:()=>w(1),children:Ut.jsx(ui,{icon:Go,className:"size-4"})})]})]}),Ut.jsx("div",{className:"flex justify-end",children:Ut.jsx(en,{type:"button",variant:"outline",size:"sm",onClick:b,children:"Clear"})})]})})]})}function rb({basePageRotations:e,documentId:t,activePage:n,pageCount:r,pageRotationDeltas:o,pdfDocument:i,selectedPageIndexes:s,onSelectPage:a}){const l=Bt.useId(),c=n>0?`${l}-page-${n}`:void 0,u=Bt.useCallback(e=>{if(r<1)return;const t=n>0?n:1;let o=null;if("ArrowDown"===e.key)o=Math.min(r,t+1);else if("ArrowUp"===e.key)o=Math.max(1,t-1);else if("Home"===e.key)o=1;else if("End"===e.key)o=r;else if(" "===e.key)return e.preventDefault(),void a(t,"toggle");null!==o&&(e.preventDefault(),a(o,e.shiftKey?"range":"replace"))},[n,a,r]);return Ut.jsx(ob,{activeDescendantId:c,basePageRotations:e,documentId:t,onKeyDown:u,pageRotationDeltas:o,pdfDocument:i,children:e=>{const i=e.pageIndex+1,c=i===n,u=s.has(e.pageIndex),d=e.padding??0,h=o.get(e.pageIndex)??0,p=h%2==1?{height:e.width,transform:`rotate(${Wy(h)}deg)`,width:e.height}:{height:e.height,transform:0===h?void 0:`rotate(${Wy(h)}deg)`,width:e.width};return Ut.jsx("div",{"data-pdf-viewer-thumbnail":i,className:Jt("absolute right-0 left-0 flex justify-center",c&&"z-10"),style:{to
2p:e.top,height:e.wrapperHeight},children:Ut.jsxs("div",{id:`${l}-page-${i}`,role:"option","data-pdf-viewer-thumbnail-option":i,"aria-current":c?"page":void 0,"aria-label":`Page ${i}`,"aria-posinset":i,"aria-selected":u,"aria-setsize":r,"data-selected":u?"":void 0,className:Jt("flex h-full w-full cursor-default flex-col items-center justify-between rounded-md px-2 py-0 text-xs transition-shadow outline-none select-none hover:bg-sidebar-accent",c||u?"bg-sidebar-accent text-foreground":"text-muted-foreground",c&&"group-focus-visible/pdf-thumbnail-sidebar:ring-2 group-focus-visible/pdf-thumbnail-sidebar:ring-ring group-focus-visible/pdf-thumbnail-sidebar:ring-offset-1 group-focus-visible/pdf-thumbnail-sidebar:ring-offset-background"),onClick:e=>{const t=e.shiftKey?"range":e.metaKey||e.ctrlKey?"toggle":"replace";a(i,t)},children:[Ut.jsx("span",{className:"mt-0 flex items-center justify-center overflow-hidden rounded-md bg-transparent",style:{width:e.width+2*d,height:e.height+2*d,padding:d},children:Ut.jsx(Lv,{documentId:t,meta:e,className:"block rounded-sm object-contain",style:p})}),Ut.jsx("span",{className:"flex items-center justify-center tabular-nums",style:{height:e.labelHeight},children:Ut.jsx("span",{className:"flex min-w-5 items-center justify-center px-1.5 text-center leading-5",children:i})})]})},e.pageIndex)}})}function ob({activeDescendantId:e,basePageRotations:t,children:n,documentId:r,onKeyDown:o,pageRotationDeltas:i,pdfDocument:s}){const{plugin:a}=jv(),l=Bt.useRef(null),[c,u]=Bt.useState({clientHeight:0,scrollTop:0}),d=Bt.useMemo(()=>(null==a?void 0:a.provides().forDocument(r))??null,[r,a]),h=Bt.useSyncExternalStore(Bt.useCallback(e=>d?d.onWindow(()=>e()):()=>{},[d]),Bt.useCallback(()=>(null==d?void 0:d.getWindow())??null,[d]),()=>null),p=Boolean(h),g=(null==a?void 0:a.cfg.paddingY)??0,f=Bt.useMemo(()=>Yy({basePageRotations:t,pageRotationDeltas:i,pdfDocument:s,width:(null==a?void 0:a.cfg.width)??108,gap:(null==a?void 0:a.cfg.ga
2p)??12,imagePadding:(null==a?void 0:a.cfg.imagePadding)??0,labelHeight:(null==a?void 0:a.cfg.labelHeight)??24,paddingY:g}),[t,i,s,g,a]),m=Bt.useMemo(()=>{var e,t;if(!f)return h;const n=function({buffer:e,clientHeight:t,items:n,scrollTop:r}){if(0===n.length)return[];if(t<=0)return n.slice(0,Math.min(n.length,2*e));const o=r+t;let i=n.findIndex(e=>e.top+e.wrapperHeight>=r);-1===i&&(i=n.length-1);let s=i;for(;s<n.length&&n[s].top<=o;)s+=1;return n.slice(Math.max(0,i-e),Math.min(n.length,s+e))}({buffer:(null==a?void 0:a.cfg.buffer)??3,clientHeight:c.clientHeight,items:f.items,scrollTop:c.scrollTop});return{start:(null==(e=n[0])?void 0:e.pageIndex)??-1,end:(null==(t=n.at(-1))?void 0:t.pageIndex)??-1,items:n,totalHeight:f.totalHeight}},[f,a,c,h]);return Bt.useEffect(()=>{const e=l.current;if(!e||!d)return;const t=()=>{u({clientHeight:e.clientHeight,scrollTop:e.scrollTop}),d.updateWindow(e.scrollTop,e.clientHeight)};e.addEventListener("scroll",t);const n=window.requestAnimationFrame(t);return()=>{window.cancelAnimationFrame(n),e.removeEventListener("scroll",t)}},[d]),Bt.useEffect(()=>{const e=l.current;if(!e||!d)return;const t=new ResizeObserver(()=>{u({clientHeight:e.clientHeight,scrollTop:e.scrollTop}),d.updateWindow(e.scrollTop,e.clientHeight)});return t.observe(e),()=>t.disconnect()},[d]),Bt.useEffect(()=>{const e=l.current;e&&d&&d.updateWindow(e.scrollTop,e.clientHeight)},[f,d,h]),Bt.useEffect(()=>{const e=l.current;if(e&&d&&p)return d.onScrollTo(({top:t,behavior:n})=>{e.scrollTo({top:t,behavior:n})})},[p,d]),Ut.jsx($y,{className:"h-full w-full",orientation:"vertical",scrollFade:!0,viewportClassName:"group/pdf-thumbnail-sidebar px-4 focus-visible:ring-0 focus-visible:ring-offset-0",viewportProps:{"aria-activedescendant":e,"aria-label":"PDF pages","aria-multiselectable":!0,onKeyDown:o,onMouseDown:e=>{e.currentTarget.focus({preventScroll:!0})},role:"listbox",style:{paddingBottom:g,paddingTop:g},tabIndex:0},viewportRef:l,children:Ut.jsx("div",{className:"relative",style:{height:(null==m?void 0:m.totalHeight)??0},children:null==m?void 0:m.items.map(e=>n(e))})})}function ib({children:e,className:t,documentId:n}){const r=xy(n),{provides:o}=wy(),i=(e=>{const{provides:t}=wy(),[n,r]=Bt.useState((null==t?void 0:t.isGated(e))??!1);return Bt.useEffect(()=>{if(t)return r(t.isGated(e)),t.onGateChange(t=>{t.documentId===e&&r(t.isGated)})},[t,e]),n})(n),s=(null==o?void 0:o.getViewportGap())??0;return Ut.jsx(by.Provider,{value:r,children:Ut.jsx($y,{className:t,orientation:"both",viewportClassName:"relative select-none selection:bg-transparent selection:text-inherit",viewportProps:{style:{padding:s}},viewportRef:r,children:i?null:e})})}function sb({viewportElementRef:e}){const t=Bt.useContext(by);return Bt.useEffect(()=>{e.current=(null==t?void 0:t.current)??null}),null}function ab({documentId:e,pageIndex:t,scale:n}){const{plugin:r}=wv(),[o,i]=Bt.useState([]);return Bt.useEffect(()=>{if(r)return r.registerSelectionOnPage({documentId:e,pageIndex:t,onRectsChange:({rects:e})=>{i(e)}})},[e,t,r]),o.length?Ut.jsx(Ut.Fragment,{children:o.map((e,t)=>Ut.jsx("div",{className:"pointer-events-none absolute",style:{background:"rgba(59, 130, 246, 0.14)",height:e.size.height*n,left:e.origin.x*n,top:e.origin.y*n,width:e.size.width*n}},`${t}-${e.origin.x}-${e.origin.y}`))}):null}function lb({documentId:e}){const{plugin:t}=wv(),{provides:n}=bv(),r=Bt.useRef(null);return Bt.useEffect(()=>{if(n)return n.forDocument(e).onBeginSelection(({modeId:e})=>{r.current=e})},[e,n]),Bt.useEffect(()=>{if(!n)return;let o=0;const i=()=>{window.cancelAnimationFrame(o),o=window.requestAnimationFrame(()=>{var o;const i=n.getState(e);if(i.selecting){if(i.selection&&t){const n=t;return void(null==(o=n.endSelection)||o.call(n,e,r.current??"pointerMode"))}i.selection||n.clear(e)}})};return window.addEventListener("pointerup",i),window.addEventListener("pointercancel",i),window.addEventListener("blur",i),()=>{window.cancelAnimationFrame(o),window.removeEventListener("pointerup",i),window.removeEventListener("pointercancel",i),window.removeEventListener("blur",i)}},[e,n,t]),null}function cb({documentId:e}){const{provides:t}=bv();return Bt.useEffect(()=>{if(!t)return;const n=n=>{var r;(r=n.target)instanceof HTMLElement&&(r.isContentEditable||Boolean(r.closest("input, textarea, [contenteditable='true']")))||t.getState(e).selection&&(n.preventDefault(),t.copyToClipboard(e))},r=e=>{"c"===e.key.toLowerCase()&&(e.metaKey||e.ctrlKey)&&n(e)};return document.addEventListener("copy",n),document.addEventListener("keydown",r),()=>{document.removeEventListener("copy",n),document.removeEventListener("keydown",r)}},[e,t]),null}function ub({height:e,rotation:t,width:n}){return function(e){return e%2==1}(t)?{height:n,width:e}
2:{height:e,width:n}}function db({basePageRotations:e,layout:t,pageRotationDeltas:n}){if(0===n.size)return t;let r=0,o=0,i=0;const s=t.pageGap;let a=0;const l=t.items.map((l,c)=>{let u=0,d=0,h=0;const p=l.pageLayouts.map(r=>{const o=e[r.pageIndex]??By(0),i=function(e,t){return ub({height:e.height,rotation:t,width:e.width})}(r,By(o+(n.get(r.pageIndex)??0))),l=t.strategy===Qf.Horizontal?r.rotatedWidth:r.rotatedHeight,p=t.strategy===Qf.Horizontal?i.width:i.height;0===t.startSpacing&&0===c&&0===u&&p<l&&(a=Math.max(a,(l-p)/2));const g={...r,rotatedHeight:i.height,rotatedWidth:i.width,x:t.strategy===Qf.Horizontal?0:u,y:t.strategy===Qf.Horizontal?u:0};return u+=(t.strategy===Qf.Horizontal?i.height:i.width)+s,d=t.strategy===Qf.Horizontal?Math.max(d,i.width):d+i.width,h=t.strategy===Qf.Horizontal?h+i.height:Math.max(h,i.height),g});p.length>1&&(t.strategy===Qf.Horizontal?h-=s:d-=s);const g={...l,height:h,offset:i,pageLayouts:p,width:d,x:t.strategy===Qf.Horizontal?i:l.x,y:t.strategy===Qf.Horizontal?l.y:i};return t.strategy===Qf.Horizontal?(i+=d+s,o=Math.max(o,h)):(i+=h+s,r=Math.max(r,d)),g});return l.length>0&&(i-=s),{...t,endSpacing:t.endSpacing,items:l,startSpacing:t.startSpacing+a,totalHeight:t.strategy===Qf.Horizontal?o:t.startSpacing+a+i+t.endSpacing,totalWidth:t.strategy===Qf.Horizontal?t.startSpacing+a+i+t.endSpacing:r}}function hb({documentId:e,pageRotationDeltas:t,basePageRotations:n,renderPage:r}){const{plugin:o}=Jg(cm.id),[i,s]=Bt.useState({docId:null,layout:null});Bt.useEffect(()=>{if(!o||!e)return;let t=0;const n=o.onScrollerData(e,t=>{s({docId:e,layout:t})});return t=window.requestAnimationFrame(()=>{try{s({docId:e,layout:o.getScrollerLayout(e)})}catch{s({docId:e,layout:null})}}),()=>{window.cancelAnimationFrame(t),n(),s({docId:null,layout:null}),o.clearLayoutReady(e)}},[e,o]);const a=Bt.useMemo(()=>i.docId===e&&i.layout?db({basePageRotations:n,layout:i.layout,pageRotationDeltas:t}):null,[n,e,i,t]);return Bt.useLayoutEffect(()=>{o&&e&&a&&o.setLayoutReady(e)},[e,o,a]),a?Ut.jsxs("div",{style:{width:`${a.totalWidth}px`,height:`${a.totalHeight}px`,position:"relative",boxSizing:"border-box",margin:"0 auto",...a.strategy===Qf.Horizontal&&{display:"flex",flexDirection:"row"}},children:[Ut.jsx("div",{style:a.strategy===Qf.Horizontal?{width:a.startSpacing,height:"100%",flexShrink:0}:{height:a.startSpacing,width:"100%"}}),Ut.jsx("div",{style:{gap:a.pageGap,display:"flex",alignItems:"center",position:"relative",boxSizing:"border-box",...a.strategy===Qf.Horizontal?{flexDirection:"row",minHeight:"100%"}:{flexDirection:"column",minWidth:"fit-content"}},children:a.items.map(e=>Ut.jsx("div",{style:{display:"flex",justifyContent:"center",gap:a.pageGap},children:e.pageLayouts.map(e=>Ut.jsx("div",{style:{width:`${e.rotatedWidth}px`,height:`${e.rotatedHeight}px`,position:"relative",zIndex:e.elevated?1:void 0},children:r(e)},e.pageNumber))},e.pageNumbers[0]))}),Ut.jsx("div",{style:a.strategy===Qf.Horizontal?{width:a.endSpacing,height:"100%",flexShrink:0}:{height:a.endSpacing,width:"100%"}})]}):null}function pb({viewerRef:e,pdfFile:t,documentId:n,document:r,defaultZoom:o,className:i,fileName:s,showDownload:a,showToolbar:l,showRotateControls:c,showUpload:u,toolbarActions:d,pageClassName:h,renderPageOverlay:p,onActivePageChange:g,onPdfUpload:f,onPagePointerDown:m,onPagePointerMove:v,onPagePointerUp:y,onPagePointerCancel:b,onUploadFile:w}){const{registry:x}=Qg(),{state:C,provides:S}=hm(n),{state:I,provides:k}=jy(n),{provides:P}=zv(),{plugin:D}=jv(),[M,E]=Bt.useState(!1),[T,A]=Bt.useState(!1),[_,N]=Bt.useState(()=>new Map),[R,j]=Bt.useState(()=>new Set),z=Bt.useMemo(()=>(null==r?void 0:r.pages.map(e=>By(e.rotation)))??[],[r]),[L,$]=function(){const e=Bt.useRef(null),[t,n]=Bt.useState(0);return Bt.useLayoutEffect(()=>{const t=e.current;if(!t)return;const r=()=>{const e=t.getBoundingClientRect().width;0!==e&&n(e)};r();const o=new ResizeObserver(r);return o.observe(t),()=>o.disconnect()},[]),[e,t]}(),F=$>=768;const O=Bt.useRef(null),H=Bt.useRef(_),q=Bt.useRef(R),V=Bt.useRef(null),B=Bt.useRef(null),U=Bt.useRef(null),W=C.currentPage,G=(null==r?void 0:r.pageCount)??0,Z=!r,K=!G,Y=K||T,X=M&&!Z,Q=I.currentZoomLevel,J=Bt.useRef(null);Bt.useEffect(()=>{H.current=_},[_]),Bt.useEffect(()=>{q.current=R},[R]),Bt.useEffect(()=>{W>0&&(null==g||g(W))},[W,g]),Bt.useEffect(()=>{if(W<1||G<1)return;const e=W-1,t=B.current;if(B.current=null,t===e)return;const n=new Set([e]);V.current=e,q.current=n,j(e=>function(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}(e,n)?e:n)},[W,G]),Bt.useEffect(()=>{if(G<1||U.current===n)return;const e=Math.max(0,(W>0?W:1)-1),t=new Set([e]);U.current=n,V.current=e,q.current=t,j(t)},[W,n,G]),Bt.useEffect(()=>{if(!X)return void(J.current=null);if(W<1||!P||J.current===n)return;J.current=n;const e=window.requestAnimationFrame(()=>{P.forDocument(n).scrollToThumb(W-1)});return()=>window.cancelAnimationFrame(e)},[W,n,X,P]);const ee=Bt.useRef(null);Bt.useEffect(()=>{r&&k&&ee.current!==n&&(ee.current=n,k.requestZoom(o))},[o,n,r,k]);const te=Bt.useCallback((e,t)=>{null==S||S.scrollToPage({pageNumber:e,behavior:"smooth"===(null==t?void 0:t.behavior)?"smooth":"auto"})},[S]),ne=Bt.useCallback((e,t)=>{const n=e-1;n<0||n>=G||(B.current=n,j(e=>{let r;if("range"===t){r=function(e,t){const n=Math.min(e,t),r=Math.max(e,t),o=new Set;for(let i=n;i<=r;i+=1)o.add(i);return o}(V.current??(W>0?W-1:n),n)}else"toggle"===t?(r=new Set(e),r.has(n)?r.delete(n):r.add(n),V.current=n):(r=new Set([n]),V.current=n);return q.current=r,r}),te(e))},[W,G,te]);Bt.useImperativeHandle(e,()=>({scrollToPage:te,scrollToPageArea:(e,t,n)=>{var o;const i=null==(o=null==r?void 0:r.pages[e-1])?void 0:o.size;null==S||S.scrollToPage({pageNumber:e,...i?{pageCoordinates:{x:(t.left??0)/100*i.width,y:t.top/100*i.height},alignY:25}:{},behavior:"smooth"===(null==n?void 0:n.behavior)?"smooth":"auto"})},getViewportElement:()=>O.current}),[r,S,te]);const re=Bt.useCallback(async()=>
2{if(t&&!T){A(!0);try{await async function({fileName:e,pageRotationDeltas:t,src:n}){const r=await fetch(n);if(!r.ok)throw new Error(`Failed to download PDF (${r.status})`);if(0===t.size)return void Ky(await r.blob(),e);const[{PDFDocument:o,degrees:i},s]=await Promise.all([hn(()=>import("./index-CKB9C24I.js"),__vite__mapDeps([21,1])),r.arrayBuffer()]),a=await o.load(s);a.getPages().forEach((e,n)=>{const r=t.get(n);r&&e.setRotation(i(((e.getRotation().angle+Wy(r))%360+360)%360))});const l=await a.save(),c=new ArrayBuffer(l.byteLength);new Uint8Array(c).set(l),Ky(new Blob([c],{type:"application/pdf"}),function(e){return e.replace(/\.pdf$/i,"-rotated.pdf")}(e))}({fileName:Zy(s,t),pageRotationDeltas:_,src:t})}catch(e){}finally{A(!1)}}},[s,T,_,t]),oe=Bt.useCallback(e=>{var t;if(!r||!x||W<1)return;const o=x.getStore().getState().core.documents[n],i=(null==o?void 0:o.document)??r,s=Array.from(q.current).filter(e=>i.pages[e]),a=W-1,l=(s.length?s:[a]).filter(e=>i.pages[e]).sort((e,t)=>e-t);if(0===l.length)return;const c=H.current,u=new Map(c),d=W>0&&i.pages[W-1]?W-1:l[0];let h=0;for(const n of l){const t=i.pages[n];if(!t)continue;const r=c.get(n)??0,o=By(r+e),s=z[n]??By(t.rotation),a=By(s+r),l=By(s+o),p=ub({height:t.size.height*Q,rotation:a,width:t.size.width*Q}),g=ub({height:t.size.height*Q,rotation:l,width:t.size.width*Q}).height-p.height;n<d?h+=g:n===d&&(h+=g/2),o?u.set(n,o):u.delete(n)}const p=x.getStore(),g=O.current;H.current=u,ir.flushSync(()=>{N(u),p.dispatchToCore(((e,t)=>({type:vg,payload:{documentId:e,pageIndexes:t}}))(n,l))}),g&&0!==h&&(g.scrollTop+=h),null==(t=null==D?void 0:D.calculateWindowState)||t.call(D,n)},[W,z,Q,n,r,x,D]),ie=Bt.useCallback(e=>{w(e),null==f||f(e)},[f,w]),se=Bt.useCallback(e=>{var t;const o=e.pageNumber,i=z[e.pageIndex]??(null==(t=null==r?void 0:r.pages[e.pageIndex])?void 0:t.rotation)??By(0),s=By(i+(_.get(e.pageIndex)??0));return Ut.jsx(Xf,{documentId:n,pageIndex:e.pageIndex,rotation:s,children:Ut.jsxs(zf,{documentId:n,pageIndex:e.pageIndex,rotation:s,"data-pdf-viewer-page":o,className:Jt("relative border border-transparent bg-transparent shadow-xs select-none selection:bg-transparent selection:text-inherit",null==h?void 0:h(o)),style:{backgroundColor:"transparent"},onPointerDown:e=>null==m?void 0:m(e,o),onPointerMove:e=>null==v?void 0:v(e,o),onPointerUp:e=>null==y?void 0:y(e,o),onPointerCancel:e=>null==b?void 0:b(e,o),children:[Ut.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 bg-white"}),Ut.jsx(Hf,{documentId:n,pageIndex:e.pageIndex,scale:Math.min(Q,1),dpr:1,className:"pointer-events-none absolute inset-0 h-full w-full object-fill opacity-100 blur-[0.35px] transition-none"}),Ut.jsx(Jv,{documentId:n,pageIndex:e.pageIndex,className:"pointer-events-none opacity-100 transition-none [&_img]:opacity-100 [&_img]:transition-none"},`tiles-${e.pageIndex}-${s}`),Ut.jsx(Rm,{documentId:n,pageIndex:e.pageIndex,className:"pointer-events-none",highlightColor:"rgba(253, 224, 71, 0.45)",activeHighlightColor:"rgba(249, 115, 22, 0.55)"}),Ut.jsx(ab,{documentId:n,pageIndex:e.pageIndex,scale:Q}),null==p?void 0:p({pageNumber:o,pageWidth:e.width,pageHeight:e.height,scale:Q,rotation:Wy(s)})]},`${e.pageIndex}-${s}`)})},[z,Q,b,m,v,y,h,_,p,n,r]);return Ut.jsxs("div",{"data-slot":"pdf-viewer",className:Jt("flex h-full max-h-full min-h-0 w-full flex-col overflow-hidden bg-background",i),children:[l?Ut.jsxs("div",{className:"flex min-h-12 flex-wrap items-center justify-between gap-2 border-b bg-background px-3 py-2",children:[Ut.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[Ut.jsx(sr,{children:Ut.jsx(Jy,{label:"Toggle thumbnails",children:Ut.jsx(en,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Toggle thumbnails",disabled:K,onClick:()=>E(e=>!e),children:Ut.jsx(ui,{icon:si,className:"size-4"})})})}),Ut.jsx(tb,{activePage:W,controlsDisabled:K,numPages:G,onPageChange:te})]}),Ut.jsx(sr,{children:Ut.jsxs("div",{className:"flex min-w-0 flex-wrap items-center justify-end gap-1",children:[c?Ut.jsxs(Ut.Fragment,{children:[Ut.jsxs("div",{className:"flex flex-none items-center gap-1",children:[Ut.jsx(Jy,{label:"Rotate counterclockwise",children:Ut.jsx(en,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Rotate counterclockwise",disabled:K,onClick:()=>oe(-1),children:Ut.jsx(ui,{icon:oi,className:"size-4"})})}),Ut.jsx(Jy,{label:"Rotate clockwise",children:Ut.jsx(en,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Rotate clockwise",disabled:K,onClick:()=>oe(1),children:Ut.jsx(ui,{icon:oi,className:"size-4 -scale-x-100"})})})]}),Ut.jsx(go,{orientation:"vertical",className:"mx-1 h-4 self-center"})]}):null,Ut.jsxs("div",{className:"flex flex-none items-center gap-1",children:[Ut.jsx(Jy,{label:"Zoom out",children:Ut.jsx(en,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Zoom out",disabled:K||Q<=qy[0],onClick:()=>{const e=[...qy].reverse().find(e=>e<Q);null==k||k.requestZoom(e??qy[0])},children:Ut.jsx(ui,{icon:ei,className:"size-4"})})}),Ut.jsxs(Dn,{value:String(Q),onValueChange:e=>null==k?void 0:k.requestZoom(Number(e)),disabled:K,children:[Ut.jsx(Mn,{size:"sm",className:"w-[84px] min-w-[84px]",children:Ut.jsxs(En,{placeholder:"Zoom",children:[Math.round(100*Q),"%"]})}),Ut.jsx(Tn,{children:qy.map(e=>Ut.jsxs(An,{value:String(e),children:[Math.round(100*e),"%"]},e))})]}),Ut.jsx(Jy,{label:"Zoom in",children:Ut.jsx(en,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Zoom in",disabled:K||Q>=qy[qy.length-1],onClick:()=>{const e=qy.find(e=>e>Q);null==k||k.requestZoom(e??qy[qy.length-1])},children:Ut.jsx(ui,{icon:ri,className:"size-4"})})})]}),Ut.jsx(go,{orientation:"vertical",className:"mx-1 h-4 self-center"}),Ut.jsx(nb,{documentId:n,controlsDisabled:K},n),d?Ut.jsxs(Ut.Fragment,{children:[Ut.jsx(go,{orientation:"vertical",className:"mx-1 h-4 self-center"}),d]}):null,a||u?Ut.jsxs(Ut.Fragment,{children:[Ut.jsx(go,{orientation:"vertical",className:"mx-1 h-4 self-center"}),Ut.jsx(eb,{downloadDisabled:Y,isPreparingDownload:T,onDownload:re,onUploadFile:ie,showDownload:a,showUpload:u})]}):null]})})]}):null,Ut.jsxs("div",{ref:L,className:"relative flex min-h-0 flex-1 overflow-hidden bg-muted/30",children:[Z?Ut.jsx(Xy,{sidebarInline:F,sidebarOpen:M}):null,Ut.jsxs("div",{className:"flex h-full max-h-full min-h-0 w-full flex-1 overflow-hidden",children:[Ut.jsx(zy,{closedInlineClassName:"-ml-40",inline:F,open:X,widthClassName:Vy,children:X?Ut.jsx(rb,{basePageRotations:z,documentId:n,activePage:W,pageCount:G,pageRotationDeltas:_,pdfDocument:r,selectedPageIndexes:R,onSelectPage:ne}):null}),Ut.jsxs(ib,{documentId:n,className:"relative h-full max-h-full min-h-0 min-w-0 flex-1",children:[Ut.jsx(sb,{viewportElementRef:O}),Ut.jsx(cb,{documentId:n}),Ut.jsx(lb,{documentId:n}),Ut.jsx(jf,{documentId:n,children:Ut.jsx(hb,{basePageRotations:z,documentId:n,pageRotationDeltas:_,renderPage:se})}),Ut.jsx(xv,{})]})]})]})]})}function gb({pdfFile:e,onDocumentLoadSuccess:t,...n}){const{provides:r}=af(),{activeDocumentId:o,activeDocument:i}=(()=>{const e=tf();return Bt.useMemo(()=>
2{if(!e)return{activeDocumentId:null,activeDocument:null};const t=e.activeDocumentId;return{activeDocumentId:t,activeDocument:t?e.documents[t]??null:null}},[e])})(),[s,a]=Bt.useState(!1),l=Bt.useRef(null),c=Bt.useRef(t);Bt.useEffect(()=>{c.current=t}),Bt.useEffect(()=>{if(!r||!e)return;if(l.current===e)return;l.current=e,a(!1);const t=r.getOpenDocuments().map(e=>e.id),n=()=>{l.current===e&&a(!0)};r.openDocumentUrl({url:e,mode:e.startsWith("blob:")?"full-fetch":"auto"}).wait(e=>{e.task.wait(e=>{var n;null==(n=c.current)||n.call(c,e.pageCount),t.forEach(e=>{r.closeDocument(e).wait(()=>{},()=>{})})},n)},n)},[r,e]);const u="loaded"===(null==i?void 0:i.status)?i.document:null,d=s||"error"===(null==i?void 0:i.status);return o&&!d&&e?Ut.jsx(pb,{...n,pdfFile:e,documentId:o,document:u},o):Ut.jsx(Qy,{className:n.className,showToolbar:n.showToolbar,showUpload:n.showUpload,sidebarOpen:!1,state:e?d?"error":"loading":"empty",onUploadFile:e=>{var t;n.onUploadFile(e),null==(t=n.onPdfUpload)||t.call(n,e)}})}const fb=Bt.forwardRef(function({className:e,defaultZoom:t=1,fileName:n,showDownload:r=!0,showRotateControls:o=!0,showToolbar:i=!0,showUpload:s=!0,src:a,toolbarActions:l,pageClassName:c,renderPageOverlay:u,onActivePageChange:d,onDocumentLoadSuccess:h,onPdfUpload:p,onPagePointerDown:g,onPagePointerMove:f,onPagePointerUp:m,onPagePointerCancel:v},y){const{engine:b,error:w}=Uy(),[x,C]=Bt.useState(()=>({src:a,url:null})),S=x.src===a?x.url:null,I=S??a??"";Bt.useEffect(()=>()=>{S&&URL.revokeObjectURL(S)},[S]);const k=Bt.useCallback(e=>{const t=URL.createObjectURL(e);C({src:a,url:t})},[a]),[P]=Bt.useState(()=>[Ng(lf),Ng(yy,{viewportGap:24}),Ng(dm,{defaultPageGap:24,defaultBufferSize:2}),Ng(Of),Ng(Yv,{tileSize:768,overlapPx:2.5,extraRings:0}),Ng(Mf),Ng(Cv,{marquee:{enabled:!1}}),Ng(_m,{showAllResults:!0}),Ng(Rv,{width:108,gap:12,imagePadding:8,labelHeight:24,paddingY:16,buffer:3,autoScroll:!0,scrollBehavior:"auto"}),Ng(Ry,{defaultZoomLevel:t,minZoom:qy[0],maxZoom:qy[qy.length-1]}),Ng(Yf)]);return w?Ut.jsx("div",{"data-slot":"pdf-viewer",className:Jt("grid h-full w-full place-items-center bg-background p-6 text-sm text-muted-foreground",e),children:"Unable to load the PDF engine."}):b?Ut.jsx(Xg,{engine:b,plugins:P,children:Ut.jsx(gb,{viewerRef:y,pdfFile:I,defaultZoom:t,className:e,fileName:n,showDownload:r,showToolbar:i,showRotateControls:o,showUpload:s,toolbarActions:l,pageClassName:c,renderPageOverlay:u,onActivePageChange:d,onDocumentLoadSuccess:h,onPdfUpload:p,onPagePointerDown:g,onPagePointerMove:f,onPagePointerUp:m,onPagePointerCancel:v,onUploadFile:k})}):Ut.jsxs("div",{"data-slot":"pdf-viewer",className:Jt("relative flex h-full max-h-full min-h-0 w-full flex-col overflow-hidden bg-background",e),children:[i?Ut.jsx("div",{className:"min-h-12 border-b bg-background"}):null,Ut.jsx("div",{className:"relative min-h-0 flex-1",children:Ut.jsx(Xy,{sidebarInline:!0,sidebarOpen:!1})})]})}),{entries:mb,setPrototypeOf:vb,isFrozen:yb,getPrototypeOf:bb,getOwnPropertyDescriptor:wb}=Object;let{freeze:xb,seal:Cb,create:Sb}=Object,{apply:Ib,construct:kb}="undefined"!=typeof Reflect&&Reflect;xb||(xb=function(e){return e}),Cb||(Cb=function(e){return e}),Ib||(Ib=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return e.apply(t,r)}),kb||(kb=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)});const Pb=Hb(Array.prototype.forEach),Db=Hb(Array.prototype.lastIndexOf),Mb=Hb(Array.prototype.pop),Eb=Hb(Array.prototype.push),Tb=Hb(Array.prototype.splice),Ab=Hb(String.prototype.toLowerCase),_b=Hb(String.prototype.toString),Nb=Hb(String.prototype.match),Rb=Hb(String.prototype.replace),jb=Hb(String.prototype.indexOf),zb=Hb(String.prototype.trim),Lb=Hb(Object.prototype.hasOwnProperty),$b=Hb(RegExp.prototype.test),Fb=(Ob=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return kb(Ob,t)});var Ob;function Hb(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return Ib(e,t,r)}}function qb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ab;vb&&vb(e,null);let r=t.length;for(;r--;){let o=t[r];if("string"==typeof o){const e=n(o);e!==o&&(yb(t)||(t[r]=e),o=e)}e[o]=!0}return e}function Vb(e){for(let t=0;t<e.length;t++){Lb(e,t)||(e[t]=null)}return e}function Bb(e){const t=Sb(null);for(const[n,r]of mb(e)){Lb(e,n)&&(Array.isArray(r)?t[n]=Vb(r):r&&"object"==typeof r&&r.constructor===Object?t[n]=Bb(r):t[n]=r)}return t}function Ub(e,t){for(;null!==e;){const n=wb(e,t);if(n){if(n.get)return Hb(n.get);if("function"==typeof n.value)return Hb(n.value)}e=bb(e)}return function(){return null}}const Wb=xb(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Gb=xb(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Zb=xb(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Kb=xb(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Yb=xb(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Xb=xb(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Qb=xb(["#text"]),Jb=xb(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","
2spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),ew=xb(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),tw=xb(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),nw=xb(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),rw=Cb(/\{\{[\w\W]*|[\w\W]*\}\}/gm),ow=Cb(/<%[\w\W]*|[\w\W]*%>/gm),iw=Cb(/\$\{[\w\W]*/gm),sw=Cb(/^data-[\-\w.\u00B7-\uFFFF]+$/),aw=Cb(/^aria-[\-\w]+$/),lw=Cb(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),cw=Cb(/^(?:\w+script|data):/i),uw=Cb(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),dw=Cb(/^html$/i),hw=Cb(/^[a-z][.\w]*(-[.\w]+)+$/i);var pw=Object.freeze({__proto__:null,ARIA_ATTR:aw,ATTR_WHITESPACE:uw,CUSTOM_ELEMENT:hw,DATA_ATTR:sw,DOCTYPE_NAME:dw,ERB_EXPR:ow,IS_ALLOWED_URI:lw,IS_SCRIPT_OR_DATA:cw,MUSTACHE_EXPR:rw,TMPLIT_EXPR:iw});const gw=1,fw=3,mw=7,vw=8,yw=9;var bw=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"undefined"==typeof window?null:window;const n=t=>e(t);if(n.version="3.3.3",n.removed=[],!t||!t.document||t.document.nodeType!==yw||!t.Element)return n.isSupported=!1,n;let{document:r}=t;const o=r,i=o.currentScript,{DocumentFragment:s,HTMLTemplateElement:a,Node:l,Element:c,NodeFilter:u,NamedNodeMap:d=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:h,DOMParser:p,trustedTypes:g}=t,f=c.prototype,m=Ub(f,"cloneNode"),v=Ub(f,"remove"),y=Ub(f,"nextSibling"),b=Ub(f,"childNodes"),w=Ub(f,"parentNode");if("function"==typeof a){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let x,C="";const{implementation:S,createNodeIterator:I,createDocumentFragment:k,getElementsByTagName:P}=r,{importNode:D}=o;let M={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof mb&&"function"==typeof w&&S&&void 0!==S.createHTMLDocument;const{MUSTACHE_EXPR:E,ERB_EXPR:T,TMPLIT_EXPR:A,DATA_ATTR:_,ARIA_ATTR:N,IS_SCRIPT_OR_DATA:R,ATTR_WHITESPACE:j,CUSTOM_ELEMENT:z}=pw;let{IS_ALLOWED_URI:L}=pw,$=null;const F=qb({},[...Wb,...Gb,...Zb,...Yb,...Qb]);let O=null;const H=qb({},[...Jb,...ew,...tw,...nw]);let q=Object.seal(Sb(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),V=null,B=null;
vendor: 4,226 bytes, line 2
2const U=Object.seal(Sb(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let W=!0,G=!0,Z=!1,K=!0,Y=!1,X=!0,Q=!1,J=!1,ee=!1,te=!1,ne=!1,re=!1,oe=!0,ie=!1,se=!0,ae=!1,le={},ce=null;const ue=qb({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let de=null;const he=qb({},["audio","video","img","source","image","track"]);let pe=null;const ge=qb({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),fe="http://www.w3.org/1998/Math/MathML",me="http://www.w3.org/2000/svg",ve="http://www.w3.org/1999/xhtml";let ye=ve,be=!1,we=null;const xe=qb({},[fe,me,ve],_b);let Ce=qb({},["mi","mo","mn","ms","mtext"]),Se=qb({},["annotation-xml"]);const Ie=qb({},["title","style","font","a","script"]);let ke=null;const Pe=["application/xhtml+xml","text/html"];let De=null,Me=null;const Ee=r.createElement("form"),Te=function(e){return e instanceof RegExp||e instanceof Function},Ae=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Me||Me!==e){if(e&&"object"==typeof e||(e={}),e=Bb(e),ke=-1===Pe.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,De="application/xhtml+xml"===ke?_b:Ab,$=Lb(e,"ALLOWED_TAGS")?qb({},e.ALLOWED_TAGS,De):F,O=Lb(e,"ALLOWED_ATTR")?qb({},e.ALLOWED_ATTR,De):H,we=Lb(e,"ALLOWED_NAMESPACES")?qb({},e.ALLOWED_NAMESPACES,_b):xe,pe=Lb(e,"ADD_URI_SAFE_ATTR")?qb(Bb(ge),e.ADD_URI_SAFE_ATTR,De):ge,de=Lb(e,"ADD_DATA_URI_TAGS")?qb(Bb(he),e.ADD_DATA_URI_TAGS,De):he,ce=Lb(e,"FORBID_CONTENTS")?qb({},e.FORBID_CONTENTS,De):ue,V=Lb(e,"FORBID_TAGS")?qb({},e.FORBID_TAGS,De):Bb({}),B=Lb(e,"FORBID_ATTR")?qb({},e.FORBID_ATTR,De):Bb({}),le=!!Lb(e,"USE_PROFILES")&&e.USE_PROFILES,W=!1!==e.ALLOW_ARIA_ATTR,G=!1!==e.ALLOW_DATA_ATTR,Z=e.ALLOW_UNKNOWN_PROTOCOLS||!1,K=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Y=e.SAFE_FOR_TEMPLATES||!1,X=!1!==e.SAFE_FOR_XML,Q=e.WHOLE_DOCUMENT||!1,te=e.RETURN_DOM||!1,ne=e.RETURN_DOM_FRAGMENT||!1,re=e.RETURN_TRUSTED_TYPE||!1,ee=e.FORCE_BODY||!1,oe=!1!==e.SANITIZE_DOM,ie=e.SANITIZE_NAMED_PROPS||!1,se=!1!==e.KEEP_CONTENT,ae=e.IN_PLACE||!1,L=e.ALLOWED_URI_REGEXP||lw,ye=e.NAMESPACE||ve,Ce=e.MATHML_TEXT_INTEGRATION_POINTS||Ce,Se=e.HTML_INTEGRATION_POINTS||Se,q=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Te(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(q.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Te(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(q.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(q.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Y&&(G=!1),ne&&(te=!0),le&&($=qb({},Qb),O=Sb(null),!0===le.html&&(qb($,Wb),qb(O,Jb)),!0===le.svg&&(qb($,Gb),qb(O,ew),qb(O,nw)),!0===le.svgFilters&&(qb($,Zb),qb(O,ew),qb(O,nw)),!0===le.mathMl&&(qb($,Yb),qb(O,tw),qb(O,nw))),Lb(e,"ADD_TAGS")||(U.tagCheck=null),Lb(e,"ADD_ATTR")||(U.attributeCheck=null),e.ADD_TAGS&&("function"==typeof e.ADD_TAGS?U.tagCheck=e.ADD_TAGS:($===F&&($=Bb($)),qb($,e.ADD_TAGS,De))),e.ADD_ATTR&&("function"==typeof e.ADD_ATTR?U.attributeCheck=e.ADD_ATTR:(O===H&&(O=Bb(O)),qb(O,e.ADD_ATTR,De))),e.ADD_URI_SAFE_ATTR&&qb(pe,e.ADD_URI_SAFE_ATTR,De),e.FORBID_CONTENTS&&(ce===ue&&(ce=Bb(ce)),qb(ce,e.FORBID_CONTENTS,De)),e.ADD_FORBID_CONTENTS&&(ce===ue&&(ce=Bb(ce)),qb(ce,e.ADD_FORBID_CONTENTS,De)),se&&($["#text"]=!0),Q&&qb($,["html","head","body"]),$.table&&(qb($,["tbody"]),delete V.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw Fb('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw Fb('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');x=e.TRUSTED_TYPES_POLICY,C=x.createHTML("")}else void 0===x&&(x=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;
vendor: 2,293 bytes, line 2
2const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:e=>e,createScriptURL:e=>e})}catch(i){return null}}(g,i)),null!==x&&"string"==typeof C&&(C=x.createHTML(""));xb&&xb(e),Me=e}},_e=qb({},[...Gb,...Zb,...Kb]),Ne=qb({},[...Yb,...Xb]),Re=function(e){Eb(n.removed,{element:e});try{w(e).removeChild(e)}catch(t){v(e)}},je=function(e,t){try{Eb(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(r){Eb(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(te||ne)try{Re(t)}catch(r){}else try{t.setAttribute(e,"")}catch(r){}},ze=function(e){let t=null,n=null;if(ee)e="<remove></remove>"+e;else{const t=Nb(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===ke&&ye===ve&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const o=x?x.createHTML(e):e;if(ye===ve)try{t=(new p).parseFromString(o,ke)}catch(s){}if(!t||!t.documentElement){t=S.createDocument(ye,"template",null);try{t.documentElement.innerHTML=be?C:o}catch(s){}}const i=t.body||t.documentElement;return e&&n&&i.insertBefore(r.createTextNode(n),i.childNodes[0]||null),ye===ve?P.call(t,Q?"html":"body")[0]:Q?t.documentElement:i},Le=function(e){return I.call(e.ownerDocument||e,e,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},$e=function(e){return e instanceof h&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof d)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Fe=function(e){return"function"==typeof l&&e instanceof l};function Oe(e,t,r){Pb(e,e=>{e.call(n,t,r,Me)})}const He=function(e){let t=null;if(Oe(M.beforeSanitizeElements,e,null),$e(e))return Re(e),!0;const r=De(e.nodeName);if(Oe(M.uponSanitizeElement,e,{tagName:r,allowedTags:$}),X&&e.hasChildNodes()&&!Fe(e.firstElementChild)&&$b(/<[/\w!]/g,e.innerHTML)&&$b(/<[/\w!]/g,e.textContent))return Re(e),!0;if(e.nodeType===mw)return Re(e),!0;if(X&&e.nodeType===vw&&$b(/<[/\w]/g,e.data))return Re(e),!0;if(!(U.tagCheck instanceof Function&&U.tagCheck(r))&&(!$[r]||V[r])){if
vendor: 5,648 bytes, line 2
2(!V[r]&&Ve(r)){if(q.tagNameCheck instanceof RegExp&&$b(q.tagNameCheck,r))return!1;if(q.tagNameCheck instanceof Function&&q.tagNameCheck(r))return!1}if(se&&!ce[r]){const t=w(e)||e.parentNode,n=b(e)||e.childNodes;if(n&&t){for(let r=n.length-1;r>=0;--r){const o=m(n[r],!0);o.__removalCount=(e.__removalCount||0)+1,t.insertBefore(o,y(e))}}}return Re(e),!0}return e instanceof c&&!function(e){let t=w(e);t&&t.tagName||(t={namespaceURI:ye,tagName:"template"});const n=Ab(e.tagName),r=Ab(t.tagName);return!!we[e.namespaceURI]&&(e.namespaceURI===me?t.namespaceURI===ve?"svg"===n:t.namespaceURI===fe?"svg"===n&&("annotation-xml"===r||Ce[r]):Boolean(_e[n]):e.namespaceURI===fe?t.namespaceURI===ve?"math"===n:t.namespaceURI===me?"math"===n&&Se[r]:Boolean(Ne[n]):e.namespaceURI===ve?!(t.namespaceURI===me&&!Se[r])&&!(t.namespaceURI===fe&&!Ce[r])&&!Ne[n]&&(Ie[n]||!_e[n]):!("application/xhtml+xml"!==ke||!we[e.namespaceURI]))}(e)?(Re(e),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!$b(/<\/no(script|embed|frames)/i,e.innerHTML)?(Y&&e.nodeType===fw&&(t=e.textContent,Pb([E,T,A],e=>{t=Rb(t,e," ")}),e.textContent!==t&&(Eb(n.removed,{element:e.cloneNode()}),e.textContent=t)),Oe(M.afterSanitizeElements,e,null),!1):(Re(e),!0)},qe=function(e,t,n){if(B[t])return!1;if(oe&&("id"===t||"name"===t)&&(n in r||n in Ee))return!1;if(G&&!B[t]&&$b(_,t));else if(W&&$b(N,t));else if(U.attributeCheck instanceof Function&&U.attributeCheck(t,e));else if(!O[t]||B[t]){if(!(Ve(e)&&(q.tagNameCheck instanceof RegExp&&$b(q.tagNameCheck,e)||q.tagNameCheck instanceof Function&&q.tagNameCheck(e))&&(q.attributeNameCheck instanceof RegExp&&$b(q.attributeNameCheck,t)||q.attributeNameCheck instanceof Function&&q.attributeNameCheck(t,e))||"is"===t&&q.allowCustomizedBuiltInElements&&(q.tagNameCheck instanceof RegExp&&$b(q.tagNameCheck,n)||q.tagNameCheck instanceof Function&&q.tagNameCheck(n))))return!1}else if(pe[t]);else if($b(L,Rb(n,j,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==jb(n,"data:")||!de[e]){if(Z&&!$b(R,Rb(n,j,"")));else if(n)return!1}else;return!0},Ve=function(e){return"annotation-xml"!==e&&Nb(e,z)},Be=function(e){Oe(M.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||$e(e))return;const r={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:O,forceKeepAttr:void 0};let o=t.length;for(;o--;){const s=t[o],{name:a,namespaceURI:l,value:c}=s,u=De(a),d=c;let h="value"===a?d:zb(d);if(r.attrName=u,r.attrValue=h,r.keepAttr=!0,r.forceKeepAttr=void 0,Oe(M.uponSanitizeAttribute,e,r),h=r.attrValue,!ie||"id"!==u&&"name"!==u||(je(a,e),h="user-content-"+h),X&&$b(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,h)){je(a,e);continue}if("attributename"===u&&Nb(h,"href")){je(a,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){je(a,e);continue}if(!K&&$b(/\/>/i,h)){je(a,e);continue}Y&&Pb([E,T,A],e=>{h=Rb(h,e," ")});const p=De(e.nodeName);if(qe(p,u,h)){if(x&&"object"==typeof g&&"function"==typeof g.getAttributeType)if(l);else switch(g.getAttributeType(p,u)){case"TrustedHTML":h=x.createHTML(h);break;case"TrustedScriptURL":h=x.createScriptURL(h)}if(h!==d)try{l?e.setAttributeNS(l,a,h):e.setAttribute(a,h),$e(e)?Re(e):Mb(n.removed)}catch(i){je(a,e)}}else je(a,e)}Oe(M.afterSanitizeAttributes,e,null)},Ue=function e(t){let n=null;const r=Le(t);for(Oe(M.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)Oe(M.uponSanitizeShadowNode,n,null),He(n),Be(n),n.content instanceof s&&e(n.content);Oe(M.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,i=null,a=null,c=null;if(be=!e,be&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Fe(e)){if("function"!=typeof e.toString)throw Fb("toString is not a function");if("string"!=typeof(e=e.toString()))throw Fb("dirty is not a string, aborting")}if(!n.isSupported)return e;if(J||Ae(t),n.removed=[],"string"==typeof e&&(ae=!1),ae){if(e.nodeName){const t=De(e.nodeName);if(!$[t]||V[t])throw Fb("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)r=ze("\x3c!----\x3e"),i=r.ownerDocument.importNode(e,!0),i.nodeType===gw&&"BODY"===i.nodeName||"HTML"===i.nodeName?r=i:r.appendChild(i);else{if(!te&&!Y&&!Q&&-1===e.indexOf("<"))return x&&re?x.createHTML(e):e;if(r=ze(e),!r)return te?null:re?C:""}r&&ee&&Re(r.firstChild);const u=Le(ae?e:r);for(;a=u.nextNode();)He(a),Be(a),a.content instanceof s&&Ue(a.content);if(ae)return e;if(te){if(ne)for(c=k.call(r.ownerDocument);r.firstChild;)c.appendChild(r.firstChild);else c=r;return(O.shadowroot||O.shadowrootmode)&&(c=D.call(o,c,!0)),c}let d=Q?r.outerHTML:r.innerHTML;return Q&&$["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&$b(dw,r.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+d),Y&&Pb([E,T,A],e=>{d=Rb(d,e," ")}),x&&re?x.createHTML(d):d},n.setConfig=function(){Ae(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),J=!0},n.clearConfig=function(){Me=null,J=!1},n.isValidAttribute=function(e,t,n){Me||Ae({});const r=De(e),o=De(t);return qe(r,o,n)},n.addHook=function(e,t){"function"==typeof t&&Eb(M[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=Db(M[e],t);return-1===n?void 0:Tb(M[e],n,1)[0]}return Mb(M[e])},n.removeHooks=function(e){M[e]=[]},n.removeAllHooks=function(){M={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();const ww={assignee:{icon:fr,bgColor:"bg-blue-50 dark:bg-blue-950/30",iconColor:"text-blue-600 dar
2k:text-blue-400",label:"Assignee"},assignedBy:{icon:fr,bgColor:"bg-blue-50 dark:bg-blue-950/30",iconColor:"text-blue-600 dark:text-blue-400",label:"Assigned By"},dueDate:{icon:Cn,bgColor:"bg-purple-50 dark:bg-purple-950/30",iconColor:"text-purple-600 dark:text-purple-400",label:"Due Date"},startDate:{icon:Cn,bgColor:"bg-purple-50 dark:bg-purple-950/30",iconColor:"text-purple-600 dark:text-purple-400",label:"Start Date"},targetDate:{icon:Cn,bgColor:"bg-purple-50 dark:bg-purple-950/30",iconColor:"text-purple-600 dark:text-purple-400",label:"Target Date"},priority:{icon:gr,bgColor:"bg-red-50 dark:bg-red-950/30",iconColor:"text-red-600 dark:text-red-400",label:"Priority"},status:{icon:pr,bgColor:"bg-emerald-50 dark:bg-emerald-950/30",iconColor:"text-emerald-600 dark:text-emerald-400",label:"Status"},workflow:{icon:mr,bgColor:"bg-indigo-50 dark:bg-indigo-950/30",iconColor:"text-indigo-600 dark:text-indigo-400",label:"Workflow"},lead:{icon:fr,bgColor:"bg-blue-50 dark:bg-blue-950/30",iconColor:"text-blue-600 dark:text-blue-400",label:"Lead"},health:{icon:hr,bgColor:"bg-amber-50 dark:bg-amber-950/30",iconColor:"text-amber-600 dark:text-amber-400",label:"Health"}},xw={icon:hr,bgColor:"bg-slate-50 dark:bg-slate-950/30",iconColor:"text-slate-600 dark:text-slate-400",label:""},Cw=e=>ww[e]||{...xw,label:e},Sw=e=>e&&"object"==typeof e?"string"==typeof e.name&&e.name.trim()?e.name:"string"==typeof e.title&&e.title.trim()?e.title:"string"==typeof e.label&&e.label.trim()?e.label:null:null;Bt.memo(({fieldPath:e,hasMultipleUpdates:t})=>{const n=(t?xw:Cw(e)).icon;return Ut.jsx("div",{className:"p-1 text-muted-foreground",children:Ut.jsx(n,{className:"h-3.5 w-3.5"})})}).displayName="FieldIcon";const Iw=Bt.memo(({activity:e,index:t,hasMultipleUpdates:n,updateEntries:r,getMemberName:o,collaborators:i})=>{var s,a,l,c,u;const d=Bt.useMemo(()=>(e,t)=>{if(null==t||""===t)return"N/A";if("workflow"===e)return Sw(t)||("string"==typeof t?t:"updated");if(["dueDate","startDate","targetDate"].includes(e))return bn(t,"relative")||"N/A";if("assignee"===e||"lead"===e||"assignedBy"===e){const e=(e=>e?"string"==typeof e?e:"object"!=typeof e?null:e.user||e.member_id||e._id||null:null)(t);if(e){const t=o(e);if(t&&"Someone"!==t)return t}return Sw(t)||"Unassigned"}if("priority"===e)return ur(t)||"N/A";if("status"===e||"health"===e)return"string"==typeof t?wn(t):String(t);if("progress"===e&&"number"==typeof t)return`${Math.round(t)}%`;if("progress"===e&&"string"==typeof t){const e=Number(t);return Number.isNaN(e)?t:`${Math.round(e)}%`}return"description"===e&&"string"==typeof t?bw.sanitize(t,{ALLOWED_TAGS:[],ALLOWED_ATTR:[]}).trim()||"N/A":"object"==typeof t?Sw(t)||"new value":String(t)||"N/A"},[o]),h=null==(s=e.updates)?void 0:s.auditEventType;if(h){const n="user"===String((null==(a=e.updates)?void 0:a.eventSource)??"").toLowerCase(),r=n?e.updatedBy||"Someone":"Truco",s=n?(null==(l=null==i?void 0:i.find)?void 0:l.call(i,e=>e.member_id===r))??null:null,u=null==(p=null==(c=e.updates)?void 0:c.valueAfter)||""===p?"Empty":"string"==typeof p?p:"number"==typeof p||"boolean"==typeof p?String(p):"object"==typeof p?Sw(p)||"new value":String(p),d=n?o(r):r,g=n&&"Someone"!==d?d:r,f=["edited","proposed"].includes(String(h).toLowerCase()),m=s??{name:g};return Ut.jsx("div",{className:"space-y-1 pr-4",children:Ut.jsx("div",{className:"relative py-1 border-b border-border/60 last:border-b-0",style:{animationDelay:50*t+"ms"},children:Ut.jsx("div",{className:"group relative flex items-center gap-1.5",children:Ut.jsx("div",{className:"flex-1 space-y-1 min-w-0",children:Ut.jsx("div",{className:"flex items-start justify-between gap-4",children:Ut.jsxs("div",{className:"text-sm leading-relaxed text-muted-foreground min-w-0 flex-1",children:[Ut.jsxs("span",{className:"inline-flex items-center gap-1 align-middle text-foreground",children:[Ut.jsx(dr,{collaborator:m,className:"h-4 w-4"}),Ut.jsx("span",{className:"font-medium text-xs leading-snug",children:g})]})," ","approved"===String(h).toLowerCase()?"approved":wn(h).toLowerCase(),f?Ut.jsxs(Ut.Fragment,{children:[" ",Ut.jsx("span",{className:"inline-flex items-center rounded px-1 py-px text-xs bg-muted text-foreground
2/80 max-w-md min-w-0 truncate align-middle",children:Ut.jsx("span",{className:"truncate",children:u})})]}):null,Ut.jsx("span",{className:"ml-2 text-xs text-muted-foreground whitespace-nowrap",children:bn(e.updatedAt??e.createdAt)})]})})})})},e._id||t)})}var p;const g=(null==(u=null==i?void 0:i.find)?void 0:u.call(i,t=>t.member_id===e.updatedBy))??null;return Ut.jsx("div",{className:"space-y-1 pr-4",children:Ut.jsx("div",{className:"relative py-1 border-b border-border/60 last:border-b-0",style:{animationDelay:50*t+"ms"},children:Ut.jsxs("div",{className:"group relative flex items-center gap-1.5",children:[Ut.jsx(dr,{collaborator:g,className:"h-4 w-4"}),Ut.jsx("div",{className:"flex-1 space-y-1 min-w-0",children:Ut.jsx("div",{className:"flex items-start gap-1.5",children:Ut.jsx("div",{className:"flex-1 min-w-0",children:Ut.jsx("div",{className:"flex items-start justify-between gap-4",children:Ut.jsxs("div",{className:"text-sm leading-relaxed text-muted-foreground min-w-0 flex-1",children:[Ut.jsx("span",{className:"font-medium text-foreground text-xs leading-snug",children:o(e.updatedBy)||"Someone"})," ",n?"updated multiple fields:":`changed ${Cw(r[0][0]).label.toLowerCase()} to`,n?Ut.jsx("span",{className:"ml-2 inline-flex items-center gap-1 overflow-hidden whitespace-nowrap align-middle",children:r.map(([e,t],n)=>{const o=Cw(e);return Ut.jsxs("span",{className:"inline-flex items-center gap-1",children:[Ut.jsxs("span",{className:"text-foreground",children:[o.label,":"]}),Ut.jsx("span",{className:"inline-flex items-center rounded px-1 py-px text-xs bg-muted text-foreground/80 max-w-md min-w-0 truncate",children:Ut.jsx("span",{className:"truncate",children:d(e,t)||"N/A"})}),n<r.length-1&&Ut.jsx("span",{className:"text-muted-foreground",children:","})]},n)})}):Ut.jsxs(Ut.Fragment,{children:[" ",Ut.jsx("span",{className:"inline-flex items-center rounded px-1 py-px text-xs bg-muted text-foreground/80 max-w-md min-w-0 truncate",children:Ut.jsx("span",{className:"truncate",children:d(r[0][0],r[0][1])||"N/A"})})]}),Ut.jsx("span",{className:"ml-2 text-xs text-muted-foreground whitespace-nowrap",children:bn(e.createdAt)})]})})})})})]})},e._id||t)})});Iw.displayName="ActivityRenderer";export{Iw as A,fp as B,ro as C,vp as E,vh as F,Dp as N,fb as P,go as S,No as T,mr as W,Cy as Z,Ro as a,jo as b,zo as c,oo as d,io as e,so as f,ao as g,lo as h,Bo as i,jp as j,Hp as k,Bp as l,Jp as m,dp as n,th as o,np as p,gr as q,tp as r,Qp as s,Vo as t,yp as u,cp as v,up as w,hp as x,gp as y,pp as z};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.