@fungi.computer/prints 0.18.0 → 0.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/audio-waveform-Be5wRu8s.js +1 -0
- package/dist/assets/audio-waveform-view-DbTyVH72.js +1 -0
- package/dist/assets/button-oE2Hrd5D.js +83 -0
- package/dist/assets/computer-Bfe-Ioxr.js +1 -0
- package/dist/assets/dialog-BXLOuKaF.js +1 -0
- package/dist/assets/dist-DAokFn5x.js +1 -0
- package/dist/assets/dropdown-menu-CAHLGfkb.js +1 -0
- package/dist/assets/ellipsis-DlNHenkt.js +1 -0
- package/dist/assets/generation-quote-DcaCSlvV.js +2 -0
- package/dist/assets/heart-BquDo4lf.js +1 -0
- package/dist/assets/images-CQ3EhUoY.js +1 -0
- package/dist/assets/index-D-LwJiG1.js +2 -0
- package/dist/assets/keycap-D2RkH2IS.js +1 -0
- package/dist/assets/library-rail-DVjIWa9C.js +1266 -0
- package/dist/assets/library-view-BBAeJjj6.js +1 -0
- package/dist/assets/log-event-B3BGsDWO.js +1 -0
- package/dist/assets/{print-download-button-CwK9wdo2.js → print-download-button-BNNi_aoW.js} +2 -2
- package/dist/assets/print-info-drawer-DDZan_oj.js +2 -0
- package/dist/assets/print-viewer-D7p4Tznx.js +2 -0
- package/dist/assets/prints-folder-dialog--W4H7Jx6.js +1 -0
- package/dist/assets/query-CYqgVHJ7.js +1 -0
- package/dist/assets/status-DNJRO5m5.js +1 -0
- package/dist/assets/textarea-LIOZDOK4.js +1 -0
- package/dist/assets/upload-queue-BHAaEiPu.js +1 -0
- package/dist/assets/useMutation-DH-cbXIA.js +1 -0
- package/dist/assets/useTriggerFocusGuards-Bddw7Qdn.js +1 -0
- package/dist/index.html +20 -4
- package/package.json +7 -7
- package/dist/assets/generation-quote-D7I39kF2.js +0 -2
- package/dist/assets/index-C0hNF6s0.js +0 -1267
- package/dist/assets/local-images-B-ZLs6V_.js +0 -1
- package/dist/assets/log-event-BpFScFqd.js +0 -83
- package/dist/assets/print-info-drawer-B1PQWwH2.js +0 -2
|
@@ -1,1267 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./print-download-button-CwK9wdo2.js","./rolldown-runtime-hePW80VL.js","./log-event-BpFScFqd.js","./modules-C4mfDnjH.js","./local-images-B-ZLs6V_.js","./print-info-drawer-B1PQWwH2.js","./generation-quote-D7I39kF2.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{$ as n,$n as r,$r as i,$t as a,A as o,Ar as s,At as c,B as l,Bn as u,Br as d,C as f,Cn as p,Cr as m,Ct as h,Dn as g,Dr as _,Dt as v,E as y,En as b,Er as x,Et as S,F as C,Fn as w,Fr as T,G as E,Gn as D,Gr as O,H as k,Hn as A,Hr as j,I as M,Ir as N,J as P,Jn as F,Jr as I,K as ee,Kn as te,Kr as ne,L as re,Ln as L,Lr as R,M as ie,Mn as ae,Mr as oe,Mt as se,N as ce,Nn as z,Nr as le,O as B,On as ue,Or as de,Ot as fe,P as V,Pn as pe,Pr as me,Q as he,Qn as ge,Qr as _e,R as ve,Rn as ye,Rr as be,S as xe,Sn as Se,Sr as Ce,St as we,T as Te,Tn as Ee,Tr as De,Tt as Oe,U as ke,Un as Ae,V as je,Vr as Me,Vt as Ne,W as Pe,Wn as Fe,Wr as Ie,X as Le,Xn as Re,Y as ze,Yn as Be,Yr as Ve,Z as He,Zn as Ue,Zr as H,_ as U,_i as We,_n as Ge,_r as Ke,_t as qe,a as Je,ai as Ye,ar as Xe,at as Ze,b as Qe,bn as $e,br as et,bt as tt,c as nt,cr as rt,ct as it,d as at,dn as ot,dr as st,dt as ct,ei as W,er as lt,et as ut,f as dt,fn as G,ft,g as pt,gn as mt,gr as ht,gt,h as _t,hn as vt,ht as yt,i as bt,ii as xt,in as St,ir as Ct,it as wt,j as Tt,jn as Et,jr as Dt,jt as Ot,kn as kt,kr as At,kt as jt,ln as Mt,lr as Nt,lt as Pt,m as Ft,mn as It,mt as Lt,ni as Rt,nn as zt,nr as Bt,nt as Vt,or as Ht,ot as Ut,p as Wt,pn as Gt,pt as Kt,q as qt,qr as Jt,r as Yt,ri as Xt,rr as Zt,rt as Qt,sr as $t,st as en,t as tn,ti as K,tr as nn,tt as rn,u as an,un as on,ur as sn,ut as cn,v as ln,vn as un,vr as dn,vt as fn,wn as pn,wr as mn,wt as hn,x as gn,xn as _n,xr as vn,xt as yn,yn as bn,yr as xn,yt as Sn,z as Cn,zn as wn,zr as Tn,zt as En}from"./log-event-BpFScFqd.js";import{$ as Dn,$t as On,An as kn,At as An,B as jn,Bt as Mn,C as Nn,Cn as Pn,Ct as Fn,D as In,Dn as Ln,Dt as Rn,E as zn,En as Bn,Et as Vn,F as Hn,Ft as Un,G as Wn,Gt as Gn,H as Kn,Ht as qn,I as Jn,It as Yn,J as Xn,Jt as Zn,K as Qn,Kt as $n,L as er,Lt as tr,M as nr,Mt as rr,N as ir,Nt as ar,O as or,On as sr,Ot as cr,P as lr,Pt as ur,Q as dr,Qt as fr,R as pr,Rt as mr,S as hr,Sn as gr,St as _r,T as vr,Tn as yr,Tt as br,U as xr,Ut as Sr,V as Cr,Vt as wr,W as Tr,Wt as Er,X as Dr,Xt as Or,Y as kr,Yt as Ar,Z as jr,Zt as Mr,_ as Nr,_n as Pr,_t as Fr,a as Ir,an as Lr,at as Rr,b as zr,bn as Br,bt as Vr,c as Hr,cn as Ur,ct as Wr,d as Gr,dn as Kr,dt as qr,en as Jr,et as Yr,f as Xr,fn as Zr,ft as Qr,gn as $r,gt as ei,h as ti,hn as ni,ht as ri,i as ii,in as ai,j as oi,jt as si,k as ci,kn as li,kt as ui,l as di,ln as fi,m as pi,mn as mi,mt as hi,n as gi,nn as _i,nt as vi,o as yi,on as bi,ot as xi,p as Si,pn as Ci,pt as wi,q as Ti,qt as Ei,rn as Di,s as Oi,sn as ki,st as Ai,t as ji,tn as Mi,tt as Ni,u as Pi,un as Fi,ut as Ii,vn as Li,vt as Ri,w as zi,wn as Bi,wt as Vi,x as Hi,xn as Ui,xt as Wi,y as Gi,yn as Ki,yt as qi,z as Ji,zt as Yi}from"./generation-quote-D7I39kF2.js";import{$ as Xi,A as Zi,At as Qi,B as $i,Bt as ea,C as ta,D as na,Dt as ra,E as ia,F as aa,Ft as oa,G as sa,H as ca,Ht as la,I as ua,J as da,K as fa,L as pa,M as ma,Mt as ha,N as ga,Nt as _a,O as va,Ot as ya,P as ba,Pt as xa,Q as Sa,R as Ca,S as wa,T as Ta,Tt as Ea,U as Da,Ut as Oa,V as ka,Vt as Aa,W as ja,Wt as Ma,X as Na,Y as Pa,Z as Fa,_ as Ia,_t as La,a as Ra,at as za,b as Ba,bt as Va,c as Ha,ct as Ua,d as Wa,dt as Ga,et as Ka,f as qa,ft as Ja,g as Ya,gt as Xa,h as Za,ht as Qa,i as $a,it as eo,j as to,jt as no,k as ro,kt as io,l as ao,lt as oo,m as so,mt as co,n as lo,nt as uo,o as fo,ot as po,p as mo,pt as ho,q as go,r as _o,rt as vo,s as yo,st as bo,t as xo,tt as So,u as Co,ut as wo,v as To,vt as Eo,w as Do,wt as Oo,x as ko,xt as Ao,y as jo,yt as Mo,z as No}from"./local-images-B-ZLs6V_.js";import{r as Po}from"./modules-C4mfDnjH.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var q=e(We(),1),Fo=class extends Error{code;details;constructor(e,t,n){super(t),this.code=e,this.details=n,this.name=`WhistleActionError`}},Io=class extends Error{constructor(){super(`Whistle runtime is closed`),this.name=`WhistleClosedError`}};function Lo(){let e=!1,t=gs,n=[],r=[],i=!1,a=[],o=new Set,s=()=>{for(let e of o)e()};return Object.freeze({close:()=>{e||(e=!0,n=[],a=[],r=[],t=gs,s(),o.clear())},contribute:t=>{if(Ko(t),e)throw new Io;qo(t,n),Jo(t,n);let r=Symbol(`whistle-contribution`);Go(t)||(n=[...n,{contribution:Yo(t),generation:r}],i=!0,s());let a=!0;return ms(o=>{if(!a||e)return;let c={...t,commands:o};Ko(c);let l=n.findIndex(e=>e.generation===r),u=n.filter(e=>e.generation!==r);qo(c,u),Jo(c,u);let d=Yo(c);if(Go(c)){if(l<0)return;n=u}else n=l<0?[...n,{contribution:d,generation:r}]:n.map(e=>e.generation===r?{contribution:d,generation:r}:e);i=!0,s()},()=>{a&&(a=!1,n.find(e=>e.generation===r)!==void 0&&(n=n.filter(e=>e.generation!==r),i=!0,s()))})},execute:async(t,r)=>{if(t.namespace.trim().length===0||t.id.trim().length===0)return{status:`invalid`};if(e)return{status:`closed`};let i=Wo(t,n);if(i===void 0)return{status:`missing`};let o;try{let e=vs(i);if(e.status===`unavailable`)return e;let n=a.at(-1)?.presenter;r.interaction===void 0&&n!==void 0&&Ro.has(r.origin)&&(o=n({commandId:Uo(t.namespace,t.id),title:i.title}));let s={...r,signal:r.signal??new AbortController().signal};o!==void 0&&(s.interaction=o.interaction,s.signal=AbortSignal.any([s.signal,o.interaction.signal]));let c=await i.handler(s);return o?.settle({status:`handled`}),c===void 0?{status:`handled`}:{status:`handled`,result:c}}catch(e){let t=bs(e instanceof Error?e:Error(`Command handler threw a non-Error value`));return o?.settle(o.interaction.signal.aborted?{status:`cancelled`}:{status:`failed`,message:t.message}),{status:`failed`,error:t}}},present:t=>{let n={presenter:t};return e||(a=[...a,n]),()=>{a=a.filter(e=>e!==n)}},snapshot:()=>{if(e)return gs;let a=n.flatMap(e=>e.contribution.commands.map(vs));return(i||a.some((e,t)=>!ys(e,r[t])))&&(t=xs(n,a),r=a,i=!1),t},subscribe:t=>e?()=>void 0:(o.add(t),()=>{o.delete(t)})})}var Ro=new Set([`browser`,`keyboard`,`menu`,`palette`,`slash`,`terminal`]),zo=16,Bo=32,Vo=64,Ho=256;function Uo(e,t){return x.parse(`${e}:${t}`)}function Wo(e,t){for(let n of t)if(n.contribution.namespace===e.namespace){for(let t of n.contribution.commands)if(t.id===e.id)return t}}function Go(e){return e.commands.length===0}function Ko(e){fs(e.sourceId,`source ID`),fs(e.namespace,`namespace`),e.scope!==void 0&&fs(e.scope,`scope`);for(let t of e.commands)ss(t)}function qo(e,t){t.find(t=>t.contribution.namespace===e.namespace&&t.contribution.sourceId!==e.sourceId)!==void 0&&hs(`Namespace is already owned by another source`);let n=new Set,r=new Set;for(let i of t){let t=i.contribution.scope===e.scope;for(let e of i.contribution.commands)if(n.add(Uo(i.contribution.namespace,e.id)),t)for(let t of e.projections?.slash?.aliases??[])r.add(t)}for(let t of e.commands){let i=Uo(e.namespace,t.id);n.has(i)&&hs(`Canonical command ID is already registered`),n.add(i);for(let e of t.projections?.slash?.aliases??[])r.has(e)&&hs(`Slash alias is already registered`),r.add(e)}}function Jo(e,t){t.length>=Vo&&hs(`Live contribution capacity exceeded`),t.reduce((e,t)=>e+t.contribution.commands.length,0)+e.commands.length>Ho&&hs(`Live command capacity exceeded`)}function Yo(e){let t={sourceId:e.sourceId,namespace:e.namespace,commands:e.commands.map(Xo)};return e.scope===void 0?t:{...t,scope:e.scope}}function Xo(e){let t={id:e.id,title:e.title,category:e.category,handler:e.handler};return e.description!==void 0&&(t.description=e.description),e.action!==void 0&&(t.action=Zo(e.action)),e.availability!==void 0&&(t.availability=e.availability),e.projections!==void 0&&(t.projections=ts(e.projections)),t}function Zo(e){let t={};return e.inputSchema!==void 0&&(t.inputSchema=Qo(e.inputSchema)),e.outputSchema!==void 0&&(t.outputSchema=Qo(e.outputSchema)),e.presentation!==void 0&&(t.presentation=es(e.presentation)),Object.freeze(t)}function Qo(e){return Object.freeze(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,$o(t)])))}function $o(e){return Array.isArray(e)?Object.freeze(e.map($o)):e!==null&&e instanceof Object?Object.freeze(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,$o(t)]))):e}function es(e){switch(e.type){case`action`:return Object.freeze({type:`action`});case`custom`:return Object.freeze({type:`custom`,data:Qo(e.data)});case`choice`:return Object.freeze({type:`choice`,options:Object.freeze(e.options.map(e=>Object.freeze({...e,value:$o(e.value)})))});case`form`:return Object.freeze({...e});case`confirmation`:return Object.freeze({...e})}}function ts(e){let t={};return e.bindings!==void 0&&(t.bindings=ns(e.bindings)),e.agent!==void 0&&(t.agent=rs(e.agent)),e.help!==void 0&&(t.help=is(e.help.order)),e.menu!==void 0&&(t.menu=is(e.menu.order)),e.palette!==void 0&&(t.palette=is(e.palette.order)),e.slash!==void 0&&(t.slash=as(e.slash)),t}function ns(e){let t={values:[...e.values]};return e.order!==void 0&&(t.order=e.order),t}function rs(e){let t={};return e.keybind!==void 0&&(t.keybind=e.keybind),e.order!==void 0&&(t.order=e.order),t}function is(e){let t={};return e!==void 0&&(t.order=e),t}function as(e){let t={aliases:[...e.aliases]};return e.order!==void 0&&(t.order=e.order),e.consumesDraft!==void 0&&(t.consumesDraft=e.consumesDraft),e.arguments!==void 0&&(t.arguments=os(e.arguments)),t}function os(e){let t={hint:e.hint};return e.words!==void 0&&(t.words=Object.freeze(e.words.map(e=>Object.freeze({...e,arguments:Qo(e.arguments)})))),e.text!==void 0&&(t.text=Object.freeze({...e.text,arguments:Qo(e.text.arguments)})),Object.freeze(t)}function ss(e){fs(e.id,`command ID`,!0),fs(e.title,`title`),fs(e.category,`category`),cs(e.action),ls(e.projections)}function cs(e){if(e?.presentation!==void 0)switch(e.presentation.type){case`action`:case`custom`:return;case`choice`:for(let t of e.presentation.options)fs(t.label,`choice label`),t.description!==void 0&&fs(t.description,`choice description`);return;case`form`:e.presentation.submitLabel!==void 0&&fs(e.presentation.submitLabel,`submit label`);return;case`confirmation`:fs(e.presentation.message,`confirmation message`),e.presentation.confirmLabel!==void 0&&fs(e.presentation.confirmLabel,`confirmation label`),e.presentation.cancelLabel!==void 0&&fs(e.presentation.cancelLabel,`cancellation label`)}}function ls(e){if(e!==void 0){for(let t of[e.bindings,e.palette,e.slash,e.help,e.menu,e.agent])t!==void 0&&ps(t.order);if(e.bindings!==void 0&&ds(e.bindings.values,`binding`),e.slash!==void 0){ds(e.slash.aliases,`slash alias`);for(let t of e.slash.aliases)/\s/u.test(t)&&hs(`slash alias must not contain whitespace`);us(e.slash.arguments)}e.agent?.keybind!==void 0&&fs(e.agent.keybind,`agent keybind`)}}function us(e){if(e===void 0)return;fs(e.hint,`argument hint`),e.words===void 0&&e.text===void 0&&hs(`slash arguments need words or text`);let t=new Set;for(let n of e.words??[])fs(n.word,`argument word`),/\s/u.test(n.word)&&hs(`argument word must not contain whitespace`),t.has(n.word)&&hs(`argument word is repeated`),t.add(n.word),n.description!==void 0&&fs(n.description,`argument word description`);t.size>Bo&&hs(`argument word count exceeds 32`),e.text!==void 0&&(fs(e.text.field,`argument text field`),e.text.requestIdField!==void 0&&fs(e.text.requestIdField,`request id field`))}function ds(e,t){e.length>zo&&hs(`${t} count exceeds 16`);for(let n of e)fs(n,t)}function fs(e,t,n=!1){e.trim().length===0&&hs(`${t} must not be blank`),n&&e.includes(`:`)&&hs(`${t} must not contain a colon`)}function ps(e){e!==void 0&&!Number.isSafeInteger(e)&&hs(`order must be a safe integer`)}function ms(e=()=>void 0,t=()=>void 0){return Object.freeze({update:e,dispose:t})}function hs(e){throw Error(e)}var gs=Object.freeze({bindings:Object.freeze([]),palette:Object.freeze([]),slash:Object.freeze([]),help:Object.freeze([]),menu:Object.freeze([]),agent:Object.freeze([])}),_s=Object.freeze({status:`available`});function vs(e){let t=e.availability?.()??_s;return t.status===`available`?_s:Object.freeze({status:`unavailable`,reason:t.reason})}function ys(e,t){return e.status===`available`?t?.status===`available`:t?.status===`unavailable`&&e.reason===t.reason}function bs(e){if(e instanceof Fo){let t={code:e.code,message:e.message};return Object.freeze(e.details===void 0?t:{...t,details:$o(e.details)})}return Object.freeze({code:`command_failed`,message:e.message})}function xs(e,t){let n=[],r=[],i=[],a=[],o=[],s=[],c=0;for(let l of e){let e=l.contribution;for(let l of e.commands){let u=l.projections,d=t[c++]??_s;if(u?.bindings!==void 0)for(let t of u.bindings.values)n.push({...Os(e,l,u.bindings.order,d),binding:t});if(u?.palette!==void 0&&r.push({...Os(e,l,u.palette.order,d)}),u?.slash!==void 0)for(let t of u.slash.aliases){let n={...Os(e,l,u.slash.order,d),alias:t};u.slash.consumesDraft!==void 0&&(n={...n,consumesDraft:u.slash.consumesDraft}),u.slash.arguments!==void 0&&(n={...n,arguments:u.slash.arguments}),i.push(n)}u?.help!==void 0&&a.push({...Os(e,l,u.help.order,d)}),u?.menu!==void 0&&o.push({...Os(e,l,u.menu.order,d)}),u?.agent!==void 0&&s.push(As(e,l,u.agent,d))}}return Ts(n),Es(i),ws(r),ws(a),ws(o),ws(s),Object.freeze({bindings:Ds(n),palette:Ds(r),slash:Ds(i),help:Ds(a),menu:Ds(o),agent:Ds(s)})}var Ss=new TextEncoder;function Cs(e,t){let n=Ss.encode(e),r=Ss.encode(t),i=Math.min(n.length,r.length);for(let e=0;e<i;e+=1){let t=n[e]??0,i=r[e]??0;if(t!==i)return t<i?-1:1}return n.length<r.length?-1:+(n.length>r.length)}function ws(e){e.sort((e,t)=>e.order-t.order||Cs(e.commandId,t.commandId))}function Ts(e){e.sort((e,t)=>e.order-t.order||Cs(e.commandId,t.commandId)||Cs(e.binding,t.binding))}function Es(e){e.sort((e,t)=>e.order-t.order||Cs(e.commandId,t.commandId)||Cs(e.alias,t.alias))}function Ds(e){return Object.freeze(e.map(e=>Object.freeze(e)))}function Os(e,t,n,r){let i=ks(e,t,n,r);return e.scope===void 0?i:{...i,scope:e.scope}}function ks(e,t,n,r){let i={commandId:Uo(e.namespace,t.id),command:Object.freeze({namespace:e.namespace,id:t.id}),sourceId:e.sourceId,title:t.title,category:t.category,order:n??0,availability:r},a=t.description===void 0?i:{...i,description:t.description};return t.action===void 0?a:{...a,action:t.action}}function As(e,t,n,r){let i=Os(e,t,n.order,r),a=i.action===void 0?i:{...i,action:js(i.action)};return n.keybind===void 0?a:{...a,keybind:n.keybind}}function js(e){let t={};return e.inputSchema!==void 0&&(t.inputSchema=e.inputSchema),e.outputSchema!==void 0&&(t.outputSchema=e.outputSchema),Object.freeze(t)}var Ms=new WeakMap;function Ns(e,t){let n=!1,r=[];for(let i of t){let{availability:t,handler:a,...o}=i,s=a,c=t===void 0?o:{...o,availability:t()},l=Ms.get(e)??new Map;Ms.set(e,l);let u=l.get(i.id),d=()=>e.register(c,async({arguments:e,origin:t,signal:n})=>{let r=await s(e===void 0?{origin:t,signal:n}:{arguments:e,origin:t,signal:n});return r===void 0?void 0:de(r)}),f=(u?u.then(d):d()).then(e=>{n?e():r.push(e)},e=>{console.warn(`App command ${i.id} was not registered`,e)});l.set(i.id,f),f.finally(()=>{l.get(i.id)===f&&l.delete(i.id)})}return()=>{if(!n){n=!0;for(let e of r.splice(0))e()}}}j(`light.dark.latte.mocha.readout.readout-night.field-guide.field-guide-night.embed.embed-dark.phosphor.codec.paper.ember.tide.tape.sunrise.pirate-radio.pirate-radio-night.consulting.consulting-ink.consulting-night.consulting-night-ink.consulting-riso-latte.consulting-riso-latte-ink.consulting-riso-glomzy.consulting-riso-glomzy-ink.vishnu.coin.coin-night.chamfer`.split(`.`));var Ps=`data-theme`;function Fs(e){return e||(globalThis.document?.documentElement??null)}function Is(e){let t=e.trim();if(t.length===0)throw TypeError(`Theme must be a non-empty string`);return t}function Ls(e,t){let n=Is(e),r=Fs(t);r&&r.setAttribute(Ps,n)}function Rs(e){return Fs(e)?.getAttribute(Ps)??null}var zs=class extends sr{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:li(t,n.data),hasPreviousPage:kn(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}};function Bs(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var Vs=class extends Ne{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,En.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!St(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Bs(e,n).forEach(e=>{e.destroy()}),Bs(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){let n=new Set;return t.map((r,i)=>{let a=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?a:r.observer.trackResult(a,e=>{n.has(e)||(n.add(e),t.forEach(t=>{t.observer.trackProp(e)}))})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=zt(this.#a,t(e))),this.#a}return e}#f(){return!this.#r?.combine||this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new sr(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=this.#t.slice(),this.#t[n]=t,this.#h())}#h(){if(this.hasListeners()){let e=this.#f(),t=this.#a,n=e?t:this.#d(this.#u(this.#t,this.#l),this.#r?.combine);(e||t!==n)&&En.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}};function Hs({queries:e,...t},n){let r=on(n),i=Ln(),o=Bn(),s=t.subscribed!==!1,c=q.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:s?`optimistic`:void 0,t}),[e,r,i,s]);c.forEach(e=>{Br(e);let t=r.getQueryCache().get(e.queryHash);Pn(e,o,t)}),yr(o);let[l]=q.useState(()=>new Vs(r,c,t)),[u,d,f]=l.getOptimisticResult(c,t.combine),p=!i&&s;q.useSyncExternalStore(q.useCallback(e=>p?l.subscribe(En.batchCalls(e)):a,[l,p]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),q.useEffect(()=>{l.setQueries(c,t)},[c,t,l]);let m=u.some((e,t)=>gr(c[t],e))?u.flatMap((e,t)=>{let n=c[t];if(n&&gr(n,e)){let e=new sr(r,n);return Ui(n,e,o)}return[]}):[];if(m.length>0)throw Promise.all(m);let h=u.find((e,t)=>{let n=c[t];return n&&Bi({result:e,errorResetBoundary:o,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(h)throw h.error;return d(f())}function Us(e){return e}function Ws(e,t){return e.findAll(t.filters).map(e=>t.select?t.select(e):e.state)}function Gs(e={},t){let n=on(t).getMutationCache(),r=q.useRef(e),i=q.useRef(null);return i.current===null&&(i.current=Ws(n,e)),q.useEffect(()=>{r.current=e}),q.useSyncExternalStore(q.useCallback(e=>n.subscribe(()=>{let t=zt(i.current,Ws(n,r.current));i.current!==t&&(i.current=t,En.schedule(e))}),[n]),()=>i.current,()=>i.current)}function Ks(e,t){return Ki(e,zs,t)}var qs=t((e=>{var t=Ot();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot}))();function Js(e){let t=e.trim().toLowerCase();if(!t)throw Error(`Invalid keymap token: token cannot be empty`);return t}function Ys(e){let t=e.trim().toLowerCase();if(!t)throw Error(`Invalid key name: key name cannot be empty`);return t}function Xs(e){return{name:Ys(e.name),ctrl:e.ctrl??!1,shift:e.shift??!1,meta:e.meta??!1,super:e.super??!1,hyper:e.hyper||void 0}}function Zs(e){return{name:e.name,ctrl:e.ctrl,shift:e.shift,meta:e.meta,super:e.super,hyper:e.hyper||void 0}}function Qs(e,t){let n=Zs(Xs(e));return{stroke:n,display:t?.display??oc(n),match:t?.match??nc(n),tokenName:t?.tokenName?Js(t.tokenName):void 0}}function $s(e){return{stroke:Zs(e.stroke),display:e.display,match:e.match,tokenName:e.tokenName,patternName:e.patternName,payloadKey:e.payloadKey}}function ec(e){return e.map(e=>$s(e))}function tc(e){return`match`in e?e.match:`stroke`in e?nc(e.stroke):nc(e)}function nc(e){return`key:${sc(Xs(e))}`}function rc(e){let t=e.trim();if(!t)throw Error(`Invalid keymap match id: id cannot be empty`);return`text:${t}`}function ic(e,t){return`stroke`in e?t?.preferDisplay&&e.display?e.display:oc(e.stroke):oc(Xs(e))}function ac(e,t){return e.map(e=>ic(e,t)).join(t?.separator??``)}function oc(e){let t=[];return e.ctrl&&t.push(`ctrl`),e.shift&&t.push(`shift`),e.meta&&t.push(`meta`),e.super&&t.push(`super`),e.hyper&&t.push(`hyper`),t.push(e.name===`return`?`enter`:e.name),t.join(`+`)}function sc(e){return`${e.name}:${+!!e.ctrl}:${+!!e.shift}:${+!!e.meta}:${+!!e.super}:${+!!e.hyper}`}var cc=Symbol(`keymap-extension-context`);function lc(e){return e.isDestroyed?null:e.getFocusedTarget()}function uc(e,t,n){let r=t??e.rootTarget,i=t!==null;for(;r;){if(n(r,i)===!1)return;r=e.getParentTarget(r),i=!1}}function dc(e,t){let n=new Set;return uc(e,t,e=>{n.add(e)}),n}function fc(e,t,n){let r=[],i=dc(t,n),a=Array.isArray(e)?e:pc(e);for(let e of a)mc(t,e,n,i)&&r.push(e);return r}function pc(e){return[...e].sort((e,t)=>t.priority-e.priority||t.order-e.order)}function mc(e,t,n,r=dc(e,n)){let i=t.target;return i?e.isTargetDestroyed(i)?!1:t.targetMode===`focus`?i===n:r.has(i):!0}function hc(e){let t=e.binding.sequence[e.index];if(!t?.patternName)return 0;let n=e.patterns?.at(-1);return n?.name===t.patternName?n.values.length:0}function gc(e,t,n=!0){let r=e.binding.sequence[e.index];if(!r?.patternName)return!0;let i=t.get(r.patternName);return i?hc(e)>=i.min:n}function _c(e,t,n=!0){let r=e.binding.sequence[e.index];if(r?.patternName){let n=t.get(r.patternName);if(n&&hc(e)<n.max)return!0}return gc(e,t,n)&&e.index+1<e.binding.sequence.length}function vc(e,t){return e.index===e.binding.sequence.length-1&&gc(e,t,!1)}function yc(e,t,n,r){return{parent:e,depth:e?e.depth+1:0,stroke:t,match:n,pattern:r,children:new Map,patternChildren:[],bindings:[],reachableBindings:[]}}function bc(e,t){let n=yc(null,null,null);for(let r of e){if(r.event!==`press`)continue;let e=n;for(let n of r.sequence){let i;if(n.patternName){let r=t.get(n.patternName);i=e.patternChildren.find(e=>e.pattern?.name===n.patternName),i||(i=yc(e,n.stroke,n.match,r),e.patternChildren.push(i))}else i=e.children.get(n.match),i||(i=yc(e,n.stroke,n.match),e.children.set(n.match,i));i.reachableBindings.push(r),e=i}e.bindings.push(r)}return n}function xc(e,t){let n=[];for(let r of e){if(!gc(r,t))continue;let e=r.index+1,i=r.binding.sequence[e];i&&n.push({part:i,binding:r.binding,index:e,exact:e===r.binding.sequence.length-1,continues:e<r.binding.sequence.length-1})}return n}function Sc(e,t,n,r){let i=n.patternName;if(!i)return{...e,index:t};let a=[...e.patterns??[]],o=a.at(-1);return o?.name===i?a[a.length-1]={...o,values:[...o.values,r],parts:[...o.parts,n]}:a.push({name:i,payloadKey:n.payloadKey??i,values:[r],parts:[n]}),{layer:e.layer,binding:e.binding,index:t,parts:[...e.parts,n],patterns:a}}function Cc(e,t){let n=e.parts.at(-1);if(!n||n.patternName)return t.length;let r=t.indexOf(n.match);return r===-1?t.length:r}function wc(e,t,n,r,i,a,o,s,c){let l=t.sequence[n];if(l){if(l.patternName){let a=s(l.patternName,o);if(!a)return;let u=c(o,l.patternName,a);return Sc({layer:e,binding:t,index:n,parts:r,patterns:i},n,u,a.value??o.name)}if(a.includes(l.match))return{layer:e,binding:t,index:n,parts:[...r,l],patterns:i}}}function Tc(e,t,n,r,i,a){let o=e.binding.sequence[e.index];if(o?.patternName){let s=r.get(o.patternName);if(s&&hc(e)<s.max){let t=i(s.name,n);if(t){let r=a(n,s.name,t);return Sc(e,e.index,r,t.value??n.name)}}return gc(e,r,!1)?wc(e.layer,e.binding,e.index+1,e.parts,e.patterns,t,n,i,a):void 0}return wc(e.layer,e.binding,e.index+1,e.parts,e.patterns,t,n,i,a)}function Ec(e,t,n,r,i){let a=[],o=1/0;for(let s of e.bindings){if(s.event!==`press`)continue;let c=wc(e,s,0,[],void 0,t,n,r,i);if(!c)continue;let l=Cc(c,t);l<o&&(o=l,a.length=0),l===o&&a.push(c)}return a}import.meta.require;function Dc(e){let t=Object.create(null),n=(e,n)=>{let r=t[e];if(!r)return;let i=r.filter(e=>e!==n);i.length===0?delete t[e]:i.length!==r.length&&(t[e]=i)};return{hook(e,r){return t[e]=[...t[e]??[],r],()=>n(e,r)},has(e){return(t[e]?.length??0)>0},emit(n,...r){let i=t[n];if(i)for(let t of i)try{r.length===0?t():t(r[0])}catch(t){e(n,t)}}}}function Oc(){let e=[];return{get:()=>e,set:t=>{e=t},remove(t){e=e.filter(e=>e!==t)},has:()=>e.length>0,clear:()=>{e=[]}}}function kc(){let e=Oc();return{append(t){return e.set([...e.get(),t]),()=>e.remove(t)},prepend(t){return e.set([t,...e.get()]),()=>e.remove(t)},values:e.get,has:e.has,clear:e.clear}}function Ac(){let e=Oc(),t=0;return{register(n,r){let i={...r,listener:n,order:t++};return e.set([...e.get(),i].sort((e,t)=>t.priority-e.priority||e.order-t.order)),()=>e.remove(i)},entries:e.get,has:e.has,clear:e.clear}}function jc(e){return typeof e==`string`||!!e&&typeof e==`object`&&!Array.isArray(e)}function Mc(e){if(!Array.isArray(e))return{ok:!1,reason:`Invalid keymap bindings: expected an array of binding objects`};for(let[t,n]of e.entries()){if(!n||typeof n!=`object`||Array.isArray(n))return{ok:!1,reason:`Invalid keymap binding at index ${t}: expected a binding object`};if(!jc(n.key))return{ok:!1,reason:`Invalid keymap binding at index ${t}: expected "key" to be a string or keystroke object`}}return{ok:!0}}function Nc(e){let t=Mc(e);if(!t.ok)throw Error(t.reason);return e.map(e=>({...e,key:typeof e.key==`string`?e.key:{...e.key}}))}function Pc(e){return{...e,sequence:ec(e.sequence)}}function Fc(e,t){let n=kc();return{prependLayerAnalyzer(e){return n.prepend(e)},appendLayerAnalyzer(e){return n.append(e)},clearLayerAnalyzers(){n.clear()},analyzeLayer(r){let i=n.values();if(i.length===0)return;let a=Ic(r.bindings),o={target:r.target,order:r.order,sourceBindings:r.sourceBindings,bindings:a,hasTokenBindings:r.hasTokenBindings,checkCommandResolution(e){return t.getCommandResolutionStatus(e,r.commands)},warn(t,n,r){e.emitWarning(t,n,r)},warnOnce(t,n,r,i){e.warnOnce(t,n,r,i)},error(t,n,r){e.emitError(t,n,r)}};for(let t of i)try{t(o)}catch(t){e.emitError(`layer-analyzer-error`,t,`[Keymap] Error in layer analyzer:`)}}}}function Ic(e){return e.map(t=>({sequence:ec(t.sequence),command:t.command,attrs:t.attrs,event:t.event,preventDefault:t.preventDefault,fallthrough:t.fallthrough,parsedBinding:Pc(t.parsedBinding),sourceTarget:t.sourceTarget,sourceLayerOrder:t.sourceLayerOrder,bindingIndex:t.bindingIndex,hasCommandAtSequence:e.some(e=>e.event===`press`&&e.command!==void 0&&Lc(e,t)),hasContinuations:e.some(e=>e.event===`press`&&Rc(t,e))}))}function Lc(e,t){return e.sequence.length===t.sequence.length&&e.sequence.every((e,n)=>e.match===t.sequence[n]?.match)}function Rc(e,t){return e.sequence.length<t.sequence.length&&e.sequence.every((e,n)=>e.match===t.sequence[n]?.match)}function zc(){return{version:-1,notifyVersion:-1,focused:void 0,value:[],targets:new WeakMap}}function Bc(){return{plain:zc(),bindings:zc(),metadata:zc(),bindingsAndMetadata:zc()}}function Vc(e,t){if(t===void 0)return e.plain;let n=t.includeBindings===!0,r=t.includeMetadata===!0;return n?r?e.bindingsAndMetadata:e.bindings:r?e.metadata:e.plain}function Hc(e,t,n){let r=n?e.targets.get(n):e.nullTarget;return r?.version===t?r:void 0}function Uc(e,t,n,r){let i={version:t,value:r};n?e.targets.set(n,i):e.nullTarget=i}function Wc(e,t){if(e===t)return!0;if(!e||!t||e.captures.length!==t.captures.length)return!1;for(let n=0;n<e.captures.length;n+=1){let r=e.captures[n],i=t.captures[n];if(!r||!i||r.layer!==i.layer||r.binding!==i.binding||r.index!==i.index||r.parts.length!==i.parts.length)return!1;for(let e=0;e<r.parts.length;e+=1)if(r.parts[e]?.match!==i.parts[e]?.match)return!1;let a=r.patterns??[],o=i.patterns??[];if(a.length!==o.length)return!1;for(let e=0;e<a.length;e+=1){let t=a[e],n=o[e];if(!t||!n||t.name!==n.name||t.values.length!==n.values.length)return!1;for(let e=0;e<t.values.length;e+=1)if(!Object.is(t.values[e],n.values[e]))return!1}}return!0}function Gc(e){let t=e.parts.at(-1);if(!t||e.parts.length<=1)return;let n=e.index-1,r=e.patterns;if(t.patternName){let i=r?.at(-1);i?.name===t.patternName&&(i.values.length>1?(n=e.index,r=[...(r??[]).slice(0,-1),{...i,values:i.values.slice(0,-1),parts:i.parts.slice(0,-1)}]):r=(r??[]).slice(0,-1))}return{layer:e.layer,binding:e.binding,index:n,parts:e.parts.slice(0,-1),patterns:r}}function Kc(e){let t=e.captures[0];if(!t||t.parts.length===0)return[];let n=[];for(let r=0;r<t.parts.length;r+=1){let i=t.parts[r];if(!i)continue;let a,o,s=!1,c=!1;for(let t of e.captures){let e=t.parts[r];if(e){if(a===void 0){a=e.display,o=e.tokenName;continue}!s&&a!==e.display&&(s=!0),!c&&o!==e.tokenName&&(c=!0)}}(a===void 0||s)&&(a=ic(i.stroke)),c&&(o=void 0),n.push(Qs(i.stroke,{display:a,match:i.match,tokenName:o}))}return n}function qc(e){if(e.isDestroyed)throw Error(`Cannot use a keymap after its host was destroyed`);return e}function Jc(e,t,n,r,i,a,o={}){let s=Bc(),c=-1,l=[],u=()=>qc(t).getFocusedTarget(),d=()=>lc(t),f=t=>{let n=e.pending;Wc(n,t)||(e.pending=t,o.onPendingSequenceChanged?.(n,t),oe(),r.queueStateChange())},p=()=>{let t=e.pending;if(!t)return;let n=u(),r=a.getActiveCommandView(n),o=t.captures.filter(t=>e.layers.has(t.layer)&&C(t.layer,n)&&i.matchesConditions(t.layer)&&D(t.binding,n,r)&&_c(t,e.patterns));if(o.length===0){f(null);return}return o.length!==t.captures.length&&f({captures:o}),e.pending??void 0},m=()=>{t.isDestroyed||!e.pending||p()},h=()=>!t.isDestroyed&&e.pending!==null,g=()=>{if(c===e.cacheVersion)return l;let t=p(),n=t?Kc(t):[];return(!t||T())&&(c=e.cacheVersion,l=n),n},_=()=>{let e=p();if(!e)return!1;let t=e.captures[0];if(!t||t.parts.length<=1)return f(null),!0;let n=[];for(let t of e.captures){let e=Gc(t);e&&n.push(e)}return n.length===0?(f(null),!0):(f({captures:n}),!0)},v=t=>{let n=t?.includeBindings===!0,r=t?.includeMetadata===!0,i=Vc(s,t);return i.notifyVersion===e.derivedVersion?i.value:y(i,n,r)},y=(n,r,i)=>{t.isDestroyed&&qc(t);let o=u(),s=Hc(n,e.cacheVersion,o);if(s)return n.notifyVersion=e.derivedVersion,n.version=e.cacheVersion,n.focused=o,n.value=s.value,s.value;let c=a.getActiveCommandView(o),l=p(),d=l?[]:S(o),f=l?F(l.captures,r,i,o,c):j(d,r,i,o,c);return(l?T():w(d))&&(n.version=e.cacheVersion,n.notifyVersion=e.derivedVersion,n.focused=o,n.value=f,Uc(n,e.cacheVersion,o,f)),f},b=(e,t)=>{let n=t?.includeBindings===!0,r=t?.includeMetadata===!0,i=u(),o=a.getActiveCommandView(i);return F(e,n,r,i,o)},x=(e,t)=>{let n=t?.includeBindings===!0,r=t?.includeMetadata===!0,i=e===d()?p():void 0,o=a.getActiveCommandView(e);return i?F(i.captures,n,r,e,o):j(S(e),n,r,e,o)},S=n=>e.activeLayersCacheVersion===e.cacheVersion&&e.activeLayersCacheFocused===n?e.activeLayersCache:(e.activeLayersCacheVersion=e.cacheVersion,e.activeLayersCacheFocused=n,e.activeLayersCache=fc(e.sortedLayers,t,n),e.activeLayersCache),C=(e,n)=>mc(t,e,n),w=t=>!e.commandResolvers.has()&&e.activeKeyCacheBlockers===0,T=()=>!e.commandResolvers.has()&&e.activeKeyCacheBlockers===0,E=(e,t,n)=>{let r=[];for(let o of e)i.matchesConditions(o)&&a.isBindingVisible(o,t,n)&&r.push(o);return r},D=(e,t,n)=>i.matchesConditions(e)&&a.isBindingVisible(e,t,n),O=(e,t)=>{let n,r,i=!1,a=!1;for(let o of e){let e=o.sequence[t];if(e){if(n===void 0){n=e.display,r=e.tokenName;continue}!i&&n!==e.display&&(i=!0),!a&&r!==e.tokenName&&(a=!0)}}if(n===void 0||i){let r=e[0]?.sequence[t]?.stroke;n=r?ic(r):``}return a&&(r=void 0),{display:n,tokenName:r}},k=(e,t,n)=>({sequence:e.sequence,command:e.command,commandAttrs:a.getBindingCommandAttrs(e,t,n),attrs:e.attrs,event:e.event,preventDefault:e.preventDefault,fallthrough:e.fallthrough}),A=(e,t,n)=>e.map(e=>k(e,t,n)),j=(e,t,n,r,a)=>{let o=new Map,s=new Set;for(let n of e)n.root.children.size===0&&n.root.patternChildren.length===0||!i.matchesConditions(n)||(M(n.root.children.values(),o,s,t,r,a),M(n.root.patternChildren,o,s,t,r,a));return te(o,t,n,r,a)},M=(e,t,n,r,i,a)=>{for(let o of e){let e=o.match;if(!e||n.has(e)||!o.stroke)continue;let s=N(o,r,i,a);if(!s)continue;let c=t.get(e);c?ie(c,s,r):t.set(e,R(o.stroke,s,r)),s.stop&&n.add(e)}},N=(e,t,n,r)=>{if(!(e.children.size>0||e.patternChildren.length>0)){let i=L(P(e)?E(e.bindings,n,r):e.bindings,n,r);if(!i)return;let a=O(i.bindings,e.depth-1);return{display:a.display,tokenName:a.tokenName,continues:!1,firstBinding:i.bindings[0],commandBinding:i.commandBinding,bindings:t?[...i.bindings]:void 0,stop:i.stop}}let i=E(e.reachableBindings,n,r);if(i.length===0)return;let a=L(e.bindings,n,r),o=O(i,e.depth-1);return{display:o.display,tokenName:o.tokenName,continues:!0,firstBinding:a?.bindings[0],commandBinding:a?.commandBinding,bindings:t&&a?[...a.bindings]:void 0,stop:!0}},P=t=>{if(e.commandResolvers.has())return!0;for(let e of t.bindings)if(e.matchers.length>0)return!0;return!1},F=(t,n,r,i,a)=>{let o=new Map,s=new Set;return I(xc(t,e.patterns),o,s,n,i,a),te(o,n,r,i,a)},I=(e,t,n,r,i,a)=>{let o=new Set;for(let s of e)o.has(s.part.match)||(o.add(s.part.match),ee(s,e,t,n,r,i,a))},ee=(e,t,n,r,i,a,o)=>{let s=e.part.match;if(r.has(s))return;let c=ne(e,t,i,a,o);if(!c)return;let l=n.get(s);l?ie(l,c,i):n.set(s,R(e.part.stroke,c,i)),c.stop&&r.add(s)},te=(e,t,n,r,i)=>{let a=[];for(let o of e.values()){let e=ae(o,t,n,r,i);e&&a.push(e)}return a},ne=(e,t,n,r,i)=>{let a=t.filter(t=>t.part.match===e.part.match),o=a.filter(e=>e.exact).map(e=>e.binding),s=L(o,r,i),c=a.some(e=>e.continues);if(!c&&!s)return;let l=re(a);return{display:l.display,tokenName:l.tokenName,continues:c,firstBinding:s?.bindings[0],commandBinding:s?.commandBinding,bindings:n&&s?[...s.bindings]:void 0,stop:c||s?.stop===!0}},re=e=>{let t,n,r=!1,i=!1;for(let a of e){let e=a.part;if(t===void 0){t=e.display,n=e.tokenName;continue}!r&&t!==e.display&&(r=!0),!i&&n!==e.tokenName&&(i=!0)}let a=e[0]?.part;return(t===void 0||r)&&(t=a?ic(a.stroke):``),i&&(n=void 0),{display:t,tokenName:n}},L=(e,t,n)=>{let r=[],o;for(let s of e)if(!(!i.matchesConditions(s)||!a.isBindingVisible(s,t,n))&&(r.push(s),s.command!==void 0&&(o??=s,!s.fallthrough)))return{bindings:r,commandBinding:o,stop:!0};if(r.length!==0)return{bindings:r,commandBinding:o,stop:!1}},R=(e,t,n)=>({stroke:e,display:t.display,tokenName:t.tokenName,continues:t.continues,firstBinding:t.firstBinding,commandBinding:t.commandBinding,bindings:n&&t.bindings?[...t.bindings]:void 0}),ie=(e,t,n)=>{if(!e.firstBinding&&t.firstBinding&&(e.firstBinding=t.firstBinding),!e.commandBinding&&t.commandBinding&&(e.commandBinding=t.commandBinding),t.continues&&(e.continues=!0),!(!n||!t.bindings||t.bindings.length===0)){if(!e.bindings){e.bindings=[...t.bindings];return}e.bindings.push(...t.bindings)}},ae=(e,t,n,r,i)=>{if(!e.commandBinding&&!e.continues)return;let o={stroke:Zs(e.stroke),display:e.display,continues:e.continues};if(e.tokenName&&(o.tokenName=e.tokenName),e.commandBinding&&(o.command=e.commandBinding.command),t&&e.bindings&&e.bindings.length>0&&(o.bindings=e.bindings.length===1?[k(e.bindings[0],r,i)]:A(e.bindings,r,i)),n){e.firstBinding?.attrs&&(o.bindingAttrs=e.firstBinding.attrs);let t=e.commandBinding?a.getBindingCommandAttrs(e.commandBinding,r,i):void 0;t&&(o.commandAttrs=t)}return o},oe=()=>{n.has(`pendingSequence`)&&n.emit(`pendingSequence`,e.pending?Kc(e.pending):[])};return{getFocusedTarget:u,getFocusedTargetIfAvailable:d,setPendingSequence:f,ensureValidPendingSequence:p,revalidatePendingSequenceIfNeeded:m,hasPendingSequenceState:h,getPendingSequence:g,popPendingSequence:_,getActiveKeys:v,getActiveKeysForCaptures:b,getActiveKeysForFocused:x,getActiveLayers:S,isLayerActiveForFocused:C,collectSequencePartsFromPending:Kc,collectMatchingBindings:E,collectActiveBindings:A}}var Yc=new Set([`name`,`run`,`fields`,`attrs`,`rejectedResult`]),Xc=new Set([`key`,`cmd`,`event`,`preventDefault`,`fallthrough`]),Zc=new Set([`target`,`targetMode`,`priority`,`bindings`,`commands`]);function Qc(e){if(e===void 0||typeof e==`function`)return e;let t=e.trim();if(!t)throw Error(`Invalid keymap command: command cannot be empty`);return t}function $c(e){let t=e.trim();if(!t)throw Error(`Invalid keymap command name: name cannot be empty`);if(/\s/.test(t))throw Error(`Invalid keymap command name "${e}": command names cannot contain whitespace`);return t}function el(e,t,n){let r=e.get(t);r?r.push(n):e.set(t,[n])}function tl(e){let t=[],n=new Map;for(let r of e.layers)for(let e of r.commands){let i={layer:r,commandState:e};t.push(i),el(n,e.command.name,i)}return{entries:t,chainsByName:n}}function nl(e,t,n){let r=[],i=[],a=new Map,o=new Map;for(let s of e)if(s.commands.length!==0&&!(n&&!t.matchesConditions(s)))for(let e of s.commands){if(!t.matchesConditions(e))continue;let n={layer:s,commandState:e};r.push(n),el(o,e.command.name,n),a.has(e.command.name)||(a.set(e.command.name,n),i.push(n))}return{layers:e,entries:r,reachable:i,reachableByName:a,chainsByName:o}}function rl(e,t,n,r){return(e.activeLayersCacheVersion!==e.cacheVersion||e.activeLayersCacheFocused!==r)&&(e.activeLayersCacheVersion=e.cacheVersion,e.activeLayersCacheFocused=r,e.activeLayersCache=fc(e.sortedLayers,t,r)),nl(e.activeLayersCache,n,!0)}function il(e,t,n,r){if(Object.prototype.hasOwnProperty.call(e,t)&&!Object.is(e[t],n))throw Error(`Conflicting keymap requirement for "${t}" from ${r}`);e[t]=n}function al(e,t,n,r){if(Object.prototype.hasOwnProperty.call(e,t)&&!Object.is(e[t],n))throw Error(`Conflicting keymap attribute for "${t}" from ${r}`);e[t]=n}function ol(e){let t=`field ${e.fieldName}`;return{require(n,r){il(e.requirements,n,r,t)},attr(n,r){if(!e.attrs)throw Error(`Keymap ${t} cannot publish attrs`);al(e.attrs,n,r,t)},activeWhen(n){e.matchers.push(e.conditions.buildRuntimeMatcher(n,t))}}}function sl(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function cl(e,t){return e instanceof Error&&e.message?e.message:t}function ll(e){return!e||typeof e!=`object`&&typeof e!=`function`?!1:typeof e.then==`function`}function ul(e,t){let n=t?.deep===!0,r=t?.freeze===!0,i=t?.preserveNonPlainObjects===!0;if(Array.isArray(e)){let i=n?e.map(e=>ul(e,t)):[...e];return r?Object.freeze(i):i}if(e&&typeof e==`object`){if(i&&!sl(e))return e;let a={};for(let[r,i]of Object.entries(e))a[r]=n?ul(i,t):i;return r?Object.freeze(a):a}return e}var dl=[`name`],fl=Object.freeze({}),pl=new WeakMap;function ml(e,t,n,r,i){let a=-1,o,s=-1,c,l,u=-1,d,f,p=-1,m,h=-1,g=new Map,_=t=>gl({commands:t,commandFields:e.commandFields,conditions:r,onError:(e,t,r)=>{n.emitError(e,t,r)}}),v=t=>te(()=>e.commandResolvers.prepend(t),t),y=t=>te(()=>e.commandResolvers.append(t),t),b=()=>{e.commandResolvers.has()&&n.runWithStateChangeBatch(()=>{e.commandResolvers.clear(),i.onCommandResolversChanged(),n.queueStateChange()})},x=e=>ce(e).map(e=>hl(e.commandState)),S=e=>{let t=se(e),n=ce(e,t);if(n.length===0)return[];let r=n.map(e=>({entry:e,command:hl(e.commandState),commandAttrs:e.commandState.attrs,bindings:[]})),i=new Map;for(let[e,t]of r.entries()){let n=i.get(t.command.name);n?n.push(e):i.set(t.command.name,[e])}return i.size>0&&z(r,i,t),r.map(e=>({command:e.command,bindings:e.bindings}))},C=t=>{if(t.visibility===`registered`&&u===e.derivedVersion&&d===t.commands&&f)return f;let n=new Map;for(let e of t.commands)n.has(e)||n.set(e,[]);return n.size===0?n:(le(n,se(t)),t.visibility===`registered`&&(u=e.derivedVersion,d=t.commands,f=n),n)},w=(e,t,n)=>{let r=M(t);if(n){let i=[],a=r.chainsByName.get(e);if(a)for(let e of a)i.push({target:e.layer.target,command:e.commandState.command,attrs:e.commandState.attrs,payload:n.payload});let o=pe(e,t,{mode:`active`,execution:n});return o.resolved&&i.push(o.resolved),{entries:i.length>0?i:void 0,hadError:o.hadError}}let i=[];for(let t of r.chainsByName.get(e)??[])i.push({target:t.layer.target,command:t.commandState.command,attrs:t.commandState.attrs});let a=pe(e,t,{mode:`active`});return a.resolved&&i.push(a.resolved),{entries:i.length>0?i:void 0,hadError:a.hadError}},T=t=>{if(h!==e.derivedVersion&&(h=e.derivedVersion,g=new Map),g.has(t))return g.get(t)??void 0;let n=R(L(t));return g.set(t,n??null),n},E=(e,t)=>R(M(t).chainsByName.get(e)),D=(e,t)=>pe(e,null,{mode:`registered`,execution:t}),O=(e,t,n)=>pe(e,t,{mode:`active`,execution:n}),k=(e,t)=>ne(e,t)?.command,A=e=>re(e)?.commandState.command,j=(e,n,i)=>{let a=N().chainsByName.get(e);if(!a||a.length===0)return;let o,s;for(let e of a){if(!mc(t,e.layer,n)){o??=e;continue}(!r.matchesConditions(e.layer)||!r.matchesConditions(e.commandState))&&(s??=e)}let c=s??o;if(c)return{reason:s?`disabled`:`inactive`,command:i?c.commandState.command:void 0}},M=n=>{if(s===e.derivedVersion&&c===n&&l)return l;let i=rl(e,t,r,n);return P()&&(s=e.derivedVersion,c=n,l=i),i},N=()=>a===e.derivedVersion&&o?o:(a=e.derivedVersion,o=tl(e),o),P=()=>e.activeCommandViewCacheBlockers===0,F=(e,t,n)=>e.command===void 0||e.run?!0:typeof e.command==`string`?n.reachableByName.has(e.command)?!0:ie(e.command,t,`active`)!==void 0:!1,I=(e,t,n)=>{if(typeof e.command!=`string`)return;let r=n.reachableByName.get(e.command);return r?r.commandState.attrs:ie(e.command,t,`active`)?.attrs},ee=(e,n)=>{if(n?.some(t=>t.command.name===e)||N().chainsByName.has(e))return`resolved`;let r=pe(e,lc(t));return r.resolved||r.hadError?r.resolved?`resolved`:`error`:`unresolved`},te=(t,r)=>n.runWithStateChangeBatch(()=>{let a=t();return i.onCommandResolversChanged(),n.queueStateChange(),()=>{n.runWithStateChangeBatch(()=>{a(),!e.commandResolvers.values().includes(r)&&(i.onCommandResolversChanged(),n.queueStateChange())})}}),ne=(e,t)=>{let n=M(t).reachableByName.get(e);return n?{target:n.layer.target,command:n.commandState.command,attrs:n.commandState.attrs}:ie(e,t,`active`)},re=e=>L(e)?.[0],L=t=>{let n=[];for(let r of e.sortedLayers)for(let e of r.commands)e.command.name===t&&n.push({layer:r,commandState:e});return n.length>0?n:void 0},R=e=>{if(e?.length)return e.map(e=>({target:e.layer.target,command:e.commandState.command,attrs:e.commandState.attrs}))},ie=(e,t,n)=>pe(e,t,{mode:n}).resolved,ae=()=>N().entries,oe=()=>{if(p===e.derivedVersion&&m)return m;let t=new Map;for(let n of e.layers)for(let e of n.bindings){if(typeof e.command!=`string`)continue;let n=t.get(e.command);n?n.push(e):t.set(e.command,[e])}return p=e.derivedVersion,m=t,t},se=e=>{let n=e?.visibility??`reachable`,r=e&&Object.prototype.hasOwnProperty.call(e,`focused`)?e.focused??null:lc(t);return n===`registered`?{visibility:n,focused:r}:{visibility:n,focused:r,activeView:M(r)}},ce=(e,t=se(e))=>{let r;return r=t.visibility===`registered`?ae():t.visibility===`active`?t.activeView?.entries??[]:t.activeView?.reachable??[],xl({entries:r,query:e,getCommand:e=>hl(e),onFilterError:e=>{n.emitError(`command-query-filter-error`,e,`[Keymap] Error in command query filter:`)}})},z=(e,t,n)=>{B(n,n=>{ue(e,t,n)})},le=(e,t)=>{if(t.visibility===`registered`){let t=oe();for(let[n,r]of e){let e=N().chainsByName.get(n)?.[0]?.commandState.attrs;for(let i of t.get(n)??[])r.push(fe(i,e))}return}B(t,n=>{de(e,n,t)})},B=(t,n)=>{if(t.visibility===`registered`){for(let t of e.layers)for(let e of t.bindings)n(e);return}let i=t.activeView;if(i){for(let e of i.layers)if(!(e.bindings.length===0||!r.matchesConditions(e)))for(let a of e.bindings)r.matchesConditions(a)&&F(a,t.focused,i)&&n(a)}},ue=(e,t,n)=>{if(typeof n.command!=`string`)return;let r=t.get(n.command);if(!(!r||r.length===0))for(let t of r){let r=e[t];r&&r.bindings.push(fe(n,r.commandAttrs))}},de=(e,t,n)=>{if(typeof t.command!=`string`)return;let r=e.get(t.command);r&&r.push(fe(t,V(t,n)))},fe=(e,t)=>({sequence:e.sequence,command:e.command,commandAttrs:t,attrs:e.attrs,event:e.event,preventDefault:e.preventDefault,fallthrough:e.fallthrough}),V=(e,t)=>{if(typeof e.command!=`string`)return;if(t.visibility===`registered`)return N().chainsByName.get(e.command)?.[0]?.commandState.attrs;let n=t.activeView;if(n)return I(e,t.focused,n)},pe=(t,r,i)=>{let a=i?.mode??`active`,o=i?.execution??{input:t},s=_l(t,e.commandResolvers.values(),()=>ge(r,a,o),e=>{n.emitError(`command-resolver-error`,e,`[Keymap] Error in command resolver for "${t}":`)}),c=s.resolved;if(c){let e=he(c.command.name,r,a);e?.commandState.command===c.command&&c.target===void 0&&(c={...c,target:e.layer.target},s.resolved=c)}if(c&&!c.attrs){let e=me(c.command.name,r,a)??bl(c.command);e&&(s.resolved={...c,attrs:e})}return s},me=(e,t,n)=>n===`registered`?re(e)?.commandState.attrs:M(t).reachableByName.get(e)?.commandState.attrs,he=(e,t,n)=>n===`registered`?re(e):M(t).reachableByName.get(e),ge=(e,t,n)=>{let r=n.input,i=n.payload;return{context:{get input(){return r},get payload(){return i},setInput(e){r=e},setPayload(e){i=e},getCommand:n=>t===`registered`?A(n):k(n,e)},getExecutionFields(){return{input:r,payload:i}}}};return{normalizeCommands:_,prependCommandResolver:v,appendCommandResolver:y,clearCommandResolvers:b,getCommands:x,getCommandEntries:S,getCommandBindings:C,getResolvedCommandChain:w,getRegisteredResolvedEntries:T,getActiveRegisteredResolvedEntries:E,resolveRegisteredResolverFallback:D,resolveActiveResolverFallback:O,getTopCommand:k,getDispatchUnavailableCommandState:j,getActiveCommandView:M,isBindingVisible:F,getBindingCommandAttrs:I,getCommandResolutionStatus:ee}}function hl(e){return e.command}function gl(e){let t=[],n=new Set;for(let r of e.commands)try{let i={},a=[],o=$c(r.name),s=vl(r),c={};if(n.has(o)){e.onError(`duplicate-command`,{command:o},`Duplicate keymap command "${o}" in the same layer`);continue}r.name=o;for(let[t,n]of Object.entries(s)){if(n===void 0)continue;let r=e.commandFields.get(t);r&&r(n,ol({fieldName:t,conditions:e.conditions,requirements:i,matchers:a,attrs:c}))}let l={command:r,fields:s,attrs:Object.keys(c).length===0?void 0:c,requires:Object.entries(i),matchers:a};n.add(l.command.name),t.push(l)}catch(t){e.onError(`register-command-failed`,t,cl(t,`Failed to register keymap command "${String(r.name)}"`));continue}return t}function _l(e,t,n,r){if(t.length===0)return{hadError:!1};let i=!1;for(let a of t){let t,o=n();try{t=a(e,o.context)}catch(e){i=!0,r(e);continue}if(t)return{hadError:i,resolved:yl(t,o.getExecutionFields())}}return{hadError:i}}function vl(e){let t={};for(let[n,r]of Object.entries(e))!Yc.has(n)&&r!==void 0&&(t[n]=r);return Object.keys(t).length===0?fl:t}function yl(e,t){return{command:e,input:t.input,payload:t.payload}}function bl(e){let t=vl(e);return t===fl?void 0:t}function xl(e){let t=e.query?.namespace,n=Sl(e.query?.limit);if(n===0)return[];let r=e.query?.search?.trim().toLowerCase()??``,i=dl;e.query?.searchIn&&e.query.searchIn.length>0&&(i=e.query.searchIn);let a=e.query?.filter,o,s,c;if(typeof a==`function`)s=a;else if(a){let e=Object.entries(a),t=[];for(let[n,r]of e){if(n===`name`){if(typeof r==`string`){c=new Set([r]);continue}if(Array.isArray(r)){let e=new Set;for(let t of r)typeof t==`string`&&e.add(t);c=e;continue}}t.push([n,r])}o=t.length>0?t:void 0}let l=[];for(let a of e.entries){let u=a.commandState;if(wl(u,t)&&Cl(u,r,i)&&!(c&&!c.has(u.command.name))&&Tl(u,o,e)){if(s){let t=!1;try{t=s(e.getCommand(u))}catch(t){e.onFilterError(t);continue}if(!t)continue}if(l.push(a),n!==void 0&&l.length>=n)break}}return l}function Sl(e){if(e===void 0)return;let t=Math.floor(Number(e));return!Number.isFinite(t)||t<=0?0:t}function Cl(e,t,n){if(!t)return!0;for(let r of n)if(El(e,r,t))return!0;return!1}function wl(e,t){if(t===void 0)return!0;let n=e.fields;return Object.prototype.hasOwnProperty.call(n,`namespace`)?Nl(n.namespace,t):!1}function Tl(e,t,n){if(!t)return!0;for(let[r,i]of t)if(!Al(e,r,i,n))return!1;return!0}function El(e,t,n){return Dl(e,t)?.includes(n)===!0}function Dl(e,t){let n=pl.get(e);if(n||(n=new Map,pl.set(e,n)),n.has(t))return n.get(t);let r=e.fields,i=e.attrs,a;t===`name`?a=e.command.name:Object.prototype.hasOwnProperty.call(r,t)?a=r[t]:i&&Object.prototype.hasOwnProperty.call(i,t)&&(a=i[t]);let o=Ol(a);return n.set(t,o),o}function Ol(e){if(Array.isArray(e)){let t=[];for(let n of e){let e=Ol(n);e!==void 0&&t.push(e)}return t.length>0?t.join(`\0`):void 0}if(typeof e==`string`)return e.toLowerCase();if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return String(e).toLowerCase()}function kl(e,t,n,r){try{return e(t,n)}catch(e){return r(e),!1}}function Al(e,t,n,r){return typeof n==`function`?jl(e,t,n,r):Ml(e,t,n)}function jl(e,t,n,r){let i=e.command,a=e.fields,o=e.attrs,s,c=!1,l=()=>s??=r.getCommand(e);return t===`name`&&(c=!0,kl(n,i.name,l(),r.onFilterError))||Object.prototype.hasOwnProperty.call(a,t)&&(c=!0,kl(n,a[t],l(),r.onFilterError))||o&&Object.prototype.hasOwnProperty.call(o,t)&&(c=!0,kl(n,o[t],l(),r.onFilterError))?!0:!c&&kl(n,void 0,l(),r.onFilterError)}function Ml(e,t,n){let r=e.command,i=e.fields,a=e.attrs;return t===`name`&&Nl(r.name,n)||Object.prototype.hasOwnProperty.call(i,t)&&Nl(i[t],n)?!0:!!a&&Object.prototype.hasOwnProperty.call(a,t)&&Nl(a[t],n)}function Nl(e,t){return Array.isArray(t)?t.some(t=>Pl(e,t)):Pl(e,t)}function Pl(e,t){return Array.isArray(e)?e.some(e=>Pl(e,t)):Object.is(e,t)}function Fl(e,t,n,r,i){let a=(e,t,n,r,a,o)=>({keymap:i.keymap,event:e,focused:t,target:n,data:r,input:a,payload:o}),o=(t,n,r,i)=>{let a=typeof n==`function`?void 0:n,o=typeof n==`function`?n:n.run,s=i?a:void 0,c;try{c=o(a?{...r,command:a}:r)}catch(n){return e.emitError(`command-execution-error`,n,`[Keymap] Error running command "${t}":`),{status:`error`,result:s?{ok:!1,reason:`error`,command:s}:{ok:!1,reason:`error`}}}if(ll(c))return c.catch(n=>{e.emitError(`async-command-error`,n,`[Keymap] Async error in command "${t}":`)}),{status:`handled`,result:s?{ok:!0,command:s}:{ok:!0}};if(Il(c)){let e=c;return(!c.ok&&c.reason!==`not-found`&&i&&a&&!c.command||c.ok&&i&&a&&!c.command)&&(e={...c,command:a}),{status:c.ok?`handled`:`rejected`,result:e}}return c===!1?{status:`rejected`,result:s?{ok:!1,reason:`rejected`,command:s}:{ok:!1,reason:`rejected`}}:{status:`handled`,result:s?{ok:!0,command:s}:{ok:!0}}},s=(e,t,n,r,i,s,c,l)=>{let u;for(let d of t??[]){let t=o(e,d.command,a(n,r,i??d.target??null,s,e,c),l);if(t.status===`handled`||t.status===`error`)return[t.result,u];u=t.result}return[void 0,u]},c=(e,c,l)=>{let u;try{u=Qc(e)}catch{return{ok:!1,reason:`invalid-args`}}if(typeof u!=`string`)return{ok:!1,reason:`not-found`};let d=c?.includeCommand===!0,f=c?.focused??n.getFocusedTargetIfAvailable(),p=c?.event??i.createCommandEvent(),m=t.getReadonlyData(),h=c?.payload,g=l===`registered`?r.getRegisteredResolvedEntries(u):r.getActiveRegisteredResolvedEntries(u,f),[_,v]=s(u,g,p,f,c?.target,m,h,d);if(_)return _;let y=v,b=l===`registered`?r.resolveRegisteredResolverFallback(u,{input:u,payload:h}):r.resolveActiveResolverFallback(u,f,{input:u,payload:h});if(b.resolved){let e=o(u,b.resolved.command,a(p,f,c?.target??b.resolved.target??null,m,b.resolved.input??u,b.resolved.payload),d);if(e.status===`handled`||e.status===`error`)return e.result;y=e.result}if(b.hadError)return{ok:!1,reason:`error`};if(l===`active`){let e=r.getDispatchUnavailableCommandState(u,f,d);if(e)return e.command?{ok:!1,reason:e.reason,command:e.command}:{ok:!1,reason:e.reason}}return y??{ok:!1,reason:`not-found`}};return{runCommand(e,t){return c(e,t,`registered`)},dispatchCommand(e,t){return c(e,t,`active`)},runBinding(e,n,i,s,c){let l=t.getReadonlyData();if(n.run)return o(typeof n.command==`string`?n.command:`<function>`,n.run,a(i,s,e.target??null,l,typeof n.command==`string`?n.command:`<function>`,c),!1).status!==`rejected`&&(Ll(n,i),!0);if(typeof n.command!=`string`)return!1;let u=r.getResolvedCommandChain(n.command,s,c===void 0?void 0:{input:n.command,payload:c}).entries;for(let t of u??[])if(o(n.command,t.command,a(i,s,t.target??e.target??null,l,t.input??n.command,t.payload),!1).status!==`rejected`)return Ll(n,i),!0;return!1}}}function Il(e){return typeof e==`object`&&!!e&&`ok`in e}function Ll(e,t){e.preventDefault&&(t.preventDefault(),t.stopPropagation())}var Rl=Object.freeze({}),zl=[],Bl=[];function Vl(e){if(Object.keys(e).length!==0)return ul(e,{freeze:!0})}function Hl(e,t,n,r){let i=t=>Jl(t,e.bindingParsers.values(),{tokens:e.tokens,patterns:e.patterns,layer:Rl,parseObjectKey:(e,t)=>c(e,t)}),a=t=>{if(typeof t!=`string`)return[c(t)];let n=ql(t,e.bindingParsers.values(),{tokens:e.tokens,patterns:e.patterns,layer:Rl,parseObjectKey:(e,t)=>c(e,t)});for(let e of n.unknownTokens)r.warnUnknownToken(e,t);return n.unknownTokens.length>0?[]:n.parts},o=(e,t)=>ac(a(e),t),s=(i,a,o,s,d)=>{let f=[],p=!1,m=e.bindingExpanders.values(),h=e.bindingParsers.values(),g=e.bindingFields,_=e.disambiguationResolvers.has(),v=r.warnUnknownField,y=r.warnUnknownToken;for(let[r,b]of i.entries()){let i;try{i=Gl(b.key,m,{layer:d})}catch(e){t.emitError(`binding-expand-error`,e,cl(e,`Failed to expand keymap binding`));continue}for(let m of i){let i=m.key,x;try{x=typeof i==`string`?ql(i,h,{tokens:a,patterns:e.patterns,layer:d,parseObjectKey:(e,t)=>c(e,t)}):{parts:[c(i)],usedTokens:[],unknownTokens:[],hasTokenBindings:!1},x=Kl(x,m)}catch(e){t.emitError(`binding-parse-error`,e,cl(e,`Failed to parse keymap binding`));continue}let S=x.parts;p||=x.hasTokenBindings;for(let e of x.unknownTokens)y(e,typeof i==`string`?i:String(i.name));if(!(x.unknownTokens.length>0))for(let i of u(b,S,a,h,d))try{let t=l(i.event),a=i.sequence,c={},u={},d=[];for(let e in i){if(e===`sequence`||Xc.has(e))continue;let t=i[e];if(t===void 0)continue;let r=g.get(e);if(!r){v(`binding`,e);continue}r(t,ol({fieldName:e,conditions:n,requirements:c,matchers:d,attrs:u}))}let p=Object.keys(u).length>0?Vl(u):void 0,m=Qc(i.cmd),h={binding:b,sequence:a,command:m,event:t,parsedBinding:Pc(i),sourceTarget:o,sourceLayerOrder:s,bindingIndex:r,requires:Object.keys(c).length>0?Object.entries(c):zl,matchers:d.length>0?d:Bl,preventDefault:i.preventDefault!==!1,fallthrough:i.fallthrough??!1};if(p&&(h.attrs=p),typeof m==`function`&&(h.run=m),a.length===0)continue;if(t===`release`&&a.length>1)throw Error(`Keymap release bindings only support a single key stroke`);let y=a.at(-1);if(y?.patternName){let t=e.patterns.get(y.patternName);if(t&&t.max!==t.min)throw Error(`Keymap unbounded sequence patterns must be followed by a concrete continuation`)}t===`press`&&!_&&Wl(f,h),f.push(h)}catch(e){t.emitError(`binding-compile-error`,e,cl(e,`Failed to compile keymap binding`))}}}return{bindings:f,hasTokenBindings:p}},c=(e,t)=>Qs(e,t),l=e=>{if(e===void 0||e===`press`)return`press`;if(e===`release`)return`release`;throw Error(`Invalid keymap binding event "${String(e)}": expected "press" or "release"`)},u=(n,r,i,a,o)=>{let s=e.bindingTransformers.values();if(s.length===0)return[{...n,sequence:ec(r)}];let l={...n,sequence:ec(r)},u=[],d=!0,f=o??Rl;for(let n of s)try{n(l,{layer:f,parseKey:t=>Jl(t,a,{tokens:i,patterns:e.patterns,layer:f,parseObjectKey:(e,t)=>c(e,t)}),add:e=>{u.push(Pc(e))},skipOriginal:()=>{d=!1}})}catch(e){t.emitError(`binding-transformer-error`,e,`[Keymap] Error in binding transformer:`)}return d?u.length===0?[l]:[l,...u]:u};return{parseTokenKey:i,parseKeySequence:a,formatKey:o,compileBindings:s}}function Ul(e,t){if(e.length>=t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]?.match!==t[n]?.match)return!1;return!0}function Wl(e,t){for(let n of e)if(n.event===`press`&&(n.command!==void 0&&Ul(n.sequence,t.sequence)||t.command!==void 0&&Ul(t.sequence,n.sequence)))throw Error(`Keymap bindings cannot use the same sequence as both an exact match and a prefix in the same layer`)}function Gl(e,t,n){if(typeof e!=`string`||t.length===0)return[{key:e}];let r=n?.layer??Rl,i=[{key:e}];for(let e of t){let t=[];for(let n of i){let i=e({input:n.key,displays:n.displays,layer:r});if(!i){t.push(n);continue}if(i.length===0)throw Error(`Keymap binding expander must return at least one key sequence for "${n.key}"`);for(let e of i){if(!e||typeof e!=`object`||Array.isArray(e)||typeof e.key!=`string`)throw Error(`Keymap binding expander must return expansion objects with string keys for "${n.key}"`);if(e.displays!==void 0){if(!Array.isArray(e.displays))throw Error(`Keymap binding expander displays must be an array of strings for "${n.key}"`);for(let t of e.displays)if(typeof t!=`string`)throw Error(`Keymap binding expander displays must be an array of strings for "${n.key}"`)}t.push(e)}}i=t}return i}function Kl(e,t){if(!t.displays)return e;if(t.displays.length!==e.parts.length)throw Error(`Keymap binding expansion displays length must match parsed sequence length for "${String(t.key)}"`);return{...e,parts:e.parts.map((e,n)=>({...e,display:t.displays[n]}))}}function ql(e,t,n){if(e.length===0)throw Error(`Invalid key sequence: sequence cannot be empty`);if(t.length===0)throw Error(`No keymap binding parsers are registered`);let r=n.tokens??new Map,i=n.patterns??new Map,a=n.layer??Rl,o=n.parseObjectKey,s=[],c=new Set,l=new Set,u=0;for(;u<e.length;){let n=!1;for(let d of t){let t=d({input:e,index:u,layer:a,tokens:r,patterns:i,normalizeTokenName:Js,createMatch:rc,parseObjectKey:o});if(t){if(t.nextIndex<=u||t.nextIndex>e.length)throw Error(`Keymap binding parser must advance the input for "${e}" at index ${u}`);s.push(...t.parts);for(let e of t.usedTokens??[])c.add(e);for(let e of t.unknownTokens??[])l.add(e);u=t.nextIndex,n=!0;break}}if(!n)throw Error(`No keymap binding parser handled input at index ${u} in "${e}"`)}return{parts:s,usedTokens:[...c],unknownTokens:[...l],hasTokenBindings:c.size>0||l.size>0}}function Jl(e,t,n){if(typeof e!=`string`)return n.parseObjectKey(e);let{parts:r}=ql(e,t,n),[i]=r;if(!i||r.length!==1)throw Error(`Invalid key "${String(e)}": expected a single key stroke`);return i}function Yl(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.get==`function`&&typeof t.subscribe==`function`}function Xl(e,t){let n=e=>e.requires.length===0&&e.matchers.length===0,r=e=>{try{return e.match()}catch(n){return t.emitError(`runtime-matcher-error`,n,`[Keymap] Error evaluating runtime matcher from ${e.source}:`),!1}},i=e=>{if(e.matchers.length===0)return!0;if(e.matchers.length===1){let[t]=e.matchers;return!t||r(t)}for(let t of e.matchers)if(!r(t))return!1;return!0},a=t=>{if(t.length===0)return!0;for(let[n,r]of t)if(!Object.is(e.data[n],r))return!1;return!0};return{buildRuntimeMatcher(e,t){if(typeof e==`function`)return{source:t,match:e};if(Yl(e))return{source:t,match:()=>e.get(),subscribe:t=>e.subscribe(t)};throw Error(`Keymap ${t} expected a function or a reactive matcher`)},matchesConditions:e=>n(e)||a(e.requires)&&i(e)}}var Zl=Symbol(`keymap-disambiguation-decision`),Ql=Symbol(`keymap-deferred-disambiguation-decision`);function $l(e,t){return{[Zl]:!0,action:e,handler:t}}function eu(e){return{[Ql]:!0,action:e}}function tu(e){return!!e&&typeof e==`object`&&e[Zl]===!0}function nu(e){return!!e&&typeof e==`object`&&e[Ql]===!0}function ru(e,t){return t.aborted?Promise.resolve(!1):new Promise(n=>{let r=setTimeout(()=>{t.removeEventListener(`abort`,i),n(!0)},Math.max(0,e)),i=()=>{clearTimeout(r),t.removeEventListener(`abort`,i),n(!1)};t.addEventListener(`abort`,i,{once:!0})})}function iu(e,t,n,r){let i=e.get(n);if(i)try{return i.matcher(r)}catch(e){t.emitError(`sequence-pattern-match-error`,e,`[Keymap] Error matching sequence pattern "${i.name}":`);return}}function au(e,t,n,r){let i=e.get(n)?.payloadKey??n;return{...Qs({name:t.name,ctrl:t.ctrl,shift:t.shift,meta:t.meta,super:t.super??!1,hyper:t.hyper||void 0},{display:r.display??String(r.value??t.name)}),patternName:n,payloadKey:i}}function ou(e,t,n){if(!n?.patterns||n.patterns.length===0)return;let r={},i=!1;for(let a of n.patterns){let n=e.get(a.name),o;try{o=n?.finalize?n.finalize(a.values):a.values.length===1?a.values[0]:[...a.values]}catch(e){t.emitError(`sequence-pattern-finalize-error`,e,`[Keymap] Error finalizing sequence pattern "${a.name}":`);continue}let s=r[a.payloadKey];s===void 0?(r[a.payloadKey]=o,i=!0):Array.isArray(s)?s.push(o):r[a.payloadKey]=[s,o]}return i?r:void 0}function su(e,t,n,r,i,a,o,s,c,l){let u={resolveKey:e=>o.parseTokenKey(e).match},d=null,f=0;function p(t,n,r){if(t===`key`){let t=r;return e.keyHooks.register(n,{priority:t?.priority??0,release:t?.release??!1})}if(t===`key:after`){let t=r;return e.keyAfterHooks.register(n,{priority:t?.priority??0,release:t?.release??!1})}let i=r;return e.rawHooks.register(n,{priority:i?.priority??0})}function m(t){return e.eventMatchResolvers.prepend(t)}function h(t){return e.eventMatchResolvers.append(t)}function g(){e.eventMatchResolvers.clear()}function _(t){return ee(()=>e.disambiguationResolvers.prepend(t),t)}function v(t){return ee(()=>e.disambiguationResolvers.append(t),t)}function y(){e.disambiguationResolvers.has()&&t.runWithStateChangeBatch(()=>{e.disambiguationResolvers.clear(),c.recompileBindings()})}function b(e,t){d&&fe()}function x(n){let r=e.rawHooks.entries();if(r.length===0)return!1;let i=!1,a={sequence:n,stop(){i=!0}};for(let e of r){try{e.listener(a)}catch(e){t.emitError(`raw-intercept-error`,e,`[Keymap] Error in raw intercept listener:`)}if(i)return!0}return!1}function S(e,t){return{sequence:ec(e.sequence),command:e.command,commandAttrs:s.getBindingCommandAttrs(e,t,s.getActiveCommandView(t)),attrs:e.attrs,event:e.event,preventDefault:e.preventDefault,fallthrough:e.fallthrough,sourceLayerOrder:e.sourceLayerOrder,bindingIndex:e.bindingIndex}}function C(e){l.has(`dispatch`)&&l.emit(`dispatch`,e)}function w(e,t,n,r){l.has(`dispatch`)&&C({phase:e,event:n.event,focused:r,layer:{order:t.order,priority:t.priority,target:t.target,targetMode:t.targetMode},binding:S(n,r),sequence:ec(n.sequence),command:n.command})}function T(e,t,n){if(!l.has(`dispatch`))return;let i=t[0],a=t.length>0?r.collectSequencePartsFromPending({captures:t}):[];C({phase:e,event:`press`,focused:n,layer:i?{order:i.layer.order,priority:i.layer.priority,target:i.layer.target,targetMode:i.layer.targetMode}:void 0,sequence:a})}function E(t){let n=e.keyAfterHooks.entries();for(let e of n)if(e.release===t)return n}function D(e){return e.sequence?ec(e.sequence):e.captures?r.collectSequencePartsFromPending({captures:e.captures}):[]}function O(e,t){return{handled:e!==`sequence-miss`,reason:e,captures:t}}function k(e,t){return{handled:t,reason:t?`binding-handled`:`binding-rejected`,sequence:e.sequence}}function A(e,t){return t.handled||e.reason===`no-match`?t:e}function j(e,i,a,o,s){let c={event:i,eventType:a?`release`:`press`,focused:o,handled:s.handled,reason:s.reason,sequence:D(s),pendingSequence:r.getPendingSequence(),setData:(e,t)=>{n.setData(e,t)},getData:e=>n.getData(e),consume:e=>{let t=e?.preventDefault??!0,n=e?.stopPropagation??!0;t&&i.preventDefault(),n&&i.stopPropagation()}};for(let n of e)if(n.release===a)try{n.listener(c)}catch(e){t.emitError(`key-after-intercept-error`,e,`[Keymap] Error in key:after intercept listener:`)}}function M(){return{handled:!1,reason:`no-match`}}function N(e){e.preventDefault(),e.stopPropagation()}function P(e,t,n,i){r.setPendingSequence({captures:t});let a=O(`sequence-pending`,t);return T(e,t,n),N(i),a}function F(e,t,n,i){let a=O(e,t);return T(`sequence-clear`,t,n),r.setPendingSequence(null),N(i),a}function I(i,a){a||fe();let o=E(a),s=o?r.getFocusedTarget():null,c=e.keyHooks.entries(),l={event:i,setData:(e,t)=>{n.setData(e,t)},getData:e=>n.getData(e),consume:e=>{let t=e?.preventDefault??!0,n=e?.stopPropagation??!0;t&&i.preventDefault(),n&&i.stopPropagation()}};for(let e of c)if(e.release===a){try{e.listener(l)}catch(e){t.emitError(`key-intercept-error`,e,`[Keymap] Error in key intercept listener:`)}if(i.propagationStopped){o&&j(o,i,a,s,{handled:!0,reason:`intercept-consumed`,sequence:[]});return}}if(a){let e=te(i);o&&j(o,i,a,s,e);return}let u=ne(i);o&&j(o,i,a,s,u)}function ee(n,r){return t.runWithStateChangeBatch(()=>{let i=e.disambiguationResolvers.has(),a=n();return!i&&e.disambiguationResolvers.has()&&c.recompileBindings(),()=>{t.runWithStateChangeBatch(()=>{let t=e.disambiguationResolvers.has();a(),!e.disambiguationResolvers.values().includes(r)&&t&&!e.disambiguationResolvers.has()&&c.recompileBindings()})}})}function te(e){let t=r.getFocusedTarget(),n=r.getActiveLayers(t),a=_e(e),o=M();for(let r of a)layerLoop:for(let a of n){if(a.bindings.length===0||!i.matchesConditions(a))continue;let n=ve(a,r,e,t);if(o=A(o,n.outcome),n.handled){if(n.stop)return o;continue layerLoop}}return o}function ne(e){let t=r.getFocusedTarget(),n=r.ensureValidPendingSequence(),i=_e(e);if(n)return re(n,i,e,t);let a=r.getActiveLayers(t),o=M();for(let n of i){let r=R(a,[n],e,t);if(o=A(o,r),r.handled)return o}return o}function re(t,n,i,a){let o=s.getActiveCommandView(a),c=[];for(let r of t.captures){let t=Tc(r,n,i,e.patterns,ye,be);t&&c.push(t)}let l=c.reduce((e,t)=>Math.min(e,Cc(t,n)),1/0),u=c.filter(e=>Cc(e,n)===l);if(u.length===0||!u.some(e=>we(e,a,o))){let e=O(`sequence-miss`,t.captures);return T(`sequence-clear`,t.captures,a),r.setPendingSequence(null),e}return L(u,0,!1,i,a)}function L(t,n,i,a,o){let s=i,c=M(),l=new Set;for(let i=n;i<t.length;i+=1){let n=t[i];if(!n||l.has(n))continue;let u=he(t,i,n);if(u.length>0){if(s)continue;let e=ge(t,n);return oe(t,i,u,e,a,o,s)||P(`sequence-advance`,u,o,a)}if(!vc(n,e.patterns))continue;let d=ge(t,n);for(let e of d)l.add(e);let f=Te(n.layer,d,a,o);if(c=A(c,f.outcome),f.handled&&(s=!0,f.stop))return T(`sequence-clear`,t,o),r.setPendingSequence(null),c}return T(`sequence-clear`,t,o),r.setPendingSequence(null),c}function R(e,t,n,r){return ie(e,0,t,n,r)}function ie(t,n,r,a,o){let c=s.getActiveCommandView(o),l=M();for(let s=n;s<t.length;s+=1){let n=t[s];if(!n||!i.matchesConditions(n))continue;let u=xe(n,r,a,o,c);if(u.length===0)continue;if(u.filter(t=>_c(t,e.patterns,!1)).length>0){let n=u.filter(t=>vc(t,e.patterns)),i=me(t,s,r,a,o);return ae(t,s,r,i,n,a,o)||P(`sequence-start`,i,o,a)}let d=Te(n,u.filter(t=>vc(t,e.patterns)),a,o);if(l=A(l,d.outcome),d.handled&&d.stop)return l}return l}function ae(e,t,n,i,a,o,s){return se({event:o,focused:s,continuationCaptures:i,exactBindingsSource:a.map(e=>e.binding),sequencePhase:`sequence-start`,runExact:()=>{r.setPendingSequence(null);let i=a[0]?.layer;if(!i)return M();let c=Te(i,a,o,s);return c.stop?c.outcome:A(c.outcome,ie(e,t+1,n,o,s))}})}function oe(e,t,n,i,a,o,s){return se({event:a,focused:o,continuationCaptures:n,exactBindingsSource:i.map(e=>e.binding),sequencePhase:`sequence-advance`,runExact:()=>{r.setPendingSequence(null);let n=i[0]?.layer;if(!n)return M();let c=Te(n,i,a,o);return c.stop?c.outcome:A(c.outcome,L(e,t+1,s||c.handled,a,o))}})}function se(t){let{event:n,focused:i,continuationCaptures:a,exactBindingsSource:o,sequencePhase:c,runExact:l}=t;if(!e.disambiguationResolvers.has()||a.length===0)return;let u=s.getActiveCommandView(i),d=r.collectMatchingBindings(o,i,u);if(!d.some(e=>e.command!==void 0))return;let f=()=>P(c,a,i,n),p=()=>F(`sequence-cleared`,a,i,n),m,h=()=>(m??=r.collectSequencePartsFromPending({captures:a}),m),g=z({event:n,focused:i,getSequence:h,exactBindings:d,continuationCaptures:a,activeView:u});return g?ce(g,a,l,f,p,i,h):(pe(h()),f())}function ce(e,t,n,r,i,a,o){if(e.action===`run-exact`)return n();if(e.action===`continue-sequence`)return r();if(e.action===`clear`)return i();let s=r();return le(t,e.handler,a,o(),e=>{if(e){if(e.action===`run-exact`){n();return}if(e.action===`continue-sequence`){r();return}i()}}),s}function z(i){let a,o,s,c,l={event:i.event,focused:i.focused,get sequence(){return a??=ec(i.getSequence()),a},get stroke(){let e=i.getSequence().at(-1);if(!e)throw Error(`Disambiguation context expected a non-empty sequence`);return c??={...e,stroke:Zs(e.stroke)},c},get exact(){return o??=r.collectActiveBindings(i.exactBindings,i.focused,i.activeView).map(e=>({...e,sequence:ec(e.sequence)})),o},get continuations(){return s??=r.getActiveKeysForCaptures(i.continuationCaptures,{includeBindings:!0,includeMetadata:!0}),s},getData:e=>n.getData(e),setData:(e,t)=>{n.setData(e,t)},runExact:()=>$l(`run-exact`),continueSequence:()=>$l(`continue-sequence`),clear:()=>$l(`clear`),defer:e=>$l(`defer`,e)};for(let n of e.disambiguationResolvers.values()){let e;try{e=n(l)}catch(e){t.emitError(`disambiguation-resolver-error`,e,`[Keymap] Error in disambiguation resolver:`);continue}if(e!==void 0){if(ll(e)){t.emitError(`invalid-disambiguation-resolver-return`,e,`[Keymap] Disambiguation resolvers must return synchronously; use ctx.defer(...) for async handling`);continue}if(!tu(e)){t.emitError(`invalid-disambiguation-decision`,e,`[Keymap] Invalid disambiguation decision returned by resolver:`);continue}return e}}}function le(e,t,n,r,i){fe();let a=new AbortController,o={id:f++,controller:a,captures:e,apply:i};d=o,queueMicrotask(()=>{B(o,t,n,r)})}function B(e,n,r,i){if(!V(e))return;let a={signal:e.controller.signal,sequence:ec(i),focused:r,sleep:t=>ru(t,e.controller.signal),runExact:()=>eu(`run-exact`),continueSequence:()=>eu(`continue-sequence`),clear:()=>eu(`clear`)},o;try{o=n(a)}catch(n){V(e)&&(t.emitError(`deferred-disambiguation-error`,n,`[Keymap] Error in deferred disambiguation handler:`),de(e));return}if(ll(o)){o.then(t=>{ue(e,t)}).catch(n=>{V(e)&&(t.emitError(`deferred-disambiguation-error`,n,`[Keymap] Error in deferred disambiguation handler:`),de(e))});return}ue(e,o)}function ue(e,n){if(V(e)){if(n!==void 0&&!nu(n)){t.emitError(`invalid-deferred-disambiguation-decision`,n,`[Keymap] Invalid deferred disambiguation decision returned by handler:`),de(e);return}de(e),e.apply(n)}}function de(e){V(e)&&(d=null)}function fe(){let e=d;e&&(d=null,e.controller.abort())}function V(e){return d===e}function pe(e){let n=ac(e,{preferDisplay:!0});t.warnOnce(`unresolved-disambiguation:${n}`,`unresolved-disambiguation`,{sequence:n},`[Keymap] Ambiguous exact/prefix sequence "${n}" fell back to prefix handling because no disambiguation resolver resolved it`)}function me(t,n,r,a,o){let c=[],l=s.getActiveCommandView(o);for(let s=n;s<t.length;s+=1){let n=t[s];if(n&&i.matchesConditions(n))for(let t of xe(n,r,a,o,l))_c(t,e.patterns,!1)&&c.push(t)}return c}function he(t,n,r){return t.filter((t,i)=>i>=n&&_c(t,e.patterns,!1)&&lu(t.parts,r.parts))}function ge(t,n){return t.filter(t=>t.layer===n.layer&&vc(t,e.patterns)&&lu(t.parts,n.parts))}function _e(n){let r=e.eventMatchResolvers.values();if(r.length===0)return[];if(r.length===1)return cu(r[0],n,u,t);let i=[],a=new Set;for(let e of r){let r;try{r=e(n,u)}catch(e){t.emitError(`event-match-resolver-error`,e,`[Keymap] Error in event match resolver:`);continue}if(!(!r||r.length===0))for(let e of r){if(typeof e!=`string`){t.emitError(`invalid-event-match-resolver-candidate`,e,`[Keymap] Invalid event match resolver candidate:`);continue}a.has(e)||(a.add(e),i.push(e))}}return i}function ve(e,t,n,r){let o=!1,s=M();for(let c of e.bindings){if(c.event!==`release`)continue;let l=c.sequence[0];if(!l||l.match!==t||!i.matchesConditions(c))continue;let u=a.runBinding(e,c,n,r);if(s=A(s,k(c,u)),!u){w(`binding-reject`,e,c,r);continue}if(w(`binding-execute`,e,c,r),o=!0,!c.fallthrough)return{handled:!0,stop:!0,outcome:s}}return{handled:o,stop:!1,outcome:s}}function ye(n,r){return iu(e.patterns,t,n,r)}function be(t,n,r){return au(e.patterns,t,n,r)}function xe(e,t,n,r,i){let a=Ec(e,t,n,ye,be);return a.some(e=>we(e,r,i))?a:[]}function Se(n){return ou(e.patterns,t,n)}function Ce(e,t,n){return i.matchesConditions(e)&&s.isBindingVisible(e,t,n)}function we(e,t,n){return Ce(e.binding,t,n)}function Te(e,t,n,r){let o=!1,s=M();for(let c of t){let t=c.binding;if(!i.matchesConditions(t))continue;let l=a.runBinding(e,t,n,r,Se(c));if(s=A(s,k(t,l)),!l){w(`binding-reject`,e,t,r);continue}if(w(`binding-execute`,e,t,r),o=!0,!t.fallthrough)return{handled:!0,stop:!0,outcome:s}}return{handled:o,stop:!1,outcome:s}}return{intercept:p,prependEventMatchResolver:m,appendEventMatchResolver:h,clearEventMatchResolvers:g,prependDisambiguationResolver:_,appendDisambiguationResolver:v,clearDisambiguationResolvers:y,handlePendingSequenceChange:b,handleRawSequence:x,handleKeyEvent:I}}function cu(e,t,n,r){let i;try{i=e(t,n)}catch(e){return r.emitError(`event-match-resolver-error`,e,`[Keymap] Error in event match resolver:`),[]}if(!i||i.length===0)return[];if(i.length===1){let[e]=i;return typeof e==`string`?[e]:(r.emitError(`invalid-event-match-resolver-candidate`,e,`[Keymap] Invalid event match resolver candidate:`),[])}let a=[],o=new Set;for(let e of i){if(typeof e!=`string`){r.emitError(`invalid-event-match-resolver-candidate`,e,`[Keymap] Invalid event match resolver candidate:`);continue}o.has(e)||(o.add(e),a.push(e))}return a}function lu(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]?.match!==t[n]?.match)return!1;return!0}var uu=()=>{};function du(e,t,n,r){if(n===void 0)return r;if(typeof n!=`number`||!Number.isInteger(n)||n<0)throw Error(`Keymap sequence pattern "${e}" ${t} must be a non-negative integer`);return n}function fu(e,t){let{kind:n,reservedFields:r,registeredFields:i,emitError:a}=t,o=Object.entries(e),s=[];for(let[e,t]of o){if(r.has(e)){a(`reserved-${n}-field`,{field:e,kind:n},`Keymap ${n} field "${e}" is reserved`);continue}if(i.has(e)){a(`duplicate-${n}-field`,{field:e,kind:n},`Keymap ${n} field "${e}" is already registered`);continue}i.set(e,t),s.push([e,t])}return()=>{for(let[e,t]of s)i.get(e)===t&&i.delete(e)}}function pu(e,t,n,r,i){let a;try{a=Js(i.name)}catch(e){return t.emitError(`token-name-normalize-error`,e,cl(e,`Failed to register keymap token`)),uu}if(e.tokens.has(a)||e.patterns.has(a))return t.emitError(`duplicate-token`,{token:a},`Keymap token "${a}" is already registered`),uu;let o;try{if(o=n.parseTokenKey(i.key),o.patternName)throw Error(`Invalid key "${String(i.key)}": expected a concrete key stroke`)}catch(e){return t.emitError(`token-parse-error`,e,cl(e,`Failed to register keymap token "${a}"`)),uu}let s={stroke:o.stroke,match:o.match},c=new Map(e.tokens);c.set(a,s);try{r.applyTokenState(c)}catch(e){return t.emitError(`token-register-error`,e,cl(e,`Failed to register keymap token "${a}"`)),uu}return()=>{if(e.tokens.get(a)!==s)return;let n=new Map(e.tokens);n.delete(a);try{r.applyTokenState(n)}catch(e){t.emitError(`token-unregister-error`,e,cl(e,`Failed to unregister keymap token "${a}"`))}}}function mu(e,t,n,r){let i,a;try{i=Js(r.name);let e=du(i,`min`,r.min,1),t=du(i,`max`,r.max,2**53-1);if(t<e)throw Error(`Keymap sequence pattern "${i}" max must be greater than or equal to min`);a={name:i,display:r.display,payloadKey:r.payloadKey??i,match:rc(`pattern:${i}`),min:e,max:t,matcher:e=>r.match(e),finalize:r.finalize}}catch(e){return t.emitError(`sequence-pattern-register-error`,e,cl(e,`Failed to register keymap sequence pattern`)),uu}return e.tokens.has(i)||e.patterns.has(i)?(t.emitError(`duplicate-sequence-pattern`,{pattern:i},`Keymap sequence pattern "${i}" is already registered`),uu):(e.patterns.set(i,a),n.recompileBindings(),()=>{e.patterns.get(i)===a&&(e.patterns.delete(i),n.recompileBindings())})}function hu(e,t,n,r){return fu(r,{kind:n,reservedFields:n===`layer`?Zc:n===`binding`?Xc:Yc,registeredFields:n===`layer`?e.layerFields:n===`binding`?e.bindingFields:e.commandFields,emitError:(e,n,r)=>t.emitError(e,n,r)})}var gu=()=>{};function _u(e,t){return t.priority-e.priority||t.order-e.order}function vu(e){if(e.matchers.length>0)return!0;for(let t of e.commands)if(t.matchers.length>0)return!0;for(let t of e.bindings)if(t.matchers.length>0)return!0;return!1}function yu(e){if(e.commands.length===0)return!1;if(e.matchers.length>0)return!0;for(let t of e.commands)if(t.matchers.length>0)return!0;return!1}function bu(e,t,n,r,i){let a=n=>t.runWithStateChangeBatch(()=>{let a=n.target;if(a&&i.host.isTargetDestroyed(a))return t.emitError(`destroyed-layer-target`,{target:a},`Cannot register a keymap layer for a destroyed keymap target`),gu;let o,s,c,p,m,v,y;try{y=l(n),o=u(Nc(n.bindings??[]),n);let e=d(n.commands??[],n);v=e.length===0?[]:i.commands.normalizeCommands(e),{requires:s,matchers:c,fields:p,attrs:m}=f(n)}catch(e){return t.emitError(`register-layer-failed`,e,cl(e,`Failed to register keymap layer`)),gu}let b=e.order++,x=i.compiler.compileBindings(o,e.tokens,a,b,p);if(x.bindings.length===0&&!x.hasTokenBindings&&v.length===0)return gu;i.diagnostics?.analyzeLayer({target:a,order:b,commands:v,sourceBindings:o,bindings:x.bindings,hasTokenBindings:x.hasTokenBindings});let S={order:b,target:a,targetMode:y,priority:n.priority??0,requires:s,matchers:c,fields:p,attrs:m,commands:v,sourceBindings:o,bindings:x.bindings,root:bc(x.bindings,e.patterns),hasTokenBindings:x.hasTokenBindings,activeKeyCacheBlocked:!1,activeCommandViewCacheBlocked:!1};_(S),e.layers.add(S),e.sortedLayers=[...e.sortedLayers,S].sort(_u),g(S);for(let e of S.commands)g(e);for(let e of S.bindings)g(e);return a&&(S.offTargetDestroy=i.host.onTargetDestroy(a,()=>{h(S)})),S.commands.length>0&&r.ensureValidPendingSequence(),t.queueStateChange(),()=>{h(S)}}),o=n=>{t.runWithStateChangeBatch(()=>{let i=new Map;for(let t of e.layers)t.hasTokenBindings&&i.set(t,p(t,n));e.tokens=n;let a=!1;for(let[e,t]of i)m(e,t)&&(a=!0);a&&r.setPendingSequence(null),i.size>0&&t.queueStateChange()})},s=()=>{t.runWithStateChangeBatch(()=>{let n=0,i=!1;for(let t of e.layers){if(t.sourceBindings.length===0)continue;let r=p(t,e.tokens);m(t,r)&&(i=!0),n+=1}i&&r.setPendingSequence(null),n>0&&t.queueStateChange()})},c=()=>{for(let t of e.layers){y(t);for(let e of t.commands)y(e);for(let e of t.bindings)y(e);t.offTargetDestroy?.(),t.offTargetDestroy=void 0}},l=e=>{if(e.targetMode){if(!e.target)throw Error(`Keymap targetMode "${e.targetMode}" requires a target`);return e.targetMode}return e.target?`focus-within`:void 0},u=(t,n)=>{let r=e.layerBindingsTransformers.values();if(r.length===0)return t;let i=t;for(let e of r){let t=e(i,{layer:n,validateBindings:e=>Mc(e)});t&&(i=Nc(t))}return i},d=(n,r)=>{let i=e.commandTransformers.values();if(n.length===0||i.length===0)return n;let a=[];for(let e of n){let n={...e},o=[],s=!0;for(let e of i)try{e(n,{layer:r,add(e){o.push({...e})},skipOriginal(){s=!1}})}catch(e){t.emitError(`command-transformer-error`,e,`[Keymap] Error in command transformer:`)}s&&a.push(n),a.push(...o)}return a},f=t=>{let r={},a=[],o=Object.create(null),s={};for(let[c,l]of Object.entries(t)){if(Zc.has(c)||l===void 0)continue;o[c]=ul(l);let t=e.layerFields.get(c);if(!t){i.warnUnknownField(`layer`,c);continue}t(l,ol({fieldName:c,conditions:n,requirements:r,matchers:a,attrs:s}))}return{requires:Object.entries(r),matchers:a,fields:Object.keys(o).length>0?Object.freeze(o):void 0,attrs:Object.keys(s).length>0?ul(s,{freeze:!0}):void 0}},p=(e,t)=>i.compiler.compileBindings(e.sourceBindings,t,e.target,e.order,e.fields),m=(t,n)=>{i.diagnostics?.analyzeLayer({target:t.target,order:t.order,commands:t.commands,sourceBindings:t.sourceBindings,bindings:n.bindings,hasTokenBindings:n.hasTokenBindings}),v(t);for(let e of t.bindings)y(e);t.bindings=n.bindings,t.root=bc(n.bindings,e.patterns),t.hasTokenBindings=n.hasTokenBindings,_(t);for(let e of t.bindings)g(e);return e.pending?.captures.some(e=>e.layer===t)??!1},h=n=>{t.runWithStateChangeBatch(()=>{if(e.layers.delete(n)){e.sortedLayers=e.sortedLayers.filter(e=>e!==n),v(n),y(n);for(let e of n.commands)y(e);for(let e of n.bindings)y(e);n.offTargetDestroy?.(),n.offTargetDestroy=void 0,e.pending?.captures.some(e=>e.layer===n)?r.setPendingSequence(null):n.commands.length>0&&!i.host.isDestroyed&&r.ensureValidPendingSequence(),t.queueStateChange()}})},g=e=>{for(let n of e.matchers)if(n.subscribe)try{n.dispose=n.subscribe(()=>{if(!r.hasPendingSequenceState()){t.queueStateChange();return}t.runWithStateChangeBatch(()=>{r.revalidatePendingSequenceIfNeeded(),t.queueStateChange()})})}catch(e){t.emitError(`reactive-matcher-subscribe-error`,e,cl(e,`Failed to subscribe to reactive matcher from ${n.source}`))}},_=t=>{let n=vu(t),r=yu(t);t.activeKeyCacheBlocked=n,t.activeCommandViewCacheBlocked=r,n&&(e.activeKeyCacheBlockers+=1),r&&(e.activeCommandViewCacheBlockers+=1)},v=t=>{t.activeKeyCacheBlocked&&=(--e.activeKeyCacheBlockers,!1),t.activeCommandViewCacheBlocked&&=(--e.activeCommandViewCacheBlockers,!1)},y=e=>{for(let n of e.matchers)if(n.dispose){try{n.dispose()}catch(e){t.emitError(`reactive-matcher-dispose-error`,e,cl(e,`Failed to dispose reactive matcher from ${n.source}`))}n.dispose=void 0}};return{registerLayer:a,applyTokenState:o,recompileBindings:s,cleanup:c}}var xu=1e3;function Su(e,t,n){let r=(e,n,r)=>{if(!t.has(`warning`)){let t=`[${e}] ${r}`;n instanceof Error?console.warn(t,n):console.warn(t);return}t.emit(`warning`,{code:e,message:r,warning:n})},i=(e,n,r)=>{if(!t.has(`error`)){let t=`[${e}] ${r}`;n instanceof Error?console.error(t,n):console.error(t);return}t.emit(`error`,{code:e,message:r,error:n})},a=()=>{if(!(!e.stateChangePending||e.stateChangeDepth>0||e.flushingStateChange)){e.flushingStateChange=!0;try{let t=0;for(;e.stateChangePending&&e.stateChangeDepth===0;){if(t>=xu){e.stateChangePending=!1,i(`state-change-feedback-loop`,{iterations:xu},`[Keymap] Possible infinite state listener feedback loop detected after ${xu} iterations; pending state notifications were dropped`);break}t+=1,e.stateChangePending=!1,n.emit(`state`)}}finally{e.flushingStateChange=!1}}};return{runWithStateChangeBatch(t){e.stateChangeDepth+=1;try{return t()}finally{--e.stateChangeDepth,e.stateChangeDepth===0&&a()}},queueStateChange(t){e.derivedVersion+=1,t?.invalidateCaches!==!1&&(e.cacheVersion+=1),n.has(`state`)&&(e.stateChangePending=!0,e.stateChangeDepth===0&&!e.flushingStateChange&&a())},emitWarning:r,emitError:i,reportListenerError(e,t){if(e===`state`){i(`state-listener-error`,t,`[Keymap] Error in state listener:`);return}if(e===`pendingSequence`){i(`pending-sequence-listener-error`,t,`[Keymap] Error in pending sequence listener:`);return}e===`dispatch`&&i(`dispatch-listener-error`,t,`[Keymap] Error in dispatch listener:`)},warnOnce(t,n,i,a){e.usedWarningKeys.has(t)||(e.usedWarningKeys.add(t),r(n,i,a))}}}function Cu(e,t,n){return{getData(t){return e.data[t]},setData(r,i){t.runWithStateChangeBatch(()=>{if(i===void 0){if(!(r in e.data))return;delete e.data[r],e.dataVersion+=1,n.ensureValidPendingSequence(),t.queueStateChange();return}Object.is(e.data[r],i)||(e.data[r]=i,e.dataVersion+=1,n.ensureValidPendingSequence(),t.queueStateChange())})},getReadonlyData(){return e.readonlyDataVersion===e.dataVersion?e.readonlyData:(e.readonlyData=Object.freeze({...e.data}),e.readonlyDataVersion=e.dataVersion,e.readonlyData)}}}var wu=Object.freeze({});function Tu(){return{order:0,tokens:new Map,patterns:new Map,layerFields:new Map,layerBindingsTransformers:kc(),bindingExpanders:kc(),bindingParsers:kc(),bindingTransformers:kc(),bindingFields:new Map,commandTransformers:kc(),commandFields:new Map,eventMatchResolvers:kc(),disambiguationResolvers:kc(),keyHooks:Ac(),keyAfterHooks:Ac(),rawHooks:Ac(),layers:new Set,sortedLayers:[],activeLayersCacheVersion:-1,activeLayersCacheFocused:void 0,activeLayersCache:[],activeKeyCacheBlockers:0,activeCommandViewCacheBlockers:0,commandResolvers:kc(),pending:null,data:{},dataVersion:0,readonlyDataVersion:-1,readonlyData:wu,cacheVersion:0,derivedVersion:0,stateChangeDepth:0,stateChangePending:!1,flushingStateChange:!1,usedWarningKeys:new Set}}function Eu(e){return tc(e)}var Du=class{#e=Tu();#t=!1;#n=new Map;#r=[];#i=Dc(()=>{});#a;#o;#s;#c;#l;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y;#b;getPendingSequence;getActiveKeys;constructor(e){if(this.#b=e,e.isDestroyed)throw Error(`Cannot create a keymap for a destroyed host`);this.#a=Dc((e,t)=>{this.#o.reportListenerError(e,t)}),this.#o=Su(this.#e,this.#i,this.#a),this.#l=Xl(this.#e,this.#o),this.#u=ml(this.#e,this.#b,this.#o,this.#l,{onCommandResolversChanged:()=>{this.#s.ensureValidPendingSequence()}}),this.#s=Jc(this.#e,this.#b,this.#a,this.#o,this.#l,this.#u,{onPendingSequenceChanged:(e,t)=>{this.#p?.handlePendingSequenceChange(e,t)}}),this.#c=Cu(this.#e,this.#o,this.#s),this.#d=Fl(this.#o,this.#c,this.#s,this.#u,{keymap:this,createCommandEvent:()=>this.#b.createCommandEvent()}),this.#f=Hl(this.#e,this.#o,this.#l,{warnUnknownField:(e,t)=>{this.#C(e,t)},warnUnknownToken:(e,t)=>{this.#w(e,t)}}),this.#h=Fc(this.#o,this.#u),this.#m=bu(this.#e,this.#o,this.#l,this.#s,{compiler:this.#f,commands:this.#u,host:this.#b,diagnostics:this.#h,warnUnknownField:(e,t)=>{this.#C(e,t)}}),this.#p=su(this.#e,this.#o,this.#c,this.#s,this.#l,this.#d,this.#f,this.#u,this.#m,this.#a),this.getPendingSequence=this.#s.getPendingSequence,this.getActiveKeys=this.#s.getActiveKeys,this.#g=e=>{this.#p.handleKeyEvent(e,!1)},this.#_=e=>{this.#p.handleKeyEvent(e,!0)},this.#v=e=>this.#p.handleRawSequence(e),this.#y=e=>{this.#S(e)},this.#r.push(this.#b.onKeyPress(this.#g)),this.#r.push(this.#b.onKeyRelease(this.#_)),this.#b.onRawInput&&this.#r.push(this.#b.onRawInput(this.#v)),this.#r.push(this.#b.onFocusChange(this.#y)),this.#b.onDestroy&&this.#r.push(this.#b.onDestroy(()=>{this.#x()}))}[cc](){return{state:this.#e,host:this.#b,conditions:this.#l,catalog:this.#u,activation:this.#s}}#x(){if(!this.#t){this.#t=!0,this.#s.setPendingSequence(null);for(let e of this.#n.values())e.dispose();this.#n.clear(),this.#m.cleanup();for(let e of this.#r.splice(0))e()}}setData(e,t){this.#c.setData(e,t)}getData(e){return this.#c.getData(e)}getHostMetadata(){return this.#b.metadata}hasPendingSequence(){return this.#s.ensureValidPendingSequence()!==void 0}createKeyMatcher(e){let t=this.#f.parseTokenKey(e).match;return e=>e?Eu(e)===t:!1}parseKeySequence(e){return this.#f.parseKeySequence(e)}formatKey(e,t){return this.#f.formatKey(e,t)}clearPendingSequence(){this.#s.setPendingSequence(null)}popPendingSequence(){return this.#s.popPendingSequence()}getCommands(e){return this.#u.getCommands(e)}getCommandEntries(e){return this.#u.getCommandEntries(e)}getCommandBindings(e){return this.#u.getCommandBindings(e)}acquireResource(e,t){if(this.#t||this.#b.isDestroyed)throw Error(`Cannot use a keymap after its host was destroyed`);let n=this.#n.get(e);if(n)return n.count+=1,()=>{this.#T(e,n)};let r={count:1,dispose:t()};return this.#n.set(e,r),()=>{this.#T(e,r)}}runCommand(e,t){return this.#d.runCommand(e,t)}dispatchCommand(e,t){return this.#d.dispatchCommand(e,t)}on(e,t){return e===`warning`||e===`error`?this.#i.hook(e,t):this.#a.hook(e,t)}intercept(e,t,n){return this.#p.intercept(e,t,n)}registerLayer(e){return this.#m.registerLayer(e)}registerLayerFields(e){return hu(this.#e,this.#o,`layer`,e)}prependLayerBindingsTransformer(e){return this.#e.layerBindingsTransformers.prepend(e)}appendLayerBindingsTransformer(e){return this.#e.layerBindingsTransformers.append(e)}clearLayerBindingsTransformers(){this.#e.layerBindingsTransformers.clear()}prependBindingTransformer(e){return this.#e.bindingTransformers.prepend(e)}appendBindingTransformer(e){return this.#e.bindingTransformers.append(e)}clearBindingTransformers(){this.#e.bindingTransformers.clear()}prependCommandTransformer(e){return this.#e.commandTransformers.prepend(e)}appendCommandTransformer(e){return this.#e.commandTransformers.append(e)}clearCommandTransformers(){this.#e.commandTransformers.clear()}prependBindingParser(e){return this.#e.bindingParsers.prepend(e)}appendBindingParser(e){return this.#e.bindingParsers.append(e)}clearBindingParsers(){this.#e.bindingParsers.clear()}registerToken(e){return pu(this.#e,this.#o,this.#f,this.#m,e)}registerSequencePattern(e){return mu(this.#e,this.#o,this.#m,e)}prependBindingExpander(e){return this.#e.bindingExpanders.prepend(e)}appendBindingExpander(e){return this.#e.bindingExpanders.append(e)}clearBindingExpanders(){this.#e.bindingExpanders.clear()}registerBindingFields(e){return hu(this.#e,this.#o,`binding`,e)}registerCommandFields(e){return hu(this.#e,this.#o,`command`,e)}prependCommandResolver(e){return this.#u.prependCommandResolver(e)}appendCommandResolver(e){return this.#u.appendCommandResolver(e)}clearCommandResolvers(){this.#u.clearCommandResolvers()}prependLayerAnalyzer(e){return this.#h.prependLayerAnalyzer(e)}appendLayerAnalyzer(e){return this.#h.appendLayerAnalyzer(e)}clearLayerAnalyzers(){this.#h.clearLayerAnalyzers()}prependEventMatchResolver(e){return this.#p.prependEventMatchResolver(e)}appendEventMatchResolver(e){return this.#p.appendEventMatchResolver(e)}clearEventMatchResolvers(){this.#p.clearEventMatchResolvers()}prependDisambiguationResolver(e){return this.#p.prependDisambiguationResolver(e)}appendDisambiguationResolver(e){return this.#p.appendDisambiguationResolver(e)}clearDisambiguationResolvers(){this.#p.clearDisambiguationResolvers()}#S(e){this.#o.runWithStateChangeBatch(()=>{this.#s.setPendingSequence(null),this.#o.queueStateChange({invalidateCaches:!1})})}#C(e,t){this.#o.warnOnce(`${e}:${t}`,`unknown-${e}-field`,{field:t,kind:e},`[Keymap] Unknown ${e} field "${t}" was ignored`)}#w(e,t){this.#o.warnOnce(`token:${e}`,`unknown-token`,{token:e,sequence:t},`[Keymap] Unknown token "${e}" in key sequence "${t}"; binding was skipped until the token is registered`)}#T(e,t){this.#n.get(e)===t&&(--t.count,!(t.count>0)&&(t.dispose(),this.#n.delete(e)))}},Ou=new Set(`up.down.left.right.clear.escape.return.linefeed.enter.tab.backspace.delete.insert.home.end.pageup.pagedown.space.lt.gt.plus.minus.equal.comma.period.slash.backslash.semicolon.quote.backquote.leftbracket.rightbracket.capslock.numlock.scrolllock.printscreen.pause.menu.apps.kp0.kp1.kp2.kp3.kp4.kp5.kp6.kp7.kp8.kp9.kpdecimal.kpdivide.kpmultiply.kpminus.kpplus.kpenter.kpequal.kpseparator.kpleft.kpright.kpup.kpdown.kppageup.kppagedown.kphome.kpend.kpinsert.kpdelete.mediaplay.mediapause.mediaplaypause.mediareverse.mediastop.mediafastforward.mediarewind.medianext.mediaprev.mediarecord.volumedown.volumeup.mute.leftshift.leftctrl.leftalt.leftsuper.lefthyper.leftmeta.rightshift.rightctrl.rightalt.rightsuper.righthyper.rightmeta.iso_level3_shift.iso_level5_shift.option.alt.meta.super.hyper.control.ctrl.shift`.split(`.`)),ku=new Set([`ctrl`,`control`,`shift`,`meta`,`alt`,`option`,`super`,`hyper`]),Au=Mu(Ou),ju=Mu(ku);function Mu(e){let t=new Map;for(let n of e){let e=n.charCodeAt(0);if(Number.isNaN(e))continue;let r=t.get(e);r||(r=[],t.set(e,r)),r.push(n)}for(let e of t.values())e.sort((e,t)=>t.length-e.length);return t}function Nu(e){return e>=65&&e<=90?e+32:e}function Pu(e){return e>=48&&e<=57}function Fu(e,t,n){if(e.startsWith(t,n))return!0;if(n+t.length>e.length)return!1;for(let r=0;r<t.length;r+=1)if(Nu(e.charCodeAt(n+r))!==t.charCodeAt(r))return!1;return!0}function Iu(e,t,n){let r=t.charCodeAt(n);if(Number.isNaN(r))return;let i=e.get(Nu(r));if(i){for(let e of i)if(Fu(t,e,n))return e}}function Lu(e,t,n,r,i){return e.parseObjectKey(t,{display:n,match:r,tokenName:i})}function Ru(e,t){if(e===` `)return t.parseObjectKey({name:`space`},{display:`space`});if(e===`+`)return t.parseObjectKey({name:`+`},{display:`+`});let n=e.split(`+`),r=``,i=``,a=!1,o=!1,s=!1,c=!1,l=!1;for(let t of n){let n=t.trim();if(!n)continue;let u=n.toLowerCase();if(u===`ctrl`||u===`control`){a=!0;continue}if(u===`shift`){o=!0;continue}if(u===`meta`||u===`alt`||u===`option`){s=!0;continue}if(u===`super`){c=!0;continue}if(u===`hyper`){l=!0;continue}if(r)throw Error(`Invalid key "${e}": multiple key names are not supported`);r=n,i=u}if(!r)throw Error(`Invalid key "${e}": missing key name`);let u=[];return a&&u.push(`ctrl`),o&&u.push(`shift`),s&&u.push(`meta`),c&&u.push(`super`),l&&u.push(`hyper`),u.push(i),t.parseObjectKey({name:r,ctrl:a,shift:o,meta:s,super:c,hyper:l||void 0},{display:u.join(`+`)})}function zu(e,t){let n=e.trim().toLowerCase();return t.parseObjectKey({name:n},{display:n})}function Bu(e,t){let n=Iu(Au,e,t);if(n)return n;if(Nu(e.charCodeAt(t))!==102||!Pu(e.charCodeAt(t+1)))return;let r=Pu(e.charCodeAt(t+2))?t+3:t+2;return e.slice(t,r).toLowerCase()}function Vu(e,t){return Iu(ju,e,t)}function Hu(e,t,n){let r=t,i=!1,a=!1,o=!1,s=!1,c=!1;for(;r<e.length;){let t=Vu(e,r);if(!t)break;let n=r+t.length;if(e[n]!==`+`)break;t===`ctrl`||t===`control`?i=!0:t===`shift`?a=!0:t===`meta`||t===`alt`||t===`option`?o=!0:t===`super`?s=!0:t===`hyper`&&(c=!0),r=n+1}if(r===t)return;let l=e[r];if(l===void 0)throw Error(`Invalid key "${e.slice(t)}": missing key name`);let u=Bu(e,r)??l,d=u===` `?`space`:u===`+`?`+`:u.toLowerCase(),f=[];return i&&f.push(`ctrl`),a&&f.push(`shift`),o&&f.push(`meta`),s&&f.push(`super`),c&&f.push(`hyper`),f.push(d),{part:n.parseObjectKey({name:u===` `?`space`:u,ctrl:i,shift:a,meta:o,super:s,hyper:c||void 0},{display:f.join(`+`)}),nextIndex:r+u.length}}var Uu=e=>{let{input:t,index:n,tokens:r,normalizeTokenName:i}=e;if(n===0&&t.includes(`+`)&&/\s/.test(t))return{parts:[Ru(t,e)],nextIndex:t.length};let a=t[n];if(a===void 0)return;if(a===`<`){let o=t.indexOf(`>`,n);if(o===-1)return{parts:[Ru(a,e)],nextIndex:n+1};let s=i(t.slice(n+1,o)),c=r.get(s);return c?{parts:[Lu(e,c.stroke,`<${s}>`,c.match,s)],nextIndex:o+1,usedTokens:[s]}:{parts:[],nextIndex:o+1,unknownTokens:[s]}}if(a===`{`){let r=t.indexOf(`}`,n);if(r===-1)return{parts:[Ru(a,e)],nextIndex:n+1};let o=i(t.slice(n+1,r)),s=e.patterns.get(o);return s?{parts:[{...e.parseObjectKey({name:o,ctrl:!1,shift:!1,meta:!1,super:!1},{display:s.display??`{${o}}`,match:s.match}),patternName:s.name,payloadKey:s.payloadKey}],nextIndex:r+1,usedTokens:[o]}:{parts:[],nextIndex:r+1,unknownTokens:[o]}}let o=Hu(t,n,e);if(o)return{parts:[o.part],nextIndex:o.nextIndex};let s=Bu(t,n);return s?{parts:[zu(s,e)],nextIndex:n+s.length}:{parts:[Ru(a,e)],nextIndex:n+1}},Wu=(e,t)=>[t.resolveKey({name:e.name,ctrl:e.ctrl,shift:e.shift,meta:e.meta,super:e.super??!1,hyper:e.hyper||void 0})];function Gu(e){return e.appendBindingParser(e=>Uu(e))}function Ku(e){return e.appendEventMatchResolver((e,t)=>Wu(e,t))}function qu(e){let t=Gu(e),n=Ku(e);return()=>{n(),t()}}var Ju=Symbol(`keymap:mod-bindings`),Yu=/(^|[+,\s])mod(?=\s*\+)/i,Xu=/(^|[+,\s])mod(?=\s*\+)/gi;function Zu(e){let t=e.primaryModifier;return(t===`ctrl`||t===`super`)&&e.modifiers[t]!==`unsupported`?t:e.modifiers.ctrl===`unsupported`?`super`:`ctrl`}function Qu(e){if(e.includes(`,`))return[e];let t=e.trim();return t.includes(` `)?t.split(/\s+/):[e]}function $u(e){return e.acquireResource(Ju,()=>e.appendBindingExpander(({input:t,displays:n})=>{if(!Yu.test(t))return;let r=Zu(e.getHostMetadata());return[{key:t.replace(Xu,(e,t)=>`${t}${r}`),displays:n??Qu(t)}]}))}var ed=new Map([[` `,`space`],[`Spacebar`,`space`],[`ArrowUp`,`up`],[`ArrowDown`,`down`],[`ArrowLeft`,`left`],[`ArrowRight`,`right`],[`Escape`,`escape`],[`Esc`,`escape`],[`Enter`,`return`],[`Backspace`,`backspace`],[`Delete`,`delete`],[`Tab`,`tab`],[`Home`,`home`],[`End`,`end`],[`PageUp`,`pageup`],[`PageDown`,`pagedown`],[`Insert`,`insert`],[`CapsLock`,`capslock`],[`NumLock`,`numlock`],[`ScrollLock`,`scrolllock`],[`ContextMenu`,`menu`],[`Meta`,`super`],[`OS`,`super`],[`Alt`,`alt`],[`Control`,`control`],[`Shift`,`shift`]]);function td(e){let t=e?.trim().toLowerCase();return t?t.includes(`mac`)||t.includes(`darwin`)?`macos`:t.includes(`win`)?`windows`:t.includes(`linux`)||t.includes(`x11`)?`linux`:`unknown`:`unknown`}function nd(){let e=globalThis.navigator,t=e?.userAgentData?.platform,n=td(t);return n===`unknown`?td(e?.platform??e?.userAgent):n}function rd(){let e=nd();return{platform:e,primaryModifier:e===`macos`?`super`:e===`unknown`?`unknown`:`ctrl`,modifiers:{ctrl:`supported`,shift:`supported`,meta:`supported`,super:`supported`,hyper:`unsupported`}}}function id(e){return e.length===1&&!/^[a-z0-9]$/i.test(e)}function ad(e){let t={name:e.name,ctrl:e.ctrl,shift:e.shift,meta:e.meta,super:e.super??!1,hyper:e.hyper||void 0};return!t.shift||!id(t.name)?[t]:[t,{...t,shift:!1}]}var od=class{name;ctrl;shift;meta;superKey;originalEvent;propagationStopped=!1;constructor(e,t,n,r,i,a){this.name=e,this.ctrl=t,this.shift=n,this.meta=r,this.superKey=i,this.originalEvent=a}get super(){return this.superKey}preventDefault(){this.originalEvent?.preventDefault()}stopPropagation(){this.propagationStopped=!0,this.originalEvent?.stopPropagation()}};function sd(){return globalThis.MutationObserver}function cd(e){return ed.get(e)||(/^F\d{1,2}$/i.test(e)||e.length===1?e.toLowerCase():e.trim().toLowerCase().replace(/\s+/g,``))}function ld(e){if(!e)return new od(`command`,!1,!1,!1,!1);let t=globalThis.KeyboardEvent;return new od(cd(e.key),e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,t&&e instanceof t?e:void 0)}var ud=class{metadata=rd();rootTarget;isDestroyed=!1;observer;targetDestroyListeners=new Map;constructor(e){this.rootTarget=e}getFocusedTarget(){let e=this.rootTarget.ownerDocument.activeElement;return!e||typeof e!=`object`?null:e===this.rootTarget||this.rootTarget.contains(e)?e:null}getParentTarget(e){return e.parentElement}isTargetDestroyed(e){return e===this.rootTarget?!1:!e.isConnected||!this.rootTarget.contains(e)}onKeyPress(e){let t=t=>{e(ld(t))};return this.rootTarget.addEventListener(`keydown`,t,{capture:!0}),()=>{this.rootTarget.removeEventListener(`keydown`,t,{capture:!0})}}onKeyRelease(e){let t=t=>{e(ld(t))};return this.rootTarget.addEventListener(`keyup`,t,{capture:!0}),()=>{this.rootTarget.removeEventListener(`keyup`,t,{capture:!0})}}onFocusChange(e){let t=()=>{queueMicrotask(()=>{e(this.getFocusedTarget())})};return this.rootTarget.addEventListener(`focusin`,t,{capture:!0}),this.rootTarget.addEventListener(`focusout`,t,{capture:!0}),()=>{this.rootTarget.removeEventListener(`focusin`,t,{capture:!0}),this.rootTarget.removeEventListener(`focusout`,t,{capture:!0})}}onTargetDestroy(e,t){let n=this.targetDestroyListeners.get(e);return n||(n=new Set,this.targetDestroyListeners.set(e,n)),n.add(t),this.ensureObserver(),this.flushDisconnectedTargets(),()=>{let n=this.targetDestroyListeners.get(e);n&&(n.delete(t),n.size===0&&this.targetDestroyListeners.delete(e),this.targetDestroyListeners.size===0&&this.disconnectObserver())}}createCommandEvent(){return ld()}ensureObserver(){if(this.observer||this.targetDestroyListeners.size===0)return;let e=sd();e&&(this.observer=new e(()=>{this.flushDisconnectedTargets()}),this.observer.observe(this.rootTarget,{childList:!0,subtree:!0}))}disconnectObserver(){this.observer&&=(this.observer.disconnect(),void 0)}flushDisconnectedTargets(){for(let[e,t]of this.targetDestroyListeners)if(this.isTargetDestroyed(e)){this.targetDestroyListeners.delete(e);for(let e of[...t])e()}this.targetDestroyListeners.size===0&&this.disconnectObserver()}};function dd(e){return new ud(e)}var fd=(e,t)=>ad(e).map(e=>t.resolveKey(e));function pd(e){return e instanceof G?{code:e.code,message:hd(e.message),retryable:e.retryable,...e.need!==void 0&&{need:e.need}}:{code:`HOST_FAILURE`,message:`Host operation failed`,retryable:!1}}function md(e){try{let t=Vt(e);return new G(t.message,{code:t.code,retryable:t.retryable,...t.need!==void 0&&{need:t.need}})}catch(e){return new G(`The host returned a malformed error`,{cause:e,code:`PROTOCOL`,retryable:!1})}}function hd(e){return e.trim().slice(0,512)||`Host operation failed`}var gd=e=>({ok:!0,value:e}),_d=e=>({error:pd(e),ok:!1});async function vd(e,t){let n,r=new Set;try{return n=await e,yd(t(n))}catch(e){throw bd(e)&&xd(e,r),e instanceof G?e:new G(`The remote operation failed`,{cause:e,code:`HOST_FAILURE`,retryable:!0})}finally{n!==e&&bd(n)&&xd(n,r)}}function yd(e){if(e.ok)return e.value;throw md(e.error)}function bd(e){return mn(e)&&Symbol.dispose in e&&m(e[Symbol.dispose])}function xd(e,t){if(!t.has(e)){t.add(e);try{e[Symbol.dispose]()}catch(e){console.warn(`RPC result disposal failed`,e)}}}function Sd(){let e=[],t=new Set;return{get:()=>e,subscribe:e=>(t.add(e),()=>t.delete(e)),update:n=>{e=n;for(let e of Array.from(t))try{e()}catch(e){console.warn(`App binding subscriber failed`,e)}}}}function Cd(e){let t=yt(e),n=new Set;return{get:()=>t,subscribe:e=>(n.add(e),()=>n.delete(e)),update:e=>{t=yt(e);for(let e of Array.from(n))try{e()}catch(e){console.warn(`Reserved chord subscriber failed`,e)}}}}function wd(e){let t=!0,n,r=e.window.document.querySelector(`html`);if(!r)return()=>{t=!1};let i=dd(r),a=new Du(i);qu(a),$u(a),a.prependEventMatchResolver(fd);let o=Ed(e.onBroken),s=Ad(a,e.chords,e.remote,o),c=Td(e,o,()=>t,e=>{n=e},()=>n),l=i.onFocusChange(()=>{queueMicrotask(c)}),u=()=>{queueMicrotask(c)};e.window.addEventListener(`focus`,u),e.window.addEventListener(`blur`,u);let d=e.bindings,f=()=>Dd(e.window.document,e.identity.surfaceId).editing,p=d===void 0?()=>void 0:Od(a,d,f),m=d===void 0?()=>void 0:d.subscribe(()=>{p(),p=Od(a,d,f)}),h=e.chords.subscribe(()=>{s(),s=Ad(a,e.chords,e.remote,o)});return queueMicrotask(c),()=>{t&&(t=!1,l(),e.window.removeEventListener(`focus`,u),e.window.removeEventListener(`blur`,u),h(),s(),m(),p())}}function Td(e,t,n,r,i){return()=>{if(!n())return;let a=Dd(e.window.document,e.identity.surfaceId),o=i();(a.editing!==o?.editing||a.surface!==o.surface)&&(r(a),t(()=>e.remote.reportFocus(a)))}}function Ed(e){return t=>{try{vd(t(),we).catch(t=>{Ma(`browser-bridge.host-call`,t),e(t)})}catch(t){Ma(`browser-bridge.host-call`,t),e(t)}}}function Dd(e,t){let n=e.activeElement;return wt({editing:!!(n?.matches(`input, textarea, select, [contenteditable='true']`)===!0||n?.closest(`[contenteditable='true']`)),surface:e.hasFocus()?t:null})}function Od(e,t,n){let r=t.get();return e.registerLayer({bindings:r.map((e,t)=>({cmd:`app/${String(t)}`,key:e.key})),commands:r.map((e,t)=>({name:`app/${String(t)}`,run:t=>{let r=t.event.originalEvent;if(r?.defaultPrevented||r?.isComposing||kd(e.key)&&n())return!1;e.run()}})),priority:500})}function kd(e){return!/(?:^|\+)(?:ctrl|control|super|meta|cmd|alt|option|mod)\+/iu.test(e)}function Ad(e,t,n,r){let i=t.get();return e.registerLayer({bindings:i.map(e=>({cmd:`reserved/${e.id}`,key:{ctrl:e.ctrlKey,meta:e.altKey,name:cd(e.key),shift:e.shiftKey,super:e.metaKey}})),commands:i.map(e=>({name:`reserved/${e.id}`,run:t=>{let i=t.event.originalEvent;if(i?.defaultPrevented||i?.isComposing)return!1;r(()=>n.invokeReservedChord(e.id,i?.repeat??!1))}})),priority:1e3})}function jd(e){let t=t=>{if(t.defaultPrevented||t.isComposing)return;let n=Pd(t,e.mac);n!==null&&(t.preventDefault(),!t.repeat&&(n===`back`&&e.canGoBack()&&e.back(),n===`forward`&&e.canGoForward()&&e.forward()))},n=t=>{let n=Nd(t.button);if(n===null)return;let r=t.defaultPrevented;t.preventDefault(),!(t.type!==`mouseup`||r)&&(n===`back`&&e.canGoBack()&&e.back(),n===`forward`&&e.canGoForward()&&e.forward())};e.window.addEventListener(`keydown`,t);for(let t of Md)e.window.addEventListener(t,n);return()=>{e.window.removeEventListener(`keydown`,t);for(let t of Md)e.window.removeEventListener(t,n)}}var Md=[`mousedown`,`mouseup`,`auxclick`];function Nd(e){return e===3?`back`:e===4?`forward`:null}function Pd(e,t){return e.shiftKey||e.ctrlKey?null:t?!e.metaKey||e.altKey?null:e.key===`[`?`back`:e.key===`]`?`forward`:Fd(e.target)?null:e.key===`ArrowLeft`?`back`:e.key===`ArrowRight`?`forward`:null:!e.altKey||e.metaKey?null:e.key===`ArrowLeft`?`back`:e.key===`ArrowRight`?`forward`:null}function Fd(e){return e instanceof HTMLElement?e.isContentEditable||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement:!1}function Id(){return!De(globalThis.navigator)&&/Mac|iPhone|iPad/u.test(globalThis.navigator.userAgent)}var Ld=[];for(let e=0;e<256;++e)Ld.push((e+256).toString(16).slice(1));function Rd(e,t=0){return(Ld[e[t+0]]+Ld[e[t+1]]+Ld[e[t+2]]+Ld[e[t+3]]+`-`+Ld[e[t+4]]+Ld[e[t+5]]+`-`+Ld[e[t+6]]+Ld[e[t+7]]+`-`+Ld[e[t+8]]+Ld[e[t+9]]+`-`+Ld[e[t+10]]+Ld[e[t+11]]+Ld[e[t+12]]+Ld[e[t+13]]+Ld[e[t+14]]+Ld[e[t+15]]).toLowerCase()}var zd,Bd=new Uint8Array(16);function Vd(){if(!zd){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);zd=crypto.getRandomValues.bind(crypto)}return zd(Bd)}var Hd={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Ud(e,t,n){if(Hd.randomUUID&&!t&&!e)return Hd.randomUUID();e||={};let r=e.random??e.rng?.()??Vd();if(r.length<16)throw Error(`Random bytes length must be >= 16`);if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return Rd(r)}var Wd=xt({version:`v7`}),Gd=K().regex(/^replay_[a-f0-9]{64}$/);ne(e=>Gd.safeParse(e).success);var Kd=xt({version:`v4`});ne(e=>Wd.safeParse(e).success);var qd=ne(e=>Kd.safeParse(e).success);function Jd(){return qd.parse(Ud())}var Yd=class extends jt{#e=!0;#t;#n=new Map;constructor(e){super(),this.#t=e}cancel(e){try{return this.#n.get(He(e))?.abort(),Promise.resolve(gd(void 0))}catch(e){return Promise.resolve(_d(e))}}dispose(){if(this.#e){this.#e=!1;for(let e of this.#n.values())e.abort();this.#n.clear()}}async invoke(e){try{if(!this.#e)throw new G(`The command is disposed`,{code:`DISCONNECTED`,retryable:!0});let t=he(e);if(this.#n.has(t.requestId))throw new G(`Duplicate command request`,{code:`PROTOCOL`,retryable:!1});if(this.#n.size>=64)throw new G(`Too many command requests`,{code:`HOST_FAILURE`,retryable:!0});let r=new AbortController;this.#n.set(t.requestId,r);try{let e=await this.#t(E(t,r.signal)),i=n(e);return gd(i===void 0?{status:`handled`}:{status:`handled`,result:i})}finally{this.#n.delete(t.requestId)}}catch(e){if(e instanceof Fo)try{let t={code:e.code,message:e.message,details:e.details};return gd({status:`failed`,error:_(t)})}catch(e){return _d(e)}return _d(e)}}[Symbol.dispose](){this.dispose()}};function Xd(e){let t=[];for(let n of e.values()){let{commandId:e,definition:r,target:i}=n;if(e===void 0)continue;let a=r.availability?.status!==`unavailable`;for(let n of r.projections?.bindings?.values??[])n.trim().includes(` `)||n.startsWith(`<`)||t.push({key:n,run:()=>{a&&Promise.resolve().then(async()=>{let t=yd(await i.invoke({commandId:e,origin:`keyboard`,requestId:Jd()}));if(t.status===`failed`)throw new Fo(t.error.code,t.error.message,t.error.details)}).catch(e=>{console.warn(`App key command failed`,e)})}})}return t}function Zd(e,t,n,r){let i=new Map,a=!1,o=()=>{r?.update(a?[]:Xd(i))},s=e=>{try{n()}catch(t){console.warn(`App command failure callback failed`,t,e)}},c=e=>{try{vd(e(),we).catch(e=>{s(e)})}catch(e){console.warn(`App command RPC supervision failed`,e),s(e)}};return{commands:$d(e,t,i,()=>a,t=>{let n=i.get(t);if(!n)return;i.delete(t),n.target.dispose(),o();let r=n.commandId;!a&&r!==void 0&&c(()=>e.unregisterCommand(r))},o),dispose(){if(!a){a=!0;for(let e of i.values())e.target[Symbol.dispose]();i.clear(),o()}}}}function Qd(e,t,n){let r=t.id;if(e.size>=128||e.has(r))throw n.dispose(),new G(`Command registration is unavailable`,{code:`INVALID_ARGUMENT`,retryable:!1});let i={commandId:void 0,definition:t,target:n};e.set(r,i);let a=!1;return{commit(e){a||(i.commandId=e)},release(){a||(a=!0,e.get(r)===i&&e.delete(r),n.dispose())},target:n}}function $d(e,t,n,r,i,a){return Object.freeze({async register(o,s){if(t(),!m(s))throw new G(`Command handler must be a function`,{code:`INVALID_ARGUMENT`,retryable:!1});let c=Le(o),l=new Yd(s),u=Qd(n,c,l);try{let t=await ef(e,c,u.target);r()&&await tf(e,t.commandId,l),u.commit(t.commandId),a()}catch(e){throw u.release(),e}let d=!0;return()=>{d&&(d=!1,i(c.id))}}})}async function ef(e,t,n){return vd(e.registerCommand(t,n),Lt)}async function tf(e,t,n){throw n.dispose(),await vd(e.unregisterCommand(t),we),new G(`The command controller is disposed`,{code:`DISCONNECTED`,retryable:!0})}var nf=pe(e=>e instanceof fe),rf=class extends jt{#e=!1;#t;constructor(e){super(),this.#t=e}disconnect(e){try{if(this.#e)throw hf();let t=e===void 0?void 0:Vt(e);return setTimeout(()=>this.#t.disconnect?.(t??yf()),0),Promise.resolve(gd(void 0))}catch(e){return Promise.resolve(_d(e))}}async requestClose(){try{if(this.#e)throw hf();return gd(await(this.#t.beforeClose?.()??!0))}catch(e){return _d(e)}}async requestBack(){try{if(this.#e)throw hf();return gd(await(this.#t.back?.()??!1))}catch(e){return _d(e)}}async requestForward(){try{if(this.#e)throw hf();return gd(await(this.#t.forward?.()??!1))}catch(e){return _d(e)}}async activateNavigation(e){try{if(this.#e)throw hf();let t=Pt(e);return Oe(this.#t.navigation,t)?gd(await(this.#t.activate?.(t)??!1)):gd(!1)}catch(e){return _d(e)}}async activateStatus(e){try{if(this.#e)throw hf();let t=fn(e);return S(this.#t.statusItems,t)?gd(await(this.#t.statusAction?.(t)??!1)):gd(!1)}catch(e){return _d(e)}}[Symbol.dispose](){this.#e=!0}async updateContext(e){return this.#e?_d(hf()):this.#n(e,`context`,rn,e=>{this.#t.context.update(e)})}reconfigure(e){let t=[];try{if(this.#e)throw hf();let n=Ze(e);if(n.context.version<=this.#t.versions.context)return Promise.resolve(gd(void 0));for(let e of n.capabilities)t.push({...e,handle:L(nf)(e.handle).dup()});if(!this.#t.capabilities)throw hf();return this.#t.capabilities.replace(t),t=[],this.#t.versions.context=n.context.version,this.#t.context.update(n.context.value),Promise.resolve(gd(void 0))}catch(e){for(let e of t)ke(e.handle);return Promise.resolve(_d(e))}}updateLifecycle(e){try{if(this.#e)throw hf();let t=Qt(en)(e);if(t.version<=this.#t.versions.lifecycle)return Promise.resolve(gd(void 0));if(!bf(this.#t.lifecycle.get(),t.value))throw new G(`The host sent an invalid lifecycle transition`,{code:`PROTOCOL`,retryable:!1});return this.#t.versions.lifecycle=t.version,this.#t.lifecycle.update(t.value),Promise.resolve(gd(void 0))}catch(e){return Promise.resolve(_d(e))}}async updateReservedChords(e){return this.#e?_d(hf()):this.#n(e,`chords`,yt,e=>{this.#t.chords.update(e)})}async updateTheme(e){return this.#e?_d(hf()):this.#n(e,`theme`,tt,e=>{this.#t.theme.update(e)})}#n(e,t,n,r){try{let i=Qt(n)(e);return i.version>this.#t.versions[t]&&(this.#t.versions[t]=i.version,r(i.value)),Promise.resolve(gd(void 0))}catch(e){return Promise.resolve(_d(e))}}};async function af(e){let t=lf(),n=new rf(t),r=c(e.port,n),i,a=cf(r);try{performance.mark(`fungi.app-open.agar-rpc-connect-start`);let o=await Promise.race([r.connect({epoch:e.epoch,protocolVersion:2}),a]);performance.mark(`fungi.app-open.agar-rpc-connect-ready`),i=o;let s=yd(qt(o));if(!e.isActive())throw sf();let c=uf({bootstrap:s,bootstrapOwner:i,options:e,remote:r,state:t,target:n});return performance.mark(`fungi.app-open.agar-root-created`),i=void 0,c}catch(t){return Sf(t,e,n,r,i)}}function of(e,t){e.context.update(t.context.value),e.theme.update(t.theme.value),e.lifecycle.update(t.lifecycle.value),e.chords.update(t.chords.value),e.versions.context=t.context.version,e.versions.theme=t.theme.version,e.versions.lifecycle=t.lifecycle.version,e.versions.chords=t.chords.version}function sf(){return new G(`App connection was cancelled`,{code:`CANCELLED`,retryable:!1})}function cf(e){let t,n=new Promise((e,n)=>{t=n});return n.catch(e=>{Ma(`app-session.rpc-disconnect`,e)}),e.onRpcBroken(()=>t?.(new G(`The app host disconnected`,{code:`DISCONNECTED`,retryable:!0}))),n}function lf(){return{statusItems:[],navigation:{canGoBack:!1,canGoForward:!1},bindings:Sd(),chords:Cd([]),context:Pe({computerId:null,focus:{editing:!1,surface:null},openRequest:null,visibility:`hidden`}),lifecycle:Pe(`connecting`),theme:Pe(`default`),canGoBack:!1,canGoForward:!1,versions:{chords:-1,context:-1,lifecycle:-1,theme:-1}}}function uf(e){let t=Ut(e.bootstrap.identity),n=xf(e.bootstrap);of(e.state,n);let r=k(e.bootstrap.capabilities);return e.state.capabilities=r,ff(e,t,r)}function df(e,t,n){return wd({bindings:e.state.bindings,chords:e.state.chords,identity:t,onBroken:e=>{n({code:`DISCONNECTED`,message:e instanceof G?e.message:`The app host rejected a browser bridge operation`,retryable:!0})},remote:e.remote,window:e.options.window})}function ff(e,t,n){let r=!1,i=t=>{r||(r=!0,_f([()=>{t&&e.state.lifecycle.update(`disconnected`)},()=>{e.state.lifecycle.update(`disposing`)},l,u,()=>{o.dispose()},()=>{e.state.beforeClose=void 0,e.state.back=void 0,e.state.forward=void 0,e.state.activate=void 0,e.state.statusAction=void 0},()=>{n.disconnect()},()=>{e.target[Symbol.dispose]()},()=>{ke(e.bootstrapOwner)},()=>{ke(e.remote)},()=>{e.options.port.close()},()=>{e.state.lifecycle.update(`disposed`)},e.options.onDisposed],`app connection disposal`))},a=()=>{if(r)throw new G(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0})},o=Zd(e.remote,a,()=>{i({code:`DISCONNECTED`,message:`The app host rejected a terminal command operation`,retryable:!0})},e.state.bindings),s=mf(e.remote,a,e.state),c=pf(e.state,e.remote,a),l=df(e,t,i),u=jd({window:e.options.window,mac:Id(),canGoBack:()=>e.state.canGoBack&&e.state.back!==void 0,back:()=>{let t=e.state.back;t&&Promise.resolve().then(t).catch(e=>{Ma(`app-window.back-input`,e)})},canGoForward:()=>e.state.canGoForward&&e.state.forward!==void 0,forward:()=>{let t=e.state.forward;t&&Promise.resolve().then(t).catch(e=>{Ma(`app-window.forward-input`,e)})}});return e.state.disconnect=i,e.remote.onRpcBroken(()=>{gf(i)}),vf({capabilities:n.directory,commands:o.commands,context:e.state.context,dispose:i,identity:t,lifecycle:e.state.lifecycle,theme:e.state.theme,ui:s,window:c})}function pf(e,t,n){let r=Object.freeze({async publish(r){n();let i=ct(r);e.canGoBack=i.canGoBack,e.canGoForward=i.canGoForward,e.navigation=cn(i),await vd(t.reportNavigation(i),we)},onActivate(t){if(n(),e.activate!==void 0)throw new G(`The App already owns navigation activations`,{code:`INVALID_ARGUMENT`,retryable:!1});e.activate=t;let r=!1;return()=>{r||(r=!0,e.activate===t&&(e.activate=void 0))}},onForward(t){if(n(),e.forward!==void 0)throw new G(`The App already owns Forward requests`,{code:`INVALID_ARGUMENT`,retryable:!1});e.forward=t;let r=!1;return()=>{r||(r=!0,e.forward===t&&(e.forward=void 0))}},onBack(t){if(n(),e.back!==void 0)throw new G(`The App already owns Back requests`,{code:`INVALID_ARGUMENT`,retryable:!1});e.back=t;let r=!1;return()=>{r||(r=!0,e.back===t&&(e.back=void 0))}}});return Object.freeze({navigation:r,onBeforeClose(t){if(n(),e.beforeClose!==void 0)throw new G(`The App already owns a close consultation`,{code:`INVALID_ARGUMENT`,retryable:!1});e.beforeClose=t;let r=!1;return()=>{r||(r=!0,e.beforeClose===t&&(e.beforeClose=void 0))}}})}function mf(e,t,n){return Object.freeze({async requestComputerChoice(){t(),await vd(e.requestComputerChoice(),we)},async requestBrowserAction(n){t();let r=P(n);return r.kind===`refused`?r:await vd(e.requestBrowserAction(r),ze)},onStatusAction(e){if(t(),n.statusAction!==void 0)throw new G(`The App already owns its status actions`,{code:`INVALID_ARGUMENT`,retryable:!1});n.statusAction=e;let r=!1;return()=>{r||(r=!0,n.statusAction===e&&(n.statusAction=void 0))}},async requestAppPermissions(n){return t(),await vd(e.requestAppPermissions(Kt(n)),ft)},async openDesktopSettings(){t(),await vd(e.openDesktopSettings(),we)},async openSetup(n){return t(),await vd(e.openSetup(gt(n)),qe)},async openTeamBilling(){t(),await vd(e.openTeamBilling(),we)},async openNavigation(n){t(),await vd(e.openNavigation(it(n)),we)},async reportStatus(r){t();let i=Sn(r);n.statusItems=i,await vd(e.reportStatus(i),we)},async reportAgentSessionSelection(n){t(),await vd(e.reportAgentSessionSelection(ee(n)),we)},async showToast(n){t(),await vd(e.showToast(yn(n)),we)}})}function hf(){return new G(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0})}function gf(e){e({code:`DISCONNECTED`,message:`The app host disconnected`,retryable:!0})}function _f(e,t){for(let n of e)try{n()}catch(e){console.warn(`${t} cleanup failed`,e)}}function vf(e){return Object.freeze(e)}function yf(){return{code:`DISCONNECTED`,message:`The app host disconnected`,retryable:!1}}function bf(e,t){return e===t||e===`connected`&&t===`suspended`||e===`suspended`&&t===`connected`}function xf(e){let t=Qt(rn)(e.context),n=Qt(tt)(e.theme),r=Qt(en)(e.lifecycle),i=Qt(yt)(e.reservedChords);if(r.value!==`connected`&&r.value!==`suspended`)throw new G(`The bootstrap lifecycle is invalid`,{code:`PROTOCOL`,retryable:!1});return{chords:i,context:t,lifecycle:r,theme:n}}function Sf(e,t,n,r,i){throw _f([()=>{n[Symbol.dispose]()},()=>{i&&ke(i)},()=>{ke(r)},()=>{t.port.close()},t.onDisposed],`app connection rejection`),e instanceof G?e:new G(`Unable to establish the app RPC session`,{cause:e,code:`PROTOCOL`,retryable:!1})}var Cf=!1,wf=class{options;#e;#t;#n=!1;#r;#i;constructor(e){this.options=e,this.#e=globalThis.window}start(){performance.mark(`fungi.app-open.agar-connect-start`);let e=this.#l();return e?Promise.reject(e):(Cf=!0,this.#a())}#a(){return new Promise((e,t)=>{let n=(n,a)=>{this.#o(n,a,i,r,e,t)},r=()=>{n(Ef())},i=e=>{this.#s(e,n,i)};this.#e.addEventListener(`message`,i),this.options.signal?.addEventListener(`abort`,r,{once:!0});let a=()=>{try{performance.mark(`fungi.app-open.agar-ready-sent`),this.#e.parent.postMessage({protocolVersion:2,type:hn},`*`)}catch(e){Ma(`connect.notify-host`,e),n(Mf(e))}};this.#r=setInterval(a,200),this.#i=setTimeout(()=>{n(Of())},1e4),a()})}#o(e,t,n,r,i,a){if(!this.#n){if(this.#n=!0,this.#c(),this.#e.removeEventListener(`message`,n),this.options.signal?.removeEventListener(`abort`,r),e||!t){this.#t?.close(),Cf=!1,a(e??Of());return}i(t)}}#s(e,t,n){if(!jf(e.data))return;if(performance.mark(`fungi.app-open.agar-connect-received`),e.source!==this.#e.parent||kf(e.origin)===void 0){t(Af());return}let r=Nf(e,t);if(!r)return;let i=e.ports.length===1?e.ports[0]:void 0;if(!i){t(Pf(`The app host did not transfer exactly one port`));return}this.#t=i,this.#c(),this.#e.removeEventListener(`message`,n),af({epoch:r.epoch,isActive:()=>!this.#n,onDisposed:()=>{Cf=!1},port:i,window:this.#e}).then(e=>{performance.mark(`fungi.app-open.agar-root-ready`),t(void 0,e)},e=>{t(Df(e))})}#c(){clearInterval(this.#r),clearTimeout(this.#i),this.#r=void 0,this.#i=void 0}#l(){if(this.options.signal?.aborted)return Ef();if(Cf)return new G(`An app connection is already live`,{code:`IDENTITY`,retryable:!1});if(De(globalThis.window)||this.#e.parent===this.#e)return new G(`The app host is unavailable`,{code:`DISCONNECTED`,retryable:!0})}};function Tf(e){return new wf(e).start()}function Ef(){return new G(`App connection was cancelled`,{code:`CANCELLED`,retryable:!1})}function Df(e){return e instanceof G?e:new G(`Unable to connect to the app host`,{cause:e,code:`PROTOCOL`,retryable:!1})}function Of(){return new G(`The app host disconnected`,{code:`DISCONNECTED`,retryable:!0})}function kf(e){if(!URL.canParse(e))return;let t=new URL(e).origin;return t===e?t:void 0}function Af(){return new G(`The app connection identity is invalid`,{code:`IDENTITY`,retryable:!1})}var jf=u(g({type:bn(h)}));function Mf(e){return new G(`Unable to notify the app host`,{cause:e,code:`DISCONNECTED`,retryable:!0})}function Nf(e,t){try{return ut(e.data)}catch(e){Ma(`connect.decode-message`,e),t(e instanceof G?e:new G(`Malformed app connection`,{cause:e,code:`PROTOCOL`,retryable:!1}));return}}function Pf(e){return new G(e,{code:`PROTOCOL`,retryable:!1})}function Ff(e,t,n){e.style.isolation=`isolate`;let r=(0,qs.createRoot)(e),i=new AbortController,a=e.ownerDocument.documentElement,o=Rs(a),s,c,l,u=!1,d=e=>{let i=(0,q.createElement)(If,{state:e,render:n});r.render(t.queryClient?(0,q.createElement)(Mt,{client:t.queryClient},i):i)},f=()=>{l?.(),l=void 0,c?.(),c=void 0;let e=s;s=void 0,e?.dispose(),u&&=(o===null?a.removeAttribute(`data-theme`):Ls(o,a),!1)},{defaultView:p}=e.ownerDocument;return performance.mark(`fungi.app-open.react-root-render-start`),p?p.parent===p?d({app:null,status:`standalone`}):(d({app:null,status:`connecting`}),Tf({host:`parent`,signal:i.signal}).then(e=>{if(i.signal.aborted){e.dispose();return}s=e;let t=()=>{let t=e.lifecycle.get();return t===`disposing`||t===`disconnected`||t===`disposed`?(f(),d({app:null,status:`ended`}),!0):!1};l=e.lifecycle.subscribe(t),!t()&&(u=!0,Ls(e.theme.get(),a),c=e.theme.subscribe(e=>{Ls(e,a)}),d({app:e,status:`live`}))}).catch(e=>{i.signal.aborted&&e instanceof G&&e.code===`CANCELLED`||(console.error(`${t.name} host connection failed`,e),f(),i.signal.aborted||d({app:null,status:`not-hosted`,error:e instanceof G?e:new G(`The App host is unavailable`,{cause:e,code:`HOST_FAILURE`,retryable:!0})}))})):d({app:null,status:`not-hosted`,error:new G(`The App document has no window`,{code:`DISCONNECTED`,retryable:!1})}),()=>{i.signal.aborted||(i.abort(),r.unmount(),f())}}function If({state:e,render:t}){return(0,q.useLayoutEffect)(()=>{performance.mark(`fungi.app-open.react-initial-commit`)},[]),(0,q.useLayoutEffect)(()=>{e.app&&performance.mark(`fungi.app-open.react-connected-commit`)},[e.app]),(0,q.createElement)(q.Fragment,null,e.status===`not-hosted`?(0,q.createElement)(`p`,{role:`alert`},`App host connection unavailable. Open this App through its host to try again.`):null,t(e))}function Lf(e){let t=(0,q.useCallback)(t=>e?.subscribe(t)??(()=>void 0),[e]),n=(0,q.useCallback)(()=>e?.get(),[e]);return(0,q.useSyncExternalStore)(t,n,n)}function Rf(e){return Lf(e?.context)??null}function zf(e){return Rf(e)?.computerId??null}function Bf(e,t,n,r){let i=(0,q.useRef)(t);i.current=t;let a=(0,q.useRef)(n);a.current=n;let o=(0,q.useRef)(r);o.current=r;let s=JSON.stringify(t),c=n!==void 0;(0,q.useEffect)(()=>{e&&e.ui.reportStatus(i.current).catch(e=>{o.current?o.current(e):console.error(`Window status report failed`,e)})},[e,s]),(0,q.useEffect)(()=>{if(!(!e||!c))return e.ui.onStatusAction(e=>a.current?.(e)??!1)},[e,c]),(0,q.useEffect)(()=>()=>{e?.ui.reportStatus([]).catch(e=>{console.error(`Window status report failed`,e)})},[e])}function Vf(e,{sourceId:t,namespace:n},r){let i=(0,q.useMemo)(()=>Lo(),[]),a=(0,q.useMemo)(r,[r]);return(0,q.useEffect)(()=>{let e=i.contribute({sourceId:t,namespace:n,commands:a});return()=>{e.dispose()}},[i,t,n,a]),(0,q.useEffect)(()=>e?Ns(e.commands,a):void 0,[e,a]),i}function Hf(e,{canGoBack:t,canGoForward:n,title:r,crumbs:i,primary:a,menu:o,status:s,onBack:c,onForward:l,onCrumb:u,onAction:d}){let f=(0,q.useRef)(c),p=(0,q.useRef)(l),m=(0,q.useRef)(u),h=(0,q.useRef)(d);(0,q.useEffect)(()=>{f.current=c,p.current=l,m.current=u,h.current=d},[c,l,u,d]),(0,q.useEffect)(()=>{if(!e)return;let t=e.onBack(()=>f.current()),n=e.onForward(()=>p.current()),r=e.onActivate(e=>{if(e.kind===`action`){let t=h.current;return t?.(e.actionId),t!==void 0}let t=m.current;return e.siblingId===void 0?t?.(e.crumbId):t?.(e.crumbId,e.siblingId),t!==void 0});return()=>{t(),n(),r(),Uf(e,{canGoBack:!1,canGoForward:!1})}},[e]);let g=JSON.stringify([i,a,o,s]),_=(0,q.useRef)({crumbs:i,primary:a,menu:o,status:s});(0,q.useEffect)(()=>{_.current={crumbs:i,primary:a,menu:o,status:s}},[i,a,o,s]),(0,q.useEffect)(()=>{if(!e)return;let i={canGoBack:t,canGoForward:n};r!==void 0&&(i={...i,title:r});let a=_.current;a.crumbs!==void 0&&(i={...i,crumbs:a.crumbs}),a.primary!==void 0&&(i={...i,primary:a.primary}),a.menu!==void 0&&(i={...i,menu:a.menu}),a.status!==void 0&&(i={...i,status:a.status}),Uf(e,i)},[e,t,n,r,g])}function Uf(e,t){e.publish(t).catch(e=>{e instanceof G&&e.code===`DISCONNECTED`||console.warn(`App navigation report failed`,e)})}var Wf=j({png:`png`,jpeg:`jpeg`,webp:`webp`}),Gf=j({draft:`draft`,balanced:`balanced`,premium:`premium`,max:`max`}),Kf=I(()=>W({transport:j({json:`json`,multipart:`multipart`}),dimensions:j({none:`none`,own:`own`}),maxDimension:H().int().positive().nullable(),maxDimensionDocumented:O(),defaultWidth:H().int().positive(),defaultHeight:H().int().positive(),steps:j({steps:`steps`,num_steps:`num_steps`,fixed:`fixed`}),maxSteps:H().int().positive().nullable(),defaultSteps:H().int().nonnegative().nullable(),guidance:W({min:H().nonnegative(),max:H().positive(),default:H().nonnegative()}).readonly().refine(e=>e.min<=e.default&&e.default<=e.max,`guidance default must lie within its bounds`).nullable().default(null),referenceField:K().min(1).max(256).nullable(),maxReferences:H().int().nonnegative(),referenceDimension:H().int().positive().nullable(),referenceFormat:j({png:`png`,webp:`webp`})}).readonly()),qf=j({seedance25:`bytedance/seedance-2.5`,seedance:`bytedance/seedance-2.0`,seedanceFast:`bytedance/seedance-2.0-fast`,seedanceMini:`bytedance/seedance-2.0-mini`,veo:`google/veo-3.1`,veoFast:`google/veo-3.1-fast`,minimaxH3Max:`minimax/h3-max`}),Jf=j({p480:`480p`,p720:`720p`,p768:`768p`,p1080:`1080p`,p4k:`4k`}),Yf=j({wide:`16:9`,landscape:`4:3`,square:`1:1`,portrait:`3:4`,tall:`9:16`,ultrawide:`21:9`,ultratall:`9:21`}),Xf=j({first:`first-frame`,last:`last-frame`,reference:`reference`}),Zf=I(()=>W({resolution:Jf,aspectRatio:Yf,width:H().int().positive(),height:H().int().positive()}).readonly()),Qf=I(()=>W({minSeconds:H().int().positive(),maxSeconds:H().int().positive(),defaultSeconds:H().int().positive(),durations:Ie(H().int().positive()).readonly(),provider:j({seedance:`seedance`,veo:`veo`,minimax:`minimax`}),formats:Ie(Zf).readonly(),defaultResolution:Jf,defaultAspectRatio:Yf,supportsAudio:O(),defaultGenerateAudio:O().nullable(),referenceRoles:Ie(Xf).readonly(),maxReferenceImages:H().int().nonnegative(),referenceResolutions:Ie(Jf).readonly(),audioReferences:W({max:H().int().positive(),totalSeconds:H().int().positive()}).readonly().nullable(),prices:Ie(W({resolution:Jf,silentMilliunitsPerSecond:H().int().positive(),audioMilliunitsPerSecond:H().int().positive()}).readonly()).readonly()}).readonly()),$f=j({multilingual:`elevenlabs/eleven-multilingual-v2`,v3:`elevenlabs/eleven-v3`,music:`elevenlabs/music-v2`}),ep=I(()=>W({id:K().min(1).max(64),label:K().min(1).max(128)}).readonly()),tp=I(()=>W({provider:Ve(`elevenlabs`),mode:j({speech:`speech`,music:`music`}),voices:Ie(ep).readonly(),defaultVoiceId:K().min(1).max(64).nullable(),seconds:W({min:H().int().positive(),max:H().int().positive(),default:H().int().positive()}).readonly().nullable(),milliunitsPerUnit:H().int().positive()}).readonly()),np=32e3,rp=2048,ip=j({remove_background:`remove_background`,upscale:`upscale`}),ap=I(()=>W({operation:ip,source:W({formats:Ie(Wf).readonly(),maxBytes:H().int().positive(),maxPixels:H().int().positive()}).readonly(),defaultMegapixels:H().int().positive().nullable(),milliunits:H().int().positive().nullable(),sizes:Ie(W({megapixels:H().int().positive(),milliunits:H().int().positive()}).readonly()).readonly()}).readonly()),op=[[4,.005],[8,.01],[16,.02],[32,.04],[64,.06],[128,.12]],sp=[4,8,16],cp=1e5,lp=.018,up=8388608,dp=25e6,fp=j({image:`image`,video_second:`video_second`,audio_second:`audio_second`,audio_character_block:`audio_character_block`}),pp=e=>e.kind===`video`?`video_second`:e.kind===`audio`?e.audio?.mode===`speech`?`audio_character_block`:`audio_second`:`image`,mp=W({id:K().min(1).max(256),label:K().min(1).max(512),kind:j({image:`image`,video:`video`,audio:`audio`}),tier:Gf,outputFormats:Ie(Wf).max(3).readonly(),maxPromptLength:H().int().positive().max(np),input:Kf,sizes:Ie(K().regex(/^\d+x\d+$/u)).readonly().nullable(),video:Qf.nullable(),audio:tp.nullable(),billingUnit:fp,transform:ap.nullable()}).readonly(),hp=e=>{let t={kind:`image`,sizes:null,video:null,audio:null,transform:null,outputFormats:Object.freeze([]),...e};return Object.freeze({...t,billingUnit:pp(t),input:Object.freeze(e.input)})},gp=3840,_p=8294400,vp=[[1,1],[4,3],[3,4],[3,2],[2,3],[16,9],[9,16],[21,9]],yp=(()=>{let e=new Set([`1024x1024`,`1024x1536`,`1536x1024`]),t=[],n=[];for(let[r,i]of vp){let a=((e,t)=>{let n=e,r=t;for(;r!==0;)[n,r]=[r,n%r];return n})(r,i),o=16*r/a,s=16*i/a,c=o*s,l=e=>`${String(o*e)}x${String(s*e)}`,u=Math.round(Math.sqrt(1048576/c)),d=[...e].find(e=>{let[t,n]=e.split(`x`).map(Number);return(t??0)*i===(n??0)*r});t.push(d??l(u)),n.push(l(Math.floor(Math.min(gp/Math.max(o,s),Math.sqrt(_p/c)))))}return Object.freeze([...t,...n])})(),bp=(e=>Object.freeze(vp.map(([t,n])=>{let r=t,i=n;for(;i!==0;)[r,i]=[i,r%i];let a=16*t/r,o=16*n/r,s=Math.round(Math.sqrt(e/(a*o)));return`${String(a*s)}x${String(o*s)}`})))(1327104),xp={"480p":480,"720p":720,"768p":768,"1080p":1080,"4k":2160},Sp={"16:9":[16,9],"4:3":[4,3],"1:1":[1,1],"3:4":[3,4],"9:16":[9,16],"21:9":[21,9],"9:21":[9,21]},Cp={maxSeconds:30,maxReferenceImages:30,audioReferences:{max:10,totalSeconds:30},maxPromptLength:25e3,resolutions:[`480p`,`720p`],aspects:Yf.options.filter(e=>e!==Yf.enum.ultratall)};function wp(e,t,n,r,i,a){let o=r===`seedance`,s=a?.resolutions??i.map(([e])=>e),c=a?.maxSeconds??(o?12:8),l=a?.maxReferenceImages??(o?4:0),u=a?a.aspects:o?Yf.options:[Yf.enum.wide,Yf.enum.tall,Yf.enum.square],d=Object.freeze(s.flatMap(e=>u.map(t=>{let[n,r]=Sp[t],i=xp[e],a=Math.min(n,r);return Object.freeze({resolution:e,aspectRatio:t,width:Math.ceil(i*n/a/2)*2,height:Math.ceil(i*r/a/2)*2})}))),f=Object.freeze(o?Array.from({length:c-3},(e,t)=>t+4):[4,6,8]),p=Object.freeze({minSeconds:4,maxSeconds:c,defaultSeconds:o?5:6,durations:f,provider:r,formats:d,defaultResolution:`720p`,defaultAspectRatio:`16:9`,supportsAudio:!0,defaultGenerateAudio:!0,referenceRoles:Object.freeze(o?Xf.options:[Xf.enum.first]),maxReferenceImages:l,audioReferences:a===void 0?null:Object.freeze({...a.audioReferences}),referenceResolutions:Object.freeze(o?s.filter(e=>e!==`1080p`):[]),prices:Object.freeze(i.map(([e,t,n])=>Object.freeze({resolution:e,silentMilliunitsPerSecond:t,audioMilliunitsPerSecond:n})))});return hp({id:e,label:t,tier:n,maxPromptLength:a?.maxPromptLength??(o?1e4:rp),kind:`video`,video:p,sizes:Object.freeze(d.map(({width:e,height:t})=>`${String(e)}x${String(t)}`)),input:{transport:`json`,dimensions:`own`,maxDimension:Math.max(...d.map(({width:e,height:t})=>Math.max(e,t))),maxDimensionDocumented:!1,defaultWidth:1280,defaultHeight:720,steps:`fixed`,maxSteps:null,defaultSteps:null,guidance:null,referenceField:o?`image`:`image_input`,maxReferences:o?l:1,referenceDimension:null,referenceFormat:`png`}})}function Tp(){let e=[`480p`,`768p`],t=[Yf.enum.wide,Yf.enum.landscape,Yf.enum.square,Yf.enum.portrait,Yf.enum.tall,Yf.enum.ultrawide],n=Object.freeze(e.flatMap(e=>t.map(t=>{let[n,r]=Sp[t],i=xp[e],a=Math.min(n,r);return Object.freeze({resolution:e,aspectRatio:t,width:Math.ceil(i*n/a/2)*2,height:Math.ceil(i*r/a/2)*2})}))),r=Jf.enum.p768,i=Yf.enum.wide,a=n.find(e=>e.resolution===r&&e.aspectRatio===i);if(a===void 0)throw Error(`minimax/h3-max is missing its default format`);let o=Object.freeze(Array.from({length:11},(e,t)=>t+5)),s=Object.freeze({minSeconds:5,maxSeconds:15,defaultSeconds:5,durations:o,provider:`minimax`,formats:n,defaultResolution:r,defaultAspectRatio:i,defaultGenerateAudio:null,supportsAudio:!1,referenceRoles:Object.freeze([Xf.enum.first,Xf.enum.reference]),maxReferenceImages:4,audioReferences:null,referenceResolutions:Object.freeze(e),prices:Object.freeze([{resolution:Jf.enum.p480,silentMilliunitsPerSecond:5e3,audioMilliunitsPerSecond:5e3},{resolution:Jf.enum.p768,silentMilliunitsPerSecond:8e3,audioMilliunitsPerSecond:8e3}])});return hp({id:qf.enum.minimaxH3Max,label:`MiniMax H3 Max`,tier:`balanced`,maxPromptLength:7e3,kind:`video`,video:s,sizes:Object.freeze(n.map(({width:e,height:t})=>`${String(e)}x${String(t)}`)),input:{transport:`json`,dimensions:`own`,maxDimension:Math.max(...n.map(({width:e,height:t})=>Math.max(e,t))),maxDimensionDocumented:!1,defaultWidth:a.width,defaultHeight:a.height,steps:`fixed`,maxSteps:null,defaultSteps:null,guidance:null,referenceField:`image_url`,maxReferences:4,referenceDimension:null,referenceFormat:`png`}})}var Ep=Object.freeze([Object.freeze({id:`JBFqnCBsd6RMkjVDRZzb`,label:`Default voice`})]);function Dp(e,t,n,r){return kp(e,t,n,1e4,{provider:`elevenlabs`,mode:`speech`,voices:Ep,defaultVoiceId:Ep[0]?.id??null,seconds:null,milliunitsPerUnit:r})}function Op(){return kp($f.enum.music,`Eleven Music v2`,`premium`,rp,{provider:`elevenlabs`,mode:`music`,voices:Object.freeze([]),defaultVoiceId:null,seconds:Object.freeze({min:3,max:600,default:30}),milliunitsPerUnit:250})}function kp(e,t,n,r,i){return hp({id:e,label:t,tier:n,maxPromptLength:r,kind:`audio`,audio:Object.freeze(i),input:{transport:`json`,dimensions:`none`,maxDimension:null,maxDimensionDocumented:!1,defaultWidth:1,defaultHeight:1,steps:`fixed`,maxSteps:null,defaultSteps:null,guidance:null,referenceField:null,maxReferences:0,referenceDimension:null,referenceFormat:`png`}})}function Ap(e){let t=op.find(([t])=>e<=t);if(t===void 0)throw Error(`no published upscale price for ${String(e)} MP`);return t[1]}function jp(e){return hp({id:e.id,label:e.label,tier:e.tier,outputFormats:Object.freeze([e.outputFormat]),maxPromptLength:256,transform:Object.freeze({operation:e.operation,source:Object.freeze({formats:Object.freeze([`png`,`jpeg`]),maxBytes:up,maxPixels:dp}),defaultMegapixels:e.defaultMegapixels,milliunits:e.flatUsd===null?null:Math.round(e.flatUsd*cp),sizes:Object.freeze(e.sizes.map(({megapixels:e,usd:t})=>Object.freeze({megapixels:e,milliunits:Math.round(t*cp)})))}),input:{transport:`json`,dimensions:`none`,maxDimension:null,maxDimensionDocumented:!1,defaultWidth:1024,defaultHeight:1024,steps:`fixed`,maxSteps:null,defaultSteps:null,guidance:null,referenceField:`image`,maxReferences:1,referenceDimension:8192,referenceFormat:`png`}})}Object.freeze([hp({id:`@cf/black-forest-labs/flux-1-schnell`,maxPromptLength:2048,outputFormats:Object.freeze([`jpeg`]),tier:`draft`,label:`Flux 1 Schnell — cheap/fast sketches`,input:{transport:`json`,dimensions:`none`,maxDimension:null,maxDimensionDocumented:!1,defaultWidth:1024,defaultHeight:768,steps:`steps`,maxSteps:8,defaultSteps:4,guidance:null,referenceField:null,maxReferences:0,referenceDimension:512,referenceFormat:`png`}}),hp({id:`@cf/black-forest-labs/flux-2-klein-4b`,maxPromptLength:rp,tier:`balanced`,label:`Flux 2 Klein 4b — balanced default`,input:{transport:`multipart`,dimensions:`own`,maxDimension:1920,maxDimensionDocumented:!1,defaultWidth:1024,defaultHeight:768,steps:`fixed`,maxSteps:null,defaultSteps:4,guidance:null,referenceField:`input_image_`,maxReferences:4,referenceDimension:512,referenceFormat:`png`}}),hp({id:`@cf/black-forest-labs/flux-2-klein-9b`,maxPromptLength:rp,tier:`premium`,label:`Flux 2 Klein 9b — higher quality flux-2`,input:{transport:`multipart`,dimensions:`own`,maxDimension:1920,maxDimensionDocumented:!1,defaultWidth:1024,defaultHeight:768,steps:`fixed`,maxSteps:null,defaultSteps:4,guidance:null,referenceField:`input_image_`,maxReferences:4,referenceDimension:512,referenceFormat:`png`}}),hp({id:`@cf/black-forest-labs/flux-2-dev`,maxPromptLength:rp,tier:`max`,label:`Flux 2 Dev — best detailed quality, expensive`,input:{transport:`multipart`,dimensions:`own`,maxDimension:1920,maxDimensionDocumented:!1,defaultWidth:1024,defaultHeight:768,steps:`steps`,maxSteps:null,defaultSteps:20,guidance:null,referenceField:`input_image_`,maxReferences:4,referenceDimension:512,referenceFormat:`png`}}),hp({id:`@cf/leonardo/lucid-origin`,maxPromptLength:rp,tier:`premium`,label:`Leonardo Lucid Origin — premium prompt adherence`,input:{transport:`json`,dimensions:`own`,maxDimension:2500,maxDimensionDocumented:!0,defaultWidth:1120,defaultHeight:1120,steps:`num_steps`,maxSteps:40,defaultSteps:null,guidance:{min:0,max:10,default:5},referenceField:null,maxReferences:0,referenceDimension:512,referenceFormat:`png`}}),hp({id:`@cf/leonardo/phoenix-1.0`,maxPromptLength:rp,tier:`balanced`,label:`Leonardo Phoenix 1.0 — best prompt adherence`,input:{transport:`json`,dimensions:`own`,maxDimension:2048,maxDimensionDocumented:!0,defaultWidth:1024,defaultHeight:1024,steps:`num_steps`,maxSteps:50,defaultSteps:25,guidance:{min:2,max:10,default:3},referenceField:null,maxReferences:0,referenceDimension:512,referenceFormat:`png`}}),hp({id:`openai/gpt-image-2`,maxPromptLength:32e3,outputFormats:Object.freeze([`png`,`jpeg`,`webp`]),tier:`premium`,label:`GPT Image 2 — strong text and layout, premium`,sizes:yp,input:{transport:`json`,dimensions:`own`,maxDimension:gp,maxDimensionDocumented:!0,defaultWidth:1024,defaultHeight:1024,steps:`fixed`,maxSteps:null,defaultSteps:null,guidance:null,referenceField:`images`,maxReferences:16,referenceDimension:1024,referenceFormat:`webp`}}),hp({id:`bytedance/seedream-5-pro`,maxPromptLength:rp,outputFormats:Object.freeze([`jpeg`]),tier:`premium`,label:`Seedream 5 Pro — ByteDance, high-quality images`,sizes:bp,input:{transport:`json`,dimensions:`own`,maxDimension:1792,maxDimensionDocumented:!1,defaultWidth:1536,defaultHeight:864,steps:`fixed`,maxSteps:null,defaultSteps:null,guidance:null,referenceField:null,maxReferences:0,referenceDimension:512,referenceFormat:`png`}}),jp({id:`bria/remove-background`,label:`Remove background — Bria RMBG 2.0`,tier:`draft`,operation:`remove_background`,outputFormat:`png`,flatUsd:lp,sizes:[],defaultMegapixels:null}),jp({id:`pruna/p-image-upscale`,label:`Upscale — Pruna P-Image-Upscale`,tier:`draft`,operation:`upscale`,outputFormat:`webp`,flatUsd:null,sizes:sp.map(e=>({megapixels:e,usd:Ap(e)})),defaultMegapixels:4}),wp(qf.enum.seedance25,`Seedance 2.5`,`balanced`,`seedance`,[[`480p`,10280,10280],[`720p`,23120,23120]],Cp),wp(qf.enum.seedance,`Seedance 2.0`,`balanced`,`seedance`,[[`480p`,7e3,7e3],[`720p`,15e3,15e3],[`1080p`,37e3,37e3],[`4k`,78e3,78e3]]),wp(qf.enum.seedanceFast,`Seedance 2.0 Fast`,`draft`,`seedance`,[[`480p`,6e3,6e3],[`720p`,12e3,12e3]]),wp(qf.enum.seedanceMini,`Seedance 2.0 Mini`,`draft`,`seedance`,[[`480p`,4e3,4e3],[`720p`,9e3,9e3]]),wp(qf.enum.veo,`Veo 3.1`,`premium`,`veo`,[[`720p`,2e4,4e4],[`1080p`,2e4,4e4]]),wp(qf.enum.veoFast,`Veo 3.1 Fast`,`balanced`,`veo`,[[`720p`,8e3,1e4],[`1080p`,1e4,12e3]]),Tp(),Dp($f.enum.multilingual,`Eleven Multilingual v2 — natural speech`,`balanced`,10),Dp($f.enum.v3,`Eleven v3 — expressive speech`,`premium`,10),Op()]);var Mp=mp.unwrap().extend({billingUnit:fp.optional(),audio:tp.unwrap().nullable().default(null),transform:ap.unwrap().nullable().default(null),video:Qf.unwrap().unwrap().extend({audioReferences:Qf.unwrap().unwrap().shape.audioReferences.default(null),provider:j({seedance:`seedance`,veo:`veo`,minimax:`minimax`,host:`host`})}).readonly().nullable()}).readonly();Ie(Mp).min(1).max(256).superRefine((e,t)=>{let n=new Set;e.forEach((e,r)=>{let i=e=>{t.addIssue({code:`custom`,message:e,path:[r]})};n.has(e.id)&&i(`duplicate model id "${e.id}"`),n.add(e.id),e.kind===`video`!=(e.video!==null)&&i(`${e.id} must carry video bounds exactly when kind is video`),e.kind===`audio`!=(e.audio!==null)&&i(`${e.id} must carry audio bounds exactly when kind is audio`),e.billingUnit!==void 0&&e.billingUnit!==pp(e)&&i(`${e.id} billingUnit must be ${pp(e)} for ${e.kind===`image`?`an`:`a`} ${e.kind} model`);let a=e.video;a!==null&&((a.minSeconds>a.maxSeconds||a.durations.some(e=>e<a.minSeconds||e>a.maxSeconds)||!a.durations.includes(a.defaultSeconds))&&i(`${e.id} durations must sit inside min/max and include the default`),a.formats.some(({resolution:e,aspectRatio:t})=>e===a.defaultResolution&&t===a.defaultAspectRatio)||i(`${e.id} formats must include the default resolution and aspect`))})}).transform(e=>Object.freeze(e.map(e=>Object.freeze({...e,input:Object.freeze(e.input)}))));var Np=e=>K().min(1).max(e),Pp=H().int().min(-(2**53-1)).max(2**53-1),Fp=Pp.positive(),Ip=Pp.nonnegative(),Lp=W({printId:Np(256),computerId:Np(256),kind:j([`image`,`video`,`audio`]),prompt:Np(np),model:Np(256),width:Fp.nullable(),height:Fp.nullable(),steps:Ip.nullable(),durationSeconds:Ip.nullable(),format:Np(32),bytes:Fp,costMilliunits:Ip,actorKind:j([`member`,`agent`]),actorId:Np(256),derivedFrom:Np(256).nullable(),createdAt:Ip,source:j([`recorded`,`file`]),schemaVersion:Fp}),Rp=_e({printId:Lp.shape.printId,path:K().startsWith(`/`).min(2).max(4096)});function zp(e,t){let n=e?.app??null,r=Rf(n),i=r?.openRequest,a=r?.computerId,o=i?.kind===`navigate`?i.params.find(e=>e.key===`print`):void 0,s=Lp.shape.printId.safeParse(o?.value),c=s.success?s.data:null,l=i?.kind===`navigate`?i.requestId:null,u=(0,q.useRef)({app:n,requestId:l,computerId:a});(u.current.app!==n||u.current.requestId!==l)&&(u.current={app:n,requestId:l,computerId:a});let d=u.current.computerId===a,f=Li({...mi(n,Ci,Pr.of(n,`prints`,`navigate`,a,l,c),async(e,t)=>{if(!n||!a||!c||!l)throw Error(`No print selected`);let r=await e.call(`openOutput`,JSON.stringify({printId:c,byteLength:1}));if(t.throwIfAborted(),n.context.get().computerId!==a)throw Error(`Computer selection changed`);let i=Rp.parse(r);if(i.printId!==c)throw Error(`Print selection changed`);return{path:i.path,requestId:l,computerId:a}}),enabled:!!(n&&d&&a&&l&&c&&n.capabilities.has(Ci)),retry:!1,staleTime:1/0}),p=(0,q.useRef)(t);p.current=t;let m=(0,q.useRef)(void 0);return(0,q.useEffect)(()=>{let t=f.data;!e||!t||m.current===t||e.app.context.get().computerId!==t.computerId||(m.current=t,p.current(t.path,e,t.computerId))},[e,f.data]),{target:f.data??null,error:f.error}}var Bp=q.createContext(void 0);function Vp(e){let t=q.useContext(Bp);if(!e&&t===void 0)throw Error(Oa(27));return t}var Hp=q.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=Vp(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`),d={open:c,transitionStatus:s.useState(`transitionStatus`)};return Aa(`div`,e,{state:d,ref:[s.context.backdropRef,t],stateAttributesMapping:_a,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),Up=q.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,c=Vp(),l=c.useState(`open`),{getButtonProps:u,buttonRef:d}=ya({disabled:a,native:o}),f={disabled:a};function p(e){l&&c.setOpen(!1,ra(Ao,e.nativeEvent))}return Aa(`button`,e,{state:f,ref:[t,d],props:[{onClick:p},s,u]})}),Wp=q.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=Vp(),c=Va(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),Aa(`p`,e,{ref:t,props:[{id:c},o]})}),Gp=q.createContext(void 0);function Kp(){let e=q.useContext(Gp);if(e===void 0)throw Error(Oa(26));return e}var qp=`--nested-dialogs`,Jp=`data-nested-dialog-open`,Yp={...ha,...ea,nestedDialogOpen(e){return e?{[Jp]:``}:null}},J=ot(),Xp=q.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=Vp(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),y=c.useState(`titleElementId`),b=c.useState(`transitionStatus`),x=c.useState(`role`),S=d.useState(`floatingId`);Kp(),uo({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let C=o===void 0?da(c.context.popupRef):o,w=g>0,T=c.useStateSetter(`popupElement`),E=Aa(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:w},props:[f,{id:S,"aria-labelledby":y,"aria-describedby":l,role:x,...sa,hidden:!m,onKeyDown(e){ga.has(e.key)&&e.stopPropagation()},style:{[qp]:g}},s],ref:[t,c.context.popupRef,T],stateAttributesMapping:Yp});return(0,J.jsx)(po,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:C,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:E})}),Zp=q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=Vp(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,J.jsx)(Gp.Provider,{value:n,children:(0,J.jsxs)(wo,{ref:t,...r,children:[a&&o===!0&&(0,J.jsx)(to,{ref:i.context.internalBackdropRef,inert:ma(!s)}),e.children]})}):null});function Qp({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`mounted`),a=e.useState(`disablePointerDismissal`),o=e.useState(`modal`),s=e.useState(`popupElement`),c=e.useState(`floatingRootContext`),[l,u]=q.useState(0),[d,f]=q.useState(0),p=l===0,m=eo(c,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:o===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0)return!1;if(`touches`in t){if(t.type===`touchend`){if(t.changedTouches.length!==1||t.touches.length!==0)return!1}else if(t.touches.length!==1)return!1}let n=Xa(t);if(p&&!a){if(o){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||Qa(n,s)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:p});return Zi(r&&o===!0,s),e.useContextCallback(`onNestedDialogOpen`,(t,n)=>{!e.select(`open`)&&!e.select(`mounted`)||(u(t),f(n))}),io(()=>{!r&&!i&&(u(0),f(0))},[r,i]),io(()=>(t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(l+1,d+ +!!n),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,l,d,t]),Sa(e,{activeTriggerProps:m.reference,inactiveTriggerProps:m.trigger,popupProps:m.floating,nestedOpenDialogCount:l,nestedOpenDrawerCount:d}),null}var $p={...No,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role},em=class extends $i{constructor(e,t,n){let r=new ja,i=tm(e,r,t,n);super(i,nm(r),$p)}setOpen=(e,t)=>{t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),!t.isCanceled&&(this.state.floatingRootContext.dispatchOpenChange(e,t),this.update(Pa(this.state,e,t.trigger)))}};function tm(e,t,n,r=!1){return{...Ca(t,n,r),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}function nm(e){return{popupRef:q.createRef(),backdropRef:q.createRef(),internalBackdropRef:q.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function rm(e,t){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:d,defaultTriggerId:f=null}=t,p=e===`drawer`,m=e===`alert-dialog`,h=m?!0:c,g=m||s,_=m?`alertdialog`:`dialog`,v=Vp(!0),y={modal:h,disablePointerDismissal:g,nested:v!=null,role:_},b=Xi((e,t)=>new em({open:i,openProp:r,activeTriggerId:f,triggerIdProp:d,...y},e,t),!0);b.useControlledProp(`openProp`,r),b.useControlledProp(`triggerIdProp`,d),b.useSyncedValues(y),b.useContextCallback(`onOpenChange`,a),b.useContextCallback(`onOpenChangeComplete`,o);let x=b.useState(`open`),S=b.useState(`mounted`),C=b.useState(`payload`);Ka(b,x),Na(b);let{forceUnmount:w}=Fa(x,b);q.useImperativeHandle(l,()=>({unmount:w,close:()=>b.setOpen(!1,ra(Oo))}),[w,b]);let T=x||S||u!=null;return(0,J.jsxs)(Bp.Provider,{value:b,children:[u&&(0,J.jsx)(fa,{handle:u,store:b}),T&&(0,J.jsx)(Qp,{store:b,parentContext:v?.context,isDrawer:p}),typeof n==`function`?n({payload:C}):n]})}var im=ka(function(e){return rm(`dialog`,e)}),am=q.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=Vp(),c=Va(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),Aa(`h2`,e,{ref:t,props:[{id:c},o]})}),om=ca(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,payload:c,handle:l,...u}=e,d=Vp(!0),f=pa(l)??d;if(!f)throw Error(Oa(79));let p=Va(s),m=f.useState(`floatingRootContext`),h=f.useState(`isOpenedByTrigger`,p),g=f.useState(`triggerPopupId`,p),_=q.useRef(null),{registerTrigger:v,isMountedByThisTrigger:y}=So(p,_,f,{payload:c}),{getButtonProps:b,buttonRef:x}=ya({disabled:a,native:o}),S=za(m),C=ro(()=>f.select(`open`),e=>{f.set(`openMethod`,e)}),w={disabled:a,open:h},T=f.useState(`triggerProps`,y);return Aa(`button`,e,{state:w,ref:[x,t,v,_],props:[S.reference,T,C,{[Ga]:``,id:p,"aria-haspopup":`dialog`,"aria-expanded":h,"aria-controls":g},u,b],stateAttributesMapping:oa})}),sm=(0,q.createContext)(null);function cm({children:e,interactionOwner:t=`local`,modal:n=!0,onOpenChange:r,...i}){return(0,J.jsx)(sm.Provider,{value:{interactionOwner:t,modal:n},children:(0,J.jsx)(im,{...i,modal:n,onOpenChange:(e,n)=>{if(t===`host`&&!e&&n.reason===`escape-key`){n.cancel(),n.allowPropagation();return}r?.(e,n)},children:e})})}function lm(){let e=(0,q.useContext)(sm);if(!e)throw Error(`Dialog parts must be used inside <Dialog>`);return e}(0,q.forwardRef)(function({className:e,type:t=`button`,...n},r){return(0,J.jsx)(om,{...n,className:t=>V(`btn`,C(e,t)),ref:r,type:t})});var um=(0,q.forwardRef)(function({container:e,...t},n){let r=va(`dialog`);return e==null&&r===null?null:(0,J.jsx)(Zp,{...t,container:e??r,ref:n})}),dm=(0,q.forwardRef)(function({className:e,...t},n){return(0,J.jsx)(Hp,{...t,ref:n,className:t=>V(`caps-dialog-backdrop fixed inset-0 bg-black/40`,C(e,t))})}),fm=(0,q.forwardRef)(function({className:e,finalFocus:t,size:n=`default`,...r},i){let a=lm();return(0,J.jsx)(Xp,{...r,"data-size":n,className:t=>V(`caps-dialog-popup overflow-y-auto overscroll-contain rounded-box bg-base-100 p-lg text-base-content shadow-xl`,n===`fill`?`fixed inset-0 h-full w-full max-w-none`:`caps-dialog-popup-default`,C(e,t)),finalFocus:a.interactionOwner===`host`?!1:t??!0,ref:i})}),pm=(0,q.forwardRef)(function({container:e,keepMounted:t=!0,forceBackdrop:n=!1,className:r,size:i=`default`,...a},o){let{modal:s}=lm();return(0,J.jsxs)(um,{container:e,keepMounted:t,children:[s===!0?(0,J.jsx)(dm,{forceRender:n}):null,(0,J.jsx)(fm,{...a,size:i,className:e=>V(i==="default"&&`fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2`,C(r,e)),ref:o})]})});function mm({className:e,...t}){return(0,J.jsx)(`div`,{...t,className:V(`flex justify-end gap-sm`,e)})}function hm({className:e,...t}){return(0,J.jsx)(`div`,{...t,className:V(`flex flex-col gap-sm`,e)})}var gm=(0,q.forwardRef)(function({className:e,...t},n){return(0,J.jsx)(am,{...t,className:t=>V(`text-lg font-semibold`,C(e,t)),ref:n})});(0,q.forwardRef)(function({className:e,...t},n){return(0,J.jsx)(Wp,{...t,className:t=>V(`text-sm text-base-content`,C(e,t)),ref:n})});var _m=(0,q.forwardRef)(function({className:e,type:t=`button`,...n},r){return(0,J.jsx)(Up,{...n,className:t=>V(`btn btn-ghost`,C(e,t)),ref:r,type:t})}),vm=(0,q.forwardRef)(function({className:e,count:t,density:n=`row`,dismissAriaLabel:r,dismissLabel:i=`Dismiss`,message:a,onDismiss:o,onRetry:s,retryAriaLabel:c,retryLabel:l=`Retry`,role:u=`status`,...d},f){return(0,J.jsxs)(`div`,{...d,className:V(`caps-failure-line`,e),"data-density":n,ref:f,role:u,children:[(0,J.jsx)(bi,{glyph:`dot`,tone:`error`}),(0,J.jsxs)(`span`,{className:`caps-failure-line-copy`,children:[(0,J.jsx)(`span`,{children:a}),t!==void 0&&t>1?(0,J.jsxs)(`span`,{className:`caps-failure-line-count`,children:[`Failed `,t,` times`]}):null]}),s||o?(0,J.jsxs)(`span`,{className:`caps-failure-line-actions`,children:[s?(0,J.jsx)(U,{"aria-label":c,size:`sm`,variant:`outline`,onClick:s,children:l}):null,o?(0,J.jsx)(U,{"aria-label":r,size:`sm`,variant:`ghost`,onClick:o,children:i}):null]}):null]})}),ym={queued:`Waiting to start`,generating:`Generating`,refining:`Refining`,done:void 0,failed:void 0},bm=(0,q.forwardRef)(function({status:e,children:t,aspectRatio:n,label:r,indicator:i,failure:a,className:o,style:s,...c},l){let u=(0,q.useRef)(null);(0,q.useImperativeHandle)(l,()=>u.current);let d=(0,q.useRef)(e),[f,p]=(0,q.useState)(!1),[m,h]=(0,q.useState)(e);m!==e&&(h(e),p(e===`done`)),(0,q.useLayoutEffect)(()=>{let t=u.current,n=d.current;if(d.current=e,!t||n===e)return;if(!y(t)){p(!1);return}let r=Tt(t),i=B(r,r.ease),a=[],o=t.querySelector(`:scope > [data-layer="media"]`),s=t.querySelector(`:scope > [data-layer="placeholder"]`),c=t.querySelector(`:scope > [data-layer="failure"]`);if(e===`done`&&o){let e=o.animate(r.reduced?[{opacity:0},{opacity:1}]:[{opacity:0,filter:`blur(10px)`,transform:`scale(1.03)`},{opacity:1,filter:`blur(0px)`,transform:`none`}],{duration:r.reduced?r.fast:r.slow*2,easing:i,fill:`backwards`});e.addEventListener(`finish`,()=>{p(!1)}),a.push(e),s&&a.push(s.animate([{opacity:1},{opacity:0}],{duration:r.reduced?r.fast:r.slow,easing:i,fill:`forwards`}))}return e===`failed`&&c&&a.push(c.animate([{opacity:0,transform:`translateY(${String(r.distance)}px)`},{opacity:1,transform:`none`}],{duration:r.normal,easing:i})),n===`failed`&&s&&a.push(s.animate([{opacity:.4},{opacity:1}],{duration:r.normal,easing:i})),()=>{for(let e of a)e.cancel()}},[e]);let g=e===`queued`||e===`generating`||e===`refining`,_=r??ym[e],v=e===`done`||e===`refining`;return(0,J.jsxs)(`div`,{...c,ref:u,className:V(`caps-generation-frame`,o),"data-status":e,"data-aspect":n===void 0?void 0:``,"aria-busy":g,style:n===void 0?s:{aspectRatio:n,...s},children:[e===`done`&&!f?null:(0,J.jsxs)(`div`,{className:V(`caps-generation-placeholder`,e===`queued`&&`skeleton`),"data-layer":`placeholder`,role:e===`done`?void 0:`status`,"aria-hidden":e===`done`||void 0,children:[e===`generating`||e===`refining`||e===`done`?i??(0,J.jsx)(ln,{decorative:!0,size:`lg`,variant:`bloom`}):null,_===void 0?null:(0,J.jsx)(Te,{children:_})]}),v?(0,J.jsx)(`div`,{className:`caps-generation-media`,"data-layer":`media`,children:t}):null,e===`failed`&&a!==void 0?(0,J.jsx)(`div`,{className:`caps-generation-failure`,"data-layer":`failure`,role:`alert`,children:a}):null]})}),xm=q.createContext(void 0);function Sm(){let e=q.useContext(xm);if(e===void 0)throw Error(Oa(53));return e}function Cm(e,t,n){if(!e)return 0;let r=getComputedStyle(e),i=`${t}${n===`x`?`Inline`:`Block`}`,a=parseFloat(r[`${i}Start`]);return n===`x`&&t===`margin`?a*2:a+parseFloat(r[`${i}End`])}var wm=`base-ui-disable-scrollbar`,Tm={className:wm,getElement(e){return(0,J.jsx)(`style`,{nonce:e,href:wm,precedence:`base-ui:low`,children:`.${wm}{scrollbar-width:none}.${wm}::-webkit-scrollbar{display:none}`})}},Em=`data-has-overflow-x`,Dm=`data-has-overflow-y`,Om=`data-overflow-x-start`,km=`data-overflow-x-end`,Am=`data-overflow-y-start`,jm=`data-overflow-y-end`,Mm=e=>t=>t?{[e]:``}:null,Nm={hasOverflowX:Mm(Em),hasOverflowY:Mm(Dm),overflowXStart:Mm(Om),overflowXEnd:Mm(km),overflowYStart:Mm(Am),overflowYEnd:Mm(jm),cornerHidden:()=>null},Pm=q.createContext(void 0),Fm={disableStyleElements:!1};function Im(){return q.useContext(Pm)??Fm}var Lm=`--scroll-area-corner-height`,Rm=`--scroll-area-corner-width`,zm=`data-orientation`,Bm={x:0,y:0},Vm={width:0,height:0},Hm={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},Um={x:!0,y:!0,corner:!0},Wm=q.forwardRef(function(e,t){let{render:n,className:r,overflowEdgeThreshold:i,style:a,...o}=e,{xStart:s,xEnd:c,yStart:l,yEnd:u}=Gm(i),d=Va(),f=Mo(),p=Mo(),{nonce:m,disableStyleElements:h}=Im(),[g,_]=q.useState(!1),[v,y]=q.useState(!1),[b,x]=q.useState(!1),[S,C]=q.useState(!1),[w,T]=q.useState(!1),[E,D]=q.useState(Vm),[O,k]=q.useState(Vm),[A,j]=q.useState(Hm),[M,N]=q.useState(Um),P=q.useRef(null),F=q.useRef(null),I=q.useRef(null),ee=q.useRef(null),te=q.useRef(null),ne=q.useRef(null),re=q.useRef(null),L=q.useRef(null),R=q.useRef(0),ie=q.useRef(0),ae=q.useRef(0),oe=q.useRef(0),se=q.useRef(`vertical`),ce=q.useRef(Bm),z=q.useRef(null);function le(e){let t=e?x:y,n=e?f:p;t(!0),n.start(500,()=>{t(!1)})}let B=Qi(e=>{let t=e.x-ce.current.x,n=e.y-ce.current.y;ce.current=e,n!==0&&le(!0),t!==0&&le(!1)}),ue=Qi(()=>{let e=F.current;e&&z.current===null&&(z.current=e.style.scrollSnapType,e.style.scrollSnapType=`none`)}),de=Qi(e=>{if(e.button!==0||L.current!==null&&(se.current===`vertical`?te.current:ne.current)?.hasPointerCapture(L.current))return;L.current=e.pointerId,R.current=e.clientY,ie.current=e.clientX,se.current=e.currentTarget.getAttribute(zm);let t=F.current;t&&(ae.current=t.scrollTop,oe.current=t.scrollLeft,ue()),(se.current===`vertical`?te.current:ne.current)?.setPointerCapture(e.pointerId)}),fe=Qi(e=>{if(e.pointerId!==L.current)return;L.current=null,(se.current===`vertical`?x:y)(!1),z.current!==null&&(F.current&&(F.current.style.scrollSnapType=z.current),z.current=null);let t=se.current===`vertical`?te.current:ne.current;t?.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId)}),V=Qi(e=>{if(e.pointerId!==L.current)return;if(e.buttons%2==0){fe(e);return}let t=F.current;if(!t)return;let n=se.current===`vertical`,r=n?te.current:ne.current,i=n?I.current:ee.current;if(!r||!i)return;let a=n?`y`:`x`,o=Cm(i,`padding`,a),s=Cm(r,`margin`,a),c=n?r.offsetHeight:r.offsetWidth,l=(n?i.offsetHeight:i.offsetWidth)-c-o-s,u=n?e.clientY-R.current:e.clientX-ie.current,d=l<=0?0:u/l,f=n?t.scrollHeight:t.scrollWidth,p=n?t.clientHeight:t.clientWidth,m=(n?ae.current:oe.current)+d*(f-p);n?t.scrollTop=m:t.scrollLeft=m,e.preventDefault(),le(n)});function pe(e){C(e.pointerType===`touch`)}function me(e){if(pe(e),e.pointerType!==`touch`){let t=Qa(P.current,e.target);_(t)}}let he=q.useMemo(()=>({scrolling:v||b,hasOverflowX:!M.x,hasOverflowY:!M.y,overflowXStart:A.xStart,overflowXEnd:A.xEnd,overflowYStart:A.yStart,overflowYEnd:A.yEnd,cornerHidden:M.corner}),[v,b,M.x,M.y,M.corner,A]),ge={role:`presentation`,onPointerEnter:me,onPointerMove:me,onPointerDown:pe,onPointerLeave(){_(!1)},style:{position:`relative`,[Lm]:`${E.height}px`,[Rm]:`${E.width}px`}},_e=Aa(`div`,e,{state:he,ref:[t,P],props:[ge,o],stateAttributesMapping:Nm}),ve=q.useMemo(()=>({handlePointerDown:de,handlePointerMove:V,handlePointerUp:fe,handleScroll:B,disableViewportSnap:ue,cornerSize:E,setCornerSize:D,thumbSize:O,setThumbSize:k,hasMeasuredScrollbar:w,setHasMeasuredScrollbar:T,touchModality:S,cornerRef:re,scrollingX:v,scrollingY:b,hovering:g,setHovering:_,viewportRef:F,scrollbarYRef:I,scrollbarXRef:ee,thumbYRef:te,thumbXRef:ne,rootId:d,hiddenState:M,setHiddenState:N,overflowEdges:A,setOverflowEdges:j,viewportState:he,overflowEdgeThreshold:{xStart:s,xEnd:c,yStart:l,yEnd:u}}),[de,V,fe,B,ue,E,O,w,S,v,b,g,d,M,A,he,s,c,l,u]);return(0,J.jsxs)(xm.Provider,{value:ve,children:[!h&&Tm.getElement(m),_e]})});function Gm(e){let t=typeof e==`number`?{xStart:e,xEnd:e,yStart:e,yEnd:e}:e;return{xStart:Math.max(0,t?.xStart||0),xEnd:Math.max(0,t?.xEnd||0),yStart:Math.max(0,t?.yStart||0),yEnd:Math.max(0,t?.yEnd||0)}}function Km(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}var qm=q.createContext(void 0);function Jm(){let e=q.useContext(qm);if(e===void 0)throw Error(Oa(55));return e}function Ym(e,t){if(t<=0)return 0;let n=Km(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}var Xm=`--scroll-area-overflow-x-start`,Zm=`--scroll-area-overflow-x-end`,Qm=`--scroll-area-overflow-y-start`,$m=`--scroll-area-overflow-y-end`,eh=`--scroll-area-thumb-height`,th=`--scroll-area-thumb-width`,nh=[Xm,Zm,Qm,$m],rh=!1;function ih(){rh||La||(typeof CSS<`u`&&`registerProperty`in CSS&&nh.forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),rh=!0)}var ah=q.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{viewportRef:o,scrollbarYRef:s,scrollbarXRef:c,thumbYRef:l,thumbXRef:u,cornerRef:d,cornerSize:f,setCornerSize:p,setThumbSize:m,rootId:h,setHiddenState:g,hiddenState:_,setHasMeasuredScrollbar:v,handleScroll:y,touchModality:b,setHovering:x,setOverflowEdges:S,overflowEdgeThreshold:C,viewportState:w}=Sm(),T=Do(),E=q.useRef(!0),D=q.useRef([NaN,NaN,NaN,NaN]),O=Mo(),k=Mo(),A=Qi(()=>{let e=o.current,t=s.current,n=c.current,r=l.current,i=u.current,a=d.current;if(!e)return;let h=e.scrollHeight,_=e.scrollWidth,y=e.clientHeight,b=e.clientWidth,x=e.scrollTop,w=e.scrollLeft,E=D.current,O=Number.isNaN(E[0]);if(E[0]=y,E[1]=h,E[2]=b,E[3]=_,O&&v(!0),h===0||_===0)return;let k=oh(e),A=k.y,j=k.x,M=b/_,N=y/h,P=Math.max(0,_-b),F=Math.max(0,h-y),I=0,ee=0;j||(I=Ym(T===`rtl`?-w:w,P),ee=P-I);let te=A?0:Ym(x,F),ne=A?0:F-te,re=j?0:b,L=A?0:y,R=0,ie=0;!j&&!A&&(R=t?.offsetWidth||0,ie=n?.offsetHeight||0);let ae=f.width===0&&f.height===0,oe=ae?R:0,se=ae?ie:0,ce=Cm(n,`padding`,`x`),z=Cm(t,`padding`,`y`),le=Cm(i,`margin`,`x`),B=Cm(r,`margin`,`y`),ue=re-ce-le,de=L-z-B,fe=n?Math.min(n.offsetWidth-oe,ue):ue,V=t?Math.min(t.offsetHeight-se,de):de,pe=Math.max(16,fe*M),me=Math.max(16,V*N);if(m(e=>sh(e,{width:pe,height:me})),t&&r){let e=ch(r,eh,x,F,h,me,t.offsetHeight-me-z-B);r.style.transform=`translate3d(0,${e}px,0)`}if(n&&i){let e=n.offsetWidth-pe-ce-le,t=ch(i,th,T===`rtl`?-w:w,P,_,pe,e);i.style.transform=`translate3d(${T===`rtl`?-t:t}px,0,0)`}let he=[I,ee,te,ne];nh.forEach((t,n)=>{e.style.setProperty(t,`${he[n]}px`)}),a&&p(e=>sh(e,{width:R,height:ie})),g(e=>sh(e,k));let ge={xStart:!j&&I>C.xStart,xEnd:!j&&ee>C.xEnd,yStart:!A&&te>C.yStart,yEnd:!A&&ne>C.yEnd};S(e=>sh(e,ge))});io(()=>{ih()},[]),io(()=>{queueMicrotask(A)},[A,_,T,C.xStart,C.xEnd,C.yStart,C.yEnd]),io(()=>{o.current?.matches(`:hover`)&&x(!0)},[o,x]),io(()=>{let e=o.current;if(typeof ResizeObserver>`u`||!e)return;let t=!1,n=new ResizeObserver(()=>{if(!t){t=!0;let n=D.current;if(n[0]===e.clientHeight&&n[1]===e.scrollHeight&&n[2]===e.clientWidth&&n[3]===e.scrollWidth)return}A()});return n.observe(e),k.start(0,()=>{let t=vo(e,{subtree:!0});t.length!==0&&Promise.allSettled(t.map(e=>e.finished.then(la))).then(A).catch(()=>{})}),()=>{n.disconnect(),k.clear()}},[A,o,k]);function j(){E.current=!1}let M={...h&&{"data-id":`${h}-viewport`},tabIndex:_.x&&_.y?-1:0,className:Tm.className,style:{overflow:`scroll`},onScroll(){o.current&&(A(),(b||!E.current)&&y({x:o.current.scrollLeft,y:o.current.scrollTop}),O.start(100,()=>{E.current=!0}))},onWheel:j,onPointerMove:j,onPointerEnter:j,onKeyDown:j},N=Aa(`div`,e,{ref:[t,o],state:w,props:[M,a],stateAttributesMapping:Nm}),P=q.useMemo(()=>({computeThumbPosition:A}),[A]);return(0,J.jsx)(qm.Provider,{value:P,children:N})});function oh(e){let t=e.clientHeight>=e.scrollHeight,n=e.clientWidth>=e.scrollWidth;return{y:t,x:n,corner:t||n}}function sh(e,t){for(let n in t)if(e[n]!==t[n])return t;return e}function ch(e,t,n,r,i,a,o){let s=Km(n,0,r),c=n-s,l=Math.max(16,a*i/(i+Math.abs(c)));return e.style.setProperty(t,c?`${l}px`:``),(r?s/r*o:0)+(c>0?a-l:0)}var lh=q.createContext(void 0);function uh(){let e=q.useContext(lh);if(e===void 0)throw Error(Oa(54));return e}var dh=q.forwardRef(function(e,t){let{render:n,className:r,orientation:i=`vertical`,keepMounted:a=!1,style:o,...s}=e,{hovering:c,scrollingX:l,scrollingY:u,hiddenState:d,scrollbarYRef:f,scrollbarXRef:p,viewportRef:m,thumbYRef:h,thumbXRef:g,handlePointerDown:_,handlePointerUp:v,handleScroll:y,disableViewportSnap:b,rootId:x,thumbSize:S,hasMeasuredScrollbar:C,viewportState:w}=Sm(),T=i===`vertical`,E={...w,hovering:c,scrolling:T?u:l,orientation:i},D=Do(),O=!C&&!a,k=T?d.y:d.x,A=a||!k;q.useEffect(()=>{if(!A)return;let e=m.current,t=T?f.current:p.current;if(!t)return;function n(t){if(!e||t.ctrlKey)return;let n=!T,r=n?`scrollLeft`:`scrollTop`,i=n?t.deltaX:t.deltaY;if(i===0)return;let a=n?e.scrollWidth-e.clientWidth:e.scrollHeight-e.clientHeight,o=n&&D===`rtl`?-a:0,s=n&&D===`rtl`?0:a,c=e[r];c<=o&&i<0||c>=s&&i>0||(t.preventDefault(),e[r]=Math.min(s,Math.max(o,c+i)),y({x:e.scrollLeft,y:e.scrollTop}))}return co(t,`wheel`,n,{passive:!1})},[D,y,T,p,f,A,m]);let j={...x&&{"data-id":`${x}-scrollbar`},"aria-hidden":!0,onPointerDown(e){if(e.button!==0)return;let t=Xa(e.nativeEvent),n=T?h.current:g.current;if(n&&Qa(n,t))return;let r=m.current;if(!r)return;let i=T?f.current:p.current;if(!n||!i)return;let a=T?`y`:`x`,o=Cm(n,`margin`,a),s=Cm(i,`padding`,a),c=T?n.offsetHeight:n.offsetWidth,l=i.getBoundingClientRect(),u=T?e.clientY-l.top-c/2-s+o/2:e.clientX-l.left-c/2-s+o/2,d=T?r.scrollHeight:r.scrollWidth,v=T?r.clientHeight:r.clientWidth,x=(T?i.offsetHeight:i.offsetWidth)-c-s-o;if(x<=0)return;let S=u/x,C=d-v;b(),T?r.scrollTop=S*C:r.scrollLeft=D===`rtl`?-(1-S)*C:S*C,y({x:r.scrollLeft,y:r.scrollTop}),_(e)},onMouseDown(e){e.preventDefault()},onPointerUp:v,onPointerCancel:v,style:{position:`absolute`,touchAction:`none`,WebkitUserSelect:`none`,userSelect:`none`,visibility:O?`hidden`:void 0,...T?{top:0,bottom:`var(${Lm})`,insetInlineEnd:0,[eh]:`${S.height}px`}:{insetInlineStart:0,insetInlineEnd:`var(${Rm})`,bottom:0,[th]:`${S.width}px`}}},M=Aa(`div`,e,{ref:[t,T?f:p],state:E,props:[j,s],stateAttributesMapping:Nm});return A?(0,J.jsx)(lh.Provider,{value:i,children:M}):null}),fh=q.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{computeThumbPosition:o}=Jm(),{hasMeasuredScrollbar:s,viewportState:c}=Sm(),l=q.useRef(null),u=q.useRef(s);return io(()=>{if(typeof ResizeObserver>`u`)return;let e=!1,t=new ResizeObserver(()=>{!e&&(e=!0,!u.current)||o()});return l.current&&t.observe(l.current),()=>{t.disconnect()}},[o]),Aa(`div`,e,{ref:[t,l],state:c,stateAttributesMapping:Nm,props:[{role:`presentation`,style:{minWidth:`fit-content`}},a]})}),ph=q.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{thumbYRef:o,thumbXRef:s,handlePointerDown:c,handlePointerMove:l,handlePointerUp:u,scrollingX:d,scrollingY:f,hasMeasuredScrollbar:p}=Sm(),m=uh(),h=m===`vertical`;return Aa(`div`,e,{ref:[t,h?o:s],state:{scrolling:h?f:d,orientation:m},props:[{onPointerDown:c,onPointerMove:l,onPointerUp:u,onPointerCancel:u,style:{visibility:p?void 0:`hidden`,...h?{height:`var(--scroll-area-thumb-height)`}:{width:`var(--scroll-area-thumb-width)`}}},a]})});function mh(e,t,n){let r=(Math.abs(t)-Math.abs(e))/Math.max(16,n);if(Math.abs(r)<.035)return null;let i=Math.min(.04,Math.abs(r)*.3),a=r>0,o=Math.sign(t||e);return{scaleY:1+(a?i:-i),scaleX:1+(a?-i/2:i/2),origin:(a?o>0:o<0)?`center top`:`center bottom`}}function hh(e,t,n){if(t<=0||Math.abs(n)<4)return null;let r=e<=0&&n<0,i=e>=t-1&&n>0;if(!r&&!i)return null;let a=Math.min(.06,Math.abs(n)/120*.06);return{scaleY:1-a,scaleX:1+a/2,origin:r?`center top`:`center bottom`}}var gh=(0,q.forwardRef)(function({children:e,className:t,surface:n=!1,surfaceSize:r,surfaceDepth:i,screen:a=!1,...o},s){let c=(0,q.useRef)(null),l=(0,q.useRef)(null),u=ce();(0,q.useEffect)(()=>{let e=c.current,t=e?.querySelector(`.caps-scroll-viewport`);if(!t||!e)return;let n=null,r,i=t.scrollTop,a=performance.now(),o=0,s=e=>{let t=l.current;if(!e||u||!t)return;n?.cancel(),t.style.transformOrigin=e.origin;let r=Tt(t),i=Ur(r,{ease:`outQuad`,duration:45}),a=fi(r,{bounce:.18,duration:180});n=Po(t,{scaleY:[{to:e.scaleY,...i},{to:1,...a}],scaleX:[{to:e.scaleX,...i},{to:1,...a}]})},d=(e,t)=>{let n=mh(o,e,t);o=e,s(n)},f=e=>{if(e.ctrlKey||Math.abs(e.deltaX)>Math.abs(e.deltaY))return;let n=e.deltaMode===1?16:e.deltaMode===2?t.clientHeight:1,i=hh(t.scrollTop,t.scrollHeight-t.clientHeight,e.deltaY*n);i&&(clearTimeout(r),o=0,s(i))},p=()=>{let e=performance.now(),n=e-a,s=n>100?16:Math.max(16,n),c=t.scrollTop-i;n>100&&(o=0),d(c/s,s),i=t.scrollTop,a=e,clearTimeout(r),r=setTimeout(()=>{d(0,32)},64)};return t.addEventListener(`scroll`,p,{passive:!0}),e.addEventListener(`wheel`,f,{passive:!0}),()=>{clearTimeout(r),n?.cancel(),l.current&&(l.current.style.transform=`none`),t.removeEventListener(`scroll`,p),e.removeEventListener(`wheel`,f)}},[a,n,u]);let d=(0,J.jsx)(ah,{render:a?(0,J.jsx)(Fi,{}):(0,J.jsx)(`div`,{}),...o,ref:s,className:`caps-scroll-viewport`,children:(0,J.jsx)(fh,{style:{minWidth:0},children:e})});return(0,J.jsxs)(Wm,{render:n?(0,J.jsx)(Kr,{size:r??`md`,depth:i??`shallow`}):(0,J.jsx)(`div`,{}),ref:c,className:V(`caps-scroll-area`,t),children:[a?(0,J.jsx)(`div`,{className:`caps-display-gasket caps-scroll-display`,children:d}):d,(0,J.jsx)(Kr,{size:`sm`,depth:`deep`,placement:`embedded`,className:`caps-scroll-track-surface`,children:(0,J.jsx)(dh,{className:`caps-scroll-track`,children:(0,J.jsx)(ph,{className:`caps-scroll-thumb`,children:(0,J.jsx)(`span`,{className:`caps-scroll-thumb-surface`,ref:l})})})})]})}),_h=Ft(`ArrowLeft`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),vh=Ft(`ArrowRight`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),yh=Ft(`AudioLines`,[[`path`,{d:`M2 10v3`,key:`1fnikh`}],[`path`,{d:`M6 6v11`,key:`11sgs0`}],[`path`,{d:`M10 3v18`,key:`yhl04a`}],[`path`,{d:`M14 8v7`,key:`3a1oy3`}],[`path`,{d:`M18 5v13`,key:`123xd1`}],[`path`,{d:`M22 10v3`,key:`154ddg`}]]),bh=Ft(`ExternalLink`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),xh=Ft(`EyeOff`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Sh=Ft(`Eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Ch=Ft(`FolderPlus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),wh=Ft(`FolderTree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),Th=Ft(`Folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Eh=Ft(`ImagePlus`,[[`path`,{d:`M16 5h6`,key:`1vod17`}],[`path`,{d:`M19 2v6`,key:`4bpg5p`}],[`path`,{d:`M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5`,key:`1ue2ih`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}]]),Dh=Ft(`Image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),Oh=Ft(`Info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),kh=Ft(`Maximize`,[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]),Ah=Ft(`Mic`,[[`path`,{d:`M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z`,key:`131961`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`line`,{x1:`12`,x2:`12`,y1:`19`,y2:`22`,key:`x3vr5v`}]]),jh=Ft(`Minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),Mh=Ft(`Pause`,[[`rect`,{x:`14`,y:`4`,width:`4`,height:`16`,rx:`1`,key:`zuxfzm`}],[`rect`,{x:`6`,y:`4`,width:`4`,height:`16`,rx:`1`,key:`1okwgv`}]]),Nh=Ft(`Pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Ph=Ft(`Play`,[[`polygon`,{points:`6 3 20 12 6 21 6 3`,key:`1oa8hb`}]]),Fh=Ft(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Ih=Ft(`SlidersHorizontal`,[[`line`,{x1:`21`,x2:`14`,y1:`4`,y2:`4`,key:`obuewd`}],[`line`,{x1:`10`,x2:`3`,y1:`4`,y2:`4`,key:`1q6298`}],[`line`,{x1:`21`,x2:`12`,y1:`12`,y2:`12`,key:`1iu8h1`}],[`line`,{x1:`8`,x2:`3`,y1:`12`,y2:`12`,key:`ntss68`}],[`line`,{x1:`21`,x2:`16`,y1:`20`,y2:`20`,key:`14d8ph`}],[`line`,{x1:`12`,x2:`3`,y1:`20`,y2:`20`,key:`m0wm8r`}],[`line`,{x1:`14`,x2:`14`,y1:`2`,y2:`6`,key:`14e1ph`}],[`line`,{x1:`8`,x2:`8`,y1:`10`,y2:`14`,key:`1i6ji0`}],[`line`,{x1:`16`,x2:`16`,y1:`18`,y2:`22`,key:`1lctlv`}]]),Lh=Ft(`Upload`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`17 8 12 3 7 8`,key:`t8dd8p`}],[`line`,{x1:`12`,x2:`12`,y1:`3`,y2:`15`,key:`widbto`}]]),Rh=Et([g({kind:bn(`compose`),text:b.pipe(z(te(1)),z(D(2e3)))}),g({kind:bn(`navigate`),params:vt(g({key:b.pipe(z(te(1)),z(D(64))),value:b.pipe(z(D(1024)))})).pipe(z(D(16)))})]);Et([g({role:b.pipe(z(te(1)),z(D(80))),intent:Rh}),g({appId:b.pipe(z(te(1)),z(D(128))),intent:Rh})],{mode:`oneOf`});var zh=W({displayName:K().min(1).max(80).nullable()}).nullable(),Bh=je(`apps.open`,1,I(()=>ve({open:l,role:Cn(re(zh))})));je(`apps.call`,1,I(()=>ve({call:Cn(re(Xt().transform(e=>de(e))))})));var Vh=K().regex(/^[a-zA-Z0-9._-]{1,128}$/).refine(e=>e!==`.`&&e!==`..`),Hh=K().regex(/^[0-9a-f]{40}$/);W({ref:K().startsWith(`refs/`).max(1024),before:Hh,after:Hh}),I(()=>K().min(1).max(512));var Uh=`files`,Wh=W({name:K(),email:K()}),Gh=W({hash:Hh,treeHash:Hh,message:K(),author:Wh,committer:Wh,parents:Ie(Hh),authoredAt:H(),committedAt:H()}),Kh=W({name:K(),mode:K(),hash:Hh,type:j([`blob`,`tree`,`commit`])});W({ref:K(),commit:Gh,path:K(),entries:Ie(Kh)});var qh=65536,Jh=K().min(1).max(1024).refine(e=>!e.startsWith(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`&&e!==`.git`),`Choose a relative repository file path.`),Yh=K().min(1).max(256),Xh={repo:Vh,branch:Yh,path:Jh},Zh=j([`pending`,`synced`,`conflict`,`failed`]),Qh=W({text:K(),revision:H().int().positive(),state:Zh,theirs:W({blob:Hh.nullable(),commit:Hh}).optional(),failure:j([`branch_missing`,`access_changed`,`sync_failed`,`permanent_material`]).optional()});W({...Xh,baseBlob:Hh.nullable(),baseCommit:Hh,text:K().max(qh),revision:H().int().positive().nullable()});var $h=Rt([W({kind:Ve(`saved`),revision:H().int().positive(),state:Ve(`pending`)}),W({kind:Ve(`synced`),revision:H().int().positive(),commit:Hh}),W({kind:Ve(`conflict`),revision:H().int().nonnegative(),theirs:Qh.shape.theirs.optional()}),W({kind:Ve(`failed`),revision:H().int().positive(),reason:j([`branch_missing`,`access_changed`,`sync_failed`,`permanent_material`])}),W({kind:Ve(`refused`),reason:j([`not-source-writer`,`background-unavailable`])})]);W({...Xh,revision:H().int().positive()}),Rt([W({kind:j([`discarded`,`not_found`])}),W({kind:Ve(`conflict`),revision:H().int().positive()})]),W({settled:Ie(W({...Xh,result:$h})),more:O()}),W({version:H().int().positive().nullable(),commit:Hh,blob:Hh.nullable(),pending:Qh.optional(),ref:K(),path:K(),size:H(),binary:O(),text:K().nullable()}),W({ref:K(),commits:Ie(W({commit:Gh,agent:K().nullable()})),next:K().optional()}),W({ref:K(),commit:Gh,paths:Ie(K()),truncated:O()}),W({kind:Ve(`rebuilding`)}),W({done:O(),cursor:K().nullable()}),Rt([W({repository:Vh,branch:Yh,path:Jh}),W({path:K().min(1).max(1024)})]);var eg=e(Ot(),1),tg=`(max-width: 600px)`,ng=globalThis;function rg(e){let t=ng.matchMedia?.(tg);return t?.addEventListener(`change`,e),()=>{t?.removeEventListener(`change`,e)}}function ig(){return(0,q.useSyncExternalStore)(rg,()=>ng.matchMedia?.(tg).matches??!1,()=>!1)}function ag({className:e,...t}){let n=va(`toast`),r=ig();return n?(0,eg.createPortal)((0,J.jsx)(dt,{position:r?`bottom-center`:`top-right`,swipeDirections:r?[`bottom`]:[`right`,`top`],mobileOffset:{top:16,bottom:`max(16px, env(safe-area-inset-bottom))`,left:16,right:16},offset:16,gap:8,icons:{close:(0,J.jsx)(Ei,{"aria-hidden":`true`,size:12}),success:(0,J.jsx)(bi,{glyph:`dot`,tone:`success`}),error:(0,J.jsx)(bi,{glyph:`dot`,tone:`error`}),warning:(0,J.jsx)(bi,{glyph:`dot`,tone:`warning`}),info:(0,J.jsx)(bi,{glyph:`dot`,tone:`info`}),loading:(0,J.jsx)(ln,{decorative:!0,size:`sm`,tone:`current`,variant:`wander`})},className:V(`caps-toaster`,e),...t}),n):null}var og=4096,sg=255,cg=new TextEncoder,lg=b.pipe(z(te(1)),z(D(og)),z(F(e=>!e.includes(`\0`)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`&&cg.encode(e).byteLength<=sg),{description:`a relative folder inside the library`}))),ug=u(lg);function dg(e,t){return t===void 0?e:`${e}/${t}`}function fg(e,t){let n=`${e}/`;if(!t.startsWith(n))return;let r=t.slice(n.length).split(`/`).slice(0,-1).join(`/`);return ug(r)?r:void 0}function pg(e){if(e===void 0)return[];let t=e.split(`/`);return t.map((e,n)=>({name:e,folder:t.slice(0,n+1).join(`/`)}))}g({queue:vt(b.pipe(z(D(og)))).pipe(z(te(1))),offset:pn.pipe(z(Fe()),z(Ae(0)))});function mg(e){return!e.selectable&&e.atFolderRoot&&!e.loading&&!e.failed}var hg=_e({error:K()}),gg=K().min(1).max(4096),_g=j([`not_granted`,`not_found`,`conflict`,`invalid`,`unavailable`]),vg=_e({moved:Ie(_e({from:gg,to:gg})),failed:Ie(_e({path:gg,error:_g}))}),yg=_e({files:Ie(_e({path:gg,kind:j([`image`,`video`,`audio`]).nullable(),model:K().nullable(),modelLabel:K().nullable(),durationSeconds:H().nullable(),favorite:O()}))}),bg=_e({paths:Ie(gg),next:gg.nullable()});async function xg(e,t,n,r){let i=await e.capabilities.require(Ci).call(t,JSON.stringify(n)),a=r.safeParse(i);if(a.success)return a.data;let o=hg.safeParse(i);throw new G(o.success?`Prints refused ${t}: ${o.data.error}`:`Prints answered ${t} in an unexpected shape`,{code:`PROTOCOL`,retryable:!1})}function Sg(e,t){return xg(e,`moveFiles`,{paths:[...t.paths],folder:t.folder,createFolder:t.createFolder??!1,name:t.name},vg)}async function Cg(e,t){return(await xg(e,`describeFiles`,{paths:[...t]},yg)).files}async function wg(e,t,n){await xg(e,`setFavorite`,{paths:[...t],favorite:n},_e({favorite:O(),count:H()}))}function Tg(e,t,n){return xg(e,`listFavorites`,{after:t,limit:n},bg)}var Eg=24,Dg=256,Og=e=>e===null?null:e.kind===`folder`?e.path:`${e.kind}:${e.path}`,kg={all:e=>Pr.of(e,`prints`,`gallery`),listings:e=>[...kg.all(e),`listing`],listing:(e,t)=>[...kg.listings(e),t],file:(e,t)=>[...kg.all(e),`file`,t],describedAll:e=>[...kg.all(e),`described`],described:(e,t)=>[...kg.describedAll(e),...t]};function Ag(e,t){return t.modifiedAt-e.modifiedAt||(e.path<t.path?-1:+(e.path>t.path))}function jg(e){let t=new Map;for(let n of e)for(let e of n.entries)t.set(e.path,e);return[...t.values()].sort(Ag)}var Mg=/\.(avif|gif|jpe?g|png|svg|webp|mp4|mp3)$/i;function Ng(e,t){let n=e?.context.get().computerId,r=t?.path??null,i={queue:r===null?[]:[r],offset:0,after:null};return Us({queryKey:kg.listing(e,Og(t)),initialPageParam:i,enabled:!!(n&&r&&e.capabilities.has(_o)&&e.capabilities.has($a)),queryFn:async({pageParam:r,signal:i})=>{if(!e||!n||!t)throw new G(`No Computer folder selected`,{code:`SELECTION_CHANGED`,retryable:!1});let a=()=>{if(i.throwIfAborted(),e.context.get().computerId!==n)throw new G(`Computer selection changed`,{code:`SELECTION_CHANGED`,retryable:!1})};if(t.kind===`favorites`){let n=[];a();let i=await Tg(e,r.after,Dg);return a(),{entries:i.paths.filter(e=>Mg.test(e)).map(e=>({path:e,name:e.slice(e.lastIndexOf(`/`)+1),modifiedAt:0,size:0,...Pg(t.path,e)})),folders:n,next:i.next===null?null:{queue:[],offset:0,after:i.next}}}let o=[],s=[],c=[...r.queue],l=r.offset;for(;o.length<Dg&&c.length>0;){a();let n=c[0],r=await fo(e.capabilities,{path:n,limit:Dg-o.length,offset:l});if(a(),r.nextOffset!==null&&r.nextOffset<=l)throw new G(`Directory pagination did not advance`,{code:`PROTOCOL`,retryable:!1});let i=r.path.replace(/\/$/,``);for(let e of r.entries)e.name.startsWith(`.`)||(e.type===`directory`?t.kind===`all`?c.push(`${i}/${e.name}`):s.push(e.name):e.type===`file`&&Mg.test(e.name)&&o.push({...e,path:`${i}/${e.name}`,...Pg(t.path,`${i}/${e.name}`)}));r.nextOffset===null?(c=c.slice(1),l=0):l=r.nextOffset}return{entries:o,folders:s,next:c.length===0?null:{queue:c,offset:l,after:null}}},getNextPageParam:e=>e.next})}function Pg(e,t){let n=fg(e,t);return n===void 0?{}:{folder:n}}function Fg(e,t,n){return{...mi(e,$a,[...kg.file(e,t.path),t.modifiedAt,t.size],async(n,r)=>{if(!e)throw new G(`Prints disconnected`,{code:`DISCONNECTED`,retryable:!0});let i=await yo(e.capabilities,{path:t.path},{signal:r});return new File([i],i.name,{type:i.type,lastModified:t.modifiedAt})}),enabled:!!(n&&e?.context.get().computerId&&e.capabilities.has($a)),structuralSharing:!1}}function Ig(e,t){let n=e?.app??null,r=zf(n),i=on(),[a,o]=(0,q.useState)(()=>new Set),s=(0,q.useCallback)(e=>{if(!r)return;let t=`${r}:${e}`;o(e=>e.has(t)?e:new Set([...e,t]))},[r]),c=(0,q.useCallback)(e=>{s(e),i.resetQueries({queryKey:kg.file(n,e)})},[n,i,s]),l=Ng(n,t),u=Ks(l),d=u.fetchNextPage;(0,q.useEffect)(()=>{l.enabled&&u.hasNextPage&&!u.isFetching&&!u.error&&d({cancelRefetch:!1})},[l.enabled,u.hasNextPage,u.isFetching,u.error,d]);let f=!u.hasNextPage||u.error!==null,p=(0,q.useMemo)(()=>l.enabled&&u.data&&f?jg(u.data.pages):[],[u.data,l.enabled,f]),m=`${r??``}|${Og(t)??``}`,[h,g]=(0,q.useState)({key:m,count:Eg}),_=h.key===m?h.count:Eg,v=(0,q.useMemo)(()=>p.slice(0,_),[p,_]),y=p.length>_,b=(0,q.useCallback)(e=>({files:e.flatMap((e,t)=>e.data?[{path:v[t].path,file:e.data}]:[]),failures:e.flatMap((e,t)=>e.isError?[v[t].name]:[]),loading:e.some(e=>e.isLoading)}),[v]),x=Hs({queries:v.map(e=>Fg(n,e,!!(r&&a.has(`${r}:${e.path}`)))),combine:b});return(0,q.useEffect)(()=>{if(!n)return;let e=kg.all(n),t=kg.listings(n),a=!0;i.invalidateQueries({queryKey:e});let o=()=>{i.cancelQueries({queryKey:e})},s=n.context.subscribe(e=>{e.computerId!==r&&o()}),c=n.lifecycle.subscribe(e=>{(e===`disconnected`||e===`disposing`||e===`disposed`)&&o()}),l=n.capabilities.subscribe(()=>{queueMicrotask(()=>{!a||n.context.get().computerId!==r||i.resetQueries({queryKey:t})})});return()=>{a=!1,s(),c(),l(),o()}},[n,r,e,i]),{entries:v,folders:(0,q.useMemo)(()=>[...new Set(u.data?.pages.flatMap(e=>e.folders)??[])],[u.data]),loadFile:s,retryFile:c,files:x.files,failures:x.failures,error:u.error,loading:u.isFetching||!f||x.loading,hasNextPage:y,nextPageReady:y,refresh:()=>{u.refetch({cancelRefetch:!1})},loadMore:()=>{y&&g({key:m,count:_+Eg})}}}function Lg(e){return e.replace(/\s/gu,` `).replace(/ +/g,` `).trim()}function Rg(e,t,n){let r=e.replace(/\/$/,``),i=t.lastIndexOf(`.`),a=i>0?t.slice(0,i):t,o=i>0?t.slice(i):``,s=`${r}/${t}`;for(let e=2;n(s);e+=1)s=`${r}/${a} ${String(e)}${o}`;return s}async function zg(e,t){let n=e.replace(/\/$/,``),r=new Set,i=0;for(;i!==null;){let e=await t(i);if(e.nextOffset!==null&&e.nextOffset<=i)throw Error(`Directory pagination did not advance`);for(let t of e.entries)r.add(`${n}/${t.name}`);i=e.nextOffset}return r}function Bg(e,t){let[n,r]=(0,q.useState)([]),i=(0,q.useRef)(new Map),a=(0,q.useRef)(Promise.resolve()),[o,s]=(0,q.useState)(null),c=(0,q.useRef)(new Map),l=(0,q.useRef)(e);l.current=e;let u=(0,q.useRef)(t);u.current=t;let d=(e,t,n)=>{let a=i.current.get(e);a&&i.current.set(e,{...a,status:t,message:n}),r([...i.current.values()])},f=(0,q.useCallback)(async(e,t)=>{let n=()=>t.signal.aborted;if(n()){d(e.id,`cancelled`,`Cancelled before sending`),c.current.delete(e.id);return}let r=e.dimensions;if(!r)try{let t=await xo(e.file,e.previewUrl);r={width:t.width,height:t.height},e.dimensions=r;let n=i.current.get(e.id);n&&i.current.set(e.id,{...n,dimensions:r})}catch(t){tn(`decode-upload-image`,t),d(e.id,`error`,`Could not decode this image. No upload was sent.`),c.current.delete(e.id);return}try{if(n()){d(e.id,`cancelled`,`Cancelled before sending`);return}if(e.app.context.get().computerId!==e.computerId){d(e.id,`error`,`Computer changed. Select the original Computer and retry. No upload was sent.`);return}u.current({id:e.id,path:e.path,computerId:e.computerId,app:e.app,width:r.width,height:r.height}),d(e.id,`sending`,`Sending; awaiting Computer completion`),await Ha(e.app.capabilities,{path:e.path,content:e.file.slice()},{signal:t.signal}),d(e.id,`complete`,`Written to Computer`);try{await l.current(e.path,e.app,e.computerId)}catch(t){tn(`refresh-upload-preview`,t),d(e.id,`complete`,`Written; fresh preview unavailable`)}}catch(t){n()||tn(`write-computer-upload`,t),d(e.id,n()?`cancelled`:`error`,n()?`Cancelled request; check Computer before retrying`:`Completion not confirmed; check Computer or retry`)}finally{c.current.delete(e.id)}},[]),p=e=>{let t=new AbortController;c.current.set(e.id,t),d(e.id,`queued`,`Queued`),a.current=a.current.then(()=>f(e,t))},m=(0,q.useCallback)(()=>{for(let e of c.current.values())e.abort()},[]);return(0,q.useEffect)(()=>()=>{m();for(let e of i.current.values())URL.revokeObjectURL(e.previewUrl)},[m]),{items:n,error:o,cancelAll:m,add(e,t,n,r=new Set){s(null);let a=[...i.current.values()].reduce((e,t)=>e+t.file.size,0);for(let o of e){if(!o.type.startsWith(`image/`)){s(`Only image files can be uploaded here`);continue}if(i.current.size>=8||a+o.size>67108864){s(`Upload queue limit: eight files and 64 MiB. Remove finished rows before adding more.`);break}let e=n.context.get().computerId;if(!e){s(`Select a Computer before uploading images.`);continue}let c=Rg(t,Lg(o.name),e=>r.has(e)||i.current.has(e)),l={computerId:e,id:c,file:o,previewUrl:URL.createObjectURL(o),app:n,path:c,status:`queued`,message:`Queued`};i.current.set(l.id,l),a+=o.size,p(l)}},cancel(e){c.current.get(e)?.abort()},retry(e){let t=n.find(t=>t.id===e);t&&!c.current.has(e)&&p(t)},remove(e){if(!c.current.has(e)){let t=i.current.get(e);t&&URL.revokeObjectURL(t.previewUrl),i.current.delete(e),r([...i.current.values()])}}}}function Vg(e){return e.source.kind===`computer`?`${e.source.computerId}:${e.source.path}`:e.file.name}function Hg(e){return e.connection.app.ui.openNavigation({computerId:e.computerId,path:e.path})}function Ug(e){let[t,n]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(n(!1),!e?.capabilities.has(Bh))return;let t=!0;return e.capabilities.require(Bh).role(Uh).then(e=>{t&&n(e!==null)},e=>{tn(`files-editor-role`,e)}),()=>{t=!1}},[e]),t}function Wg(e,t){let n=t.landingPath,r=zf(e?.app),i=(0,q.useRef)(new Set),a=(0,q.useRef)(0),o=(0,q.useRef)(e);o.current=e;let s=e?.app.capabilities.has(_o)===!0,c=e?.app.capabilities.has($a)===!0,l=e?.app.capabilities.has(Ra)===!0,u=Ig(e,t.source),[d,f]=(0,q.useState)([]),[p,m]=(0,q.useState)([]),[h,g]=(0,q.useState)([]),[_,v]=(0,q.useState)([]);(0,q.useEffect)(()=>{v([])},[e]);let y=e=>{v(t=>t.some(t=>t.key===e.key)?t.map(t=>t.key===e.key?e:t):[...t,e])},[b,x]=(0,q.useState)(!1),S=(0,q.useMemo)(()=>[...u.error?[`Could not refresh the Media gallery`]:[],...u.failures],[u.error,u.failures]),C=(0,q.useRef)(new WeakMap),w=(0,q.useMemo)(()=>{if(!c||!s)return d.filter(e=>e.kind===`local`);let t=r?u.files.map(({file:t,path:n})=>({kind:`computer`,computerId:r,connection:e,file:t,path:n})):[],i=d.filter(t=>t.kind===`local`||t.computerId===r&&t.connection===e&&t.path.slice(0,t.path.lastIndexOf(`/`))===n?.replace(/\/$/,``));return[...t.filter(e=>!i.some(t=>t.kind===`computer`&&e.kind===`computer`&&t.path===e.path)),...i]},[e,r,n,u.files,d,c,s]),T=(0,q.useCallback)(()=>{a.current+=1;for(let e of i.current)e.abort();i.current.clear()},[]);(0,q.useEffect)(()=>{if(!e)return()=>{T()};let t=e.app.lifecycle.subscribe(e=>{(e===`disconnected`||e===`disposing`||e===`disposed`)&&T()});return()=>{t(),T()}},[e,T]),(0,q.useEffect)(()=>{if(e)return e.app.context.subscribe(e=>{e.computerId!==r&&T()})},[e,r,T]),(0,q.useEffect)(()=>{v([]),f(e=>e.filter(e=>e.kind===`local`))},[r]);let E=(0,q.useCallback)(async(e,t,n)=>{let r=n??t.app.context.get().computerId;if(!r){g([`The selected Computer is unavailable`]);return}if(o.current!==t){g([`Computer selection changed`]);return}if(t.app.context.get().computerId!==r){g([`Computer selection changed before the preview was loaded`]);return}let s=a.current,c=new AbortController;i.current.add(c);try{let n=await yo(t.app.capabilities,{path:e},{signal:c.signal});if(c.signal.aborted||s!==a.current)return;v(t=>t.map(t=>t.key===`${r}:${e}`?{...t,previewFile:n}:t)),f(i=>[...i.filter(t=>t.kind!==`computer`||t.path!==e||t.computerId!==r),{kind:`computer`,computerId:r,file:n,path:e,connection:t}])}catch(t){c.signal.aborted||(tn(`read-computer-file`,t),g([`Could not read ${e}`]),v(t=>t.map(t=>t.key===`${r}:${e}`?{...t,error:`Saved; preview unavailable. Retry loading it.`}:t)))}finally{i.current.delete(c)}},[]),D=(0,q.useCallback)(t=>{let n=d.find(n=>n.kind===`computer`&&n.connection===e&&n.computerId===r&&n.path===t);n?.kind===`computer`?E(t,n.connection,n.computerId):u.retryFile(t)},[d,e,r,E,u.retryFile]),O=(0,q.useRef)(new Set),k=(0,q.useRef)(new Set),A=(0,q.useRef)(new Map),j=(0,q.useRef)(new Map),M=(0,q.useCallback)(e=>{URL.revokeObjectURL(e),O.current.delete(e);let t=j.current.get(e);t&&A.current.delete(t),j.current.delete(e)},[]);(0,q.useEffect)(()=>{let e=!0,t=new Set,n=new Map,r=new Set,i=[...w].sort((e,t)=>Ag({modifiedAt:e.file.lastModified,path:e.kind===`computer`?e.path:e.file.name},{modifiedAt:t.file.lastModified,path:t.kind===`computer`?t.path:t.file.name})).map(e=>{let t=A.current.get(e.file)??URL.createObjectURL(e.file);return A.current.set(e.file,t),j.current.set(t,e.file),O.current.add(t),{source:e,file:e.file,url:t}}),a=i.length;return g(S),x(a>0),a===0&&m([]),i.forEach(({file:o,url:s,source:c},l)=>{let u=C.current.get(o);u||(u=(async()=>{let e=URL.createObjectURL(o);try{let{width:t,height:n}=await xo(o,e);return{width:t,height:n}}finally{URL.revokeObjectURL(e)}})(),C.current.set(o,u)),u.then(r=>{e&&(n.set(l,{...r,file:o,url:s,source:c}),t.add(s),m(i.flatMap((e,t)=>{let r=n.get(t);return r?[r]:[]})),v(e=>e.map(e=>e.previewFile===o?{...e,resolved:!0,previewFile:void 0,error:void 0}:e)))}).catch(t=>{e&&(tn(`decode-gallery-image`,t),M(s),r.add(o.name),g([...S,...r]),c.kind===`computer`&&v(e=>e.map(e=>e.key===`${c.computerId}:${c.path}`?{...e,error:`Could not decode the saved image.`}:e)))}).finally(()=>{--a,e&&a===0&&(x(!1),m(i.flatMap((e,t)=>{let r=n.get(t);return r?[r]:[]})))})}),()=>{e=!1;for(let{url:e}of i)!t.has(e)&&!k.current.has(e)&&M(e)}},[w,S,M]),(0,q.useEffect)(()=>{let e=new Set(p.map(e=>e.url));for(let t of k.current)e.has(t)||M(t);k.current=e},[p,M]),(0,q.useEffect)(()=>{let e=O.current;return()=>{for(let t of e)URL.revokeObjectURL(t);e.clear()}},[]);let N=Bg(async(e,t,n)=>{let r=o.current,i=r?.app===t&&t.context.get().computerId===n?r:null;i&&await E(e,i,n)},e=>{o.current?.app===e.app&&e.app.context.get().computerId===e.computerId&&y({key:`${e.computerId}:${e.path}`,path:e.path,computerId:e.computerId,width:e.width,height:e.height,uploadId:e.id})});return(0,q.useEffect)(()=>{let t=N.cancelAll,n=e?.app.lifecycle.subscribe(e=>{(e===`disposing`||e===`disconnected`||e===`disposed`)&&t()});return()=>{n?.(),t()}},[e,N.cancelAll]),{images:p,failed:h,loading:b,gallery:u,gallerySlots:_,canBrowse:s,canRead:c,canWrite:l,reserveSlot:y,addComputerFile:E,retryFile:D,uploads:N,uploadFiles:async i=>{if(!e||!l||n===null)return;let a=e,s=r,c=await t.ensureCreated();if(c){g([c]);return}if(o.current!==a||a.app.context.get().computerId!==s)return;let u;try{u=await zg(n,e=>fo(a.app.capabilities,{path:n,limit:500,offset:e}))}catch(e){tn(`list-upload-destination`,e),g([`Could not check the Computer folder. No upload was sent.`]);return}o.current===a&&a.app.context.get().computerId===s&&N.add(i,n,a.app,u)},failSlot:(e,t)=>{v(n=>n.map(n=>n.key===e?{...n,error:t}:n))},clearSlotError:e=>{v(t=>t.map(t=>t.key===e?{...t,error:void 0}:t))},removeSlot:e=>{v(t=>t.filter(t=>t.key!==e))}}}function Gg(e){return e.map(e=>e.key)}function Kg(e,t,n){let r=e.indexOf(t);return r<0?null:e[r+n]??null}function qg(e,t,n){if(e.includes(t))return t;let r=n.indexOf(t);if(r>=0){let t=new Set(e);for(let e=1;e<n.length;e+=1)for(let i of[e,-e]){let e=r+i;if(e<0||e>=n.length)continue;let a=n[e];if(t.has(a))return a}}return e[0]??null}var Jg=M(`badge caps-badge`,{variants:{tone:{neutral:`badge-neutral`,primary:`badge-primary`,secondary:`badge-secondary`,accent:`badge-accent`,success:`badge-success`,info:`badge-info`,warning:`badge-warning`,error:`badge-error`},size:{sm:`badge-sm`,default:`badge-md`,lg:`badge-lg`},variant:{solid:``,quiet:`caps-badge-quiet`}},defaultVariants:{tone:`neutral`,size:`default`}}),Yg=(0,q.forwardRef)(function({className:e,size:t,tone:n,variant:r,...i},a){return(0,J.jsx)(`span`,{...i,className:V(Jg({size:t,tone:n,variant:r}),e),ref:a})});function Xg(e){return e?.closest(`[data-app-pane="media"]`)??e}var Zg={voice:`Voice`,sfx:`Sound effects`,music:`Music`};function Qg(e){return e.audio.mode===`speech`?`voice`:`music`}function $g(e){return e.flatMap(e=>e.audio===null?[]:[{id:e.id,label:e.label,audio:e.audio}])}function e_(e){return e.audio===null?null:e.audio.mode===`speech`?`voice`:`music`}function t_(e){let t=new Set(e.map(Qg));return[`voice`,`sfx`,`music`].filter(e=>t.has(e))}function n_(e,t){return e.filter(e=>Qg(e)===t)}function r_({modes:e,value:t,onChange:n,disabled:r=!1}){return(0,J.jsx)(Sr,{className:`prints-audio-modes`,value:t,onValueChange:t=>{let r=e.find(e=>e===t);r!==void 0&&n(r)},children:(0,J.jsx)(Er,{"aria-label":`Audio type`,className:`prints-audio-modes-list`,variant:`segmented`,children:e.map(e=>(0,J.jsx)(Gn,{"data-audio-mode":e,disabled:r,value:e,children:Zg[e]},e))})})}function i_({label:e,name:t,options:n,value:r,disabled:i,onChange:a,icon:o,compact:s=!1}){let[c,l]=(0,q.useState)(null);return(0,J.jsx)(`span`,{className:`contents`,ref:l,children:(0,J.jsxs)(Co,{children:[(0,J.jsx)(Ia,{"aria-label":t,disabled:i||n.length===0,render:(t,n)=>(0,J.jsx)(_t,{...t,className:V(`parakeet-composer-model-key`,s&&`prints-audio-key-compact`),expanded:n.open,icon:o,label:e,readout:(0,J.jsx)(ai,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)] shrink-0`})})}),(0,J.jsx)(qa,{align:`start`,"aria-label":t,container:Xg(c),side:`top`,children:n.map(e=>(0,J.jsx)(Wa,{checked:e.value===r,closeOnClick:!0,onSelect:()=>{a(e.value)},children:e.label},String(e.value)))})]})})}function a_({models:e,value:t,onChange:n,disabled:r=!1}){let i=e.find(e=>e.id===t);return(0,J.jsx)(i_,{disabled:r,label:i===void 0?`Model`:Rn(i),name:`Generation model`,onChange:n,options:e.map(e=>({value:e.id,label:e.label})),value:t})}function o_({voices:e,value:t,onChange:n,disabled:r=!1}){let i=e.find(e=>e.id===t);return(0,J.jsx)(i_,{disabled:r,compact:!0,icon:(0,J.jsx)(Ah,{}),label:i?.label??`Voice`,name:`Voice`,onChange:n,options:e.map(e=>({value:e.id,label:e.label})),value:t})}var s_=[10,15,30,60,90,120,180,300,600];function c_(e){let t=s_.filter(t=>t>=e.min&&t<=e.max);return[...new Set([...t,e.default])].sort((e,t)=>e-t)}function l_({seconds:e,value:t,onChange:n,disabled:r=!1}){return(0,J.jsx)(i_,{disabled:r,compact:!0,icon:(0,J.jsx)(_i,{}),label:Ai(t),name:`Length`,onChange:n,options:c_(e).map(e=>({value:e,label:Ai(e)})),value:t})}var u_=null;function d_(e,t){let n=(0,q.useRef)(null),r=(0,q.useRef)(t);r.current=t;let[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(0);(0,q.useEffect)(()=>()=>{let e=n.current;e!==null&&(e.pause(),u_===e&&(u_=null),n.current=null)},[e]),(0,q.useEffect)(()=>{if(!i)return;let e=0,t=()=>{let r=n.current;r!==null&&r.duration>0&&s(Math.min(1,r.currentTime/r.duration)),e=requestAnimationFrame(t)};return e=requestAnimationFrame(t),()=>{cancelAnimationFrame(e)}},[i]);let c=(0,q.useCallback)(()=>{if(n.current!==null)return n.current;let t=new Audio(e);return t.preload=`auto`,t.addEventListener(`ended`,()=>{a(!1),s(0),u_===t&&(u_=null)}),t.addEventListener(`pause`,()=>{a(!1)}),t.addEventListener(`error`,()=>{a(!1),r.current(`This audio could not be played.`)}),n.current=t,t},[e]);return{playing:i,progress:o,toggle:(0,q.useCallback)(()=>{let e=c();if(!e.paused){e.pause();return}u_!==null&&u_!==e&&u_.pause(),u_=e,a(!0),e.play().catch(e=>{tn(`play-audio`,e),a(!1),r.current(`This audio could not be played.`)})},[c]),seek:(0,q.useCallback)(e=>{let t=c();Number.isFinite(t.duration)&&t.duration>0&&(t.currentTime=Math.min(1,Math.max(0,e))*t.duration,s(Math.min(1,Math.max(0,e))))},[c])}}function f_({url:e,progress:t=0,bars:n=64,className:r}){let i=Wr(e,n),a=i.status===`ready`?i.peaks:null;return(0,J.jsx)(`span`,{"aria-hidden":`true`,className:V(`prints-waveform`,r),"data-waveform":i.status,children:Array.from({length:n},(e,r)=>(0,J.jsx)(`span`,{className:`prints-waveform-bar`,"data-played":r/n<t?``:void 0,style:{height:`max(2px, ${String((a?.[r]??0)*100)}%)`}},r))})}function p_({facts:e}){let t=d_(e.url,at),n=Wr(e.url,96),r=e.durationSeconds??(n.status===`ready`?n.durationSeconds:void 0),i=e.mode===void 0?`Audio`:Zg[e.mode],a=t.progress*(r??0);return(0,J.jsxs)(`section`,{"aria-label":`${i} print`,className:`prints-audio-stage`,"data-audio-stage":!0,children:[(0,J.jsx)(Yg,{size:`sm`,variant:`quiet`,children:i}),(0,J.jsx)(`button`,{"aria-label":`Seek`,className:`prints-audio-stage-seek`,type:`button`,onClick:e=>{let n=e.currentTarget.getBoundingClientRect();t.seek((e.clientX-n.left)/n.width)},children:(0,J.jsx)(f_,{bars:96,className:`prints-audio-stage-waveform`,progress:t.progress,url:e.url})}),(0,J.jsxs)(`div`,{className:`prints-audio-stage-controls`,children:[(0,J.jsx)(pt,{"aria-label":t.playing?`Pause`:`Play`,icon:t.playing?(0,J.jsx)(Mh,{}):(0,J.jsx)(Ph,{}),iconSize:`md`,size:`default`,variant:`accent`,onClick:t.toggle}),(0,J.jsxs)(`span`,{className:`prints-audio-stage-time`,children:[Ai(a,`elapsed`),r===void 0?null:` / ${Ai(r)}`]})]})]})}var m_=(0,q.lazy)(async()=>({default:(await Rr(()=>import(`./print-download-button-CwK9wdo2.js`),__vite__mapDeps([0,1,2,3,4]),import.meta.url)).PrintDownloadButton}));function h_({url:e,path:t,onError:n,autoPlay:r}){let i=(0,q.useRef)(null);return(0,q.useEffect)(()=>{let t=i.current;if(!t)return;let a=!1;return r&&t.play().catch(t=>{a||t instanceof DOMException&&(t.name===`NotAllowedError`||t.name===`AbortError`)||(tn(`play-print-video`,t),n(e))}),()=>{a=!0,t.pause()}},[e,n,r]),(0,J.jsx)(`video`,{ref:i,src:e,"aria-label":t,controls:!0,playsInline:!0,preload:`auto`,className:`block max-h-full max-w-full object-contain`,onError:()=>{n(e)}})}function g_({item:e,actualSize:t}){let[n,r]=(0,q.useState)(null),[i,a]=(0,q.useState)(null),o=e.pending===!0&&!e.onVisible,[s,c]=(0,q.useState)(o);o&&!s&&c(!0);let l=e.pendingLabel??`Loading print…`,u=o?`Not saved`:`Prints can’t show this file`,d=(0,J.jsx)(`img`,{src:e.url,alt:e.path,decoding:`async`,width:t?e.width:void 0,height:t?e.height:void 0,className:t?`block max-w-none`:`block max-h-full max-w-full object-contain`,onLoad:()=>{r(e.url)},onError:()=>{a(e.url)}},e.url);return(0,J.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 items-center justify-center overflow-hidden`,"data-print-viewer-stage":!0,children:e.error||i===e.url?(0,J.jsx)(bm,{status:`failed`,className:`h-full w-full`,failure:(0,J.jsxs)(`div`,{className:`flex max-w-full flex-col items-center gap-sm px-md text-center`,children:[(0,J.jsx)(`p`,{className:`max-w-full break-words text-sm`,children:e.path}),(0,J.jsx)(vm,{density:`tile`,message:e.error?`${u}: ${e.error}`:u,onRetry:e.onRetry,onDismiss:e.onDismiss})]})}):an(e.path)&&e.url?(0,J.jsx)(p_,{facts:{url:e.url}}):lo(e.path)&&e.url?(0,J.jsx)(h_,{url:e.url,path:e.path,onError:a,autoPlay:!s}):e.url?(0,J.jsxs)(J.Fragment,{children:[t?(0,J.jsx)(gh,{className:`h-full w-full`,role:`region`,"aria-label":`Actual-size print`,tabIndex:0,"data-print-viewer-scroll":!0,children:d}):d,n===e.url?null:(0,J.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,J.jsx)(ln,{label:`Loading print`,variant:`bloom`})})]}):(0,J.jsx)(bm,{status:`generating`,label:l,className:`h-full w-full`,indicator:(0,J.jsxs)(`div`,{"aria-hidden":`true`,className:`flex max-w-full flex-col items-center gap-sm px-md text-center`,children:[(0,J.jsx)(ln,{decorative:!0,variant:`bloom`}),(0,J.jsx)(`p`,{className:`text-sm`,children:l})]})})})}var __=`(max-width: 640px)`;function v_(){return(0,q.useSyncExternalStore)(e=>{let t=globalThis.matchMedia(__);return t.addEventListener(`change`,e),()=>{t.removeEventListener(`change`,e)}},()=>globalThis.matchMedia(__).matches,()=>!1)}function y_(e){let[t,n]=(0,q.useState)(!1);return{pending:t,open:()=>{e&&(n(!0),Hg(e).catch(t=>{tn(`open-print-in-inkcap`,t),xi(`Could not open ${e.path} in Inkcap.`,`prints-inkcap-open`)}).finally(()=>{n(!1)}))}}}function b_({source:e,app:t,inkcap:n,phone:r}){let i=e.kind===`computer`&&n?e:null,a=y_(i);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(q.Suspense,{fallback:null,children:(0,J.jsx)(m_,{source:e,app:t,presentation:r?`menu`:`key`,menuItems:i?(0,J.jsx)(so,{disabled:a.pending,onSelect:a.open,children:`Open in Inkcap`}):void 0})}),i&&!r?(0,J.jsx)(_t,{label:`Open in Inkcap`,icon:(0,J.jsx)(bh,{}),disabled:a.pending,onClick:a.open}):null]})}function x_({items:e,images:t,viewerKey:n,app:r,onNavigate:i,onClose:a,renderInfo:o}){let s=(0,q.useRef)(null),c=Ug(r),l=v_(),u=Gg(e),d=(0,q.useRef)(u),f=n===null?null:qg(u,n,d.current);(0,q.useEffect)(()=>{d.current=u,n!==null&&f!==n&&(f===null?a(n):i(f))},[u,f,n,a,i]),(0,q.useEffect)(()=>{if(f===null)return;let t=e.findIndex(e=>e.key===f);for(let n of e.slice(Math.max(0,t-1),t+2))n.onVisible?.()},[e,f]);let[p,m]=(0,q.useState)(null),[h,g]=(0,q.useState)(null);(0,q.useEffect)(()=>{g(null)},[f]),(0,q.useEffect)(()=>{m(null)},[n]);let _=e.find(e=>e.key===f),v=t.find(e=>Vg(e)===f);if(!_||f===null)return null;let y=Kg(u,f,-1),b=Kg(u,f,1),x=_.path.split(`/`).at(-1)??_.path,S=()=>{a(f)},C=e=>{e!==null&&i(e)};return(0,J.jsx)(cm,{open:!0,onOpenChange:e=>{e||S()},children:(0,J.jsxs)(um,{children:[(0,J.jsx)(dm,{}),(0,J.jsxs)(fm,{ref:s,size:`fill`,initialFocus:s,finalFocus:!1,className:`flex min-h-0 flex-col gap-sm`,onKeyDown:e=>{e.altKey||e.ctrlKey||e.metaKey||e.target instanceof HTMLElement&&e.target.closest(`input, textarea, select, video, [data-print-viewer-scroll], [contenteditable=true]`)||(e.key===`ArrowLeft`||e.key===`ArrowRight`?(e.preventDefault(),C(e.key===`ArrowLeft`?y:b)):e.key.toLowerCase()===`i`&&v&&(e.preventDefault(),m(p===f?null:f)))},children:[(0,J.jsx)(Fi,{className:`prints-viewer-frame`,children:(0,J.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,J.jsxs)(`div`,{className:`prints-viewer-caption`,"data-print-viewer-caption":!0,children:[(0,J.jsx)(gm,{className:`prints-viewer-caption-name truncate text-xs font-normal`,children:x}),(0,J.jsxs)(`span`,{className:`prints-viewer-caption-position`,"aria-live":`polite`,"aria-atomic":`true`,children:[(0,J.jsxs)(`span`,{className:`sr-only`,children:[x,`, `]}),u.indexOf(f)+1,` of `,u.length]})]}),(0,J.jsxs)(`div`,{className:`@container relative flex min-h-0 min-w-0 flex-1`,children:[(0,J.jsx)(g_,{item:_,actualSize:h===f},f),p===f&&v?o(v,()=>{m(null)}):null]})]})}),(0,J.jsxs)(`div`,{className:`prints-viewer-actions`,children:[(0,J.jsx)(pt,{size:`default`,iconSize:`md`,"aria-label":`Previous print`,title:`Previous print (Left arrow)`,"aria-keyshortcuts":`ArrowLeft`,icon:(0,J.jsx)(_h,{}),disabled:y===null,onClick:()=>{C(y)}}),(0,J.jsx)(pt,{size:`default`,iconSize:`md`,"aria-label":`Next print`,title:`Next print (Right arrow)`,"aria-keyshortcuts":`ArrowRight`,icon:(0,J.jsx)(vh,{}),disabled:b===null,onClick:()=>{C(b)}}),(0,J.jsx)(pt,{size:`default`,iconSize:`md`,"aria-label":`Image info`,title:`Image info (I)`,"aria-keyshortcuts":`i`,"aria-expanded":p===f,icon:(0,J.jsx)(Oh,{}),disabled:!v,onClick:()=>{m(p===f?null:f)}}),!lo(_.path)&&!an(_.path)?(0,J.jsx)(pt,{size:`default`,iconSize:`md`,"aria-label":`Actual size`,title:`Actual size`,"aria-pressed":h===f,active:h===f,icon:(0,J.jsx)(kh,{}),disabled:!_.url||!!_.error,onClick:()=>{g(h===f?null:f)}}):null,v?(0,J.jsx)(b_,{source:v.source,app:r,inkcap:c,phone:l},`${f}\n${v.url}`):null,(0,J.jsx)(pt,{size:`default`,iconSize:`md`,"aria-label":`Close viewer`,title:`Close viewer (Escape)`,icon:(0,J.jsx)(Ei,{}),onClick:S})]})]})]})})}var S_=e=>b.pipe(z(te(1)),z(D(e))),C_=pn.pipe(z(Fe()),z(F(Number.isSafeInteger,{message:`Expected a safe integer`}))),w_=C_.pipe(z(A(0))),T_=C_.pipe(z(Ae(0))),E_=g({bytes:w_,costMilliunits:T_,destination:g({computerId:S_(256),path:S_(4096)}),format:$e([`png`,`jpeg`,`gif`,`webp`,`mp4`,`mp3`]),height:Be(w_),model:S_(256),width:Be(w_)}),D_=g({operation:bn(`complete-generation`),reference:Je,result:E_,derivedFrom:Be(S_(256)),references:Be(vt(p(S_(256))))}),O_=g({prompt:_n,references:un.pipe(z(Ae(0)))}),k_=g({reason:$e([...Gt,`UNKNOWN`]),message:_n.pipe(z(D(512)))}),A_=g({reference:Je,input:bt,typed:O_,style:Be(Dr),characters:Be(vt(Hn)),failure:Be(k_)});Et([g({operation:bn(`remember-generation`),record:A_}),g({operation:bn(`fail-generation`),reference:Je,failure:k_}),g({operation:bn(`forget-generation`),reference:Je}),g({operation:bn(`list-generations`),after:p(b)})]);function j_(e){return{reference:e.reference,input:nt(e.input),typed:e.typed,style:e.style,characters:e.characters,failure:e.failure}}async function M_(e,t){let n=j_(L(A_,{onExcessProperty:`error`})(t)),r=L(Et([A_,qn]),{onExcessProperty:`error`})(await e.require(Zr).request(JSON.stringify({operation:`remember-generation`,record:n})));if(`error`in r)throw new Yi(r.message);let i=j_(r);if(JSON.stringify(i)!==JSON.stringify(n))throw new G(`Prints did not confirm the original generation command`,{code:`PROTOCOL`,retryable:!1});return i}async function N_(e,t,n){L(A_,{onExcessProperty:`error`})(await e.require(Zr).request(JSON.stringify({operation:`fail-generation`,reference:t,failure:n})))}async function P_(e,t){L(g({removed:mt}))(await e.require(Zr).request(JSON.stringify({operation:`forget-generation`,reference:t})))}async function F_(e,t=null){let n=L(g({records:vt(A_),next:p(b)}),{onExcessProperty:`error`})(await e.require(Zr).request(JSON.stringify({operation:`list-generations`,after:t})));return{records:n.records.map(j_),next:n.next}}async function I_(e,t,n){let r=L(D_,{onExcessProperty:`error`})({operation:`complete-generation`,reference:t,result:n}),i=L(g({printId:b,computerId:b}))(await e.require(Zr).request(JSON.stringify(r)));if(i.printId!==t.requestId||i.computerId!==t.computerId)throw new G(`Prints did not confirm the saved generation`,{code:`PROTOCOL`,retryable:!1})}var L_=w(g({reference:Je}));function R_({connection:e,folder:t,effects:n,styles:r,characters:i}){let a=e?.app??null,o=zf(a),s=(0,q.useRef)(e);s.current=e;let c=(0,q.useRef)(n);c.current=n;let l=on(),u=Pr.of(a,`prints`,`generation`),d=[...u,`recovery`],f=Li(or(a)),p=f.isError?void 0:f.data,m=p?.models??[],h=a?.capabilities.has(Yt)===!0,g=p?.canGenerate??!1,_=f.error?It(f.error).message:p?.models.length===0?`The granted Media model registry is empty.`:null,v=Ks({queryKey:d,enabled:a!==null&&o!==null,initialPageParam:null,queryFn:async({pageParam:e,signal:t})=>{if(!a)throw new G(`Prints disconnected`,{code:`DISCONNECTED`,retryable:!0});if(a.context.get().computerId!==o)throw new G(`Computer selection changed`,{code:`SELECTION_CHANGED`,retryable:!1});let n=await F_(a.capabilities,e);return t.throwIfAborted(),n},getNextPageParam:e=>e.next}),y=(0,q.useMemo)(()=>Array.from(new Map(v.data?.pages.flatMap(e=>e.records).map(e=>[e.reference.requestId,e])??[]).values()),[v.data]),b=(0,q.useRef)(new Map),x=(0,q.useRef)(new Set),S=(0,q.useRef)(0),C=(0,q.useRef)(new Map),w=(0,q.useRef)(new Set),T=(0,q.useRef)(new Map),E=(0,q.useRef)(new Set),[,D]=(0,q.useState)(0),[O,k]=(0,q.useState)([]),[A,j]=(0,q.useState)(null),[M,N]=(0,q.useState)(null),P=e=>{j(e),c.current.notifyFailure(e.message)},F=e=>{N(e),c.current.notifyFailure(e)},I=(0,q.useRef)(null);(0,q.useEffect)(()=>{I.current!==v.error&&(I.current=v.error,v.error&&c.current.notifyFailure(It(v.error).message))},[v.error]);let ee=e=>s.current===e.connection&&e.connection.app.context.get().computerId===e.reference.computerId,te=(e,t,n)=>{l.setQueryData(e,e=>e&&{...e,pages:e.pages.map(e=>({...e,records:e.records.map(e=>e.reference.requestId===t?{...e,failure:n}:e)}))})},ne=(e,t)=>{l.setQueryData(e,e=>e&&{...e,pages:e.pages.map(e=>({...e,records:e.records.filter(e=>e.reference.requestId!==t)}))})},re=(e,t)=>{l.setQueryData(e,e=>!e||e.pages.some(e=>e.records.some(e=>e.reference.requestId===t.reference.requestId))?e:{...e,pages:e.pages.map((e,n)=>n===0?{...e,records:[t,...e.records]}:e)})},L=se({mutationKey:[...u,`run`],mutationFn:async e=>{e.controller.signal.throwIfAborted();let t=j_({reference:e.reference,input:e.input,typed:e.typed,style:e.style,characters:e.characters});await M_(e.connection.app.capabilities,t),te(e.recoveryKey,e.reference.requestId,void 0),e.controller.signal.throwIfAborted();let n=await e.session.restoreAttempt(e.reference),r;try{r=await n.generate(t.input,{signal:e.controller.signal})}finally{n[Symbol.dispose]()}return await I_(e.connection.app.capabilities,t.reference,r),{input:e.input,result:r}},onMutate:e=>{if(!ee(e)||e.controller.signal.aborted)return;let t=Vn(e.session.models,e.input.settings.model),n={key:`${e.reference.computerId}:${e.input.destination.path}`,computerId:e.reference.computerId,path:e.input.destination.path,...mr(t,e.draft),pendingLabel:Fn(t)};t?.kind===`video`&&(n.startedAt=Date.now(),n.resumed=e.resumed===!0),c.current.reserve(n)},onSuccess:(e,t)=>{ne(t.recoveryKey,t.reference.requestId),C.current.delete(t.reference.requestId),!(!ee(t)||t.controller.signal.aborted)&&c.current.saved(e,t.connection)},onError:(e,n)=>{if(tn(`generate-media`,e),n.controller.signal.aborted){if(w.current.delete(n.reference.requestId)){let e={reason:`CANCELLED`,message:`Stopped. Retry to run it again.`};N_(n.connection.app.capabilities,n.reference,e).catch(e=>{tn(`fail-generation`,e)}),re(n.recoveryKey,j_({reference:n.reference,input:n.input,typed:n.typed,style:n.style,characters:n.characters,failure:e})),te(n.recoveryKey,n.reference.requestId,e)}c.current.release(`${n.reference.computerId}:${n.input.destination.path}`);return}if(e instanceof Yi){C.current.delete(n.reference.requestId),c.current.release(`${n.reference.computerId}:${n.input.destination.path}`),ee(n)&&c.current.notifyFailure(e.message);return}let r=Wi(e);if(N_(n.connection.app.capabilities,n.reference,r).catch(e=>{tn(`fail-generation`,e)}),!ee(n))return;te(n.recoveryKey,n.reference.requestId,r);let i=ei(e),a={requestId:n.reference.requestId,path:n.input.destination.path,mediaKind:Vn(n.session.models,n.input.settings.model)?.kind??null,message:i.message,action:i.action,prompt:n.typed.prompt};k(e=>[...e.filter(e=>e.requestId!==a.requestId),a]),t.recheck(),c.current.failed(`${n.reference.computerId}:${n.input.destination.path}`,r.message)},onSettled:(e,t,n)=>{b.current.get(n.reference.requestId)===n.controller&&b.current.delete(n.reference.requestId)}}),R=se({mutationKey:[...u,`discard`],mutationFn:async e=>{await P_(e.connection.app.capabilities,e.reference)},onSuccess:(e,t)=>{ne(t.recoveryKey,t.reference.requestId),C.current.delete(t.reference.requestId),k(e=>e.filter(e=>e.requestId!==t.reference.requestId))},onError:(e,t)=>{ee(t)&&F(It(e).message)},onSettled:(e,t,n)=>{b.current.get(n.reference.requestId)===n.controller&&b.current.delete(n.reference.requestId)}}),ie=Gs({filters:{mutationKey:u,status:`pending`},select:e=>Ke(L_(e.state.variables))?.reference.requestId}),ae=new Set(ie.filter(e=>e!==void 0)),oe=Date.now(),ce=new Set([...ae,...[...T.current].filter(([,e])=>oe-e<Mn).map(([e])=>e)]),z=ce.size>=4;(0,q.useEffect)(()=>{x.current.clear(),j(null),N(null),C.current.clear(),w.current.clear(),T.current.clear();for(let e of E.current)clearTimeout(e);E.current.clear(),k([]);let e=Pr.of(a,`prints`,`generation`,`recovery`),t=a?.capabilities.subscribe(()=>{queueMicrotask(()=>{l.resetQueries({queryKey:e,exact:!0})})}),n=()=>{S.current+=1;for(let e of b.current.values())e.abort();b.current.clear(),l.cancelQueries({queryKey:e})},r=a?.context.subscribe(e=>{e.computerId!==o&&n()}),i=a?.lifecycle.subscribe(e=>{(e===`disposing`||e===`disposed`||e===`disconnected`)&&n()});return()=>{r?.(),i?.(),t?.(),n();for(let e of E.current)clearTimeout(e);E.current.clear()}},[a,o,e,l]);let le=e=>{k(t=>t.filter(t=>t.requestId!==e));let t=C.current.get(e);if(!t||b.current.has(e))return;C.current.delete(e);let n=new AbortController;b.current.set(e,n),R.mutate({...t,controller:n,recoveryKey:d})},B=e=>{let t=e.reference.requestId;if(b.current.has(t))return!1;if(!ee(e))return F(`Select the original Computer to retry this generation.`),!1;if(p?.computerId!==e.reference.computerId)return F(`Media access is unavailable for the original Computer.`),!1;if(!ce.has(t)&&z)return F(wr),!1;let n=new AbortController;return b.current.set(t,n),C.current.set(t,e),T.current.delete(t),k(e=>e.filter(e=>e.requestId!==t)),j(null),N(null),S.current+=1,L.mutate({...e,session:p,controller:n,ticket:S.current,recoveryKey:d}),!0};(0,q.useEffect)(()=>{if(!(!e||!p||!v.isSuccess))for(let t of y){let n=t.reference.requestId;x.current.has(n)||t.reference.computerId!==o||Vn(p.models,t.input.settings.model)?.kind!==`video`||B({connection:e,...t,resumed:!0,draft:Ri(t.input)})&&x.current.add(n)}},[e,o,p,v.isSuccess,y]);let ue=async(n,a=n.references.map((e,t)=>t+1))=>{if(!e?.app.capabilities.has(Ra)||!g)return!1;if(t.path===null)return t.setEditing(!0),!1;if(z)return c.current.notifyFailure(wr),!1;let l=Vn(m,n.model);if(l===void 0)return P({kind:`error`,mediaKind:null,message:`Choose a model from the granted registry.`}),!1;let u=Cr(n.prompt).length>0,d=l.kind===`audio`?pr(n.prompt):Ji({prompt:n.prompt,saved:i,references:n.references,labels:a,wording:e=>xr(rr(e,l,u),l),computerId:o,model:{label:l.label,maxReferences:l.input.maxReferences}});if(d.kind===`refused`)return P({kind:`error`,mediaKind:l.kind,message:d.message}),!1;let f=tr({...n,references:rr(d.references,l,u)},l);if(f)return P({kind:`error`,mediaKind:l.kind,message:f}),!1;let _=l.kind===`audio`?void 0:n.style,v=_===void 0?void 0:r.find(e=>e.name===_);if(_!==void 0&&v===void 0)return P({kind:`error`,mediaKind:l.kind,message:`The "${_}" style no longer exists. Pick another or none.`}),!1;let y=d.characters.map(e=>e.name),b=Wn(v?.text,d.prompt),x=Ti(b,Xn(l),v?.name,y);if(x!==void 0)return P({kind:`error`,mediaKind:l.kind,message:x}),!1;if(!h||!p)return j(null),!1;let C=e,w=C.app.context.get().computerId,T=S.current,E={...n,prompt:b,references:rr(d.references,l,u),destination:Vr(n,t.landingPath??t.path,l)},D=_r(E,l),O;try{let e=await t.ensureCreated();if(e)return P({kind:`error`,mediaKind:l.kind,message:e}),!1;if(S.current!==T||s.current!==C||C.app.context.get().computerId!==w)return!1;let n=await p.createAttempt();O=n.reference,n[Symbol.dispose]()}catch(e){return S.current===T&&s.current===C&&C.app.context.get().computerId===w&&P({kind:`error`,mediaKind:l.kind,...ei(e)}),!1}return S.current!==T||s.current!==C||C.app.context.get().computerId!==w?!1:B({connection:C,reference:O,input:D,draft:E,typed:{prompt:Tr(n.prompt.trim(),e=>{let t=a.indexOf(e);return t<0?void 0:t+1}),references:n.references.length},style:v?.name,characters:y})},de=async(t,n,r)=>{if(!e?.app.capabilities.has(Ra)||!g||!p)return Ii;if(z)return wr;let i=Ni(m,n);if(i===void 0)return`${Dn[n]} is not available on this Computer.`;let a=vi(i,t);if(a!==void 0)return a;let o=e,c=o.app.context.get().computerId;if(t.computerId!==c)return`Select this print's Computer to edit it.`;let l=S.current,{input:u,draft:d}=Yr(i,t,r),f;try{let e=await p.createAttempt();f=e.reference,e[Symbol.dispose]()}catch(e){return ei(e).message}return S.current!==l||s.current!==o||o.app.context.get().computerId!==c?`The selected Computer changed. Try again.`:(B({connection:o,reference:f,input:u,draft:d,typed:{prompt:u.settings.prompt,references:1},characters:[]}),null)},fe=L.variables;return{state:A??(ae.size>0&&fe?{kind:`pending`,draft:fe.draft}:null)??(!e||!h||o===null?{kind:`unavailable`,reason:`Image creation is unavailable for this Computer right now.`}:_?{kind:`unavailable`,reason:_}:p?{kind:`ready`}:{kind:`loading`}),models:m,session:p,modelsLoading:f.isFetching,modelsError:_,canGenerate:g,mediaCapability:h,retryModels:()=>{f.refetch()},submit:ue,operate:de,atLimit:z,stopPath:e=>{for(let[t,n]of C.current){let r=b.current.get(t);if(n.input.destination.path!==e||!r||!ae.has(t))continue;w.current.add(t),T.current.set(t,Date.now());let i=setTimeout(()=>{E.current.delete(i),D(e=>e+1)},Mn+1e3);E.current.add(i),r.abort()}},activeGenerations:ae,pendingGenerations:y,recoveryError:M??(v.error?It(v.error).message:null),reportRecoveryError:e=>{F(It(e).message)},hasMore:v.hasNextPage,loadMore:()=>{v.isFetching||v.fetchNextPage()},resume:t=>{if(!e||p?.computerId!==t.reference.computerId){F(`Select the original Computer to retry this generation.`);return}B({connection:e,...t,draft:Ri(t.input)})},discard:t=>{if(!e||b.current.has(t.reference.requestId))return;C.current.delete(t.reference.requestId),k(e=>e.filter(e=>e.requestId!==t.reference.requestId));let n=new AbortController;b.current.set(t.reference.requestId,n),R.mutate({...t,connection:e,controller:n,draft:Ri(t.input),recoveryKey:d})},failures:O.map(e=>({...e,key:`generation:${e.requestId}`,retry:C.current.has(e.requestId)?()=>{let t=C.current.get(e.requestId);t&&ee(t)&&B(t)}:void 0,dismiss:()=>{le(e.requestId)}})),retryPath:e=>{for(let t of C.current.values())if(!(t.input.destination.path!==e||!ee(t)))return B(t);return!1},promptAt:e=>{for(let t of C.current.values())if(t.input.destination.path===e)return t.typed.prompt},dismissPath:e=>{for(let[t,n]of C.current)n.input.destination.path===e&&le(t)}}}function z_({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function B_(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var V_=[],H_=0,{link:U_,unlink:W_,propagate:G_,checkDirty:K_,shallowPropagate:q_}=z_({update(e){return e._update()},notify(e){V_[Y_++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,$_(e))}}),J_=0,Y_=0,X_,Z_=0;function Q_(e){try{++Z_,e()}finally{--Z_||ev()}}function $_(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=W_(n,e)}function ev(){if(!(Z_>0)){for(;J_<Y_;){let e=V_[J_];V_[J_++]=void 0,e.notify()}J_=0,Y_=0}}function tv(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:+!n,get(){return X_!==void 0&&U_(i,X_,H_),i._snapshot},subscribe(e){let t=B_(e),n={current:!1},r=nv(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=X_,o=t?.compare??Object.is;if(n)X_=i,++H_,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=5);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{X_=a,n&&(i.flags&=-5),$_(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&K_(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&q_(e)}}else e&32&&(i.flags=e&-33);return X_!==void 0&&U_(i,X_,H_),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(G_(e),q_(e),ev())}},i}function nv(e){let t=()=>{let t=X_;X_=n,++H_,n.depsTail=void 0,n.flags=6;try{return e()}finally{X_=t,n.flags&=-5,$_(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let e=this.flags;e&16||e&32&&K_(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,$_(this)}};return t(),n}var rv=class{constructor(e,t){this.atom=tv(e),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),t&&(this.actions=t(this))}setState(e){this.atom.set(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(B_(e))}},iv=class{constructor(e){this.atom=tv(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(B_(e))}};function av(e,t){return typeof e==`function`?new iv(e):t?new rv(e,t):new rv(e)}var ov=class{constructor(e,t){this.fn=e,this.options=t,this.lastExecutionTime=0,this.isPending=!1,this.maybeExecute=(...e)=>{let t=Date.now()-this.lastExecutionTime;if(this.options.leading&&t>=this.options.wait)this.execute(...e);else if(this.lastArgs=e,!this.timeoutId&&this.options.trailing){let e=this.options.wait-t;this.isPending=!0,this.timeoutId=setTimeout(()=>{this.lastArgs!==void 0&&this.execute(...this.lastArgs)},e)}},this.execute=(...e)=>{this.fn(...e),this.options.onExecute?.(e,this),this.lastExecutionTime=Date.now(),this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.flush=()=>{this.isPending&&this.lastArgs&&this.execute(...this.lastArgs)},this.cancel=()=>{this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.clearTimeout=()=>{this.timeoutId&&=(clearTimeout(this.timeoutId),void 0)},this.options.leading===void 0&&this.options.trailing===void 0&&(this.options.leading=!0,this.options.trailing=!0)}};function sv(e,t){return new ov(e,t).maybeExecute}var cv=class{#e=!0;#t;#n;#r;#i;#a;#o;#s;#c=0;#l=5;#u=!1;#d=!1;#f=null;#p=()=>{this.debugLog(`Connected to event bus`),this.#a=!0,this.#u=!1,this.debugLog(`Emitting queued events`,this.#i),this.#i.forEach(e=>this.emitEventToBus(e)),this.#i=[],this.stopConnectLoop(),this.#n().removeEventListener(`tanstack-connect-success`,this.#p)};#m=()=>{if(this.#c<this.#l){this.#c++,this.dispatchCustomEvent(`tanstack-connect`,{});return}this.#n().removeEventListener(`tanstack-connect`,this.#m),this.#d=!0,this.debugLog(`Max retries reached, giving up on connection`),this.stopConnectLoop()};#h=()=>{this.#u||(this.#u=!0,this.#n().addEventListener(`tanstack-connect-success`,this.#p),this.#m())};constructor({pluginId:e,debug:t=!1,enabled:n=!0,reconnectEveryMs:r=300}){this.#t=e,this.#e=n,this.#n=this.getGlobalTarget,this.#r=t,this.debugLog(` Initializing event subscription for plugin`,this.#t),this.#i=[],this.#a=!1,this.#d=!1,this.#o=null,this.#s=r}startConnectLoop(){this.#o!==null||this.#a||(this.debugLog(`Starting connect loop (every ${this.#s}ms)`),this.#o=setInterval(this.#m,this.#s))}stopConnectLoop(){this.#u=!1,this.#o!==null&&(clearInterval(this.#o),this.#o=null,this.#i=[],this.debugLog(`Stopped connect loop`))}debugLog(...e){this.#r&&console.log(`🌴 [tanstack-devtools:${this.#t}-plugin]`,...e)}getGlobalTarget(){if(typeof globalThis<`u`&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog(`Using global event target`),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<`u`&&window.addEventListener!==void 0)return this.debugLog(`Using window as event target`),window;let e=typeof EventTarget<`u`?new EventTarget:void 0;return e===void 0||e.addEventListener===void 0?(this.debugLog(`No event mechanism available, running in non-web environment`),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog(`Using new EventTarget as fallback`),e)}getPluginId(){return this.#t}dispatchCustomEventShim(e,t){try{let n=new Event(e,{detail:t});this.#n().dispatchEvent(n)}catch{this.debugLog(`Failed to dispatch shim event`)}}dispatchCustomEvent(e,t){try{this.#n().dispatchEvent(new CustomEvent(e,{detail:t}))}catch{this.dispatchCustomEventShim(e,t)}}emitEventToBus(e){this.debugLog(`Emitting event to client bus`,e),this.dispatchCustomEvent(`tanstack-dispatch-event`,e)}createEventPayload(e,t){return{type:`${this.#t}:${e}`,payload:t,pluginId:this.#t}}emit(e,t){if(!this.#e){this.debugLog(`Event bus client is disabled, not emitting event`,e,t);return}if(this.#f&&(this.debugLog(`Emitting event to internal event target`,e,t),this.#f.dispatchEvent(new CustomEvent(`${this.#t}:${e}`,{detail:this.createEventPayload(e,t)}))),this.#d){this.debugLog(`Previously failed to connect, not emitting to bus`);return}if(!this.#a){this.debugLog(`Bus not available, will be pushed as soon as connected`),this.#i.push(this.createEventPayload(e,t)),typeof CustomEvent<`u`&&!this.#u&&(this.#h(),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(e,t))}on(e,t,n){let r=n?.withEventTarget??!1,i=`${this.#t}:${e}`;if(r&&(this.#f||=new EventTarget,this.#f.addEventListener(i,e=>{t(e.detail)})),!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`,i),()=>{};let a=e=>{this.debugLog(`Received event from bus`,e.detail),t(e.detail)};return this.#n().addEventListener(i,a),this.debugLog(`Registered event to bus`,i),()=>{r&&this.#f?.removeEventListener(i,a),this.#n().removeEventListener(i,a)}}onAll(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}onAllPluginEvents(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;this.#t&&n.pluginId!==this.#t||e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}},lv=new class extends cv{constructor(){super({pluginId:`form-devtools`,reconnectEveryMs:1e3})}};function uv(e,t){return typeof e==`function`?e(t):e}function dv(e,t){return yv(t).reduce((e,t)=>{if(e===null)return null;if(e!==void 0)return e[t]},e)}function fv(e,t,n){let r=yv(t);function i(e){if(!r.length)return uv(n,e);let t=r.shift();if(typeof t==`string`||typeof t==`number`&&!Array.isArray(e))return typeof e==`object`?(e===null&&(e={}),{...e,[t]:i(e[t])}):{[t]:i()};if(Array.isArray(e)&&typeof t==`number`){let n=e.slice(0,t);return[...n.length?n:Array(t),i(e[t]),...e.slice(t+1)]}return[...Array(t),i()]}return i(e)}function pv(e,t){let n=yv(t);function r(e){if(!e)return;if(n.length===1){let t=n[0];if(Array.isArray(e)&&typeof t==`number`)return e.filter((e,n)=>n!==t);let{[t]:r,...i}=e;return i}let t=n.shift();if((typeof t==`string`||typeof t==`number`&&!Array.isArray(e))&&typeof e==`object`)return{...e,[t]:r(e[t])};if(typeof t==`number`&&Array.isArray(e)){if(t>=e.length)return e;let n=e.slice(0,t);return[...n.length?n:Array(t),r(e[t]),...e.slice(t+1)]}throw Error(`It seems we have created an infinite loop in deleteBy. `)}return r(e)}var mv=46,hv=91,gv=93,_v=48,vv=57;function yv(e){if(Array.isArray(e))return[...e];if(typeof e!=`string`)throw Error(`Path must be a string.`);let t=e.length,n=[],r=+(t>0&&e.charCodeAt(0)===hv),i=!0,a=-1;for(let o=r;o<=t;o++){let s=o<t?e.charCodeAt(o):-1;if(o===t||s===mv||s===hv||s===gv){let t=o-r;if(t>0){let a=i&&(t===1||e.charCodeAt(r)!==_v),s=e.slice(r,o);if(a){let e=parseInt(s,10);t<=15||String(e)===s?n.push(e):n.push(s)}else n.push(s)}else a!==gv&&(a!==-1||s!==gv)&&(a!==s||s!==mv&&s!==hv)&&n.push(``);r=o+1,i=!0}else(s<_v||s>vv)&&(i=!1);a=s}return n.length||n.push(``),n}function bv(e){return!(Array.isArray(e)&&e.length===0)}function xv(e,t){return t.validationLogic({form:t.form,group:t.group,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!1},runValidation:e=>e.validators.filter(Boolean).map(e=>({cause:e.cause,validate:e.fn}))})}function Sv(e,t){let{asyncDebounceMs:n}=t,{onBlurAsyncDebounceMs:r,onChangeAsyncDebounceMs:i,onDynamicAsyncDebounceMs:a}=t.validators||{},o=n??0;return t.validationLogic({form:t.form,group:t.group,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!0},runValidation:t=>t.validators.filter(Boolean).map(t=>{let n=t?.cause||e,s=o;switch(n){case`change`:s=i??o;break;case`blur`:s=r??o;break;case`dynamic`:s=a??o;break;case`submit`:s=0}return e===`submit`&&(s=0),{cause:n,validate:t.fn,debounceMs:s}})})}var Cv=e=>!!e&&typeof e==`object`&&`fields`in e;function wv(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length||n.length===0&&!Array.isArray(e)&&!Array.isArray(t)&&(Object.getPrototypeOf(e)!==Object.prototype||Object.getPrototypeOf(t)!==Object.prototype))return!1;for(let i of n)if(!r.includes(i)||!wv(e[i],t[i]))return!1;return!0}var Tv=({newFormValidatorError:e,isPreviousErrorFromFormValidator:t,previousErrorValue:n})=>e?{newErrorValue:e,newSource:`form`}:t?{newErrorValue:void 0,newSource:void 0}:n?{newErrorValue:n,newSource:`field`}:{newErrorValue:void 0,newSource:void 0},Ev=({formLevelError:e,fieldLevelError:t})=>t?{newErrorValue:t,newSource:`field`}:e?{newErrorValue:e,newSource:`form`}:{newErrorValue:void 0,newSource:void 0};function Dv(e,t){return e==null?t:{...e,...t}}for(var Ov=256,kv=[],Av;Ov--;)kv[Ov]=(Ov+256).toString(16).substring(1);function jv(){let e=0,t,n=``;if(!Av||Ov+16>256){for(Av=Array(256),e=256;e--;)Av[e]=256*Math.random()|0;e=0,Ov=0}for(;e<16;e++)t=Av[Ov+e],n+=e===6?kv[t&15|64]:e===8?kv[t&63|128]:kv[t],e&1&&e>1&&e<11&&(n+=`-`);return Ov++,n}var Mv=sv(e=>lv.emit(`form-state`,{id:e.formId,state:e.store.state}),{wait:300});function Nv(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++)t[n]=Nv(e[n]);return t}if(e instanceof Map){let t=new Map;return e.forEach((e,n)=>{t.set(n,Nv(e))}),t}if(e instanceof Set){let t=new Set;return e.forEach(e=>{t.add(Nv(e))}),t}let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=Nv(e[n]));return t}function Pv(e,t){return t===e||t.startsWith(`${e}.`)||t.startsWith(`${e}[`)}var Fv=e=>{if(!e.validators)return e.runValidation({validators:[],form:e.form});let t=e.event.async,n=t?void 0:{fn:e.validators.onMount,cause:`mount`},r={fn:t?e.validators.onChangeAsync:e.validators.onChange,cause:`change`},i={fn:t?e.validators.onBlurAsync:e.validators.onBlur,cause:`blur`},a={fn:t?e.validators.onSubmitAsync:e.validators.onSubmit,cause:`submit`},o=t?void 0:{fn:()=>void 0,cause:`server`};switch(e.event.type){case`mount`:return e.runValidation({validators:[n],form:e.form});case`submit`:return e.runValidation({validators:[r,i,a,o],form:e.form});case`server`:return e.runValidation({validators:[],form:e.form});case`blur`:return e.runValidation({validators:[i,o],form:e.form});case`change`:return e.runValidation({validators:[r,o],form:e.form});default:throw Error(`Unknown validation event type: ${e.event.type}`)}};function Iv(e,t){let n=new Map;for(let r of e){let e=r.path??[],i=t,a=``;for(let t=0;t<e.length;t++){let n=e[t];if(n===void 0)continue;let r=typeof n==`object`?n.key:n,o=Number(r);a+=Array.isArray(i)&&!Number.isNaN(o)?`[${o}]`:(t>0?`.`:``)+String(r),i=typeof i==`object`&&i?i[r]:void 0}n.set(a,(n.get(a)??[]).concat(r))}return Object.fromEntries(n)}var Lv=(e,t)=>{let n=Iv(e,t);return{form:n,fields:n}},Rv={validate({value:e,validationSource:t},n){let r=n[`~standard`].validate(e);if(r instanceof Promise)throw Error(`async function passed to sync validator`);if(r.issues)return t===`field`?r.issues:Lv(r.issues,e)},async validateAsync({value:e,validationSource:t},n){let r=await n[`~standard`].validate(e);if(r.issues)return t===`field`?r.issues:Lv(r.issues,e)}},zv=e=>!!e&&`~standard`in e,Bv={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{},_arrayVersion:0,_pendingValidationsCount:0};function Vv(e){function t(t){let n=e.getFieldMeta(t)??Bv;e.setFieldMeta(t,{...n,_arrayVersion:(n._arrayVersion||0)+1})}function n(n,r,i){t(n);let a=s(n,r,`move`,i),c=Math.min(r,i),u=Math.max(r,i);for(let e=c;e<=u;e++)a.push(o(n,e));let d=Object.keys(e.fieldInfo).reduce((t,i)=>(i.startsWith(o(n,r))&&t.set(i,e.getFieldMeta(i)),t),new Map);l(a,r<i?`up`:`down`),Object.keys(e.fieldInfo).filter(e=>e.startsWith(o(n,i))).forEach(t=>{let a=t.replace(o(n,i),o(n,r)),s=d.get(a);s&&e.setFieldMeta(t,s)})}function r(e,n){t(e),l(s(e,n,`remove`),`up`)}function i(n,r,i){t(n),s(n,r,`swap`,i).forEach(t=>{if(!t.toString().startsWith(o(n,r)))return;let a=t.toString().replace(o(n,r),o(n,i)),[s,c]=[e.getFieldMeta(t),e.getFieldMeta(a)];s&&e.setFieldMeta(a,s),c&&e.setFieldMeta(t,c)})}function a(n,r){t(n);let i=s(n,r,`insert`);l(i,`down`),i.forEach(t=>{t.toString().startsWith(o(n,r))&&e.setFieldMeta(t,u())})}function o(e,t){return`${e}[${t}]`}function s(t,n,r,i){let a=[o(t,n)];switch(r){case`swap`:a.push(o(t,i));break;case`move`:{let[e,r]=[Math.min(n,i),Math.max(n,i)];for(let n=e;n<=r;n++)a.push(o(t,n));break}default:{let r=e.getFieldValue(t),i=Array.isArray(r)?r.length:0;for(let e=n+1;e<i;e++)a.push(o(t,e));break}}return Object.keys(e.fieldInfo).filter(e=>a.some(t=>e.startsWith(t)))}function c(e,t){return e.replace(/\[(\d+)\]/,(e,n)=>{let r=parseInt(n,10);return`[${t===`up`?r+1:Math.max(0,r-1)}]`})}function l(t,n){(n===`up`?t:[...t].reverse()).forEach(t=>{let r=c(t.toString(),n),i=e.getFieldMeta(r);i?e.setFieldMeta(t,i):e.setFieldMeta(t,u())})}let u=()=>Bv;return{bumpArrayVersion:t,handleArrayMove:n,handleArrayRemove:r,handleArraySwap:i,handleArrayInsert:a}}function Hv(e){return{values:e.values??{},errorMap:e.errorMap??{},fieldMetaBase:e.fieldMetaBase??{},formGroupStateBase:e.formGroupStateBase??{},isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1,validationMetaMap:e.validationMetaMap??{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}}}var Uv=class{constructor(e){this.options={},this.fieldInfo={},this.formGroupApis=new Set,this.mount=()=>{let e=this.store.subscribe(()=>{Mv(this)}),t=lv.on(`request-form-state`,e=>{e.payload.id===this._formId&&lv.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}),n=lv.on(`request-form-reset`,e=>{e.payload.id===this._formId&&this.reset()}),r=lv.on(`request-form-force-submit`,e=>{e.payload.id===this._formId&&(this._devtoolsSubmissionOverride=!0,this.handleSubmit(),this._devtoolsSubmissionOverride=!1)}),i=()=>{r(),n(),t(),e.unsubscribe(),lv.emit(`form-unmounted`,{id:this._formId})};this.options.listeners?.onMount?.({formApi:this});let{onMount:a}=this.options.validators||{};return lv.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options}),a&&this.validateSync(`mount`),i},this.update=e=>{if(!e)return;let t=this.options;this.options=e;let n=e.defaultValues&&!wv(e.defaultValues,t.defaultValues)&&!this.state.isTouched,r=!wv(e.defaultState,t.defaultState)&&!this.state.isTouched;if(!(!n&&!r)){if(Q_(()=>{this.baseStore.setState(()=>Hv(Object.assign({},this.state,r?e.defaultState:{},n?{values:e.defaultValues}:{})))}),n){let e=Vv(this);for(let t of Object.keys(this.fieldInfo))Array.isArray(this.getFieldValue(t))&&e.bumpArrayVersion(t)}lv.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}},this.reset=(e,t)=>{let{fieldMeta:n}=this.state,r=this.resetFieldMeta(n);e&&!t?.keepDefaultValues&&(this.options={...this.options,defaultValues:e}),this.baseStore.setState(()=>{let t=e??this.options.defaultValues??this.options.defaultState?.values;return e||Object.values(this.fieldInfo).forEach(e=>{e.instance&&e.instance.options.defaultValue!==void 0&&(t=fv(t,e.instance.name,e.instance.options.defaultValue))}),Hv({...this.options.defaultState,values:t,fieldMetaBase:r})})},this.validateAllFields=async e=>{let t=[];return Q_(()=>{Object.values(this.fieldInfo).forEach(n=>{if(!n.instance)return;let r=n.instance;t.push(Promise.resolve().then(()=>r.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),n.instance.store.state.meta.isTouched||n.instance.setMeta(e=>({...e,isTouched:!0}))})}),(await Promise.all(t)).flat()},this.validateArrayFieldsStartingFrom=async(e,t,n)=>{let r=this.getFieldValue(e),i=Array.isArray(r)?Math.max(r.length-1,0):null,a=[`${e}[${t}]`];for(let n=t+1;n<=(i??0);n++)a.push(`${e}[${n}]`);let o=Object.keys(this.fieldInfo).filter(e=>a.some(t=>e.startsWith(t))),s=[];return Q_(()=>{o.forEach(e=>{s.push(Promise.resolve().then(()=>this.validateField(e,n)))})}),(await Promise.all(s)).flat()},this.validateField=(e,t)=>{let n=this.fieldInfo[e]?.instance;if(!n){let{hasErrored:n}=this.validateSync(t);return n&&!this.options.asyncAlways?this.getFieldMeta(e)?.errors??[]:this.validateAsync(t).then(()=>this.getFieldMeta(e)?.errors??[])}return n.store.state.meta.isTouched||n.setMeta(e=>({...e,isTouched:!0})),n.validate(t)},this.validateSync=(e,t)=>{let n=xv(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||Fv}),r=!1,i={};return Q_(()=>{for(let e of n){if(!e.validate)continue;let{formError:n,fieldErrors:a}=Wv(this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`},type:`validate`})),o=Gv(e.cause),s=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(a||{})]);t?.filterFieldNames&&(s=new Set([...s].filter(t.filterFieldNames)));for(let e of s){if(this.baseStore.state.fieldMetaBase[e]===void 0&&!a?.[e])continue;let{errorMap:t,errorSourceMap:n}=this.getFieldMeta(e)??Bv,r=a?.[e],{newErrorValue:s,newSource:c}=Tv({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[o]===`form`,previousErrorValue:t?.[o]});c===`form`&&(i[e]={...i[e],[o]:r}),t?.[o]!==s&&this.setFieldMeta(e,(e=Bv)=>({...e,errorMap:{...e.errorMap,[o]:s},errorSourceMap:{...e.errorSourceMap,[o]:c}}))}t?.dontUpdateFormErrorMap||this.state.errorMap?.[o]!==n&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[o]:n}})),(n||a)&&(r=!0)}if(t?.dontUpdateFormErrorMap)return;let a=Gv(`submit`);this.state.errorMap?.[a]&&e!==`submit`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[a]:void 0}}));let o=Gv(`server`);this.state.errorMap?.[o]&&e!==`server`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[o]:void 0}}))}),{hasErrored:r,fieldsErrorMap:i}},this.validateAsync=async(e,t)=>{let n=Sv(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||Fv});this.state.isFormValidating||this.baseStore.setState(e=>({...e,isFormValidating:!0}));let r=[],i;for(let e of n){if(!e.validate)continue;let n=Gv(e.cause);this.state.validationMetaMap[n]?.lastAbortController.abort();let a=new AbortController;this.state.validationMetaMap[n]={lastAbortController:a},r.push(new Promise(async n=>{let r;try{r=await new Promise((t,n)=>{setTimeout(async()=>{if(a.signal.aborted)return t(void 0);try{t(await this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`,signal:a.signal},type:`validateAsync`}))}catch(e){n(e)}},e.debounceMs)})}catch(e){r=e}let{formError:o,fieldErrors:s}=Wv(r);s&&(i=i?{...i,...s}:s);let c=Gv(e.cause),l=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(i||{})]),u=Array.from(l);t?.filterFieldNames&&(u=u.filter(t.filterFieldNames));for(let e of u){if(this.baseStore.state.fieldMetaBase[e]===void 0&&!i?.[e])continue;let{errorMap:t,errorSourceMap:n}=this.getFieldMeta(e)??Bv,r=i?.[e],{newErrorValue:a,newSource:o}=Tv({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[c]===`form`,previousErrorValue:t?.[c]});t?.[c]!==a&&this.setFieldMeta(e,(e=Bv)=>({...e,errorMap:{...e.errorMap,[c]:a},errorSourceMap:{...e.errorSourceMap,[c]:o}}))}t?.dontUpdateFormErrorMap||this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[c]:o}})),n(i?{fieldErrors:i,errorMapKey:c}:void 0)}))}let a=[],o={};if(r.length){a=await Promise.all(r);for(let e of a)if(e?.fieldErrors){let{errorMapKey:t}=e;for(let[n,r]of Object.entries(e.fieldErrors))o[n]={...o[n]||{},[t]:r}}}return this.baseStore.setState(e=>({...e,isFormValidating:!1})),o},this.validate=(e,t)=>{let{hasErrored:n,fieldsErrorMap:r}=this.validateSync(e,t);return n&&!this.options.asyncAlways?r:this.validateAsync(e,t)},this._handleSubmit=async e=>{this.baseStore.setState(e=>({...e,isSubmitted:!1,submissionAttempts:e.submissionAttempts+1,isSubmitSuccessful:!1})),Q_(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance&&(e.instance.store.state.meta.isTouched||e.instance.setMeta(e=>({...e,isTouched:!0})))})});let t=e??this.options.onSubmitMeta;if(!this.state.canSubmit&&!this._devtoolsSubmissionOverride&&this.baseStore.state.submissionAttempts<=1){this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t});return}this.baseStore.setState(e=>({...e,isSubmitting:!0}));let n=()=>{this.baseStore.setState(e=>({...e,isSubmitting:!1}))};if(await this.validateAllFields(`submit`),!this.state.isFieldsValid){n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),lv.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validateAllFields`,errors:Object.values(this.state.fieldMeta).map(e=>e.errors).flat()});return}if(await this.validate(`submit`),!this.state.isValid){n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),lv.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validate`,errors:this.state.errors});return}Q_(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance?.triggerOnSubmitListener()})}),this.options.listeners?.onSubmit?.({formApi:this,meta:t});try{await this.options.onSubmit?.({value:this.state.values,formApi:this,meta:t}),Q_(()=>{this.baseStore.setState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),lv.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),n()})}catch(e){throw this.baseStore.setState(e=>({...e,isSubmitSuccessful:!1})),lv.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`inflight`,onError:e}),n(),e}},this.getFieldValue=e=>dv(this.state.values,e),this.getFieldMeta=e=>this.state.fieldMeta[e],this.getFormGroupMeta=e=>this.formGroupMetaDerived.state[e],this.getFieldInfo=e=>this.fieldInfo[e]||={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.setFieldMeta=(e,t)=>{this.baseStore.setState(n=>({...n,fieldMetaBase:{...n.fieldMetaBase,[e]:uv(t,n.fieldMetaBase[e])}}))},this.resetFieldMeta=e=>Object.keys(e).reduce((e,t)=>{let n=t;return e[n]=Bv,e},{}),this.setFieldValue=(e,t,n)=>{let r=n?.dontUpdateMeta??!1,i=n?.dontRunListeners??!1,a=n?.dontValidate??!1;Q_(()=>{r||this.setFieldMeta(e,e=>({...e,isTouched:!0,isDirty:!0,errorMap:{...e?.errorMap,onMount:void 0}})),this.baseStore.setState(n=>({...n,values:fv(n.values,e,t)}))}),i||this.getFieldInfo(e).instance?.triggerOnChangeListener(),a||this.validateField(e,`change`)},this.deleteField=e=>{let t=[...Object.keys(this.fieldInfo).filter(t=>{let n=e.toString();return t!==n&&t.startsWith(n)}),e];this.baseStore.setState(e=>{let n={...e};return t.forEach(e=>{n.values=pv(n.values,e),delete this.fieldInfo[e],delete n.fieldMetaBase[e]}),n})},this.pushFieldValue=(e,t,n)=>{this.setFieldValue(e,e=>[...Array.isArray(e)?e:[],t],n),Vv(this).bumpArrayVersion(e)},this.insertFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>[...e.slice(0,t),n,...e.slice(t)],Dv(r,{dontValidate:!0}));let i=r?.dontValidate??!1;i||await this.validateField(e,`change`),Vv(this).handleArrayInsert(e,t),i||await this.validateArrayFieldsStartingFrom(e,t,`change`)},this.replaceFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>e.map((e,r)=>r===t?n:e),Dv(r,{dontValidate:!0})),Vv(this).bumpArrayVersion(e),(r?.dontValidate??!1)||(await this.validateField(e,`change`),await this.validateArrayFieldsStartingFrom(e,t,`change`))},this.removeFieldValue=async(e,t,n)=>{let r=this.getFieldValue(e),i=Array.isArray(r)?Math.max(r.length-1,0):null;if(this.setFieldValue(e,e=>e.filter((e,n)=>n!==t),Dv(n,{dontValidate:!0})),Vv(this).handleArrayRemove(e,t),i!==null){let t=`${e}[${i}]`;this.deleteField(t)}(n?.dontValidate??!1)||(await this.validateField(e,`change`),await this.validateArrayFieldsStartingFrom(e,t,`change`))},this.swapFieldValues=(e,t,n,r)=>{this.setFieldValue(e,e=>{let r=e[t],i=e[n];return fv(fv(e,`${t}`,i),`${n}`,r)},Dv(r,{dontValidate:!0})),Vv(this).handleArraySwap(e,t,n),(r?.dontValidate??!1)||(this.validateField(e,`change`),this.validateField(`${e}[${t}]`,`change`),this.validateField(`${e}[${n}]`,`change`))},this.moveFieldValues=(e,t,n,r)=>{this.setFieldValue(e,e=>{let r=[...e];return r.splice(n,0,r.splice(t,1)[0]),r},Dv(r,{dontValidate:!0})),Vv(this).handleArrayMove(e,t,n),(r?.dontValidate??!1)||(this.validateField(e,`change`),this.validateField(`${e}[${t}]`,`change`),this.validateField(`${e}[${n}]`,`change`))},this.clearFieldValues=(e,t)=>{let n=this.getFieldValue(e),r=Array.isArray(n)?Math.max(n.length-1,0):null;if(this.setFieldValue(e,[],Dv(t,{dontValidate:!0})),Vv(this).bumpArrayVersion(e),r!==null)for(let t=0;t<=r;t++){let n=`${e}[${t}]`;this.deleteField(n)}(t?.dontValidate??!1)||this.validateField(e,`change`)},this.resetField=e=>{this.baseStore.setState(t=>{let n=this.getFieldInfo(e).instance?.options.defaultValue,r=dv(this.options.defaultValues,e),i=n??r;return{...t,fieldMetaBase:{...t.fieldMetaBase,[e]:Bv},values:i===void 0?t.values:fv(t.values,e,i)}})},this.setErrorMap=e=>{Q_(()=>{Object.entries(e).forEach(([e,t])=>{let n=e;if(Cv(t)){let{formError:e,fieldErrors:r}=Wv(t);for(let e of Object.keys(this.fieldInfo))this.getFieldMeta(e)&&this.setFieldMeta(e,t=>({...t,errorMap:{...t.errorMap,[n]:r?.[e]},errorSourceMap:{...t.errorSourceMap,[n]:`form`}}));this.baseStore.setState(t=>({...t,errorMap:{...t.errorMap,[n]:e}}))}else this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[n]:t}}))})})},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((e,[t,n])=>(Object.keys(n).length&&n.errors.length&&(e[t]={errors:n.errors,errorMap:n.errorMap}),e),{})}),this.parseValuesWithSchema=e=>Rv.validate({value:this.state.values,validationSource:`form`},e),this.parseValuesWithSchemaAsync=e=>Rv.validateAsync({value:this.state.values,validationSource:`form`},e),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=e?.formId??jv(),this._devtoolsSubmissionOverride=!1;let t=Hv({...e?.defaultState,values:e?.defaultValues??e?.defaultState?.values});if(e?.transform){t=e.transform({state:t}).state;for(let e of Object.keys(t.errorMap)){let n=t.errorMap[e];if(!(n===void 0||!Cv(n)))for(let r of Object.keys(n.fields)){let i=n.fields[r];if(i===void 0)continue;let a=t.fieldMetaBase[r];t.fieldMetaBase[r]={isTouched:!1,isValidating:!1,isBlurred:!1,isDirty:!1,_arrayVersion:0,_pendingValidationsCount:0,...a??{},errorSourceMap:{...a?.errorSourceMap??{},onChange:`form`},errorMap:{...a?.errorMap??{},[e]:i}}}}}this.baseStore=av(t);let n;this.fieldMetaDerived=av(e=>{let t=this.baseStore.get(),r=0,i={};for(let a of Object.keys(t.fieldMetaBase)){let o=t.fieldMetaBase[a],s=n?.fieldMetaBase[a],c=e?.[a],l=dv(t.values,a),u=c?.errors;if(!s||o.errorMap!==s.errorMap){u=Object.values(o.errorMap??{}).filter(e=>e!==void 0);let e=this.getFieldInfo(a)?.instance;(!e||!e.options.disableErrorFlat)&&(u=u.flat(1))}let d=!bv(u),f=!o.isDirty,p=wv(l,this.getFieldInfo(a)?.instance?.options.defaultValue??dv(this.options.defaultValues,a));if(c&&c.isPristine===f&&c.isValid===d&&c.isDefaultValue===p&&c.errors===u&&o===s){i[a]=c,r++;continue}i[a]={...o,errors:u??[],isPristine:f,isValid:d,isDefaultValue:p}}return Object.keys(t.fieldMetaBase).length?e&&r===Object.keys(t.fieldMetaBase).length?e:(n=this.baseStore.get(),i):i}),this.formGroupMetaDerived=av(e=>{let t=this.baseStore.get(),n=this.fieldMetaDerived.get(),r={};for(let i of this.formGroupApis){let a=i.name,o=t.formGroupStateBase[a]??{isSubmitted:!1,isSubmitting:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1},s=n[a],c=!1,l=!0,u=!1,d=!1,f=!0,p=!1;for(let e in n){if(e===a||!Pv(a,e))continue;let t=n[e];t&&(t.isValidating&&(c=!0),t.isValid||(l=!1),t.isTouched&&(u=!0),t.isBlurred&&(d=!0),t.isDefaultValue||(f=!1),t.isDirty&&(p=!0))}let m=!p,h=!!c||o.isValidating,g=s?.errorMap??{},_=s?.errorSourceMap??{},v=!!(g.onMount||Object.entries(n).some(([e,t])=>t&&e!==a&&Pv(a,e)&&t.errorMap.onMount)),y=e?.[a],b=y?.errors??[];(!y||y.__srcErrorMap!==g)&&(b=Object.values(g).reduce((e,t)=>{if(t===void 0)return e;if(t&&typeof t==`object`&&`fields`in t){let n=t.group;return n!==void 0&&e.push(n),e}return e.push(t),e},[]));let x=b.length===0,S=l&&x,C=i.options.canSubmitWhenInvalid??!1,w=o.submissionAttempts===0&&!u&&!v||!h&&!o.isSubmitting&&S||C;if(y&&y.errorMap===g&&y.errorSourceMap===_&&y.errors===b&&y.isFieldsValidating===c&&y.isFieldsValid===l&&y.isGroupValid===x&&y.isValid===S&&y.canSubmit===w&&y.isTouched===u&&y.isBlurred===d&&y.isPristine===m&&y.isDefaultValue===f&&y.isDirty===p&&y.isValidating===h&&y.isSubmitting===o.isSubmitting&&y.isSubmitted===o.isSubmitted&&y.submissionAttempts===o.submissionAttempts&&y.isSubmitSuccessful===o.isSubmitSuccessful){r[a]=y;continue}let T={...o,errorMap:g,errorSourceMap:_,_arrayVersion:s?._arrayVersion??0,isTouched:u,isBlurred:d,isDirty:p,isPristine:m,isDefaultValue:f,isValid:S,errors:b,isValidating:h,isFieldsValidating:c,isFieldsValid:l,isGroupValid:x,canSubmit:w};Object.defineProperty(T,"__srcErrorMap",{value:g,enumerable:!1,configurable:!0}),r[a]=T}return r});let r;this.store=av(e=>{let t=this.baseStore.get(),n=this.fieldMetaDerived.get(),i=Object.values(n).filter(Boolean),a=i.some(e=>e.isValidating),o=i.every(e=>e.isValid),s=i.some(e=>e.isTouched),c=i.some(e=>e.isBlurred),l=i.every(e=>e.isDefaultValue),u=s&&t.errorMap?.onMount,d=i.some(e=>e.isDirty),f=!d,p=!!(t.errorMap?.onMount||i.some(e=>e?.errorMap?.onMount)),m=!!a,h=e?.errors??[];(!r||t.errorMap!==r.errorMap)&&(h=Object.values(t.errorMap).reduce((e,t)=>t===void 0?e:t&&Cv(t)?(e.push(t.form),e):(e.push(t),e),[]));let g=h.length===0,_=o&&g,v=this.options.canSubmitWhenInvalid??!1,y=t.submissionAttempts===0&&!s&&!p||!m&&!t.isSubmitting&&_||v,b=t.errorMap;if(u&&(h=h.filter(e=>e!==t.errorMap.onMount),b=Object.assign(b,{onMount:void 0})),e&&r&&e.errorMap===b&&e.fieldMeta===this.fieldMetaDerived.state&&e.errors===h&&e.isFieldsValidating===a&&e.isFieldsValid===o&&e.isFormValid===g&&e.isValid===_&&e.canSubmit===y&&e.isTouched===s&&e.isBlurred===c&&e.isPristine===f&&e.isDefaultValue===l&&e.isDirty===d&&wv(r,t))return e;let x={...t,errorMap:b,fieldMeta:this.fieldMetaDerived.state,errors:h,isFieldsValidating:a,isFieldsValid:o,isFormValid:g,isValid:_,canSubmit:y,isTouched:s,isBlurred:c,isPristine:f,isDefaultValue:l,isDirty:d};return r=this.baseStore.get(),x}),this.handleSubmit=this.handleSubmit.bind(this),this.update(e||{})}get state(){return this.store.state}get formId(){return this._formId}runValidator(e){return zv(e.validate)?Rv[e.type](e.value,e.validate):e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function Wv(e){return e?Cv(e)?{formError:Wv(e.form).formError,fieldErrors:e.fields}:{formError:e}:{formError:void 0}}function Gv(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}var Kv=class e{constructor(t){this.options={},this.mount=()=>{this.options.defaultValue!==void 0&&!this.getMeta().isTouched&&this.form.setFieldValue(this.name,this.options.defaultValue,{dontUpdateMeta:!0});let e=this.getInfo();e.instance=this,this.update(this.options);let{onMount:t}=this.options.validators||{};if(t){let e=this.runValidator({validate:t,value:{value:this.state.value,fieldApi:this,validationSource:`field`},type:`validate`});e&&this.setMeta(t=>({...t,errorMap:{...t?.errorMap,onMount:e},errorSourceMap:{...t?.errorSourceMap,onMount:`field`}}))}return this.options.listeners?.onMount?.({value:this.state.value,fieldApi:this}),()=>{for(let[e,t]of Object.entries(this.timeoutIds.validations))t&&(clearTimeout(t),this.timeoutIds.validations[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.listeners))t&&(clearTimeout(t),this.timeoutIds.listeners[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.formListeners))t&&(clearTimeout(t),this.timeoutIds.formListeners[e]=null);let e=this.form.fieldInfo[this.name];if(e&&e.instance===this){for(let[t,n]of Object.entries(e.validationMetaMap))n?.lastAbortController.abort(),e.validationMetaMap[t]=void 0;this.form.baseStore.setState(e=>({...e,fieldMetaBase:{...e.fieldMetaBase,[this.name]:{...Bv,isTouched:e.fieldMetaBase[this.name]?.isTouched??Bv.isTouched,isBlurred:e.fieldMetaBase[this.name]?.isBlurred??Bv.isBlurred,isDirty:e.fieldMetaBase[this.name]?.isDirty??Bv.isDirty}}})),e.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,fieldApi:this}),this.form.options.listeners?.onFieldUnmount?.({formApi:this.form,fieldApi:this})}}},this.update=e=>{this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0&&(wv(this.form.getFieldValue(this.name),e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})),this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,this.state.meta)},this.getValue=()=>this.form.getFieldValue(this.name),this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,Dv(t,{dontRunListeners:!0,dontValidate:!0})),t?.dontRunListeners||this.triggerOnChangeListener(),t?.dontValidate||this.validate(`change`)},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.form.getFieldInfo(this.name),this.pushValue=(e,t)=>{this.form.pushFieldValue(this.name,e,Dv(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(e,t,n)=>{this.form.insertFieldValue(this.name,e,t,Dv(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(e,t,n)=>{this.form.replaceFieldValue(this.name,e,t,Dv(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(e,t)=>{this.form.removeFieldValue(this.name,e,Dv(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(e,t,n)=>{this.form.swapFieldValues(this.name,e,t,Dv(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(e,t,n)=>{this.form.moveFieldValues(this.name,e,t,Dv(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=e=>{this.form.clearFieldValues(this.name,Dv(e,{dontRunListeners:!0})),e?.dontRunListeners||this.triggerOnChangeListener()},this.getLinkedFields=t=>{let n=Object.values(this.form.fieldInfo),r=[];for(let i of n){if(!i.instance||!(i.instance instanceof e))continue;let{onChangeListenTo:n,onBlurListenTo:a}=i.instance.options.validators||{};t===`change`&&n?.includes(this.name)&&r.push(i.instance),t===`blur`&&a?.includes(this.name)&&r.push(i.instance)}return r},this.validateSync=(e,t)=>{let n=xv(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||Fv}),r=this.getLinkedFields(e).reduce((t,n)=>{let r=xv(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||Fv});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),i=!1;Q_(()=>{let e=(e,n)=>{let r=Jv(n.cause),a=n.validate?qv(e.runValidator({validate:n.validate,value:{value:e.store.state.value,validationSource:`field`,fieldApi:e},type:`validate`})):void 0,o=t[r],{newErrorValue:s,newSource:c}=Ev({formLevelError:o,fieldLevelError:a});e.state.meta.errorMap?.[r]!==s&&e.setMeta(e=>({...e,errorMap:{...e.errorMap,[r]:s},errorSourceMap:{...e.errorSourceMap,[r]:c}})),s&&(i=!0)};for(let t of n)e(this,t);for(let t of r)t.validate&&e(t.field,t)});let a=Jv(`submit`);return this.state.meta.errorMap?.[a]&&e!==`submit`&&!i&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,[a]:void 0},errorSourceMap:{...e.errorSourceMap,[a]:void 0}})),{hasErrored:i}},this.validateAsync=async(e,t)=>{let n=Sv(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||Fv}),r=await t,i=this.getLinkedFields(e).reduce((t,n)=>{let r=Sv(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||Fv});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),a=[],o=[],s=n.some(e=>e.validate),c=Array.from(new Set(i.filter(e=>e.validate).map(e=>e.field)));Q_(()=>{s&&this.startValidation();for(let e of c)e.startValidation()});let l=(e,t,n)=>{let i=Jv(t.cause),a=e.getInfo();a.validationMetaMap[i]?.lastAbortController.abort();let o=new AbortController;a.validationMetaMap[i]={lastAbortController:o},n.push(new Promise(async n=>{let a;try{a=await new Promise((n,r)=>{e.timeoutIds.validations[t.cause]&&(clearTimeout(e.timeoutIds.validations[t.cause]),e.endValidation()),e.timeoutIds.validations[t.cause]=setTimeout(async()=>{if(o.signal.aborted)return n(void 0);try{n(await this.runValidator({validate:t.validate,value:{value:e.store.state.value,fieldApi:e,signal:o.signal,validationSource:`field`},type:`validateAsync`}))}catch(e){r(e)}},t.debounceMs)})}catch(e){a=e}if(o.signal.aborted)return n(void 0);let s=qv(a),c=r[e.name]?.[i],{newErrorValue:l,newSource:u}=Ev({formLevelError:c,fieldLevelError:s});if(e.getInfo().instance!==e)return n(void 0);e.setMeta(e=>({...e,errorMap:{...e?.errorMap,[i]:l},errorSourceMap:{...e.errorSourceMap,[i]:u}})),n(l)}))};for(let e of n)e.validate&&l(this,e,a);for(let e of i)e.validate&&l(e.field,e,o);let u=[];return(a.length||o.length)&&(u=await Promise.all(a),await Promise.all(o)),Q_(()=>{s&&this.endValidation();for(let e of c)e.endValidation()}),u.filter(Boolean)},this.validate=(e,t)=>{if(!this.state.meta.isTouched)return[];let n=t?.skipGroupValidation?[]:Array.from(this.form.formGroupApis).filter(e=>this.name.startsWith(e.name)),r=(t?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e)).fieldsErrorMap[this.name]??{};if(!t?.skipFormValidation)for(let t of n){if(t.state.meta.submissionAttempts===0)continue;let{fieldsErrorMap:n}=this.form.validateSync(e,{group:t,dontUpdateFormErrorMap:!0,filterFieldNames:e=>Pv(t.name,e)});r={...r,...n[this.name]??{}}}let{hasErrored:i}=this.validateSync(e,r),a=new WeakMap;for(let t of n){let{hasErrored:n}=t.validateSync(e,{},{skipRelatedFieldValidation:!0});a.set(t,n)}if(i&&!this.options.asyncAlways){this.getInfo().validationMetaMap[Jv(e)]?.lastAbortController.abort();let t=[];for(let r of n)r.getInfo().validationMetaMap[Jv(e)]?.lastAbortController.abort(),t.push(r.state.meta.errors);return[...this.state.meta.errors,...t.flat()]}let o=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e),s=this.validateAsync(e,o),c=[];for(let t of n)a.get(t)&&!t.options.asyncAlways||c.push(t.validateAsync(e,o,{skipRelatedFieldValidation:!0}));return c.length===0?s:Promise.all([s,...c]).then(e=>e.flat())},this.handleChange=e=>{this.setValue(e)},this.handleBlur=()=>{this.state.meta.isTouched||this.setMeta(e=>({...e,isTouched:!0})),this.state.meta.isBlurred||this.setMeta(e=>({...e,isBlurred:!0})),this.validate(`blur`),this.triggerOnBlurListener()},this.setErrorMap=e=>{this.setMeta(t=>({...t,errorMap:{...t.errorMap,...e}}))},this.parseValueWithSchema=e=>Rv.validate({value:this.state.value,validationSource:`field`},e),this.parseValueWithSchemaAsync=e=>Rv.validateAsync({value:this.state.value,validationSource:`field`},e),this.triggerOnBlurListener=()=>{let e=this.form.options.listeners?.onBlurDebounceMs;e&&e>0?(this.timeoutIds.formListeners.blur&&clearTimeout(this.timeoutIds.formListeners.blur),this.timeoutIds.formListeners.blur=setTimeout(()=>{this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this});let t=this.options.listeners?.onBlurDebounceMs;t&&t>0?(this.timeoutIds.listeners.blur&&clearTimeout(this.timeoutIds.listeners.blur),this.timeoutIds.listeners.blur=setTimeout(()=>{this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},this.triggerOnChangeListener=()=>{let e=this.form.options.listeners?.onChangeDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this});let t=this.options.listeners?.onChangeDebounceMs;t&&t>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this});for(let e of this.form.formGroupApis)Pv(e.name,this.name)&&e.triggerOnChangeListener()},this.triggerOnSubmitListener=()=>{this.options.listeners?.onSubmit?.({value:this.state.value,fieldApi:this})},this.form=t.form,this.name=t.name,this.options=t,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=av(e=>{this.form.store.get();let n=this.form.getFieldMeta(this.name)??{...Bv,...t.defaultMeta},r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!wv(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===n?e:{value:r,meta:n}})}get state(){return this.store.state}runValidator(e){return zv(e.validate)?Rv[e.type](e.value,e.validate):e.validate(e.value)}startValidation(){this.setMeta(e=>{let t=e._pendingValidationsCount+1;return{...e,_pendingValidationsCount:t,isValidating:t>0&&!e.isValidating||e.isValidating}})}endValidation(){this.setMeta(e=>{let t=Math.max(0,e._pendingValidationsCount-1);return{...e,_pendingValidationsCount:t,isValidating:t===0&&e.isValidating?!1:e.isValidating}})}};function qv(e){if(e)return e}function Jv(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}function Yv(e){return{isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1}}function Xv(e){return{...Bv,...e,errors:[],isPristine:!0,isValid:!0,isDefaultValue:!0,isFieldsValidating:!1,isFieldsValid:!0,isGroupValid:!0,canSubmit:!0,isSubmitting:!1,isSubmitted:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1}}var Zv=class e{constructor(t){this.options={},this.setFormGroupState=e=>{this.form.baseStore.setState(t=>{let n=t.formGroupStateBase[this.name]??Yv({});return{...t,formGroupStateBase:{...t.formGroupStateBase,[this.name]:e(n)}}})},this._lastDistributedFieldNames={},this.update=e=>{this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0&&(wv(this.form.getFieldValue(this.name),e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})),this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,{...Bv,...this.options.defaultMeta})},this.mount=()=>{this.update(this.options),this.form.formGroupApis.add(this),this.fieldInfo.instance=this,this.form.baseStore.setState(e=>({...e,formGroupStateBase:{...e.formGroupStateBase,[this.name]:e.formGroupStateBase[this.name]??Yv({...this.options.defaultState})}}));let{onMount:e}=this.options.validators||{};if(e){let t=this.runValidator({validate:e,value:{value:this.state.value,groupApi:this,validationSource:`form`},type:`validate`}),n=t,r;$v(t)&&(n=t.group,r=t.fields);let i=Qv(n);i&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,onMount:i},errorSourceMap:{...e.errorSourceMap,onMount:`field`}})),this.distributeFieldErrors(`onMount`,r)}return this.options.listeners?.onMount?.({value:this.state.value,groupApi:this}),()=>{for(let[e,t]of Object.entries(this.timeoutIds.validations))t&&(clearTimeout(t),this.timeoutIds.validations[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.listeners))t&&(clearTimeout(t),this.timeoutIds.listeners[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.formListeners))t&&(clearTimeout(t),this.timeoutIds.formListeners[e]=null);if(this.fieldInfo.instance===this){for(let[e,t]of Object.entries(this.fieldInfo.validationMetaMap))t?.lastAbortController.abort(),this.fieldInfo.validationMetaMap[e]=void 0;this.form.formGroupApis.delete(this),this.form.baseStore.setState(e=>({...e,formGroupStateBase:{...e.formGroupStateBase,[this.name]:Yv({})}})),this.fieldInfo.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,groupApi:this})}}},this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,Dv(t,{dontRunListeners:!0,dontValidate:!0})),t?.dontRunListeners||this.triggerOnChangeListener(),t?.dontValidate||this.validate(`change`)},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.fieldInfo,this.getRelatedFields=()=>{let e=Object.values(this.form.fieldInfo),t=[];for(let n of e)n.instance&&n.instance instanceof Kv&&n.instance.name.startsWith(this.name)&&t.push(n.instance);return t},this.getRelatedFieldMetasDerived=()=>{let e=Object.entries(this.form.fieldMetaDerived.state),t=[];for(let[n,r]of e)n!==this.name&&Pv(this.name,n)&&t.push({...r,name:n});return t},this.buildChildFieldName=e=>e===``?this.name:e.startsWith(`[`)?`${this.name}${e}`:`${this.name}.${e}`,this.distributeFieldErrors=(e,t)=>{let n=this._lastDistributedFieldNames[e]??new Set,r=new Set;if(t)for(let[e,n]of Object.entries(t))n!=null&&n!==!1&&r.add(this.buildChildFieldName(e));let i=new Set([...n,...r]),a=!1;for(let n of i){let r=n.startsWith(this.name+`[`)?n.slice(this.name.length):n.slice(this.name.length+1),i=t?.[r],o=this.form.getFieldMeta(n);if(!o&&!i)continue;let s=o?.errorMap[e],{newErrorValue:c,newSource:l}=Tv({newFormValidatorError:i,isPreviousErrorFromFormValidator:o?.errorSourceMap[e]===`form`,previousErrorValue:s});c&&(a=!0),(s!==c||o?.errorSourceMap[e]!==l)&&this.form.setFieldMeta(n,(t=Bv)=>({...t,errorMap:{...t.errorMap,[e]:c},errorSourceMap:{...t.errorSourceMap,[e]:l}}))}return this._lastDistributedFieldNames[e]=r,a},this.validateSync=(t,n,r={})=>{let i=xv(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||Fv}),a=(r.skipRelatedFieldValidation?[]:this.getRelatedFields()).reduce((e,n)=>{let r=xv(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||Fv});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),o=!1;Q_(()=>{let t=(t,r)=>{let i=ty(r.cause),a=t===this,s;r.validate&&(s=t.runValidator({validate:r.validate,value:{value:t.store.state.value,validationSource:a?`form`:`field`,...t instanceof e?{groupApi:t}:{fieldApi:t}},type:`validate`}));let c=s,l;a&&$v(s)&&(c=s.group,l=s.fields);let u=Qv(c),d=n[i],{newErrorValue:f,newSource:p}=Ev({formLevelError:d,fieldLevelError:u});t.state.meta.errorMap?.[i]!==f&&t.setMeta(e=>({...e,errorMap:{...e.errorMap,[i]:f},errorSourceMap:{...e.errorSourceMap,[i]:p}})),f&&(o=!0),a&&this.distributeFieldErrors(i,l)&&(o=!0)};for(let e of i)t(this,e);for(let e of a)e.validate&&t(e.field,e)});let s=ty(`submit`);return this.state.meta.errorMap?.[s]&&t!==`submit`&&!o&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,[s]:void 0},errorSourceMap:{...e.errorSourceMap,[s]:void 0}})),{hasErrored:o}},this.validateAsync=async(t,n,r={})=>{let i=Sv(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||Fv}),a=await n,o=r.skipRelatedFieldValidation?[]:this.getRelatedFields(),s=o.reduce((e,n)=>{let r=Sv(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||Fv});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),c=[],l=[],u=i.some(e=>e.validate)||s.some(e=>e.validate);if(u){this.state.meta.isValidating||this.setMeta(e=>({...e,isValidating:!0}));for(let e of o)e.setMeta(e=>({...e,isValidating:!0}))}let d=(t,n,r)=>{let i=ty(n.cause),o=t.getInfo();o.validationMetaMap[i]?.lastAbortController.abort();let s=new AbortController;o.validationMetaMap[i]={lastAbortController:s};let c=t===this;r.push(new Promise(async r=>{let o;try{o=await new Promise((r,i)=>{t.timeoutIds.validations[n.cause]&&clearTimeout(t.timeoutIds.validations[n.cause]),t.timeoutIds.validations[n.cause]=setTimeout(async()=>{if(s.signal.aborted)return r(void 0);try{r(await this.runValidator({validate:n.validate,value:{value:t.store.state.value,signal:s.signal,validationSource:c?`form`:`field`,...t instanceof e?{groupApi:t}:{fieldApi:t}},type:`validateAsync`}))}catch(e){i(e)}},n.debounceMs)})}catch(e){o=e}if(s.signal.aborted)return r(void 0);let l=o,u;c&&$v(o)&&(l=o.group,u=o.fields);let d=Qv(l),f=a[t.name]?.[i],{newErrorValue:p,newSource:m}=Ev({formLevelError:f,fieldLevelError:d});if(t.getInfo().instance!==t)return r(void 0);t.setMeta(e=>({...e,errorMap:{...e?.errorMap,[i]:p},errorSourceMap:{...e.errorSourceMap,[i]:m}})),c&&this.distributeFieldErrors(i,u),r(p)}))};for(let e of i)e.validate&&d(this,e,c);for(let e of s)e.validate&&d(e.field,e,l);let f=[];if((c.length||l.length)&&(f=await Promise.all(c),await Promise.all(l)),u){this.setMeta(e=>({...e,isValidating:!1}));for(let e of o)e.setMeta(e=>({...e,isValidating:!1}))}return f.filter(Boolean)},this.validateAllFields=async e=>{let t=[];return Q_(()=>{Object.values(this.getRelatedFields()).forEach(n=>{t.push(Promise.resolve().then(()=>n.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),n.store.state.meta.isTouched||n.setMeta(e=>({...e,isTouched:!0}))})}),(await Promise.all(t)).flat()},this.validateArrayFieldsStartingFrom=(e,t,n)=>this.form.validateArrayFieldsStartingFrom(e,t,n),this.validateField=(e,t)=>this.form.validateField(e,t),this.getFieldValue=e=>this.form.getFieldValue(e),this.getFieldMeta=e=>this.form.getFieldMeta(e),this.setFieldMeta=(e,t)=>this.form.setFieldMeta(e,t),this.setFieldValue=(e,t)=>this.form.setFieldValue(e,t),this.deleteField=e=>this.form.deleteField(e),this.pushFieldValue=(e,t)=>this.form.pushFieldValue(e,t),this.insertFieldValue=(e,t,n)=>this.form.insertFieldValue(e,t,n),this.replaceFieldValue=(e,t,n)=>this.form.replaceFieldValue(e,t,n),this.swapFieldValues=(e,t,n)=>this.form.swapFieldValues(e,t,n),this.moveFieldValues=(e,t,n)=>this.form.moveFieldValues(e,t,n),this.clearFieldValues=e=>this.form.clearFieldValues(e),this.resetField=e=>this.form.resetField(e),this.removeFieldValue=(e,t)=>this.form.removeFieldValue(e,t),this.areRelatedFieldsValid=()=>Object.values(this.getRelatedFields()).every(e=>e.state.meta.isValid),this.validate=(e,t)=>{let{fieldsErrorMap:n}=t?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>Pv(this.name,e)}),{hasErrored:r}=this.validateSync(e,n[this.name]??{},{skipRelatedFieldValidation:t?.skipRelatedFieldValidation});if(r&&!this.options.asyncAlways)return this.getInfo().validationMetaMap[ty(e)]?.lastAbortController.abort(),this.state.meta.errors;let i=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>Pv(this.name,e)});return this.validateAsync(e,i,{skipRelatedFieldValidation:t?.skipRelatedFieldValidation})},this.triggerOnChangeListener=()=>{let e=this.form.options.listeners?.onChangeGroupDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChangeGroup?.({formApi:this.form,groupApi:this})},e)):this.form.options.listeners?.onChangeGroup?.({formApi:this.form,groupApi:this});let t=this.options.listeners?.onChangeDebounceMs;t&&t>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,groupApi:this})},t)):this.options.listeners?.onChange?.({value:this.state.value,groupApi:this})},this.triggerOnSubmitListener=()=>{this.options.listeners?.onSubmit?.({value:this.state.value,groupApi:this})},this._handleSubmit=async e=>{this.setFormGroupState(e=>({...e,isSubmitted:!1,submissionAttempts:e.submissionAttempts+1,isSubmitSuccessful:!1})),Q_(()=>{Object.values(this.getRelatedFields()).forEach(e=>{e.state.meta.isTouched||e.setMeta(e=>({...e,isTouched:!0}))})});let t=e??this.options.onSubmitMeta;this.setFormGroupState(e=>({...e,isSubmitting:!0}));let n=()=>{this.setFormGroupState(e=>({...e,isSubmitting:!1}))};if(await this.validateAllFields(`submit`),!this.areRelatedFieldsValid()){n(),this.options.onGroupSubmitInvalid?.({value:this.state.value,groupApi:this,meta:t});return}if(await this.validate(`submit`,{skipRelatedFieldValidation:!0}),!this.areRelatedFieldsValid()||!this.state.meta.isValid){n(),this.options.onGroupSubmitInvalid?.({value:this.state.value,groupApi:this,meta:t});return}Q_(()=>{Object.values(this.getRelatedFields()).forEach(e=>{e.options.listeners?.onGroupSubmit?.({value:e.state.value,fieldApi:e})})}),this.options.listeners?.onSubmit?.({groupApi:this,value:this.state.value});try{await this.options.onGroupSubmit?.({value:this.state.value,groupApi:this,meta:t}),Q_(()=>{this.setFormGroupState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),n()})}catch(e){throw this.setFormGroupState(e=>({...e,isSubmitSuccessful:!1})),n(),e}},this.form=t.form,this.name=t.name,this.options=t,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.fieldInfo={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.store=av(e=>{this.form.formGroupMetaDerived.get(),this.form.baseStore.get();let n=this.form.getFormGroupMeta(this.name)??Xv(t.defaultMeta),r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!wv(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===n?e:{value:r,meta:n}}),this.handleSubmit=this.handleSubmit.bind(this)}get state(){return this.store.state}runValidator(e){if(zv(e.validate)){let t=Rv[e.type](e.value,e.validate);return e.type===`validate`?ey(t):t.then(ey)}return e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function Qv(e){if(e)return e}function $v(e){return!!e&&typeof e==`object`&&`fields`in e}function ey(e){if(!e||typeof e!=`object`||!(`form`in e)&&!(`fields`in e))return e;let{form:t,fields:n,...r}=e;return{...r,group:t,fields:n}}function ty(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}function ny(e,t){if(!t)return;let n=Object.assign({},e,{state:Nv(e.state)});t(n),n.fieldInfo!==e.fieldInfo&&(e.fieldInfo=n.fieldInfo),n.options!==e.options&&(e.options=n.options);let r=Object.keys({values:null,validationMetaMap:null,fieldMetaBase:null,formGroupStateBase:null,isSubmitting:null,isSubmitted:null,isValidating:null,submissionAttempts:null,isSubmitSuccessful:null,_force_re_eval:null}).reduce((t,r)=>(e.state[r]!==n.state[r]&&(t[r]=n.state[r]),t),{});return Q_(()=>{Object.keys(r).length&&e.baseStore.setState(e=>({...e,...r})),n.state.errorMap!==e.state.errorMap&&e.setErrorMap(n.state.errorMap)}),n}var ry=Da();function iy(e,t){return e===t}function ay(e,t=e=>e,n){let r=n?.compare??iy,i=(0,q.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,q.useCallback)(()=>e.get(),[e]);return(0,ry.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var oy=typeof window<`u`?q.useLayoutEffect:q.useEffect;function sy(e){let[t,n]=(0,q.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,q.useState)(()=>new Kv({...e})),a=r;(t.form!==e.form||t.name!==e.name)&&(a=new Kv({...e}),i(a),n({form:e.form,name:e.name}));let o=ay(a.store,e.mode===`array`?e=>e.meta._arrayVersion||0:e=>e.value),s=ay(a.store,e=>e.meta.isTouched),c=ay(a.store,e=>e.meta.isBlurred),l=ay(a.store,e=>e.meta.isDirty),u=ay(a.store,e=>e.meta.errorMap),d=ay(a.store,e=>e.meta.errorSourceMap),f=ay(a.store,e=>e.meta.isValidating),p=(0,q.useMemo)(()=>({...a,get state(){return{value:e.mode===`array`?a.state.value:o,get meta(){return{...a.state.meta,isTouched:s,isBlurred:c,isDirty:l,errorMap:u,errorSourceMap:d,isValidating:f}}}}}),[a,e.mode,o,s,c,l,u,d,f]);return oy(a.mount,[a]),oy(()=>{a.update(e)}),p}var cy=(({children:e,...t})=>{let n=sy(t),r=(0,q.useMemo)(()=>uv(e,n),[e,n]);return(0,J.jsx)(J.Fragment,{children:r})});function ly(){return(0,q.useState)(()=>jv())[0]}var uy=q,dy=`18.3.1`.split(`.`)[0]===`17`?ly:uy.useId;function fy(e){let[t,n]=(0,q.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,q.useState)(()=>new Zv({...e}));(t.form!==e.form||t.name!==e.name)&&(i(new Zv({...e})),n({form:e.form,name:e.name}));let a=ay(r.store,e=>e.value),o=ay(r.store,e=>e.meta.isTouched),s=ay(r.store,e=>e.meta.isBlurred),c=ay(r.store,e=>e.meta.isDirty),l=ay(r.store,e=>e.meta.errorMap),u=ay(r.store,e=>e.meta.errorSourceMap),d=ay(r.store,e=>e.meta.isValidating),f=ay(r.store,e=>e.meta.isSubmitting),p=ay(r.store,e=>e.meta.isSubmitted),m=ay(r.store,e=>e.meta.submissionAttempts),h=ay(r.store,e=>e.meta.isSubmitSuccessful),g=ay(r.store,e=>e.meta.canSubmit),_=ay(r.store,e=>e.meta.isValid),v=ay(r.store,e=>e.meta.isFieldsValid),y=ay(r.store,e=>e.meta.isFieldsValidating),b=ay(r.store,e=>e.meta.isGroupValid),x=(0,q.useMemo)(()=>({...r,handleSubmit:((...e)=>r._handleSubmit(...e)),get state(){return{...r.state,value:a,get meta(){return{...r.state.meta,isTouched:o,isBlurred:s,isDirty:c,errorMap:l,errorSourceMap:u,isValidating:d,isSubmitting:f,isSubmitted:p,submissionAttempts:m,isSubmitSuccessful:h,canSubmit:g,isValid:_,isFieldsValid:v,isFieldsValidating:y,isGroupValid:b}}}}}),[r,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b]);return oy(r.mount,[r]),oy(()=>{r.update(e)}),x}var py=(({children:e,...t})=>{let n=fy(t),r=(0,q.useMemo)(()=>uv(e,n),[e,n]);return(0,J.jsx)(J.Fragment,{children:r})});function my({form:e,selector:t=e=>e,children:n}){let r=ay(e.store,t);return(0,J.jsx)(J.Fragment,{children:uv(n,r)})}function hy(e){let t=dy(),[n,r]=(0,q.useState)(e?.formId),[i,a]=(0,q.useState)(()=>new Uv({...e,formId:e?.formId??t}));if(n!==e?.formId){let n=e?.formId??t;a(new Uv({...e,formId:n})),r(n)}let o=(0,q.useMemo)(()=>{let e={...i,handleSubmit:((...e)=>i._handleSubmit(...e)),get formId(){return i._formId},get state(){return i.store.state}};return e.Field=function(e){return(0,J.jsx)(cy,{...e,form:i})},e.FormGroup=function(e){return(0,J.jsx)(py,{...e,form:i})},e.Subscribe=function(e){return(0,J.jsx)(my,{form:i,selector:e.selector,children:e.children})},e},[i]);oy(i.mount,[]),oy(()=>{i.update(e)});let s=(0,q.useRef)(!1);return oy(()=>{s.current&&e?.transform&&ny(i,e.transform)},[i,e?.transform]),oy(()=>{s.current=!0}),o}var gy=(0,q.forwardRef)(function({className:e,invalid:t,...n},r){return(0,J.jsx)(`input`,{...n,"aria-invalid":t?!0:n[`aria-invalid`]===!1?void 0:n[`aria-invalid`],className:V(`input caps-input w-full`,e),ref:r})});(0,q.forwardRef)(function({leading:e,className:t,...n},r){return(0,J.jsxs)(`span`,{className:`caps-search-input`,"data-leading":e?`true`:void 0,children:[e?(0,J.jsx)(`span`,{className:`caps-search-leading`,"aria-hidden":`true`,children:e}):null,(0,J.jsx)(gy,{...n,type:`search`,className:t,ref:r})]})});var _y=(0,q.forwardRef)(function({children:e,className:t,optional:n,required:r,...i},a){return(0,J.jsxs)(`label`,{...i,className:V(`label caps-label cursor-pointer justify-start gap-sm text-sm font-semibold text-base-content`,t),ref:a,children:[e,r?(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`text-error`,children:`*`}):null,n&&!r?(0,J.jsx)(`span`,{className:`caps-label-optional`,children:`Optional`}):null]})}),vy=(0,q.forwardRef)(function({children:e,className:t,...n},r){return(0,J.jsx)(`div`,{...n,className:V(`caps-input-group join flex w-full items-stretch [&>*]:join-item [&>*:first-child]:rounded-e-none [&>*:last-child]:rounded-s-none [&>*:not(:first-child):not(:last-child)]:rounded-none [&>.btn]:shrink-0 [&>.input]:min-w-0 [&>.input]:flex-1 [&>.select]:min-w-0 [&>.select]:flex-1`,t),ref:r,children:q.Children.map(e,e=>(0,q.isValidElement)(e)?(0,q.cloneElement)(e,{className:V(`join-item caps-input-group-control`,e.props.className)}):e)})}),yy=(0,q.forwardRef)(function({className:e,...t},n){return(0,J.jsx)(`div`,{...t,className:V(`join-item flex items-center border border-base-300 bg-base-200 px-md text-sm text-base-content`,e),ref:n})});function by(e){let t=e.parentElement;if(!t||e.previousElementSibling===null)return 0;let n=getComputedStyle(t);if(!(n.display.includes(`grid`)||n.display.includes(`flex`)&&n.flexDirection.startsWith(`column`)))return 0;let r=Number.parseFloat(n.rowGap);return Number.isFinite(r)?r:0}(0,q.forwardRef)(function({show:e,appear:t=!1,children:n,className:r,...i},a){let o=(0,q.useRef)(null);(0,q.useImperativeHandle)(a,()=>o.current);let s=ce(),[c,l]=(0,q.useState)(e),u=(0,q.useRef)(!0);return e&&!c&&l(!0),(0,q.useLayoutEffect)(()=>{let n=o.current,r=u.current;if(u.current=!1,!n||r&&!t)return;if(!y(n)){e||l(!1);return}let i=Tt(n),a=`translateY(${String(i.distance)}px)`,c=B(i,i.ease),d=n.getBoundingClientRect().height,f=by(n),p=(e,t)=>{n.style.overflow=`clip`;let r=e=>({height:`${String(e)}px`,marginBlockStart:`${String(e===0?-f:0)}px`}),a=n.animate([r(e),r(t)],{duration:i.normal,easing:c}),o=()=>{n.style.removeProperty(`overflow`)};return a.addEventListener(`finish`,o),a.addEventListener(`cancel`,o),a};if(e){let e=[n.animate([{opacity:0,transform:a},{opacity:1,transform:`none`}],{duration:i.normal,easing:c})];return!s&&d>0&&e.push(p(0,d)),()=>{for(let t of e)t.cancel()}}let m=n.animate([{opacity:1,transform:`none`},{opacity:0,transform:a}],{duration:i.fast,easing:B(i,i.easeExit),fill:`forwards`}),h=!s&&d>0?p(d,0):m;return h!==m&&h.effect?.updateTiming({fill:`forwards`}),h.addEventListener(`finish`,()=>{l(!1)}),()=>{m.cancel(),h.cancel()}},[e,t,s]),c?(0,J.jsx)(`div`,{...i,ref:o,className:V(`caps-presence`,r),"data-present":e,"aria-hidden":!e||void 0,children:n}):null});var xy=(0,q.forwardRef)(function({open:e,children:t,className:n,...r},i){return(0,J.jsx)(`div`,{...r,ref:i,className:V(`caps-collapse`,n),"data-open":e,"aria-hidden":!e||void 0,children:(0,J.jsx)(`div`,{className:`caps-collapse-clip`,children:t})})});(0,q.forwardRef)(function({swapKey:e,anchor:t=`start`,children:n,className:r,...i},a){let o=(0,q.useRef)(null);(0,q.useImperativeHandle)(a,()=>o.current);let s=ce(),[c,l]=(0,q.useState)({key:e,content:n}),[u,d]=(0,q.useState)([]);c.key===e?c.content!==n&&l({key:e,content:n}):(d([...u.filter(t=>t.key!==e&&t.key!==c.key),c]),l({key:e,content:n}));let f=(0,q.useRef)(null);return(0,q.useLayoutEffect)(()=>{let e=o.current;if(!e||!(`ResizeObserver`in globalThis))return;f.current=e.getBoundingClientRect();let t=new ResizeObserver(()=>{e.getAnimations().length===0&&(f.current=e.getBoundingClientRect())});return t.observe(e),()=>{t.disconnect()}},[]),(0,q.useLayoutEffect)(()=>{let e=o.current;if(!e)return;let t=[...e.querySelectorAll(`:scope > [data-swap-leaving]`)],n=e.querySelector(`:scope > [data-swap-current]`);if(n===null||t.length===0)return;if(!y(e)){d([]);return}let r=f.current,i=e.getBoundingClientRect(),a=Tt(e),c=[n.animate([{opacity:0,filter:`blur(${String(a.blur)}px)`,transform:`translateY(${String(a.distance/2)}px)`},{opacity:1,filter:`blur(0px)`,transform:`none`}],{duration:a.normal,easing:B(a,a.ease)})];for(let e of t){let t=e.animate([{opacity:1,filter:`blur(0px)`,transform:`none`},{opacity:0,filter:`blur(${String(a.blur)}px)`,transform:`translateY(${String(-a.distance/2)}px)`}],{duration:a.fast,easing:B(a,a.easeExit),fill:`forwards`}),n=e.dataset.swapLeaving;t.onfinish=()=>{d(e=>e.filter(e=>e.key!==n))},c.push(t)}let l=r!==null&&(Math.abs(r.height-i.height)>.5||Math.abs(r.width-i.width)>.5);return!s&&l&&c.push(e.animate([{width:`${String(r.width)}px`,height:`${String(r.height)}px`},{width:`${String(i.width)}px`,height:`${String(i.height)}px`}],{duration:a.normal,easing:B(a,a.ease)})),()=>{for(let e of c)e.cancel()}},[e,s]),(0,J.jsx)(`div`,{...i,ref:o,className:V(`caps-swap`,r),"data-anchor":t,children:[...u.map(e=>(0,J.jsx)(`div`,{className:`caps-swap-layer`,"data-swap-leaving":e.key,"aria-hidden":`true`,children:e.content},e.key)),(0,J.jsx)(`div`,{className:`caps-swap-layer`,"data-swap-current":``,children:n},e)]})});function Sy({children:e,...t}){let[n,r]=(0,q.useState)(e);return e&&e!==n&&r(e),(0,J.jsx)(xy,{...t,className:V(`caps-field-error-reveal`,t.className),open:!!e,children:(0,J.jsx)(`div`,{className:`caps-field-error`,role:`alert`,"aria-hidden":!e,children:n})})}function Cy({children:e,divider:t=!0,error:n,layout:r=`end`,status:i,...a}){return(0,J.jsxs)(`footer`,{...a,className:V(`caps-form-footer`,a.className),"data-divider":t,"data-layout":r,children:[(0,J.jsx)(Sy,{children:n}),(0,J.jsxs)(`div`,{className:`caps-form-footer-row`,children:[i?(0,J.jsx)(`div`,{className:`caps-form-footer-status`,role:`status`,children:i}):null,(0,J.jsx)(`div`,{className:`caps-form-footer-actions`,children:e})]})]})}var wy=(0,q.forwardRef)(function({busy:e=!1,children:t,className:n,layout:r,...i},a){return(0,J.jsx)(`form`,{...i,"aria-busy":e||void 0,className:V(`caps-form`,n),"data-layout":r,ref:a,children:(0,J.jsx)(`fieldset`,{className:`caps-form-body`,disabled:e,children:t})})}),Ty={2:`h2`,3:`h3`,4:`h4`},Ey=(0,q.forwardRef)(function({children:e,className:t,description:n,layout:r,level:i=3,title:a,...o},s){let c=(0,q.useId)(),l=Ty[i];return(0,J.jsxs)(`section`,{...o,"aria-labelledby":`${c}-title`,className:V(`caps-form-section`,t),"data-layout":r,ref:s,children:[(0,J.jsxs)(`header`,{className:`caps-form-section-copy`,children:[(0,J.jsx)(l,{className:`caps-form-section-title`,id:`${c}-title`,children:a}),n?(0,J.jsx)(`p`,{className:`caps-form-section-description`,children:n}):null]}),(0,J.jsx)(`div`,{className:`caps-form-section-fields`,children:e})]})}),Dy=(0,q.forwardRef)(function({children:e,className:t,description:n,error:r,icon:i,layout:a,legend:o,legendTitle:s,...c},l){let u=(0,q.useId)(),d=[n?`${u}-description`:c[`aria-describedby`],r?`${u}-error`:null].filter(Boolean).join(` `)||void 0;return(0,J.jsxs)(`fieldset`,{...c,"aria-describedby":d,"aria-invalid":r?!0:c[`aria-invalid`],className:V(`caps-fieldset`,t),"data-layout":a,ref:l,children:[(0,J.jsxs)(`legend`,{className:`caps-fieldset-legend`,title:s,children:[i?(0,J.jsx)(`span`,{className:`caps-field-icon`,"aria-hidden":`true`,children:i}):null,o]}),n?(0,J.jsx)(`p`,{className:`caps-fieldset-description`,id:`${u}-description`,children:n}):null,(0,J.jsx)(`div`,{className:`caps-fieldset-fields`,children:e}),r===void 0?null:(0,J.jsx)(Sy,{id:`${u}-error`,children:r})]})});function Oy(e){let t=[];return q.Children.forEach(e.props.children,e=>{(0,q.isValidElement)(e)&&e.type!==yy&&t.push(e)}),t[0]??null}var ky=(0,q.forwardRef)(function({children:e,className:t,description:n,error:r,icon:i,label:a,labelTitle:o,optional:s,orientation:c=`vertical`,readout:l=!1,required:u,...d},f){let p=(0,q.useId)(),m=(0,q.isValidElement)(e)?e:null,h=m?.type===vy,g=h?Oy(m):m,_=g?.props.id??p,v=`${_}-description`,y=`${_}-error`,b=[g?.props[`aria-describedby`],n?v:null,r?y:null].filter(Boolean).join(` `)||void 0,x=u===!0||g?.props.required,S=r?!0:g?.props[`aria-invalid`],C=u===!0||g?.props[`aria-required`],w={id:_};x!==void 0&&(w.required=x),b!==void 0&&(w[`aria-describedby`]=b),S!==void 0&&(w[`aria-invalid`]=S),C!==void 0&&(w[`aria-required`]=C);let T=m&&g&&!l?h?(0,q.cloneElement)(m,void 0,q.Children.map(m.props.children,e=>e===g?(0,q.cloneElement)(g,w):e)):(0,q.cloneElement)(m,w):e,E=a?(0,J.jsx)(_y,{htmlFor:l?void 0:_,title:o,className:c===`inline`?`font-normal`:void 0,...u===void 0?{}:{required:u},...s===void 0?{}:{optional:s},children:a}):null,D=a||n?(0,J.jsxs)(`div`,{className:`caps-field-copy`,children:[E,n?(0,J.jsx)(`p`,{className:`caps-field-description`,id:v,children:n}):null]}):null,O=i?(0,J.jsxs)(`div`,{className:`caps-field-lead`,children:[(0,J.jsx)(`span`,{className:`caps-field-icon`,"aria-hidden":`true`,children:i}),D]}):D;return(0,J.jsxs)(`div`,{...d,className:V(`caps-field`,t),"data-orientation":c,ref:f,children:[c===`horizontal`?(0,J.jsxs)(`div`,{className:`caps-field-row`,children:[O,T]}):c===`inline`?(0,J.jsxs)(`div`,{className:`caps-field-row`,children:[T,O]}):(0,J.jsxs)(J.Fragment,{children:[O,T]}),(0,J.jsx)(Sy,{id:y,children:r})]})});function Ay(e){let t=String(e),n=t.indexOf(`.`);return n===-1?0:t.length-n-1}var jy=`M 9.86 38.14 A 20 20 0 1 1 38.14 38.14`,My=6,Ny=new Map([[`ArrowUp`,1],[`ArrowDown`,-1],[`PageUp`,10],[`PageDown`,-10]]),Py=(0,q.forwardRef)(function({className:e,decrementLabel:t=`Decrease`,defaultValue:n=null,disabled:r,incrementLabel:i=`Increase`,invalid:a,max:o,min:s,onBlur:c,onKeyDown:l,onValueChange:u,step:d=1,unit:f,value:p,wrap:m=!1,...h},g){let[_,v]=(0,q.useState)(n),[y,b]=(0,q.useState)(null),x=p===void 0?_:p,S=Ay(d),C=e=>{let t=Number(e.toFixed(S));return s!==void 0&&t<s?s:o!==void 0&&t>o?o:t},w=e=>{let t=e===null?null:C(e);v(t),b(null),t!==x&&u?.(t)},T=()=>{if(y===null)return;let e=Number(y);w(y.trim()===``||!Number.isFinite(e)?null:e)},E=e=>{let t=(x??s??0)+e*d;if(m&&s!==void 0&&o!==void 0){if(t>o){w(s);return}if(t<s){w(o);return}}w(t)},D=s!==void 0&&x!==null&&x<=s,O=o!==void 0&&x!==null&&x>=o,k=r===!0,A=(0,q.useRef)(null),j=s!==void 0&&o!==void 0&&o>s?((x??s)-s)/(o-s):null,M=e=>{k||(e.currentTarget.setPointerCapture(e.pointerId),A.current={y:e.clientY,value:x??s??0})},N=e=>{if(!A.current)return;let t=Math.trunc((A.current.y-e.clientY)/My),n=C(A.current.value+t*d);n!==x&&w(n)},P=()=>{A.current=null};return(0,J.jsxs)(`span`,{className:V(`caps-number-field`,e),"data-at-max":O||void 0,"data-at-min":D||void 0,"data-disabled":k||void 0,"data-wrap":m||void 0,children:[j===null?null:(0,J.jsxs)(`svg`,{className:`caps-number-field-dial`,viewBox:`0 0 48 48`,"aria-hidden":`true`,focusable:`false`,onPointerDown:M,onPointerMove:N,onPointerUp:P,onPointerCancel:P,children:[(0,J.jsx)(`path`,{className:`caps-number-field-dial-track`,d:jy,pathLength:100}),(0,J.jsx)(`path`,{className:`caps-number-field-dial-level`,d:jy,pathLength:100,strokeDasharray:`${String(Math.max(.5,j*100))} 100`})]}),(0,J.jsx)(U,{type:`button`,variant:`outline`,size:`icon`,className:`caps-number-field-decrement`,"aria-label":t,"aria-controls":h.id,tabIndex:-1,disabled:k||D&&!m,onClick:()=>{E(-1)},children:(0,J.jsx)(jh,{"aria-hidden":`true`})}),(0,J.jsxs)(`span`,{className:`caps-number-field-readout`,children:[(0,J.jsx)(`input`,{...h,"aria-invalid":a?!0:h[`aria-invalid`]===!1?void 0:h[`aria-invalid`],className:`input caps-input caps-number-field-input`,disabled:r,inputMode:h.inputMode??(S>0?`decimal`:`numeric`),max:o,min:s,onBlur:e=>{T(),c?.(e)},onChange:e=>{b(e.target.value)},onKeyDown:e=>{if(l?.(e),e.defaultPrevented)return;let t=Ny.get(e.key);t===void 0?e.key===`Home`&&s!==void 0?(e.preventDefault(),w(s)):e.key===`End`&&o!==void 0?(e.preventDefault(),w(o)):e.key===`Enter`&&T():(e.preventDefault(),E(t))},ref:g,step:d,type:`number`,value:y??(x===null?``:String(x))}),f?(0,J.jsx)(`span`,{className:`caps-number-field-unit`,"aria-hidden":`true`,children:f}):null]}),(0,J.jsx)(U,{type:`button`,variant:`outline`,size:`icon`,className:`caps-number-field-increment`,"aria-label":i,"aria-controls":h.id,tabIndex:-1,disabled:k||O&&!m,onClick:()=>{E(1)},children:(0,J.jsx)(Fh,{"aria-hidden":`true`})})]})}),Fy=(0,q.forwardRef)(function({className:e,invalid:t,...n},r){return(0,J.jsxs)(`span`,{className:`caps-select-shell`,children:[(0,J.jsx)(`select`,{...n,"aria-invalid":t?!0:n[`aria-invalid`]===!1?void 0:n[`aria-invalid`],className:V(`select select-bordered caps-select w-full`,t&&`select-error`,e),ref:r}),!n.multiple&&(!n.size||n.size<=1)?(0,J.jsx)(ai,{className:`caps-select-chevron`,"aria-hidden":`true`}):null]})}),Iy={2:`h2`,3:`h3`,4:`h4`};function Ly(e,t){let{reduced:n}=t,r=e&&!n,i=o(t,600),[a,s]=(0,q.useState)(r);return(0,q.useEffect)(()=>{if(s(r),!r)return;let e=globalThis.setTimeout(()=>{s(!1)},i);return()=>{globalThis.clearTimeout(e)}},[r,i]),a}var Ry=(0,J.jsx)(ln,{decorative:!0,pace:`idle`,size:`md`,tone:`primary`,variant:`wander`}),zy=(0,q.forwardRef)(function({actions:e,secondaryAction:t,className:n,description:r,headingLevel:i=2,primaryAction:a,suggestions:o,thinking:s=!1,title:c,visual:l,renderVisual:u,variant:d=`plain`,...f},p){let m=(0,q.useId)(),h=(0,q.useRef)(null),g=ie(h),_=Ly(d===`speech`,g)&&!s,v=Iy[i],y=l??(d===`panel`?`blobs`:void 0),b=u?u({speaking:_,thinking:s}):y===`blobs`?Ry:y,x=`${m}-reason`,S=(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(v,{ref:h,className:`empty-state-title`,id:f[`aria-labelledby`]?void 0:m,children:c}),(0,J.jsx)(`p`,{children:r}),a?(0,J.jsxs)(`div`,{className:`empty-state-primary`,children:[(0,J.jsxs)(`div`,{className:`empty-state-action-row`,children:[(0,J.jsx)(U,{"aria-describedby":a.disabled&&a.disabledReason?x:void 0,disabled:a.disabled,loading:a.pending===!0,onClick:a.onSelect,variant:`primary`,children:a.label}),t]}),a.disabled&&a.disabledReason?(0,J.jsx)(`span`,{className:`empty-state-reason`,id:x,children:a.disabledReason}):null]}):null,o&&o.length>0?(0,J.jsx)(`ul`,{"aria-label":`Try one of these`,className:`empty-state-suggestions`,children:o.map((e,t)=>(0,J.jsx)(`li`,{children:(0,J.jsx)(U,{disabled:e.disabled,loading:e.pending===!0,size:`sm`,variant:`outline`,onClick:e.onSelect,children:e.label})},`${String(t)}:${e.label}`))}):null,e?(0,J.jsx)(`div`,{className:`empty-state-actions`,children:e}):null]});return(0,J.jsxs)(`section`,{...f,"aria-labelledby":f[`aria-labelledby`]??m,className:V(`empty-state`,d!==`plain`&&`empty-state-${d}`,n),ref:p,children:[b?(0,J.jsx)(`div`,{"aria-hidden":`true`,className:`empty-state-visual`,children:b}):null,d===`speech`?(0,J.jsx)(`div`,{className:`empty-state-bubble`,children:S}):S]})}),By=8e3,Vy=(0,q.forwardRef)(function({className:e,detail:t,framed:n=!0,icon:r,message:i,onRetry:a,size:o=`md`,slowAfterMs:s=By,variant:c=`line`,...l},u){let[d,f]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(f(!1),!Number.isFinite(s))return;let e=globalThis.setTimeout(()=>{f(!0)},s);return()=>{globalThis.clearTimeout(e)}},[s,i]),(0,J.jsxs)(`div`,{...l,className:V(`caps-loading-state`,e),"data-framed":n?void 0:`false`,"data-icon":r?``:void 0,"data-size":o,"data-slow":d||void 0,ref:u,role:`status`,children:[r?(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`caps-loading-state-icon`,children:r}):null,(0,J.jsx)(ln,{decorative:!0,size:o,variant:c}),(0,J.jsxs)(`span`,{className:`caps-loading-state-copy`,children:[(0,J.jsx)(`span`,{children:i}),t?(0,J.jsx)(`span`,{className:`caps-loading-state-detail`,children:t}):null,d?(0,J.jsx)(`span`,{className:`caps-loading-state-detail`,children:`Still working…`}):null]}),d&&a?(0,J.jsx)(U,{className:`caps-loading-state-retry`,size:`sm`,variant:`outline`,onClick:a,children:`Retry`}):null]})}),Hy=`prints.composer.v1`,Uy=160,Wy=96,Gy=24,Ky=96,qy=.4,Jy={maxHeight:Uy,collapsed:!1};function Yy(e,t){return Math.max(Wy,Math.floor(Math.min(e*.7,t-200)))}function Xy(e,t){return Math.round(Math.min(Math.max(e,Wy),t))}var Zy=ye(g({maxHeight:Ge,collapsed:mt})),Qy=w(Zy);function $y(){try{let e=Qy(window.localStorage.getItem(Hy));return xn(e)?{maxHeight:Math.max(e.value.maxHeight,Wy),collapsed:e.value.collapsed}:Jy}catch(e){return tn(`composer-size-read`,e),Jy}}function eb(e){try{window.localStorage.setItem(Hy,JSON.stringify(e))}catch(e){tn(`composer-size-write`,e)}}function tb(){let[e,t]=(0,q.useState)(!1);return(0,q.useLayoutEffect)(()=>{let e=window.matchMedia(`(pointer: coarse)`),n=()=>{t(e.matches)};return n(),e.addEventListener(`change`,n),()=>{e.removeEventListener(`change`,n)}},[]),e}function nb(e){return e?.closest(`[data-app-pane]`)??null}function rb(e){let[t,n]=(0,q.useState)(Jy),[r,i]=(0,q.useState)(Yy(800,800)),[a,o]=(0,q.useState)(800),[s,c]=(0,q.useState)(!1),l=tb();(0,q.useLayoutEffect)(()=>{n($y())},[]),(0,q.useLayoutEffect)(()=>{let t=()=>{let t=nb(e.current);i(Yy(window.innerHeight,t?.clientHeight??window.innerHeight)),o(window.visualViewport?.height??window.innerHeight)};return t(),window.addEventListener(`resize`,t),window.visualViewport?.addEventListener(`resize`,t),()=>{window.removeEventListener(`resize`,t),window.visualViewport?.removeEventListener(`resize`,t)}},[e]);let u=Xy(t.maxHeight,r),d=(0,q.useCallback)(e=>{n(e),eb(e)},[]),f=s&&l;return{cap:l?Math.max(Wy,Math.round(a*qy)):u,coarse:l,collapsed:t.collapsed,fullscreen:f,min:Wy,max:r,maxHeight:u,setMaxHeight:e=>{d({...t,maxHeight:Xy(e,r)})},reset:()=>{d({...t,maxHeight:Uy})},setCollapsed:e=>{d({...t,collapsed:e})},setFullscreen:c}}function ib({layout:e}){let[t,n]=(0,q.useState)(null);return e.coarse?null:(0,J.jsx)(`div`,{"aria-label":`Resize prompt`,"aria-orientation":`horizontal`,"aria-valuemax":e.max,"aria-valuemin":e.min,"aria-valuenow":e.maxHeight,"aria-valuetext":`${String(e.maxHeight)} pixels`,className:`prints-composer-handle`,"data-composer-handle":!0,"data-dragging":t===null?void 0:``,onDoubleClick:e.reset,onKeyDown:t=>{let n=t.shiftKey?Ky:Gy,r=t.key===`ArrowUp`?e.maxHeight+n:t.key===`ArrowDown`?e.maxHeight-n:t.key===`Home`?e.min:t.key===`End`?e.max:null;t.key===`Enter`?(t.preventDefault(),e.reset()):r!==null&&(t.preventDefault(),e.setMaxHeight(r))},onPointerCancel:()=>{n(null)},onPointerDown:t=>{t.preventDefault(),t.currentTarget.setPointerCapture(t.pointerId),n({y:t.clientY,height:e.maxHeight})},onPointerMove:n=>{t!==null&&e.setMaxHeight(t.height+(t.y-n.clientY))},onPointerUp:()=>{n(null)},role:`separator`,tabIndex:0})}var ab=`file-tree-container`,ob=`data-file-tree-style`,sb=`data-file-tree-unsafe-css`,cb=`data-file-tree-scrollbar-measure`,lb=`data-file-tree-scrollbar-gutter-measured`,ub=`--trees-scrollbar-gutter-measured`,db=`header`,fb=`context-menu`,pb=`context-menu-trigger`,mb=typeof window>`u`?q.useEffect:q.useLayoutEffect;function hb(e,t,n){let r=e==null?null:(0,J.jsx)(`div`,{slot:db,children:e}),i=t!=null&&n!=null?(0,J.jsx)(`div`,{slot:fb,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,J.jsxs)(J.Fragment,{children:[r,i]})}function gb(e,t){return typeof window>`u`&&t!=null?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t.shadowHtml}}),e]}):(0,J.jsx)(J.Fragment,{children:e})}function _b(e){let t=e.shadowRoot;return t?.querySelector(`[data-file-tree-id]`)instanceof HTMLElement||t?.querySelector(`[data-file-tree-id]`)instanceof SVGElement||e.querySelector(`template[shadowrootmode="open"]`)instanceof HTMLTemplateElement}function vb(e,t,n,r,i){let a={...e??{}};if(t!=null&&delete a.header,n){let t=e?.contextMenu,n=t?.onClose,o=t?.onOpen;a.contextMenu={...t??{},enabled:!0,onClose:()=>{n?.(),r()},onOpen:(e,t)=>{i(e,t),o?.(e,t)}},delete a.contextMenu.render}return a.header!=null||a.contextMenu!=null?a:void 0}function yb({header:e,id:t,model:n,preloadedData:r,renderContextMenu:i,...a}){let[o,s]=(0,q.useState)(null),[c,l]=(0,q.useState)(null),u=(0,q.useRef)(n.getComposition()),d=(0,q.useRef)(n);d.current!==n&&(d.current=n,u.current=n.getComposition());let f=i!=null,p=(0,q.useCallback)(()=>{s(null)},[]),m=(0,q.useCallback)((e,t)=>{s({context:t,item:e})},[]),h=u.current,g=(0,q.useMemo)(()=>vb(h,e,f,p,m),[h,p,m,f,e]),_=(0,q.useCallback)(e=>{l(e)},[]);(0,q.useEffect)(()=>{f||s(null)},[f]),mb(()=>{n.setComposition(g)},[g,n]),mb(()=>{if(c!=null)return r!=null&&_b(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(h)}},[h,c,n,r]);let v=gb(hb(e,i,o),r),y=t??r?.id,b={"--trees-item-height":`${String(n.getItemHeight())}px`,"--trees-density-override":n.getDensityFactor(),...a.style};return(0,J.jsx)(ab,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}var bb=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
3
|
-
<symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
|
|
4
|
-
<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"/>
|
|
5
|
-
</symbol>
|
|
6
|
-
<symbol id="file-tree-icon-dot" viewBox="0 0 6 6">
|
|
7
|
-
<circle cx="3" cy="3" r="3" />
|
|
8
|
-
</symbol>
|
|
9
|
-
<symbol id="file-tree-icon-file" viewBox="0 0 16 16">
|
|
10
|
-
<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"/>
|
|
11
|
-
<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"/>
|
|
12
|
-
</symbol>
|
|
13
|
-
<symbol id="file-tree-icon-lock" viewBox="0 0 16 16">
|
|
14
|
-
<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" />
|
|
15
|
-
</symbol>
|
|
16
|
-
<symbol id="file-tree-icon-ellipsis" viewBox="0 0 16 16">
|
|
17
|
-
<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" />
|
|
18
|
-
</symbol>
|
|
19
|
-
</svg>`,xb=`<symbol id="file-tree-builtin-astro" viewBox="0 0 16 16">
|
|
20
|
-
<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"/>
|
|
21
|
-
<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"/>
|
|
22
|
-
</symbol>`,Sb=`<symbol id="file-tree-builtin-babel" viewBox="0 0 16 16">
|
|
23
|
-
<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"/>
|
|
24
|
-
</symbol>`,Cb=`<symbol id="file-tree-builtin-bash" viewBox="0 0 16 16">
|
|
25
|
-
<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"/>
|
|
26
|
-
<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"/>
|
|
27
|
-
</symbol>`,wb=`<symbol id="file-tree-builtin-biome" viewBox="0 0 16 16">
|
|
28
|
-
<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"/>
|
|
29
|
-
</symbol>`,Tb=`<symbol id="file-tree-builtin-bootstrap" viewBox="0 0 16 16">
|
|
30
|
-
<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"/>
|
|
31
|
-
<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"/>
|
|
32
|
-
</symbol>`,Eb=`<symbol id="file-tree-builtin-browserslist" viewBox="0 0 16 16">
|
|
33
|
-
<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"/>
|
|
34
|
-
<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"/>
|
|
35
|
-
<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"/>
|
|
36
|
-
</symbol>`,Db=`<symbol id="file-tree-builtin-bun" viewBox="0 0 16 16">
|
|
37
|
-
<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"/>
|
|
38
|
-
</symbol>`,Ob=`<symbol id="file-tree-builtin-c" viewBox="0 0 16 16">
|
|
39
|
-
<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"/>
|
|
40
|
-
</symbol>`,kb=`<symbol id="file-tree-builtin-claude" viewBox="0 0 16 16">
|
|
41
|
-
<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-.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"/>
|
|
42
|
-
</symbol>`,Ab=`<symbol id="file-tree-builtin-cpp" viewBox="0 0 16 16">
|
|
43
|
-
<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"/>
|
|
44
|
-
</symbol>`,jb=`<symbol id="file-tree-builtin-css" viewBox="0 0 16 16">
|
|
45
|
-
<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"/>
|
|
46
|
-
<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"/>
|
|
47
|
-
</symbol>`,Mb=`<symbol id="file-tree-builtin-database" viewBox="0 0 16 16">
|
|
48
|
-
<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"/>
|
|
49
|
-
<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"/>
|
|
50
|
-
<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"/>
|
|
51
|
-
</symbol>`,Nb=`<symbol id="file-tree-builtin-default" viewBox="0 0 16 16">
|
|
52
|
-
<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"/>
|
|
53
|
-
<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"/>
|
|
54
|
-
</symbol>`,Pb=`<symbol id="file-tree-builtin-docker" viewBox="0 0 16 16">
|
|
55
|
-
<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"/>
|
|
56
|
-
<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"/>
|
|
57
|
-
</symbol>`,Fb=`<symbol id="file-tree-builtin-eslint" viewBox="0 0 16 16">
|
|
58
|
-
<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"/>
|
|
59
|
-
<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"/>
|
|
60
|
-
</symbol>`,Ib=`<symbol id="file-tree-builtin-font" viewBox="0 0 16 16">
|
|
61
|
-
<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"/>
|
|
62
|
-
</symbol>`,Lb=`<symbol id="file-tree-builtin-git" viewBox="0 0 16 16">
|
|
63
|
-
<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"/>
|
|
64
|
-
</symbol>`,Rb=`<symbol id="file-tree-builtin-go" viewBox="0 0 16 16">
|
|
65
|
-
<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"/>
|
|
66
|
-
</symbol>`,zb=`<symbol id="file-tree-builtin-graphql" viewBox="0 0 16 16">
|
|
67
|
-
<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"/>
|
|
68
|
-
</symbol>`,Bb=`<symbol id="file-tree-builtin-html" viewBox="0 0 16 16">
|
|
69
|
-
<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"/>
|
|
70
|
-
<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"/>
|
|
71
|
-
</symbol>`,Vb=`<symbol id="file-tree-builtin-image" viewBox="0 0 16 16">
|
|
72
|
-
<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"/>
|
|
73
|
-
<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"/>
|
|
74
|
-
</symbol>`,Hb=`<symbol id="file-tree-builtin-javascript" viewBox="0 0 16 16">
|
|
75
|
-
<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"/>
|
|
76
|
-
<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"/>
|
|
77
|
-
</symbol>`,Ub=`<symbol id="file-tree-builtin-json" viewBox="0 0 16 16">
|
|
78
|
-
<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"/>
|
|
79
|
-
</symbol>`,Wb=`<symbol id="file-tree-builtin-markdown" viewBox="0 0 16 16">
|
|
80
|
-
<path fill="currentColor" d="M1 12V4h2l2 2.5L7 4h2v8H7V7.5l-2 2-2-2V12zm9-3 3 3.5L16 9h-2V4h-2v5z"/>
|
|
81
|
-
</symbol>`,Gb=`<symbol id="file-tree-builtin-mcp" viewBox="0 0 16 16">
|
|
82
|
-
<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"/>
|
|
83
|
-
<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"/>
|
|
84
|
-
</symbol>`,Kb=`<symbol id="file-tree-builtin-nextjs" viewBox="0 0 16 16">
|
|
85
|
-
<defs>
|
|
86
|
-
<linearGradient id="a" x1="4.522" x2="14" y1="3.943" y2="16" gradientUnits="userSpaceOnUse">
|
|
87
|
-
<stop stop-color="currentColor"/>
|
|
88
|
-
<stop offset="1" stop-color="currentColor" stop-opacity="0"/>
|
|
89
|
-
</linearGradient>
|
|
90
|
-
</defs>
|
|
91
|
-
<path fill="currentColor" d="M3 2h1.522v9.09H3z"/>
|
|
92
|
-
<path fill="url(#a)" d="M4.903 2 15 15.075q-.565.5-1.195.925L4.522 3.943z"/>
|
|
93
|
-
<path fill="currentColor" d="M12.172 2h-1.508v9.094h1.508z"/>
|
|
94
|
-
</symbol>`,qb=`<symbol id="file-tree-builtin-npm" viewBox="0 0 16 16">
|
|
95
|
-
<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"/>
|
|
96
|
-
<path fill="currentColor" d="M10.5 13H13V3H3v10h5V5.5h2.5z"/>
|
|
97
|
-
</symbol>`,Jb=`<symbol id="file-tree-builtin-oxc" viewBox="0 0 16 16">
|
|
98
|
-
<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"/>
|
|
99
|
-
</symbol>`,Yb=`<symbol id="file-tree-builtin-postcss" viewBox="0 0 16 16">
|
|
100
|
-
<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"/>
|
|
101
|
-
</symbol>`,Xb=`<symbol id="file-tree-builtin-prettier" viewBox="0 0 16 16">
|
|
102
|
-
<path fill="currentColor" d="M6 12v1H4.93v-1zm1-2v1H2v-1zm6-4v1h-3V6zm-1-4v1H9V2z"/>
|
|
103
|
-
<path fill="currentColor" d="M11.5 10v1H8v-1zM5 6v1H2V6zm5-2v1H9V4z" opacity=".8"/>
|
|
104
|
-
<path fill="currentColor" d="M6 14v1H2v-1zm-.5-6v1H2V8zM13 4v1h-3V4zM4.93 2v1H2V2z" opacity=".6"/>
|
|
105
|
-
<path fill="currentColor" d="M4.93 12v1H2v-1zM13 8v1H9V8zM5.5 4v1H2V4zM9 2v1H4.93V2z" opacity=".4"/>
|
|
106
|
-
</symbol>`,Zb=`<symbol id="file-tree-builtin-python" viewBox="0 0 16 16">
|
|
107
|
-
<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"/>
|
|
108
|
-
<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-.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"/>
|
|
109
|
-
</symbol>`,Qb=`<symbol id="file-tree-builtin-react" viewBox="0 0 16 16">
|
|
110
|
-
<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"/>
|
|
111
|
-
<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"/>
|
|
112
|
-
</symbol>`,$b=`<symbol id="file-tree-builtin-ruby" viewBox="0 0 16 16">
|
|
113
|
-
<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"/>
|
|
114
|
-
</symbol>`,ex=`<symbol id="file-tree-builtin-rust" viewBox="0 0 16 16">
|
|
115
|
-
<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"/>
|
|
116
|
-
</symbol>`,tx=`<symbol id="file-tree-builtin-sass" viewBox="0 0 16 16">
|
|
117
|
-
<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"/>
|
|
118
|
-
</symbol>`,nx=`<symbol id="file-tree-builtin-stylelint" viewBox="0 0 16 16">
|
|
119
|
-
<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"/>
|
|
120
|
-
<path fill="currentColor" d="M6.5 2.5V4l-2 1.5v-4zm5 3L9.5 4V2.5l2-1zM9 4H7V2.5h2z"/>
|
|
121
|
-
</symbol>`,rx=`<symbol id="file-tree-builtin-svelte" viewBox="0 0 16 16">
|
|
122
|
-
<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"/>
|
|
123
|
-
</symbol>`,ix=`<symbol id="file-tree-builtin-svg" viewBox="0 0 16 16">
|
|
124
|
-
<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"/>
|
|
125
|
-
<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"/>
|
|
126
|
-
</symbol>`,ax=`<symbol id="file-tree-builtin-svgo" viewBox="0 0 16 16">
|
|
127
|
-
<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"/>
|
|
128
|
-
<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"/>
|
|
129
|
-
</symbol>`,ox=`<symbol id="file-tree-builtin-swift" viewBox="0 0 16 16">
|
|
130
|
-
<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"/>
|
|
131
|
-
</symbol>`,sx=`<symbol id="file-tree-builtin-table" viewBox="0 0 16 16">
|
|
132
|
-
<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"/>
|
|
133
|
-
<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"/>
|
|
134
|
-
</symbol>`,cx=`<symbol id="file-tree-builtin-tailwind" viewBox="0 0 16 16">
|
|
135
|
-
<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"/>
|
|
136
|
-
</symbol>`,lx=`<symbol id="file-tree-builtin-terraform" viewBox="0 0 16 16">
|
|
137
|
-
<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"/>
|
|
138
|
-
</symbol>`,ux=`<symbol id="file-tree-builtin-text" viewBox="0 0 16 16">
|
|
139
|
-
<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"/>
|
|
140
|
-
<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"/>
|
|
141
|
-
</symbol>`,dx=`<symbol id="file-tree-builtin-typescript" viewBox="0 0 16 16">
|
|
142
|
-
<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"/>
|
|
143
|
-
<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"/>
|
|
144
|
-
</symbol>`,fx=`<symbol id="file-tree-builtin-vite" viewBox="0 0 16 16">
|
|
145
|
-
<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"/>
|
|
146
|
-
</symbol>`,px=`<symbol id="file-tree-builtin-vscode" viewBox="0 0 16 16">
|
|
147
|
-
<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"/>
|
|
148
|
-
<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"/>
|
|
149
|
-
<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"/>
|
|
150
|
-
</symbol>`,mx=`<symbol id="file-tree-builtin-vue" viewBox="0 0 16 16">
|
|
151
|
-
<path fill="currentColor" d="M9.62 2.25 8 5.02 6.38 2.25H1l7 12 7-12z" opacity=".5"/>
|
|
152
|
-
<path fill="currentColor" d="M9.54 2.25 8 4.95l-1.54-2.7H4l4 7 4-7z"/>
|
|
153
|
-
</symbol>`,hx=`<symbol id="file-tree-builtin-wasm" viewBox="0 0 16 16">
|
|
154
|
-
<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"/>
|
|
155
|
-
<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"/>
|
|
156
|
-
<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"/>
|
|
157
|
-
</symbol>`,gx=`<symbol id="file-tree-builtin-webpack" viewBox="0 0 16 16">
|
|
158
|
-
<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"/>
|
|
159
|
-
<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"/>
|
|
160
|
-
</symbol>`,_x=`<symbol id="file-tree-builtin-yml" viewBox="0 0 16 16">
|
|
161
|
-
<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"/>
|
|
162
|
-
</symbol>`,vx=`<symbol id="file-tree-builtin-zig" viewBox="0 0 16 16">
|
|
163
|
-
<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"/>
|
|
164
|
-
<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"/>
|
|
165
|
-
</symbol>`,yx=[Cb,Ob,Ab,jb,Mb,Nb,Ib,Lb,Rb,Bb,Vb,Hb,Ub,Wb,Gb,Zb,$b,ex,ox,sx,ux,dx,`<symbol id="file-tree-builtin-zip" viewBox="0 0 16 16">
|
|
166
|
-
<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"/>
|
|
167
|
-
<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"/>
|
|
168
|
-
</symbol>`],bx=[xb,Sb,wb,Tb,Eb,Db,kb,Pb,Fb,zb,Kb,qb,Jb,Yb,Xb,Qb,tx,nx,rx,ix,ax,cx,lx,fx,px,mx,hx,gx,_x,vx];function xx(e,t){return t.length===0?e:e.replace(`</svg>`,`\n ${t.join(`
|
|
169
|
-
`)}\n</svg>`)}var Sx=xx(bb,yx),Cx={minimal:bb,standard:Sx,complete:xx(Sx,bx)},wx={".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`},Tx={"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`,tsv:`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`},Ex={jsx:`react`,sass:`sass`,scss:`sass`,tsx:`react`},Dx=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`]),Ox=new Set([`complete`]);function kx(e){return Cx[e===`none`?`minimal`:e]}function Ax(e){return`file-tree-builtin-${e}`}function jx(e){return e!==`none`&&Ox.has(e)}function Mx(e,t,n){if(e===`minimal`||e===`none`)return;let r=e===`complete`,i=wx[t.toLowerCase()];if(i!=null&&(r||Dx.has(i)))return i;for(let e of n){if(r){let t=Ex[e];if(t!=null)return t}let t=Tx[e];if(t!=null&&(r||Dx.has(t)))return t}return`default`}function Nx(e){return e.spriteSheet!=null||e.remap!=null||e.byFileName!=null||e.byFileExtension!=null||e.byFileNameContains!=null}function Px(e){return e==null?{set:`complete`,colored:!0}:typeof e==`string`?{set:e,colored:!0}:{...e,set:e.set??(Nx(e)?`none`:`complete`),colored:e.colored??!0}}var Fx={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function Ix(e,t){if(typeof e==`number`)return{itemHeight:t??Fx.default.itemHeight,factor:e};let n=Fx[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var Lx=Fx.default.itemHeight,Rx=`@layer base {
|
|
170
|
-
:host {
|
|
171
|
-
--trees-accent: var(--trees-accent-override, #009fff);
|
|
172
|
-
--trees-fg: var(--trees-fg-override, var(--trees-theme-sidebar-fg, light-dark(#6c6c71, #adadb1)));
|
|
173
|
-
--trees-fg-muted: var(--trees-fg-muted-override, var(--trees-theme-sidebar-header-fg, light-dark(#84848a, #84848a)));
|
|
174
|
-
--trees-bg: var(--trees-bg-override, var(--trees-theme-sidebar-bg, light-dark(#f8f8f8, #141415)));
|
|
175
|
-
--trees-bg-muted: var(--trees-bg-muted-override, var(--trees-theme-list-hover-bg, light-dark(color-mix(in lab,
|
|
176
|
-
var(--trees-accent) var(--trees-bg-alpha-light, 8%),
|
|
177
|
-
var(--trees-bg)), color-mix(in lab,
|
|
178
|
-
var(--trees-accent) var(--trees-bg-alpha-dark, 10%),
|
|
179
|
-
var(--trees-bg)))));
|
|
180
|
-
--trees-input-bg: var(--trees-input-bg-override, light-dark(#f8f8f8, #070707));
|
|
181
|
-
--trees-added-light: #16a994;
|
|
182
|
-
--trees-added-dark: #00cab1;
|
|
183
|
-
--trees-ignored-light: #adadb1;
|
|
184
|
-
--trees-ignored-dark: #4a4a4e;
|
|
185
|
-
--trees-modified-light: #1ca1c7;
|
|
186
|
-
--trees-modified-dark: #08c0ef;
|
|
187
|
-
--trees-renamed-light: #d5a910;
|
|
188
|
-
--trees-renamed-dark: #ffd452;
|
|
189
|
-
--trees-untracked-light: #16a994;
|
|
190
|
-
--trees-untracked-dark: #00cab1;
|
|
191
|
-
--trees-deleted-light: #ff2e3f;
|
|
192
|
-
--trees-deleted-dark: #ff6762;
|
|
193
|
-
--trees-border-color: var(--trees-border-color-override, var(--trees-theme-sidebar-border, light-dark(#eeeeef, #070707)));
|
|
194
|
-
--trees-indent-guide-bg: var(--trees-indent-guide-bg-override, color-mix(in lab, var(--trees-fg-muted) 25%, transparent));
|
|
195
|
-
--trees-density: var(--trees-density-override, 1);
|
|
196
|
-
--trees-border-radius: var(--trees-border-radius-override, calc(6px * var(--trees-density)));
|
|
197
|
-
--trees-font-family: var(--trees-font-family-override, system-ui);
|
|
198
|
-
--trees-font-size: var(--trees-font-size-override, 13px);
|
|
199
|
-
--trees-font-weight-regular: var(--trees-font-weight-regular-override, 400);
|
|
200
|
-
--trees-font-weight-semibold: var(--trees-font-weight-semibold-override, 600);
|
|
201
|
-
--trees-focus-ring-color: var(--trees-focus-ring-color-override, var(--trees-theme-focus-ring, var(--trees-accent)));
|
|
202
|
-
--trees-focus-ring-width: var(--trees-focus-ring-width-override, 1px);
|
|
203
|
-
--trees-focus-ring-offset: var(--trees-focus-ring-offset-override, -1px);
|
|
204
|
-
--trees-search-fg: var(--trees-search-fg-override, var(--trees-theme-input-fg, var(--trees-fg)));
|
|
205
|
-
--trees-search-font-weight: var(--trees-search-font-weight-override, 600);
|
|
206
|
-
--trees-search-bg: var(--trees-search-bg-override, var(--trees-theme-input-bg, var(--trees-input-bg)));
|
|
207
|
-
--trees-scrollbar-thumb: var(--trees-scrollbar-thumb-override, var(--trees-theme-scrollbar-thumb, color-mix(in lab, var(--trees-fg) 25%, var(--trees-bg))));
|
|
208
|
-
--trees-selected-fg: var(--trees-selected-fg-override, var(--trees-theme-list-active-selection-fg, var(--trees-fg)));
|
|
209
|
-
--trees-selected-bg: var(--trees-selected-bg-override, var(--trees-theme-list-active-selection-bg, light-dark(color-mix(in lab, var(--trees-accent) 12%, var(--trees-bg)), color-mix(in lab, var(--trees-accent) 15%, var(--trees-bg)))));
|
|
210
|
-
--trees-selected-focused-border-color: var(--trees-selected-focused-border-color-override, var(--trees-theme-focus-ring, var(--trees-accent)));
|
|
211
|
-
--trees-status-added: var(--trees-status-added-override, var(--trees-theme-git-added-fg, light-dark(var(--trees-added-light), var(--trees-added-dark))));
|
|
212
|
-
--trees-status-ignored: var(--trees-status-ignored-override, var(--trees-theme-git-ignored-fg, light-dark(var(--trees-ignored-light), var(--trees-ignored-dark))));
|
|
213
|
-
--trees-status-modified: var(--trees-status-modified-override, var(--trees-theme-git-modified-fg, light-dark(var(--trees-modified-light), var(--trees-modified-dark))));
|
|
214
|
-
--trees-status-renamed: var(--trees-status-renamed-override, var(--trees-theme-git-renamed-fg, light-dark(var(--trees-renamed-light), var(--trees-renamed-dark))));
|
|
215
|
-
--trees-status-untracked: var(--trees-status-untracked-override, var(--trees-theme-git-untracked-fg, light-dark(var(--trees-untracked-light), var(--trees-untracked-dark))));
|
|
216
|
-
--trees-status-deleted: var(--trees-status-deleted-override, var(--trees-theme-git-deleted-fg, light-dark(var(--trees-deleted-light), var(--trees-deleted-dark))));
|
|
217
|
-
--trees-git-modified-color: var(--trees-git-modified-color-override, var(--trees-status-modified));
|
|
218
|
-
--trees-git-added-color: var(--trees-git-added-color-override, var(--trees-status-added));
|
|
219
|
-
--trees-git-ignored-color: var(--trees-git-ignored-color-override, var(--trees-status-ignored));
|
|
220
|
-
--trees-git-deleted-color: var(--trees-git-deleted-color-override, var(--trees-status-deleted));
|
|
221
|
-
--trees-git-renamed-color: var(--trees-git-renamed-color-override, var(--trees-status-renamed));
|
|
222
|
-
--trees-git-untracked-color: var(--trees-git-untracked-color-override, var(--trees-status-untracked));
|
|
223
|
-
--trees-icon-gray: light-dark(#84848a, #adadb1);
|
|
224
|
-
--trees-icon-red: light-dark(#d52c36, #ff6762);
|
|
225
|
-
--trees-icon-vermilion: light-dark(#ff8c5b, #d5512f);
|
|
226
|
-
--trees-icon-orange: light-dark(#d47628, #ffa359);
|
|
227
|
-
--trees-icon-yellow: light-dark(#d5a910, #ffd452);
|
|
228
|
-
--trees-icon-green: light-dark(#199f43, #5ecc71);
|
|
229
|
-
--trees-icon-teal: light-dark(#17a5af, #64d1db);
|
|
230
|
-
--trees-icon-cyan: light-dark(#1ca1c7, #68cdf2);
|
|
231
|
-
--trees-icon-blue: light-dark(#1a85d4, #69b1ff);
|
|
232
|
-
--trees-icon-indigo: light-dark(#693acf, #9d6afb);
|
|
233
|
-
--trees-icon-purple: light-dark(#a631be, #d568ea);
|
|
234
|
-
--trees-icon-pink: light-dark(#d32a61, #ff678d);
|
|
235
|
-
--trees-icon-mauve: light-dark(#594c5b, #79697b);
|
|
236
|
-
--trees-file-icon-color-default: var(--trees-file-icon-color, var(--trees-icon-gray));
|
|
237
|
-
--trees-file-icon-color-astro: var(--trees-file-icon-color, var(--trees-icon-purple));
|
|
238
|
-
--trees-file-icon-color-babel: var(--trees-file-icon-color, var(--trees-icon-yellow));
|
|
239
|
-
--trees-file-icon-color-bash: var(--trees-file-icon-color, var(--trees-icon-green));
|
|
240
|
-
--trees-file-icon-color-biome: var(--trees-file-icon-color, var(--trees-icon-blue));
|
|
241
|
-
--trees-file-icon-color-bootstrap: var(--trees-file-icon-color, var(--trees-icon-indigo));
|
|
242
|
-
--trees-file-icon-color-browserslist: var(--trees-file-icon-color, var(--trees-icon-yellow));
|
|
243
|
-
--trees-file-icon-color-bun: var(--trees-file-icon-color, var(--trees-icon-mauve));
|
|
244
|
-
--trees-file-icon-color-c: var(--trees-file-icon-color, var(--trees-icon-blue));
|
|
245
|
-
--trees-file-icon-color-cpp: var(--trees-file-icon-color, var(--trees-icon-blue));
|
|
246
|
-
--trees-file-icon-color-claude: var(--trees-file-icon-color, var(--trees-icon-orange));
|
|
247
|
-
--trees-file-icon-color-css: var(--trees-file-icon-color, var(--trees-icon-indigo));
|
|
248
|
-
--trees-file-icon-color-database: var(--trees-file-icon-color, var(--trees-icon-purple));
|
|
249
|
-
--trees-file-icon-color-docker: var(--trees-file-icon-color, var(--trees-icon-blue));
|
|
250
|
-
--trees-file-icon-color-eslint: var(--trees-file-icon-color, var(--trees-icon-indigo));
|
|
251
|
-
--trees-file-icon-color-git: var(--trees-file-icon-vermilion, var(--trees-icon-vermilion));
|
|
252
|
-
--trees-file-icon-color-go: var(--trees-file-icon-color, var(--trees-icon-cyan));
|
|
253
|
-
--trees-file-icon-color-graphql: var(--trees-file-icon-color, var(--trees-icon-pink));
|
|
254
|
-
--trees-file-icon-color-html: var(--trees-file-icon-color, var(--trees-icon-orange));
|
|
255
|
-
--trees-file-icon-color-image: var(--trees-file-icon-color, var(--trees-icon-pink));
|
|
256
|
-
--trees-file-icon-color-javascript: var(--trees-file-icon-color, var(--trees-icon-yellow));
|
|
257
|
-
--trees-file-icon-color-json: var(--trees-file-icon-color, var(--trees-icon-orange));
|
|
258
|
-
--trees-file-icon-color-markdown: var(--trees-file-icon-color, var(--trees-icon-green));
|
|
259
|
-
--trees-file-icon-color-mcp: var(--trees-file-icon-color, var(--trees-icon-teal));
|
|
260
|
-
--trees-file-icon-color-npm: var(--trees-file-icon-color, var(--trees-icon-red));
|
|
261
|
-
--trees-file-icon-color-oxc: var(--trees-file-icon-cyan, var(--trees-icon-cyan));
|
|
262
|
-
--trees-file-icon-color-postcss: var(--trees-file-icon-color, var(--trees-icon-red));
|
|
263
|
-
--trees-file-icon-color-prettier: var(--trees-file-icon-color, var(--trees-icon-teal));
|
|
264
|
-
--trees-file-icon-color-python: var(--trees-file-icon-color, var(--trees-icon-blue));
|
|
265
|
-
--trees-file-icon-color-react: var(--trees-file-icon-color, var(--trees-icon-cyan));
|
|
266
|
-
--trees-file-icon-color-ruby: var(--trees-file-icon-color, var(--trees-icon-red));
|
|
267
|
-
--trees-file-icon-color-rust: var(--trees-file-icon-color, var(--trees-icon-orange));
|
|
268
|
-
--trees-file-icon-color-sass: var(--trees-file-icon-color, var(--trees-icon-pink));
|
|
269
|
-
--trees-file-icon-color-svg: var(--trees-file-icon-color, var(--trees-icon-orange));
|
|
270
|
-
--trees-file-icon-color-svelte: var(--trees-file-icon-color, var(--trees-icon-red));
|
|
271
|
-
--trees-file-icon-color-svgo: var(--trees-file-icon-color, var(--trees-icon-green));
|
|
272
|
-
--trees-file-icon-color-swift: var(--trees-file-icon-color, var(--trees-icon-orange));
|
|
273
|
-
--trees-file-icon-color-table: var(--trees-file-icon-color, var(--trees-icon-teal));
|
|
274
|
-
--trees-file-icon-color-text: var(--trees-file-icon-color, var(--trees-icon-gray));
|
|
275
|
-
--trees-file-icon-color-tailwind: var(--trees-file-icon-color, var(--trees-icon-cyan));
|
|
276
|
-
--trees-file-icon-color-terraform: var(--trees-file-icon-color, var(--trees-icon-indigo));
|
|
277
|
-
--trees-file-icon-color-typescript: var(--trees-file-icon-color, var(--trees-icon-blue));
|
|
278
|
-
--trees-file-icon-color-vite: var(--trees-file-icon-color, var(--trees-icon-purple));
|
|
279
|
-
--trees-file-icon-color-vscode: var(--trees-file-icon-color, var(--trees-icon-blue));
|
|
280
|
-
--trees-file-icon-color-vue: var(--trees-file-icon-color, var(--trees-icon-green));
|
|
281
|
-
--trees-file-icon-color-wasm: var(--trees-file-icon-color, var(--trees-icon-indigo));
|
|
282
|
-
--trees-file-icon-color-webpack: var(--trees-file-icon-color, var(--trees-icon-blue));
|
|
283
|
-
--trees-file-icon-color-yml: var(--trees-file-icon-color, var(--trees-icon-red));
|
|
284
|
-
--trees-file-icon-color-zig: var(--trees-file-icon-color, var(--trees-icon-orange));
|
|
285
|
-
--trees-file-icon-color-zip: var(--trees-file-icon-color, var(--trees-icon-orange));
|
|
286
|
-
--trees-level-gap: var(--trees-level-gap-override, calc(8px * var(--trees-density)));
|
|
287
|
-
--trees-item-padding-x: var(--trees-item-padding-x-override, calc(8px * var(--trees-density)));
|
|
288
|
-
--trees-item-margin-x: var(--trees-item-margin-x-override, calc(2px * var(--trees-density)));
|
|
289
|
-
--trees-item-row-gap: var(--trees-item-row-gap-override, calc(6px * var(--trees-density)));
|
|
290
|
-
--trees-icon-width: var(--trees-icon-width-override, 16px);
|
|
291
|
-
--trees-icon-nudge: var(--trees-icon-nudge-override, calc(1px * var(--trees-density)));
|
|
292
|
-
--trees-row-height: var(--trees-item-height, 30px);
|
|
293
|
-
--trees-git-lane-width: var(--trees-git-lane-width-override, 12px);
|
|
294
|
-
--trees-action-lane-width: var(--trees-action-lane-width-override, calc(var(--trees-icon-width) + 2px));
|
|
295
|
-
--trees-context-menu-trigger-inline-offset: calc(var(--trees-padding-inline) + var(--trees-item-padding-x) -
|
|
296
|
-
var(--trees-focus-ring-width));
|
|
297
|
-
--trees-scrollbar-gutter: var(--trees-scrollbar-gutter-override, 6px);
|
|
298
|
-
--trees-padding-inline: var(--trees-padding-inline-override, 16px);
|
|
299
|
-
color-scheme: light dark;
|
|
300
|
-
font-size: var(--trees-font-size);
|
|
301
|
-
color: var(--trees-fg);
|
|
302
|
-
background-color: var(--trees-bg);
|
|
303
|
-
--truncate-marker-background-color: var(--trees-bg);
|
|
304
|
-
--truncate-marker-background-overlay-color: transparent;
|
|
305
|
-
font-family: var(--trees-font-family);
|
|
306
|
-
font-weight: var(--trees-font-weight-regular);
|
|
307
|
-
flex-direction: column;
|
|
308
|
-
display: flex;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
:host([data-file-tree-virtualized="true"]) {
|
|
312
|
-
height: 100%;
|
|
313
|
-
overflow: hidden;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
[data-file-tree-virtualized-wrapper="true"], [data-file-tree-virtualized-root="true"] {
|
|
317
|
-
flex-direction: column;
|
|
318
|
-
height: 100%;
|
|
319
|
-
display: flex;
|
|
320
|
-
overflow: hidden;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
[data-file-tree-virtualized-scroll="true"], [data-file-tree-scrollbar-measure="true"] {
|
|
324
|
-
--trees-scrollbar-thumb-current: transparent;
|
|
325
|
-
scrollbar-gutter: stable;
|
|
326
|
-
overflow-y: auto;
|
|
327
|
-
|
|
328
|
-
&:hover {
|
|
329
|
-
--trees-scrollbar-thumb-current: var(--trees-scrollbar-thumb);
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
&::-webkit-scrollbar {
|
|
333
|
-
width: var(--trees-scrollbar-gutter);
|
|
334
|
-
height: var(--trees-scrollbar-gutter);
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
&::-webkit-scrollbar-track {
|
|
338
|
-
background: none;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
&::-webkit-scrollbar-thumb {
|
|
342
|
-
background-color: var(--trees-scrollbar-thumb-current);
|
|
343
|
-
border-radius: calc(var(--trees-scrollbar-gutter) / 2);
|
|
344
|
-
background-clip: content-box;
|
|
345
|
-
border: 1px solid #0000;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
&::-webkit-scrollbar-corner {
|
|
349
|
-
background-color: #0000;
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
[data-file-tree-scrollbar-measure="true"] {
|
|
354
|
-
visibility: hidden;
|
|
355
|
-
pointer-events: none;
|
|
356
|
-
width: 100px;
|
|
357
|
-
height: 100px;
|
|
358
|
-
position: absolute;
|
|
359
|
-
top: 0;
|
|
360
|
-
left: 0;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
@supports ((-moz-appearance: none)) {
|
|
364
|
-
[data-file-tree-virtualized-scroll="true"], [data-file-tree-scrollbar-measure="true"] {
|
|
365
|
-
scrollbar-width: thin;
|
|
366
|
-
scrollbar-color: var(--trees-scrollbar-thumb-current) transparent;
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
[data-file-tree-virtualized-scroll="true"] {
|
|
371
|
-
min-height: 0;
|
|
372
|
-
padding-inline: max(calc(var(--trees-padding-inline) - var(--trees-item-margin-x)),
|
|
373
|
-
0px)
|
|
374
|
-
/* NOTE(amadeus): We can assume that all Webkit based browser gutters
|
|
375
|
-
* will align to the value of '--trees-scrollbar-gutter', however if not, then
|
|
376
|
-
* \`--trees-scrollbar-gutter-measured\` should correct it. Mostly we are
|
|
377
|
-
* hoping to avoid SSR alignment jumps if possible. In non-SSR'd environments
|
|
378
|
-
* \`--trees-scrollbar-gutter-measured\` should always be immediately available.
|
|
379
|
-
*/
|
|
380
|
-
max(calc(var(--trees-padding-inline) - var(--trees-item-margin-x) -
|
|
381
|
-
var(--trees-scrollbar-gutter-measured, var(--trees-scrollbar-gutter))),
|
|
382
|
-
0px);
|
|
383
|
-
flex: 1 1 0;
|
|
384
|
-
position: relative;
|
|
385
|
-
overflow-y: auto;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
@supports ((-moz-appearance: none)) {
|
|
389
|
-
[data-file-tree-virtualized-scroll="true"] {
|
|
390
|
-
padding-inline: max(calc(var(--trees-padding-inline) - var(--trees-item-margin-x)),
|
|
391
|
-
0px)
|
|
392
|
-
/* NOTE(amadeus): However on Firefox it can vary a little bit, but most
|
|
393
|
-
* likely the majority of cases will default to a 0px width scrollbar lets
|
|
394
|
-
* inherit that first to avoid SSR jumps. In non-SSR'd environments
|
|
395
|
-
* \`--trees-scrollbar-gutter-measured\` should always be immediately available.
|
|
396
|
-
*/
|
|
397
|
-
max(calc(var(--trees-padding-inline) - var(--trees-item-margin-x) -
|
|
398
|
-
var(--trees-scrollbar-gutter-measured, 0px)),
|
|
399
|
-
0px);
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
[data-file-tree-sticky-overlay="true"] {
|
|
404
|
-
z-index: 4;
|
|
405
|
-
pointer-events: none;
|
|
406
|
-
height: 0;
|
|
407
|
-
position: sticky;
|
|
408
|
-
top: 0;
|
|
409
|
-
overflow: visible;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
[data-file-tree-virtualized-root="true"][data-scroll-at-top="true"]:not([data-overlay-reveal]) [data-file-tree-sticky-overlay="true"] {
|
|
413
|
-
visibility: hidden;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
[data-file-tree-sticky-overlay-content="true"] {
|
|
417
|
-
background-color: var(--trees-bg);
|
|
418
|
-
pointer-events: none;
|
|
419
|
-
position: relative;
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
[data-file-tree-virtualized-list="true"] {
|
|
423
|
-
background-color: var(--trees-bg);
|
|
424
|
-
overflow-anchor: none;
|
|
425
|
-
width: 100%;
|
|
426
|
-
min-height: 100%;
|
|
427
|
-
position: relative;
|
|
428
|
-
|
|
429
|
-
&[data-is-scrolling] {
|
|
430
|
-
pointer-events: none;
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
[data-file-tree-virtualized-sticky-offset="true"] {
|
|
435
|
-
contain: layout size;
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
[data-file-tree-virtualized-sticky="true"] {
|
|
439
|
-
isolation: isolate;
|
|
440
|
-
will-change: transform;
|
|
441
|
-
flex-direction: column;
|
|
442
|
-
width: 100%;
|
|
443
|
-
display: flex;
|
|
444
|
-
position: sticky;
|
|
445
|
-
top: 0;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
[data-file-tree-search-container] {
|
|
449
|
-
padding: 0;
|
|
450
|
-
padding-inline: var(--trees-padding-inline);
|
|
451
|
-
margin-bottom: var(--trees-item-row-gap);
|
|
452
|
-
display: flex;
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
[data-file-tree-search-input] {
|
|
456
|
-
--trees-focus-ring-width: 2px;
|
|
457
|
-
font-family: var(--trees-font-family);
|
|
458
|
-
font-size: var(--trees-font-size);
|
|
459
|
-
height: var(--trees-row-height);
|
|
460
|
-
padding-inline: var(--trees-item-padding-x);
|
|
461
|
-
line-height: var(--trees-row-height);
|
|
462
|
-
color: var(--trees-search-fg);
|
|
463
|
-
background-color: var(--trees-search-bg);
|
|
464
|
-
border: 1px solid var(--trees-border-color);
|
|
465
|
-
border-radius: var(--trees-border-radius);
|
|
466
|
-
outline: none;
|
|
467
|
-
flex: 1;
|
|
468
|
-
margin-block: 1px;
|
|
469
|
-
|
|
470
|
-
&::placeholder {
|
|
471
|
-
color: color-mix(in lab,
|
|
472
|
-
var(--trees-search-fg) 65%,
|
|
473
|
-
var(--trees-search-bg));
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
&:focus-visible, &[data-file-tree-search-input-fake-focus="true"] {
|
|
477
|
-
outline: var(--trees-focus-ring-width) solid var(--trees-focus-ring-color);
|
|
478
|
-
outline-offset: var(--trees-focus-ring-offset);
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
[role="tree"] {
|
|
483
|
-
gap: var(--trees-gap-override, 0);
|
|
484
|
-
flex-direction: column;
|
|
485
|
-
display: flex;
|
|
486
|
-
position: relative;
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
[data-type="item"] {
|
|
490
|
-
color: inherit;
|
|
491
|
-
font-family: var(--trees-font-family);
|
|
492
|
-
font-size: var(--trees-font-size);
|
|
493
|
-
text-align: start;
|
|
494
|
-
background-color: var(--trees-bg);
|
|
495
|
-
padding: 0 var(--trees-item-padding-x);
|
|
496
|
-
margin: 0 var(--trees-item-margin-x);
|
|
497
|
-
cursor: pointer;
|
|
498
|
-
user-select: none;
|
|
499
|
-
-webkit-touch-callout: none;
|
|
500
|
-
touch-action: manipulation;
|
|
501
|
-
flex: 0 0 var(--trees-row-height);
|
|
502
|
-
height: var(--trees-row-height);
|
|
503
|
-
line-height: var(--trees-row-height);
|
|
504
|
-
align-items: center;
|
|
505
|
-
gap: var(--trees-item-row-gap);
|
|
506
|
-
border-radius: var(--trees-border-radius);
|
|
507
|
-
--truncate-marker-background-color: var(--trees-bg);
|
|
508
|
-
--truncate-marker-background-overlay-color: transparent;
|
|
509
|
-
--truncate-marker-block-inset: 0px;
|
|
510
|
-
border: none;
|
|
511
|
-
outline: none;
|
|
512
|
-
display: flex;
|
|
513
|
-
position: relative;
|
|
514
|
-
|
|
515
|
-
&:hover, &[data-item-context-hover="true"] {
|
|
516
|
-
background-color: var(--trees-bg-muted);
|
|
517
|
-
--truncate-marker-background-overlay-color: var(--trees-bg-muted);
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
&[data-item-focused="true"], &:focus-visible {
|
|
521
|
-
z-index: 2;
|
|
522
|
-
|
|
523
|
-
& [data-item-flattened-subitems] {
|
|
524
|
-
--truncate-marker-block-inset: var(--trees-focus-ring-width);
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
&:before {
|
|
528
|
-
content: "";
|
|
529
|
-
border-radius: var(--trees-border-radius);
|
|
530
|
-
outline: var(--trees-focus-ring-width) solid
|
|
531
|
-
var(--trees-focus-ring-color);
|
|
532
|
-
outline-offset: var(--trees-focus-ring-offset);
|
|
533
|
-
pointer-events: none;
|
|
534
|
-
display: block;
|
|
535
|
-
position: absolute;
|
|
536
|
-
inset: 0;
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
&[data-item-selected="true"]:before {
|
|
540
|
-
outline-color: var(--trees-selected-focused-border-color);
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
&[data-item-selected="true"] {
|
|
545
|
-
color: var(--trees-selected-fg);
|
|
546
|
-
background-color: var(--trees-selected-bg);
|
|
547
|
-
--truncate-marker-background-overlay-color: var(--trees-selected-bg);
|
|
548
|
-
z-index: 3;
|
|
549
|
-
|
|
550
|
-
& [data-item-section="icon"] {
|
|
551
|
-
color: var(--trees-selected-fg);
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
&[data-item-search-match="true"] {
|
|
556
|
-
font-weight: var(--trees-search-font-weight);
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
[data-type="item"][data-file-tree-sticky-row="true"] {
|
|
561
|
-
pointer-events: auto;
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
[data-file-tree-virtualized-root="true"][data-is-scrolling] [data-type="item"][data-file-tree-sticky-row="true"] {
|
|
565
|
-
pointer-events: none;
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
[data-file-tree-virtualized-root="true"][data-is-scrolling] [data-type="item"][data-file-tree-sticky-row="true"]:hover:not([data-item-selected="true"]), [data-file-tree-virtualized-root="true"][data-is-scrolling] [data-type="item"][data-file-tree-sticky-row="true"][data-item-context-hover="true"]:not([data-item-selected="true"]) {
|
|
569
|
-
background-color: var(--trees-bg);
|
|
570
|
-
--truncate-marker-background-overlay-color: transparent;
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
[data-item-selected="true"]:has( + [data-item-selected="true"]) {
|
|
574
|
-
border-bottom-right-radius: 0;
|
|
575
|
-
border-bottom-left-radius: 0;
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
[data-item-selected="true"] + [data-item-selected="true"] {
|
|
579
|
-
border-top-left-radius: 0;
|
|
580
|
-
border-top-right-radius: 0;
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
[data-item-flattened-subitems] {
|
|
584
|
-
align-items: center;
|
|
585
|
-
gap: 2px;
|
|
586
|
-
display: inline-flex;
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
[data-item-flattened-subitem]:hover, [data-item-flattened-subitem-drag-target="true"] {
|
|
590
|
-
text-decoration: underline;
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
[data-item-section="icon"] {
|
|
594
|
-
color: var(--trees-fg-muted);
|
|
595
|
-
fill: currentColor;
|
|
596
|
-
width: var(--trees-icon-width);
|
|
597
|
-
flex-shrink: 0;
|
|
598
|
-
justify-content: center;
|
|
599
|
-
align-items: center;
|
|
600
|
-
display: flex;
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
:where([data-item-section="icon"] > [data-icon-token]) {
|
|
604
|
-
color: var(--trees-fg-muted);
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
[data-file-tree-colored-icons="true"] {
|
|
608
|
-
& [data-icon-token="astro"] {
|
|
609
|
-
color: var(--trees-file-icon-color-astro);
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
& [data-icon-token="babel"] {
|
|
613
|
-
color: var(--trees-file-icon-color-babel);
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
& [data-icon-token="bash"] {
|
|
617
|
-
color: var(--trees-file-icon-color-bash);
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
& [data-icon-token="biome"] {
|
|
621
|
-
color: var(--trees-file-icon-color-biome);
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
& [data-icon-token="bootstrap"] {
|
|
625
|
-
color: var(--trees-file-icon-color-bootstrap);
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
& [data-icon-token="browserslist"] {
|
|
629
|
-
color: var(--trees-file-icon-color-browserslist);
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
& [data-icon-token="bun"] {
|
|
633
|
-
color: var(--trees-file-icon-color-bun);
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
& [data-icon-token="c"] {
|
|
637
|
-
color: var(--trees-file-icon-color-c);
|
|
638
|
-
}
|
|
639
|
-
|
|
640
|
-
& [data-icon-token="cpp"] {
|
|
641
|
-
color: var(--trees-file-icon-color-cpp);
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
& [data-icon-token="claude"] {
|
|
645
|
-
color: var(--trees-file-icon-color-claude);
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
& [data-icon-token="css"] {
|
|
649
|
-
color: var(--trees-file-icon-color-css);
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
& [data-icon-token="database"] {
|
|
653
|
-
color: var(--trees-file-icon-color-database);
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
& [data-icon-token="default"] {
|
|
657
|
-
color: var(--trees-file-icon-color-default);
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
& [data-icon-token="docker"] {
|
|
661
|
-
color: var(--trees-file-icon-color-docker);
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
& [data-icon-token="eslint"] {
|
|
665
|
-
color: var(--trees-file-icon-color-eslint);
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
& [data-icon-token="git"] {
|
|
669
|
-
color: var(--trees-file-icon-color-git);
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
& [data-icon-token="go"] {
|
|
673
|
-
color: var(--trees-file-icon-color-go);
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
& [data-icon-token="graphql"] {
|
|
677
|
-
color: var(--trees-file-icon-color-graphql);
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
& [data-icon-token="html"] {
|
|
681
|
-
color: var(--trees-file-icon-color-html);
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
& [data-icon-token="image"] {
|
|
685
|
-
color: var(--trees-file-icon-color-image);
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
& [data-icon-token="javascript"] {
|
|
689
|
-
color: var(--trees-file-icon-color-javascript);
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
& [data-icon-token="json"] {
|
|
693
|
-
color: var(--trees-file-icon-color-json);
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
& [data-icon-token="markdown"] {
|
|
697
|
-
color: var(--trees-file-icon-color-markdown);
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
& [data-icon-token="mcp"] {
|
|
701
|
-
color: var(--trees-file-icon-color-mcp);
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
& [data-icon-token="npm"] {
|
|
705
|
-
color: var(--trees-file-icon-color-npm);
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
& [data-icon-token="oxc"] {
|
|
709
|
-
color: var(--trees-file-icon-color-oxc);
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
& [data-icon-token="postcss"] {
|
|
713
|
-
color: var(--trees-file-icon-color-postcss);
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
& [data-icon-token="prettier"] {
|
|
717
|
-
color: var(--trees-file-icon-color-prettier);
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
& [data-icon-token="python"] {
|
|
721
|
-
color: var(--trees-file-icon-color-python);
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
& [data-icon-token="react"] {
|
|
725
|
-
color: var(--trees-file-icon-color-react);
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
& [data-icon-token="ruby"] {
|
|
729
|
-
color: var(--trees-file-icon-color-ruby);
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
& [data-icon-token="rust"] {
|
|
733
|
-
color: var(--trees-file-icon-color-rust);
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
& [data-icon-token="sass"] {
|
|
737
|
-
color: var(--trees-file-icon-color-sass);
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
& [data-icon-token="svg"] {
|
|
741
|
-
color: var(--trees-file-icon-color-svg);
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
& [data-icon-token="svelte"] {
|
|
745
|
-
color: var(--trees-file-icon-color-svelte);
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
& [data-icon-token="svgo"] {
|
|
749
|
-
color: var(--trees-file-icon-color-svgo);
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
& [data-icon-token="swift"] {
|
|
753
|
-
color: var(--trees-file-icon-color-swift);
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
& [data-icon-token="table"] {
|
|
757
|
-
color: var(--trees-file-icon-color-table);
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
& [data-icon-token="text"] {
|
|
761
|
-
color: var(--trees-file-icon-color-text);
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
& [data-icon-token="tailwind"] {
|
|
765
|
-
color: var(--trees-file-icon-color-tailwind);
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
& [data-icon-token="terraform"] {
|
|
769
|
-
color: var(--trees-file-icon-color-terraform);
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
& [data-icon-token="typescript"] {
|
|
773
|
-
color: var(--trees-file-icon-color-typescript);
|
|
774
|
-
}
|
|
775
|
-
|
|
776
|
-
& [data-icon-token="vite"] {
|
|
777
|
-
color: var(--trees-file-icon-color-vite);
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
& [data-icon-token="vscode"] {
|
|
781
|
-
color: var(--trees-file-icon-color-vscode);
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
& [data-icon-token="vue"] {
|
|
785
|
-
color: var(--trees-file-icon-color-vue);
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
& [data-icon-token="wasm"] {
|
|
789
|
-
color: var(--trees-file-icon-color-wasm);
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
& [data-icon-token="webpack"] {
|
|
793
|
-
color: var(--trees-file-icon-color-webpack);
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
& [data-icon-token="yml"] {
|
|
797
|
-
color: var(--trees-file-icon-color-yml);
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
& [data-icon-token="zig"] {
|
|
801
|
-
color: var(--trees-file-icon-color-zig);
|
|
802
|
-
}
|
|
803
|
-
|
|
804
|
-
& [data-icon-token="zip"] {
|
|
805
|
-
color: var(--trees-file-icon-color-zip);
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
|
|
809
|
-
[data-icon-name="file-tree-icon-chevron"] {
|
|
810
|
-
&[data-align-capitals="false"] {
|
|
811
|
-
transform: translate(0, var(--trees-icon-nudge));
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
&[data-align-capitals="true"] {
|
|
815
|
-
transform: translate(0);
|
|
816
|
-
}
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
[data-item-section="content"] {
|
|
820
|
-
text-align: start;
|
|
821
|
-
text-overflow: ellipsis;
|
|
822
|
-
flex: 0 auto;
|
|
823
|
-
min-width: 0;
|
|
824
|
-
max-width: 100%;
|
|
825
|
-
overflow: hidden;
|
|
826
|
-
}
|
|
827
|
-
|
|
828
|
-
[data-item-section="decoration"] {
|
|
829
|
-
text-align: end;
|
|
830
|
-
min-width: 0;
|
|
831
|
-
color: var(--trees-fg-muted);
|
|
832
|
-
flex: 1 1 0;
|
|
833
|
-
justify-content: flex-end;
|
|
834
|
-
display: flex;
|
|
835
|
-
overflow: hidden;
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
[data-item-section="decoration"] > span {
|
|
839
|
-
text-overflow: ellipsis;
|
|
840
|
-
white-space: nowrap;
|
|
841
|
-
justify-content: flex-end;
|
|
842
|
-
align-items: center;
|
|
843
|
-
min-width: 0;
|
|
844
|
-
max-width: 100%;
|
|
845
|
-
display: inline-flex;
|
|
846
|
-
overflow: hidden;
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
[data-item-section="git"], [data-item-section="action"] {
|
|
850
|
-
flex: none;
|
|
851
|
-
justify-content: center;
|
|
852
|
-
align-items: center;
|
|
853
|
-
display: flex;
|
|
854
|
-
}
|
|
855
|
-
|
|
856
|
-
[data-item-section="git"] {
|
|
857
|
-
width: var(--trees-git-lane-width);
|
|
858
|
-
}
|
|
859
|
-
|
|
860
|
-
[data-item-section="action"] {
|
|
861
|
-
width: var(--trees-action-lane-width);
|
|
862
|
-
color: var(--trees-fg-muted);
|
|
863
|
-
fill: currentColor;
|
|
864
|
-
pointer-events: none;
|
|
865
|
-
}
|
|
866
|
-
|
|
867
|
-
[data-item-section="git"] > span, [data-item-section="action"] > span {
|
|
868
|
-
justify-content: center;
|
|
869
|
-
align-items: center;
|
|
870
|
-
width: 100%;
|
|
871
|
-
display: inline-flex;
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
[data-item-action-affordance="decorative"] {
|
|
875
|
-
opacity: .85;
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
[data-item-rename-input] {
|
|
879
|
-
appearance: none;
|
|
880
|
-
width: 100%;
|
|
881
|
-
min-width: 0;
|
|
882
|
-
height: calc(var(--trees-row-height) - 4px);
|
|
883
|
-
font-family: inherit;
|
|
884
|
-
font-size: inherit;
|
|
885
|
-
color: inherit;
|
|
886
|
-
box-sizing: border-box;
|
|
887
|
-
background-color: #0000;
|
|
888
|
-
border: 0;
|
|
889
|
-
outline: none;
|
|
890
|
-
padding-inline: 6px;
|
|
891
|
-
}
|
|
892
|
-
|
|
893
|
-
[data-item-section="content"]:has([data-item-rename-input]) ~ [data-item-section="action"], [data-item-section="content"]:has([data-item-rename-input]) ~ [data-item-section="decoration"] {
|
|
894
|
-
display: none;
|
|
895
|
-
}
|
|
896
|
-
|
|
897
|
-
[aria-expanded="false"][data-item-type="folder"] > [data-item-section="icon"] > [data-icon-name="file-tree-icon-chevron"] {
|
|
898
|
-
&[data-align-capitals="true"] {
|
|
899
|
-
transform: rotate(-90deg)
|
|
900
|
-
translate(calc(var(--trees-icon-nudge) / 2),
|
|
901
|
-
calc(var(--trees-icon-nudge) / 2));
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
&[data-align-capitals="false"] {
|
|
905
|
-
transform: rotate(-90deg)
|
|
906
|
-
translate(calc(var(--trees-icon-nudge) / 2 * -1),
|
|
907
|
-
calc(var(--trees-icon-nudge) / 2));
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
[data-item-section="spacing"] {
|
|
912
|
-
height: var(--trees-row-height);
|
|
913
|
-
padding-left: calc(calc(var(--trees-icon-width) / 2) - .5px);
|
|
914
|
-
flex-direction: row;
|
|
915
|
-
justify-content: center;
|
|
916
|
-
align-items: center;
|
|
917
|
-
display: flex;
|
|
918
|
-
|
|
919
|
-
&:empty {
|
|
920
|
-
padding-left: 0;
|
|
921
|
-
}
|
|
922
|
-
}
|
|
923
|
-
|
|
924
|
-
[data-item-section="spacing-item"] {
|
|
925
|
-
border-left: 1px solid var(--trees-indent-guide-bg);
|
|
926
|
-
height: 100%;
|
|
927
|
-
margin-right: calc(var(--trees-level-gap) - 1px);
|
|
928
|
-
opacity: 0;
|
|
929
|
-
transition: opacity .15s;
|
|
930
|
-
display: inline-block;
|
|
931
|
-
transform: translateX(-.25px);
|
|
932
|
-
|
|
933
|
-
& + & {
|
|
934
|
-
margin-left: calc(var(--trees-item-row-gap) + calc(var(--trees-icon-width) / 2) - .5px);
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
:host(:hover) [data-item-section="spacing-item"] {
|
|
939
|
-
opacity: .75;
|
|
940
|
-
}
|
|
941
|
-
|
|
942
|
-
[data-item-contains-git-change="true"] > [data-item-section="git"] {
|
|
943
|
-
color: var(--trees-git-modified-color);
|
|
944
|
-
opacity: .5;
|
|
945
|
-
fill: currentColor;
|
|
946
|
-
}
|
|
947
|
-
|
|
948
|
-
[data-item-git-status] {
|
|
949
|
-
& > :where([data-item-section="icon"]) > :where(:not([data-icon-name="file-tree-icon-chevron"])), & > [data-item-section="content"] {
|
|
950
|
-
color: var(--trees-item-git-status-color);
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
& > [data-item-section="git"] {
|
|
954
|
-
color: var(--trees-item-git-status-color);
|
|
955
|
-
font-weight: var(--trees-font-weight-semibold);
|
|
956
|
-
}
|
|
957
|
-
}
|
|
958
|
-
|
|
959
|
-
[data-item-git-status="added"] {
|
|
960
|
-
--trees-item-git-status-color: var(--trees-git-added-color);
|
|
961
|
-
}
|
|
962
|
-
|
|
963
|
-
[data-item-git-status="deleted"] {
|
|
964
|
-
--trees-item-git-status-color: var(--trees-git-deleted-color);
|
|
965
|
-
}
|
|
966
|
-
|
|
967
|
-
[data-item-git-status="ignored"] {
|
|
968
|
-
--trees-item-git-status-color: var(--trees-git-ignored-color);
|
|
969
|
-
|
|
970
|
-
& > [data-item-section="icon"] {
|
|
971
|
-
opacity: .5;
|
|
972
|
-
}
|
|
973
|
-
}
|
|
974
|
-
|
|
975
|
-
[data-item-section="git"] [data-icon-name="file-tree-icon-dot"] {
|
|
976
|
-
transform: translateY(calc(.65ex - 50%));
|
|
977
|
-
}
|
|
978
|
-
|
|
979
|
-
[data-item-git-status="modified"] {
|
|
980
|
-
--trees-item-git-status-color: var(--trees-git-modified-color);
|
|
981
|
-
}
|
|
982
|
-
|
|
983
|
-
[data-item-git-status="renamed"] {
|
|
984
|
-
--trees-item-git-status-color: var(--trees-git-renamed-color);
|
|
985
|
-
}
|
|
986
|
-
|
|
987
|
-
[data-item-git-status="untracked"] {
|
|
988
|
-
--trees-item-git-status-color: var(--trees-git-untracked-color);
|
|
989
|
-
}
|
|
990
|
-
|
|
991
|
-
[data-item-drag-target="true"] {
|
|
992
|
-
background-color: var(--trees-selected-bg);
|
|
993
|
-
}
|
|
994
|
-
|
|
995
|
-
[data-item-dragging="true"] {
|
|
996
|
-
opacity: .5;
|
|
997
|
-
}
|
|
998
|
-
|
|
999
|
-
[data-item-section="lock"] {
|
|
1000
|
-
color: var(--trees-fg-muted);
|
|
1001
|
-
flex: none;
|
|
1002
|
-
align-items: center;
|
|
1003
|
-
margin-left: auto;
|
|
1004
|
-
display: flex;
|
|
1005
|
-
}
|
|
1006
|
-
|
|
1007
|
-
[data-item-section="lock"] svg {
|
|
1008
|
-
display: block;
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
|
-
[data-type="header-slot"] {
|
|
1012
|
-
flex: none;
|
|
1013
|
-
display: block;
|
|
1014
|
-
}
|
|
1015
|
-
|
|
1016
|
-
[data-type="context-menu-wash"] {
|
|
1017
|
-
z-index: 3;
|
|
1018
|
-
touch-action: none;
|
|
1019
|
-
background-color: #0000;
|
|
1020
|
-
position: absolute;
|
|
1021
|
-
inset: 0;
|
|
1022
|
-
}
|
|
1023
|
-
|
|
1024
|
-
[data-type="context-menu-anchor"] {
|
|
1025
|
-
top: 0;
|
|
1026
|
-
right: var(--trees-context-menu-trigger-inline-offset);
|
|
1027
|
-
z-index: 4;
|
|
1028
|
-
align-items: center;
|
|
1029
|
-
display: none;
|
|
1030
|
-
position: absolute;
|
|
1031
|
-
|
|
1032
|
-
&[data-visible="true"] {
|
|
1033
|
-
display: flex;
|
|
1034
|
-
}
|
|
1035
|
-
}
|
|
1036
|
-
|
|
1037
|
-
[data-file-tree-virtualized-root="true"][data-is-scrolling] [data-type="context-menu-anchor"] {
|
|
1038
|
-
display: none;
|
|
1039
|
-
}
|
|
1040
|
-
|
|
1041
|
-
[data-type="context-menu-anchor"] > slot[name="context-menu"] {
|
|
1042
|
-
flex: 0 0 0;
|
|
1043
|
-
width: 0;
|
|
1044
|
-
min-width: 0;
|
|
1045
|
-
display: block;
|
|
1046
|
-
overflow: visible;
|
|
1047
|
-
}
|
|
1048
|
-
|
|
1049
|
-
[data-type="context-menu-trigger"] {
|
|
1050
|
-
all: unset;
|
|
1051
|
-
width: var(--trees-action-lane-width);
|
|
1052
|
-
color: var(--trees-fg-muted);
|
|
1053
|
-
fill: currentColor;
|
|
1054
|
-
cursor: pointer;
|
|
1055
|
-
font-family: var(--trees-font-family);
|
|
1056
|
-
font-size: var(--trees-font-size);
|
|
1057
|
-
border-top-right-radius: var(--trees-border-radius);
|
|
1058
|
-
border-bottom-right-radius: var(--trees-border-radius);
|
|
1059
|
-
margin: var(--trees-focus-ring-width);
|
|
1060
|
-
height: calc(var(--trees-row-height) - var(--trees-focus-ring-width) * 2);
|
|
1061
|
-
border-width: 0;
|
|
1062
|
-
justify-content: center;
|
|
1063
|
-
align-items: center;
|
|
1064
|
-
transition: color .12s;
|
|
1065
|
-
display: flex;
|
|
1066
|
-
}
|
|
1067
|
-
|
|
1068
|
-
[data-type="context-menu-trigger"]:hover, [data-type="context-menu-trigger"][aria-expanded="true"] {
|
|
1069
|
-
color: var(--trees-fg);
|
|
1070
|
-
}
|
|
1071
|
-
|
|
1072
|
-
[data-truncate-container] {
|
|
1073
|
-
--truncate-internal-marker-fade-width: var(--truncate-marker-fade-width, 2px);
|
|
1074
|
-
--truncate-internal-marker-gap: var(--truncate-marker-gap, 0px);
|
|
1075
|
-
--truncate-internal-marker-opacity: var(--truncate-marker-opacity, 50%);
|
|
1076
|
-
--truncate-internal-middle-marker-opacity: var(--truncate-middle-marker-opacity, 80%);
|
|
1077
|
-
--truncate-internal-marker-background-color: var(--truncate-marker-background-color, light-dark(#fff, #000));
|
|
1078
|
-
--truncate-internal-marker-background-overlay-color: var(--truncate-marker-background-overlay-color, transparent);
|
|
1079
|
-
--truncate-internal-marker-block-inset: var(--truncate-marker-block-inset, 0px);
|
|
1080
|
-
--truncate-internal-marker-fade-out-duration: var(--truncate-marker-fade-out-duration, 0s);
|
|
1081
|
-
--truncate-internal-marker-fade-in-duration: var(--truncate-marker-fade-in-duration, .1s);
|
|
1082
|
-
--truncate-internal-fade-marker-color: var(--truncate-fade-marker-color, #000);
|
|
1083
|
-
--truncate-internal-fade-marker-width: var(--truncate-fade-marker-width, .2lh);
|
|
1084
|
-
--truncate-internal-single-line-height: 1lh;
|
|
1085
|
-
height: var(--truncate-internal-single-line-height);
|
|
1086
|
-
min-width: 0;
|
|
1087
|
-
margin-top: -1px;
|
|
1088
|
-
margin-bottom: -1px;
|
|
1089
|
-
overflow: hidden;
|
|
1090
|
-
}
|
|
1091
|
-
|
|
1092
|
-
[data-truncate-marker] {
|
|
1093
|
-
height: var(--truncate-internal-single-line-height);
|
|
1094
|
-
padding-block: var(--truncate-internal-marker-block-inset);
|
|
1095
|
-
box-sizing: border-box;
|
|
1096
|
-
z-index: 2;
|
|
1097
|
-
color: color-mix(in srgb,
|
|
1098
|
-
currentColor var(--truncate-internal-marker-opacity),
|
|
1099
|
-
transparent);
|
|
1100
|
-
opacity: 0;
|
|
1101
|
-
transition: opacity var(--truncate-internal-marker-fade-out-duration)
|
|
1102
|
-
ease-in-out;
|
|
1103
|
-
background-clip: content-box;
|
|
1104
|
-
align-items: center;
|
|
1105
|
-
display: flex;
|
|
1106
|
-
position: absolute;
|
|
1107
|
-
}
|
|
1108
|
-
|
|
1109
|
-
@container measure (height > 1lh) {
|
|
1110
|
-
[data-truncate-marker] {
|
|
1111
|
-
opacity: 1;
|
|
1112
|
-
transition: opacity var(--truncate-internal-marker-fade-in-duration)
|
|
1113
|
-
ease-in-out;
|
|
1114
|
-
}
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
[data-truncate-grid] {
|
|
1118
|
-
display: grid;
|
|
1119
|
-
position: relative;
|
|
1120
|
-
}
|
|
1121
|
-
|
|
1122
|
-
[data-truncate-content="visible"] {
|
|
1123
|
-
white-space: nowrap;
|
|
1124
|
-
}
|
|
1125
|
-
|
|
1126
|
-
[data-truncate-content="overflow"] {
|
|
1127
|
-
opacity: 0;
|
|
1128
|
-
pointer-events: none;
|
|
1129
|
-
user-select: none;
|
|
1130
|
-
word-break: break-all;
|
|
1131
|
-
margin-top: calc(-1 * var(--truncate-internal-single-line-height));
|
|
1132
|
-
}
|
|
1133
|
-
|
|
1134
|
-
[data-truncate-marker-cell] {
|
|
1135
|
-
user-select: none;
|
|
1136
|
-
pointer-events: none;
|
|
1137
|
-
overflow: visible;
|
|
1138
|
-
container: measure / size;
|
|
1139
|
-
}
|
|
1140
|
-
|
|
1141
|
-
[data-truncate-container="truncate"] {
|
|
1142
|
-
& [data-truncate-grid] {
|
|
1143
|
-
grid-template-columns: minmax(0, max-content) 0;
|
|
1144
|
-
}
|
|
1145
|
-
|
|
1146
|
-
& [data-truncate-marker] {
|
|
1147
|
-
right: 0;
|
|
1148
|
-
}
|
|
1149
|
-
|
|
1150
|
-
& [data-truncate-fade] {
|
|
1151
|
-
margin-right: calc(-2 * var(--truncate-internal-fade-marker-width));
|
|
1152
|
-
}
|
|
1153
|
-
}
|
|
1154
|
-
|
|
1155
|
-
[data-truncate-container="fruncate"] {
|
|
1156
|
-
& [data-truncate-grid] {
|
|
1157
|
-
grid-template-columns: 0 minmax(0, max-content) auto;
|
|
1158
|
-
}
|
|
1159
|
-
|
|
1160
|
-
& [data-truncate-content] {
|
|
1161
|
-
direction: rtl;
|
|
1162
|
-
}
|
|
1163
|
-
|
|
1164
|
-
& [data-truncate-content] > span {
|
|
1165
|
-
unicode-bidi: plaintext;
|
|
1166
|
-
}
|
|
1167
|
-
|
|
1168
|
-
& [data-truncate-fade] {
|
|
1169
|
-
margin-left: calc(-2 * var(--truncate-internal-fade-marker-width));
|
|
1170
|
-
}
|
|
1171
|
-
}
|
|
1172
|
-
|
|
1173
|
-
[data-truncate-variant="default"] {
|
|
1174
|
-
& [data-truncate-marker] {
|
|
1175
|
-
background-color: var(--truncate-internal-marker-background-color);
|
|
1176
|
-
background-image: linear-gradient(var(--truncate-internal-marker-background-overlay-color),
|
|
1177
|
-
var(--truncate-internal-marker-background-overlay-color));
|
|
1178
|
-
}
|
|
1179
|
-
|
|
1180
|
-
& [data-truncate-marker]:after, & [data-truncate-marker]:before {
|
|
1181
|
-
content: "";
|
|
1182
|
-
width: calc(var(--truncate-internal-marker-fade-width) +
|
|
1183
|
-
var(--truncate-internal-marker-gap));
|
|
1184
|
-
height: max(0px,
|
|
1185
|
-
calc(var(--truncate-internal-single-line-height) -
|
|
1186
|
-
var(--truncate-internal-marker-block-inset) * 2));
|
|
1187
|
-
background-color: var(--truncate-internal-marker-background-color);
|
|
1188
|
-
background-image: linear-gradient(var(--truncate-internal-marker-background-overlay-color),
|
|
1189
|
-
var(--truncate-internal-marker-background-overlay-color));
|
|
1190
|
-
-webkit-mask-image: linear-gradient(var(--truncate-internal-fade-dir),
|
|
1191
|
-
#000 0%,
|
|
1192
|
-
#000 var(--truncate-internal-marker-gap),
|
|
1193
|
-
transparent 100%);
|
|
1194
|
-
mask-image: linear-gradient(var(--truncate-internal-fade-dir),
|
|
1195
|
-
#000 0%,
|
|
1196
|
-
#000 var(--truncate-internal-marker-gap),
|
|
1197
|
-
transparent 100%);
|
|
1198
|
-
position: absolute;
|
|
1199
|
-
inset-block-start: var(--truncate-internal-marker-block-inset);
|
|
1200
|
-
}
|
|
1201
|
-
|
|
1202
|
-
& [data-truncate-marker]:after {
|
|
1203
|
-
--truncate-internal-fade-dir: to right;
|
|
1204
|
-
right: calc(-1 *
|
|
1205
|
-
(
|
|
1206
|
-
var(--truncate-internal-marker-fade-width) +
|
|
1207
|
-
var(--truncate-internal-marker-gap)
|
|
1208
|
-
));
|
|
1209
|
-
}
|
|
1210
|
-
|
|
1211
|
-
& [data-truncate-marker]:before {
|
|
1212
|
-
--truncate-internal-fade-dir: to left;
|
|
1213
|
-
left: calc(-1 *
|
|
1214
|
-
(
|
|
1215
|
-
var(--truncate-internal-marker-fade-width) +
|
|
1216
|
-
var(--truncate-internal-marker-gap)
|
|
1217
|
-
));
|
|
1218
|
-
}
|
|
1219
|
-
}
|
|
1220
|
-
|
|
1221
|
-
[data-truncate-variant="fade"] {
|
|
1222
|
-
& [data-truncate-marker] {
|
|
1223
|
-
background: none;
|
|
1224
|
-
}
|
|
1225
|
-
}
|
|
1226
|
-
|
|
1227
|
-
[data-truncate-fade] {
|
|
1228
|
-
box-shadow: 0 0 calc(var(--truncate-internal-fade-marker-width) / 2)
|
|
1229
|
-
var(--truncate-internal-fade-marker-color),
|
|
1230
|
-
0 0 var(--truncate-internal-fade-marker-width)
|
|
1231
|
-
var(--truncate-internal-fade-marker-color);
|
|
1232
|
-
width: calc(var(--truncate-internal-fade-marker-width) * 2);
|
|
1233
|
-
height: calc(var(--truncate-internal-single-line-height) -
|
|
1234
|
-
(var(--truncate-internal-fade-marker-width) * 2));
|
|
1235
|
-
margin: var(--truncate-internal-fade-marker-width) 0;
|
|
1236
|
-
}
|
|
1237
|
-
|
|
1238
|
-
[data-truncate-group-container="middle"] {
|
|
1239
|
-
& [data-truncate-container] {
|
|
1240
|
-
--truncate-marker-opacity: var(--truncate-internal-middle-marker-opacity);
|
|
1241
|
-
}
|
|
1242
|
-
|
|
1243
|
-
min-width: 0;
|
|
1244
|
-
display: flex;
|
|
1245
|
-
|
|
1246
|
-
& > div {
|
|
1247
|
-
min-width: 0;
|
|
1248
|
-
}
|
|
1249
|
-
|
|
1250
|
-
& > div[data-truncate-segment-priority="1"] {
|
|
1251
|
-
flex: 0 1 max-content;
|
|
1252
|
-
}
|
|
1253
|
-
|
|
1254
|
-
& > div[data-truncate-segment-priority="2"] {
|
|
1255
|
-
flex: 0 999999 max-content;
|
|
1256
|
-
}
|
|
1257
|
-
}
|
|
1258
|
-
}
|
|
1259
|
-
|
|
1260
|
-
@layer theme, unsafe;
|
|
1261
|
-
`,zx=`@layer base, unsafe;`;function Bx(e){return`${zx}
|
|
1262
|
-
@layer base {
|
|
1263
|
-
${e}
|
|
1264
|
-
}`}function Vx(e){return`${zx}
|
|
1265
|
-
@layer unsafe {
|
|
1266
|
-
${e}
|
|
1267
|
-
}`}var Hx=new WeakMap;function Ux(e){let t=Hx.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(cb,`true`);let r=document.createElement(`div`);r.style.position=`relative`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n);let i=Math.max(n.offsetWidth-n.clientWidth,0);return n.remove(),Hx.set(e,i),i}function Wx(e,t){if(!e.isConnected)return;let n=Ux(t);if(n==null)return;let r=t.querySelector(`style[${lb}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(lb,``),t.appendChild(i)),i.textContent=`:host { ${ub}: ${n}px; }`}var Gx;function Kx(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){Gx??(Gx=new CSSStyleSheet,Gx.replaceSync(Bx(Rx)));let t=!1;try{e.adoptedStyleSheets=[Gx],t=!0}catch{}if(t){e.querySelector(`style[${ob}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(ob,``),t.textContent=Bx(Rx),e.prepend(t)}}function qx(e,t){Jx(e,t),Kx(t),Wx(e,t)}function Jx(e,t){let n=e.querySelector(`template[shadowrootmode="open"], template[data-file-tree-shadowrootmode="open"]`);n instanceof HTMLTemplateElement&&(t.childNodes.length>0||(t.appendChild(n.content.cloneNode(!0)),n.hasAttribute(`shadowrootmode`)&&n.remove()))}if(typeof HTMLElement<`u`&&customElements.get(`file-tree-container`)==null){class e extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.shadowRoot??this.attachShadow({mode:`open`});qx(this,e)}}if(customElements.define(ab,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(ab)))e instanceof HTMLElement&&qx(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var Yx=5,Xx=32,Zx=128;function Qx(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function $x(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function eS(e,t){if(t.childIdByNameId!=null)return t.childIdByNameId;let n=new Map;for(let r of t.childIds){let t=e[r];t!=null&&n.set(t.nameId,r)}return t.childIdByNameId=n,n}function tS(e){if(e.childPositionById!=null)return e.childPositionById;let t=new Map;for(let n=0;n<e.childIds.length;n++){let r=e.childIds[n];r!=null&&t.set(r,n)}return e.childPositionById=t,t}function nS(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function rS(e,t){if(e.childPositionById!=null)for(let n=t;n<e.childIds.length;n++){let t=e.childIds[n];t!=null&&e.childPositionById.set(t,n)}}function iS(e,t){let n=0,r=0;for(let i of t.childIds){let t=e[i];t!=null&&(n+=t.subtreeNodeCount,r+=t.visibleSubtreeCount)}t.totalChildSubtreeNodeCount=n,t.totalChildVisibleSubtreeCount=r,cS(e,t)}function aS(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=tS(e).get(t);if(i===void 0)return;let a=i>>Yx;e.childVisibleChunkSums[a]+=r}function oS(e,t,n){let r=t.childVisibleChunkSums;if(r!=null){let i=n,a=0;for(let o of r){if(i<o){let r=lS(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=Xx}throw Error(`Visible child index ${String(n)} is out of range`)}let i=n;for(let r=0;r<t.childIds.length;r++){let a=t.childIds[r];if(a==null)continue;let o=e[a];if(o!=null){if(i<o.visibleSubtreeCount)return{childIndex:r,childVisibleIndex:n-i,localVisibleIndex:i};i-=o.visibleSubtreeCount}}throw Error(`Visible child index ${String(n)} is out of range`)}function sS(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>Yx;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<Yx}for(let i=a;i<n;i+=1){let n=t.childIds[i];if(n==null)continue;let a=e[n];a!=null&&(r+=a.visibleSubtreeCount)}return r}function cS(e,t){if(t.childIds.length<Zx){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/Xx),r=new Int32Array(n);for(let n=0;n<t.childIds.length;n++){let i=t.childIds[n];if(i==null)continue;let a=e[i];a!=null&&(r[n>>Yx]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function lS(e,t,n,r){let i=Math.min(t.childIds.length,n+Xx),a=r;for(let r=n;r<i;r++){let n=t.childIds[r];if(n==null)continue;let i=e[n];if(i!=null){if(a<i.visibleSubtreeCount)return{childIndex:r,localVisibleIndex:a};a-=i.visibleSubtreeCount}}throw Error(`Visible child index ${String(r)} is out of range`)}var uS=7,dS=3,fS=8,pS=4;function mS(e,t,n=0){return e<<pS|n<<dS|t}function hS(e){return e.depthAndFlags>>>pS}function gS(e){return(e.depthAndFlags&fS)>>dS}function Y(e){return(e.depthAndFlags&fS)!==0}function _S(e){return e.depthAndFlags&uS}function vS(e,t){return(_S(e)&t)!==0}function yS(e,t){e.depthAndFlags|=t}function bS(e,t){e.depthAndFlags=mS(t,_S(e),gS(e))}var xS=Symbol(`benchmarkInstrumentation`);function SS(e,t){return t==null||Object.defineProperty(e,xS,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function CS(e){return e==null?null:e[xS]??null}function X(e,t,n){return e==null?n():e.measurePhase(t,n)}function wS(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function TS(e){return e>=48&&e<=57}function ES(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!TS(e.charCodeAt(r));)r+=1;if(r>=e.length)break;r>n&&t.push(e.slice(n,r));let i=0;for(;r<e.length&&TS(e.charCodeAt(r));)i=i*10+(e.charCodeAt(r)-48),r+=1;t.push(i),n=r}return(n<e.length||t.length===0)&&t.push(e.slice(n)),t}function DS(e){let t=e.toLowerCase();return{lowerValue:t,tokens:ES(t)}}function OS(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let n=e[r],i=t[r];if(n===i)continue;if(typeof n==`number`&&typeof i==`number`)return n<i?-1:1;let a=String(n),o=String(i);if(a!==o)return a<o?-1:1}return e.length===t.length?0:e.length<t.length?-1:1}function kS(e,t){if(e.tokens.length===1&&t.tokens.length===1&&typeof e.tokens[0]==`string`&&typeof t.tokens[0]==`string`)return e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1;let n=OS(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function AS(e,t,n){let r=kS(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function jS(e,t){return AS(e,t,DS)}function MS(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function NS(e,t){let n=Math.min(e.segments.length,t.segments.length);for(let r=0;r<n;r++){let n=e.segments[r],i=t.segments[r];if(n===i)continue;let a=MS(e,r);return a===MS(t,r)?jS(n,i):a===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function PS(e,t){return NS(e,t)}function FS(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=DS(e);return n.set(e,r),r},i=Math.min(e.segments.length,t.segments.length);for(let n=0;n<i;n++){let i=e.segments[n],a=t.segments[n];if(i===a)continue;let o=MS(e,n);return o===MS(t,n)?AS(i,a,r):o===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function IS(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=DS(r);return e.sortKeyById[t]=i,i}function LS(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function RS(e){let t=e.length>0&&e.charCodeAt(e.length-1)===47,n=t?e.length-1:e.length,r=[],i=0;for(let t=0;t<n;t++)e.charCodeAt(t)===47&&(r.push(e.slice(i,t)),i=t+1);return r.push(e.slice(i,n)),{hasTrailingSlash:t,segments:r}}function zS(e){let{hasTrailingSlash:t,segments:n}=RS(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function BS(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=RS(e);return{requiresDirectory:t,segments:n}}function VS(){let e=new Map;return e.set(``,0),{idByValue:e,valueById:[``],sortKeyById:[DS(``)]}}function HS(e,t){let n=e.idByValue.get(t);if(n!==void 0)return n;let r=e.valueById.length;return e.idByValue.set(t,r),e.valueById.push(t),r}function US(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var WS=Symbol(`pathStorePreparedInputKind`);function GS(e,t){return e[WS]=t,e}function KS(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function qS(e,t,n){return n==="default"?PS(e,t):n(KS(e),KS(t))}function JS(){return{depthAndFlags:mS(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function YS(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return r;return n}function XS(e){return e.isDirectory?e.segments.length:e.segments.length-1}function ZS(e){return Array.isArray(e)&&e.every(e=>typeof e==`object`&&!!e&&typeof e.path==`string`&&Array.isArray(e.segments)&&typeof e.basename==`string`&&typeof e.isDirectory==`boolean`)}function QS(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function $S(e,t={}){return aC(e,t).map(e=>e.path)}function eC(e,t={}){let n=aC(e,t);return GS({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function tC(e){let t=e.length,n=!1;for(let r=0;r<t;r+=1){let t=e[r];if(t.length>0&&t.charCodeAt(t.length-1)===47){n=!0;break}}return GS({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function nC(e){let t=e,n=t.preparedPaths;if(t[WS]===`prepared`&&n!=null)return n;if(!ZS(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function rC(e){let t=e;return t[WS]===`presorted`&&t.presortedPaths!=null||QS(t.presortedPaths)?t.presortedPaths:null}function iC(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function aC(e,t={}){let n=LS(t),r=CS(t);wS(r,`workload.inputFiles`,e.length);let i=X(r,`store.preparePathEntries.parse`,()=>e.map(e=>zS(e)));return X(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>qS(e,t,n.sort))),i}var oC=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[JS()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=VS();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=CS(e),this.options=LS(e);let t=e.initialExpandedPaths??null;if(t==null||t.length===0)this.initialExpandedPathSet=null;else{let e=new Set,n=t.length;for(let r=0;r<n;r+=1){let n=t[r],i=n.length;e.add(i>0&&n.charCodeAt(i-1)===47?n.slice(0,i-1):n)}this.initialExpandedPathSet=e,this.createdDirectoriesAllExpanded=!0}this.directories.set(0,Qx())}appendPaths(e){return X(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>zS(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,X(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return X(this.instrumentation,`store.builder.appendPresortedPaths`,()=>{if(t===!1){this.appendPresortedFilePaths(e);return}this.createdDirectoriesAllExpanded=!1;let n=null,r=0,i=this.nodes,a=this.segmentTable,o=a.idByValue,s=a.valueById,c=this.directoryStack,l=0,u=``,d=0;for(let t of e){if(n===t)throw Error(`Duplicate path: "${t}"`);let e=t.length>0&&t.charCodeAt(t.length-1)===47,a=e?t.length-1:t.length,f=0,p=0;if(n!=null){if(u.length>0&&t.length>u.length&&t.startsWith(u))f=d,p=u.length;else{let r=Math.min(a,n.length),i=!0;for(let e=0;e<r;e++){let r=t.charCodeAt(e);if(r!==n.charCodeAt(e)){i=!1;break}r===47&&(f++,p=e+1)}i&&e&&r===a&&n.length>a&&n.charCodeAt(a)===47&&(f++,p=a+1)}}l=f,r=f;let m=p,h=t.indexOf(`/`,m);for(;h>=0&&h<a;){let e=c[l];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);r++;let n=t.slice(m,h),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n));let u=i.length;i.push({depthAndFlags:mS(r,0,1),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(t.slice(0,h)),l++,c[l]=u,m=h+1,h=t.indexOf(`/`,m)}if(e){if(m<a){let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory parent for "${t}"`);r++;let n=t.slice(m,a),u=o.get(n);u===void 0&&(u=s.length,o.set(n,u),s.push(n));let d=i.length;i.push({depthAndFlags:mS(r,0,1),nameId:u,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),l++,c[l]=d,m=a+1}let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory node for "${t}"`);this.promoteDirectoryToExplicit(e,t)}else{let e=c[l];if(e===void 0)throw Error(`Unable to resolve file parent for "${t}"`);let n=t.slice(m),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n)),i.push({depthAndFlags:mS(r+1,0),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1})}m!==u.length&&(u=t.substring(0,m),d=r),n=t}c.length=l+1,n!=null&&(this.lastPreparedPath=zS(n)),this.hasDeferredDirectoryIndexes=!0}),this}appendPresortedFilePaths(e){let t=null,n=0,r=this.nodes,i=this.segmentTable,a=i.idByValue,o=i.valueById,s=this.directoryStack,c=0,l=``,u=0;for(let i of e){if(t===i)throw Error(`Duplicate path: "${i}"`);let e=i.length,d=0,f=0;if(t!=null){if(l.length>0&&i.length>l.length&&i.startsWith(l))d=u,f=l.length;else{let n=Math.min(e,t.length);for(let e=0;e<n;e++){let n=i.charCodeAt(e);if(n!==t.charCodeAt(e))break;n===47&&(d++,f=e+1)}}}c=d,n=d;let p=f,m=i.indexOf(`/`,p);for(;m>=0;){let e=s[c];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);n++;let t=i.slice(p,m),l=a.get(t);l===void 0&&(l=o.length,a.set(t,l),o.push(t));let u=r.length;r.push({depthAndFlags:mS(n,0,1),nameId:l,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(i.slice(0,m)),this.presortedDirectoryNodeIds.push(u),c++,s[c]=u,p=m+1,m=i.indexOf(`/`,p)}let h=s[c];if(h===void 0)throw Error(`Unable to resolve file parent for "${i}"`);let g=i.slice(p),_=a.get(g);_===void 0&&(_=o.length,a.set(g,_),o.push(g)),r.push({depthAndFlags:mS(n+1,0),nameId:_,parentId:h,subtreeNodeCount:1,visibleSubtreeCount:1}),p!==l.length&&(l=i.substring(0,p),u=n),t=i}s.length=c+1,t!=null&&(this.lastPreparedPath=zS(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(X(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||X(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&&this.initialExpandedPathSet!=null&&this.createdDirectoryCount===this.initialExpandedPathSet.size}appendPreparedPath(e,t){if(this.hasDeferredDirectoryIndexes&&=(this.buildDirectoryIndexes(),!1),this.lastPreparedPath!=null){if(e.path===this.lastPreparedPath.path)throw Error(`Duplicate path: "${e.path}"`);if(t&&(this.options.sort==="default"?FS(this.lastPreparedPath,e,this.segmentSortKeyCache):qS(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=XS(e),i=n==null?0:XS(n),a=n==null?0:YS(n.segments,e.segments),o=Math.min(a,r,i);this.directoryStack.length=o+1;for(let n=o;n<r;n++){let r=this.directoryStack[this.directoryStack.length-1];if(r===void 0)throw Error(`Directory stack underflow while building the path store`);let i=t?this.getOrCreateDirectoryChild(r,e.segments[n]):this.createDirectoryChild(r,e.segments[n]);this.directoryStack.push(i)}if(e.isDirectory){let t=this.directoryStack[this.directoryStack.length-1];if(t===void 0)throw Error(`Unable to resolve directory node for "${e.path}"`);this.promoteDirectoryToExplicit(t,e.path),this.lastPreparedPath=e;return}let s=this.directoryStack[this.directoryStack.length-1];if(s===void 0)throw Error(`Unable to resolve file parent for "${e.path}"`);t?this.createFileChild(s,e.basename,e.path):this.createFileChildUnchecked(s,e.basename),this.lastPreparedPath=e}recordCreatedDirectoryPath(e){!this.createdDirectoriesAllExpanded||this.initialExpandedPathSet==null||(this.createdDirectoryCount+=1,this.initialExpandedPathSet.has(e)||(this.createdDirectoriesAllExpanded=!1))}createFileChild(e,t,n){let r=HS(this.segmentTable,t),i=this.getDirectoryIndex(e),a=i.childIdByNameId;if(a!=null&&a.get(r)!==void 0)throw Error(`Path collides with an existing entry: "${n}"`);let o=this.nodes[e];if(o===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let s=this.nodes.length;return this.nodes.push({depthAndFlags:mS(hS(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),nS(i,s),s}createFileChildUnchecked(e,t){let n=HS(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:mS(hS(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),nS(r,a),a}getOrCreateDirectoryChild(e,t){let n=HS(this.segmentTable,t),r=this.getDirectoryIndex(e);if(r.childIdByNameId!=null){let e=r.childIdByNameId.get(n);if(e!==void 0){let n=this.nodes[e];if(n!=null&&!Y(n))throw Error(`Path collides with an existing file while creating directory "${t}"`);return e}}let i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:mS(hS(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),nS(r,a),this.directories.set(a,Qx()),a}createDirectoryChild(e,t){let n=HS(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:mS(hS(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),nS(r,a),this.directories.set(a,Qx()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!Y(n))throw Error(`Path is not a directory: "${t}"`);if(vS(n,1))throw Error(`Duplicate path: "${t}"`);yS(n,1)}getDirectoryIndex(e){let t=this.directories.get(e);if(t!==void 0)return t;throw Error(`Unknown directory child index for node ${String(e)}`)}buildPresortedFinish(e){let t=this.nodes,n=this.directories;n.set(0,$x());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(Y(a)){let t=$x();n.set(e,t),r=e,i=t}let o;a.parentId===r?o=i:(o=n.get(a.parentId),r=a.parentId,i=o??null),o?.childIds.push(e)}if(!e)for(let e=t.length-1;e>=1;e--){let n=t[e];if(n==null)continue;let r=t[n.parentId];r!=null&&(r.subtreeNodeCount+=n.subtreeNodeCount,r.visibleSubtreeCount+=n.visibleSubtreeCount)}}buildDirectoryIndexes(){let e=this.nodes;for(let t=1;t<e.length;t++){let n=e[t];if(n==null)continue;Y(n)&&this.directories.set(t,Qx());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),nS(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!Y(t))return t.subtreeNodeCount=1,t.visibleSubtreeCount=1,1;let n=this.getDirectoryIndex(e),r=1;for(let e of n.childIds)r+=this.computeSubtreeCounts(e);return iS(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function sC(e,t=`closed`,n=null){let r=lC(t);return{activeNodeCount:e.nodes.length-1,collapsedDirectoryIds:new Set,collapseNewDirectoriesByDefault:!1,defaultExpansion:r,directoriesOpenByDefault:r===`open`,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 cC(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function lC(e){if(typeof e!=`number`)return e;if(!Number.isInteger(e)||e<0)throw Error(`initialExpansion must be "open", "closed", or a non-negative integer depth. Received: ${String(e)}`);return e}function uC(e,t){return vS(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion!==`closed`&&hS(t)<=e.defaultExpansion}function dC(e,t,n=e.snapshot.nodes[t]){return n==null||!Y(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:uC(e,n)}function fC(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!Y(r))return;let i=uC(e,r);if(n){if(i){e.collapsedDirectoryIds.delete(t),e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0;return}e.expandedDirectoryIds.add(t);return}if(i){e.collapsedDirectoryIds.add(t),e.hasCollapsedDirectoryOverrides=!0;return}e.expandedDirectoryIds.delete(t)}function pC(e,t){let n=e.directoryLoadInfoById.get(t);if(n!=null)return n;let r={activeAttemptId:null,errorMessage:null,nextAttemptId:1,state:`loaded`};return e.directoryLoadInfoById.set(t,r),r}function mC(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function hC(e,t){let n=pC(e,t);if(n.state===`loading`&&n.activeAttemptId!=null)return{attemptId:n.activeAttemptId,nodeId:t,reused:!0};let r=n.nextAttemptId;return n.activeAttemptId=r,n.errorMessage=null,n.nextAttemptId+=1,n.state=`loading`,{attemptId:r,nodeId:t,reused:!1}}function gC(e,t){let n=pC(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function _C(e,t,n){let r=e.directoryLoadInfoById.get(t);return r==null||r.activeAttemptId!==n?!1:(r.activeAttemptId=null,r.errorMessage=null,r.state=`loaded`,!0)}function vC(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function yC(e,t,n,r){let i=e.directoryLoadInfoById.get(t);return i==null||i.activeAttemptId!==n?!1:(i.activeAttemptId=null,i.errorMessage=r??null,i.state=`error`,!0)}function bC(e,t){e.directoryLoadInfoById.delete(t)}function xC(e,t,n){let r=n,i=e.listeners.get(t);return i==null?e.listeners.set(t,new Set([r])):i.add(r),()=>{let n=e.listeners.get(t);n!=null&&(n.delete(r),n.size===0&&e.listeners.delete(t))}}function SC(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function CC(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function wC(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function TC(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function EC(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function DC(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function OC(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`begin-child-load`,path:e.path,projectionChanged:e.projectionChanged,reused:e.reused,visibleCountDelta:null}}function kC(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:e.childEvents.some(e=>e.canonicalChanged),childEvents:e.childEvents,operation:`apply-child-patch`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function AC(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`complete-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function jC(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,errorMessage:e.errorMessage,operation:`fail-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function MC(e){return{activeNodeCountAfter:e.activeNodeCountAfter,activeNodeCountBefore:e.activeNodeCountBefore,affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],cachedPathEntryCountAfter:e.cachedPathEntryCountAfter,cachedPathEntryCountBefore:e.cachedPathEntryCountBefore,canonicalChanged:!1,idsPreserved:e.idsPreserved,loadInfoEntryCountAfter:e.loadInfoEntryCountAfter,loadInfoEntryCountBefore:e.loadInfoEntryCountBefore,mode:e.mode,operation:`cleanup`,projectionChanged:e.projectionChanged,reclaimedCachedPathEntryCount:e.reclaimedCachedPathEntryCount,reclaimedLoadInfoEntryCount:e.reclaimedLoadInfoEntryCount,reclaimedNodeSlotCount:e.reclaimedNodeSlotCount,reclaimedSegmentCount:e.reclaimedSegmentCount,segmentCountAfter:e.segmentCountAfter,segmentCountBefore:e.segmentCountBefore,totalNodeSlotCountAfter:e.totalNodeSlotCountAfter,totalNodeSlotCountBefore:e.totalNodeSlotCountBefore,visibleCountDelta:null}}function NC(e,t,n){return{...n,visibleCountDelta:WC(e)-t}}function PC(e,t){let n=WC(e),r=cC();e.transactionStack.push(r);try{t()}catch(t){throw LC(e,r,!1),t}LC(e,r,!0,WC(e)-n)}function FC(e,t){let n=e.instrumentation;if(n==null){IC(e,t);return}X(n,`store.events.record`,()=>IC(e,t))}function IC(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){HC(e,t);return}n.events.push(t),VC(n,t)}function LC(e,t,n,r=null){if(e.transactionStack.pop()!==t)throw Error(`Transaction stack underflow`);if(!n)return;let i=e.transactionStack[e.transactionStack.length-1]??null;if(i!=null){let n=e.instrumentation;n==null?BC(i,t):X(n,`store.events.batch.merge`,()=>BC(i,t));return}let a=RC(t,r),o=e.instrumentation;if(o==null){HC(e,a);return}X(o,`store.events.batch.commit`,()=>HC(e,a))}function RC(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}}function zC(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function BC(e,t){for(let n of t.events)e.events.push(n);zC(e,t)}function VC(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function HC(e,t){let n=e.instrumentation;if(n==null){UC(e,t);return}X(n,`store.events.emit`,()=>UC(e,t))}function UC(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function WC(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function GC(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!Y(n)||vS(n,2))return null;let r=e.snapshot.directories.get(t);if(r==null||r.childIds.length!==1)return null;let i=r.childIds[0];if(i==null)return null;let a=e.snapshot.nodes[i];return a==null||!Y(a)?null:i}function KC(e,t){let n=t;for(;;){let t=GC(e,n);if(t==null)return n;n=t}}function qC(e,t){let n=[t],r=t;for(;;){let t=GC(e,r);if(t==null)return n;n.push(t),r=t}}function JC(e,t){let n=t==null?e.snapshot.rootId:iw(e,t);return n==null?[]:sw(e,n)}function YC(e,t){let n=zS(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=Sw(e,xw(e,r)),{createdNodeIds:a,directoryId:o}=cw(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=Z(e,o);if(vS(n,1))throw Error(`Path already exists: "${t}"`);yS(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=uw(e,o,n.basename),s.add(c);tw(e,o);let l=Sw(e,o);return SC({affectedAncestorIds:rw(e,c),affectedNodeIds:[...s],path:t,projectionChanged:Cw(i,l)})}function XC(e,t,n){let r=iw(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=Z(e,r);if(vS(i,2))throw Error(`The root node cannot be removed`);if(Y(i)&&ow(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=Sw(e,a),s=yw(e,r);pw(e,a,r,i.nameId),bw(e,a),tw(e,a);let c=Sw(e,a);return CC({affectedAncestorIds:rw(e,a),affectedNodeIds:s,path:t,projectionChanged:Cw(o,c),recursive:n.recursive===!0})}function ZC(e,t,n,r){let i=iw(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=Z(e,i);if(vS(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=_w(e,i,n),c=Sw(e,a.parentId),l=Sw(e,s.parentId),u=US(e.snapshot.segmentTable,a.nameId),d=HS(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(Y(a)&&Dw(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=eS(e.snapshot.nodes,ow(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&vw(e,p,o,gS(a))===`skip`)return null;let m=a.parentId;pw(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),Ew(e,i),fw(e,s.parentId,i),bw(e,m),e.pathCacheVersion++,tw(e,m),s.parentId!==m&&tw(e,s.parentId);let h=Sw(e,m),g=Sw(e,s.parentId);return wC({affectedAncestorIds:[...new Set([...rw(e,m),...rw(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:ww([c,l],[h,g]),to:ew(e,i)})}function QC(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function $C(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function ew(e,t){let n=Z(e,t),r=QC(e,t);if(r!=null)return r;if(vS(n,2))return $C(e,t,``);let i=ew(e,n.parentId),a=US(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return $C(e,t,Y(n)?`${o}/`:o)}function tw(e,t){let n=e.instrumentation;if(n==null){kw(e,t);return}X(n,`store.recomputeCountsUpwardFrom`,()=>kw(e,t))}function nw(e,t){let n=[[t,0]],{nodes:r,directories:i}=e.snapshot;for(;n.length>0;){let t=n[n.length-1],a=t[0],o=r[a];if(o==null||!Y(o)){Ow(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){Ow(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function rw(e,t){let n=[],r=t;for(;r!=null;){let t=Z(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function iw(e,t){if(t.length===0)return e.snapshot.rootId;let n=BS(t);return aw(e,n.segments,n.requiresDirectory)}function aw(e,t,n){let r=e.snapshot.rootId;for(let n of t){let t=e.snapshot.segmentTable.idByValue.get(n);if(t===void 0)return null;let i=ow(e,r),a=eS(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=Z(e,r);return n&&!Y(i)?null:r}function ow(e,t){let n=e.snapshot.directories.get(t);if(n===void 0)throw Error(`Unknown directory child index for node ${String(t)}`);return n}function Z(e,t){let n=e.snapshot.nodes[t];if(n===void 0||vS(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function sw(e,t){let n=e.snapshot.nodes[t];if(n===void 0||vS(n,4))return[];if(!Y(n))return[ew(e,t)];if(ow(e,t).childIds.length===0)return vS(n,1)&&!vS(n,2)?[ew(e,t)]:[];let r=[],i=[{childIndex:0,nodeId:t}];for(;i.length>0;){let t=i[i.length-1];if(t==null)break;let n=e.snapshot.nodes[t.nodeId];if(n===void 0||vS(n,4)){i.pop();continue}if(!Y(n)){r.push(ew(e,t.nodeId)),i.pop();continue}let a=ow(e,t.nodeId);if(a.childIds.length===0){vS(n,1)&&!vS(n,2)&&r.push(ew(e,t.nodeId)),i.pop();continue}let o=a.childIds[t.childIndex];if(o==null){i.pop();continue}t.childIndex++,i.push({childIndex:0,nodeId:o})}return r}function cw(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=HS(e.snapshot.segmentTable,i),a=ow(e,r),o=eS(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!Y(Z(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=lw(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function lw(e,t,n){let r=Z(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:mS(hS(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,Qx()),fw(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function uw(e,t,n){let r=HS(e.snapshot.segmentTable,n),i=ow(e,t);if(eS(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${jw(e,t,n)}"`);let a=Z(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:mS(hS(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),fw(e,t,o),e.activeNodeCount++,o}function dw(e,t,n){let r=0,i=t.childIds.length;for(;r<i;){let a=r+i>>>1,o=t.childIds[a];if(o==null){i=a;continue}mw(e,n,o)<0?i=a:r=a+1}return r}function fw(e,t,n){let r=ow(e,t),i=Z(e,n);eS(e.snapshot.nodes,r).set(i.nameId,n),aS(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=dw(e,r,n);r.childIds.splice(a,0,n),rS(r,a),cS(e.snapshot.nodes,r)}function pw(e,t,n,r){let i=ow(e,t),a=tS(i),o=a.get(n)??-1;eS(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&aS(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),rS(i,o),cS(e.snapshot.nodes,i))}function mw(e,t,n){let r=e.snapshot.options.sort;return r==="default"?hw(e,t,n):r(gw(e,t),gw(e,n))}function hw(e,t,n){let r=Z(e,t),i=Z(e,n),a=Y(r);if(a!==Y(i))return a?-1:1;let o=kS(IS(e.snapshot.segmentTable,r.nameId),IS(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=US(e.snapshot.segmentTable,r.nameId),c=US(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function gw(e,t){let n=Z(e,t),r=ew(e,t),i=Y(n),a=i?r.slice(0,-1):r;return{basename:US(e.snapshot.segmentTable,n.nameId),depth:hS(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function _w(e,t,n){let r=Z(e,t),i=iw(e,n);if(i!=null){let t=Z(e,i);if(Y(t))return{basename:US(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=BS(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=BS(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:aw(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function vw(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${ew(e,t)}"`);let i=Z(e,t);if(gS(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(Y(i)&&ow(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return yw(e,t),pw(e,a,t,o),bw(e,a),tw(e,a),`handled`}function yw(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=Z(e,t.nodeId);if(t.visitedChildren||!Y(i)){Y(i)&&e.snapshot.directories.delete(t.nodeId),yS(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),bC(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=ow(e,t.nodeId);for(let e=a.childIds.length-1;e>=0;e--){let t=a.childIds[e];t!=null&&r.push({nodeId:t,visitedChildren:!1})}}return n}function bw(e,t){let n=t;for(;n!=null;){let t=Z(e,n);if(!Y(t)||vS(t,2)||ow(e,n).childIds.length>0)return;yS(t,1),n=t.parentId===n?null:t.parentId}}function xw(e,t){let n=e.snapshot.rootId;for(let r of t){let t=e.snapshot.segmentTable.idByValue.get(r);if(t==null)break;let i=eS(e.snapshot.nodes,ow(e,n)).get(t);if(i==null||!Y(Z(e,i)))break;n=i}return n}function Sw(e,t){let n=Tw(e,t);if(n==null)return null;let r=KC(e,n),i=Z(e,r),a=n===r?null:qC(e,n).map(t=>ew(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:ow(e,r).childIds.length>0,path:ew(e,r),terminalKind:gS(i)})}function Cw(e,t){return ww([e],[t])}function ww(e,t){for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(r==null||i==null||r!==i)return!0}return!1}function Tw(e,t){let n=t;for(;n!=null;){let t=Z(e,n);if(!Y(t)||vS(t,2))return null;if(!dC(e,n,t))return n;n=t.parentId}return null}function Ew(e,t){let n=Z(e,t);if(bS(n,(t===e.snapshot.rootId?-1:hS(Z(e,n.parentId)))+1),!Y(n))return;let r=ow(e,t);for(let t of r.childIds)Ew(e,t)}function Dw(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=Z(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function Ow(e,t,n=Z(e,t),r=!1){let i=e.instrumentation;if(i==null){Aw(e,t,n,r);return}X(i,`store.recomputeNodeCounts`,()=>Aw(e,t,n,r))}function kw(e,t){let n=t;for(;n!=null;){let t=Z(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(Ow(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&aS(ow(e,s),n,a,o),n=s}}function Aw(e,t,n,r){if(!Y(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=ow(e,t);if(r){let t=e.instrumentation;t==null?iS(e.snapshot.nodes,i):X(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>iS(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,vS(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=GC(e,t)==null?dC(e,t,n)?1+o:1:o}function jw(e,t,n){let r=ew(e,t);return r.length===0?n:`${r}${n}`}function Mw(e){return e!=null&&!vS(e,4)}function Nw(e,t){let n=e.snapshot.nodes[t];return!Mw(n)||!Y(n)||vS(n,2)?null:n}function Pw(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&Mw(e.snapshot.nodes[n])&&(t+=1);return t}function Fw(e){return Math.max(0,e.valueById.length-1)}function Iw(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:Pw(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:Fw(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function Lw(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}}function Rw(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)Nw(e,n)!=null&&t.push(ew(e,n));for(let t of e.expandedDirectoryIds)Nw(e,t)!=null&&n.push(ew(e,t));return{collapsedPaths:t,expandedPaths:n}}function zw(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)Nw(e,n)!=null&&mC(e,n)!==`loaded`&&t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:ew(e,n)});return t}function Bw(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=iw(e,n);t!=null&&fC(e,t,!0,Z(e,t))}for(let n of t.collapsedPaths){let t=iw(e,n);t!=null&&fC(e,t,!1,Z(e,t))}}function Vw(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=iw(e,n.path);t!=null&&Nw(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function Hw(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function Uw(e){let t=e.snapshot.segmentTable,n=VS();for(let r of e.snapshot.nodes)if(Mw(r)){if(vS(r,2)){r.nameId=0;continue}r.nameId=HS(n,US(t,r.nameId))}e.snapshot.segmentTable=n}function Ww(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!Mw(r)||!Y(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return Mw(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[Z(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),iS(e.snapshot.nodes,n)}}function Gw(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(Mw(n))break;--t}e.snapshot.nodes.length=t+1}function Kw(e){let t=Rw(e),n=zw(e);X(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>Hw(e)),X(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>Uw(e)),X(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>Ww(e)),X(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>Gw(e)),X(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>Bw(e,t)),X(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>Vw(e,n)),X(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>nw(e,e.snapshot.rootId))}function qw(e){let t=Rw(e),n=zw(e),r=X(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>JC(e)),i=SS({...e.snapshot.options},e.instrumentation),a=X(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new oC(i);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,X(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>Bw(e,t)),X(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>Vw(e,n)),X(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>nw(e,e.snapshot.rootId))}function Jw(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function Yw(e,t){let n=Iw(e);t===`stable`?X(e.instrumentation,`store.cleanup.stable`,()=>Kw(e)):X(e.instrumentation,`store.cleanup.aggressive`,()=>qw(e));let r=Iw(e);return Lw(t,t===`stable`,n,r)}var Xw=64;function Zw(e,t){let n=t+2;if(n<=e.length)return e;let r=e.length;for(;r<n;)r*=2;let i=new Int32Array(r);return i.fill(-1),i.set(e),i}function Qw(e){return Z(e,e.snapshot.rootId).visibleSubtreeCount}function $w(e,t,n,r){let i=Z(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function eT(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:yT(e,t.cursor),setSize:t.setSize,subtreeEndIndex:$w(e,t.cursor,t.index,n)}}function tT(e,t,n,r,i,a){let o=ow(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=oS(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return nT(e,u,l,r+c,i+1,s,o.childIds.length,a)}function nT(e,t,n,r,i,a,o,s){if(!Y(Z(e,t))){if(n===0)return{ancestors:s,cursor:{headNodeId:t,terminalNodeId:t,visibleDepth:i},index:r,posInSet:a,setSize:o};throw Error(`Visible index ${String(n)} is out of range for file`)}let c=pT(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=Z(e,c.terminalNodeId);if(!Y(l)||!dC(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return tT(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function rT(e,t){let n=Qw(e);if(t<0||t>=n)return null;let r=tT(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>ew(e,t.cursor.terminalNodeId)),a=null;return{ancestorPaths:i,get ancestorRows(){if(a!=null)return a;let t=[],i=[];for(let a of r.ancestors){let r=eT(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:yT(e,r.cursor),setSize:r.setSize,subtreeEndIndex:$w(e,r.cursor,r.index,n)}}function iT(e,t,n){let r=e.instrumentation,i=Qw(e);if(i<=0||n<t)return[];let a=Math.max(0,Math.min(t,i-1)),o=Math.max(a,Math.min(n,i-1));if(r==null){if(a===0)return vT(e,o+1);let t=[],n=uT(e,a);for(let r=a;r<=o&&n!=null;r++){let r=yT(e,n);t.push(r),n=hT(e,n)}return t}let s=[],c=0,l=0,u=X(r,`store.getVisibleSlice.selectFirstRow`,()=>uT(e,a));for(let t=a;t<=o&&u!=null;t++){let t=X(r,`store.getVisibleSlice.materializeRow`,()=>yT(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=X(r,`store.getVisibleSlice.advanceCursor`,()=>hT(e,u))}return wS(r,`workload.visibleRowsRead`,s.length),wS(r,`workload.flattenedRowsRead`,c),wS(r,`workload.flattenedSegmentsRead`,l),s}function aT(e,t=Qw(e)){let n=e.instrumentation;return n==null?_T(e,t):X(n,`store.getVisibleTreeProjection`,()=>_T(e,t))}function oT(e){return gT(aT(e))}function sT(e,t){let n=iw(e,t);if(n==null||n===e.snapshot.rootId||Y(Z(e,n))&&KC(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=Z(e,i).parentId,n=ow(e,t),s=tS(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=sS(a,n,s),t!==o){let n=Z(e,t),a=GC(e,t);if(!dC(e,t,n)&&a!==i)return null;KC(e,t)===t&&(r+=1)}i=t}return r}function cT(e,t){let n=iw(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=Z(e,n);if(!Y(r))throw Error(`Path is not a directory: "${t}"`);return dC(e,n,r)?null:(fC(e,n,!0,r),tw(e,n),TC({affectedAncestorIds:rw(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function lT(e,t){let n=iw(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=Z(e,n);if(!Y(r))throw Error(`Path is not a directory: "${t}"`);return dC(e,n,r)?(fC(e,n,!1,r),tw(e,n),EC({affectedAncestorIds:rw(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function uT(e,t){return t<0||t>=Qw(e)?null:dT(e,e.snapshot.rootId,t,-1)}function dT(e,t,n,r){let i=ow(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?oS(e.snapshot.nodes,i,n):X(a,`store.getVisibleSlice.selectChildIndex`,()=>oS(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return fT(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function fT(e,t,n,r){if(!Y(Z(e,t))){if(n===0)return{headNodeId:t,terminalNodeId:t,visibleDepth:r};throw Error(`Visible index ${String(n)} is out of range for file`)}let i=pT(e,t,r);if(n===0)return i;let a=Z(e,i.terminalNodeId);if(!Y(a)||!dC(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return dT(e,i.terminalNodeId,n-1,i.visibleDepth)}function pT(e,t,n){return Y(Z(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:KC(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:X(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>KC(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function mT(e,t){let n=Z(e,t);if(!Y(n))return!0;let r=n.parentId;return r===e.snapshot.rootId||GC(e,r)!==t}function hT(e,t){let n=Z(e,t.terminalNodeId);if(Y(n)){let r=ow(e,t.terminalNodeId);if(dC(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:fT(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=Z(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=ow(e,n),o=tS(a).get(r)??-1;if(o<0)throw Error(`Child ${String(r)} was not found in its parent index`);let s=a.childIds[o+1]??null;if(s!=null)return fT(e,s,0,i);mT(e,r)&&i--,r=n}}function gT(e){let t=e.paths.length,n=Array(t);for(let r=0;r<t;r+=1){let 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}}}function _T(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(Xw);o.fill(-1);let s=0,{nodes:c,directories:l,segmentTable:u}=e.snapshot,d=[[l.get(e.snapshot.rootId),0,-1,``]],f=e.snapshot.options.flattenEmptyDirectories,p=e.pathCacheByNodeId,m=e.pathCacheVersion,h=u.valueById;for(;d.length>0&&s<t;){let t=d[d.length-1],u=t[0];if(t[1]>=u.childIds.length){d.pop();continue}let g=t[1],_=u.childIds[t[1]++],v=c[_],y=t[2]+1,b=t[3];o=Zw(o,y);let x,S=_;if(Y(v))S=f?KC(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:ew(e,S);else{let e=p.get(_);x=e!=null&&e.version===m?e.path:`${b}${h[v.nameId]}`}r[s]=o[y],n[s]=x,i[s]=g,a[s]=u.childIds.length,o[y+1]=s,s+=1;let C=c[S];C!=null&&Y(C)&&dC(e,S,C)&&d.push([l.get(S),0,y,x])}s<t&&(n.length=s);let g=r.subarray(0,s),_=i.subarray(0,s),v=a.subarray(0,s),y=null;return{getParentIndex(e){return e<0||e>=s?-1:g[e]??-1},paths:n,posInSetByIndex:_,setSizeByIndex:v,get visibleIndexByPath(){if(y==null){y=new Map;for(let e=0;e<s;e+=1)y.set(n[e]??``,e)}return y}}}function vT(e,t){let n=Array(t),r=0,{nodes:i,directories:a,segmentTable:o}=e.snapshot,s=[[a.get(e.snapshot.rootId),0,-1]],c=o.valueById,l=e.snapshot.options.flattenEmptyDirectories,u=e.pathCacheByNodeId,d=e.pathCacheVersion;for(;s.length>0&&r<t;){let t=s[s.length-1],o=t[0];if(t[1]>=o.childIds.length){s.pop();continue}let f=o.childIds[t[1]++],p=i[f],m=t[2]+1;if(!Y(p)){let t=u.get(f);n[r++]={depth:m,flattenedSegments:void 0,hasChildren:!1,id:f,isExpanded:!1,isFlattened:!1,isLoading:!1,kind:`file`,loadState:void 0,name:c[p.nameId],path:t!=null&&t.version===d?t.path:ew(e,f)};continue}let h=l?KC(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=yT(e,g);let _=i[h];_!=null&&Y(_)&&dC(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function yT(e,t){let n=Z(e,t.terminalNodeId),r=Y(n)?bT(e,t):null,i=ew(e,t.terminalNodeId),a=US(e.snapshot.segmentTable,n.nameId),o=Y(n)&&ow(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?qC(e,t.headNodeId).map(n=>{let r=Z(e,n);return{isTerminal:n===t.terminalNodeId,name:US(e.snapshot.segmentTable,r.nameId),nodeId:n,path:ew(e,n)}}):X(c,`store.getVisibleSlice.flatten.collectSegments`,()=>qC(e,t.headNodeId).map(n=>{let r=Z(e,n);return{isTerminal:n===t.terminalNodeId,name:US(e.snapshot.segmentTable,r.nameId),nodeId:n,path:ew(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:Y(n)&&dC(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:Y(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function bT(e,t){if(t.headNodeId===t.terminalNodeId)return mC(e,t.terminalNodeId);let n=qC(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=mC(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}var xT=8;function ST(e){let{nodes:t,directories:n,rootId:r,options:i}=e,a=t.length,o=new Int32Array(a),s=new Int32Array(a),c=new Int32Array(a),l=new Int32Array(a),u=new Int32Array(a),d=new Int32Array(a),f=new Int32Array(a);for(let e=0;e<a;e+=1){let n=t[e];n!=null&&(o[e]=n.parentId,s[e]=n.nameId,c[e]=n.depthAndFlags,l[e]=n.subtreeNodeCount,u[e]=n.visibleSubtreeCount)}let p=0;for(let e of n.values())p+=e.childIds.length;let m=new Int32Array(p),h=0;for(let[e,t]of n){let n=t.childIds;d[e]=h,f[e]=n.length;for(let e=0;e<n.length;e+=1)m[h]=n[e],h+=1}return{nodeCount:a,rootId:r,flattenEmptyDirectories:i.flattenEmptyDirectories===!0,parentId:o,nameId:s,depthAndFlags:c,subtreeNodeCount:l,visibleSubtreeCount:u,childStart:d,childCount:f,childIdsFlat:m}}function CT(e){let{nodeCount:t,rootId:n,flattenEmptyDirectories:r,depthAndFlags:i,subtreeNodeCount:a,visibleSubtreeCount:o,childStart:s,childCount:c,childIdsFlat:l}=e;for(let e=t-1;e>=1;--e){if((i[e]&xT)===0)continue;let t=s[e],n=c[e],u=0,d=0;for(let e=0;e<n;e+=1){let n=l[t+e];u+=a[n],d+=o[n]}a[e]=1+u;let f;f=r&&n===1?(i[l[t]]&xT)===0?1+d:d:1+d,o[e]=f}let u=s[n],d=c[n],f=0,p=0;for(let e=0;e<d;e+=1){let t=l[u+e];f+=a[t],p+=o[t]}a[n]=1+f,o[n]=p}function wT(e){let{directories:t,nodes:n,options:r,rootId:i,presortedDirectoryNodeIds:a}=e.snapshot,o=r.flattenEmptyDirectories===!0,s=e=>{let r=n[e];if(r==null||!Y(r))return;let i=t.get(e);if(i==null)throw Error(`Unknown directory child index for node ${String(e)}`);let a=i.childIds,s=a.length,c=0,l=0;for(let e=0;e<s;e++){let t=a[e];if(t==null)continue;let r=n[t];c+=r.subtreeNodeCount,l+=r.visibleSubtreeCount}i.totalChildSubtreeNodeCount=c,i.totalChildVisibleSubtreeCount=l,s>=128&&cS(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&Y(e)?l:1+l}else u=1+l;r.visibleSubtreeCount=u};if(a!=null)for(let e=a.length-1;e>=0;e--)s(a[e]);else for(let e=n.length-1;e>=1;e--)s(e);let c=n[i],l=t.get(i);if(c==null||l==null)return;let u=l.childIds,d=0,f=0;for(let e=0;e<u.length;e++){let t=u[e];if(t==null)continue;let r=n[t];d+=r.subtreeNodeCount,f+=r.visibleSubtreeCount}l.totalChildSubtreeNodeCount=d,l.totalChildVisibleSubtreeCount=f,cS(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function TT(e){let{directories:t,nodes:n,rootId:r}=e.snapshot,i=ST(e.snapshot);CT(i);let a=i.subtreeNodeCount,o=i.visibleSubtreeCount;for(let e=0;e<n.length;e+=1){let t=n[e];t!=null&&(t.subtreeNodeCount=a[e],t.visibleSubtreeCount=o[e])}for(let[e,i]of t){let t=i.childIds,a=t.length,o=0,s=0;for(let e=0;e<a;e++){let r=t[e];if(r==null)continue;let i=n[r];o+=i.subtreeNodeCount,s+=i.visibleSubtreeCount}i.totalChildSubtreeNodeCount=o,i.totalChildVisibleSubtreeCount=s,(e===r||a>=128)&&cS(n,i)}}function ET(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var DT=class e{#e;constructor(e={}){let t=CS(e),n=X(t,`store.builder.create`,()=>new oC(e));if(e.preparedInput!=null){let t=rC(e.preparedInput);t==null?n.appendPreparedPaths(nC(e.preparedInput),!1):n.appendPresortedPaths(t,iC(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(X(t,`store.preparePathEntries`,()=>aC(r,e)))}let r=X(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=X(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=X(t,`store.state.create`,()=>sC(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:X(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||ET(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&X(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?e.useSoaCountSweep===!0?X(t,`store.state.initializeOpenVisibleCountsViaSoa`,()=>TT(this.#e)):X(t,`store.state.initializeOpenVisibleCounts`,()=>wT(this.#e)):X(t,`store.state.recomputeCounts`,()=>nw(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return $S(e,t)}static prepareInput(e,t={}){return eC(e,t)}static preparePresortedInput(e){return tC(e)}list(e){return X(this.#e.instrumentation,`store.list`,()=>JC(this.#e,e))}add(e){X(this.#e.instrumentation,`store.add`,()=>{let t=Qw(this.#e);FC(this.#e,NC(this.#e,t,YC(this.#e,e)))})}remove(e,t={}){X(this.#e.instrumentation,`store.remove`,()=>{let n=Qw(this.#e);FC(this.#e,NC(this.#e,n,XC(this.#e,e,t)))})}move(e,t,n={}){X(this.#e.instrumentation,`store.move`,()=>{let r=Qw(this.#e),i=ZC(this.#e,e,t,n);i!=null&&FC(this.#e,NC(this.#e,r,i))})}batch(e){PC(this.#e,()=>{if(typeof e==`function`){e(this);return}for(let t of e)switch(t.type){case`add`:this.add(t.path);break;case`remove`:this.remove(t.path,{recursive:t.recursive});break;case`move`:this.move(t.from,t.to,{collision:t.collision})}})}getVisibleCount(){return X(this.#e.instrumentation,`store.getVisibleCount`,()=>Qw(this.#e))}getVisibleSlice(e,t){return X(this.#e.instrumentation,`store.getVisibleSlice`,()=>iT(this.#e,e,t))}getVisibleRowContext(e){return X(this.#e.instrumentation,`store.getVisibleRowContext`,()=>rT(this.#e,e))}getVisibleTreeProjection(){return oT(this.#e)}getVisibleTreeProjectionData(e){return aT(this.#e,e)}getVisibleIndex(e){return X(this.#e.instrumentation,`store.getVisibleIndex`,()=>sT(this.#e,e))}getPathInfo(e){return X(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=iw(this.#e,e);if(t==null)return null;let n=Z(this.#e,t);return{depth:hS(n),kind:Y(n)?`directory`:`file`,path:ew(this.#e,t)}})}isExpanded(e){return X(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=Z(this.#e,t);return dC(this.#e,t,n)})}expand(e){X(this.#e.instrumentation,`store.expand`,()=>{let t=Qw(this.#e),n=cT(this.#e,e);n!=null&&FC(this.#e,NC(this.#e,t,n))})}collapse(e){X(this.#e.instrumentation,`store.collapse`,()=>{let t=Qw(this.#e),n=lT(this.#e,e);n!=null&&FC(this.#e,NC(this.#e,t,n))})}on(e,t){return xC(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return mC(this.#e,t)}markDirectoryUnloaded(e){X(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(ow(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=Qw(this.#e);gC(this.#e,t),FC(this.#e,NC(this.#e,n,DC({affectedAncestorIds:rw(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return X(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=Qw(this.#e),r=hC(this.#e,t);return FC(this.#e,NC(this.#e,n,OC({affectedAncestorIds:rw(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return X(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||mC(this.#e,n)!==`loading`||!vC(this.#e,n,e.attemptId))return!1;let r=ew(this.#e,n);this.validateChildPatch(r,t);let i=Qw(this.#e),a=[];for(let e of t.operations){OT(r,e);let t=Qw(this.#e);switch(e.type){case`add`:a.push(NC(this.#e,t,YC(this.#e,e.path)));break;case`remove`:a.push(NC(this.#e,t,XC(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=ZC(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(NC(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return FC(this.#e,NC(this.#e,i,kC({affectedAncestorIds:rw(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:ew(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return X(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=Qw(this.#e),r=_C(this.#e,t,e.attemptId);return FC(this.#e,NC(this.#e,n,AC({affectedAncestorIds:rw(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:ew(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return X(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=Qw(this.#e),i=yC(this.#e,n,e.attemptId,t);return FC(this.#e,NC(this.#e,r,jC({affectedAncestorIds:rw(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:ew(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return X(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(Jw(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=Qw(this.#e),n=Yw(this.#e,e.mode??`stable`);return FC(this.#e,NC(this.#e,t,MC({...n,affectedAncestorIds:[],affectedNodeIds:[],projectionChanged:n.idsPreserved===!1}))),n})}getNodeCount(){return this.#e.activeNodeCount}initializeExpandedPaths(e){if(e==null||e.length===0)return 0;let t=0,n=[],r=[],i=0,a=null,o=this.#e.snapshot.segmentTable,s=o.valueById,c=this.#e.snapshot.nodes,l=new Map;for(let u of e){a!=null&&u<a&&(a=null,i=0,n.length=0,r.length=0);let e=u.length>0&&u.charCodeAt(u.length-1)===47?u.length-1:u.length;if(e===0){a=u,i=e,n.length=0,r.length=0;continue}let d=0,f=0;if(a!=null){let t=Math.min(e,i),n=!0;for(let e=0;e<t;e+=1){let t=u.charCodeAt(e);if(t!==a.charCodeAt(e)){n=!1;break}t===47&&(d+=1,f=e+1)}n&&(t===i&&e>t&&u.charCodeAt(t)===47?(d+=1,f=t+1):t===e&&i>t&&a.charCodeAt(t)===47&&(d+=1,f=e+1)),d=Math.min(d,r.length)}let p=d===0?this.#e.snapshot.rootId:r[d-1]??this.#e.snapshot.rootId,m=d,h=!0,g=f;for(;g<=e;){let t=u.indexOf(`/`,g),i=t===-1||t>e?e:t,a=u.slice(g,i),f=ow(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??DS(a);l.set(a,b);let x=(e,t)=>{for(v=e;v<t;v+=1){let e=f[v],t=c[e],n=s[t.nameId];if(n===a)return y=e,!0;let r=kS(IS(o,t.nameId),b);if(r>0||r===0&&n>a)return!1}return!1};if(!x(_,f.length)&&_>0&&x(0,_),y===void 0){h=!1;break}if(!Y(Z(this.#e,y))){h=!1;break}if(n[m]=v,r[m]=y,p=y,m+=1,i===e)break;g=i+1}if(a=u,i=e,n.length=m,r.length=m,!h){a=null,i=0,n.length=0,r.length=0;continue}for(let e=d;e<m;e+=1){let n=r[e];if(n==null)continue;let i=Z(this.#e,n);dC(this.#e,n,i)||(fC(this.#e,n,!0,i),t+=1)}}return t}hasAllDirectoriesExpanded(){for(let e of this.#e.snapshot.directories.keys()){if(e===this.#e.snapshot.rootId)continue;let t=Z(this.#e,e);if(!dC(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=iw(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!Y(Z(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!Y(Z(this.#e,e)))throw Error(`Node is not a directory: ${String(e)}`);return e}catch{return null}}isDirectoryProjectionVisible(e){let t=e;for(;t!==this.#e.snapshot.rootId;){let e=Z(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=Z(this.#e,e),r=GC(this.#e,e);if(!dC(this.#e,e,n)&&r!==t)return!1}t=e}return!0}validateChildPatch(t,n){new e({paths:this.list(t),presorted:!0,sort:this.#e.snapshot.options.sort}).batch(n.operations)}};function OT(e,t){switch(t.type){case`add`:case`remove`:if(!t.path.startsWith(e)||t.path===e)throw 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 Error(`Child patch move must stay within ${e}: "${t.from}" -> "${t.to}"`)}}var kT=e=>e.startsWith(`f::`)?e.slice(3):e;function AT(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function jT(e,t){return e===``?t:`${e}/${t}`}function MT({files:e,path:t,isFolder:n,nextBasename:r}){let i=kT(t),a=r.trim();if(a.length===0)return{error:`Name cannot be empty.`};if(a.includes(`/`))return{error:`Name cannot include "/".`};let{parentPath:o,baseName:s}=AT(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=jT(o,a),l=Array(e.length),u=new Set;if(!n){let t=`${c}/`,r=!1;for(let n=0;n<e.length;n++){let a=e[n];if(a!==i&&a.startsWith(t))return{error:`"${c}" already exists.`};let o=a===i?c:a;if(u.has(o))return{error:`"${c}" already exists.`};u.add(o),l[n]=o,a===i&&(r=!0)}return r?{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}:{error:`Could not find the selected file to rename.`}}let d=`${i}/`,f=`${c}/`,p=0;for(let t=0;t<e.length;t++){let n=e[t],r=n===i||n.startsWith(d);if(!r&&(n===c||n.startsWith(f)))return{error:`"${c}" already exists.`};let a=r?`${c}${n.slice(i.length)}`:n;if(u.has(a))return{error:`"${c}" already exists.`};u.add(a),l[t]=a,r&&p++}return p===0?{error:`Could not find the selected folder to rename.`}:{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}}function NT(e){return e.endsWith(`/`)}function PT(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`),r=n<0?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function FT(e){let t=[],n=new Set;for(let r of e)n.has(r)||(n.add(r),t.push(r));let r=new Set;for(let e of t.toSorted((e,t)=>e.length===t.length?e.localeCompare(t):e.length-t.length)){let t=(e.endsWith(`/`)?e.slice(0,-1):e).split(`/`),n=!1;for(let e=0;e<t.length-1;e+=1){let i=`${t.slice(0,e+1).join(`/`)}/`;if(r.has(i)){n=!0;break}}n||r.add(e)}return t.filter(e=>r.has(e))}function IT(e,t){return t.includes(e)?FT(t):[e]}function LT(e,t){return e===t?!0:e==null||t==null?!1:e.kind===t.kind&&e.directoryPath===t.directoryPath&&e.flattenedSegmentPath===t.flattenedSegmentPath&&e.hoveredPath===t.hoveredPath}function RT(e,t){return{draggedPaths:e,target:t}}function zT(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(NT(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function BT(e,t){return t.kind===`root`||t.directoryPath==null?PT(e):t.directoryPath}function VT(e,t){let n=e.map(e=>{let n=BT(e,t);return n===e?null:{from:e,to:n,type:`move`}}).filter(e=>e!=null);return n.length===0?null:{operations:n,result:{draggedPaths:e,operation:n.length===1?`move`:`batch`,target:t}}}function HT(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}function UT(e,t,n){let{paths:r,preparedInput:i}=e;if(i==null){if(r==null)throw Error(`FileTree requires paths or preparedInput`);return{paths:r,preparedInput:void 0}}let a=i.paths;if(r==null)return{paths:a,preparedInput:i};if(!HT(DT.preparePaths(r,n==null?{}:{sort:n}),a))throw Error(`FileTree ${t} received paths and preparedInput for different path lists`);return{paths:a,preparedInput:i}}function WT(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function GT(e,t,n){if(e===t)return n;let r=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(r)?`${n.endsWith(`/`)?n:`${n}/`}${e.slice(r.length)}`:e}function KT(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function qT(e,t,n=!1){if(e==null)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 KT(e,t.path)?n?e:null:e;case`move`:return GT(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=qT(r,e,n),r==null)return null;return r}}}function JT(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function YT(e){switch(e.operation){case`add`:return{...JT(e),operation:`add`,path:e.path};case`remove`:return{...JT(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...JT(e),from:e.from,operation:`move`,to:e.to}}}function XT(e){return{...JT(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>YT(e)),operation:`batch`}}function ZT(e){switch(e.operation){case`add`:case`remove`:case`move`:return YT(e);case`batch`:return XT(e);default:return null}}function QT(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function $T(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function eE(e){return $T(e).at(-1)??null}function tE(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function nE(e){return e.endsWith(`/`)}var rE=e=>e.toLowerCase();function iE(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function aE(e){return e.endsWith(`/`)?e.slice(0,-1):e}function oE(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var sE=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},cE=Symbol(`FILE_TREE_RENAME_VIEW`),lE=512,uE=512;function dE(e){return e===`top`||e===`center`?e:`nearest`}function fE(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=$T(n);for(let e=r.length-1;e>=0;--e){let n=r[e];if(n==null)continue;let i=t(n);if(i!=null)return i}}return 0}function pE(e,t,n){if(e.paths.length===0)return{focusedIndex:-1,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};if(t==null)return{focusedIndex:0,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};let r=n??(t=>e.visibleIndexByPath.get(t)??null);return{focusedIndex:fE(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var mE=class e{static{Object.defineProperty(e.prototype,cE,{configurable:!0,value(){return{cancel:()=>{this.#q()},commit:()=>{this.#J()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#Y(e)}}},writable:!0})}#e;#t=new Set;#n=new Map;#r=null;#i=null;#a=new Map;#o=new Map;#s=-1;#c=null;#l=!1;#u=e=>-1;#d=new Map;#f=null;#p=null;#m=null;#h=null;#g=null;#_;#v;#y;#b=[];#x=new Int32Array;#S=new Int32Array;#C=void 0;#w=!1;#T=null;#E=``;#D=!1;#O=new Set;#k=[];#A;#j=null;#M=null;#N=null;#P=null;#F=null;#I=null;#L=null;#R=0;#z=null;#B=new Set;#V=0;#H;#U=0;#W=!1;#G=0;#K;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=UT({paths:s,preparedInput:c},`constructor`,l.sort);this.#e=l,t!=null&&t!==!1&&(this.#r=t===!0?{}:t),this.#w=a!=null&&a!==!1,a!=null&&a!==!1&&a!==!0&&(this.#C=a.canRename,this.#v=a.onError,this.#_=a.onRename),this.#y=o,this.#A=n??`hide-non-matches`,this.#H=this.#le(u.paths,u.preparedInput);let d=i?.map(e=>this.#Ne(e)).filter(e=>e!=null)??[],f=d.at(-1)??null;d.length>0&&(this.#B=new Set(d),this.#z=f,this.#V=1),this.#je(f,!1),r!=null&&this.#Te(r,!1),this.#K=this.#Re()}destroy(){this.#K?.(),this.#K=null,this.#n.clear(),this.#t.clear(),this.#d.clear(),this.#i=null,this.#he()}focusFirstItem(){this.#be().length>0&&this.#Fe(0)}focusLastItem(){this.#G<=0||(this.#Ie(),this.#Fe(this.#G-1))}focusNextItem(){this.#Ae(1)}focusParentItem(){if(this.#c==null)return;let e=eE(this.#c);if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t)}focusPath(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;this.#Ie();let n=this.#Z(t);n>=0&&this.#Fe(n)}scrollToPath(e,t){let n=this.#H.getPathInfo(e)?.path??null;if(n==null)return;this.#Ie();let r=this.#xe(n);r<0||this.#Me(r)!=null&&(t?.focus!==!1&&this.#Fe(r,!1),this.#L={id:this.#R+=1,offset:dE(t?.offset),visibleIndex:r},this.#De())}focusMountedPathFromInput(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;let n=this.#Z(t);n>=0&&this.#Fe(n)}focusNearestPath(e){let t=this.resolveNearestVisiblePath(e);if(t==null)return null;let n=this.#Z(t);return n>=0?(this.#Fe(n),this.#be()[n]??t):null}focusPreviousItem(){this.#Ae(-1)}getFocusedIndex(){return this.#s}getFocusedItem(){return this.#c==null?null:this.#Q(this.#c)}getFocusedPath(){return this.#c}getScrollRequest(){return this.#L}clearScrollRequest(e){this.#L?.id===e&&(this.#L=null)}resolveNearestVisiblePath(e){let t=this.#be();if(this.#G===0)return null;if(e==null)return this.#c??t[0]??null;let n=this.#H.getPathInfo(e)?.path??e,r=this.#Z(n);return r>=0?t[r]??n:this.#X(n)??this.#c??t[0]??null}getSelectedPaths(){return[...this.#B]}getSelectionVersion(){return this.#V}getVisibleCount(){return this.#G}getVisibleRows(e,t){if(t<e||this.#G===0)return[];let n=Math.max(0,e),r=Math.min(this.#G-1,t);if(r<n)return[];let i=r-n+1;if(this.#F==null&&!this.#l&&r>=this.#b.length&&i<=uE){let e=[];for(let t=n;t<=r;t+=1){let n=this.#H.getVisibleRowContext(t);if(n==null)break;e.push(this.#ee(n))}return e}if(!this.#l&&r>=this.#b.length&&this.#Ie(),this.#F!=null){let e=Array.from({length:r-n+1},(e,t)=>this.#Se(n+t)),t=new Map,i=e[0]??-1,a=i;for(let n=1;n<=e.length;n+=1){let r=e[n];if(r!=null&&r===a+1){a=r;continue}if(i>=0&&this.#H.getVisibleSlice(i,a).forEach((e,n)=>{t.set(i+n,e)}),r==null){i=-1,a=-1;continue}i=r,a=r}return Array.from({length:r-n+1},(e,r)=>{let i=n+r,a=this.#Se(i),o=t.get(a),s=this.#b[a];if(o==null||s==null)throw Error(`Missing projection row for filtered visible index ${String(i)}`);return this.#$(o,i,a,{ancestorPaths:this.#re(a),path:s})})}return this.#H.getVisibleSlice(n,r).map((e,t)=>{let r=n+t,i=this.#b[r];if(i==null)throw Error(`Missing projection path for visible index ${String(r)}`);return this.#$(e,r,r,{ancestorPaths:this.#re(r),path:i})})}getStickyRowCandidates(e,t){if(this.#F!=null)return null;if(this.#G===0||e<=0||t<=0)return[];let n=[];for(let r=0;r<this.#G;r+=1){let i=e+r*t,a=Math.min(this.#G-1,Math.floor(i/t)),o=this.#te(a,r)??(a>0?this.#te(a-1,r):void 0);if(o==null)break;n.push({row:this.#ee(o),subtreeEndIndex:o.subtreeEndIndex})}return n}getItem(e){let t=this.#H.getPathInfo(e);return t==null?null:this.#Q(t.path,t)}resolveMountedDirectoryPathFromInput(e){let t=this.#H.getPathInfo(e);return t?.kind===`directory`?t.path:null}toggleMountedDirectoryFromInput(e){let t=this.resolveMountedDirectoryPathFromInput(e);t!=null&&this.#ze(t)}selectAllVisiblePaths(){this.#Ie();let e=[...this.#be()];this.#ae(e,this.#c??this.#z)}selectOnlyPath(e){let t=this.#Ne(e);t!=null&&this.#ae([t],t)}selectOnlyMountedPathFromInput(e){this.#ae([e],e)}selectPath(e){let t=this.#Ne(e);t==null||this.#B.has(t)||this.#ae([...this.#B,t])}deselectPath(e){let t=this.#Ne(e);t==null||!this.#B.has(t)||this.#ae([...this.#B].filter(e=>e!==t))}toggleFocusedSelection(){this.#c!=null&&this.togglePathSelectionFromInput(this.#c)}togglePathSelection(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.deselectPath(t);return}this.selectPath(t)}}togglePathSelectionFromInput(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.#ae([...this.#B].filter(e=>e!==t),t);return}this.#ae([...this.#B,t],t)}}selectPathRange(e,t){let n=this.#Ne(e);if(n==null)return;this.#Ie();let r=this.#z,i=r==null?-1:this.#Ce(r),a=this.#Ce(n);if(i===-1||a===-1){let e=t?[...this.#B,n]:[n];this.#ae(e,n);return}let[o,s]=i<=a?[i,a]:[a,i],c=this.#be().slice(o,s+1),l=t?[...this.#B,...c]:c;this.#ae(l,r)}extendSelectionFromFocused(e){if(this.#c==null)return;let t=this.#s;if(t===-1)return;let n=Math.min(this.#G-1,Math.max(0,t+e));if(n===t)return;!this.#l&&n>=this.#b.length&&this.#Ie();let r=this.#be(),i=r[t]??null,a=r[n]??null;if(i==null||a==null)return;let o=new Set(this.#B);o.has(i)&&o.has(a)?o.delete(i):o.add(a),this.#ae([...o],this.#z??i,!1),this.#Fe(n)}getDragAndDropConfig(){return this.#r}isDragAndDropEnabled(){return this.#r!=null}getDragSession(){return this.#i==null?null:{draggedPaths:[...this.#i.draggedPaths],primaryPath:this.#i.primaryPath,target:this.#i.target==null?null:{...this.#i.target}}}startDrag(e){if(this.#r==null)return!1;let t=this.#Ne(e);if(t==null||this.#M!=null&&this.#M.length>0)return!1;let n=this.getSelectedPaths(),r=IT(t,n);return this.#r.canDrag?.(r)!==!1&&(n.includes(t)||this.#ae([t],t,!1),this.#Pe(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#De(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=RT(t.draggedPaths,n);(zT(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}LT(t.target,n)||(this.#i={...t,target:n},this.#De())}cancelDrag(){this.#i!=null&&(this.#i=null,this.#De())}completeDrag(){let e=this.#i;if(e==null)return!1;this.#i=null;let t=e.target==null?null:{...e.target};if(t==null)return this.#De(),!1;let n=RT(e.draggedPaths,t);if(zT(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=VT(e.draggedPaths,t);if(r==null)return this.#De(),!1;try{if(r.operations.length===1){let e=r.operations[0];if(e==null||e.type!==`move`)throw Error(`Expected a single move operation for one-item drops`);this.#H.move(e.from,e.to,{collision:e.collision})}else this.#ce(r.operations),this.#H.batch(r.operations)}catch(e){return this.#De(),this.#r?.onDropError?.(e instanceof Error?e.message:String(e),n),!1}return this.#r?.onDropComplete?.(r.result),!0}subscribe(e){return this.#t.add(e),e(),()=>{this.#t.delete(e)}}add(e){this.#H.add(e)}remove(e,t={}){this.#H.remove(e,t)}move(e,t,n={}){this.#H.move(e,t,n)}batch(e){this.#H.batch(e)}onMutation(e,t){let n=e,r=t,i=this.#n.get(n);return i??(i=new Set,this.#n.set(n,i)),i.add(r),()=>{let e=this.#n.get(n);e?.delete(r),e?.size===0&&this.#n.delete(n)}}setSearch(e){this.#Te(e,!0)}openSearch(e=``){this.#Te(e,!0)}closeSearch(){this.#Te(null,!0)}isSearchOpen(){return this.#M!==null}getSearchValue(){return this.#M??``}getSearchMatchingPaths(){return this.#k}focusNextSearchMatch(){this.#we(1)}focusPreviousSearchMatch(){this.#we(-1)}startRenaming(e=this.#c??``,t={}){if(!this.#w)return!1;let n=this.#H.getPathInfo(e);if(n==null)return!1;let r=n.path,i=nE(r),a=aE(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of $T(r))this.#H.isExpanded(e)||this.#H.expand(e);return this.#ae([r],r,!1),this.#M!=null&&(this.#Te(null,!1),this.#y?.(this.#M)),this.#Pe(r),this.#T=r,this.#E=iE(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}#q(){if(this.#T==null)return;let e=this.#T,t=this.#D;if(this.#T=null,this.#E=``,this.#D=!1,t){this.remove(e,nE(e)?{recursive:!0}:void 0);return}this.#Pe(e),this.#De()}#J(){let e=this.#T;if(e==null)return;if(this.#D&&this.#E.trim().length===0){this.#T=null,this.#E=``,this.#D=!1,this.remove(e,nE(e)?{recursive:!0}:void 0);return}let t=nE(e),n=MT({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:aE(e)});if(this.#T=null,this.#E=``,this.#D=!1,`error`in n){this.#Pe(e),this.#v?.(n.error),this.#De();return}if(n.sourcePath===n.destinationPath){this.#Pe(e),this.#De();return}this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move(oE(n.sourcePath,t),oE(n.destinationPath,t))}#Y(e){this.#T!=null&&this.#E!==e&&(this.#E=e,this.#De())}resetPaths(e,t={}){let n=!Array.isArray(e),r=n?void 0:e,i=n?e:t,a=this.#H.list().length,o=this.#G,s=UT({paths:r,preparedInput:i.preparedInput},`resetPaths`,this.#e.sort),c=this.#le(s.paths,s.preparedInput,i.initialExpandedPaths),l=this.#c,u=this.#T,d=this.getSelectedPaths(),f=this.#z;this.#K?.(),this.#H=c,this.#d.clear(),this.#he();let p=d.map(e=>c.getPathInfo(e)?.path??null).filter(e=>e!=null),m=!QT(this.#B,p);this.#B=new Set(p),m&&(this.#V+=1),this.#z=f==null?null:c.getPathInfo(f)?.path??null,this.#T=u==null?null:c.getPathInfo(u)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#je(l,l!=null||p.length>0||this.#z!=null),this.#K=this.#Re(),this.#De(),this.#Oe({canonicalChanged:!0,operation:`reset`,pathCountAfter:s.paths.length,pathCountBefore:a,projectionChanged:!0,usedPreparedInput:i.preparedInput!=null,visibleCountDelta:this.#G-o})}#X(e){this.#Ie();let t=eE(e),n=tE(e,t),r=null,i=null;for(let e of this.#be()){if(eE(e)!==t)continue;let a=tE(e,t);if(a<n){r=e;continue}if(a>n){i=e;break}}return r??i}#Z(e){let t=this.#Ce(e);if(t!==-1)return t;let n=$T(e);for(let e=n.length-1;e>=0;--e){let t=n[e];if(t==null)continue;let r=this.#Ce(t);if(r!==-1)return r}return this.#be().length>0?0:-1}#Q(e,t){let n=this.#d.get(e);if(n!=null)return n;let r=t??this.#H.getPathInfo(e);if(r==null)return null;let i=r.kind===`directory`?this.#oe(r.path):this.#se(r.path);return this.#d.set(r.path,i),i}#$(e,t,n,r){return{ancestorPaths:r.ancestorPaths,depth:e.depth,flattenedSegments:e.flattenedSegments?.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===this.#c,isSelected:this.#B.has(r.path),kind:e.kind,level:e.depth,name:e.name,path:r.path,posInSet:r.posInSet??this.#x[n]??0,setSize:r.setSize??this.#S[n]??0}}#ee(e){return this.#$(e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})}#te(e,t){let n=this.#H.getVisibleRowContext(e);return n==null?void 0:n.ancestorRows[t]??(t===n.ancestorRows.length&&n.row.kind===`directory`&&n.row.isExpanded?n:void 0)}#ne(e){let t=this.#a.get(e);if(t!=null)return t;let n=this.#u(e),r=n<0?[]:[...this.#ne(n),n];return this.#a.set(e,r),r}#re(e){let t=this.#o.get(e);if(t!=null)return t;let n=this.#ne(e).map(e=>this.#b[e]??``).filter(e=>e!==``);return this.#o.set(e,n),n}#ie(e){this.#H.collapse(e)}#ae(e,t=this.#z,n=!0){let r=[...new Set(e)],i=!QT(this.#B,r),a=this.#z!==t;!i&&!a||(this.#B=new Set(r),this.#z=t,i&&(this.#V+=1),n&&this.#De())}#oe(e){return{collapse:()=>{this.#ie(e)},deselect:()=>{this.deselectPath(e)},expand:()=>{this.#ke(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>this.#H.isExpanded(e),isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{this.#ze(e)}}}#se(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}}#ce(e){let t=this.#H.list();this.#le(t).batch(e)}#le(e,t,n){return new DT({...this.#e,paths:e,preparedInput:t??void 0,...n===void 0?{}:{initialExpandedPaths:n}})}#ue(){return this.#h??=this.#H.list(),this.#h}#de(){if(this.#m!=null)return this.#m;let e=new Set;for(let t of this.#ue()){e.add(t);for(let n of $T(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(rE),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(rE),this.#p}#he(){this.#f=null,this.#p=null,this.#m=null,this.#h=null,this.#g=null}#ge(){return this.#pe().filter(e=>this.#H.isExpanded(e))}#_e(e){let t=new Set(this.#j??[]);if(e)for(let e of this.#B)for(let n of $T(e))t.add(n);this.#ve(t)}#ve(e){this.#W=!0;try{for(let t of this.#pe()){let n=e.has(t),r=this.#H.isExpanded(t);n&&!r?this.#H.expand(t):!n&&r&&this.#H.collapse(t)}}finally{this.#W=!1}}#ye(){if(this.#M==null||this.#M.length===0){this.#k=[],this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let e=this.#b;if(this.#k=e.filter(e=>this.#O.has(e)),this.#A!==`hide-non-matches`||this.#O.size===0){this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let t=[],n=[],r=new Map;for(let[i,a]of e.entries())this.#N?.has(a)===!0&&(r.set(a,n.length),t.push(i),n.push(a));this.#F=t,this.#I=n,this.#P=r,this.#G=n.length}#be(){return this.#I??this.#b}#xe(e){return this.#I==null?this.#H.getVisibleIndex(e)??-1:this.#P?.get(e)??-1}#Se(e){return this.#F?.[e]??e}#Ce(e){return this.#P?.get(e)??this.#H.getVisibleIndex(e)??-1}#we(e){let t=this.#k;if(t.length===0)return;let n=this.#c,r=n==null?-1:t.indexOf(n),i=t[r<0?e>0?0:t.length-1:Math.min(t.length-1,Math.max(0,r+e))];i!=null&&this.focusPath(i)}#Te(e,t){let n=e==null?null:sE(e),r=this.#M;if(r!==n){if(r==null&&n!=null&&(this.#j=this.#ge()),this.#M=n,n==null)this.#_e(!0),this.#j=null,this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else if(n.length===0)this.#_e(!1),this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else{let e=this.#Ee();this.#je(e,!0)}t&&(this.#y?.(this.#M),this.#De())}}#Ee(){if(this.#M==null||this.#M.length===0)return this.#O.clear(),this.#c;let e=this.#M,t=this.#ue(),n=this.#fe(),r=[],i=new Set,a=null;for(let o=0;o<t.length;o+=1){if(!n[o].includes(e))continue;let s=t[o];r.push(s),i.add(s),a??=s}let o=this.#pe(),s=this.#me();for(let t=0;t<o.length;t+=1){if(!s[t].includes(e))continue;let n=o[t];i.has(n)||(r.push(n),i.add(n),a??=n)}this.#O=i;let c=this.#A===`hide-non-matches`&&r.length>0?new Set:null;this.#N=c;let l=this.#A===`expand-matches`?new Set(this.#j??[]):new Set;for(let e of r){c?.add(e),e.endsWith(`/`)&&l.add(e);for(let t of $T(e))l.add(t),c?.add(t)}return this.#ve(l),a??this.#c}#De(){for(let e of this.#t)e()}#Oe(e){this.#n.get(e.operation)?.forEach(t=>{t(e)}),this.#n.get(`*`)?.forEach(t=>{t(e)})}#ke(e){for(let t of $T(e))this.#H.isExpanded(t)||this.#H.expand(t);this.#H.isExpanded(e)||this.#H.expand(e)}#Ae(e){let t=this.#G;if(t===0)return;let n=this.#s===-1?0:this.#s,r=Math.min(t-1,Math.max(0,n+e));(r!==n||this.#s===-1)&&(!this.#l&&this.#F==null&&r>=this.#b.length&&this.#Ie(),this.#Fe(r))}#je(e,t=!0){let n=this.#H.getVisibleCount();this.#U=n;let r=pE(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,lE)),e,t?e=>this.#H.getVisibleIndex(e):void 0);this.#a.clear(),this.#o.clear(),this.#l=r.paths.length>=n,this.#u=r.getParentIndex,this.#b=r.paths,this.#x=r.posInSetByIndex,this.#S=r.setSizeByIndex,this.#ye(),this.#s=e==null?this.#be().length>0?0:-1:this.#Z(e),this.#c=this.#s<0?null:this.#Me(this.#s)}#Me(e){return this.#be()[e]??(this.#F==null?this.#H.getVisibleRowContext(e)?.row.path??null:null)}#Ne(e){return this.#H.getPathInfo(e)?.path??null}#Pe(e){if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t,!1)}#Fe(e,t=!0){let n=this.#Me(e);n!=null&&(this.#s!==e||this.#c!==n)&&(this.#s=e,this.#c=n,t&&this.#De())}#Ie(){this.#l||this.#je(this.#c,!0)}#Le(e){let t=qT(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=qT(this.#c,e,!0),r=[...this.#B].map(t=>qT(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=qT(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return QT(this.#B,o)||(this.#B=new Set(o),this.#V+=1),this.#z=a,n}#Re(){return this.#H.on(`*`,e=>{if(this.#W)return;e.canonicalChanged&&(this.#d.clear(),this.#he()),this.#i!=null&&WT(e)&&(this.#i=null);let t=WT(e)?this.#Le(e):this.#c,n=this.#M!=null&&this.#M.length>0?this.#Ee():this.#M===``?this.#c:t,r=this.#M!=null||e.operation!==`expand`&&e.operation!==`collapse`;this.#je(n,r),this.#De();let i=ZT(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},hE=e=>{if(e==null||e.length===0)return`0`;let t=`${e.length}`;for(let n of e)t+=`\0${n.path}\0${n.status}`;return t};function gE(e){let t=e.endsWith(`/`),n=``,r=-1;for(let t=0;t<=e.length;t+=1){if(e[t]!==`/`&&t!==e.length){r===-1&&(r=t);continue}r!==-1&&(n!==``&&(n+=`/`),n+=e.slice(r,t),r=-1)}return n===``?null:{isDirectory:t,path:n}}function _E(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=[],r=0;for(;;){let e=t.indexOf(`/`,r);if(e===-1)break;n.push(t.slice(0,e+1)),r=e+1}return n}function vE(e,t){return t?`${e}/`:e}function yE(e,t=null){let n=hE(e==null?void 0:[...e]);if(n===`0`)return null;if(t?.signature===n)return t;let r=new Map,i=new Set,a=new Set,o=new Map;for(let t of e??[]){let e=xE(t);e!=null&&wE({canonicalPath:e.canonicalPath,changeCountByDirectoryPath:o,directoriesWithChanges:i,ignoredDirectoryPaths:a,isDirectory:e.isDirectory,status:t.status,statusByPath:r})}return r.size===0?null:{changeCountByDirectoryPath:o,directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}function bE(e,t){let n=t?.remove??[],r=t?.set??[];if(n.length===0&&r.length===0)return e;let i=new Map(e?.statusByPath),a=new Set(e?.directoriesWithChanges),o=new Set(e?.ignoredDirectoryPaths),s=new Map(e?.changeCountByDirectoryPath),c=!1;for(let e of n){let t=SE(e);t!=null&&(c=CE({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,statusByPath:i})||c)}for(let e of r){let t=xE(e);t!=null&&(c=wE({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,isDirectory:t.isDirectory,status:e.status,statusByPath:i})||c)}return c?i.size===0?null:{changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,signature:DE(i),statusByPath:i}:e}function xE(e){return SE(e.path)}function SE(e){let t=gE(e);if(t!=null)return{canonicalPath:vE(t.path,t.isDirectory),isDirectory:t.isDirectory}}function CE({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,statusByPath:i}){let a=i.get(e);return a!=null&&(i.delete(e),a===`ignored`&&e.endsWith(`/`)&&r.delete(e),EE(t,n,e),!0)}function wE({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,isDirectory:i,status:a,statusByPath:o}){let s=o.get(e);return s!==a&&(s??TE(t,n,e),o.set(e,a),a===`ignored`&&i?r.add(e):i&&r.delete(e),!0)}function TE(e,t,n){for(let r of _E(n))e.set(r,(e.get(r)??0)+1),t.add(r)}function EE(e,t,n){for(let r of _E(n)){let n=(e.get(r)??0)-1;n>0?e.set(r,n):(e.delete(r),t.delete(r))}}function DE(e){let t=`${e.size}`;for(let[n,r]of e)t+=`\0${n}\0${r}`;return t}var OE=e=>e.trim().toLowerCase(),kE=e=>e.split(`/`).at(-1)??e,AE=e=>{let t=e.toLowerCase().split(`.`),n=[];for(let e=1;e<t.length;e+=1)n.push(t.slice(e).join(`.`));return n};function jE(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function ME(e){let t=Px(e),n=t.remap,r=new Map;for(let[e,n]of Object.entries(t.byFileName??{}))r.set(e.toLowerCase(),n);let i=new Map;for(let[e,n]of Object.entries(t.byFileExtension??{}))i.set(OE(e),n);let a=Object.entries(t.byFileNameContains??{}).map(([e,t])=>[e.toLowerCase(),t]);return{resolveIcon:(e,o)=>{if(e===`file-tree-icon-file`&&o!=null){let s=kE(o),c=s.toLowerCase(),l=r.get(c);if(l!=null)return jE(l,e);for(let[t,n]of a)if(c.includes(t))return jE(n,e);let u=AE(s);for(let t of u){let n=i.get(t);if(n!=null)return jE(n,e)}let d=Mx(t.set,s,u);if(d!=null&&t.set!==`none`){if(d==="default"){let t=n?.[e];if(t!=null)return jE(t,e)}return{name:Ax(d),remappedFrom:e,token:d}}}let s=n?.[e];return s==null?{name:e}:jE(s,e)}}}var NE,PE,FE,IE,LE,RE,zE,BE,VE,HE,UE={},WE=[],GE=Array.isArray,KE=WE.slice,qE=Object.assign;function JE(e){e&&e.parentNode&&e.remove()}function YE(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e!=`function`?i=t[a]:o[a]=t[a];return arguments.length>2&&(o.children=arguments.length>3?KE.call(arguments,2):n),XE(e,o,r,i,null)}function XE(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++PE,__i:-1,__u:0};return i==null&&NE.vnode!=null&&NE.vnode(a),a}function ZE(e){return e.children}function QE(e,t){this.props=e,this.context=t,this.__g=0}function $E(e,t){if(t==null)return e.__?$E(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?$E(e):null}function eD(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=n.__e;break}return eD(e)}}function tD(e){(8&e.__g||!(e.__g|=8)||!FE.push(e)||LE++)&&IE==NE.debounceRendering||((IE=NE.debounceRendering)||queueMicrotask)(nD)}function nD(){for(var e,t,n,r,i,a,o,s,c=1;FE.length;)FE.length>c&&FE.sort(RE),e=FE.shift(),c=FE.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=qE({},r)).__v=r.__v+1,NE.vnode&&NE.vnode(n),uD(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??$E(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,fD(a,n,o),n.__e!=i&&eD(n)));LE=0}function rD(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||WE,b=t.length;for(c=iD(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?UE:y[m.__i]||UE,m.__i=f,_=uD(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&hD(p.ref,null,m),u.push(m.ref,m.__c||h,m)),g==null&&h!=null&&(g=h),(v=!!(4&m.__u))||p.__k===m.__k?c=aD(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function iD(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(c=a+f,(o=e.__k[a]=typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?XE(null,o,null,null,null):GE(o)?XE(ZE,{children:o},null,null,null):o.constructor==null&&o.__b>0?XE(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,s=null,(l=o.__i=oD(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=$E(s)),gD(s,s));return r}function aD(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=aD(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=$E(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function oD(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&!(2&l.__u);if(l===null&&e.key==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function sD(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function cD(e,t,n,r,i){var a;n:if(t==`style`){if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||sD(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||sD(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(zE,`$1`)),(t=t.slice(2))[0].toLowerCase()!=t[0]&&(t=t.toLowerCase()),e.__l||={},e.__l[t+a]=n,n?r?n.l=r.l:(n.l=BE,e.addEventListener(t,a?HE:VE,a)):e.removeEventListener(t,a?HE:VE,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function lD(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=BE++;else if(t.u<n.l)return;return n(NE.event?NE.event(t):t)}}}function uD(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M=t.type;if(t.constructor!=null)return null;128&n.__u&&(c=!!(32&n.__u),n.__c.__z&&(s=t.__e=n.__e=(a=n.__c.__z)[0],n.__c.__z=null)),(d=NE.__b)&&d(t);n:if(typeof M==`function`)try{if(v=t.props,y=`prototype`in M&&M.prototype.render,b=(d=M.contextType)&&r[d.__c],x=d?b?b.props.value:d.__:r,n.__c?2&(f=t.__c=n.__c).__g&&(f.__g|=1,_=!0):(y?t.__c=f=new M(v,x):(t.__c=f=new QE(v,x),f.constructor=M,f.render=_D),b&&b.sub(f),f.props=v,f.state||(f.state={}),f.context=x,f.__n=r,p=!0,f.__g|=8,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&M.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=qE({},f.__s)),qE(f.__s,M.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&M.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&M.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),!(4&f.__g)&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)||t.__v==n.__v){for(t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),S=0;S<f._sb.length;S++)f.__h.push(f._sb[S]);f._sb=[],f.__h.length&&o.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__g&=-5,C=NE.__r,w=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),T=0;T<f._sb.length;T++)f.__h.push(f._sb[T]);f._sb=[]}else do f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++w<25);f.state=f.__s,f.getChildContext!=null&&(r=qE({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===ZE&&d.key==null&&(E=pD(d.props.children)),s=rD(e,GE(E)?E:[E],t,n,r,i,a,o,s,c,l,u),t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__g&=-4)}catch(e){if(t.__v=null,c||a!=null){if(e.then){for(D=0,O=!1,t.__u|=c?160:128,t.__c.__z=[],k=0;k<a.length;k++)(A=a[k])==null||O||(A.nodeType==8&&A.data==`$s`?(D>0&&t.__c.__z.push(A),D++,a[k]=null):A.nodeType==8&&A.data==`/$s`?(--D>0&&t.__c.__z.push(A),O=D===0,s=a[k],a[k]=null):D>0&&(t.__c.__z.push(A),a[k]=null));if(!O){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(j=a.length;j--;)JE(a[j]);dD(t)}}else t.__e=n.__e,t.__k=n.__k,e.then||dD(t);NE.__e(e,t,n)}else s=t.__e=mD(n.__e,t,n,r,i,a,o,c,l,u);return(d=NE.diffed)&&d(t),128&t.__u?void 0:s}function dD(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(dD)}function fD(e,t,n){for(var r=0;r<n.length;r++)hD(n[r],n[++r],n[++r]);NE.__c&&NE.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){NE.__e(e,t.__v)}})}function pD(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:GE(e)?e.map(pD):qE({},e)}function mD(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v=n.props,y=t.props,b=t.type;if(b==`svg`?i=`http://www.w3.org/2000/svg`:b==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(u=0;u<a.length;u++)if((m=a[u])&&`setAttribute`in m==!!b&&(b?m.localName==b:m.nodeType==3)){e=m,a[u]=null;break}}if(e==null){if(b==null)return l.createTextNode(y);e=l.createElementNS(i,b,y.is&&y),s&&=(NE.__m&&NE.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=KE.call(e.childNodes),v=n.props||UE,!s&&a!=null)for(v={},u=0;u<e.attributes.length;u++)v[(m=e.attributes[u]).name]=m.value;for(u in v)if(m=v[u],u!=`children`){if(u==`dangerouslySetInnerHTML`)f=m;else if(!(u in y)){if(u==`value`&&`defaultValue`in y||u==`checked`&&`defaultChecked`in y)continue;cD(e,u,null,m,i)}}for(u in _=1&n.__u,y)m=y[u],u==`children`?p=m:u==`dangerouslySetInnerHTML`?d=m:u==`value`?h=m:u==`checked`?g=m:s&&typeof m!=`function`||v[u]===m&&!_||cD(e,u,m,v[u],i);if(d)s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(f&&(e.innerHTML=``),rD(b==`template`?e.content:e,GE(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&$E(n,0),s,c,l),a!=null)for(u=a.length;u--;)JE(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||cD(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&cD(e,u,g,v[u],i))}return e}function hD(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){NE.__e(e,n)}}function gD(e,t,n){var r,i;if(NE.unmount&&NE.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||hD(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){NE.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&gD(r[i],t,n||typeof e.type!=`function`);n||JE(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function _D(e,t,n){return this.constructor(e,n)}function vD(e,t){var n,r,i,a;t==document&&(t=document.documentElement),NE.__&&NE.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=YE(ZE,null,[e]),i=[],a=[],uD(t,e,r||UE,UE,t.namespaceURI,r?null:t.firstChild?KE.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),fD(i,e,a)}function yD(e,t){e.__u|=32,vD(e,t)}NE={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t}}throw LE=0,e}},PE=0,QE.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=qE({},this.state);typeof e==`function`&&(e=e(qE({},n),this.props)),e&&qE(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),tD(this))},QE.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),tD(this))},QE.prototype.render=ZE,FE=[],LE=0,RE=function(e,t){return e.__v.__b-t.__v.__b},zE=/(PointerCapture)$|Capture$/i,BE=0,VE=lD(!1),HE=lD(!0);var bD=0;Array.isArray;function Q(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c&&typeof e!=`function`)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--bD,__i:-1,__u:0,__source:i,__self:a};return NE.vnode&&NE.vnode(l),l}var xD=16,SD=16,CD={};function wD({name:e,remappedFrom:t,token:n,width:r,height:i,viewBox:a,label:o,alignCapitals:s=!1}){"use no memo";let c=`#${e.replace(/^#/,``)}`,{width:l,height:u,viewBox:d}=CD[e]??{width:xD,height:SD},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return Q(`svg`,{"data-icon-name":t??e,"data-icon-token":n,"data-align-capitals":s,...o==null?{"aria-hidden":!0}:{"aria-label":o,role:`img`},viewBox:m,width:f,height:p,children:Q(`use`,{href:c})})}var TD=e=>e!==void 0&&/\s/.test(e),ED=(e,t)=>{let n=t=>TD(e[t-1])||TD(e[t]);if(!n(t))return t;for(let r=1;r<e.length;r++){let i=t-r;if(i>0&&!n(i))return i;let a=t+r;if(a<e.length&&!n(a))return a}return t},DD=e=>ED(e,Math.ceil(e.length/2)),OD=e=>{if(e.length<2)return[e,``];let t=DD(e);return[e.slice(0,t),e.slice(t)]},kD=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:DD(e);return[e.slice(0,r),e.slice(r)]},AD=e=>{if(e.length<4)return[e,``];let 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)]},jD=(e,{splitIndex:t}={})=>{if(typeof t!=`number`){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}return[e.slice(0,t),e.slice(t)]},MD=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=e.length-t;return[e.slice(0,n),e.slice(n)]},ND=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=t;return[e.slice(0,n),e.slice(n)]};function PD({children:e,marker:t,variant:n=`default`}){"use no memo";return Q(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:Q(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?Q(`span`,{"data-truncate-fade":!0}):t})})}function FD(e){"use no memo";let{mode:t,children:n}=e;return Q(`div`,{children:[Q(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?Q(`span`,{children:n}):n}),Q(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?Q(`span`,{children:n}):n})]})}function ID({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=Q(FD,{mode:t,children:e},`content`),o=Q(PD,{marker:n,mode:t,variant:r},`marker`),s=Q(`div`,{"data-truncate-fill":!0},`fill`);return Q(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:Q(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function LD({children:e,...t}){"use no memo";return Q(ID,{mode:`truncate`,...t,children:e})}function RD({children:e,...t}){"use no memo";return Q(ID,{mode:`fruncate`,...t,children:e})}function zD({children:e,contents:t,priority:n=`end`,split:r=`center`,minimumLength:i=12,className:a,style:o,...s}){"use no memo";let c=null,l=null;if(Array.isArray(t)){if(t.length!==2)return console.error(`MiddleTruncate: contents must be an array of two items`),null;c=Q(LD,{...s,children:t[0]}),l=Q(RD,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return Q(`div`,{className:a,style:o});if(e.length<i)return Q(n===`end`?RD:LD,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=OD:r===`extension`?t=kD:r===`leaf-path`&&(t=AD);else if(typeof r==`number`)t=jD,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=MD:e===`first`&&(t=ND)}else typeof r==`function`&&(t=r);t??=OD;let[f,p]=t(e,{priority:n,variant:s.variant,splitIndex:typeof u==`number`?u:void 0,splitOffset:typeof d==`number`?d:void 0}),m=f.length>=p.length,h=n===`equal`&&!m,g=n===`equal`&&m,_={},v={};h&&(_.marker=``),g&&(v.marker=``),c=Q(LD,{...s,..._,children:f}),l=Q(RD,{...s,...v,children:p})}return Q(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[Q(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),Q(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var BD={endIndex:-1,startIndex:-1};function VD(e,t,n){return Math.min(Math.max(e,t),n)}function HD(e,t){return e<0||t<e?BD:{endIndex:t,startIndex:e}}function UD(e){return e.startIndex<0||e.endIndex<e.startIndex}function WD(e,t){return UD(e)?0:(e.endIndex-e.startIndex+1)*t}function GD(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function KD(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function qD(e){let t=new Map;return e.forEach((e,n)=>{if(e.kind!==`directory`||!e.isExpanded)return;let r=e.ancestorPaths.length,i=t.get(r);if(i==null){t.set(r,[n]);return}i.push(n)}),t}function JD(e,t){let n=0,r=e.length-1,i=-1;for(;n<=r;){let a=Math.floor((n+r)/2),o=e[a];if(o==null)break;if(o<=t){i=a,n=a+1;continue}r=a-1}return i}function YD(e){let t=new Map,n=[];for(let r=0;r<e.length;r+=1){let i=e[r];if(i==null)continue;let a=i.kind===`directory`&&i.isExpanded?[...i.ancestorPaths,i.path]:i.ancestorPaths,o=0;for(;o<n.length&&o<a.length&&n[o]===a[o];)o+=1;for(let e=n.length-1;e>=o;--e){let i=n[e];i!=null&&t.set(i,r-1)}n.length=o;for(let e=o;e<a.length;e+=1){let t=a[e];t!=null&&n.push(t)}}let r=e.length-1;for(let e of n)t.set(e,r);return t}function XD(e,t,n){if(e.length===0||t<=0)return[];let r=YD(e),i=qD(e),a=[];for(let r=0;r<e.length;r+=1){let o=i.get(r);if(o==null||o.length===0)break;let s=t+r*n,c=JD(o,Math.min(e.length-1,Math.floor(s/n))),l=null;for(;c>=0;){let t=o[c],n=t==null?null:e[t]??null;if(n!=null&&(r===0||n.ancestorPaths[r-1]===a[r-1]?.path)){l=n;break}--c}if(l==null)break;a.push(l)}return a.map((i,a)=>{let o=a*n,s=(r.get(i.path)??e.length-1)+1;if(s>=e.length)return{row:i,top:o};let c=s*n-t;return{row:i,top:Math.min(o,c-n)}}).filter(e=>e.top+n>0)}function ZD(e,t){let n=t.totalRowCount??e.length,r=n*t.itemHeight,i=Math.max(0,t.viewportHeight),a=Math.max(0,Math.floor(t.overscan)),o=Math.max(0,r-i),s=VD(t.scrollTop,0,o),c=t.stickyRows??XD(e,s,t.itemHeight),l=c.reduce((e,n)=>Math.max(e,n.top+t.itemHeight),0),u=Math.min(r,s+l),d=Math.max(0,i-l),f=Math.max(0,r-u),p=GD(s,n,t.itemHeight),m=GD(u,n,t.itemHeight),h=l<=0||p<0||p>=n?-1:p,g=h===-1?-1:Math.min(n-1,m-1),_=h===-1||g<h?0:g-h+1,v=d<=0||m>=n?BD:HD(m,KD(u+d,n,t.itemHeight)),y=g+1,b=UD(v)?BD:HD(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=WD(b,t.itemHeight);return{occlusion:{firstOccludedIndex:h,lastOccludedIndex:g,occludedCount:_},physical:{itemHeight:t.itemHeight,maxScrollTop:o,overscan:a,scrollTop:s,totalHeight:r,totalRowCount:n,viewportHeight:i},projected:{contentHeight:f,paneHeight:d,paneTop:u},sticky:{height:l,rows:c},visible:v,window:{endIndex:b.endIndex,height:x,offsetTop:UD(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var QD={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},$D={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},eO=`Contains git status items`;function tO(e){return e.current?!0:(e.current=!0,!1)}function nO(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:i=0,viewportHeight:a}=e;if(n<0)return null;let o=Math.max(0,i),s=n*r,c=s+r;if(s<t+o){let e=Math.max(0,s-o);return e===t?null:e}if(c>t+a){let e=c-a;return e===t?null:e}return null}function rO(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return nO({currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:a,viewportHeight:s});if(n<0)return null;let c=Math.max(0,a),l=n*r,u=Math.max(0,s-c),d=i===`center`?c+Math.max(0,(u-r)/2):c,f=Math.max(0,o-s),p=Math.max(0,Math.min(l-d,f));return p===t?null:p}function iO(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,targetViewportOffset:i,totalHeight:a,viewportHeight:o}=e;if(n<0)return null;let s=Math.max(0,i),c=n*r,l=c+r,u=t+s,d=t+o;if(c>=u&&l<=d)return null;let f=Math.max(0,a-o),p=Math.max(0,Math.min(c-s,f));return p===t?null:p}function aO(e){if(e==null||!e.isConnected||e===document.body||e===document.documentElement)return!1;e.focus({preventScroll:!0});let t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement===e:document.activeElement===e}function oO(e){let t=e.getRootNode();if(t instanceof ShadowRoot){let e=t.activeElement;return e instanceof HTMLElement?e:null}let n=document.activeElement;return n instanceof HTMLElement&&e.contains(n)?n:null}function sO(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function cO(e,t){return e!=null&&e>0?e:t}function lO(e){let t=e.borderBoxSize,n=Array.isArray(t)?t[0]:t;return n!=null&&Number.isFinite(n.blockSize)&&n.blockSize>0?n.blockSize:e.contentRect.height>0?e.contentRect.height:null}function uO(e,t,n,r,i=0){let a=nO({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a!=null&&(e.scrollTop=a,!0)}function dO(e,t,n,r,i,a,o=0){let s=rO({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s!=null&&(e.scrollTop=s,!0)}function fO(e,t,n,r,i,a){let o=iO({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o!=null&&(e.scrollTop=o,!0)}function pO(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function mO(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function hO({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return Q(`input`,{ref:n,"data-item-rename-input":!0,...t?{"data-item-flattened-rename-input":!0}:{},"aria-label":e,value:r,onBlur:i,onInput:a,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation()})}function gO(e){let{row:t,mode:n,targetPath:r,ariaLabel:i,domId:a,isParked:o,itemHeight:s,features:c,state:l,extraStyle:u}=e,d=n===`sticky`,f=t.ancestorPaths.at(-1)??``,p={};return l.isFocusRinged&&(p[`data-item-focused`]=!0),t.isSelected&&(p[`data-item-selected`]=!0),l.isContextHovered&&(p[`data-item-context-hover`]=`true`),l.isDragTarget&&(p[`data-item-drag-target`]=!0),l.isDragging&&(p[`data-item-dragging`]=!0),l.effectiveGitStatus!=null&&(p[`data-item-git-status`]=l.effectiveGitStatus),l.containsGitChange&&(p[`data-item-contains-git-change`]=`true`),{"aria-expanded":!d&&t.kind===`directory`?t.isExpanded:void 0,"aria-haspopup":c.contextMenuEnabled?`menu`:void 0,"aria-label":i,"aria-level":d?void 0:t.level+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":c.actionLaneEnabled?c.contextMenuButtonVisibility:void 0,"data-item-context-menu-trigger-mode":c.contextMenuEnabled?c.contextMenuTriggerMode:void 0,"data-item-has-context-menu-action-lane":c.actionLaneEnabled?`true`:void 0,"data-item-has-git-lane":c.gitLaneActive?`true`:void 0,"data-item-parent-path":f.length>0?f:void 0,"data-item-parked":o?`true`:void 0,"data-item-path":r,"data-item-type":t.kind===`directory`?`folder`:`file`,"data-type":`item`,id:d?void 0:a,role:d?void 0:`treeitem`,style:{minHeight:`${s}px`,...u},tabIndex:!d&&t.isFocused?0:-1,...p}}function _O(e){let{event:t,mode:n,isSearchOpen:r,isDirectory:i}=e,a=t.ctrlKey||t.metaKey,o=t.shiftKey||a,s=t.shiftKey?{additive:a,kind:`range`}:a?{kind:`toggle`}:{kind:`single`};return{closeSearch:r,revealCanonical:n===`sticky`,selection:s,toggleDirectory:!o&&i}}var vO,yO,bO,xO,SO=Object.is,CO=0,wO=[],TO=NE,EO=TO.__b,DO=TO.__r,OO=TO.diffed,kO=TO.__c,AO=TO.unmount,jO=TO.__;function MO(e,t){TO.__h&&TO.__h(yO,e,CO||t),CO=0;var n=yO.__H||(yO.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function NO(e){return CO=1,PO(GO,e)}function PO(e,t,n){var r=MO(vO++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):GO(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);SO(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=yO,!yO.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,SO(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};yO.__f=!0;var a=yO.shouldComponentUpdate,o=yO.componentWillUpdate;yO.componentWillUpdate=function(e,t,n){if(4&this.__g){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},yO.shouldComponentUpdate=i}return r.__N||r.__}function FO(e,t){var n=MO(vO++,3);!TO.__s&&WO(n.__H,t)&&(n.__=e,n.u=t,yO.__H.__h.push(n))}function IO(e,t){var n=MO(vO++,4);!TO.__s&&WO(n.__H,t)&&(n.__=e,n.u=t,yO.__h.push(n))}function $(e){return CO=5,LO(function(){return{current:e}},[])}function LO(e,t){var n=MO(vO++,7);return WO(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function RO(e,t){return CO=8,LO(function(){return e},t)}function zO(){for(var e;e=wO.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(HO),e.__H.__h.forEach(UO),e.__H.__h=[]}catch(t){e.__H.__h=[],TO.__e(t,e.__v)}}TO.__b=function(e){yO=null,EO&&EO(e)},TO.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),jO&&jO(e,t)},TO.__r=function(e){DO&&DO(e),vO=0;var t=(yO=e.__c).__H;t&&(bO===yO?(t.__h=[],yO.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(HO),t.__h.forEach(UO),t.__h=[],vO=0)),bO=yO},TO.diffed=function(e){OO&&OO(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(wO.push(t)!==1&&xO===TO.requestAnimationFrame||((xO=TO.requestAnimationFrame)||VO)(zO)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),bO=yO=null},TO.__c=function(e,t){t.some(function(e){try{e.__h.forEach(HO),e.__h=e.__h.filter(function(e){return!e.__||UO(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],TO.__e(n,e.__v)}}),kO&&kO(e,t)},TO.unmount=function(e){AO&&AO(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{HO(e)}catch(e){t=e}}),n.__H=void 0,t&&TO.__e(t,n.__v))};var BO=typeof requestAnimationFrame==`function`;function VO(e){var t,n=function(){clearTimeout(r),BO&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);BO&&(t=requestAnimationFrame(n))}function HO(e){var t=yO,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),yO=t}function UO(e){var t=yO;e.__c=e.__(),yO=t}function WO(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!SO(t,e[n])})}function GO(e,t){return typeof t==`function`?t(e):t}function KO(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:Q(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return Q(ZE,{children:[Q(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:Q(LD,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function qO(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function JO(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function YO(e,t,n,r){return e.map((e,i)=>{let a=i*n,o=e.subtreeEndIndex+1;if(o>=r)return{row:e.row,top:a};let s=o*n-t;return{row:e.row,top:Math.min(a,s-n)}}).filter(e=>e.top+n>0)}function XO({controller:e,itemHeight:t,overscan:n,scrollTop:r,stickyFolders:i,viewportHeight:a}){let o=e.getVisibleCount(),s=i&&o>0?e.getStickyRowCandidates(r,t):[],c=s==null&&i&&o>0?e.getVisibleRows(0,o-1):[],l=ZD(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:YO(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?YO(u,1,t,o):i&&r<=0&&c.length>0?XD(c,1,t):l.sticky.rows;return{overlayHeight:d.reduce((e,n)=>Math.max(e,n.top+t),0),overlayRows:d,snapshot:l,visibleRows:c}}var ZO=400,QO=40,$O=18;function ek(e,t,n){let r=e,i=document.elementFromPoint?.bind(document)??null,a=r.elementFromPoint?.(t,n)??i?.(t,n)??null;return e instanceof ShadowRoot&&(a==null||!e.contains(a))?tk(e,t,n):a instanceof HTMLElement?a:null}function tk(e,t,n){let r=Array.from(e.querySelectorAll(`[data-type="item"], [data-item-flattened-subitem]`));for(let e=r.length-1;e>=0;e--){let i=r[e],a=i.getBoundingClientRect();if(t>=a.left&&t<=a.right&&n>=a.top&&n<=a.bottom)return i}return null}function nk(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return null;let n=t.dataset.itemPath??null;if(n==null)return null;let r=e?.closest?.(`[data-item-flattened-subitem]`),i=r instanceof HTMLElement?r.getAttribute(`data-item-flattened-subitem`)??null:null;if(i!=null&&i.endsWith(`/`))return{directoryPath:i,flattenedSegmentPath:i,hoveredPath:n,kind:`directory`};if(t.dataset.itemType===`folder`)return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`};let a=t.dataset.itemParentPath??null;return a==null||a.length===0?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:`root`}:{directoryPath:a,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`}}function rk(e){let 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 ik(){return navigator.vendor!==`Apple Computer, Inc.`}function ak(e,t){let n=e-t.top;if(n<QO)return-Math.ceil((QO-Math.max(0,n))/QO*$O);let r=t.bottom-e;return r<QO?Math.ceil((QO-Math.max(0,r))/QO*$O):0}function ok(e,t){if(e!=null){let t=QD[e];return t==null?null:{text:t,title:$D[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:eO}:null}function sk(e,t,n){if(t==null||t.size===0)return null;let r=[];for(let i=e.length-1;i>=0;--i){let a=e[i],o=n.get(a);if(o!=null){for(let e of r)n.set(e,o);return o?`ignored`:null}if(t.has(a)){n.set(a,!0);for(let e of r)n.set(e,!0);return`ignored`}r.push(a)}for(let e of r)n.set(e,!1);return null}function ck(e){return e!=null&&`toggle`in e}function lk(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function uk(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function dk(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function fk(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function pk(e,t){return t&&fk(e)||(e.ctrlKey||e.metaKey)&&lk(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var mk=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function hk(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&(t.dataset.fileTreeContextMenuRoot===`true`||t.dataset.type===`context-menu-anchor`||t.dataset.type===`context-menu-trigger`||t.getAttribute(`slot`)===`context-menu`))return!0;return!1}function gk(e){return{bottom:e.bottom,height:e.height,left:e.left,right:e.right,top:e.top,width:e.width,x:e.x,y:e.y}}function _k(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function vk(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function yk(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function bk(e,t,n){if(e==null)return null;let r=t.get(e)??null;if(r!=null)return r;let i=n.get(e)??null;return i?.dataset.itemParked===`true`?null:i}function xk(e){if(e==null)return[];let t=[];for(let n of e.querySelectorAll(`button[data-file-tree-sticky-row="true"]`)){if(!(n instanceof HTMLElement))continue;let e=n.dataset.fileTreeStickyPath;e!=null&&t.push(e)}return t}function Sk(e,t){if(e==null||t==null)return null;for(let 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}function Ck(e,t,n,r,i,a,o){let s=Math.max(0,a-i),c=t?.getBoundingClientRect()??null,l=c==null||n==null?null:n.getBoundingClientRect().top-c.top,u=Sk(e,r),d=c==null||u==null?null:u.getBoundingClientRect().top-c.top;return Math.max(0,Math.min(d??Math.max(l??0,s),Math.max(0,o-i)))}function wk(e,t){return{kind:e.kind,name:JO(e),path:t}}function Tk(e){return e==null?void 0:`${e}__tree`}function Ek(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function Dk(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function Ok(e,t){if(e==null)return null;if(`text`in e)return e.parts==null?Q(`span`,{title:e.title,children:e.text}):Q(`span`,{title:e.title,children:e.parts.map((e,t)=>Q(`span`,{style:{color:e.color},children:e.text},t))});let n=typeof e.icon==`string`?Dk(e.icon)?t(e.icon):{name:e.icon}:Dk(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return Q(`span`,{title:e.title,children:Q(wD,{...n})})}function kk(e){e!=null&&aO(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function Ak(e,t,{actionLaneEnabled:n=!1,customDecoration:r=null,decorationLaneEnabled:i=!1,dragTargetFlattenedSegmentPath:a=null,gitDecoration:o=null,gitLaneActive:s=!1,renameInput:c=null,showDecorativeActionAffordance:l=!1}={}){let u=qO(e);return Q(ZE,{children:[e.depth>0?Q(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>Q(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,Q(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?Q(wD,{...t(`file-tree-icon-chevron`)}):Q(wD,{...t(`file-tree-icon-file`,u)})}),Q(`div`,{"data-item-section":`content`,children:e.isFlattened?KO(e,c,a):c??Q(zD,{minimumLength:5,split:`extension`,children:e.name})}),i?Q(`div`,{"data-item-section":`decoration`,children:r==null?null:Ok(r,t)}):null,s?Q(`div`,{"data-item-section":`git`,children:Ok(o,t)}):null,n?Q(`div`,{"data-item-section":`action`,children:l?Q(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:Q(wD,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function jk(e,t,n,r={}){let{controller:i,renameView:a,visualFocusPath:o,contextHoverPath:s,draggedPathSet:c,dragTarget:l,dragAndDropEnabled:u,shouldSuppressContextMenu:d,handleRowDragStart:f,handleRowDragEnd:p,handleRowTouchStart:m,instanceId:h,itemHeight:g,gitStatusByPath:_,ignoredGitDirectories:v,ignoredInheritanceCache:y,directoriesWithGitChanges:b,gitLaneActive:x,contextMenuEnabled:S,contextMenuTriggerMode:C,contextMenuButtonTriggerEnabled:w,contextMenuButtonVisibility:T,contextMenuRightClickEnabled:E,registerRenameInput:D,registerButton:O,resolveIcon:k,renderDecorationForRow:A,openContextMenuForRow:j,onRowClick:M,onKeyDown:N}=e,P=qO(t),{isParked:F=!1,mode:I=`flow`,style:ee}=r,te=I===`sticky`,ne=_?.get(P)??null??sk(t.ancestorPaths,v,y),re=t.kind===`directory`&&(b?.has(P)??!1),L=A(t,P),R=ok(ne,re),ie=S&&w,ae=L!=null||x||ie,oe=ie&&T===`always`,se=a.getPath()===P,ce=se?a.getValue():``,z=te||!se?null:Q(hO,{ref:D,ariaLabel:`Rename ${JO(t)}`,isFlattened:t.isFlattened,value:ce,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),le=Ak(t,k,{actionLaneEnabled:ie,customDecoration:L,decorationLaneEnabled:ae,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:R,gitLaneActive:x,renameInput:z,showDecorativeActionAffordance:oe}),B={...gO({ariaLabel:JO(t),domId:t.isFocused?Ek(h,P,F):void 0,extraStyle:ee,features:{actionLaneEnabled:ie,contextMenuButtonVisibility:ie?T:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:F,itemHeight:g,mode:I,row:t,state:{containsGitChange:re,effectiveGitStatus:ne,isContextHovered:s===P,isDragTarget:l?.kind===`directory`&&l.directoryPath===P,isDragging:c?.has(P)===!0,isFocusRinged:t.isFocused&&o===P},targetPath:P}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),E&&(i.focusMountedPathFromInput(P),j(t,P,{anchorRect:_k(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:te?void 0:()=>{i.focusMountedPathFromInput(P)},onKeyDown:te?void 0:N,ref:e=>{O(P,e)}};return!te&&se?Q(`div`,{...B,children:le}):Q(`button`,{...B,type:`button`,draggable:u&&!F,onDragEnd:u&&!F?p:void 0,onDragStart:u&&!F?e=>{f(e,t,P)}:void 0,onMouseDown:e=>{if(te){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!F?e=>{m(e,t,P)}:void 0,onClick:e=>{M(e,t,P,I)},children:le})}function Mk(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(qO(e))).map((n,r)=>jk(e,n,t.start+r))}function Nk({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=Lx,overscan:c=10,renamingEnabled:l=!1,renderRowDecoration:u,searchBlurBehavior:d=`close`,searchEnabled:f=!1,searchFakeFocus:p=!1,slotHost:m,stickyFolders:h=!1,initialViewportHeight:g=420}){"use no memo";let _=$(null),v=$(null),y=$(!1),b=$(null),x=$(null),S=$(null),C=$(null),w=$(null),T=$(new Map),E=$(new Map),D=$(()=>{}),O=$(null),k=$(0),A=$(!1),j=$(null);j.current!==t&&(A.current=!1,j.current=t);let M=$(!1),N=$(null),P=$(null),F=$(!1),I=$(null),ee=$(null),te=$(null),ne=$(null),re=$(null),L=$(null),R=$(null),ie=$(null),ae=$(!1),oe=$(null),se=$(null),ce=$(null),z=$(null),le=LO(()=>new Map,[]),[,B]=NO(0),ue=$(!1),[de,fe]=NO(null),[V,pe]=NO(null),[me,he]=NO(null),[ge,_e]=NO(null),[ve,ye]=NO(0),[be,xe]=NO(null),Se=$(be);Se.current=be;let Ce=$(null),we=$(null),Te=$(null),Ee=$(null),De=$(null),Oe=$(!1),ke=()=>{we.current=null,Te.current=null,Ee.current=null},Ae=(e,t)=>{we.current=e,Te.current=null,Ee.current=t==null?null:{path:e,scrollTop:t}},je=(e,t)=>{we.current=null,Te.current={path:e,viewportOffset:t},Ee.current=null},Me=$(d===`retain`&&t.isSearchOpen()),[Ne,Pe]=NO(p);FO(()=>{p||Pe(!1)},[p]);let Fe=$(!1),Ie=RO(()=>{Fe.current=!0,Pe(e=>e&&!1)},[]),[Le,Re]=NO(()=>XO({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[ze,Be]=NO(!1);FO(()=>{Be(!0)},[]);let Ve=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,He=e?.contextMenu?.triggerMode??(Ve?`right-click`:`both`),Ue=He===`both`||He===`button`,H=e?.contextMenu?.buttonVisibility??`when-needed`,U=He===`both`||He===`right-click`;IO(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;De.current=t,pe(t),_e(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(Oe.current=e.detail?.disabled===!0)};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)}},[]);let We=RO((e,t)=>{yk(T.current,e,t)},[]),Ge=RO((e,t)=>{yk(E.current,e,t)},[]),Ke=RO(e=>{x.current=e},[]),qe=RO(e=>bk(e,E.current,T.current),[]),Je=n!=null||r!=null||i!=null,{resolveIcon:Ye}=LO(()=>ME(a),[a]),Xe=t[cE](),Ze=Xe.getPath(),Qe=Ze!=null,$e=t.isSearchOpen(),et=t.getSearchValue(),tt=t.getFocusedPath(),nt=t.getFocusedIndex(),rt=t.getScrollRequest(),it=t.isDragAndDropEnabled(),at=t.getDragSession(),ot=LO(()=>at==null?null:new Set(at.draggedPaths),[at]),st=at?.target??null,ct=at?.primaryPath??null,W=Tk(o),{overlayHeight:lt,overlayRows:ut,snapshot:dt,visibleRows:G}=Le,ft=dt.physical.viewportHeight,pt=LO(()=>({end:dt.window.endIndex,start:dt.window.startIndex}),[dt.window.endIndex,dt.window.startIndex]),mt=ut,ht=dt.sticky.rows,gt=dt.physical.totalHeight,_t=dt.sticky.height,vt=LO(()=>new Set(ht.map(e=>qO(e.row))),[ht]),yt=nt>=0&&nt>=pt.start&&nt<=pt.end,bt=RO((e,t)=>u?.({item:wk(e,t),row:e})??null,[u]),xt=RO(e=>aO(e==null?null:T.current.get(e)??null)?!0:aO(S.current),[]),St=RO(e=>{xt(t.focusNearestPath(e))},[t,xt]),Ct=$(St);Ct.current=St;let wt=$(!0),Tt=$(()=>{}),Et=RO((t=!0)=>{let n=Se.current;n!=null&&(wt.current=wt.current&&t,xe(null),e?.contextMenu?.onClose?.(),wt.current&&St(n.path))},[e?.contextMenu,St]);Tt.current=Et;let Dt=RO(e=>{let t=e==null?null:vk(S.current,e);he(e=>e===t?e:t)},[]),Ot=RO((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=qe(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;Ae(n,e?.scrollTop??null),M.current=!0,fe(e=>e===n?e:n)}i.focus(),Dt(a),wt.current=!0,xe({anchorRect:r?.anchorRect??null,item:wk(e,n),path:n,source:r?.source??`keyboard`})},[t,qe,Dt]),kt=RO(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=sO(e,ft);I.current=nt<0||e==null?null:Math.max(0,Math.min(nt*s-e.scrollTop,Math.max(0,t-s))),F.current=!0}t.startRenaming(e)!==!1&&(_e(`focus`),B(e=>e+1))}},[t,nt,s,l,ft]),At=RO((e,{restoreTreeFocus:n=!0,targetOffset:r=`live-overlay`}={})=>{let i=C.current;if(i==null)return!1;t.focusPath(e);let a=t.getFocusedIndex();if(a<0)return!1;let o=t.getVisibleRows(a,a)[0]??null;if(o==null)return!1;let l=sO(i,ft),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:XO({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return M.current=!0,fO(i,a,s,l,u,d),D.current(),Ce.current=n?e:null,!0},[t,s,c,ft,h]),jt=()=>y.current===!0||z.current!=null||ae.current===!0,Mt=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Nt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},Pt=()=>{ne.current!=null&&(clearTimeout(ne.current),ne.current=null),te.current=null},Ft=()=>{L.current?.remove(),L.current=null},It=()=>{Nt(ee.current),ee.current=null,re.current=null},Lt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Rt=()=>{ie.current?.(),ie.current=null,z.current!=null&&(clearTimeout(z.current),z.current=null),ae.current=!1,oe.current=null,ce.current=null,se.current!=null&&(se.current.setAttribute(`draggable`,`true`),se.current.style.removeProperty(`touch-action`),se.current=null),Ft(),Pt(),It(),R.current=null},zt=(e,n)=>{let r=S.current?.getRootNode(),i=nk(ek(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},Bt=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){Pt();return}let r=t.getItem(e.directoryPath),i=ck(r)?r:null;if(i==null||i.isExpanded()){Pt();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;te.current!==a&&(Pt(),te.current=a,ne.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind===`directory`&&n.directoryPath===e.directoryPath&&n.flattenedSegmentPath===e.flattenedSegmentPath&&i.expand()},n))},Vt=()=>{ee.current=null;let e=re.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=ak(e.clientY,r);if(i===0)return;let a=Math.max(0,n.scrollHeight-n.clientHeight),o=Math.max(0,Math.min(a,n.scrollTop+i));o!==n.scrollTop&&(n.scrollTop=o,D.current()),Bt(zt(e.clientX,e.clientY)),ee.current=Mt(Vt)},Ht=(e,t)=>{re.current={clientX:e,clientY:t},ee.current??=Mt(Vt)},Ut=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Rt(),Ft(),Pt(),It(),t.startDrag(r)===!1){e.preventDefault();return}if(R.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),ik())){let t=rk(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Lt(t),L.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Wt=()=>{Ft(),Pt(),It(),R.current=null,t.cancelDrag()},Gt=(e,n,r)=>{if(z.current!=null||ae.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;ce.current={clientX:i.clientX,clientY:i.clientY},se.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!ae.current;z.current!=null&&(clearTimeout(z.current),z.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),ie.current===o&&(ie.current=null),t&&(a.setAttribute(`draggable`,`true`),se.current===a&&(se.current=null),ce.current=null)},s=e=>{let t=e.touches[0],n=ce.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=100||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),ie.current=o,z.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),se.current===a&&(se.current=null),ce.current=null;return}ae.current=!0,se.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),R.current=n;let e=a.getBoundingClientRect(),s=rk(a);Object.assign(s.style,{height:`${e.height}px`,opacity:`0.85`,transform:`translate3d(${e.left}px, ${e.top}px, 0)`,width:`${e.width}px`}),Lt(s),L.current=s,oe.current={x:i.clientX-e.left,y:i.clientY-e.top};let c=e=>{let t=e.touches[0];if(t==null)return;e.preventDefault();let n=oe.current;n!=null&&L.current!=null&&(L.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),Bt(zt(t.clientX,t.clientY)),Ht(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&zt(n.clientX,n.clientY),t.completeDrag(),Rt()},u=()=>{t.cancelDrag(),Rt()};ie.current=()=>{document.removeEventListener(`touchmove`,c),document.removeEventListener(`touchend`,l),document.removeEventListener(`touchcancel`,u)},document.addEventListener(`touchmove`,c,{passive:!1}),document.addEventListener(`touchend`,l),document.addEventListener(`touchcancel`,u)},ZO)},Kt=e=>{if(be!=null){if(e.key===`Escape`){Et(),e.preventDefault(),e.stopPropagation();return}mk.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(Xe.isActive()){if(e.isComposing||e.keyCode===229)return;if(e.key===`Escape`)Xe.cancel();else if(e.key===`Enter`)Xe.commit();else return;_e(`focus`),B(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){kt(tt??void 0),e.preventDefault(),e.stopPropagation();return}if($e){if(e.key===`Escape`)F.current=!1,I.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=sO(n,ft);I.current=nt<0||n==null?null:Math.max(0,Math.min(nt*s-n.scrollTop,Math.max(0,r-s))),F.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;_e(`focus`),B(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&uk(e)){t.openSearch(e.key),B(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Ve&&fk(e),r=pk(e,Ve),i=r&&S.current!=null?oO(S.current):null,a=r?new Set(xk(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==tt&&a.has(o)){let e=C.current;Ae(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=ck(p)?p:null,h=u!=null&&(vt.has(u)||c&&o===u&&a.has(u)),g=e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`ArrowRight`&&m!=null&&m.isExpanded(),_=e.key===`ArrowLeft`&&h&&m!=null&&m.isExpanded(),v=C.current,y=!0;if(e.shiftKey&&e.key===`ArrowDown`)t.extendSelectionFromFocused(1);else if(e.shiftKey&&e.key===`ArrowUp`)t.extendSelectionFromFocused(-1);else if(n&&u!=null&&d>=0){let e=t.getVisibleRows(d,d)[0]??null,n=bk(u,E.current,T.current);e==null||n==null?y=!1:Ot(e,u)}else if((e.ctrlKey||e.metaKey)&&lk(e))t.toggleFocusedSelection();else if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`a`)t.selectAllVisiblePaths();else switch(e.key){case`ArrowDown`:t.focusNextItem();break;case`ArrowUp`:t.focusPreviousItem();break;case`ArrowRight`:m==null||m.isExpanded()?t.focusNextItem():m.expand();break;case`ArrowLeft`:m!=null&&m.isExpanded()?m.collapse():t.focusParentItem();break;case`Home`:t.focusFirstItem();break;case`End`:t.focusLastItem();break;default:y=!1}if(!y)return;_e(`focus`);let b=t.getFocusedPath(),x=b!=null&&(vt.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))Ae(b,v?.scrollTop??null),M.current=!0,fe(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(je(b,Ck(S.current,v,i,u,s,_t,ft)),M.current=!0,fe(e=>e===b?e:b)):ke()}B(e=>e+1),e.preventDefault(),e.stopPropagation()};IO(()=>{if(!(!f||!$e)){if(Me.current){Me.current=!1;return}aO(w.current)}},[$e,f]),IO(()=>{let e=x.current;switch(mO({hasRenderedInput:e!=null,previousRenamingPath:P.current,renamingPath:Ze})){case`reset`:P.current=null;return;case`reveal-canonical`:Ze!=null&&At(Ze,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(Ce.current=null,P.current=Ze,aO(e),e.select());return}},[pt.end,pt.start,Ze,At,vt]),IO(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=oO(e)?.dataset.itemPath??null;fe(e=>e===t?e:t)},i=()=>{n(),M.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,oO(e)!=null){r();return}M.current=!1,fe(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),M.current=!1,fe(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;fe(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),IO(()=>{let e=S.current;e!=null&&(dt.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[dt.physical.scrollTop]),IO(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=sO(n,g);let a=()=>{let e=t.getVisibleCount(),r=cO(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Re(XO({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};if(!A.current){A.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=cO(O.current,g),i=t.getVisibleRows(e,e)[0]??null;uO(n,e,s,r,h&&i!=null?Math.max(0,Math.min(i.ancestorPaths.length*s,Math.max(0,r-s))):0)}}D.current=a;let o=t.subscribe(()=>{tO(ue)&&B(e=>e+1),a()}),l=()=>{Oe.current!==!0&&(r!=null&&(r.dataset.isScrolling??=``),i!=null&&(i.dataset.isScrolling??=``),y.current=!0,e!=null&&clearTimeout(e),e=setTimeout(()=>{r!=null&&delete r.dataset.isScrolling,i!=null&&delete i.dataset.isScrolling,y.current=!1,ye(e=>e+1),e=null},50))},u=null,d=()=>{i!=null&&delete i.dataset.overlayReveal,u!=null&&(clearTimeout(u),u=null)},f=()=>{i!=null&&Oe.current!==!0&&(n.scrollTop>0||(i.dataset.overlayReveal=`true`,u!=null&&clearTimeout(u),u=setTimeout(()=>{d()},200)))},p=()=>{if(a(),n.scrollTop>0&&d(),Se.current!=null&&y.current&&Tt.current(),Oe.current===!0){y.current=!1;return}pe(e=>e==null?e:null),l()},m=()=>{l(),f()},_=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),v=e=>{_.has(e.key)&&m()};n.addEventListener(`scroll`,p,{passive:!0}),n.addEventListener(`wheel`,m,{passive:!0}),n.addEventListener(`touchmove`,m,{passive:!0}),n.addEventListener(`keydown`,v);let x=typeof ResizeObserver<`u`?new ResizeObserver(e=>{O.current=(e[0]==null?null:lO(e[0]))??sO(n,g),a()}):null;return x?.observe(n),()=>{D.current=()=>{},o(),n.removeEventListener(`scroll`,p),n.removeEventListener(`wheel`,m),n.removeEventListener(`touchmove`,m),n.removeEventListener(`keydown`,v),e!=null&&clearTimeout(e),u!=null&&clearTimeout(u),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),y.current=!1,O.current=null,x?.disconnect()}},[t,g,s,c,h]),IO(()=>{Ve||be==null||Et(!1)},[Et,Ve,be]);let qt=LO(()=>be==null?null:`${be.path}::${be.source}`,[be]);IO(()=>{if(qt==null){m?.clearSlotContent(fb);return}let t=Se.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??gk(n.getBoundingClientRect()),close:e=>{Tt.current(e?.restoreFocus??!0)},restoreFocus:()=>{wt.current&&Ct.current(Se.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(fb,i),e?.contextMenu?.onOpen?.(t.item,r),kk(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&kk(i)}),()=>{m?.clearSlotContent(fb)}},[qt,e?.contextMenu,m]),IO(()=>{be!=null&&t.getItem(be.path)==null&&Et()},[Et,be,t]),IO(()=>{if(be==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(hk(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&Et())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),Et())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[Et,be]),IO(()=>{let e=C.current,n=S.current;if(e==null||n==null){N.current=tt;return}let r=tt==null?null:T.current.get(tt)??null,i=oO(n),a=i?.dataset.itemPath??null,o=Qe&&x.current===i,c=f&&w.current===i,l=F.current&&!$e,u=I.current??0,d=Ce.current,p=we.current,m=Te.current,g=Ee.current,_=i!=null,v=M.current||_,y=N.current!==tt,b=p!=null&&p===tt&&tt!=null,E=!1,O=!1;if(rt!=null&&rt.id!==k.current){k.current=rt.id;let n=rt.visibleIndex,r=t.getVisibleRows(n,n)[0]??null;if(r!=null){let t=h?Math.max(0,Math.min(r.ancestorPaths.length*s,Math.max(0,ft-s))):_t;E=!0,O=dO(e,n,s,ft,gt,rt.offset,t)}t.clearScrollRequest(rt.id)}let A=!E&&l&&fO(e,nt,s,ft,gt,u),j=!E&&d!=null&&d===tt&&fO(e,nt,s,ft,gt,_t),P=!E&&m!=null&&m.path===tt&&fO(e,nt,s,ft,gt,m.viewportOffset),ee=!E&&g!=null&&g.path===tt&&e.scrollTop!==g.scrollTop;if(ee&&(e.scrollTop=g.scrollTop),(ee||O||j||P||A||v&&y&&d!==tt&&!b&&uO(e,nt,s,ft,_t))&&D.current(),E){N.current=tt;return}if(!v){N.current=tt;return}if(o){N.current=tt;return}if(c&&!l){N.current=tt;return}if(r==null){l&&nt>=0&&(fO(e,nt,s,ft,gt,u),D.current()),N.current=tt;return}(y||l||d===tt||p===tt||m?.path===tt||g?.path===tt||a==null||a!==tt)&&(aO(r),d===tt&&(Ce.current=null),p===tt&&(we.current=null),m?.path===tt&&(Te.current=null),g?.path===tt&&(Ee.current=null),F.current=!1,I.current=null),N.current=tt},[t,nt,tt,yt,s,Qe,$e,pt,ft,f,rt,h,_t,gt,G]);let Jt=nt>=0&&nt>=dt.visible.startIndex&&nt<=dt.visible.endIndex,Yt=tt!=null&&mt.some(e=>qO(e.row)===tt),Xt=Jt||Yt,Zt=Ue&&M.current===!0&&Xt?tt:null,Qt=ge===`pointer`?V:null,$t=be?.path??De.current??Qt??Zt??V,en=be?.source===`right-click`;IO(()=>{y.current&&be==null||Dt(qe($t))},[be,qe,pt,ft,ve,mt,$t,Dt,G]);let tn=RO(e=>{if(y.current||hk(e))return;let t=e.target;if(!(t instanceof HTMLElement)||t.closest?.(`[data-type="context-menu-trigger"]`)!=null)return;let n=t.closest?.(`[data-file-tree-sticky-row="true"]`),r=t.closest?.(`[data-type="item"]`),i=n instanceof HTMLElement?n.dataset.fileTreeStickyPath??null:r instanceof HTMLElement?r.dataset.itemPath??null:null;i!=null&&_e(e=>e===`pointer`?e:`pointer`),pe(e=>e===i?e:i)},[]),K=RO(()=>{pe(null)},[]);IO(()=>{if(!it)return;let e=()=>{Rt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Rt(),t.cancelDrag()}},[t,it]);let nn=e=>{if(!it||t.getDragSession()==null||ae.current)return;let n=nk(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),Bt(t.getDragSession()?.target??null),Ht(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},rn=e=>{if(!it||t.getDragSession()==null||ae.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(Pt(),It(),t.setDragTarget(null))},an=e=>{!it||t.getDragSession()==null||ae.current||(e.preventDefault(),zt(e.clientX,e.clientY),t.completeDrag(),Ft(),Pt(),It(),R.current=null)},on=dt.window.height,sn=dt.window.offsetTop,cn=Math.min(0,ft-on),ln=Math.min(0,ft-on-_t),un=de===tt||F.current,dn=tt!=null&&un&&!yt&&nt>=0?G[nt]??t.getVisibleRows(nt,nt)[0]??null:null,fn=dn==null?null:pO(nt,s,pt,on),pn=R.current,mn=ct!=null&&pn!=null&&pn.path===ct&&pn.index>=pt.start&&pn.index<=pt.end,hn=ct!=null&&pn!=null&&pn.path===ct&&!mn&&pn.path!==dn?.path?pn:null,gn=hn==null?null:pO(hn.index,s,pt,on),_n=dk((nt>=0?G[nt]??t.getVisibleRows(nt,nt)[0]??null:null)?.ancestorPaths.at(-1)??null),vn=$e&&tt!=null?Ek(o,tt,!yt):void 0,yn=be?.path??($e?tt:de),bn=be?.path??V,xn=qe($t),Sn=Ve&&Ue&&!en&&!Qe&&xn!=null&&me!=null&&$t!=null,Cn=Ve&&(Sn||be!=null),wn=be?.anchorRect,Tn=wn==null&&xn!=null&&me!=null&&(be!=null||Sn)?me:null,En=wn==null?Tn==null?void 0:{top:`${Tn}px`}:{left:`${wn.left}px`,position:`fixed`,right:`auto`,top:`${wn.top}px`},Dn=en?{opacity:`0`}:void 0,On=RO((e,n,r,i)=>{let a=_O({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:$e,mode:i}),o=a.toggleDirectory&&n.kind===`directory`,s=o?t.resolveMountedDirectoryPathFromInput(r):null;if(o&&s==null)return;let c=s??r;switch(a.selection.kind){case`range`:t.selectPathRange(c,a.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(c);break;case`single`:t.selectOnlyMountedPathFromInput(c)}let l=e.currentTarget instanceof HTMLElement?e.currentTarget:null,u=n.index>=dt.visible.startIndex&&n.index<=dt.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(M.current=!0,fe(e=>e===c?e:c),_e(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&At(c,{targetOffset:`sticky-parents`})},[t,$e,dt.visible.endIndex,dt.visible.startIndex,At]),kn=()=>{if(y.current||!Ue||$t==null||xn==null)return;let e=t.getItem($t);e!=null&&(Dt(xn),wt.current=!0,xe({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:xn.getAttribute(`aria-label`)??$t,path:e.getPath()},path:e.getPath(),source:`button`}))},An={contextHoverPath:bn,contextMenuButtonTriggerEnabled:Ue,contextMenuButtonVisibility:H,contextMenuEnabled:Ve,contextMenuRightClickEnabled:U,contextMenuTriggerMode:He,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:it,draggedPathSet:ot,dragTarget:st,gitLaneActive:Je,gitStatusByPath:n,handleRowDragEnd:Wt,handleRowDragStart:Ut,handleRowTouchStart:Gt,ignoredGitDirectories:r,ignoredInheritanceCache:le,instanceId:o,itemHeight:s,onKeyDown:Kt,onRowClick:On,openContextMenuForRow:Ot,registerButton:We,registerRenameInput:Ke,renameView:Xe,renderDecorationForRow:bt,resolveIcon:Ye,shouldSuppressContextMenu:jt,visualFocusPath:yn},jn={...An,registerButton:Ge};return Q(`div`,{ref:S,id:W,"data-file-tree-context-menu-button-visibility":Ve&&Ue?H:void 0,"data-file-tree-context-menu-trigger-mode":Ve?He:void 0,"data-file-tree-has-context-menu-action-lane":Ve&&Ue?`true`:void 0,"data-file-tree-has-git-lane":Je?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:it?rn:void 0,onDragOver:it?nn:void 0,onDrop:it?an:void 0,onKeyDown:Kt,onPointerLeave:Ve?K:void 0,onPointerOver:Ve?tn:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[Q(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:_n}}),Q(`slot`,{name:db,"data-type":`header-slot`}),f?Q(`div`,{"data-file-tree-search-container":!0,"data-open":$e?`true`:`false`,children:Q(`input`,{ref:w,"aria-activedescendant":vn,"aria-controls":W,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Ne?`true`:void 0,value:et,onBlur:()=>{d===`retain`&&!Fe.current||t.closeSearch()},onFocus:Ie,onPointerDown:Ie,onInput:e=>{Ie();let n=e.currentTarget;t.setSearch(n.value)}})}):null,Q(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&ze&&mt.length>0?Q(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:Q(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${lt}px`},children:mt.map((e,t)=>jk(jn,e.row,`sticky:${qO(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${mt.length-t}`}}))})}):null,Q(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${gt}px`},children:[Q(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${sn}px`}}),Q(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${on}px`,top:`${cn}px`,bottom:`${ln}px`},children:[Mk(An,pt,vt),dn!=null&&fn!=null?jk(An,dn,`parked:${dn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:ct===dn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${fn}px`}}):null,hn!=null&&gn!=null?jk(An,hn,`parked-drag:${hn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${gn}px`}}):null]})]})]}),Ve?Q(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":Cn?`true`:`false`,style:En,children:[Q(`button`,{ref:v,type:`button`,"data-type":pb,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":be==null?`false`:`true`,"data-visible":Sn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),be!=null){Et();return}kn()},tabIndex:-1,style:Dn,children:Q(wD,{...Ye(`file-tree-icon-ellipsis`)})}),be==null?null:Q(`slot`,{name:fb})]}):null,be==null?null:Q(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),Et()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),Et()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var Pk={hydrateRoot:(e,t)=>{yD(YE(Nk,t),e)},renderRoot:(e,t)=>{vD(YE(Nk,t),e)},unmountRoot:e=>{vD(null,e)}};function Fk(e,t){Pk.renderRoot(e,t)}function Ik(e,t){Pk.hydrateRoot(e,t)}function Lk(e){Pk.unmountRoot(e)}var Rk=class{#e=new Map;#t=null;clearAll(){for(let e of this.#e.values())e.remove();this.#e.clear()}clearSlotContent(e){let t=this.#n(e);t!=null&&(t.remove(),this.#e.delete(e))}setHost(e){if(this.#t=e,e!=null){this.#i(e);for(let[e,t]of this.#e)this.#r(e,t)}}setSlotContent(e,t){let n=this.#n(e);if(n===t){t!=null&&(this.#e.set(e,t),this.#r(e,t));return}if(n?.remove(),t==null){this.#e.delete(e);return}this.#e.set(e,t),this.#r(e,t)}setSlotHtml(e,t){let n=t?.trim()??``;if(n.length===0){this.setSlotContent(e,null);return}let r=this.#n(e);if(r!=null&&r.innerHTML===n){this.#e.set(e,r),this.#r(e,r);return}let i=document.createElement(`div`);i.innerHTML=n,this.setSlotContent(e,i)}#n(e){let t=this.#e.get(e)??null;if(t!=null)return t;let n=this.#t;if(n==null)return null;for(let t of Array.from(n.children))if(t instanceof HTMLElement&&t.dataset.fileTreeManagedSlot===e)return t;return null}#r(e,t){t.slot=e,t.dataset.fileTreeManagedSlot=e,this.#t!=null&&t.parentNode!==this.#t&&this.#t.appendChild(t)}#i(e){for(let t of Array.from(e.children)){if(!(t instanceof HTMLElement))continue;let e=t.dataset.fileTreeManagedSlot;e==null||this.#e.has(e)||this.#e.set(e,t)}}};Array.isArray;var zk=0;function Bk(e){return e!=null&&e.length>0?e:(zk+=1,`pst_ft_${zk}`)}function Vk({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??Lx)}function Hk(e){if(typeof document>`u`)return;let t=document.createElement(`div`);t.innerHTML=e;let n=t.querySelector(`svg`);return n instanceof SVGElement?n:void 0}function Uk(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 Wk(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var Gk=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new Rk;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y=null;#b;#x=!1;#S=!1;constructor(e){let{composition:t,density:n,fileTreeSearchMode:r,gitStatus:i,id:a,initialSearchQuery:o,icons:s,itemHeight:c,onSearchChange:l,onSelectionChange:u,overscan:d,renderRowDecoration:f,renaming:p,search:m,searchBlurBehavior:h,searchFakeFocus:g,stickyFolders:_,unsafeCSS:v,initialVisibleRowCount:y,...b}=e;this.#e=t,this.#n=Bk(a),this.#p=yE(i),this.#m=s,this.#h=v,this.#r=u,this.#i=f,this.#a=p!=null&&p!==!1,this.#o=h,this.#s=m===!0,this.#c=g===!0,this.#u=Ix(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new mE({...b,fileTreeSearchMode:r,initialSearchQuery:o,onSearchChange:l,renaming:p}),this.#v=this.#t.getSelectionVersion(),this.#y=this.#r==null?null:this.subscribe(()=>{this.#D()})}unmount(){this.#b!=null&&(Lk(this.#b),delete this.#b.dataset.fileTreeVirtualizedWrapper,this.#b=void 0),this.#l.clearAll(),this.#l.setHost(null),this.#f!=null&&(delete this.#f.dataset.fileTreeVirtualized,this.#I(this.#f),this.#f=void 0)}cleanUp(){this.unmount(),this.#y?.(),this.#y=null,this.#t.destroy()}getFileTreeContainer(){return this.#f}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getFocusedIndex(){return this.#t.getFocusedIndex()}getVisibleCount(){return this.#t.getVisibleCount()}getVisibleRows(e,t){return this.#t.getVisibleRows(e,t)}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}focusFirstItem(){this.#t.focusFirstItem()}focusLastItem(){this.#t.focusLastItem()}focusNextItem(){this.#t.focusNextItem()}focusPreviousItem(){this.#t.focusPreviousItem()}focusParentItem(){this.#t.focusParentItem()}scrollToPath(e,t){this.#t.scrollToPath(e,t)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}applyGitStatusPatch(e){let t=bE(this.#p,e);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&Fk(n.wrapper,this.#w())}move(e,t,n){this.#t.move(e,t,n)}onMutation(e,t){return this.#t.onMutation(e,t)}setSearch(e){this.#t.setSearch(e)}openSearch(e){this.#t.openSearch(e)}closeSearch(){this.#t.closeSearch()}isSearchOpen(){return this.#t.isSearchOpen()}getSearchValue(){return this.#t.getSearchValue()}getSearchMatchingPaths(){return this.#t.getSearchMatchingPaths()}focusNextSearchMatch(){this.#t.focusNextSearchMatch()}focusPreviousSearchMatch(){this.#t.focusPreviousSearchMatch()}startRenaming(e,t){return this.#t.startRenaming(e,t)}remove(e,t){this.#t.remove(e,t)}resetPaths(e,t){Array.isArray(e)?this.#t.resetPaths(e,t):this.#t.resetPaths(e)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),Fk(t.wrapper,this.#w()))}setGitStatus(e){let t=yE(e,this.#p);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&Fk(n.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),Fk(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),Ik(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),Fk(r,this.#w())}#C(){return{initialViewportHeight:Vk({initialVisibleRowCount:this.#d.initialVisibleRowCount,itemHeight:this.#d.itemHeight}),itemHeight:this.#d.itemHeight,overscan:this.#d.overscan,stickyFolders:this.#d.stickyFolders}}#w(){return{composition:this.#e,controller:this.#t,gitStatusByPath:this.#p?.statusByPath,ignoredGitDirectories:this.#p?.ignoredDirectoryPaths,directoriesWithGitChanges:this.#p?.directoriesWithChanges,icons:this.#m,instanceId:this.#n,renamingEnabled:this.#a,renderRowDecoration:this.#i,searchBlurBehavior:this.#o,searchEnabled:this.#s,searchFakeFocus:this.#c,slotHost:this.#l,...this.#C()}}#T(){let e=this.#f,t=this.#b;return e==null||t==null?null:{host:e,wrapper:t}}#E(e,t){let n=e.shadowRoot;n!=null&&(this.#k(n),this.#A(n)),this.#j(t)}#D(){let e=this.#r;if(e==null)return;let t=this.#t.getSelectionVersion();t!==this.#v&&(this.#v=t,e(this.#t.getSelectedPaths()))}#O(){let e=this.#e?.header?.render;if(e!=null){this.#l.setSlotContent(db,e());return}this.#l.setSlotHtml(db,this.#e?.header?.html??null)}#k(e){let t=Wk(e).find(e=>Uk(e)),n=Hk(kx(Px(this.#m).set));n!=null&&(t==null||t.outerHTML!==n.outerHTML)&&(t==null?e.prepend(n):t.replaceWith(n))}#A(e){let t=Wk(e),n=t.find(e=>Uk(e)),r=t.filter(e=>e!==n),i=Px(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=Hk(i);if(a==null){for(let e of r)e.remove();return}if(r.length!==1||r[0].outerHTML!==a.outerHTML){for(let e of r)e.remove();e.appendChild(a)}}#j(e){let t=Px(this.#m);t.colored&&jx(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${sb}]`);if(this.#g==null&&t instanceof HTMLStyleElement&&(this.#g=t),this.#h==null||this.#h===``){this.#g?.remove(),this.#g=void 0,this.#_=void 0;return}(this.#g?.parentNode!==e||this.#_!==this.#h)&&(this.#g??=document.createElement(`style`),this.#g.setAttribute(sb,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=Vx(this.#h),this.#_=this.#h)}#N(e){if(this.#b!=null)return this.#b;let t=e.shadowRoot;if(t==null)throw Error(`FileTree requires a shadow root`);let n=Array.from(t.children).filter(e=>e instanceof HTMLDivElement&&typeof e.dataset.fileTreeId==`string`&&e.dataset.fileTreeId.length>0),r=n.find(e=>e.dataset.fileTreeId===this.#n)??n[0];return r!=null&&(this.#n=r.dataset.fileTreeId??this.#n),this.#b=r??document.createElement(`div`),this.#b.dataset.fileTreeId=this.#n,this.#b.dataset.fileTreeVirtualizedWrapper=`true`,this.#E(e,this.#b),this.#b.parentNode!==t&&t.appendChild(this.#b),this.#b}#P(e,t){let n=e??this.#f??document.createElement(`file-tree-container`);t!=null&&n.parentNode!==t&&t.appendChild(n);let r=n.shadowRoot??n.attachShadow({mode:`open`});return qx(n,r),this.#M(r),n.dataset.fileTreeVirtualized=`true`,n.style.display=`flex`,this.#F(n),this.#l.setHost(n),this.#f=n,n}#F(e){e.style.getPropertyValue(`--trees-item-height`)===``&&(e.style.setProperty(`--trees-item-height`,`${String(this.#u.itemHeight)}px`),this.#x=!0),e.style.getPropertyValue(`--trees-density-override`)===``&&(e.style.setProperty(`--trees-density-override`,String(this.#u.factor)),this.#S=!0)}#I(e){this.#x&&=(e.style.removeProperty(`--trees-item-height`),!1),this.#S&&=(e.style.removeProperty(`--trees-density-override`),!1)}};function Kk(e){let[t]=(0,q.useState)(()=>new Gk(e)),n=(0,q.useRef)({timeout:null,model:t});return(0,q.useEffect)(()=>{let{current:e}=n;return e.timeout!=null&&(clearTimeout(e.timeout),e.timeout=null),()=>{e.timeout=setTimeout(()=>e.model.cleanUp(),1)}},[]),{model:t}}function qk(e){return e.name.startsWith(`.`)}function Jk(e,t,n=0){return mi(e,_o,Pr.of(e,`tree`,e?.capabilities.version??0,t,n),async(e,r)=>{let i=await e.list({path:t,offset:n,limit:256});return r.throwIfAborted(),{...i,entries:i.entries.filter(e=>!qk(e))}})}function Yk(){return{known:new Set,projected:new Map}}function Xk(e,t){t.known.clear(),t.projected.clear(),e.resetPaths([])}function Zk(e,t,n){t.length===0&&Xk(e,n);for(let{request:r,listing:i}of t){let t=`${r?.path??i.path}:${String(r?.offset??0)}`,a=i.entries.filter(e=>e.type!==`symlink`).map(e=>Qk(i.path,e.name,e.type)),o=n.projected.get(t)??[];n.projected.set(t,a);let s=new Set([...n.projected.values()].flat());for(let t of o)if(!s.has(t)){e.getItem(t)&&e.remove(t,{recursive:!0});for(let e of n.known)(e===t||t.endsWith(`/`)&&e.startsWith(t))&&n.known.delete(e)}$k(e,i,n.known)}}function Qk(e,t,n){return`${e.endsWith(`/`)?e:`${e}/`}${t}${n===`directory`?`/`:``}`}function $k(e,t,n){let r=t.entries.filter(e=>e.type!==`symlink`).map(e=>Qk(t.path,e.name,e.type)),i=r.filter(t=>!n.has(t)&&!e.getItem(t));i.length>0&&e.batch(i.map(e=>({type:`add`,path:e}))),n.add(t.path);for(let e of r)n.add(e);return i}function eA(e,t){let n=t===`/`?`/`:t.replace(/\/+$/,``);if(n!==`/`&&e!==n&&!e.startsWith(`${n}/`))return[];let r=n===`/`?e.split(`/`).filter(Boolean):e.slice(n.length).split(`/`).filter(Boolean),i=[n],a=n;for(let e of r.slice(0,-1))a=`${a===`/`?``:a}/${e}`,i.push(a);return i}function tA({app:e,rootPath:t,activePath:n}){let r=on(),i=zf(e),a=(0,q.useCallback)(t=>e.capabilities.subscribe(t),[e]),o=(0,q.useCallback)(()=>e.capabilities.version,[e]),s=(0,q.useSyncExternalStore)(a,o,o),c=(0,q.useMemo)(()=>({app:e,rootPath:t,computerId:i,version:s}),[e,t,i,s]),[l,u]=(0,q.useState)(null),d=l?.scope===c?l:null,f=n?eA(n,t):[],p=d?.activePath===n?d.path:f.at(-1)??t,m=new Map;for(let e of[t,...f])m.set(`${e}:0`,{path:e,offset:0});for(let e of d?.pages??[])m.set(`${e.path}:${String(e.offset)}`,e);let h=[...m.values()],g=(t,n)=>Pr.of(e,`tree`,s,t,n);return{scope:c,snapshot:Hs({queries:h.map(({path:t,offset:n})=>Jk(e,t,n)),combine:e=>({listings:e.flatMap((e,t)=>e.data?[{request:h[t],listing:e.data}]:[]),busy:e.some(e=>e.isFetching),failure:e.find(e=>e.error)?.error??null})}),focusedPath:p,requestPage:(e,t)=>{let i=e.replace(/\/+$/,``)||`/`,a=g(i,t);r.getQueryState(a)?.status===`error`&&r.invalidateQueries({queryKey:a,exact:!0}),u(e=>({scope:c,activePath:n,path:i,pages:[...e?.scope===c?e.pages.filter(e=>e.path!==i||e.offset!==t):[],{path:i,offset:t}]}))},reload:()=>{r.invalidateQueries({queryKey:Pr.of(e,`tree`,s)})}}}var nA=()=>globalThis.matchMedia(`(pointer: coarse)`).matches?44:32,rA=()=>`Library`,iA=(e,t)=>`${rA()}${t.slice(e.length)}`,aA=(e,t)=>`${e}${t.replace(/\/$/,``).slice(rA().length)}`,oA=e=>e===void 0?`${rA()}/`:`${rA()}/${e}/`;function sA(e){if(!e.endsWith(`/`))return null;let t=e.slice(0,-1);return t===rA()?{folder:void 0}:t.startsWith(`${rA()}/`)?{folder:t.slice(rA().length+1)}:null}var cA=e=>e.replace(/\/$/,``)===rA(),lA=e=>({flex:1,minHeight:0,"--trees-item-height":`${String(e)}px`,"--trees-padding-inline-override":`var(--spacing-xs)`,"--trees-item-margin-x-override":`0px`,"--trees-item-padding-x-override":`var(--spacing-xs)`,"--trees-item-row-gap-override":`var(--spacing-xs)`,"--trees-bg-override":`transparent`,"--trees-border-color-override":`var(--stipe-hairline)`,"--trees-focus-ring-color-override":`var(--color-primary)`,"--trees-fg-override":`var(--color-base-content)`,"--trees-bg-muted-override":`var(--color-base-200)`,"--trees-selected-bg-override":`var(--color-base-300)`,"--trees-border-radius-override":`var(--radius-field)`,"--trees-font-family-override":`var(--font-sans)`,"--trees-font-size-override":`13px`,"--trees-search-bg-override":`var(--color-base-200)`,"--trees-search-fg-override":`var(--color-base-content)`});function uA({app:e,root:t,activeFolder:n,active:r=!0,mode:i,onSelectFolder:a,onDrop:o,onRename:s,onNewFolder:c,onMoveRows:l,canWrite:u,version:d}){let f=oA(n),{scope:p,snapshot:m,requestPage:h,reload:g}=tA({app:e,rootPath:t,activePath:`${dg(t,n)}/.`}),_=(0,q.useRef)(!1),v=(0,q.useRef)({quiet:!1,root:t,mode:i,onSelectFolder:a,onDrop:o,onRename:s,onNewFolder:c,onMoveRows:l,requestPage:h});v.current={quiet:v.current.quiet,root:t,mode:i,onSelectFolder:a,onDrop:o,onRename:s,onNewFolder:c,onMoveRows:l,requestPage:h};let y=i===`browse`&&u,[b]=(0,q.useState)(nA),{model:x}=Kk({paths:[],itemHeight:b,initialExpansion:1,flattenEmptyDirectories:!1,search:i===`browse`,composition:{contextMenu:{enabled:i===`browse`}},onSelectionChange(e){if(v.current.quiet||_.current)return;let t=e.at(-1);if(t===void 0||e.length!==1)return;let n=sA(t);n!==null&&(v.current.requestPage(aA(v.current.root,t),0),v.current.onSelectFolder(n.folder))},dragAndDrop:y?{canDrag:e=>e.every(e=>!cA(e)),canDrop:({target:e})=>e.kind===`directory`&&e.directoryPath!==null&&sA(e.directoryPath)!==null,onDropComplete:({draggedPaths:e,target:t})=>{let n=t.directoryPath===null?null:sA(t.directoryPath);n!==null&&v.current.onDrop?.(e.map(e=>aA(v.current.root,e)),n.folder)}}:void 0,renaming:y?{canRename:e=>!cA(e.path),onRename:({sourcePath:e,destinationPath:t})=>{let n=t.replace(/\/$/,``).split(`/`).at(-1);n!==void 0&&v.current.onRename?.(aA(v.current.root,e),n)}}:void 0}),S=(0,q.useRef)(Yk());(0,q.useLayoutEffect)(()=>{Xk(x,S.current)},[x,p,d]);let C=(0,q.useRef)(d);(0,q.useEffect)(()=>{C.current!==d&&(C.current=d,g())},[g,d]),(0,q.useLayoutEffect)(()=>{let e=m.listings.map(({request:e,listing:n})=>({request:e,listing:{...n,path:iA(t,n.path),entries:n.entries.filter(e=>e.type===`directory`)}}));Zk(x,e,S.current)},[x,t,m.listings]);let w=(0,q.useRef)(null);return(0,q.useLayoutEffect)(()=>{v.current.quiet=!0;try{if(!r){w.current=null;for(let e of x.getSelectedPaths())x.getItem(e)?.deselect();return}e()}finally{v.current.quiet=!1}function e(){if(w.current===f)return;let e=x.getItem(f);if(!e)return;w.current=f;for(let e of x.getSelectedPaths())e!==f&&x.getItem(e)?.deselect();e.isSelected()||e.select();let t=f.slice(0,-1).split(`/`);for(let e=1;e<t.length;e+=1){let n=x.getItem(`${t.slice(0,e).join(`/`)}/`);n&&`expand`in n&&!n.isExpanded()&&n.expand()}}},[r,f,x,m.listings]),(0,q.useEffect)(()=>{m.failure&&Wt.error(It(m.failure).message,{id:`prints-tree-error`,toasterId:`prints-generation-notices`,action:{label:`Retry`,onClick:g}})},[g,m.failure]),(0,J.jsx)(`div`,{className:`prints-tree`,"data-library-tree":i,onDragStartCapture:()=>{_.current=!0},onDragEnd:()=>{_.current=!1},onDrop:()=>{_.current=!1},children:(0,J.jsx)(yb,{model:x,className:`prints-tree-view`,style:lA(b),renderContextMenu:i===`browse`?(e,n)=>{let r=sA(e.path);return(0,J.jsxs)(`div`,{className:`flex min-w-40 flex-col gap-xs p-xs`,role:`menu`,children:[r===null?null:(0,J.jsxs)(U,{className:`w-full justify-start`,disabled:!u,role:`menuitem`,size:`sm`,variant:`ghost`,onClick:()=>{n.close({restoreFocus:!1}),v.current.onNewFolder?.(r.folder)},children:[(0,J.jsx)(Ch,{"aria-hidden":`true`}),` New folder`]}),(0,J.jsxs)(U,{className:`w-full justify-start`,disabled:!u||cA(e.path),role:`menuitem`,size:`sm`,variant:`ghost`,onClick:()=>{n.close({restoreFocus:!1}),x.startRenaming(e.path)},children:[(0,J.jsx)(Nh,{"aria-hidden":`true`}),` Rename`]}),(0,J.jsxs)(U,{className:`w-full justify-start`,disabled:!u||cA(e.path),role:`menuitem`,size:`sm`,variant:`ghost`,onClick:()=>{n.close({restoreFocus:!1});let r=x.getSelectedPaths(),i=r.includes(e.path)?r:[e.path];v.current.onMoveRows?.(i.map(e=>aA(t,e)))},children:[(0,J.jsx)(On,{"aria-hidden":`true`}),` Move to…`]})]})}:void 0})})}function dA({view:e,onView:t,onNewFolder:n,canWrite:r,...i}){return(0,J.jsxs)(`nav`,{className:`prints-rail`,"aria-label":`Library`,children:[(0,J.jsxs)(`div`,{className:`prints-rail-views`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`prints-rail-view`,"aria-current":e.kind===`all`?`page`:void 0,onClick:()=>{t({kind:`all`})},children:[(0,J.jsx)(Mr,{"aria-hidden":!0,size:16}),` All prints`]}),(0,J.jsxs)(`button`,{type:`button`,className:`prints-rail-view`,"aria-current":e.kind===`favorites`?`page`:void 0,onClick:()=>{t({kind:`favorites`})},children:[(0,J.jsx)(fr,{"aria-hidden":!0,size:16}),` Favorites`]})]}),(0,J.jsxs)(`div`,{className:`prints-rail-head`,children:[(0,J.jsx)(`span`,{children:`Folders`}),(0,J.jsx)(U,{size:`sm`,variant:`ghost`,"aria-label":`New folder`,title:`New folder`,disabled:!r,onClick:()=>{n(e.kind===`folder`?e.folder:void 0)},children:(0,J.jsx)(Ch,{"aria-hidden":!0,size:16})})]}),(0,J.jsx)(uA,{...i,mode:`browse`,canWrite:r,activeFolder:e.kind===`folder`?e.folder:void 0,active:e.kind===`folder`,onNewFolder:n,onSelectFolder:e=>{t({kind:`folder`,folder:e})}})]})}var fA=`prints-generation-notices`;function pA({count:e,total:t,canWrite:n,onToggleAll:r,onMove:i,onFavorite:a,onDone:o}){let s=t>0&&e===t;return(0,J.jsxs)(`div`,{className:`prints-select-bar`,role:`toolbar`,"aria-label":`Selection`,children:[(0,J.jsx)(`span`,{className:`prints-select-count`,"aria-live":`polite`,children:e===0?`Choose prints`:`${String(e)} selected`}),(0,J.jsxs)(U,{size:`sm`,variant:`ghost`,className:`prints-select-all`,disabled:t===0,onClick:r,children:[(0,J.jsx)(`span`,{className:`prints-select-wide`,children:s?`Clear selection`:`Select all in view`}),(0,J.jsx)(`span`,{className:`prints-select-narrow`,children:s?`None`:`All`})]}),(0,J.jsx)(`span`,{className:`prints-select-spacer`}),(0,J.jsxs)(U,{size:`sm`,variant:`ghost`,"aria-label":`Favorite`,disabled:e===0||!n,onClick:a,children:[(0,J.jsx)(fr,{"aria-hidden":!0,size:16}),(0,J.jsx)(`span`,{className:`prints-select-wide`,children:`Favorite`})]}),(0,J.jsxs)(U,{size:`sm`,disabled:e===0||!n,onClick:i,children:[(0,J.jsx)(On,{"aria-hidden":!0,size:16}),(0,J.jsxs)(`span`,{className:`prints-select-wide`,children:[`Move to… (`,e,`)`]}),(0,J.jsxs)(`span`,{className:`prints-select-narrow`,children:[`Move (`,e,`)`]})]}),(0,J.jsx)(pt,{className:`prints-select-done`,"aria-label":`Done selecting`,title:`Done selecting`,icon:(0,J.jsx)(Ei,{}),size:`sm`,onClick:o})]})}function mA({view:e,lastFolder:t,onOpen:n,onFolders:r,subfolders:i,onOpenSubfolder:a}){return(0,J.jsxs)(`div`,{className:`prints-library-bar`,children:[(0,J.jsx)(_t,{className:`prints-folders-button`,density:`compact`,label:null,"aria-label":`Folders`,title:`Folders`,icon:(0,J.jsx)(wh,{size:16}),onClick:r}),(0,J.jsx)(Sr,{className:`prints-view-switch`,value:e.kind,onValueChange:e=>{n(e===`all`||e===`favorites`?{kind:e}:{kind:`folder`,folder:t})},children:(0,J.jsxs)(Er,{variant:`segmented`,"aria-label":`View`,children:[(0,J.jsx)(Gn,{value:`folder`,children:`Folder`}),(0,J.jsx)(Gn,{value:`all`,children:`All`}),(0,J.jsx)(Gn,{value:`favorites`,children:`Favorites`})]})}),i.length>0?(0,J.jsx)(`div`,{className:`prints-folder-chips`,role:`list`,"aria-label":`Folders`,children:i.map(e=>(0,J.jsx)(_t,{role:`listitem`,density:`compact`,className:`prints-folder-chip`,icon:(0,J.jsx)(Th,{size:16}),label:e,onClick:()=>{a(e)}},e))}):null]})}function hA({app:e,root:t,from:n,canWrite:r,count:i,open:a,version:o,onClose:s,onMove:c}){let[l,u]=(0,q.useState)(n?.folder),[d,f]=(0,q.useState)(``);(0,q.useEffect)(()=>{a&&u(n?.folder)},[a,n?.folder]);let p=d.trim(),m=p===``||ug(p)&&!p.includes(`/`),h=p===``?l:l===void 0?p:`${l}/${p}`,g=n!==null&&p===``&&h===n.folder;return(0,J.jsx)(cm,{open:a,onOpenChange:e=>{e||(f(``),s())},children:(0,J.jsxs)(pm,{className:`prints-move-dialog`,children:[(0,J.jsx)(hm,{children:(0,J.jsxs)(gm,{children:[`Move `,String(i),` `,i===1?`item`:`items`,` to…`]})}),(0,J.jsx)(`div`,{className:`prints-move-tree`,children:(0,J.jsx)(uA,{app:e,root:t,activeFolder:l,mode:`pick`,canWrite:r,version:o,onSelectFolder:u})}),(0,J.jsxs)(`label`,{className:`prints-move-new`,htmlFor:`prints-move-new-folder`,children:[(0,J.jsxs)(`span`,{children:[`New folder inside `,l??`the library`]}),(0,J.jsx)(gy,{id:`prints-move-new-folder`,value:d,placeholder:`Folder name`,"aria-invalid":!m,onChange:e=>{f(e.target.value)}})]}),(0,J.jsxs)(mm,{children:[(0,J.jsx)(_m,{render:(0,J.jsx)(U,{variant:`outline`,size:`sm`}),children:`Cancel`}),(0,J.jsx)(U,{size:`sm`,disabled:!m||!r||g,onClick:()=>{f(``),c(h,p!==``)},children:g?`Choose a folder`:`Move to ${h===void 0?`Library`:h.split(`/`).at(-1)??``}`})]})]})})}var gA={conflict:`a file or folder with that name is already there`,not_found:`it is no longer in the library`,invalid:`a folder can't move into itself`,not_granted:`Prints isn't allowed to change this Computer`,unavailable:`the Computer didn't answer`};function _A(e,t,n,r){let{moved:i,failed:a}=n;if(a.length>0){let e=a[0];Wt.error(`Couldn't move ${String(a.length)} ${a.length===1?`item`:`items`}: ${gA[e.error]}.`,{toasterId:fA,id:`prints-move-error`})}i.length!==0&&Wt(`Moved ${String(i.length)} ${i.length===1?`item`:`items`}`,{toasterId:fA,duration:8e3,action:{label:`Undo`,onClick:()=>{let n=new Map;for(let{from:e,to:r}of i){let i=fg(t,e)??``;n.set(i,[...n.get(i)??[],r])}Promise.all([...n].map(([t,n])=>Sg(e,{paths:n,folder:t===``?void 0:t}))).then(()=>{r()},e=>{tn(`prints-undo-move`,e),Wt.error(`Couldn't undo that move.`,{toasterId:fA}),r()})}}})}function vA({parent:e,open:t,onClose:n,onCreate:r}){let[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(null),[c,l]=(0,q.useState)(!1),u=()=>{a(``),s(null),n()},d=async()=>{l(!0);let e=await r(i);l(!1),e===null?u():(s(e),Wt.error(e,{toasterId:fA,id:`prints-new-folder`}))};return(0,J.jsx)(cm,{open:t,onOpenChange:e=>{e||u()},children:(0,J.jsxs)(pm,{className:`prints-new-folder-dialog`,children:[(0,J.jsx)(hm,{children:(0,J.jsxs)(gm,{children:[`New folder in `,e??`the library`]})}),(0,J.jsxs)(`form`,{id:`prints-new-folder-form`,onSubmit:e=>{e.preventDefault(),d()},children:[(0,J.jsx)(`label`,{htmlFor:`prints-new-folder-name`,children:`Name`}),(0,J.jsx)(gy,{id:`prints-new-folder-name`,autoFocus:!0,value:i,placeholder:`Characters`,"aria-invalid":o!==null,onChange:e=>{a(e.target.value),s(null)}})]}),(0,J.jsxs)(mm,{children:[(0,J.jsx)(_m,{render:(0,J.jsx)(U,{variant:`outline`,size:`sm`}),children:`Cancel`}),(0,J.jsx)(U,{size:`sm`,type:`submit`,form:`prints-new-folder-form`,disabled:c||i.trim()===``,children:`Create`})]})]})})}var yA=24,bA=`prints-generation-notices`;function xA(e,t){let[n,r]=(0,q.useState)({entries:[],index:-1}),i=(e,t)=>e.kind===t.kind&&(e.kind!==`folder`||t.kind===`folder`&&e.folder===t.folder),a=n=>{r(t=>{let r=t.entries[t.index]??e;if(i(r,n))return t;let a=t.entries.slice(0,t.index+1),o=a.length===0?[e]:a;return{entries:[...o,n],index:o.length}}),t(n)},o=e=>{let i=n.index+e;if(i<0||i>=n.entries.length)return!1;let a=n.entries[i];return r({...n,index:i}),t(a),!0};return{open:a,canGoBack:n.index>0,canGoForward:n.index>=0&&n.index<n.entries.length-1,back:()=>o(-1),forward:()=>o(1)}}function SA({app:e,destination:t,view:n,setView:r,entries:i,canWrite:a}){let o=on(),s=xA(n,r),[c,l]=(0,q.useState)(0),[u,d]=(0,q.useState)(),f=n.kind===`folder`?n.folder:void 0,p=n.kind===`folder`;(0,q.useEffect)(()=>{p&&d(f)},[p,f]);let[m,h]=(0,q.useState)(!1),[g,_]=(0,q.useState)(new Set),[v,y]=(0,q.useState)(null),[b,x]=(0,q.useState)(null),[S,C]=(0,q.useState)(new Map),w=e?.capabilities.has(Ci)===!0,T=Hs({queries:(0,q.useMemo)(()=>{let e=i.map(e=>e.path),t=[];for(let n=0;n<e.length;n+=yA)t.push(e.slice(n,n+yA));return t},[i]).map(n=>({...mi(e,Ci,kg.described(e,n),async(t,r)=>{if(!e)return[];let i=await Cg(e,n);return r.throwIfAborted(),i}),enabled:w&&t!==null,retry:!1})),combine:e=>{let t=new Map;for(let n of e)for(let e of n.data??[])t.set(e.path,e);return t}}),E=(0,q.useCallback)(()=>{l(e=>e+1),_(new Set),o.invalidateQueries({queryKey:kg.listings(e)}),o.invalidateQueries({queryKey:kg.describedAll(e)})},[e,o]),D=(0,q.useCallback)(async(n,r,i={})=>{if(!(!e||t===null)){try{_A(e,t,await Sg(e,{paths:n,folder:r,createFolder:i.create??!1,name:i.name}),E)}catch(e){tn(`prints-move-files`,e),Wt.error(`Couldn't move those. Check the Computer and try again.`,{toasterId:bA,id:`prints-move-error`})}E()}},[e,t,E]),O=(0,q.useCallback)((t,r)=>{e&&(C(e=>{let n=new Map(e);for(let e of t)n.set(e,r);return n}),wg(e,t,r).then(()=>{o.invalidateQueries({queryKey:kg.describedAll(e)}),n.kind===`favorites`&&o.invalidateQueries({queryKey:kg.listings(e)})},e=>{tn(`prints-set-favorite`,e),Wt.error(`Couldn't change that favorite.`,{toasterId:bA,id:`prints-favorite-error`}),C(e=>{let n=new Map(e);for(let e of t)n.delete(e);return n})}))},[e,o,n.kind]),k=(0,q.useCallback)(async(n,r)=>{if(!e||t===null)return`Choose a library folder first.`;let i=r.trim();if(!ug(i)||i.includes(`/`))return`Use a single name, without slashes.`;let a=n===void 0?i:`${n}/${i}`;if(!ug(a))return`That folder name is too long.`;try{await e.capabilities.require(Ra).mkdir({path:dg(t,a)})}catch(e){return tn(`prints-new-folder`,e),`Couldn't create the folder. Check Computer write access.`}return E(),s.open({kind:`folder`,folder:a}),null},[e,t,s,E]),A=(0,q.useMemo)(()=>n.kind===`folder`?[{id:``,label:t?.split(`/`).at(-1)??`Library`},...pg(n.folder).map(({name:e,folder:t})=>({id:t,label:e}))].slice(-8):[{id:n.kind,label:n.kind===`all`?`All prints`:`Favorites`}],[t,n]),j=e=>S.get(e)??T.get(e)?.favorite??!1,M=e=>{if(t===null||!e.path.startsWith(`${t}/`))return e;let r=T.get(e.path),o=S.get(e.path)??r?.favorite??!1,s=i.find(t=>t.path===e.path),c={...e,badge:void 0,folderCaption:n.kind===`folder`?void 0:s?.folder,favorite:o,select:{active:m,checked:g.has(e.path),onToggle:()=>{_(t=>{let n=new Set(t);return n.has(e.path)?n.delete(e.path):n.add(e.path),n})}}};return!e.pending&&r!==void 0&&(c.badge=r.kind===null?{label:null,seconds:null}:{label:r.modelLabel??r.model,seconds:r.durationSeconds}),w&&(c.onToggleFavorite=()=>{O([e.path],!o)}),w&&a&&(c.onMove=()=>{y([e.path])}),c},N=n.kind===`all`?`All prints`:n.kind===`favorites`?`Favorites`:n.folder?.split(`/`).at(-1)??`Library`,P=n.kind===`folder`&&n.folder!==void 0?n.folder.split(`/`).slice(0,-1).join(`/`):null;return{title:N,up:P===null?void 0:()=>{s.open({kind:`folder`,folder:P===``?void 0:P})},lastFolder:u,history:s,version:c,refresh:E,crumbs:A,selecting:m,setSelecting:e=>{h(e),e||_(new Set)},selected:g,selectAll:e=>{_(new Set(e))},moving:v,setMoving:y,newFolder:b,setNewFolder:x,move:D,toggleFavorite:O,createFolder:k,enrich:M,isFavorite:j,folderOf:fg}}function CA(e,t){return{kind:`button`,id:`folder`,text:t.checking?`Checking…`:`prints`,icon:`folder`,title:e===null?`Choose where Prints saves images`:v(`Save prints to ${e}`,1024),opens:`dialog`,expanded:t.editing}}var wA=(0,q.forwardRef)(function({className:e,label:t,...n},r){return(0,J.jsx)(_t,{...n,ref:r,className:V(`parakeet-composer-model-key`,e),label:t,readout:(0,J.jsx)(ai,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)] shrink-0`})})}),TA={unchecked:`M3.25 5.9 L5.1 7.9 L8.8 3.8`,checked:`M3.25 5.9 L5.1 7.9 L8.8 3.8`,mixed:`M3.4 6 L6 6 L8.6 6`},EA={blurStdDeviation:.22,alphaSlope:18,alphaIntercept:-8};function DA({state:e}){let t=`caps-checkbox-${(0,q.useId)().replaceAll(`:`,``)}`,n=(0,q.useRef)(null),r=(0,q.useRef)(e).current,i=(0,q.useRef)(e),a=ce();return(0,q.useLayoutEffect)(()=>{if(!n.current)return;let t=e!==`unchecked`,r=i.current!==`unchecked`,s=a||i.current===e;i.current=e;let c=Tt(n.current),l=Ur(c,{ease:`inCubic`,duration:160}),u=Po(n.current,{d:{to:TA[e],...s?ki:Ur(c,{ease:`outCubic`,duration:200})},"stroke-dashoffset":{to:+!t,...s?ki:t?Ur(c,{ease:`inOutSine`,duration:260}):l},"stroke-width":s?{to:t?2.4:0,duration:0}:t&&!r?[{to:2.2,...Ur(c,{ease:`outCubic`,duration:65})},{to:2.4,delay:o(c,120),...fi(c,{bounce:.35,duration:220})}]:{to:t?2.4:0,...l}});return()=>{u.cancel()}},[e,a]),(0,J.jsxs)(`svg`,{className:`caps-checkbox-visual`,width:`24`,height:`24`,viewBox:`0 0 12 12`,"aria-hidden":`true`,focusable:`false`,children:[(0,J.jsxs)(`defs`,{children:[(0,J.jsx)(f,{id:`${t}-surface`,transform:`matrix(1 0 0 1 6 6)`}),(0,J.jsx)(xe,{id:`${t}-shadow`}),(0,J.jsx)(gn,{id:`${t}-inset`}),(0,J.jsx)(Qe,{id:`${t}-goo`,values:EA}),(0,J.jsxs)(`filter`,{id:`${t}-relief`,x:`-25%`,y:`-25%`,width:`150%`,height:`150%`,colorInterpolationFilters:`sRGB`,children:[(0,J.jsx)(`feGaussianBlur`,{in:`SourceAlpha`,stdDeviation:`0.28`,result:`relief`}),(0,J.jsx)(`feSpecularLighting`,{in:`relief`,surfaceScale:`1.2`,specularConstant:`0.55`,specularExponent:`18`,lightingColor:`color-mix(in srgb, var(--color-white) calc(var(--depth) * 100%), var(--color-black))`,result:`light`,children:(0,J.jsx)(`feDistantLight`,{azimuth:`225`,elevation:`55`})}),(0,J.jsx)(`feComposite`,{in:`light`,in2:`SourceAlpha`,operator:`in`,result:`clipped-light`}),(0,J.jsx)(`feBlend`,{in:`SourceGraphic`,in2:`clipped-light`,mode:`screen`})]}),(0,J.jsx)(`mask`,{id:`${t}-contour`,maskUnits:`userSpaceOnUse`,x:`0`,y:`0`,width:`12`,height:`12`,style:{maskType:`alpha`},children:(0,J.jsx)(`path`,{ref:n,d:TA[r],fill:`none`,stroke:`var(--color-white)`,strokeWidth:r===`unchecked`?0:2.4,pathLength:`1`,strokeDasharray:`1`,strokeDashoffset:+(r===`unchecked`),strokeLinecap:`round`,strokeLinejoin:`round`,filter:e===`mixed`?void 0:`url(#${t}-goo)`})}),(0,J.jsx)(`clipPath`,{id:`${t}-well`,children:(0,J.jsx)(`rect`,{x:`1`,y:`1`,width:`10`,height:`10`,rx:`2.5`})})]}),(0,J.jsx)(`rect`,{className:`caps-checkbox-track`,x:`0.5`,y:`0.5`,width:`11`,height:`11`,rx:`3`,filter:`url(#${t}-inset)`}),(0,J.jsx)(`g`,{clipPath:`url(#${t}-well)`,children:(0,J.jsx)(`g`,{filter:`url(#${t}-shadow)`,children:(0,J.jsx)(`g`,{filter:`url(#${t}-relief)`,children:(0,J.jsx)(`g`,{mask:`url(#${t}-contour)`,children:(0,J.jsx)(`rect`,{x:`0`,y:`0`,width:`12`,height:`12`,fill:`url(#${t}-surface)`})})})})})]})}var OA=(0,q.forwardRef)(function({className:e,appearance:t,indicator:n,invalid:r,indeterminate:i=!1,checked:a,defaultChecked:o=!1,onChange:s,...c},l){let u=(0,q.useRef)(null),[d,f]=(0,q.useState)(o),p=a??d,m=i?`mixed`:p?`checked`:`unchecked`;return(0,q.useImperativeHandle)(l,()=>{if(!u.current)throw Error(`Checkbox input is not mounted`);return u.current},[]),(0,q.useLayoutEffect)(()=>{u.current&&(u.current.indeterminate=i)},[i]),(0,q.useEffect)(()=>{let e=u.current?.form;if(!e||a!==void 0)return;let t=e=>{queueMicrotask(()=>{!e.defaultPrevented&&u.current&&f(o)})};return e.addEventListener(`reset`,t),()=>{e.removeEventListener(`reset`,t)}},[a,o,c.form]),(0,J.jsxs)(`span`,{className:`caps-checkbox`,"data-appearance":t===`compact`?t:void 0,"data-state":m,"data-custom-indicator":n!==void 0||void 0,children:[(0,J.jsx)(`input`,{...c,checked:p,"aria-checked":i?`mixed`:p,"aria-invalid":r?!0:c[`aria-invalid`]===!1?void 0:c[`aria-invalid`],className:V(`caps-checkbox-input`,e),onChange:e=>{a===void 0&&f(e.target.checked),s?.(e),e.currentTarget.indeterminate=i},ref:u,type:`checkbox`}),n===void 0?(0,J.jsx)(DA,{state:m}):n]})});function kA({getKey:e,isDisabled:t=()=>!1,items:n}){let r=(0,q.useMemo)(()=>{let r=n.map(e);if(r.some(e=>!e))throw Error(`Selectable items require non-empty keys`);if(new Set(r).size!==r.length)throw Error(`Selectable items require unique keys`);return n.filter(e=>!t(e))},[e,t,n]),[i,a]=(0,q.useState)(null);(0,q.useEffect)(()=>{i!==null&&!r.some(t=>e(t)===i)&&a(null)},[i,r,e]);let o=r.find(t=>e(t)===i),s=o?r.findIndex(t=>e(t)===i):-1;return{activeIndex:s,activeItem:o,activeKey:i,enabledItems:r,move:(t,n)=>{if(r.length===0)return;let i=n?n===`start`?0:r.length-1:s<0?t>0?0:r.length-1:(s+t+r.length)%r.length,o=r[i];o&&a(e(o))},setActiveKey:a}}var AA={draft:`Draft`,balanced:`Balanced`,premium:`Premium`,max:`Max`};function jA(e){if(e.kind!==`video`||e.video===null)return AA[e.tier];let t=Math.min(...e.video.prices.map(e=>e.silentMilliunitsPerSecond)),n=Number.isFinite(t)?pi(t):null;return n===null?`Video`:`Video · from ${n}/s`}var MA=[{kind:`image`,label:`Images`},{kind:`video`,label:`Video`}];function NA(e){let t=()=>{e.scrollHeight-e.scrollTop-e.clientHeight>1?e.setAttribute(`data-more`,``):e.removeAttribute(`data-more`)};t();let n=requestAnimationFrame(t);return e.addEventListener(`scroll`,t,{passive:!0}),()=>{cancelAnimationFrame(n),e.removeEventListener(`scroll`,t)}}function PA({compact:e=!1,disabled:t,emptyLabel:n,models:r,onChange:i,value:a}){let o=r.find(e=>e.id===a),[s,c]=(0,q.useState)(null);(0,q.useEffect)(()=>{if(s!==null)return NA(s)},[s]);let[l,u]=(0,q.useState)(null);return(0,J.jsx)(`span`,{className:`contents`,ref:u,children:(0,J.jsxs)(Co,{children:[(0,J.jsx)(Ia,{"aria-label":`Generation model`,"data-generation-model":a,disabled:t||r.length===0,render:(t,r)=>{let i=o===void 0?n:Rn(o);return e?(0,J.jsx)(_t,{...t,className:`parakeet-composer-model-key`,expanded:r.open,icon:(0,J.jsx)(Mi,{}),label:null,readout:(0,J.jsx)(ai,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)] shrink-0`}),title:i}):(0,J.jsx)(wA,{...t,expanded:r.open,label:i})}}),(0,J.jsx)(qa,{ref:c,"data-generation-model-menu":!0,container:Xg(l),side:`top`,align:`start`,"aria-label":`Generation models`,children:MA.map((e,t)=>{let n=r.filter(t=>t.kind===e.kind);return n.length===0?null:(0,J.jsxs)(mo,{children:[t>0?(0,J.jsx)(Ya,{}):null,(0,J.jsx)(Za,{children:e.label}),n.map(e=>(0,J.jsx)(Wa,{"data-generation-model-option":e.id,checked:e.id===a,closeOnClick:!0,onSelect:()=>{i(e.id)},children:(0,J.jsxs)(`span`,{className:`prints-model-row flex items-baseline gap-lg`,children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1`,children:Rn(e)}),(0,J.jsx)(`span`,{className:`prints-model-detail`,children:jA(e)})]})},e.id))]},e.kind)})})]})})}var FA={kind:`folder`,folder:void 0};function IA(e){let t=zf(e),n=(0,q.useRef)(e);n.current=e;let r=on(),i=Li(In(e)),a=Ks(Ng(e,i.data?.configured?{kind:`folder`,path:i.data.path}:null)),o=`${t??``}:${i.data?.path??``}`,[s,c]=(0,q.useState)({scope:o,view:FA}),l=s.scope===o?s.view:FA,d=e=>{c({scope:o,view:e})},[f,p]=(0,q.useState)(null),m=n=>n?.app===e&&n.computerId===t,h=se({mutationKey:oi.folder(e),mutationFn:async({owner:e,id:t,path:r,create:i})=>{let a=()=>{if(n.current!==e||e.context.get().computerId!==t)throw new G(`Computer selection changed`,{code:`SELECTION_CHANGED`,retryable:!1})};return a(),i&&await e.capabilities.require(Ra).mkdir({path:r}),a(),await fo(e.capabilities,{path:r,limit:1,offset:0}),a(),dr(e.capabilities,{operation:`select-folder`,computerId:t,path:r})},onSuccess:(e,t)=>{t.owner===n.current&&t.owner.context.get().computerId===t.id&&p(null)},onSettled:(e,t,n)=>Promise.all([r.invalidateQueries({queryKey:n.queryKey,exact:!0}),r.invalidateQueries({queryKey:kg.listing(n.owner,n.path),exact:!0})])}),g=h.variables?.owner===e&&h.variables.id===t,_=i.isFetching||g&&h.isPending,v=async(n,r)=>{if(!e||!t||_)return`Computer selection changed. Try again.`;let i=n.trim();if(!u($n)(i))return`Enter an absolute Computer folder, such as /media.`;try{return await h.mutateAsync({owner:e,id:t,path:i,create:r,queryKey:oi.folder(e)}),null}catch{return`Could not use this folder. Check its location and your Computer permissions.`}},y=i.isError||a.isError,b=y||!i.data?.configured?null:i.data.path,x=b===null?null:l.kind===`folder`?dg(b,l.folder):b,S=b===null?null:l.kind===`folder`?{kind:`folder`,path:x??b}:{kind:l.kind,path:b};return{view:l,setView:d,destination:b,landingPath:x??(y?null:i.data?.path??null),source:S,path:y?null:i.data?.path??null,computerId:t,available:e?.capabilities.has(Zr)===!0,writable:e?.capabilities.has(Ra)===!0,busy:_,error:y?`Your media folder is unavailable. Choose or create a folder.`:null,editing:m(f),setEditing:n=>{p(n?{app:e,computerId:t}:null)},choose:v,ensureCreated:async()=>i.data?i.data.configured?null:v(i.data.path,!0):`Your Prints library is still loading.`,recheck:()=>{r.invalidateQueries({queryKey:kg.listing(e,i.data?.path??null),exact:!0}),r.invalidateQueries({queryKey:oi.folder(e),exact:!0})}}}var LA=w(b),RA=w(g({message:b}));function zA(e){for(let t of e.errors){let e=dn(Ce(et(RA(t),e=>e.message),()=>LA(t)));if(e!==void 0&&e.length>0)return e}}var BA={neutral:`progress-neutral`,primary:`progress-primary`,secondary:`progress-secondary`,accent:`progress-accent`,success:`progress-success`,info:`progress-info`,warning:`progress-warning`,error:`progress-error`},VA=(0,q.forwardRef)(function({className:e,tone:t=`primary`,...n},r){return(0,J.jsx)(`progress`,{...n,"data-complete":n.value!==void 0&&Number(n.value)>=Number(n.max??1)?`true`:void 0,className:V(`progress caps-gooey-motion caps-gooey-progress w-full`,BA[t],e),ref:r})});(0,q.forwardRef)(function({label:e,value:t,max:n,tone:r=`info`,className:i,...a},o){return(0,J.jsxs)(`div`,{...a,ref:o,className:V(`caps-game-meter`,i),children:[(0,J.jsxs)(`div`,{className:`caps-game-meter-readout`,children:[(0,J.jsx)(`span`,{children:e}),(0,J.jsxs)(`span`,{className:`caps-game-meter-value`,children:[t,` / `,n]})]}),(0,J.jsx)(VA,{"aria-label":e,value:t,max:n,tone:r})]})});function HA({className:e,items:t,onCancel:n,onRemove:r,onRetry:i,rowClassName:a}){return t.length?(0,J.jsx)(`div`,{"aria-live":`polite`,className:`caps-upload-queue flex w-full min-w-0 flex-col gap-sm ${e??``}`,"data-upload-rows":!0,children:t.map(e=>(0,J.jsx)(GA,{item:e,onCancel:n,onRemove:r,onRetry:i,...a===void 0?{}:{rowClassName:a}},e.id))}):null}function UA({action:e,id:t,onAction:n,retry:r=!1}){return e?(0,J.jsx)(pt,{"aria-label":e.accessibleLabel,title:e.label,variant:`ghost`,size:`xs`,className:`motion-reduce:transition-none`,icon:r?(0,J.jsx)(Ar,{}):(0,J.jsx)(Ei,{}),onClick:()=>void n(t),type:`button`}):null}function WA({item:e}){return(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block min-w-0 truncate`,title:e.name,children:e.name}),(0,J.jsx)(`div`,{className:`caps-upload-details`,children:(0,J.jsxs)(`span`,{"aria-live":e.alert?`assertive`:void 0,className:`caps-upload-status min-w-0 break-words`,"data-upload-status":!0,role:e.alert?`alert`:void 0,children:[e.alert??e.statusLabel,` `,e.progressLabel]})})]})}function GA({item:e,onCancel:t,onRemove:n,onRetry:r,rowClassName:i}){return(0,J.jsxs)(`div`,{className:`caps-upload-row grid w-full min-w-0 max-w-full grid-cols-[2rem_minmax(0,1fr)_auto] items-center gap-sm p-sm text-xs ${i??``}`,children:[e.preview.kind===`image`?(0,J.jsx)(`img`,{alt:``,className:`caps-upload-preview mask mask-squircle size-8 shrink-0 object-cover`,src:e.preview.url}):(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`caps-upload-preview mask mask-squircle flex size-8 shrink-0 items-center justify-center bg-base-300`,children:(0,J.jsx)(Jr,{className:`size-4`})}),(0,J.jsx)(WA,{item:e}),(0,J.jsx)(KA,{actions:e.actions,id:e.id,onCancel:t,onRemove:n,onRetry:r}),(0,J.jsx)(VA,{"aria-label":`${e.name} progress`,className:`caps-upload-progress`,tone:e.alert?`error`:e.progress===100?`success`:`accent`,max:100,value:e.progress??(e.alert?0:void 0)})]})}function KA({actions:e,id:t,onCancel:n,onRemove:r,onRetry:i}){return(0,J.jsxs)(`div`,{className:`caps-upload-actions flex min-w-0 flex-wrap justify-end gap-xs`,children:[(0,J.jsx)(UA,{action:e.retry,id:t,onAction:i,retry:!0}),(0,J.jsx)(UA,{action:e.cancel,id:t,onAction:n}),(0,J.jsx)(UA,{action:e.remove,id:t,onAction:r})]})}var qA=q.createContext(void 0);function JA(e){let t=q.useContext(qA);if(t===void 0&&!e)throw Error(Oa(47));return t}var YA={...No,disabled:e=>e.disabled,instantType:e=>e.instantType===`trigger-change`&&!No.open(e)?void 0:e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,isPressOpenedByTrigger:(e,t)=>e.openChangeReason===`trigger-press`&&No.isOpenedByTrigger(e,t),isTouchPressOpen:(e,t)=>t&&e.openMethod===`touch`&&e.openChangeReason===`trigger-press`,hasTriggerFocusGuards:(e,t)=>No.isOpenedByTrigger(e,t)&&!e.focusManagerModal,modal:e=>e.modal,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},XA=class extends $i{constructor(e,t,n){let r=new ja;super(ZA(e,r,t,n),QA(r),YA)}setOpen=(e,t)=>{let n=t.reason===Ea,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=go(t),o=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&o!=null&&(t.trigger=this.context.triggerElements.getById(o)??this.select(`activeTriggerElement`)??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let n=Pa(this.state,e,t.trigger,a());n.openChangeReason=t.reason,this.update(n)};n?(this.context.stickIfOpen=!0,this.context.stickIfOpenTimeout.start(500,()=>{this.context.stickIfOpen=!1}),eg.flushSync(s)):s();let c;r?c=`click`:i?c=`dismiss`:t.reason===`focus-out`&&(c=`focus`),this.set(`instantType`,c)}};function ZA(e,t,n,r=!1){let i={...Ca(t,n,r),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return i.open&&e?.mounted===void 0&&(i.mounted=!0),i}function QA(e){return{popupRef:q.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:q.createRef(),beforeTriggerFocusGuardRef:q.createRef(),beforeContentFocusGuardRef:q.createRef(),stickIfOpenTimeout:new Eo,stickIfOpen:!0,triggerElements:e}}var $A=ka(function({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=tj(s,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`mounted`),p=u.useState(`payload`);u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),Ka(u,d),Na(u);let{forceUnmount:m}=Fa(d,u,()=>{u.context.stickIfOpen=!0,u.set(`openChangeReason`,null)});u.useSyncedValues({modal:o}),q.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]),q.useImperativeHandle(e.actionsRef,()=>({unmount:m,close:()=>u.setOpen(!1,ra(Oo))}),[m,u]);let h=d||f||s!=null;return(0,J.jsxs)(qA.Provider,{value:u,children:[s&&(0,J.jsx)(fa,{handle:s,store:u}),h&&(0,J.jsx)(nj,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})});function ej(e){return JA(!0)?(0,J.jsx)($A,{props:e}):(0,J.jsx)(Ua,{children:(0,J.jsx)($A,{props:e})})}function tj(e,t){let n=Xi((e,n)=>new XA(t,e,n));return q.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function nj({store:e,modal:t}){let n=e.useState(`floatingRootContext`),r=eo(n,{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),i=r.reference,a=r.floating;return Sa(e,{activeTriggerProps:i,inactiveTriggerProps:i,popupProps:a}),null}var rj=ca(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,handle:s,payload:c,openOnHover:l=!1,delay:u=300,closeDelay:d=0,id:f,...p}=e,m=JA(!0),h=pa(s)??m;if(!h)throw Error(Oa(74));let g=Va(f),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=q.useRef(null),{registerTrigger:S,isMountedByThisTrigger:C}=So(g,x,h,{payload:c,disabled:a,openOnHover:l,closeDelay:d}),w=h.useState(`isPressOpenedByTrigger`,g),T=h.useState(`isTouchPressOpen`,l),E=h.useState(`hasTriggerFocusGuards`,g),D=aa(v,{enabled:!a&&l&&!T,mouseOnly:!0,move:!1,handleClose:ba(),restMs:u,delay:{close:d},triggerElementRef:x,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),O=Qi(()=>h.context.stickIfOpen),k=za(v,{stickIfOpen:O}),A=ro(()=>h.select(`open`),e=>{h.set(`openMethod`,e)}),j=h.useState(`triggerProps`,C),{getButtonProps:M,buttonRef:N}=ya({disabled:a,native:o}),P={open(e){return w?xa.open(e):oa.open(e)}},{handlePreFocusGuardFocus:F,handleFocusTargetFocus:I}=jo(h,x),ee=Aa(`button`,e,{state:{disabled:a,open:y},ref:[N,t,S,x],props:[k.reference,D,j,A,{[Ga]:``,id:g,"aria-haspopup":`dialog`,"aria-expanded":y,"aria-controls":b},p,M],stateAttributesMapping:P}),te=(0,J.jsx)(q.Fragment,{children:ee},g);return E?(0,J.jsxs)(q.Fragment,{children:[(0,J.jsx)(ho,{ref:h.context.beforeTriggerFocusGuardRef,onFocus:F}),te,(0,J.jsx)(ho,{ref:h.context.triggerFocusTargetRef,onFocus:I})]}):te}),ij=q.createContext(void 0);function aj(){let e=q.useContext(ij);if(e===void 0)throw Error(Oa(45));return e}var oj=q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return JA().useState(`mounted`)||n?(0,J.jsx)(ij.Provider,{value:n,children:(0,J.jsx)(wo,{ref:t,...r})}):null}),sj=q.createContext(void 0);function cj(){let e=q.useContext(sj);if(!e)throw Error(Oa(46));return e}var lj=q.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o,side:s,align:c,sideOffset:l,alignOffset:u,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f,arrowPadding:p,sticky:m,disableAnchorTracking:h=!1,collisionAvoidance:g=Ja,..._}=e,v=JA(),y=aj(),b=oo(),x=v.useState(`floatingRootContext`),S=v.useState(`mounted`),C=v.useState(`open`),w=v.useState(`openChangeReason`),T=v.useState(`activeTriggerElement`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`positionerElement`),k=v.useState(`instantType`),A=v.useState(`transitionStatus`),j=v.useState(`adaptiveOrigin`),M=ta({anchor:a,floatingRootContext:x,positionMethod:o,mounted:S,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:y,nodeId:b,collisionAvoidance:g,adaptiveOrigin:j}),N=x.useState(`domReferenceElement`);wa({store:v,domReference:N,positionerElement:O,open:C});let P=E===!0&&w!==`trigger-hover`;Ba(C&&P,D===`touch`,O,T);let F=v.useStateSetter(`positionerElement`),I={open:C,side:M.side,align:M.align,anchorHidden:M.anchorHidden,instant:k},ee=ko(e,I,{styles:M.positionerStyles,transitionStatus:A,props:_,refs:[t,F],hidden:!S,inert:!C});return(0,J.jsxs)(sj.Provider,{value:M,children:[S&&P&&(0,J.jsx)(to,{inert:ma(!C),cutout:T}),(0,J.jsx)(bo,{id:b,children:ee})]})}),uj=q.createContext(void 0);function dj(){let[e,t]=q.useState(0),n=Qi(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:q.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}var fj=q.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=JA(),l=cj(),u=ia(!0)!=null,{context:d,hasClosePart:f}=dj(),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`instantType`),g=c.useState(`transitionStatus`),_=c.useState(`popupProps`),v=c.useState(`titleElementId`),y=c.useState(`descriptionElementId`),b=c.useState(`modal`),x=c.useState(`mounted`),S=c.useState(`openChangeReason`),C=c.useState(`activeTriggerElement`),w=c.useState(`floatingRootContext`),T=w.useState(`floatingId`),E=c.useState(`disabled`),D=c.useState(`openOnHover`),O=c.useState(`closeDelay`);uo({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),ua(w,{enabled:D&&!E,closeDelay:O});let k=a===void 0?da(c.context.popupRef):a,A=b!==!1&&f;c.useSyncedValue(`focusManagerModal`,A);let j=c.useStateSetter(`popupElement`),M={open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},N=Aa(`div`,e,{state:M,ref:[t,c.context.popupRef,j],props:[_,{id:T,role:`dialog`,...sa,"aria-labelledby":v,"aria-describedby":y,onKeyDown(e){u&&ga.has(e.key)&&e.stopPropagation()}},Ta(g),s],stateAttributesMapping:_a});return(0,J.jsx)(po,{context:w,openInteractionType:m,modal:A,disabled:!x||S===`trigger-hover`,initialFocus:k,returnFocus:o,restoreFocus:`popup`,getInsideElements:()=>[c.context.beforeTriggerFocusGuardRef.current],previousFocusableElement:no(C)?C:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,J.jsx)(uj.Provider,{value:d,children:N})})}),pj=(0,q.forwardRef)(function({children:e,className:t,type:n=`button`,...r},i){return(0,J.jsxs)(`button`,{...r,ref:i,type:n,className:V(`select caps-select caps-combobox-trigger w-full`,t),children:[(0,J.jsx)(`span`,{children:e}),(0,J.jsx)(ai,{className:`caps-select-chevron`,"aria-hidden":`true`})]})});function mj({defaultOpen:e,defaultValue:t,getKey:n,getSearchText:r,groupBy:i,id:a,isDisabled:o,items:s,onOpenChange:c,onCommit:l,multiple:u,controlledOpen:d,controlledKeys:f,trigger:p}){let m=`${a}-listbox`,[h,g]=(0,q.useState)(``),[_,v]=(0,q.useState)(!1),[y,b]=(0,q.useState)(t),[x,S]=(0,q.useState)(e),C=f??(y===null?[]:[y]),w=p?d??x:!0,T=(0,q.useMemo)(()=>{let e=h.trim().toLowerCase();return e?s.filter(t=>r(t).toLowerCase().includes(e)):s},[r,s,h]),E=kA({getKey:n,isDisabled:o,items:T});(0,q.useEffect)(()=>{if(E.activeKey!==null)return;let e=E.enabledItems.find(e=>C.includes(n(e)))??E.enabledItems[0];e&&E.setActiveKey(n(e))},[E.activeKey,E.enabledItems,E.setActiveKey,n,C]);let D=e=>{v(!1),e||g(``),d===void 0&&S(e),c?.(e)},O=e=>`${m}-option-${encodeURIComponent(e)}`,k=e=>{let t=n(e);f===void 0&&b(t),l(e),p&&!u&&D(!1)},A=e=>{v(!0),g(e.target.value),E.setActiveKey(null)},j=e=>{if(zi(e))return;let t;switch(e.key){case`ArrowDown`:t=[1,void 0];break;case`ArrowUp`:t=[-1,void 0];break;case`End`:t=[1,`end`];break;case`Home`:t=[-1,`start`]}t?(v(!0),e.preventDefault(),E.move(t[0],t[1])):e.key===`Enter`&&E.activeItem&&(e.preventDefault(),k(E.activeItem))},M=(0,q.useMemo)(()=>{if(!i)return[{label:``,items:T}];let e=new Map;for(let t of T){let n=i(t),r=e.get(n);r?r.push(t):e.set(n,[t])}return[...e].map(([e,t])=>({label:e,items:t}))},[T,i]);return{keyboardNavigation:_,onPointerMove:()=>{v(!1)},activeKey:E.activeKey,activeItem:E.activeItem,groups:M,inputValue:h,listboxId:m,onInputChange:A,onInputKeyDown:j,optionId:O,open:w,commit:k,selectedKeys:C,setOpen:D}}function hj(e){let{"aria-describedby":t,"aria-invalid":n,"aria-label":r,"aria-labelledby":i,"aria-required":a,activeTone:o=`neutral`,container:s,contentClassName:c,defaultOpen:l=!1,defaultValue:u=null,emptyMessage:d=`No matches`,getKey:f,getLabel:p,getSearchText:m=p,groupBy:h,id:g,inputProps:_,inputRef:v,isDisabled:y=()=>!1,items:b,onOpenChange:x,onValueChange:S,multiple:C,open:w,placeholder:T=`Search…`,renderItem:E,rootRef:D,trigger:O,triggerRef:k,value:A,...j}=e,M=e=>{let t=f(e);if(C){let e=A.includes(t)?A.filter(e=>e!==t):[...A,t];S?.(e,b.filter(t=>e.includes(f(t))))}else S?.(t,e)},N;C?N=A:A!==void 0&&(N=A===null?[]:[A]);let P=(0,q.useId)(),F=O?.props??_,I=g??F?.id??P,ee={id:I,"aria-describedby":[t,F?.[`aria-describedby`]].filter(Boolean).join(` `)||void 0,"aria-invalid":n??F?.[`aria-invalid`],"aria-label":F?.[`aria-label`]??r,"aria-labelledby":F?.[`aria-labelledby`]??i,"aria-required":a??F?.[`aria-required`]},{keyboardNavigation:te,onPointerMove:ne,activeItem:re,activeKey:L,commit:R,groups:ie,inputValue:ae,listboxId:oe,onInputChange:se,onInputKeyDown:ce,open:z,optionId:le,selectedKeys:B,setOpen:ue}=mj({defaultOpen:l,defaultValue:u,getKey:f,getSearchText:m,groupBy:h,id:I,isDisabled:y,items:b,onOpenChange:x,onCommit:M,multiple:C??!1,controlledOpen:w,controlledKeys:N,trigger:O});na(()=>{O&&ue(!1)});let de=va(`popover`),fe=s===void 0?de:s,pe=To(`.caps-combobox-option[data-active="true"]:not(:disabled), [data-navigation="pointer"] .caps-combobox-option:hover:not(:disabled)`),me=(0,J.jsx)(gy,{..._,...O?{}:ee,"aria-activedescendant":re?le(f(re)):void 0,"aria-autocomplete":`list`,"aria-controls":oe,"aria-expanded":!0,className:V(`input-sm`,_?.className),id:O?_?.id??`${I}-input`:I,onChange:e=>{_?.onChange?.(e),se(e)},onKeyDown:e=>{_?.onKeyDown?.(e),e.defaultPrevented||ce(e)},placeholder:_?.placeholder??T,ref:v,role:`combobox`,value:ae}),he=(0,J.jsx)(`div`,{id:oe,ref:pe,className:`caps-combobox-list`,"data-navigation":te?`keyboard`:`pointer`,onPointerMove:ne,role:`listbox`,"aria-multiselectable":C??void 0,children:ie.every(e=>e.items.length===0)?(0,J.jsx)(`div`,{className:`px-md py-md text-sm text-base-content`,children:d}):ie.map(e=>(0,J.jsxs)(`div`,{"aria-label":e.label||void 0,role:e.label?`group`:void 0,children:[e.label?(0,J.jsx)(`div`,{className:`px-md pb-xs pt-sm text-xs text-base-content uppercase tracking-wider`,children:e.label}):null,e.items.map(e=>{let t=f(e),n=y(e),r=L===t,i={active:r,disabled:n,selected:B.includes(t)};return(0,J.jsxs)(`button`,{"aria-disabled":n||void 0,"aria-selected":i.selected,className:`caps-combobox-option`,"data-active":r&&te,disabled:n,id:le(t),onClick:()=>{R(e)},onMouseDown:e=>{e.preventDefault()},role:`option`,tabIndex:-1,type:`button`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`caps-combobox-check`,children:i.selected?(0,J.jsx)(Lr,{}):null}),E?.(e,r,i)??p(e)]},t)})]},e.label))});return O?(0,J.jsx)(`div`,{...j,className:V(j.className),ref:D,children:(0,J.jsxs)(ej,{modal:!0,onOpenChange:ue,open:z,children:[(0,J.jsx)(rj,{...ee,"aria-haspopup":`dialog`,className:`btn`,ref:k,render:O}),fe===null?null:(0,J.jsx)(oj,{container:fe,children:(0,J.jsx)(lj,{align:`start`,side:`bottom`,sideOffset:4,children:(0,J.jsxs)(fj,{"data-active-tone":o,className:V(`min-w-40 rounded-box border border-base-300 bg-base-100 p-xs shadow-lg outline-none caps-combobox-panel caps-combobox-popup`,c),children:[(0,J.jsx)(`div`,{className:`caps-combobox-search`,children:me}),he]})})})]})}):(0,J.jsx)(`div`,{...j,className:V(j.className),ref:D,children:(0,J.jsxs)(`div`,{className:V(`caps-combobox-panel`,c),"data-active-tone":o,children:[(0,J.jsx)(`div`,{className:`caps-combobox-search`,children:me}),he]})})}function gj({icon:e,caption:t}){return(0,J.jsxs)(`span`,{className:`caps-icon-choice-mark`,"aria-hidden":`true`,children:[(0,J.jsx)(`span`,{className:`caps-icon-choice-art`,children:e}),t?(0,J.jsx)(`span`,{className:`caps-icon-choice-caption`,children:t}):null,(0,J.jsx)(`span`,{className:`caps-icon-choice-lamp`})]})}var _j=(0,q.forwardRef)(function({label:e,icon:t,caption:n,appearance:r,className:i,...a},o){return(0,J.jsx)(`label`,{className:`caps-icon-choice`,"data-appearance":r===`compact`?r:void 0,children:(0,J.jsx)(OA,{...a,appearance:r??`default`,"aria-label":e,className:V(`caps-icon-choice-input`,i),indicator:(0,J.jsx)(gj,{icon:t,caption:n}),ref:o})})}),vj=(0,q.forwardRef)(function({label:e,icon:t,hint:n,className:r,...i},a){let o=(0,q.useId)(),s=[i[`aria-describedby`],n?o:null].filter(Boolean).join(` `)||void 0;return(0,J.jsx)(`label`,{className:`caps-check-key`,children:(0,J.jsx)(OA,{...i,"aria-label":e,"aria-describedby":s,className:V(`caps-check-key-input`,r),indicator:(0,J.jsxs)(`span`,{className:`caps-check-key-face`,"aria-hidden":`true`,children:[t?(0,J.jsx)(`span`,{className:`caps-check-key-icon`,children:t}):null,(0,J.jsxs)(`span`,{className:`caps-check-key-copy`,children:[(0,J.jsx)(`span`,{className:`caps-check-key-label`,children:e}),n?(0,J.jsx)(`span`,{className:`caps-check-key-hint`,id:o,children:n}):null]}),(0,J.jsx)(`span`,{className:`caps-check-key-lamp`})]}),ref:a})})});function yj({className:e,...t}){return(0,J.jsx)(`div`,{...t,className:V(`caps-check-keys`,e)})}function bj({checked:e}){let t=`caps-radio-${(0,q.useId)().replaceAll(`:`,``)}`,n=(0,q.useRef)(null),r=(0,q.useRef)(e).current,i=(0,q.useRef)(e),a=(0,q.useRef)(null),o=ie(a),{reduced:s}=o;return(0,q.useLayoutEffect)(()=>{if(!n.current)return;let t=s||i.current===e;i.current=e;let r=e?4:0,a=Ur(o,{ease:`outCubic`,duration:75}),c=e?fi(o,{bounce:.65,duration:300}):Ur(o,{ease:`inCubic`,duration:100}),l=Po(n.current,t?{rx:r,ry:r,cy:6,duration:0}:{rx:[{to:e?3.5:4.15,...a},{to:r,...c}],ry:[{to:e?4.5:3.85,...a},{to:r,...c}],cy:[{to:e?5.85:6.1,...a},{to:6,...c}]});return()=>{l.cancel()}},[e,s,o]),(0,J.jsxs)(`svg`,{ref:a,className:`caps-radio-visual`,width:`24`,height:`24`,viewBox:`0 0 12 12`,"aria-hidden":`true`,focusable:`false`,children:[(0,J.jsxs)(`defs`,{children:[(0,J.jsx)(f,{id:`${t}-surface`,transform:`matrix(1 0 0 1 6 6)`}),(0,J.jsx)(xe,{id:`${t}-shadow`}),(0,J.jsx)(gn,{id:`${t}-inset`}),(0,J.jsx)(`clipPath`,{id:`${t}-well`,children:(0,J.jsx)(`circle`,{cx:`6`,cy:`6`,r:`5`})})]}),(0,J.jsx)(`circle`,{className:`caps-radio-track`,cx:`6`,cy:`6`,r:`5.5`,filter:`url(#${t}-inset)`}),(0,J.jsx)(`g`,{clipPath:`url(#${t}-well)`,children:(0,J.jsx)(`ellipse`,{ref:n,cx:`6`,cy:`6`,rx:r?4:0,ry:r?4:0,fill:`url(#${t}-surface)`,filter:`url(#${t}-shadow)`})})]})}var xj=(0,q.createContext)(null),Sj=(0,q.forwardRef)(function({children:e,className:t,defaultValue:n,disabled:r=!1,name:i,onValueChange:a,orientation:o=`vertical`,value:s,...c},l){let u=(0,q.useId)(),d=(0,q.useRef)(null);(0,q.useImperativeHandle)(l,()=>{if(!d.current)throw Error(`RadioGroup is not mounted`);return d.current},[]);let f=i??`radio-group-${u}`,[p,m]=(0,q.useState)(n),h=s??p;return(0,q.useEffect)(()=>{let e=d.current?.form;if(!e||s!==void 0)return;let t=e=>{queueMicrotask(()=>{e.defaultPrevented||m(n)})};return e.addEventListener(`reset`,t),()=>{e.removeEventListener(`reset`,t)}},[s,n,c.form]),(0,J.jsx)(xj.Provider,{value:{disabled:r,name:f,onValueChange:e=>{s===void 0&&m(e),a?.(e)},value:h},children:(0,J.jsx)(`fieldset`,{...c,className:V(`flex gap-md`,o===`horizontal`?`flex-row flex-wrap`:`flex-col`,t),disabled:r,role:c.role??`radiogroup`,ref:d,children:e})})}),Cj=(0,q.forwardRef)(function({className:e,indicator:t,onChange:n,onClick:r,value:i,...a},o){let s=(0,q.useContext)(xj);if(!s)throw Error(`RadioGroupItem must be used inside <RadioGroup>`);let c=s.value===i,l=e=>{n?.(e),e.target.checked&&s.onValueChange?.(i)};return(0,J.jsxs)(`span`,{className:`caps-radio`,"data-checked":c,"data-custom-indicator":t!==void 0||void 0,children:[(0,J.jsx)(`input`,{...a,"aria-checked":c,checked:c,className:V(`caps-radio-input`,e),disabled:s.disabled||a.disabled,name:s.name,onChange:l,onClick:r,ref:o,type:`radio`,value:i}),t===void 0?(0,J.jsx)(bj,{checked:c}):t]})}),wj=(0,q.forwardRef)(function({description:e,id:t,meta:n,title:r,...i},a){let o=(0,q.useContext)(xj),s=(0,q.useId)(),c=t??s,l=o?.value===i.value,u=o?.disabled===!0||i.disabled===!0;return(0,J.jsxs)(`label`,{className:`caps-choice-card`,"data-checked":l,"data-disabled":u||void 0,htmlFor:c,children:[(0,J.jsx)(Cj,{...i,"aria-describedby":e?`${c}-description`:void 0,"aria-labelledby":`${c}-title`,id:c,ref:a}),(0,J.jsxs)(`span`,{className:`caps-choice-card-copy`,children:[(0,J.jsx)(`span`,{className:`caps-choice-card-title`,id:`${c}-title`,children:r}),e?(0,J.jsx)(`span`,{className:`caps-choice-card-description`,id:`${c}-description`,children:e}):null]}),n?(0,J.jsx)(`span`,{className:`caps-choice-card-meta`,children:n}):null]})}),Tj=(0,q.forwardRef)(function({label:e,icon:t,caption:n,art:r=`dim`,className:i,...a},o){return(0,J.jsx)(`label`,{className:`caps-icon-choice`,"data-art":r===`color`?r:void 0,children:(0,J.jsx)(Cj,{...a,"aria-label":e,className:V(`caps-icon-choice-input`,i),indicator:(0,J.jsx)(gj,{icon:t,caption:n}),ref:o})})});(0,q.forwardRef)(function({label:e,color:t,className:n,...r},i){return(0,J.jsx)(`label`,{className:`caps-icon-choice`,"data-art":`color`,"data-swatch":``,title:e,children:(0,J.jsx)(Cj,{...r,"aria-label":e,className:V(`caps-icon-choice-input`,n),indicator:(0,J.jsx)(gj,{icon:(0,J.jsx)(`span`,{className:`caps-swatch-dot`,style:{backgroundColor:t}})}),ref:i})})});var Ej=w(b),Dj=w(mt),Oj=w(p(Ge)),kj=w(vt(b)),Aj=vt(wn(File)),jj=w(Aj),Mj=Et([b,Ge,mt,Se,kt,vt(b),Aj]),Nj=w(Mj),Pj=e=>ht(Ej(e.state.value),()=>``),Fj=e=>ht(Dj(e.state.value),()=>!1),Ij=e=>ht(Oj(e.state.value),()=>null),Lj=e=>ht(kj(e.state.value),()=>[]),Rj=e=>ht(jj(e.state.value),()=>[]),zj=e=>ht(Nj(e.state.value),()=>null);function Bj({field:e,spec:t,locked:n,...r}){let[i,a]=(0,q.useState)(!1);return(0,J.jsxs)(vy,{children:[(0,J.jsx)(gy,{...r,name:t.name,disabled:n,type:i?`text`:`password`,autoComplete:`off`,spellCheck:!1,className:`caps-field-secret`,placeholder:t.placeholder,readOnly:t.readOnly,value:Pj(e),onBlur:e.handleBlur,onChange:t=>{e.handleChange(t.currentTarget.value)}}),(0,J.jsx)(U,{type:`button`,variant:`outline`,size:`icon`,"aria-label":i?`Hide`:`Show`,"aria-pressed":i,disabled:n,onClick:()=>{a(e=>!e)},children:i?(0,J.jsx)(xh,{"aria-hidden":`true`}):(0,J.jsx)(Sh,{"aria-hidden":`true`})})]})}var Vj={text:`text`,email:`email`,url:`url`,tel:`tel`};function Hj({spec:e,field:t,locked:n,...r}){let i=Rj(t),a=n||e.readOnly===!0,o=(0,q.useRef)(null);return(0,J.jsxs)(`div`,{className:`flex flex-col gap-sm`,children:[(0,J.jsx)(Te,{asChild:!0,children:(0,J.jsx)(`input`,{...r,ref:o,type:`file`,tabIndex:-1,required:r.required===!0&&i.length===0,name:e.name,accept:e.accept,multiple:e.multiple,disabled:a,onBlur:t.handleBlur,onChange:e=>{t.handleChange(Array.from(e.currentTarget.files??[])),e.currentTarget.value=``}})}),(0,J.jsx)(U,{type:`button`,variant:`outline`,"aria-label":`Choose files for ${e.label}`,"aria-describedby":r[`aria-describedby`],"aria-invalid":r[`aria-invalid`],disabled:a,onBlur:t.handleBlur,onClick:()=>{o.current?.click()},children:`Choose files`}),(0,J.jsx)(HA,{items:i.map((e,t)=>({id:String(t),name:e.name,preview:{kind:`file`},progress:0,progressLabel:`${String(e.size)} bytes`,statusLabel:`Selected`,actions:a?{}:{remove:{label:`Remove`,accessibleLabel:`Remove ${e.name}`}}})),onRemove:e=>{t.handleChange(i.filter((t,n)=>String(n)!==e))},onCancel:()=>void 0,onRetry:()=>void 0})]})}function Uj({spec:e,field:t,locked:n,...r}){let i=e=>{t.handleChange(e)},a={...r,name:e.name,disabled:n,onBlur:t.handleBlur};switch(e.kind){case`text`:case`email`:case`url`:case`tel`:return(0,J.jsx)(gy,{...a,type:Vj[e.kind],inputMode:e.kind===`text`?void 0:e.kind,autoComplete:e.autoComplete,placeholder:e.placeholder,maxLength:e.maxLength,readOnly:e.readOnly,value:Pj(t),onChange:e=>{i(e.currentTarget.value)}});case`textarea`:return(0,J.jsx)(Gi,{...a,rows:e.rows??3,placeholder:e.placeholder,maxLength:e.maxLength,readOnly:e.readOnly,value:Pj(t),onChange:e=>{i(e.currentTarget.value)}});case`secret`:return(0,J.jsx)(Bj,{...r,field:t,spec:e,locked:n});case`money`:return(0,J.jsxs)(vy,{children:[(0,J.jsx)(yy,{className:`caps-field-currency`,children:e.currency??`USD`}),(0,J.jsx)(gy,{...a,inputMode:`decimal`,autoComplete:`off`,className:`caps-field-amount`,placeholder:e.placeholder??`0.00`,readOnly:e.readOnly,value:Pj(t),onChange:e=>{i(e.currentTarget.value)}})]});case`date`:return(0,J.jsx)(gy,{...a,type:`date`,readOnly:e.readOnly,value:Pj(t),onChange:e=>{i(e.currentTarget.value)}});case`number`:return(0,J.jsx)(Py,{...a,...e.min===void 0?{}:{min:e.min},...e.max===void 0?{}:{max:e.max},...e.step===void 0?{}:{step:e.step},...e.unit===void 0?{}:{unit:e.unit},...e.wrap===void 0?{}:{wrap:e.wrap},disabled:n||e.readOnly===!0,decrementLabel:`Decrease ${e.label}`,incrementLabel:`Increase ${e.label}`,value:Ij(t),onValueChange:e=>{t.handleChange(e)}});case`select`:return(0,J.jsxs)(Fy,{...a,value:Pj(t),onChange:e=>{i(e.currentTarget.value)},children:[e.placeholder===void 0?null:(0,J.jsx)(`option`,{value:``,disabled:!0,children:e.placeholder}),e.options.map(e=>(0,J.jsx)(`option`,{value:e.value,disabled:e.disabled,children:e.label},e.value))]});case`combobox`:return(0,J.jsx)(hj,{id:r.id??e.name,"aria-describedby":r[`aria-describedby`],"aria-invalid":r[`aria-invalid`],"aria-required":r[`aria-required`],items:e.options,getKey:e=>e.value,getLabel:e=>e.label,isDisabled:t=>t.disabled||n||e.readOnly===!0,value:Pj(t),...e.placeholder===void 0?{}:{placeholder:e.placeholder},trigger:(0,J.jsx)(pj,{name:e.name,disabled:n||e.readOnly===!0,onBlur:t.handleBlur,children:e.options.find(e=>e.value===Pj(t))?.label??e.placeholder??`Choose…`}),inputProps:{"aria-label":`Search ${e.label}`,disabled:n||e.readOnly===!0},onValueChange:e=>{i(e??``),t.handleBlur()}});case`file`:return(0,J.jsx)(Hj,{...r,spec:e,field:t,locked:n});case`checkbox`:return(0,J.jsx)(OA,{...a,disabled:n||e.readOnly===!0,checked:Fj(t),onChange:e=>{t.handleChange(e.currentTarget.checked)}});case`switch`:return(0,J.jsx)(zn,{...a,disabled:n||e.readOnly===!0,checked:Fj(t),onCheckedChange:e=>{t.handleChange(e)}});case`radio`:case`icon-radio`:case`checkboxes`:case`icon-checkboxes`:return null}}var Wj=new Set([`radio`,`icon-radio`,`checkboxes`,`icon-checkboxes`]);function Gj({spec:e,field:t,locked:n,error:r,layout:i}){let a=n||e.readOnly===!0,o=e.label;if(e.kind===`checkboxes`||e.kind===`icon-checkboxes`){let n=Lj(t),s=(e,r)=>{t.handleChange(r?[...n,e]:n.filter(t=>t!==e))};return(0,J.jsx)(Dy,{legend:o,icon:e.icon,layout:i,...i===`columns`?{legendTitle:o}:{},description:e.help,disabled:a,error:r??null,children:e.kind===`icon-checkboxes`?(0,J.jsx)(`div`,{className:`caps-field-icon-choices`,children:e.options.map(r=>(0,J.jsx)(_j,{name:e.name,value:r.value,label:r.label,...r.caption===void 0?{}:{caption:r.caption},icon:r.icon,disabled:r.disabled,checked:n.includes(r.value),onBlur:t.handleBlur,onChange:e=>{s(r.value,e.currentTarget.checked)}},r.value))}):(0,J.jsx)(yj,{children:e.options.map(r=>(0,J.jsx)(vj,{name:e.name,value:r.value,label:r.label,icon:r.icon,hint:r.description,disabled:r.disabled,checked:n.includes(r.value),onBlur:t.handleBlur,onChange:e=>{s(r.value,e.currentTarget.checked)}},r.value))})})}let s=e.options.some(e=>e.description!==void 0||e.meta!==void 0);return(0,J.jsx)(Dy,{legend:o,icon:e.icon,layout:i,...i===`columns`?{legendTitle:o}:{},description:e.help,disabled:a,error:r??null,children:(0,J.jsx)(Sj,{name:e.name,"aria-label":o,value:Pj(t),onValueChange:e=>{t.handleChange(e),t.handleBlur()},orientation:e.kind===`icon-radio`||s?`horizontal`:`vertical`,children:e.options.map(t=>e.kind===`icon-radio`?(0,J.jsx)(Tj,{value:t.value,label:t.label,...t.caption===void 0?{}:{caption:t.caption},icon:t.icon,disabled:t.disabled},t.value):s?(0,J.jsx)(wj,{value:t.value,title:t.label,description:t.description,meta:t.meta,disabled:t.disabled},t.value):(0,J.jsx)(ky,{label:t.label,orientation:`inline`,children:(0,J.jsx)(Cj,{value:t.value,disabled:t.disabled})},t.value))})})}function Kj({spec:e,field:t,locked:n,error:r,render:i,...a}){return i({name:e.name,label:e.label,help:e.help,value:zj(t),onChange:e=>{t.handleChange(e)},onBlur:t.handleBlur,error:r,disabled:n,id:a.id??e.name,"aria-describedby":a[`aria-describedby`],"aria-invalid":r!==void 0})}function qj({form:e,spec:t,locked:n,layout:r}){let i=sy({form:e,name:t.name}),a=ay(e.store,e=>e.submissionAttempts>0),o=i.state.meta.isBlurred||a?zA(i.state.meta):void 0;if(t.render===void 0&&Wj.has(t.kind))return(0,J.jsx)(Gj,{spec:t,field:i,locked:n,error:o,layout:r});let s=r===`columns`?t.kind===`switch`||t.kind===`checkbox`?`horizontal`:`vertical`:t.kind===`checkbox`?`inline`:(t.layout??(t.kind===`switch`?`row`:`stacked`))===`row`?`horizontal`:`vertical`;return(0,J.jsx)(ky,{label:t.label,...r===`columns`?{labelTitle:t.label}:{},description:t.help,icon:t.icon,orientation:s,error:o,...t.required===void 0?{}:{required:t.required},...t.optional===void 0?{}:{optional:t.optional},children:t.render===void 0?(0,J.jsx)(Uj,{spec:t,field:i,locked:n}):(0,J.jsx)(Kj,{spec:t,field:i,locked:n,error:o,render:t.render})})}var Jj=w(Ee(b,Mj));function Yj({form:e,spec:t,locked:n,layout:r}){let i=t.when;return ay(e.store,e=>i===void 0||i(ht(Jj(e.values),()=>({}))))?(0,J.jsx)(qj,{form:e,spec:t,locked:n,layout:r}):null}function Xj({form:e,section:t,locked:n,layout:r}){let i=t.fields.map(t=>(0,J.jsx)(Yj,{form:e,spec:t,locked:n,layout:r},t.name));return t.title===void 0?i:(0,J.jsx)(Ey,{title:t.title,description:t.description,layout:r,children:i})}function Zj({model:e,names:t,disabled:n=!1,layout:r}){let i=e.form;return t===void 0?e.description.sections.map(e=>(0,J.jsx)(Xj,{form:i,section:e,locked:n,layout:r},e.id??``)):t.map(t=>{let a=e.description.fields.find(e=>e.name===t);return a===void 0?null:(0,J.jsx)(Yj,{form:i,spec:a,locked:n,layout:r},t)})}var Qj=class{annotation;constructor(e){this.annotation=e}},$j=class{sections;constructor(e){this.sections=e}},eM=`caps/form`,tM=0;function nM(e){tM+=1;let t={[`${eM}:${String(tM)}`]:new Qj(e)};return e.label!==void 0&&(t.title=e.label),e.help!==void 0&&(t.description=e.help),t}b.annotate(nM({kind:`secret`})).pipe(ae(`Secret`));var rM=e=>{let t=e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[-_]+/g,` `).toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)};function iM(e){return Object.values(e??{}).reduce((e,t)=>t instanceof Qj?{...e,...t.annotation}:e,{})}function aM(e){return e.reduce((e,t)=>({...e,...iM(t)}),{})}function oM(e){let t=e?.[eM];return t instanceof $j?t.sections:{}}var sM=w(b);function cM(e){if(nn(e))return vn(sM(e.literal),{onNone:()=>null,onSome:e=>[e]});if(!$t(e))return null;let t=[];for(let n of e.types){if(Ht(n))continue;let e=cM(n);if(e===null)return null;t.push(...e)}return t}function lM(e){if(Xe(e))return{type:`string`,literals:[]};if(Zt(e))return{type:`number`,nullable:!1};if(lt(e))return{type:`boolean`};let t=cM(e);if(t!==null)return{type:`string`,literals:t};if(r(e)){let[t]=e.rest;if(t===void 0)return null;if(Xe(t))return{type:`strings`,literals:[]};let n=cM(t);return n===null?null:{type:`strings`,literals:n}}if($t(e)){let t=e.types.filter(e=>!Ht(e)&&!Bt(e)),n=e.types.some(e=>Bt(e)),[r]=t;if(t.length!==1||r===void 0)return null;let i=lM(r);return i?.type===`number`?{type:`number`,nullable:n}:n?null:i}return null}function uM(e){let t=e.ast;if(!Ct(t))throw Error(`A schema form needs a Schema.Struct.`);return{fields:t.propertySignatures.map(e=>{let t=String(e.name),n=st(e.type),r=aM([e.type.annotations,...(e.type.checks??[]).map(e=>e.annotations)]),i=r.kind===`file`?{type:`files`}:lM(n);if(i===null)throw Error(`Schema field "${t}" has no form control. Annotate it with field({ render }) or a kind.`);return{name:t,valueType:i,optional:e.type.context?.isOptional===!0,annotation:r,title:sn(e.type),description:Nt(e.type)}}),sections:oM(rt(t))}}function dM(e){let t=e,n=!1,r=!1;for(;;)if(t instanceof R)n=!0,t=t.unwrap();else if(t instanceof me)r=!0,t=t.unwrap();else if(t instanceof Dt)t=t.unwrap();else if(t instanceof be)t=t.in;else return{node:t,optional:n,nullable:r}}function fM(e){if(e instanceof Me){let t=e.options.map(e=>fM(e));return t.some(e=>e===null)?null:t.flatMap(e=>e??[])}let t=e instanceof oe?e.options:e instanceof le?[...e.values]:null;if(t===null)return null;let n=t.map(e=>sM(e));return n.every(xn)?n.map(e=>e.value):null}function pM(e){let{node:t,nullable:n}=dM(e);if(t instanceof Tn)return{type:`string`,literals:[]};if(t instanceof T)return{type:`number`,nullable:n};if(t instanceof s)return{type:`boolean`};let r=fM(t);if(r!==null)return{type:`string`,literals:r};if(t instanceof At){let e=dM(t.element).node;if(e instanceof Tn)return{type:`strings`,literals:[]};let n=fM(e);return n===null?null:{type:`strings`,literals:n}}return null}function mM(e){let t=[e];for(;;){let e=t[t.length-1];if(e===void 0)break;let n=e instanceof R||e instanceof me||e instanceof Dt?e.unwrap():e instanceof be?e.in:e;if(n===e)break;t.push(n)}return t.reverse().map(e=>Ye.get(e))}function hM(e){return mM(e).reduce((e,t)=>({...e,...t}),{})}function gM(e){return Object.entries(e.shape)}function _M(e){let t=dM(e).node;if(!(t instanceof N))throw Error(`A schema form needs a z.object.`);return{fields:gM(t).map(([e,t])=>{let n=aM(mM(t)),r=n.kind===`file`?{type:`files`}:pM(t);if(r===null)throw Error(`Schema field "${e}" has no form control. Annotate it with field({ render }) or a kind.`);let i=hM(t);return{name:e,valueType:r,optional:dM(t).optional,annotation:n,title:i.title,description:i.description}}),sections:oM(hM(e))}}function vM(e,t){let n=t.options??{};return(e.length>0?e:Object.keys(n)).map(e=>{let t=n[e],r=t===void 0?{}:t instanceof Object?t:{label:t};return{value:e,label:r.label??rM(e),description:r.description,meta:r.meta,icon:r.icon,caption:r.caption,disabled:r.disabled===!0}})}function yM(e,t){let n=t.some(e=>e.icon!==void 0);switch(e.type){case`boolean`:return`switch`;case`number`:return`number`;case`strings`:return n?`icon-checkboxes`:`checkboxes`;case`files`:return`file`;case`string`:return t.length===0?`text`:t.length>12?`combobox`:n?`icon-radio`:t.some(e=>e.description!==void 0||e.meta!==void 0)||t.length<=3?`radio`:`select`}}function bM(e,t){switch(e.type){case`boolean`:return!1;case`number`:return e.nullable?null:0;case`strings`:case`files`:return[];case`string`:return t[0]?.value??``}}function xM(e){let t=e instanceof d?_M(e):uM(e),n=t.fields.map((e,t)=>{let{kind:n,...r}=e.annotation,i=vM(e.valueType.type===`string`||e.valueType.type===`strings`?e.valueType.literals:[],e.annotation),a=r.help??e.description;return{...r,name:e.name,label:r.label??e.title??rM(e.name),help:a,kind:n??yM(e.valueType,i),options:i,optionalInSchema:e.optional,index:t}}),r={};t.fields.forEach((e,t)=>{let i=n[t];i&&(r[e.name]=bM(e.valueType,i.options))});let i=e=>e.order??e.index,a=e=>e.section!==void 0&&Object.hasOwn(t.sections,e.section)?e.section:null,o=e=>n.filter(t=>a(t)===e).sort((e,t)=>i(e)-i(t)),s=Object.entries(t.sections).map(([e,t])=>({id:e,title:t.title,description:t.description,fields:o(e)}));return{fields:n,sections:[{id:null,title:void 0,description:void 0,fields:o(null)},...s].filter(e=>e.fields.length>0),defaults:r}}function SM(e){let t=e instanceof d?e:ge(e);return{"~standard":{...t[`~standard`],validate:e=>{let n=t[`~standard`].validate(e);return n instanceof Promise?n.then(e=>CM(e)):CM(n)}}}}function CM(e){return e.issues===void 0?e:{issues:e.issues.map(e=>e.path===void 0?e:{...e,path:e.path.slice(0,1)})}}var wM=`onServer`;function TM(e){let t=e.querySelector(`[aria-invalid="true"]`),n=t?.matches(`input, select, textarea, button, [tabindex]`)?t:t?.querySelector(`input, select, textarea, button`);return n?.focus(),n!=null}function EM(e){if(TM(e))return()=>void 0;let t=new MutationObserver(()=>{TM(e)&&t.disconnect()});return t.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`aria-invalid`]}),()=>{t.disconnect()}}function DM(e){return e.state.meta.errorMap.onServer!==void 0}function OM(e){e.setMeta(e=>({...e,errorMap:{...e.errorMap,[wM]:void 0}}))}function kM(e,t,n){e.setFieldMeta(t,e=>({...e,isBlurred:!0,errorMap:{...e.errorMap,[wM]:n}}))}function AM(e){let[t,n]=(0,q.useState)(null),[r,i]=(0,q.useState)(null),[a,o]=(0,q.useState)(e.defaultValues),[s,c]=(0,q.useState)(null);wv(a,e.defaultValues)||(o(e.defaultValues),c(null));let{schema:l}=e,u=(0,q.useMemo)(()=>xM(l),[l]),d=(0,q.useMemo)(()=>SM(l),[l]),f=hy({defaultValues:s??a,validators:{onChange:d,onSubmit:d},listeners:{onChange:({fieldApi:e})=>{n(null),i(null),DM(e)&&OM(e)}},onSubmit:async({value:t,formApi:r})=>{n(null),i(null);let a=await SM(l)[`~standard`].validate(t);if(a.issues){n(a.issues[0]?.message??`Check the form and try again.`);return}let o;try{o=await e.onSubmit(a.value,t)??{kind:`saved`}}catch(t){console.error(`SchemaForm submit failed`,t),n(e.failure??`Couldn't save changes. Try again.`);return}if(o.kind===`refused`){n(o.error??null);let e=r;for(let[t,n]of Object.entries(o.fields??{}))n!==void 0&&n.length>0&&kM(e,t,n);return}let s=o.values??t;c(s),r.reset(s),i(o.message??`Saved`),e.onSaved?.(s)}});return{description:u,form:f,error:t,saved:r,discard:()=>{n(null),i(null),f.reset()},submit:()=>f.handleSubmit()}}function jM(e){return{dirty:ay(e.form.store,e=>!e.isDefaultValue),submitting:ay(e.form.store,e=>e.isSubmitting),canSubmit:ay(e.form.store,e=>e.canSubmit)}}function MM({model:e,submitLabel:t=`Save changes`,discardLabel:n,onCancel:r,cancelLabel:i,allowClean:a,layout:o,footer:s,children:c,disabled:l=!1,...u}){let{submitting:d}=jM(e),f=(0,q.useRef)(null),p=(0,q.useRef)(()=>void 0);return(0,q.useEffect)(()=>()=>{p.current()},[]),(0,J.jsxs)(wy,{...u,ref:f,layout:o,busy:d,noValidate:!0,onSubmit:t=>{t.preventDefault(),e.form.state.isSubmitting||e.submit().then(()=>{p.current();let t=f.current;t!==null&&!e.form.state.isValid&&(p.current=EM(t))})},children:[c??(0,J.jsx)(Zj,{model:e,disabled:l,layout:o}),s===void 0?(0,J.jsx)(FM,{model:e,label:t,discardLabel:r===void 0?n:void 0,onCancel:r,cancelLabel:i,allowClean:a??r!==void 0,divider:r===void 0}):s]})}function NM({schema:e,defaultValues:t,onSubmit:n,onSaved:r,failure:i,...a}){let o=AM({schema:e,defaultValues:t,onSubmit:n,onSaved:r,failure:i});return(0,J.jsx)(MM,{...a,model:o})}function PM(e){return`model`in e?(0,J.jsx)(MM,{...e}):(0,J.jsx)(NM,{...e})}function FM({model:e,label:t,discardLabel:n,onCancel:r,cancelLabel:i=`Cancel`,allowClean:a=!1,dirtyLabel:o=`Unsaved changes`,buttonProps:s,...c}){let{dirty:l,submitting:u}=jM(e),d=u?null:e.saved&&!l?(0,J.jsx)(bi,{tone:`success`,size:`compact`,label:e.saved}):l?(0,J.jsx)(bi,{tone:`neutral`,size:`compact`,label:o}):null;return(0,J.jsxs)(Cy,{...c,error:e.error,status:d,children:[r?(0,J.jsx)(U,{type:`button`,variant:`ghost`,disabled:u,onClick:r,children:i}):n&&l?(0,J.jsx)(U,{type:`button`,variant:`ghost`,disabled:u,onClick:e.discard,children:n}):null,(0,J.jsx)(U,{...s,type:`submit`,loading:u,disabled:u||!l&&!a,title:!l&&!a?`No changes to save`:void 0,children:t})]})}var IM={error:0,warning:1,info:2};function LM(e,t){let n=t.generating+t.uploading>0;if(n)return{busy:n,tone:void 0,label:[t.generating?`Creating ${String(t.generating)}`:``,t.uploading?`Uploading ${String(t.uploading)}`:``].filter(Boolean).join(` · `)};let r=[...e].sort((e,t)=>Number(t.blocking??!1)-Number(e.blocking??!1)||IM[e.tone]-IM[t.tone]).at(0);return r?{busy:n,tone:r.tone===`info`?`neutral`:r.tone,label:r.short+(e.length>1?` +${String(e.length-1)}`:``)}:null}function RM(e,t,n){let r=LM(e,t);if(!r)return null;let i={kind:`button`,id:`activity`,text:`Activity`,count:e.length+t.generating+t.uploading,busy:r.busy,title:v(`Activity: ${r.label}`,1024),opens:`dialog`,expanded:n};return r.tone===void 0?i:{...i,tone:r.tone}}var zM={Setup:(0,J.jsx)(Ih,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)]`}),Images:(0,J.jsx)(Eh,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)]`}),Uploads:(0,J.jsx)(Lh,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)]`})};function BM({notices:e,uploads:t,open:n,inset:r,onOpenChange:i,onDismiss:a,onDismissAll:o,onLoadMore:s}){return(0,J.jsx)(zr,{className:`prints-activity-tray`,placement:`host`,align:`start`,...r===void 0?{}:{hostInset:r},items:[{id:`activity`,label:`Activity`,title:`Activity`,content:(0,J.jsx)(VM,{notices:e,uploads:t,onDismiss:a,onDismissAll:o,onLoadMore:s})}],openId:n?`activity`:null,onOpenChange:e=>{i(e===`activity`)}})}function VM({notices:e,uploads:t,onDismiss:n,onDismissAll:r,onLoadMore:i}){let a=[`Setup`,`Images`,`Uploads`].map(t=>({group:t,items:e.filter(e=>e.group===t)})).filter(e=>e.items.length);return(0,J.jsxs)(`div`,{className:`prints-instrument`,children:[a.map(({group:e,items:t})=>(0,J.jsxs)(`section`,{"aria-label":e,className:`prints-notice-group`,children:[(0,J.jsx)(Nr,{level:3,children:e}),(0,J.jsx)(Hi,{children:t.map(e=>(0,J.jsx)(Nn,{icon:zM[e.group],primary:(0,J.jsxs)(`span`,{className:`prints-notice-copy`,children:[(0,J.jsx)(`span`,{children:e.title}),e.detail?(0,J.jsx)(`span`,{className:`prints-notice-detail`,children:e.detail}):null]}),actions:(0,J.jsxs)(`div`,{className:`prints-notice-actions`,"aria-label":`Actions for ${e.title}`,children:[e.actions?.map((e,t)=>(0,J.jsx)(U,{variant:t===0?`outline`:`ghost`,size:t===0?`sm`:`xs`,onClick:e.run,children:e.label},e.label)),e.blocking?null:(0,J.jsx)(pt,{"aria-label":`Dismiss ${e.title}`,icon:(0,J.jsx)(Ei,{"aria-hidden":`true`}),onClick:()=>{n(e.key)}})]})},e.key))})]},e)),e.length?null:(0,J.jsx)(hr,{children:`All caught up.`}),t&&t.items.length>0?(0,J.jsxs)(`section`,{"aria-label":`Upload queue`,className:`prints-upload-bank`,children:[(0,J.jsx)(Nr,{level:3,children:`Uploading`}),(0,J.jsx)(HA,{...t})]}):null,(0,J.jsxs)(`div`,{className:`prints-panel-footer`,children:[(0,J.jsx)(`span`,{className:`prints-footer-note`,children:`Clear dismisses finished items`}),(0,J.jsx)(U,{variant:`ghost`,size:`xs`,disabled:!e.some(e=>!e.blocking),onClick:r,children:`Clear`}),i?(0,J.jsx)(U,{variant:`ghost`,size:`xs`,onClick:i,children:`Load more activity`}):null]})]})}function HM({folder:e}){return(0,J.jsx)(cm,{open:e.editing,onOpenChange:e.setEditing,children:(0,J.jsxs)(pm,{children:[(0,J.jsx)(hm,{children:(0,J.jsx)(gm,{children:`Save prints to`})}),(0,J.jsx)(WM,{folder:e},e.computerId),(0,J.jsx)(mm,{children:(0,J.jsx)(_m,{render:(0,J.jsx)(U,{variant:`outline`,size:`sm`}),children:`Close`})})]})})}var UM=g({path:ue.check(F(u($n),{message:`Enter an absolute Computer folder, such as /media.`})).annotate(nM({label:`Folder`,placeholder:`/media`}))});function WM({folder:e}){let t=(0,q.useRef)(!1),n=AM({schema:UM,defaultValues:{path:e.path??`/media`},onSubmit:async({path:n})=>{let r=await e.choose(n,t.current);return r?{kind:`refused`,fields:{path:r}}:{kind:`saved`}}}),r=e=>{t.current=e,n.form.setFieldMeta(`path`,e=>({...e,errorMap:{...e.errorMap,onServer:void 0}}))},i=e.busy||!e.writable;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(PM,{model:n,disabled:i,footer:(0,J.jsxs)(Cy,{divider:!1,children:[(0,J.jsx)(_t,{className:`[--caps-keycap-width:auto]`,label:`Use`,type:`submit`,disabled:i,onClick:()=>{r(!1)}}),(0,J.jsx)(_t,{className:`[--caps-keycap-width:auto]`,label:`Create`,type:`submit`,disabled:i,onClick:()=>{r(!0)}})]})}),e.error?(0,J.jsx)(Nn,{role:`alert`,icon:(0,J.jsx)(Th,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)]`}),primary:e.error}):(0,J.jsx)(hr,{children:e.writable?`Prints saves new images and uploads here and shows this folder as your gallery.`:`This Computer is read-only for Prints, so the folder can’t change.`})]})}var GM={image:`Image`,video:`Video`,audio:`Audio`,media:`Media`};function KM({connected:e,mediaCapability:t,modelsError:n,retryModels:r,modelsLoading:i,models:a,canGenerate:o,mediaSetupMissing:s,canWrite:c,generationErrors:l,recoveryError:u,pendingGenerations:d,activeGenerations:f,atGenerationLimit:p,gallerySlots:m,computerId:h,failed:g,uploadError:_,uploads:v,permissions:y,resume:b,discard:x,retryUpload:S}){let C=[];if(e)h===null?C.push({key:`no-computer`,group:`Setup`,tone:`info`,blocking:!0,short:`Choose a Computer`,title:`No Computer selected`,detail:`Choose a Computer for this window, or create one in Grove.`}):t?n===null?!i&&!o&&!s&&C.push({key:`approval`,group:`Setup`,tone:`warning`,blocking:!0,short:`Generation not enabled`,title:`Media generation isn’t enabled`,detail:`Turn it on in this App’s Team permissions. Images already generated can still be saved.`,actions:[{label:`Permissions`,run:()=>{y()}}]}):C.push({key:`models:${n}`,group:`Setup`,tone:`warning`,blocking:!0,short:`Models unavailable`,title:`Couldn’t load image models`,detail:n,actions:[{label:`Retry`,run:r}]}):C.push({key:`no-media`,group:`Setup`,tone:`info`,blocking:!0,short:`Image creation off`,title:`Image creation is off for this Computer`,detail:`You can still browse and upload images.`});else{let e=It(new G(`Prints disconnected`,{code:`DISCONNECTED`,retryable:!0}));C.push({key:`disconnected`,group:`Setup`,tone:`warning`,blocking:!0,short:e.title,title:e.title,detail:e.message})}e&&h!==null&&!c&&C.push({key:`read-only`,group:`Setup`,tone:`info`,blocking:!0,short:`Read-only`,title:`Read-only Computer`,detail:`Uploads and new prints are off.`});for(let e of l){let t=`${GM[e.mediaKind??`media`]} failed`;C.push({key:e.key,group:`Images`,tone:`error`,short:t,title:`${t}: ${e.message}`,detail:e.prompt,blocking:e.dismiss!==void 0,actions:[...e.billing?[{label:`Open Billing`,run:e.billing}]:e.retry?[{label:`Retry`,run:e.retry}]:[],...e.dismiss?[{label:`Dismiss`,run:e.dismiss}]:[]]})}p&&C.push({key:`generation-limit`,group:`Images`,tone:`info`,short:`At the limit`,title:`At the limit`,detail:wr,blocking:!0}),u!==null&&C.push({key:`recovery:${u}`,group:`Images`,tone:`error`,short:`Retry blocked`,title:u});for(let e of d){if(f.has(e.reference.requestId)||m.some(t=>t.computerId===e.reference.computerId&&t.path===e.input.destination.path))continue;let t=`${GM[Vn(a,e.input.settings.model)?.kind??`media`]} failed`;C.push({key:`unfinished:${e.reference.requestId}`,group:`Images`,tone:`error`,blocking:!0,short:t,title:`${t}: ${e.failure?.message??`Stopped when Prints closed. Retry to run it again.`}`,detail:e.reference.computerId===h?e.typed.prompt:`${e.typed.prompt} · select the original Computer to retry`,actions:[...e.reference.computerId===h?[{label:`Retry`,run:()=>{b(e)}}]:[],{label:`Dismiss`,run:()=>{x(e)}}]})}g.length>0&&C.push({key:`files:${g.join(`|`)}`,group:`Images`,tone:`error`,short:`Couldn’t open images`,title:`Couldn’t open some images`,detail:g.join(`, `)}),_!==null&&C.push({key:`uploads:${_}`,group:`Uploads`,tone:`error`,short:`Upload failed`,title:`Couldn’t add images`,detail:_});for(let e of v)(e.status===`error`||e.status===`cancelled`)&&C.push({key:`upload:${e.id}:${e.status}`,group:`Uploads`,tone:e.status===`error`?`error`:`info`,short:`Upload failed`,title:`${e.file.name} wasn’t saved`,detail:e.message,actions:[{label:`Retry`,run:()=>{S(e.id)}}]});return C}function qM(e,t){let n=Li(ci(e)),r=se($r({queryKey:oi.dismissals(e),mutationFn:({owner:e,id:t,keys:n})=>jr(e.capabilities,{operation:`dismiss-notices`,computerId:t,keys:n}),apply:(e,t)=>({keys:[...new Set([...e.keys,...t.keys])].slice(-200)})})),i=n=>{e&&t&&n.length>0&&r.mutate({owner:e,id:t,keys:n})};return{error:r.variables?.owner===e&&r.variables.id===t&&r.isError?`Could not dismiss activity. Please try again.`:n.isError?`Could not load dismissed activity. Notices may reappear.`:null,visible:e=>e.filter(e=>(e.blocking??!1)||!n.data?.keys.includes(e.key)),dismiss:e=>{i([e])},dismissAll:e=>{i(e.filter(e=>!e.blocking).map(e=>e.key).slice(-200))}}}var JM=0,YM=1,XM=2,ZM=0,QM=1;function $M(e,t,n){let r=e.list,i;for(;r;){if(r.index===n)return!1;if(t>r.high)break;i=r,r=r.next}return i||(e.list={index:n,high:t,next:r}),i&&(i.next={index:n,high:t,next:i.next}),!0}function eN(e,t){let n=e.list;if(n.index===t)return n.next===null?ZM:(e.list=n.next,QM);let r=n;for(n=n.next;n!==null;){if(n.index===t)return r.next=n.next,QM;r=n,n=n.next}}var tN={low:0,max:0,high:0,C:XM,P:void 0,R:void 0,L:void 0,list:void 0};tN.P=tN,tN.L=tN,tN.R=tN;function nN(e){let t=e.high;e.max=e.L===tN&&e.R===tN?t:e.L===tN?Math.max(e.R.max,t):e.R===tN?Math.max(e.L.max,t):Math.max(Math.max(e.L.max,e.R.max),t)}function rN(e){let t=e;for(;t.P!==tN;)nN(t.P),t=t.P}function iN(e,t){if(t.R===tN)return;let n=t.R;t.R=n.L,n.L!==tN&&(n.L.P=t),n.P=t.P,t.P===tN?e.root=n:t===t.P.L?t.P.L=n:t.P.R=n,n.L=t,t.P=n,nN(t),nN(n)}function aN(e,t){if(t.L===tN)return;let n=t.L;t.L=n.R,n.R!==tN&&(n.R.P=t),n.P=t.P,t.P===tN?e.root=n:t===t.P.R?t.P.R=n:t.P.L=n,n.R=t,t.P=n,nN(t),nN(n)}function oN(e,t,n){t.P===tN?e.root=n:t===t.P.L?t.P.L=n:t.P.R=n,n.P=t.P}function sN(e,t){let n;for(;t!==tN&&t.C===YM;)t===t.P.L?(n=t.P.R,n.C===JM&&(n.C=YM,t.P.C=JM,iN(e,t.P),n=t.P.R),n.L.C===YM&&n.R.C===YM?(n.C=JM,t=t.P):(n.R.C===YM&&(n.L.C=YM,n.C=JM,aN(e,n),n=t.P.R),n.C=t.P.C,t.P.C=YM,n.R.C=YM,iN(e,t.P),t=e.root)):(n=t.P.L,n.C===JM&&(n.C=YM,t.P.C=JM,aN(e,t.P),n=t.P.L),n.R.C===YM&&n.L.C===YM?(n.C=JM,t=t.P):(n.L.C===YM&&(n.R.C=YM,n.C=JM,iN(e,n),n=t.P.L),n.C=t.P.C,t.P.C=YM,n.L.C=YM,aN(e,t.P),t=e.root));t.C=YM}function cN(e){for(;e.L!==tN;)e=e.L;return e}function lN(e,t){let n;for(;t.P.C===JM;)t.P===t.P.P.L?(n=t.P.P.R,n.C===JM?(t.P.C=YM,n.C=YM,t.P.P.C=JM,t=t.P.P):(t===t.P.R&&(t=t.P,iN(e,t)),t.P.C=YM,t.P.P.C=JM,aN(e,t.P.P))):(n=t.P.P.L,n.C===JM?(t.P.C=YM,n.C=YM,t.P.P.C=JM,t=t.P.P):(t===t.P.L&&(t=t.P,aN(e,t)),t.P.C=YM,t.P.P.C=JM,iN(e,t.P.P)));e.root.C=YM}function uN(){let e={root:tN,size:0},t={};return{insert(n,r,i){let a=e.root,o=tN;for(;a!==tN&&(o=a,n!==o.low);)a=n<a.low?a.L:a.R;if(n===o.low&&o!==tN){if(!$M(o,r,i))return;o.high=Math.max(o.high,r),nN(o),rN(o),t[i]=o,e.size++;return}let s={low:n,high:r,max:r,C:JM,P:o,L:tN,R:tN,list:{index:i,high:r,next:null}};o===tN?e.root=s:(s.low<o.low?o.L=s:o.R=s,rN(s)),lN(e,s),t[i]=s,e.size++},remove(n){let r=t[n];if(r===void 0)return;delete t[n];let i=eN(r,n);if(i===void 0)return;if(i===QM){r.high=r.list.high,nN(r),rN(r),e.size--;return}let a=r,o=a.C,s;r.L===tN?(s=r.R,oN(e,r,r.R)):r.R===tN?(s=r.L,oN(e,r,r.L)):(a=cN(r.R),o=a.C,s=a.R,a.P===r?s.P=a:(oN(e,a,a.R),a.R=r.R,a.R.P=a),oN(e,r,a),a.L=r.L,a.L.P=a,a.C=r.C),nN(s),rN(s),o===YM&&sN(e,s),e.size--},search(t,n,r){let i=[e.root];for(;i.length!==0;){let e=i.pop();if(!(e===tN||t>e.max)&&(e.L!==tN&&i.push(e.L),e.R!==tN&&i.push(e.R),e.low<=n&&e.high>=t)){let n=e.list;for(;n!==null;)n.high>=t&&r(n.index,e.low),n=n.next}}},get size(){return e.size}}}var dN=e=>{let t=q.useRef(e);return q.useEffect(()=>{t.current=e}),t},fN=(e,t)=>{let n=t||pN,r,i;return function(){return r&&n(arguments,r)?i:i=e.apply(null,r=arguments)}},pN=(e,t)=>e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3],mN=class{constructor(){this.set=void 0,this.get=void 0;let e,t;this.get=n=>n===e?t:void 0,this.set=(n,r)=>{e=n,t=r}}},hN=e=>{try{return new e}catch{let e={};return{set(t,n){e[t]=n},get(t){return e[t]}}}},gN=e=>{let t=e.length,n=hN(e[0]),r,i,a,o,s=t===1;return t<3?{g:e=>(r=n.get(e[0]))===void 0||s?r:r.get(e[1]),s:(t,a)=>(s?n.set(t[0],a):(r=n.get(t[0]))===void 0?(i=hN(e[1]),i.set(t[1],a),n.set(t[0],i)):r.set(t[1],a),a)}:{g:e=>{for(o=n,a=0;a<t;a++)if((o=o.get(e[a]))===void 0)return;return o},s:(r,s)=>{for(o=n,a=0;a<t-1;a++)(i=o.get(r[a]))===void 0?(i=hN(e[a+1]),o.set(r[a],i),o=i):o=i;return o.set(r[t-1],s),s}}},_N=(e,t)=>{let n,{g:r,s:i}=gN(e);return function(){return(n=r(arguments))===void 0?i(arguments,t.apply(null,arguments)):n}},vN=new WeakMap;function yN(){let e=q.useState(bN)[1];return q.useRef(()=>e({})).current}var bN={},xN=q.createElement;function SN(e){let{positioner:t,resizeObserver:n,items:r,as:i=`div`,id:a,className:o,style:s,role:c=`grid`,tabIndex:l=0,containerRef:u,itemAs:d=`div`,itemStyle:f,itemHeightEstimate:p=300,itemKey:m=ON,overscanBy:h=2,scrollTop:g,isScrolling:_,height:v,render:y,onRender:b}=e,x=0,S,C=yN(),w=AN(t,n),T=r.length,{columnWidth:E,columnCount:D,range:O,estimateHeight:k,size:A,shortestColumn:j}=t,M=A(),N=j(),P=[],F=c===`list`?`listitem`:c===`grid`?`gridcell`:void 0,I=dN(b);h=v*h;let ee=g+h,te=N<ee&&M<T;if(O(Math.max(0,g-h/2),ee,(e,t,n)=>{let i=r[e],a=m(i,e),o={top:n,left:t,width:E,writingMode:`horizontal-tb`,position:`absolute`};P.push(xN(d,{key:a,ref:w(e),role:F,style:typeof f==`object`&&f?Object.assign({},o,f):o},wN(y,e,i,E))),S===void 0?(x=e,S=e):(x=Math.min(x,e),S=Math.max(S,e))}),te){let e=Math.min(T-M,Math.ceil((g+h-N)/p*D)),t=M,n=kN(E);for(;t<M+e;t++){let e=r[t],i=m(e,t);P.push(xN(d,{key:i,ref:w(t),role:F,style:typeof f==`object`?Object.assign({},n,f):n},wN(y,t,e,E)))}}q.useEffect(()=>{typeof I.current==`function`&&S!==void 0&&I.current(x,S,r),CN=`1`},[x,S,r,I]),q.useEffect(()=>{te&&C()},[te,t]);let ne=TN(_,k(T,p));return xN(i,{ref:u,key:CN,id:a,role:c,className:o,tabIndex:l,style:typeof s==`object`?DN(ne,s):ne,children:P})}var CN=`0`,wN=_N([mN,{},WeakMap,mN],(e,t,n,r)=>xN(e,{index:t,data:n,width:r})),TN=fN((e,t)=>({position:`relative`,width:`100%`,maxWidth:`100%`,height:Math.ceil(t),maxHeight:Math.ceil(t),willChange:e?`contents`:void 0,pointerEvents:e?`none`:void 0})),EN=(e,t)=>e[0]===t[0]&&e[1]===t[1],DN=fN((e,t)=>Object.assign({},e,t),EN);function ON(e,t){return t}var kN=fN(e=>({width:e,zIndex:-1e3,visibility:`hidden`,position:`absolute`,writingMode:`horizontal-tb`}),(e,t)=>e[0]===t[0]),AN=fN((e,t)=>n=>r=>{r!==null&&(t&&(t.observe(r),vN.set(r,n)),e.get(n)===void 0&&e.set(n,r.offsetHeight))},EN),jN=function(e,t,n,r){n===void 0&&(n=0),r===void 0&&(r=n);let i=uN(),a=Array(e),o=[],s=Array(e);for(let t=0;t<e;t++)a[t]=0,s[t]=[];return{columnCount:e,columnWidth:t,set:function(e,c){c===void 0&&(c=0);let l=0;for(let e=1;e<a.length;e++)a[e]<a[l]&&(l=e);let u=a[l]||0;a[l]=u+c+r,s[l].push(e),o[e]={left:l*(t+n),top:u,height:c,column:l},i.insert(u,u+c,e)},get:e=>o[e],update:t=>{let n=Array(e),c=0,l=0;for(;c<t.length-1;c++){let e=t[c],r=o[e];r.height=t[++c],i.remove(e),i.insert(r.top,r.top+r.height,e),n[r.column]=n[r.column]===void 0?e:Math.min(e,n[r.column])}for(c=0;c<n.length;c++){if(n[c]===void 0)continue;let e=s[c],t=MN(e,n[c]),u=s[c][t],d=o[u];for(a[c]=d.top+d.height+r,l=t+1;l<e.length;l++){let t=e[l],n=o[t];n.top=a[c],a[c]=n.top+n.height+r,i.remove(t),i.insert(n.top,n.top+n.height,t)}}},range:(e,t,n)=>i.search(e,t,(e,t)=>n(e,o[e].left,t)),estimateHeight:(t,n)=>{let r=Math.max(0,Math.max.apply(null,a));return t===i.size?r:r+Math.ceil((t-i.size)/e)*n},shortestColumn:()=>a.length>1?Math.min.apply(null,a):a[0]||0,size(){return i.size},all(){return o}}},MN=(e,t)=>{let n=0,r=e.length-1;for(;n<=r;){let i=n+r>>>1,a=e[i];if(a===t)return i;a<=t?n=i+1:r=i-1}return-1},NN=(0,q.createContext)(null);function PN(){let e=(0,q.useContext)(NN);if(e===null)throw Error(`An audio tile part must sit inside an AudioTileScope`);return e}function FN({url:e,children:t}){let n=d_(e,at);return(0,J.jsx)(NN.Provider,{value:n,children:t})}function IN({url:e}){let{progress:t}=PN();return(0,J.jsx)(`span`,{className:`prints-audio-tile`,children:(0,J.jsx)(f_,{progress:t,url:e})})}function LN({title:e}){let t=PN();return(0,J.jsx)(pt,{"aria-label":`${t.playing?`Pause`:`Play`} ${e}`,className:`prints-audio-tile-play`,icon:t.playing?(0,J.jsx)(Mh,{}):(0,J.jsx)(Ph,{}),iconSize:`sm`,size:`sm`,variant:`accent`,onClick:t.toggle})}var RN=8,zN=320,BN=4,VN=640,HN=656;function UN(e,t){return e<=0||!Number.isFinite(t)||t<=0?0:e===1?1:e<=BN?t<VN?1:e===2||t<HN?2:3:t>=1280?4:t>=HN?3:2}function WN({item:e}){return an(e.path)?(0,J.jsx)(IN,{url:e.url}):lo(e.path)?(0,J.jsx)(`video`,{"aria-label":e.path,className:`block h-full w-full object-cover`,"data-media-thumb":!0,loop:!0,muted:!0,playsInline:!0,src:e.url}):(0,J.jsx)(`img`,{alt:e.path,className:`block h-full w-full object-cover`,"data-media-thumb":!0,src:e.url})}var GN=(0,q.memo)(function({item:e}){let t=(0,q.useRef)(null);(0,q.useEffect)(()=>{e.onVisible?.()},[e.onVisible]);let[n,r]=(0,q.useState)(e.pending===!0&&!e.onVisible);return e.pending&&!e.onVisible&&!n&&r(!0),(0,q.useLayoutEffect)(()=>{let r=t.current;if(!r||e.pending||n)return;let i=window.matchMedia(`(prefers-reduced-motion: reduce)`);if(i.matches)return;let a=!0,o,s,c=()=>o?.();return Rr(async()=>{let{animate:e,spring:t}=await import(`./modules-C4mfDnjH.js`).then(e=>e.t);return{animate:e,spring:t}},__vite__mapDeps([3,1]),import.meta.url).then(({animate:e,spring:t})=>{if(!a)return;let n=e(r,{opacity:{from:0,to:1,duration:160,ease:`outQuad`},translateY:{from:6,to:0,ease:t({bounce:.16,duration:320})},scale:{from:.985,to:1,ease:t({bounce:.16,duration:320})}});o=()=>{n.complete()},s=()=>{n.revert()}}),i.addEventListener(`change`,c),()=>{a=!1,i.removeEventListener(`change`,c),s?.()}},[e.key,e.pending,n]),(0,J.jsxs)(`div`,{ref:t,className:`prints-gallery-tile`,"data-referenced":e.referenced?!0:void 0,children:[e.error?(0,J.jsx)(`div`,{className:`block h-full w-full overflow-hidden bg-base-200`,"data-media-failed":!0,title:e.path,children:(0,J.jsx)(bm,{status:`failed`,failure:(0,J.jsxs)(`div`,{className:`flex max-w-full flex-col items-center gap-xs`,children:[e.prompt?(0,J.jsx)(`p`,{className:`m-0 max-w-full truncate px-md text-xs text-(--stipe-fg-muted)`,children:e.prompt}):null,(0,J.jsx)(vm,{density:`tile`,message:e.error,onRetry:e.onRetry,onDismiss:e.onDismiss})]})})}):(0,J.jsx)(`button`,{className:`block h-full w-full overflow-hidden bg-base-200 p-0 text-left`,"data-media-thumb-wrap":!0,type:`button`,disabled:e.pending,"aria-pressed":e.select?.active?e.select.checked:void 0,onClick:()=>{e.select?.active?e.select.onToggle():e.onOpen(e.path)},onKeyDown:t=>{t.key.toLowerCase()===`i`&&!t.ctrlKey&&!t.metaKey&&!t.altKey&&e.onInfo&&(t.preventDefault(),e.onInfo())},title:e.path,children:(0,J.jsx)(`div`,{className:`caps-item block! h-full w-full overflow-hidden rounded-none! border-0! bg-transparent! shadow-none! z-auto! -outline-offset-2!`,"data-selected":e.selected??!1,children:e.pending||n?(0,J.jsx)(bm,{"data-media-pending":e.pending?`true`:void 0,indicator:(0,J.jsx)(`div`,{className:`prints-pending-loader`,"data-run":e.pending&&(e.prompt||e.onStop)?``:void 0,children:(0,J.jsx)(ln,{decorative:!0,size:`fill`,tone:`accent`,variant:`bloom`})}),label:e.pendingLabel??`Preparing image…`,status:e.pending?`generating`:`done`,children:e.pending?null:(0,J.jsx)(WN,{item:e})}):(0,J.jsx)(WN,{item:e})})}),e.pending&&!e.error&&(e.prompt||e.onStop)?(0,J.jsxs)(`div`,{className:`prints-tile-run`,"data-media-run":!0,children:[e.prompt?(0,J.jsx)(`p`,{className:`prints-tile-caption`,"data-media-caption":!0,children:e.prompt}):null,e.onStop?(0,J.jsx)(pt,{"aria-label":`Stop`,title:`Stop`,size:`sm`,variant:`outline`,iconSize:`sm`,className:`prints-tile-stop`,onClick:e.onStop,icon:(0,J.jsx)(Zn,{fill:`currentColor`})}):null]}):null,!e.pending&&!e.error?(0,J.jsx)(JN,{item:e}):null,(0,J.jsxs)(`div`,{className:`prints-gallery-tools`,children:[!e.pending&&!e.error?(0,J.jsx)(YN,{item:e}):null,!e.pending&&e.onInfo?(0,J.jsx)(pt,{className:`prints-gallery-secondary`,"aria-label":`Image info: ${e.path}`,title:`Image info (I)`,"aria-keyshortcuts":`I`,onClick:e.onInfo,icon:(0,J.jsx)(Oh,{})}):null,!e.pending&&e.onToggleReference?(0,J.jsx)(pt,{className:`prints-gallery-reference prints-gallery-secondary`,"aria-label":`${e.referenced?`Remove reference`:`Add reference`}: ${e.path}`,title:e.referenced?`Remove reference`:`Add reference`,"aria-pressed":e.referenced??!1,disabled:e.referenceDisabled,onClick:e.onToggleReference,icon:e.referenced?(0,J.jsx)(Lr,{}):(0,J.jsx)(Eh,{})}):null]})]})}),KN=(0,q.memo)(function({item:e}){return an(e.path)?(0,J.jsx)(FN,{url:e.url,children:(0,J.jsx)(GN,{item:e})}):(0,J.jsx)(GN,{item:e})}),qN=e=>`${String(e)}s`;function JN({item:e}){let{select:t}=e;return(0,J.jsxs)(J.Fragment,{children:[an(e.path)&&e.url!==``?(0,J.jsx)(LN,{title:e.path}):null,(0,J.jsx)(`div`,{className:`prints-tile-mark`,"data-checked":t?.active?t.checked:void 0,"data-favorite":e.favorite?!0:void 0,children:t?.active?(0,J.jsx)(OA,{appearance:`compact`,"aria-label":`Select ${e.path}`,checked:t.checked,onChange:t.onToggle}):e.onToggleFavorite?(0,J.jsx)(pt,{"aria-label":`${e.favorite?`Unfavorite`:`Favorite`}: ${e.path}`,"aria-pressed":e.favorite??!1,className:`prints-tile-heart`,icon:(0,J.jsx)(fr,{fill:e.favorite?`currentColor`:`none`}),onClick:e.onToggleFavorite,title:e.favorite?`Remove from favorites`:`Favorite`}):null}),e.badge?(0,J.jsx)(`div`,{className:`prints-tile-badge`,"data-media-badge":!0,children:e.badge.label===null?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Lh,{"aria-hidden":!0,size:12}),(0,J.jsx)(`span`,{children:`Upload`})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`prints-tile-badge-model`,children:e.badge.label}),e.badge.seconds===null?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(_i,{"aria-hidden":!0,size:12}),(0,J.jsx)(`span`,{children:qN(e.badge.seconds)})]})]})}):null,e.folderCaption?(0,J.jsx)(`div`,{className:`prints-tile-folder`,title:e.folderCaption,children:e.folderCaption}):null]})}function YN({item:e}){return!e.onMove||e.select?.active?null:(0,J.jsxs)(Co,{children:[(0,J.jsx)(Ia,{render:(0,J.jsx)(pt,{"aria-label":`More actions: ${e.path}`,title:`More actions`,icon:(0,J.jsx)(ao,{})})}),(0,J.jsxs)(qa,{children:[(0,J.jsxs)(so,{onSelect:e.onMove,children:[(0,J.jsx)(On,{"aria-hidden":!0,size:16}),` Move to…`]}),e.onToggleFavorite?(0,J.jsxs)(so,{onSelect:e.onToggleFavorite,children:[(0,J.jsx)(fr,{"aria-hidden":!0,size:16}),` `,e.favorite?`Remove from favorites`:`Favorite`]}):null,e.onInfo?(0,J.jsxs)(so,{onSelect:e.onInfo,children:[(0,J.jsx)(Oh,{"aria-hidden":!0,size:16}),` Image info`]}):null,e.onToggleReference?(0,J.jsxs)(so,{disabled:e.referenceDisabled,onSelect:e.onToggleReference,children:[e.referenced?(0,J.jsx)(Lr,{"aria-hidden":!0,size:16}):(0,J.jsx)(Eh,{"aria-hidden":!0,size:16}),` `,e.referenced?`Remove reference`:`Add reference`]}):null]})]})}var XN=(0,q.memo)(function({children:e,style:t,...n}){return(0,J.jsx)(`div`,{"data-media-grid":!0,...n,style:t,children:e})});function ZN(e,t){let[n,r]=(0,q.useState)({height:0,width:0});return(0,q.useEffect)(()=>{let t=e.current;if(!t)return;let n=()=>{r(e=>{let n={height:t.clientHeight,width:t.clientWidth};return n.width===e.width&&n.height===e.height?e:n})};n();let i=new ResizeObserver(n);return i.observe(t),window.addEventListener(`resize`,n),()=>{i.disconnect(),window.removeEventListener(`resize`,n)}},[e,t]),n}function QN(e){let[t,n]=(0,q.useState)(0),[r,i]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{let t=e.current;if(!t)return;let r=null,a=()=>{n(t.scrollTop),i(!0),r!==null&&clearTimeout(r),r=setTimeout(()=>{i(!1)},150)};return t.addEventListener(`scroll`,a,{passive:!0}),()=>{t.removeEventListener(`scroll`,a),r!==null&&clearTimeout(r)}},[e]),{isScrolling:r,scrollTop:t}}function $N(e,t){let n=t.height>0?t.width/t.height:1;return Math.round(e/n)}function eP(e,t,n,r){let i=Math.floor((t-(n-1)*RN)/n),a=e.length===1?e[0]:void 0;if(!a||r<=0)return i;let o=a.height>0?a.width/a.height:1;return Math.max(1,Math.min(i,Math.floor(r*o)))}function tP(e,t,n){let r=e.some(e=>e.select!==void 0),i=Math.max(1,UN(e.length,t),r&&e.length>=2?2:1),a=t-16,o=n-16;return(0,q.useMemo)(()=>{let t=eP(e,a,i,o),n=jN(i,t,RN);return t>0&&e.forEach((e,r)=>{n.set(r,$N(t,e))}),n},[e,a,i,o])}var nP=132,rP=(0,q.memo)(function({data:e,width:t}){let n=$N(t,e);return(0,J.jsx)(`div`,{"data-media-tile":e.key,"data-short":n<nP?``:void 0,style:{height:n,width:t},children:(0,J.jsx)(KN,{item:e})})});function iP(e,t){let n=Array.from(e.querySelectorAll(`[data-media-tile]`)).find(e=>e.dataset.mediaTile===t)?.querySelector(`[data-media-thumb-wrap]`);return!n||n.disabled?!1:(n.focus({preventScroll:!0}),!0)}function aP(e,t,n){let r=e.ownerDocument;(r.activeElement!==r.body||iP(e,t))&&n()}function oP(e,t,n){let r=n.top+t.getBoundingClientRect().top-e.getBoundingClientRect().top+e.scrollTop;return(r<e.scrollTop||r+n.height>e.scrollTop+e.clientHeight)&&e.scrollTo({top:r,behavior:`instant`}),r}var sP=(0,q.memo)(function({items:e,scrollRef:t,focus:n}){let r=ZN(t,e.length),i=r.width||zN,a=e.length===1&&r.height>0,o=i-16,s=r.height-16,c=tP(e,i,r.height),{isScrolling:l,scrollTop:u}=QN(t),d=(0,q.useRef)(new Set),f=(0,q.useRef)(null),p=(0,q.useRef)(null);(0,q.useEffect)(()=>{if(!n)return;let a=f.current===n.requestId;if(a&&p.current===i)return;let o=t.current,s=e.findIndex(e=>e.key===n.key),l=c.get(s);if(!o||!l||r.height===0)return;let u=o.querySelector(`[data-media-grid]`);if(!u)return;let d=oP(o,u,l);if(a){aP(o,n.key,()=>{p.current=i});return}iP(o,n.key)?(f.current=n.requestId,p.current=i,n.onFocus()):o.scrollTo({top:d,behavior:`instant`})},[n,e,r.height,t,u,c,i]),(0,q.useEffect)(()=>{let n=t.current;if(!n||r.width===0||r.height===0)return;let i=e.findIndex(e=>e.pending&&!e.onVisible&&!d.current.has(e.key));if(d.current=new Set(e.map(e=>e.key)),i<0)return;let a=c.get(i),o=n.querySelector(`[data-media-grid]`);if(!a||!o)return;let s=o.getBoundingClientRect().top-n.getBoundingClientRect().top+n.scrollTop,l=i===0?0:s+a.top,u=l+a.height;l>=n.scrollTop&&u<=n.scrollTop+n.clientHeight||n.scrollTo({top:Math.max(0,l-RN),behavior:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`instant`:`smooth`})},[e,r.width,r.height,t,c]);let m=(0,q.useCallback)(({data:e,width:t})=>(0,J.jsx)(rP,{data:e,width:t}),[]),h=SN({as:XN,height:r.height,isScrolling:l,itemKey:e=>e.key,items:e,overscanBy:2,positioner:c,render:m,scrollTop:u});return(0,J.jsx)(`div`,{"data-media-sole":a?``:void 0,style:{boxSizing:`border-box`,padding:RN,...a?{display:`flex`,alignItems:`center`,justifyContent:`center`,minHeight:r.height}:void 0},children:(0,J.jsx)(`div`,{style:{width:a?eP(e,o,1,s):`100%`},children:h})})});function cP({items:e,scrollRef:t,focus:n}){return(0,J.jsx)(`section`,{"data-media-mosaic":!0,children:(0,J.jsx)(sP,{items:e,scrollRef:t,focus:n})})}function lP(e,t,n){let r=new Map(e.map(e=>[e.key,e])),i=new Set(t.map(e=>e.key));return[...[...t].reverse().filter(e=>!e.resolved||r.has(e.key)).map(e=>{let t=r.get(e.key);return t&&e.resolved?t:n(e)}),...e.filter(e=>!i.has(e.key))]}var uP=48;function dP({slides:e,index:t,onIndexChange:n,onClose:r,returnFocusTo:i}){let a=(0,q.useRef)(null),o=(0,q.useRef)(!1),s=t===null?void 0:e.at(t),c=s!==void 0,l=(0,q.useRef)(null);t!==null&&s!==void 0&&(l.current={slide:s,index:t});let u=l.current;if(u===null)return null;let{slide:d}=u,f=t=>{let r=u.index+t;r>=0&&r<e.length&&n(r)};return(0,J.jsx)(cm,{open:c,onOpenChange:e=>{e||r()},children:(0,J.jsxs)(um,{children:[(0,J.jsx)(dm,{}),(0,J.jsxs)(fm,{size:`fill`,className:`prints-reference-lightbox`,finalFocus:()=>i(d.key),onClick:e=>{let t=e.target;if(o.current){o.current=!1;return}(t===e.currentTarget||t instanceof HTMLElement&&t.dataset.dismiss!==void 0)&&r()},onKeyDown:e=>{e.altKey||e.ctrlKey||e.metaKey||(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),f(e.key===`ArrowLeft`?-1:1))},children:[(0,J.jsxs)(`div`,{className:`prints-reference-lightbox-bar`,"data-dismiss":!0,children:[(0,J.jsx)(gm,{className:`prints-reference-lightbox-title`,children:d.label}),(0,J.jsxs)(`span`,{className:`prints-reference-lightbox-position`,"aria-live":`polite`,"aria-atomic":`true`,children:[u.index+1,` of `,e.length]}),(0,J.jsx)(pt,{icon:(0,J.jsx)(Ei,{}),"aria-label":`Close`,title:`Close (Esc)`,onClick:r})]}),(0,J.jsx)(`div`,{className:`prints-reference-lightbox-stage`,"data-dismiss":!0,onPointerDown:e=>{a.current=e.clientX,o.current=!1},onPointerUp:e=>{let t=a.current;if(a.current=null,t===null)return;let n=e.clientX-t;o.current=Math.abs(n)>8,Math.abs(n)>=uP&&f(n>0?-1:1)},onPointerCancel:()=>{a.current=null},children:(0,J.jsx)(`img`,{src:d.url,alt:d.name,draggable:!1})}),(0,J.jsxs)(`div`,{className:`prints-reference-lightbox-actions`,"data-dismiss":!0,children:[(0,J.jsx)(pt,{size:`default`,iconSize:`md`,"aria-label":`Previous reference`,title:`Previous reference (Left arrow)`,"aria-keyshortcuts":`ArrowLeft`,icon:(0,J.jsx)(_h,{}),disabled:u.index===0,onClick:()=>{f(-1)}}),(0,J.jsx)(pt,{size:`default`,iconSize:`md`,"aria-label":`Next reference`,title:`Next reference (Right arrow)`,"aria-keyshortcuts":`ArrowRight`,icon:(0,J.jsx)(vh,{}),disabled:u.index===e.length-1,onClick:()=>{f(1)}})]})]})]})})}function fP(e){let t=on(),n=Li(nr(e)),r=n=>({mutationFn:t=>{let r=e?.context.get().computerId;if(!e||!r)throw Error(`No Computer selected`);return n(e,r,t)},onSuccess:n=>{t.setQueryData(oi.characters(e),n)}}),i=se(r((e,t,n)=>jn(e.capabilities,t,n))),a=se(r((e,t,n)=>Jn(e.capabilities,t,n)));return{characters:n.data?.characters??[],error:n.error?It(n.error).message:null,busy:i.isPending||a.isPending,save:(e,t)=>{i.mutate(e,{onError:()=>{xi(`The character could not be saved. Try again.`,`prints-character-save`)},onSuccess:t})},remove:(e,t)=>{a.mutate(e,{onSuccess:t,onError:()=>{xi(`The character could not be deleted. Try again.`,`prints-character-delete`)}})}}}var pP=u(Hn),mP=e=>e.split(`/`).at(-1)??e;function hP({paths:e,images:t}){return(0,J.jsx)(`span`,{className:`flex gap-xs`,children:e.map(e=>{let n=t.find(t=>t.path===e);return(0,J.jsx)(`span`,{className:`prints-character-thumb mask mask-squircle`,title:e,children:n?(0,J.jsx)(`img`,{src:n.url,alt:mP(e)}):null},e)})})}function gP({characters:e,images:t,open:n,onOpenChange:r,busy:i,error:a,canUpload:o,onUpload:s,onSave:c,onDelete:l}){let[u,d]=(0,q.useState)(null),f=(0,q.useId)(),p=u?.name.trim()??``,m=p.startsWith(`@`)?p.slice(1):p,h=[];m===``?h.push(`Enter a character name.`):m.length>32?h.push(`Use 32 characters or fewer for the name.`):/^image\d+$/i.test(m)?h.push(`image1, image2 and so on name attached references; pick another name.`):pP(m)||h.push(`Use only letters, numbers, hyphens (-) and underscores (_).`),u?.references.length===0&&h.push(`Select at least one reference image.`),i&&h.push(`Wait for the current character change to finish, then save.`);let g=h.length>0,_=g?f:void 0;return(0,J.jsx)(cm,{open:n,onOpenChange:e=>{e||d(null),r(e)},children:(0,J.jsxs)(pm,{children:[(0,J.jsx)(hm,{children:(0,J.jsx)(gm,{children:`Characters`})}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-sm`,children:[e.length===0&&u===null?(0,J.jsx)(`p`,{className:`text-sm`,children:`No characters yet. Save one, then type @name in a prompt to keep it the same in every image.`}):(0,J.jsx)(`ul`,{className:`flex flex-col gap-sm`,"aria-label":`Saved characters`,children:e.map(e=>(0,J.jsxs)(`li`,{className:`flex items-center justify-between gap-sm`,children:[(0,J.jsxs)(`span`,{className:`flex min-w-0 items-center gap-sm`,children:[(0,J.jsx)(hP,{paths:e.references.map(e=>e.path),images:t}),(0,J.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`@`,e.name]})]}),(0,J.jsxs)(`span`,{className:`flex gap-xs`,children:[(0,J.jsx)(U,{size:`xs`,variant:`ghost`,type:`button`,onClick:()=>{d(e)},children:`Edit`}),(0,J.jsx)(U,{size:`xs`,variant:`ghost`,type:`button`,disabled:i,onClick:()=>{l(e,()=>{u?.id===e.id&&d(null)})},children:`Delete`})]})]},e.id))}),u===null?(0,J.jsx)(U,{size:`xs`,type:`button`,onClick:()=>{d({name:``,description:``,references:[]})},children:`New character`}):(0,J.jsxs)(`div`,{className:`flex flex-col gap-sm`,children:[(0,J.jsx)(gy,{"aria-label":`Character name`,"aria-invalid":!pP(m),"aria-describedby":_,maxLength:33,placeholder:`Name, typed as @name`,value:u.name,onChange:e=>{d({...u,name:e.currentTarget.value})}}),(0,J.jsx)(Gi,{"aria-label":`Character description`,maxLength:500,rows:4,placeholder:`Short description added to the prompt, e.g. a tall girl with silver hair and a red scarf`,value:u.description,onChange:e=>{d({...u,description:e.currentTarget.value})}}),(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-sm`,children:[(0,J.jsxs)(`span`,{className:`text-xs`,children:[`Reference images · `,u.references.length,` selected, up to`,` `,8]}),(0,J.jsxs)(U,{size:`xs`,variant:`ghost`,type:`button`,disabled:!o,onClick:s,children:[(0,J.jsx)(Lh,{"aria-hidden":`true`,size:14}),`Upload`]})]}),t.length===0?(0,J.jsx)(`p`,{className:`text-xs`,children:`No images in the Prints folder yet. Upload one to use it as a reference.`}):(0,J.jsx)(`ul`,{className:`prints-character-picker`,"aria-label":`Reference images`,children:t.map(e=>{let t=u.references.some(t=>t.path===e.path);return(0,J.jsx)(`li`,{title:e.path,children:(0,J.jsxs)(`label`,{className:`prints-character-pick`,children:[(0,J.jsx)(`img`,{src:e.url,alt:``}),(0,J.jsx)(`span`,{className:`prints-character-check`,children:(0,J.jsx)(OA,{"aria-label":`Use ${mP(e.path)}`,checked:t,disabled:!t&&u.references.length>=8,onChange:()=>{d({...u,references:t?u.references.filter(t=>t.path!==e.path):[...u.references,{path:e.path}]})}})})]})},e.path)})}),g?(0,J.jsx)(`p`,{id:f,role:`status`,className:`text-xs`,children:h.join(` `)}):null,(0,J.jsxs)(`div`,{className:`flex gap-xs`,children:[(0,J.jsx)(U,{size:`xs`,variant:`primary`,type:`button`,disabled:g,"aria-describedby":_,onClick:()=>{c({id:u.id,name:m,description:u.description.trim(),references:u.references},()=>{d(null)})},children:`Save character`}),(0,J.jsx)(U,{size:`xs`,variant:`ghost`,type:`button`,onClick:()=>{d(null)},children:`Cancel`})]})]}),a?(0,J.jsx)(`p`,{role:`alert`,className:`text-xs`,children:a}):null]}),(0,J.jsx)(mm,{children:(0,J.jsx)(_m,{render:(0,J.jsx)(U,{variant:`outline`,size:`sm`}),children:`Close`})})]})})}var _P=g({destination:Re(p(b)),height:Re(un),model:Re(b),prompt:Re(b),references:Re(vt(g({computerId:Re(b),path:b,role:Re($e([`first-frame`,`last-frame`,`reference`]))}))),generateAudio:Re(p(mt)),steps:Re(p(un)),style:Re(p(b)),width:Re(un)}),vP=i(K(),Jt()).parse(structuredClone(Ue(_P,{onExcessProperty:`error`}).schema)),yP=(e,t,n,r)=>({id:e,title:t,category:`Image generation`,description:n,projections:{agent:{}},action:r===void 0?{presentation:{type:`action`}}:{inputSchema:r,presentation:{type:`action`}}}),bP=yP(`inspect-generation-draft`,`Inspect image draft`,`Read the current Prints image form and available models`),xP=yP(`set-generation-draft`,`Edit image draft`,`Set selected Prints image form fields; this does not generate an image`,vP),SP=yP(`submit-generation-draft`,`Generate image`,`Submit the current Prints image form using the same action as the Send button`);function CP(e,t){let n=!1,r=new Set,i=(t,i)=>{e.commands.register(t,i).then(e=>{n?e():r.add(e)},()=>void 0)};return i(bP,()=>{if(n)return;let e=t.readDraft();return{draft:{destination:e.destination??null,height:e.height,model:e.model,prompt:e.prompt,generateAudio:e.generateAudio??null,references:e.references.map(e=>{let t={path:e.path,role:e.role??null};return e.computerId===void 0?t:{...t,computerId:e.computerId}}),steps:e.steps??null,style:e.style??null,width:e.width},models:t.readModels().map(e=>({id:e.id,label:e.label,defaultHeight:e.input.defaultHeight,defaultWidth:e.input.defaultWidth,maxReferences:e.input.maxReferences}))}}),i(xP,({arguments:e})=>{if(n)return;let r=L(_P,{onExcessProperty:`error`})(e);t.setDraft(r)}),i(SP,async()=>{if(!n)return{accepted:await t.submit()}}),()=>{if(!n){n=!0;for(let e of r)e();r.clear()}}}function wP(e){return[{id:`clear-prompt`,title:`Clear prompt`,category:`Prompt`,description:`Remove the current prompt`,projections:{slash:{aliases:[`clear`],order:0},palette:{}},handler:()=>{e().clear()}},...Qr.map((t,n)=>({id:`size-${t}`,title:`Use ${t} size`,category:`Prompt`,description:`Use ${String(wi[t].width)} × ${String(wi[t].height)}`,projections:{slash:{aliases:[t],order:n+1},palette:{}},handler:()=>{e().useSize(t)}})),{id:`choose-style`,title:`Choose style`,category:`Prompt`,description:`Pick, create or edit a saved style`,projections:{slash:{aliases:[`style`],order:4},palette:{}},handler:()=>{e().openStyles()}},{id:`no-style`,title:`Use no style`,category:`Prompt`,description:`Send the prompt without a style`,projections:{slash:{aliases:[`nostyle`],order:5},palette:{}},handler:()=>{e().clearStyle()}}]}function TP(e,t){let n=(0,q.useRef)(e);n.current=e;let r=Vf(t,{sourceId:`media-prompt`,namespace:`media`},(0,q.useCallback)(()=>wP(()=>n.current),[])),i=(0,q.useSyncExternalStore)(r.subscribe,r.snapshot,r.snapshot);return{items:(0,q.useMemo)(()=>vr(i).map(e=>({id:e.commandId,command:e.command,slash:e.alias,title:e.title,description:e.description})),[i]),run:e=>{r.execute(e,{origin:`slash`})}}}function EP(e){let t=on(),n=Li(ir(e)),r=n=>({mutationFn:t=>{let r=e?.context.get().computerId;if(!e||!r)throw Error(`No Computer selected`);return n(e,r,t)},onSuccess:n=>{t.setQueryData(oi.styles(e),n)}}),i=se(r((e,t,n)=>kr(e.capabilities,t,n))),a=se(r((e,t,n)=>Qn(e.capabilities,t,n)));return{styles:n.data?.styles??[],error:n.error?It(n.error).message:null,busy:i.isPending||a.isPending,save:(e,t)=>{i.mutate(e,{onError:()=>{xi(`The style could not be saved. Try again.`,`prints-style-save`)},onSuccess:n=>{t(n.styles.find(t=>t.name===e.name))}})},remove:(e,t)=>{a.mutate(e,{onSuccess:t,onError:()=>{xi(`The style could not be deleted. Try again.`,`prints-style-delete`)}})}}}function DP(e){let t=e.filter(e=>e.kind===`video`&&e.video!==null&&e.video.prices.length>0&&e.input.maxReferences>=1&&e.video.referenceRoles.includes(`first-frame`));return t.find(e=>e.video?.provider===`seedance`)??t.at(0)}function OP(e,t,n){let r=e.video;if(r===null)return;let i=Math.log(t/n),a=e=>Math.abs(Math.log(e.width/e.height)-i);return r.formats.filter(e=>e.resolution===r.defaultResolution).reduce((e,t)=>e===void 0||a(t)<a(e)?t:e,void 0)}function kP(e,t){let{lineage:n,printPath:r,models:i,current:a}=t,o=e===`animate`?DP(i):void 0;if(e===`animate`&&o===void 0)return{kind:`refused`,message:`No video model on this Computer takes a first frame.`};let s=Vn(i,n.model),c=s?.transform!=null;if(c&&e===`reuse`)return{kind:`refused`,message:`This print was an image edit, so there is no prompt to reuse. Remix or animate it instead.`};let l=o??(c?void 0:s)??Vn(i,a.model);if(l===void 0)return{kind:`refused`,message:`Choose a model from the granted registry.`};let u=o===void 0&&s===void 0?`This print was made with ${n.model}, which is no longer available. Loaded it with ${Rn(l)} instead.`:null,d=c?[]:n.references.slice(0,n.typed.references),f=e===`animate`?{path:r,role:`first-frame`}:{path:r},p=[f,...d.filter(e=>!Vi(e,t.printComputerId)||e.path!==r)];if(e!==`reuse`&&l.input.maxReferences===0)return{kind:`refused`,message:`${l.label} does not take reference images.`};let m=e===`reuse`?d:e===`remix`?p:[f],h=Fr(a,l),g={width:n.width??h.width,height:n.height??h.height},_=o===void 0?Un(g,l,void 0):OP(l,g.width,g.height)??h,v=o===void 0&&l.input.steps!==`fixed`&&n.steps!==null&&l.id===n.model?n.steps:h.steps,y=n.style!==null&&t.styles.includes(n.style)?n.style:void 0;return{kind:`draft`,notice:u,draft:{...h,destination:void 0,prompt:Tr(c?``:n.typed.prompt,e=>{let t=d.at(e-1),n=t===void 0?-1:m.findIndex(e=>e.path===t.path&&e.computerId===t.computerId);return n<0?void 0:n+1}),references:m,steps:v,style:y,width:_.width,height:_.height}}}function AP({id:e,styles:t,selected:n,disabled:r,onSelect:i}){let a=n===void 0||t.some(e=>e.name===n);return(0,J.jsxs)(Fy,{id:e,"aria-label":`Prompt style`,"data-generation-style":!0,className:`select-sm`,disabled:r,onChange:e=>{i(e.currentTarget.value||void 0)},value:n??``,children:[(0,J.jsx)(`option`,{value:``,children:`No style`}),a?null:(0,J.jsx)(`option`,{value:n,children:n}),t.map(e=>(0,J.jsx)(`option`,{value:e.name,children:e.name},e.id))]})}function jP({styles:e,selected:t,open:n,onOpenChange:r,busy:i,error:a,onSelect:o,onSave:s,onDelete:c}){let[l,u]=(0,q.useState)(null);return(0,J.jsx)(cm,{open:n,onOpenChange:r,children:(0,J.jsxs)(pm,{children:[(0,J.jsx)(hm,{children:(0,J.jsx)(gm,{children:`Styles`})}),(0,J.jsx)(`ul`,{className:`space-y-1`,"aria-label":`Saved styles`,children:e.map(e=>(0,J.jsxs)(`li`,{className:`flex items-center justify-between gap-sm`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),(0,J.jsxs)(`span`,{className:`flex gap-xs`,children:[(0,J.jsx)(U,{size:`xs`,variant:t===e.name?`primary`:`ghost`,type:`button`,"aria-pressed":t===e.name,onClick:()=>{o(e.name),r(!1)},children:`Use`}),e.builtIn?null:(0,J.jsx)(U,{size:`xs`,variant:`ghost`,type:`button`,onClick:()=>{u(e)},children:`Edit`}),(0,J.jsx)(U,{size:`xs`,variant:`ghost`,type:`button`,onClick:()=>{u({name:`${e.name} copy`.slice(0,64),text:e.text})},children:`Duplicate`}),e.builtIn?null:(0,J.jsx)(U,{size:`xs`,variant:`ghost`,type:`button`,disabled:i,onClick:()=>{c(e,()=>{t===e.name&&o(void 0),l?.id===e.id&&u(null)})},children:`Delete`})]})]},e.id))}),l===null?(0,J.jsx)(U,{size:`xs`,type:`button`,onClick:()=>{u({name:``,text:``})},children:`New style`}):(0,J.jsxs)(`div`,{className:`space-y-1`,children:[(0,J.jsx)(gy,{"aria-label":`Style name`,maxLength:64,value:l.name,onChange:e=>{u({...l,name:e.currentTarget.value})}}),(0,J.jsx)(Gi,{"aria-label":`Style text`,maxLength:8e3,rows:6,value:l.text,onChange:e=>{u({...l,text:e.currentTarget.value})}}),(0,J.jsxs)(`div`,{className:`flex gap-xs`,children:[(0,J.jsx)(U,{size:`xs`,variant:`primary`,type:`button`,disabled:i||l.name.trim()===``||l.text.trim()===``,onClick:()=>{let n=e.find(e=>e.id===l.id);s({id:l.id,name:l.name.trim(),text:l.text},e=>{n&&t===n.name&&e&&o(e.name),u(null)})},children:`Save style`}),(0,J.jsx)(U,{size:`xs`,variant:`ghost`,type:`button`,onClick:()=>{u(null)},children:`Cancel`})]})]}),a?(0,J.jsx)(`p`,{role:`alert`,className:`text-xs`,children:a}):null,(0,J.jsx)(mm,{children:(0,J.jsx)(_m,{render:(0,J.jsx)(U,{variant:`outline`,size:`sm`}),children:`Close`})})]})})}var MP=(0,q.lazy)(async()=>({default:(await Rr(()=>import(`./print-info-drawer-B1PQWwH2.js`),__vite__mapDeps([5,1,2,3,6]),import.meta.url)).PrintInfoDrawer})),NP=[`a mushroom knight`,`moss on a keyboard`,`a tiny house made of mushrooms`];function PP(e){Wt.error(e,{id:`prints-generation-error`,toasterId:`prints-generation-notices`})}function FP(e){let t=(0,q.useRef)(!1),n=hy({defaultValues:ri(),onSubmit:async({value:n})=>{t.current=await e.current(n)}}),r=(0,q.useCallback)(async()=>(t.current=!1,await n.handleSubmit(),t.current),[n]);return Object.assign(n,{submitCurrent:r})}function IP(e){let t=[...new Set(e.map(e=>e.group))];return t.length<2?[{group:void 0,choices:e}]:t.map(t=>({group:t,choices:e.filter(e=>e.group===t)}))}function LP({form:e,selected:t,stylePicker:n,sizeChoices:r,sizeMode:i,onCustomSize:a,match:o,onEditStyles:s,onEditCharacters:c}){let l=t?.input.dimensions===`none`,u=t!==void 0&&t.sizes!==null,d=t?.video??null;return(0,J.jsxs)(`div`,{className:`prints-settings`,children:[(0,J.jsx)(ky,{label:`Style`,orientation:`horizontal`,children:n}),(0,J.jsx)(ky,{label:`Size`,orientation:`horizontal`,children:(0,J.jsx)(Fy,{"aria-label":`Generation size`,"data-generation-size":!0,className:`select-sm`,disabled:l,title:l?`This model chooses the output size.`:void 0,onChange:t=>{let n=t.currentTarget.value;o.onChange(n===`match`),a(n===`custom`);let i=r.find(e=>e.value===n);i&&(e.setFieldValue(`width`,i.width),e.setFieldValue(`height`,i.height))},value:l?`provider`:i,children:l?(0,J.jsx)(`option`,{value:`provider`,children:`Model default`}):(0,J.jsxs)(J.Fragment,{children:[o.offered?(0,J.jsx)(`option`,{value:`match`,disabled:o.size===void 0,children:o.size===void 0?`Match first reference: attach an image first`:`Match first reference · ${Yn(o.size.width,o.size.height)}`}):null,u&&i!==`match`&&!r.some(e=>e.value===i)?(0,J.jsx)(`option`,{value:i,disabled:!0,children:`Choose a supported resolution`}):null,IP(r).map(({group:e,choices:t})=>e===void 0?t.map(e=>(0,J.jsx)(`option`,{value:e.value,children:e.label},e.value)):(0,J.jsx)(`optgroup`,{label:e,children:t.map(e=>(0,J.jsx)(`option`,{value:e.value,children:e.label},e.value))},e)),u?null:(0,J.jsx)(`option`,{value:`custom`,children:`Custom size`})]})})}),!l&&!u&&i===`custom`?(0,J.jsxs)(`div`,{className:`prints-custom-size`,children:[(0,J.jsx)(e.Field,{name:`width`,children:e=>(0,J.jsx)(ky,{label:`Width`,children:(0,J.jsx)(gy,{"aria-label":`Generation width`,"data-generation-width":!0,max:4096,min:1,onChange:t=>{e.handleChange(Number(t.currentTarget.value)||1)},type:`number`,value:e.state.value})})}),(0,J.jsx)(e.Field,{name:`height`,children:e=>(0,J.jsx)(ky,{label:`Height`,children:(0,J.jsx)(gy,{"aria-label":`Generation height`,"data-generation-height":!0,max:4096,min:1,onChange:t=>{e.handleChange(Number(t.currentTarget.value)||1)},type:`number`,value:e.state.value})})})]}):null,d?(0,J.jsx)(e.Field,{name:`durationSeconds`,children:e=>(0,J.jsx)(ky,{label:`Length`,orientation:`horizontal`,children:(0,J.jsx)(Fy,{"aria-label":`Video length in seconds`,className:`select-sm`,"data-generation-duration":!0,onChange:t=>{let n=t.currentTarget.value;e.handleChange(d.durations.find(e=>String(e)===n))},value:e.state.value===void 0?``:String(e.state.value),children:d.durations.map(e=>(0,J.jsxs)(`option`,{value:String(e),children:[e,` seconds`]},e))})})}):null,d?.supportsAudio?(0,J.jsx)(e.Field,{name:`generateAudio`,children:e=>d.defaultGenerateAudio===null?(0,J.jsx)(ky,{label:`Sound`,orientation:`horizontal`,children:(0,J.jsxs)(Fy,{"aria-label":`Video sound`,className:`select-sm`,"data-generation-audio":!0,onChange:t=>{let n=t.currentTarget.value;e.handleChange(n===``?void 0:n===`on`)},value:e.state.value===void 0?``:e.state.value?`on`:`off`,children:[(0,J.jsx)(`option`,{value:``,children:`Model default`}),(0,J.jsx)(`option`,{value:`on`,children:`On`}),(0,J.jsx)(`option`,{value:`off`,children:`Off`})]})}):(0,J.jsx)(ky,{label:`Sound`,orientation:`horizontal`,children:(0,J.jsx)(zn,{"aria-label":`Video sound`,checked:e.state.value??!0,"data-generation-audio":!0,onCheckedChange:e.handleChange})})}):null,t&&t.input.steps!==`fixed`?(0,J.jsx)(e.Field,{name:`steps`,children:e=>(0,J.jsx)(ky,{label:`Steps`,optional:!0,orientation:`horizontal`,children:(0,J.jsx)(gy,{"aria-label":`Generation steps`,className:`input-sm`,"data-generation-steps":!0,max:t.input.maxSteps??void 0,min:1,onChange:t=>{e.handleChange(t.currentTarget.value===``?void 0:Number(t.currentTarget.value))},type:`number`,value:e.state.value??``})})}):null,(0,J.jsxs)(`div`,{className:`prints-settings-library`,children:[(0,J.jsx)(U,{size:`xs`,variant:`ghost`,type:`button`,onClick:()=>{s()},children:`Edit styles…`}),(0,J.jsx)(U,{size:`xs`,variant:`ghost`,type:`button`,onClick:()=>{c()},children:`Characters…`})]})]})}function RP(e){return e.detail===void 0?e.title:e.group===`Images`?e.detail:`${e.title}. ${e.detail}`}function zP({actions:e,guidance:t,commandApp:n,form:r,models:i,modelsLoading:a,mediaCapability:o,submitting:s,generateLimitReason:c,values:l,computerId:u,mediaDirectory:d,referenceImages:f,referenceLabels:p,price:m,characters:h,characterDialog:g,onSubmit:_,styleControls:v,addedLength:y}){let b=Vn(i,l.model),x=!o||a||i.length===0,S=x&&t?.group===`Setup`&&t.blocking===!0?t:void 0,C=l.prompt.trim().length,w=b!==void 0&&C>0&&C+y>b.maxPromptLength,T=si(b),E=b?.video??null,D=Cr(l.prompt).length>0,O=rr(l.references,b,D),k=b?.input.maxReferences??0,A=l.references.length>k,j=(0,q.useRef)(null),M=(0,q.useId)(),N=rb(j),[P,F]=(0,q.useState)(!1),I=w?C+y:0,ee=b!==void 0&&w?Pi({addedLength:y,length:I,maxLength:b.maxPromptLength}):void 0,[te,ne]=(0,q.useState)(!1),[re,L]=(0,q.useState)(!1),R=l.references.find(e=>u!==null&&Vi(e,u)),ie=f.find(e=>e.path===R?.path),ae=ie===void 0?void 0:br(b,ie.width,ie.height),oe=r.setFieldValue,se=(0,q.useRef)({width:l.width,height:l.height});se.current={width:l.width,height:l.height},(0,q.useEffect)(()=>{if(re){if(ae===void 0){L(!1),Wt(`Size kept at ${String(se.current.width)} × ${String(se.current.height)}; Match first reference turned off`,{toasterId:`prints-generation-notices`});return}oe(`width`,ae.width),oe(`height`,ae.height)}},[re,ae?.width,ae?.height,oe]);let[ce,z]=(0,q.useState)(!1),le=b!==void 0&&b.sizes!==null,B=ur(b),ue=re?`match`:le?`${String(l.width)}x${String(l.height)}`:te?`custom`:B.find(e=>e.width===l.width&&e.height===l.height)?.value??`custom`,[de,fe]=(0,q.useState)(!1),V=TP({clear:()=>{r.setFieldValue(`prompt`,``)},useSize:e=>{ne(!1),L(!1),r.setFieldValue(`width`,wi[e].width),r.setFieldValue(`height`,wi[e].height),r.setFieldValue(`prompt`,``)},openStyles:()=>{r.setFieldValue(`prompt`,``),fe(!0)},clearStyle:()=>{r.setFieldValue(`style`,void 0),r.setFieldValue(`prompt`,``)}},n),[pe,me]=(0,q.useState)(!1),he=l.references.map((e,t)=>({number:p[t]??t+1,name:e.path.split(`/`).at(-1)??e.path,url:u!==null&&Vi(e,u)?f.find(t=>t.path===e.path)?.url:void 0})),ge=Xr(h,he,l.prompt),_e=di(l.prompt,h,he,f),ve=Gr(V.items,l.prompt),ye=(0,q.useId)(),be=`${ye}-commands`,xe=`${ye}-characters`,Se=er(l.prompt,h).characters,Ce=e=>{let t=ve.slashMatches.at(e);t&&(ve.resetSlash(),V.run(t.command))},we=v({open:de,onOpenChange:fe}),Te=[l.style,re?`Match · ${An(l.width,l.height)}`:ar(b,l.width,l.height),E&&l.durationSeconds!==void 0?`${String(l.durationSeconds)}s`:void 0,E?.supportsAudio&&l.generateAudio===!1?`silent`:void 0].filter(e=>e!=null),Ee=(0,J.jsx)(LP,{form:r,selected:b,stylePicker:we.picker,sizeChoices:B,sizeMode:ue,onCustomSize:ne,match:{offered:b?.kind===`image`&&b.input.dimensions===`own`,size:ae,onChange:L},onEditStyles:()=>{z(!1),fe(!0)},onEditCharacters:()=>{z(!1),me(!0)}}),De=e=>{let t=r.store.state.fieldMeta,n=Fr(l,e),i=Un(l,e,b);r.setFieldValue(`model`,e.id),(e.input.dimensions===`none`||e.sizes!==null)&&ne(!1),r.setFieldValue(`width`,i.width),r.setFieldValue(`height`,i.height),r.setFieldValue(`durationSeconds`,n.durationSeconds),r.setFieldValue(`voiceId`,n.voiceId),r.setFieldValue(`generateAudio`,n.generateAudio),e.kind===`audio`&&r.setFieldValue(`references`,[]),(e.input.steps===`fixed`||!t.steps?.isTouched)&&r.setFieldValue(`steps`,n.steps)},Oe=b?.kind===`audio`,[ke,Ae]=(0,q.useState)(null),je=(0,q.useRef)(null),Me=Oe?0:l.references.length,Ne=$g(hi(i)),Pe=(0,q.useRef)(null);b!==void 0&&b.kind!==`audio`&&(Pe.current=b.id);let Fe=()=>{let e=Oe?Vn(i,Pe.current??``)??Vn(i,`@cf/black-forest-labs/flux-2-klein-4b`)??ui(i).at(0):Vn(i,Ne.at(0)?.id??``);e&&De(e)},Ie=b===void 0?null:e_(b),Le=Ie===null?[]:n_(Ne,Ie),Re=b?.audio==null||Ie===null?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(r_,{disabled:s,modes:t_(Ne),value:Ie,onChange:e=>{let t=Vn(i,n_(Ne,e).at(0)?.id??``);t&&De(t)}}),Le.length>1?(0,J.jsx)(a_,{disabled:s,models:Le,value:b.id,onChange:e=>{let t=Vn(i,e);t&&De(t)}}):null,b.audio.mode===`speech`?(0,J.jsx)(o_,{disabled:s,voices:b.audio.voices,value:l.voiceId??b.audio.defaultVoiceId??``,onChange:e=>{r.setFieldValue(`voiceId`,e)}}):null,b.audio.seconds===null?null:(0,J.jsx)(l_,{disabled:s,seconds:b.audio.seconds,value:l.durationSeconds??b.audio.seconds.default,onChange:e=>{r.setFieldValue(`durationSeconds`,e)}})]}),ze=e=>JSON.stringify([e.computerId??u,e.path]),Be=e=>u!==null&&Vi(e,u)?f.find(t=>t.path===e.path):void 0,Ve=e=>{let t=O[e]?.role;return t===void 0?`@${Kn(p[e]??e+1)}`:qr[t]},He=l.references.flatMap((e,t)=>{let n=Be(e);return n===void 0?[]:[{key:ze(e),label:Ve(t),name:e.path.split(`/`).at(-1)??e.path,url:n.url}]}),Ue=He.findIndex(e=>e.key===ke);return(0,J.jsxs)(ti,{"aria-label":Oe?`Audio generation`:`Image generation`,"data-generation-form":!0,"data-composer-collapsed":N.collapsed?``:void 0,"data-composer-fullscreen":N.fullscreen?``:void 0,attachments:!Oe&&l.references.length>0?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{ref:je,className:`prints-reference-tray`,"aria-label":`Image references`,"data-over-limit":A?``:void 0,title:`${String(l.references.length)} / ${String(k)} references`,children:l.references.map((e,t)=>{let n=Be(e),i=O[t]?.role,a=cr(T,O,t);return(0,J.jsxs)(`div`,{className:`prints-reference-tile`,"data-reference-chip":!0,title:e.computerId===void 0?e.path:`${e.computerId}:${e.path}`,children:[n?(0,J.jsx)(`button`,{type:`button`,className:`prints-reference-face prints-reference-open mask mask-squircle`,"aria-label":`Enlarge ${Ve(t)}: ${e.path.split(`/`).at(-1)??e.path}`,"aria-haspopup":`dialog`,"data-reference-key":ze(e),onClick:()=>{Ae(ze(e))},children:(0,J.jsx)(`img`,{src:n.url,alt:e.path.split(`/`).at(-1)})}):(0,J.jsx)(`div`,{className:`prints-reference-face mask mask-squircle`,children:(0,J.jsx)(`span`,{children:Kn(p[t]??t+1)})}),(0,J.jsx)(`span`,{className:`prints-reference-label`,"data-reference-label":!0,children:Kn(p[t]??t+1)}),i===void 0?null:a===void 0?(0,J.jsx)(`span`,{className:`prints-reference-role`,"data-reference-role":i,children:qr[i]}):(0,J.jsx)(U,{size:`xs`,variant:`ghost`,type:`button`,className:`prints-reference-role`,"data-reference-role":i,"aria-label":`Reference ${String(t+1)}: ${qr[i]}. Use as ${qr[a]}`,title:`Use as ${qr[a]}`,onClick:()=>{r.setFieldValue(`references`,O.map((e,n)=>n===t?{...e,role:a}:e))},children:qr[i]}),(0,J.jsx)(pt,{icon:(0,J.jsx)(Ei,{}),className:`prints-reference-remove`,"aria-label":`Remove reference ${String(t+1)}`,onClick:()=>{r.setFieldValue(`references`,l.references.filter((e,n)=>n!==t))}})]},ze(e))})}),(0,J.jsx)(dP,{slides:He,index:Ue<0?null:Ue,onIndexChange:e=>{Ae(He[e]?.key??null)},onClose:()=>{Ae(null)},returnFocusTo:e=>[...je.current?.querySelectorAll(`[data-reference-key]`)??[]].find(t=>t.dataset.referenceKey===e)??null})]}):void 0,input:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`form`,{"aria-busy":s,onSubmit:e=>{e.preventDefault(),_()},children:(0,J.jsx)(r.Field,{name:`prompt`,children:e=>(0,J.jsxs)(`div`,{className:`prints-prompt`,"data-guidance-placeholder":S?``:void 0,id:M,ref:j,children:[ve.slashOpen?(0,J.jsx)(Hr,{index:ve.slashIndex,listId:be,matches:ve.slashMatches,onHighlight:ve.highlightSlash,onPick:Ce}):null,!ve.slashOpen&&ge.matches.length>0?(0,J.jsx)(yi,{images:f,index:ge.index,listId:xe,matches:ge.matches,onHighlight:ge.highlight,onPick:t=>{let n=ge.complete(t);n!==null&&e.handleChange(n)}}):null,(0,J.jsx)(Ir,{caretRequest:ge.caretRequest,layout:N,onOver:PP,onOverflow:F,menu:ve.slashOpen?{open:ve.slashMatches.length>0,listId:be,selected:ve.slashIndex}:{open:ge.matches.length>0,listId:xe,selected:ge.index},mentionCount:ve.slashOpen?0:ge.matches.length,onCaret:ge.setCaret,onMentionDismiss:ge.dismiss,onMentionMove:ge.move,onMentionPick:()=>{let t=ge.complete(ge.index);t!==null&&e.handleChange(t)},disabled:x||s,maxLength:b?.maxPromptLength,addedLength:y,onChange:t=>{e.handleChange(t)},onSend:_,onSlashMove:ve.moveSlash,onSlashPick:()=>{Ce(ve.slashIndex)},placeholder:S?RP(S):b?.audio?.mode===`speech`?`What should it say?`:b?.audio?.mode===`music`?`Describe the music`:`What are we making?`,slashCount:ve.slashMatches.length,value:e.state.value}),Se.length>0||_e.length>0?(0,J.jsxs)(`div`,{className:`prints-composer-notes`,children:[(0,J.jsx)(Oi,{tokens:_e}),Se.length>0?(0,J.jsx)(`span`,{className:`prints-reference-count`,"data-generation-characters":!0,children:`Characters: ${Se.map(e=>e.name).join(`, `)}`}):null]}):null]})})}),t&&!S?(0,J.jsxs)(`div`,{className:`prints-composer-guidance`,role:`status`,"data-composer-guidance":!0,children:[(0,J.jsx)(`span`,{children:RP(t)}),t.actions?.map(e=>(0,J.jsx)(U,{variant:`ghost`,size:`xs`,onClick:e.run,children:e.label},e.label))]}):null]}),row:{controls:(0,J.jsxs)(J.Fragment,{children:[N.fullscreen?null:(0,J.jsx)(_t,{"aria-controls":M,"aria-expanded":!N.collapsed,"aria-label":N.collapsed?`Expand composer`:`Collapse composer`,"data-composer-collapse":!0,icon:N.collapsed?(0,J.jsx)(Di,{}):(0,J.jsx)(ai,{}),label:null,onClick:()=>{N.setCollapsed(!N.collapsed)},onMouseDown:e=>{e.preventDefault()},title:N.collapsed?`Expand composer`:`Collapse composer`}),N.collapsed&&Me>0?(0,J.jsxs)(`span`,{"aria-label":`${String(Me)} ${Me===1?`reference`:`references`} attached`,className:`prints-composer-count`,"data-composer-count":!0,role:`img`,title:`${String(Me)} ${Me===1?`reference`:`references`} attached`,children:[(0,J.jsx)(Dh,{"aria-hidden":`true`}),Me]}):null,N.coarse&&P&&!N.collapsed?(0,J.jsx)(_t,{"aria-label":`Open full-screen editor`,"data-composer-expand":!0,icon:(0,J.jsx)(Or,{}),label:null,onClick:()=>{N.setFullscreen(!0),j.current?.querySelector(`textarea`)?.focus()},title:`Open full-screen editor`}):null,S?S.actions?.map(e=>(0,J.jsx)(U,{variant:`ghost`,size:`xs`,onClick:e.run,children:e.label},e.label)):null,Oe?null:e,Ne.length>0?(0,J.jsx)(_t,{"aria-label":`Audio`,"data-generation-audio-key":!0,icon:(0,J.jsx)(yh,{}),label:null,pressed:Oe,tone:Oe?`accent`:`neutral`,title:Oe?`Back to pictures`:`Make audio`,disabled:a||!o,onClick:Fe}):null,Oe?Re:(0,J.jsx)(r.Field,{name:`model`,children:e=>(0,J.jsx)(PA,{compact:N.coarse,models:ui(i),emptyLabel:u===null?`Choose a Computer`:a?`Loading models…`:`Models unavailable`,disabled:a||!o,onChange:e=>{let t=Vn(i,e);t&&De(t)},value:e.state.value})}),u&&d?(0,J.jsx)(`span`,{className:`sr-only`,"data-generation-computer":!0,title:`Where new prints are saved`,children:`Saved in your Prints folder`}):null]}),action:(0,J.jsxs)(`span`,{className:`prints-generate-action`,children:[m===null?null:(0,J.jsx)(`span`,{className:`prints-generate-price`,"data-generation-price":!0,title:`Estimated price`,children:m.startsWith(`<`)?m:`≈ ${m}`}),(0,J.jsx)(ii,{busy:s,draft:l.prompt,disabled:!o||a||i.length===0||s||c!==void 0,disabledReason:c??ee,label:qi(b),onGenerate:()=>{_()},promptOver:w})]}),items:Oe?[]:[{id:`settings`,accessibleLabel:`Generation settings`,title:`Settings`,label:(0,J.jsxs)(`span`,{className:`prints-settings-chip`,children:[(0,J.jsx)(Ih,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)]`}),(0,J.jsx)(`span`,{className:`prints-settings-chip-text`,children:Te.length>0?Te.join(` · `):`Settings`})]}),content:Ee}],openId:ce?`settings`:null,onOpenChange:e=>{z(e===`settings`)}},children:[(0,J.jsx)(ib,{layout:N}),(0,J.jsxs)(`div`,{className:`prints-composer-editor-bar`,"data-composer-editor-bar":!0,children:[(0,J.jsx)(`span`,{children:`Prompt`}),(0,J.jsx)(_t,{"data-composer-done":!0,label:`Done`,onClick:()=>{N.setFullscreen(!1),j.current?.querySelector(`textarea`)?.focus()}})]}),we.dialog,g({open:pe,onOpenChange:me})]})}function BP({connection:e}){let t=(0,q.useRef)(null),n=(0,q.useRef)(e);n.current=e;let r=IA(e?.app??null),i=Rf(e?.app??null)?.setup?.media===`missing`,[a,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(!1),l=()=>{let t=e?.app;t&&(o(!0),c(!1),t.ui.openSetup(`media`).then(e=>{o(!1),c(e===`unavailable`)},e=>{o(!1),c(!0),tn(`open-media-setup`,e)}))},u=s?(0,J.jsxs)(J.Fragment,{children:[`Image setup couldn’t open.`,` `,(0,J.jsx)(`a`,{href:`https://github.com/fungi-computer/oyster#deploy-to-cloudflare`,target:`_blank`,rel:`noreferrer`,children:`Open the image setup guide`}),`.`]}):`Image generation isn’t set up yet.`,[d,f]=(0,q.useState)(!1),[p,m]=(0,q.useState)(),h=qM(e?.app??null,r.computerId),[g,_]=(0,q.useState)(null),[v,y]=(0,q.useState)(null),[b,x]=(0,q.useState)(),S=(0,q.useRef)(0);(0,q.useEffect)(()=>{_(null),y(null),x(void 0)},[e,r.computerId,r.path]);let C=r.path,w=Wg(e,r),{gallery:T,images:E,failed:D,loading:O,gallerySlots:k,canBrowse:A,canRead:j,canWrite:M,reserveSlot:N,failSlot:P,clearSlotError:F,removeSlot:I,addComputerFile:ee,retryFile:te,uploads:ne,uploadFiles:re}=w,L=e!==null&&r.destination!==null&&A&&j,R=SA({app:e?.app??null,destination:r.destination,view:r.view,setView:r.setView,entries:T.entries,canWrite:M}),[ie,ae]=(0,q.useState)(!1),oe=R.selecting||T.entries.length>0||w.gallery.folders.length>0,se=mg({selectable:oe,atFolderRoot:r.view.kind===`folder`&&!R.up,loading:O||T.loading,failed:!!T.error});Hf(L?e.app.window.navigation:null,{canGoBack:R.history.canGoBack,canGoForward:R.history.canGoForward,crumbs:R.crumbs,primary:oe?[{id:`select`,label:`Select`,variant:`outline`}]:[],onAction:e=>{e===`select`&&R.setSelecting(!R.selecting)},onBack:R.history.back,onForward:R.history.forward,onCrumb:e=>{R.history.open(e===`all`||e===`favorites`?{kind:e}:{kind:`folder`,folder:e===``?void 0:e})}});let[ce,z]=(0,q.useState)(Date.now),le=k.some(e=>e.startedAt!==void 0&&!e.resolved&&!e.error);(0,q.useEffect)(()=>{if(!le)return;let e=setInterval(()=>{z(Date.now())},1e3);return()=>{clearInterval(e)}},[le]);let B=zp(e,(e,t,n)=>(T.refresh(),ee(e,t,n)));(0,q.useLayoutEffect)(()=>{x(void 0),B.target&&(_(null),y(null))},[B.target]),(0,q.useEffect)(()=>{B.error&&xi(`Could not open this print. It may no longer be available on this Computer.`,`prints-navigation-error`)},[B.error]);let ue=T.entries.some(e=>e.path===B.target?.path);(0,q.useEffect)(()=>{B.target&&!ue&&T.nextPageReady&&T.loadMore()},[B.target,ue,T.nextPageReady,T.loadMore]);let de=E.find(e=>e.source.kind===`computer`&&e.source.computerId===B.target?.computerId&&e.source.path===B.target.path),fe=EP(e?.app??null),V=fP(e?.app??null),[pe,me]=(0,q.useState)(new Set),he=R_({connection:e,folder:r,styles:fe.styles,characters:V.characters,effects:{reserve:e=>{me(t=>{if(!t.has(e.key))return t;let n=new Set(t);return n.delete(e.key),n}),N(e)},failed:P,release:I,notifyFailure:PP,saved:({result:e},t)=>{me(t=>new Set(t).add(`${e.destination.computerId}:${e.destination.path}`)),j?ee(e.destination.path,t,e.destination.computerId):P(`${e.destination.computerId}:${e.destination.path}`,`Image saved, but this App cannot read its preview.`)}}}),{state:ge,models:_e,modelsLoading:ve,modelsError:ye,canGenerate:be,mediaCapability:xe,pendingGenerations:Se,activeGenerations:Ce,recoveryError:we}=he,Te=(0,q.useRef)(_e),Ee=(0,q.useRef)(he);Ee.current=he;let De=(0,q.useRef)(null),Oe=(0,q.useRef)(null),ke=(0,q.useRef)(0),[Ae,je]=(0,q.useState)(null),Me=(0,q.useRef)([]),Ne=(0,q.useRef)(e=>he.submit(e,Me.current));Ne.current=async e=>{let t=await he.submit(e,Me.current);return t&&je(null),t};let Pe=FP(Ne),Fe=e=>{Pe.setFieldValue(`model`,e.model),Pe.setFieldValue(`width`,e.width),Pe.setFieldValue(`height`,e.height),Pe.setFieldValue(`steps`,e.steps),Pe.setFieldValue(`durationSeconds`,e.durationSeconds),Pe.setFieldValue(`generateAudio`,e.generateAudio),Pe.setFieldValue(`prompt`,e.prompt),Pe.setFieldValue(`references`,e.references),Pe.setFieldValue(`style`,e.style),Pe.setFieldValue(`destination`,void 0)},Ie=(0,q.useRef)(Pe);Ie.current=Pe;let Le=ay(Pe.store,e=>e.values),Re=Si(Le.references,Le.prompt,r.computerId);Me.current=Re;let ze=gi(he.session,ji({draft:Le,model:Vn(he.models,Le.model),styleText:fe.styles.find(e=>e.name===Le.style)?.text,characters:V.characters,labels:Re,computerId:r.computerId})),Be=ay(Pe.store,e=>e.isSubmitting),Ve=e?.app;(0,q.useEffect)(()=>{if(Ve)return CP(Ve,{readDraft:()=>Ie.current.store.state.values,readModels:()=>Te.current,setDraft:e=>{let t=Ie.current;if(e.model!==void 0){let n=Vn(Te.current,e.model);if(!n)throw Error(`Choose a model from the granted registry.`);let r=Fr(t.store.state.values,n),i=Vn(Te.current,t.store.state.values.model),a=Un(t.store.state.values,n,i);t.setFieldValue(`model`,r.model),t.setFieldValue(`width`,a.width),t.setFieldValue(`height`,a.height),t.setFieldValue(`steps`,r.steps),t.setFieldValue(`durationSeconds`,r.durationSeconds),t.setFieldValue(`generateAudio`,r.generateAudio)}e.generateAudio!==void 0&&t.setFieldValue(`generateAudio`,e.generateAudio??void 0),e.destination!==void 0&&t.setFieldValue(`destination`,e.destination??void 0),e.height!==void 0&&t.setFieldValue(`height`,e.height),e.prompt!==void 0&&t.setFieldValue(`prompt`,e.prompt),e.references!==void 0&&t.setFieldValue(`references`,e.references),e.steps!==void 0&&t.setFieldValue(`steps`,e.steps??void 0),e.style!==void 0&&t.setFieldValue(`style`,e.style??void 0),e.width!==void 0&&t.setFieldValue(`width`,e.width)},submit:()=>Ie.current.store.state.isSubmitting||Ee.current.atLimit?Promise.resolve(!1):Ie.current.submitCurrent()})},[Ve]),(0,q.useEffect)(()=>{Te.current=_e},[_e]),(0,q.useEffect)(()=>{if(_e.length===0||ye)return;let e=_e.find(e=>e.id===`@cf/black-forest-labs/flux-2-klein-4b`)??ui(_e).at(0)??_e[0];if(!Pe.store.state.fieldMeta.model?.isTouched){let t=Fr(Pe.store.state.values,e);Pe.setFieldValue(`model`,t.model),Pe.store.state.fieldMeta.width?.isTouched||Pe.setFieldValue(`width`,t.width),Pe.store.state.fieldMeta.height?.isTouched||Pe.setFieldValue(`height`,t.height),Pe.store.state.fieldMeta.steps?.isTouched||Pe.setFieldValue(`steps`,t.steps)}},[Pe,ye,_e]);let He=Vn(_e,Le.model),Ue=Le.references,H=He?.input.maxReferences??0,We=(0,q.useRef)({addComputerFile:ee,retryPath:he.retryPath,uploads:ne});We.current={addComputerFile:ee,retryPath:he.retryPath,uploads:ne};let Ge=de?Vg(de):null,Ke=(0,q.useMemo)(()=>E.map(e=>({key:Vg(e),selected:Vg(e)===Ge,path:e.source.kind===`computer`?e.source.path:e.file.name,referenced:Ue.some(t=>e.source.kind===`computer`&&Vi(t,e.source.computerId)&&t.path===e.source.path),referenceDisabled:Ue.length>=H&&!Ue.some(t=>e.source.kind===`computer`&&Vi(t,e.source.computerId)&&t.path===e.source.path),onToggleReference:e.source.kind===`computer`&&H>0&&!an(e.source.path)?()=>{if(e.source.kind!==`computer`)return;let t=e.source.path,n=e.source.computerId,r=Ue.some(e=>Vi(e,n)&&e.path===t);Pe.setFieldValue(`references`,r?Ue.filter(e=>!Vi(e,n)||e.path!==t):[...Ue,{path:t}])}:void 0,onInfo:()=>{_(e)},url:e.url,width:e.width,height:e.height,onOpen:()=>{_(null),y(Vg(e))}})),[E,Ue,H,Pe,Ge]),qe=(0,q.useMemo)(()=>{let e=r.computerId;if(!e)return Ke;let t=new Map(Ke.map(e=>[e.key,e])),n=T.entries.map(n=>{let r=`${e}:${n.path}`;return{...t.get(r)??{key:r,path:n.path,width:1,height:1,url:``,pending:!0,pendingLabel:`Loading print…`,onOpen:()=>void 0,onVisible:()=>{T.loadFile(n.path)},error:D.includes(n.name)?`Could not load this print.`:void 0},onRetry:()=>{te(n.path)}}}),i=new Set(n.map(e=>e.key));return[...n,...Ke.filter(e=>!i.has(e.key)&&e.key!==Ge)]},[Ke,T.entries,T.loadFile,te,D,r.computerId,Ge]),Je=L&&!(r.view.kind===`folder`&&!R.up)?r.view.kind===`all`?{title:`No prints yet`,description:`Prints in any folder of the library appear here.`}:r.view.kind===`favorites`?{title:`No favorites yet`,description:`Tap the heart on a print to keep it here for your whole Team.`}:{title:`Nothing in ${R.title} yet`,description:`New prints you make here land in it. You can also drop in images or move prints from another folder.`}:null,Ye=[...Ce].sort().join(`|`),Xe=k.filter(e=>e.error!==void 0).length,Ze=(0,q.useMemo)(()=>Se.filter(e=>e.reference.computerId===r.computerId&&!Ye.split(`|`).includes(e.reference.requestId)&&!k.some(t=>t.computerId===e.reference.computerId&&t.path===e.input.destination.path)).map(e=>({key:`${e.reference.computerId}:${e.input.destination.path}`,path:e.input.destination.path,width:1024,height:1280,url:``,pending:!0,error:e.failure?.message??`Stopped when Prints closed. Retry to run it again.`,prompt:e.typed.prompt,onOpen:()=>void 0,onRetry:()=>{Ee.current.resume(e)},onDismiss:()=>{Ee.current.discard(e)}})),[Se,r.computerId,Ye,k]),Qe=(0,q.useMemo)(()=>[...Ze,...lP(qe,k,e=>{let t=ne.items.find(t=>t.id===e.uploadId),r=e.error??(t?.status===`error`||t?.status===`cancelled`?t.message:void 0);return{key:e.key,path:e.path,width:e.width,height:r===void 0?e.height:Math.max(e.height,e.width*1.25),url:``,pending:!0,error:r,prompt:Se.find(t=>t.reference.computerId===e.computerId&&t.input.destination.path===e.path)?.typed.prompt??he.promptAt(e.path),pendingLabel:t?.status===`complete`||pe.has(e.key)?`Loading preview…`:e.uploadId?`Uploading image…`:e.startedAt===void 0?e.pendingLabel:Fn(_e.find(e=>e.kind===`video`),ce-e.startedAt,e.resumed),onOpen:()=>void 0,onStop:r===void 0&&e.uploadId===void 0?()=>{Ee.current.stopPath(e.path)}:void 0,onRetry:r&&(j||t&&t.status!==`complete`)?()=>{if(F(e.key),t&&t.status!==`complete`){We.current.uploads.retry(t.id);return}!e.uploadId&&We.current.retryPath(e.path)||n.current&&We.current.addComputerFile(e.path,n.current,e.computerId)}:void 0,onDismiss:r?()=>{I(e.key),e.uploadId&&We.current.uploads.remove(e.uploadId)}:void 0}})],[Ze,Se,Xe,he.promptAt,pe,qe,k,ne.items,j,_e,ce]),$e=!i&&xe&&be&&M&&C!==null&&ge.kind===`ready`&&!ve&&_e.length>0,et=ne.items.filter(e=>e.computerId===r.computerId),tt=()=>{e&&e.app.ui.openTeamBilling().catch(t=>{tn(`open-team-billing`,t),n.current===e&&he.reportRecoveryError(t)})},nt=[...ge.kind===`error`&&ye===null?[{key:`generation:draft`,mediaKind:ge.mediaKind,message:ge.message,billing:ge.action===`billing`?tt:void 0}]:[],...he.failures.map(e=>({key:e.key,mediaKind:e.mediaKind,message:e.message,billing:e.action===`billing`?tt:void 0,prompt:e.prompt,retry:e.retry,dismiss:()=>{for(let t of k)t.path===e.path&&I(t.key);e.dismiss()}}))],rt=KM({connected:e!==null,mediaCapability:xe,modelsError:ye,retryModels:he.retryModels,modelsLoading:ve,models:_e,canGenerate:be,mediaSetupMissing:i,canWrite:M,generationErrors:nt,recoveryError:we,pendingGenerations:Se,activeGenerations:Ce,atGenerationLimit:he.atLimit,gallerySlots:k,computerId:r.computerId,failed:D,uploadError:ne.error,uploads:et,permissions:()=>{e?.app.ui.requestAppPermissions({}).catch(e=>{he.reportRecoveryError(e)})},resume:e=>{he.resume(e)},discard:e=>{he.discard(e)},retryUpload:e=>{ne.retry(e)}});h.error&&rt.push({key:`dismissal-storage`,group:`Setup`,tone:`warning`,blocking:!0,short:`Activity not saved`,title:`Activity not saved`,detail:h.error});let it=h.visible(rt),at={generating:Ce.size,uploading:et.filter(e=>e.status===`sending`||e.status===`queued`).length},ot={items:et.filter(e=>e.status===`sending`||e.status===`queued`).map(e=>({id:e.id,name:e.file.name,preview:{kind:`image`,url:e.previewUrl},progress:null,progressLabel:``,statusLabel:e.message,actions:{cancel:{label:`Cancel`,accessibleLabel:`Cancel ${e.file.name}`}}})),onCancel:e=>{ne.cancel(e)},onRetry:e=>{ne.retry(e)},onRemove:e=>{ne.remove(e)}},st=new Set([...T.entries.map(e=>`${r.computerId??``}:${e.path}`),...E.map(e=>e.source.kind===`computer`?`${e.source.computerId}:${e.source.path}`:e.file.name)]).size,ct=RM(it,at,d);Bf(e?.app,[...r.available?[CA(r.landingPath??r.path,{checking:r.busy&&r.path===null,editing:r.editing})]:[],...ct===null?[]:[ct],...A?[{kind:`text`,id:`prints`,text:`${String(st)} ${st===1?`print`:`prints`}`}]:[]],e=>e.itemId===`activity`?(m(e.anchor?.start),f(e=>!e),!0):e.itemId!==`folder`||!r.available?!1:(r.setEditing(!0),!0),t=>{tn(`prints.status.report`,t),e?.app.ui.showToast({message:`Prints couldn't update its status bar.`,tone:`error`}).catch(e=>{tn(`prints.status.toast`,e)})});let W=E.flatMap(e=>e.source.kind===`computer`?[{path:e.source.path,url:e.url,width:e.width,height:e.height}]:[]),lt=e=>{y(null),S.current+=1,x({key:e,requestId:`viewer-close-${String(S.current)}`,onFocus:()=>void 0})},ut=(t,n,i)=>(0,J.jsx)(q.Suspense,{fallback:null,children:(0,J.jsx)(MP,{image:t,app:e?.app??null,referenceImages:W,models:_e,canAnimate:DP(_e)!==void 0,operations:{session:he.session,atLimit:he.atLimit,onRun:async(e,n)=>{if(t.source.kind!==`computer`)return;let r=await he.operate({computerId:t.source.computerId,path:t.source.path,width:t.width,height:t.height},e,n);if(r!==null){PP(r);return}_(null),v!==null&<(Vg(t))}},download:i,library:L&&t.source.kind===`computer`&&r.destination!==null&&t.source.path.startsWith(`${r.destination}/`)?(()=>{let e=t.source.path,n=R.isFavorite(e);return{favorite:n,onToggleFavorite:()=>{R.toggleFavorite([e],!n)},onMove:M?()=>{R.setMoving([e])}:void 0}})():void 0,onIterate:(e,n)=>{if(t.source.kind!==`computer`)return null;let r=kP(e,{lineage:n,printComputerId:t.source.computerId,printPath:t.source.path,models:_e,styles:fe.styles.map(e=>e.name),current:Pe.store.state.values});return r.kind===`refused`?r.message:(Fe(r.draft),je(r.notice===null?null:{model:r.draft.model,message:r.notice}),_(null),v!==null&<(Vg(t)),null)},onClose:n},t.url)}),dt={label:`Upload images`,onSelect:()=>Oe.current?.click(),disabled:!M||C===null,disabledReason:`Choose a writable Computer and folder to upload images.`},G=!i&&Je===null&&r.computerId!==null&&r.available&&C===null,ft={label:`Choose folder`,onSelect:()=>{r.setEditing(!0)}},pt=(0,J.jsx)(U,{variant:`ghost`,loading:a,onClick:l,children:`Set up image generation`});return(0,J.jsxs)(`main`,{ref:t,className:`h-full w-full flex flex-col overflow-hidden`,"data-app-pane":`media`,"data-generation-state":ge.kind,"data-computer-capability":A?`connected`:`absent`,onPaste:e=>{let t=Array.from(e.clipboardData.files);t.length&&M&&(e.preventDefault(),re(t.map(e=>(ke.current+=1,new File([e],`paste-${String(ke.current)}-${Lg(e.name)}`,{type:e.type,lastModified:e.lastModified})))))},children:[(0,J.jsx)(ag,{id:`prints-generation-notices`}),(0,J.jsxs)(`div`,{className:`prints-library`,"data-library":L||void 0,children:[L&&r.destination?(0,J.jsx)(dA,{app:e.app,root:r.destination,view:r.view,onView:R.history.open,canWrite:M,version:R.version,onNewFolder:e=>{R.setNewFolder({parent:e})},onDrop:(e,t)=>{R.move(e,t)},onRename:(e,t)=>{R.move([e],R.folderOf(r.destination??``,e),{name:t})},onMoveRows:R.setMoving}):null,(0,J.jsxs)(`div`,{className:`prints-library-main`,"data-selecting":R.selecting||void 0,children:[L?(0,J.jsxs)(J.Fragment,{children:[se?null:(0,J.jsx)(mA,{view:r.view,lastFolder:R.lastFolder,onOpen:R.history.open,onFolders:()=>{ae(!0)},subfolders:r.view.kind===`folder`?w.gallery.folders:[],onOpenSubfolder:e=>{R.history.open({kind:`folder`,folder:r.view.kind===`folder`&&r.view.folder?`${r.view.folder}/${e}`:e})}}),R.selecting?(0,J.jsx)(pA,{count:R.selected.size,total:T.entries.length,canWrite:M,onToggleAll:()=>{R.selectAll(R.selected.size===T.entries.length?[]:T.entries.map(e=>e.path))},onMove:()=>{R.setMoving([...R.selected])},onFavorite:()=>{R.toggleFavorite([...R.selected],!0)},onDone:()=>{R.setSelecting(!1)}}):null]}):null,(0,J.jsxs)(`div`,{className:`prints-gallery-region`,children:[(0,J.jsx)(gh,{screen:!0,ref:De,className:`prints-gallery-scroll flex-1 min-h-0`,"data-media-scroll":!0,"aria-busy":O||T.loading,onDragOver:e=>{e.preventDefault()},onDrop:e=>{e.preventDefault();let t=Array.from(e.dataTransfer.files);t.length&&M&&re(t)},children:(0,J.jsxs)(`div`,{className:`prints-gallery-content`,children:[Qe.length>0?(0,J.jsx)(cP,{items:L?Qe.map(R.enrich):Qe,scrollRef:De,focus:v===null?b??(de&&B.target?{key:`${B.target.computerId}:${B.target.path}`,requestId:B.target.requestId,onFocus:()=>{_(null),y(Vg(de))}}:void 0):void 0}):O||T.loading?(0,J.jsx)(Vy,{"data-media-loading":!0,framed:!1,message:`Loading prints…`,detail:`Your library is on its way.`,variant:`wander`}):(0,J.jsx)(zy,{"aria-live":`polite`,"data-absence":!0,"data-media-empty":!0,role:`status`,variant:`speech`,className:`prints-invitation`,visual:`blobs`,title:i?`Make and collect images`:Je?.title??`Make your first print`,description:i?`Upload images to start your collection. Open any image to view or download it.`:Je===null?r.computerId===null?`Your images will appear here.`:G?`Choose where Prints saves, then describe something.`:`Describe something and it lands here, or drop in images from your Computer.`:Je.description,primaryAction:i?dt:G?ft:void 0,actions:G?void 0:i?(0,J.jsxs)(`div`,{className:`prints-image-setup`,children:[(0,J.jsx)(`span`,{children:u}),pt]}):(0,J.jsx)(U,{variant:`ghost`,size:`sm`,disabled:!M||C===null,onClick:()=>Oe.current?.click(),children:`Upload images`}),suggestions:i||G?void 0:NP.map(e=>({label:e,disabled:!$e,onSelect:()=>{Pe.setFieldValue(`prompt`,e),t.current?.querySelector(`[data-generation-prompt]`)?.focus()}}))}),T.hasNextPage&&(0,J.jsx)(U,{variant:`ghost`,disabled:T.loading,onClick:T.loadMore,children:T.loading?`Loading images…`:`Load more images`})]})}),g&&(g.source.kind===`local`||g.source.connection===e&&g.source.computerId===r.computerId)?ut(g,()=>{_(null)}):null]})]})]}),L&&r.destination?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(hA,{app:e.app,root:r.destination,from:r.view.kind===`folder`?{folder:r.view.folder}:null,canWrite:M,count:R.moving?.length??0,open:R.moving!==null,version:R.version,onClose:()=>{R.setMoving(null)},onMove:(e,t)=>{let n=R.moving??[];R.setMoving(null),R.setSelecting(!1),R.move(n,e,{create:t})}}),(0,J.jsx)(vA,{parent:R.newFolder?.parent,open:R.newFolder!==null,onClose:()=>{R.setNewFolder(null)},onCreate:e=>R.createFolder(R.newFolder?.parent,e)}),(0,J.jsx)(cm,{open:ie,onOpenChange:ae,children:(0,J.jsxs)(pm,{className:`prints-folders-dialog`,children:[(0,J.jsx)(hm,{children:(0,J.jsx)(gm,{children:`Folders`})}),(0,J.jsx)(dA,{app:e.app,root:r.destination,view:r.view,onView:e=>{R.history.open(e),ae(!1)},canWrite:M,version:R.version,onNewFolder:e=>{ae(!1),R.setNewFolder({parent:e})},onMoveRows:R.setMoving})]})})]}):null,(0,J.jsx)(x_,{items:Qe,images:E,viewerKey:v,app:e?.app??null,onNavigate:y,onClose:lt,renderInfo:(e,t)=>ut(e,t,null)}),i&&Qe.length>0?(0,J.jsxs)(`div`,{className:`prints-library-actions`,children:[(0,J.jsx)(U,{size:`sm`,onClick:dt.onSelect,disabled:dt.disabled,children:`Upload images`}),pt,s?(0,J.jsx)(`div`,{className:`prints-image-setup`,children:u}):null]}):null,(0,J.jsxs)(`div`,{className:`prints-composer-dock`,children:[(0,J.jsx)(`section`,{"aria-label":`Computer uploads`,className:`prints-uploads`,children:(0,J.jsx)(`input`,{ref:Oe,type:`file`,disabled:!M||C===null,accept:`image/*`,multiple:!0,hidden:!0,"aria-label":`Choose images to upload`,onChange:e=>{re(Array.from(e.currentTarget.files??[])),e.currentTarget.value=``}})}),i?null:(0,J.jsx)(zP,{addedLength:He?.kind===`audio`?0:lr(Le.prompt,fe.styles.find(e=>e.name===Le.style)?.text,V.characters),styleControls:e=>({picker:(0,J.jsx)(AP,{styles:fe.styles,selected:Le.style,disabled:!xe||ve||Be,onSelect:e=>{Pe.setFieldValue(`style`,e)}}),dialog:(0,J.jsx)(jP,{open:e.open,onOpenChange:e.onOpenChange,styles:fe.styles,selected:Le.style,busy:fe.busy,error:fe.error,onSelect:e=>{Pe.setFieldValue(`style`,e)},onSave:fe.save,onDelete:(e,t)=>{fe.remove(e.id,t)}})}),characters:V.characters,characterDialog:e=>(0,J.jsx)(gP,{open:e.open,onOpenChange:e.onOpenChange,characters:V.characters,images:W,busy:V.busy,error:V.error,canUpload:M&&C!==null,onUpload:()=>Oe.current?.click(),onSave:V.save,onDelete:(e,t)=>{V.remove(e.id,t)}}),guidance:it.find(e=>e.blocking&&e.group===`Setup`)??(Ae!==null&&Ae.model===Le.model?{key:`iteration-model`,group:`Images`,tone:`warning`,short:`Model changed`,title:`Model changed`,detail:Ae.message,actions:[{label:`Dismiss`,run:()=>{je(null)}}]}:void 0),commandApp:Ve,actions:(0,J.jsx)(_t,{"aria-label":`Upload images`,title:M?`Upload images to Computer`:`Connect a writable Computer to upload`,icon:(0,J.jsx)(Lh,{}),label:null,className:`prints-upload-key`,disabled:!M||C===null,onClick:()=>Oe.current?.click()}),form:Pe,mediaCapability:xe&&be&&M&&C!==null,models:_e,modelsLoading:ve,onSubmit:Pe.submitCurrent,submitting:Be,generateLimitReason:he.atLimit?wr:void 0,values:Le,computerId:r.computerId,mediaDirectory:C,referenceImages:W,referenceLabels:Re,price:ze}),ct===null?null:(0,J.jsx)(BM,{notices:it,uploads:ot,open:d,inset:p,onOpenChange:f,onDismiss:h.dismiss,onDismissAll:()=>{h.dismissAll(rt)},onLoadMore:he.hasMore?he.loadMore:void 0})]}),(0,J.jsx)(HM,{folder:r})]})}var VP=document.getElementById(`media-root`);if(!VP)throw Error(`Media root is missing`);Ff(VP,{name:`Prints`,queryClient:ni()},({app:e})=>(0,q.createElement)(BP,{connection:e?{app:e}:null}));
|