opencami 1.3.1 → 1.3.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.
Files changed (33) hide show
  1. package/dist/client/assets/{_sessionKey-CaDTbjXx.js → _sessionKey-Z6Wcnj0N.js} +26 -26
  2. package/dist/client/assets/{agents-CGtqdyBi.js → agents-D8ZHVQ1Z.js} +2 -2
  3. package/dist/client/assets/{agents-screen-DzIMcmHe.js → agents-screen-BVK0QTRH.js} +1 -1
  4. package/dist/client/assets/{button-BcnCTjUT.js → button-CuH8u1uR.js} +1 -1
  5. package/dist/client/assets/{connect-B8sfEQyb.js → connect-CtDn993i.js} +1 -1
  6. package/dist/client/assets/file-explorer-screen-DMUuR1uG.js +1 -0
  7. package/dist/client/assets/{files-BHXmS1J5.js → files-CDMLoJ0u.js} +2 -2
  8. package/dist/client/assets/{index-CxJ4zG_W.js → index-IGP-Igwt.js} +1 -1
  9. package/dist/client/assets/{index-BfhiL2JN.js → index-N9-2R5hZ.js} +1 -1
  10. package/dist/client/assets/{keyboard-shortcuts-dialog-DEknElTu.js → keyboard-shortcuts-dialog-DW--4YLF.js} +1 -1
  11. package/dist/client/assets/{main-BlX7CS2-.js → main-DrVY5UJU.js} +2 -2
  12. package/dist/client/assets/{opencami-logo-5KynvViW.js → opencami-logo-ChD2XR2j.js} +1 -1
  13. package/dist/client/assets/{react-ONC2UaeC.js → react-CzqI3gbN.js} +1 -1
  14. package/dist/client/assets/search-dialog-DYyFYJmw.js +1 -0
  15. package/dist/client/assets/{session-export-dialog-DSRWU2YO.js → session-export-dialog-BFizBmGb.js} +1 -1
  16. package/dist/client/assets/settings-dialog-UvgVi2It.js +1 -0
  17. package/dist/client/assets/{switch-dAvZcYA-.js → switch-DxW2OWPG.js} +1 -1
  18. package/dist/client/assets/{use-file-explorer-state-C6lX-h0n.js → use-file-explorer-state-Cii59H70.js} +1 -1
  19. package/dist/client/assets/{useButton-DhneLsMA.js → useButton-hZdvKtl_.js} +1 -1
  20. package/dist/server/assets/{_sessionKey-ZF1_Jqbt.js → _sessionKey-DVNrEYFh.js} +38 -9
  21. package/dist/server/assets/_tanstack-start-manifest_v-PwRq_yJS.js +4 -0
  22. package/dist/server/assets/{file-explorer-screen-BzvgvV8m.js → file-explorer-screen-Cx0jiLRU.js} +72 -15
  23. package/dist/server/assets/{files-BxvRDIWU.js → files-Trs1M5ba.js} +1 -1
  24. package/dist/server/assets/{index-CTTNe_Sf.js → index-Dv2RXDa2.js} +1 -1
  25. package/dist/server/assets/{router-D5D0udHV.js → router-OoQe2c20.js} +3 -3
  26. package/dist/server/assets/{search-dialog-C8Oy-FBs.js → search-dialog-Bq0Pnxdb.js} +95 -52
  27. package/dist/server/assets/{settings-dialog-CQFuAt9B.js → settings-dialog-BsJsnMiu.js} +11 -5
  28. package/dist/server/server.js +2 -2
  29. package/package.json +1 -1
  30. package/dist/client/assets/file-explorer-screen-hjggspl-.js +0 -1
  31. package/dist/client/assets/search-dialog-40gW31ca.js +0 -1
  32. package/dist/client/assets/settings-dialog-AsvYzSBc.js +0 -1
  33. package/dist/server/assets/_tanstack-start-manifest_v-C2FijMus.js +0 -4
@@ -1,2 +1,2 @@
1
- import{j as e}from"./main-BlX7CS2-.js";import{C as a}from"./index-CxJ4zG_W.js";import"./button-BcnCTjUT.js";import"./react-ONC2UaeC.js";function c(){return e.jsx("div",{className:"min-h-screen bg-primary-50 text-primary-900",children:e.jsxs("div",{className:"max-w-2xl mx-auto px-6 py-10 space-y-10",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx("h1",{className:"text-3xl font-medium tracking-[-0.02em] text-center mb-10",children:"Connect to OpenCami"}),e.jsx("p",{className:"text-primary-700",children:"This client needs access to your OpenClaw gateway before you can start chatting."})]}),e.jsxs("div",{className:"space-y-4 text-primary-700",children:[e.jsxs("p",{children:["At the root of the project, create a new file named"," ",e.jsx("code",{className:"inline-code",children:".env.local"}),"."]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Paste this into it:"}),e.jsx(a,{content:`CLAWDBOT_GATEWAY_URL=ws://127.0.0.1:18789
1
+ import{j as e}from"./main-DrVY5UJU.js";import{C as a}from"./index-IGP-Igwt.js";import"./button-CuH8u1uR.js";import"./react-CzqI3gbN.js";function c(){return e.jsx("div",{className:"min-h-screen bg-primary-50 text-primary-900",children:e.jsxs("div",{className:"max-w-2xl mx-auto px-6 py-10 space-y-10",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx("h1",{className:"text-3xl font-medium tracking-[-0.02em] text-center mb-10",children:"Connect to OpenCami"}),e.jsx("p",{className:"text-primary-700",children:"This client needs access to your OpenClaw gateway before you can start chatting."})]}),e.jsxs("div",{className:"space-y-4 text-primary-700",children:[e.jsxs("p",{children:["At the root of the project, create a new file named"," ",e.jsx("code",{className:"inline-code",children:".env.local"}),"."]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Paste this into it:"}),e.jsx(a,{content:`CLAWDBOT_GATEWAY_URL=ws://127.0.0.1:18789
2
2
  CLAWDBOT_GATEWAY_TOKEN=YOUR_TOKEN_HERE`,ariaLabel:"Copy gateway token example",language:"bash"}),e.jsx("p",{className:"text-primary-600 text-sm",children:"or:"}),e.jsx(a,{content:"CLAWDBOT_GATEWAY_PASSWORD=YOUR_PASSWORD_HERE",ariaLabel:"Copy gateway password example",language:"bash"})]}),e.jsx("p",{children:"Environment variables are loaded at startup. Restart your dev server:"}),e.jsx(a,{content:"npm run dev",ariaLabel:"Copy npm run dev",language:"bash"}),e.jsx("p",{children:"Refresh the page after the restart and you should be connected."})]}),e.jsxs("div",{className:"space-y-3 rounded-lg border border-primary-200 bg-primary-100 px-4 py-3 text-primary-700 text-sm",children:[e.jsx("p",{className:"text-primary-900 font-medium",children:"Where to find these values"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:[e.jsx("code",{className:"inline-code",children:"CLAWDBOT_GATEWAY_URL"}),e.jsx("br",{}),"Your OpenClaw gateway endpoint (default is",e.jsx("code",{className:"inline-code",children:"ws://127.0.0.1:18789"}),")."]}),e.jsxs("p",{children:[e.jsx("code",{className:"inline-code",children:"CLAWDBOT_GATEWAY_TOKEN"})," ","(recommended)",e.jsx("br",{}),"Matches your Gateway token (",e.jsx("code",{className:"inline-code",children:"gateway.auth.token"})," or",e.jsx("code",{className:"inline-code",children:"OPENCLAW_GATEWAY_TOKEN"}),")."]}),e.jsxs("p",{children:[e.jsx("code",{className:"inline-code",children:"CLAWDBOT_GATEWAY_PASSWORD"})," ","(fallback)",e.jsx("br",{}),"Matches your Gateway password (",e.jsx("code",{className:"inline-code",children:"gateway.auth.password"}),")."]})]}),e.jsxs("p",{children:["Gateway docs:"," ",e.jsx("a",{className:"text-primary-700 hover:text-primary-900 underline",href:"https://docs.openclaw.ai/gateway",target:"_blank",rel:"noreferrer",children:"https://docs.openclaw.ai/gateway"})]})]})]})})}export{c as component};
@@ -0,0 +1 @@
1
+ import{j as e,r as t,L as ie,u as T}from"./main-DrVY5UJU.js";import{p as E,q as I,r as A,s as B,v as W,w as q,x as se,y as be,z as ve,B as ne}from"./useButton-hZdvKtl_.js";import{y as ye,c as h,j as ae,B as D,H as j,I as je,z as we,m as Ce,l as Ne,C as ke,n as De,E as Se,F as te,p as re,G as ce,K as Ee,L as Fe,N as ze,U as Me,O as Re,R as de,P as ue,Y as Te,Z as Le,_ as Ke,$ as Ue,a0 as $e,a1 as Pe,S as ee,a2 as Ie,V as Ae}from"./button-CuH8u1uR.js";import{r as L,M as Be,n as We,o as qe,p as le,q as K,D as Q,a as _,b as V,c as H,d as G}from"./use-file-explorer-state-Cii59H70.js";import"./react-CzqI3gbN.js";function Oe({className:s}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"80",height:"80",viewBox:"0 0 80 80",fill:"none",className:s,children:[e.jsx("rect",{width:"80",height:"80",fill:"currentColor",className:"text-transparent"}),e.jsx("path",{d:"M61.9624 45.5729C62.5862 44.3371 63.0907 43.3377 63.4782 41.9826C69.8221 28.8286 70.5847 14.0975 67.1723 4.32469C65.8317 0.249835 62.7688 0.254311 62.6374 3.58605C61.355 12.189 58.9061 17.6275 57.1756 21.0554C52.8087 29.7058 45.9949 37.7278 39.3706 42.7305C28.6217 50.8021 25.0716 44.614 24.3711 37.8823C23.8822 32.1203 24.7206 25.5721 26.24 18.2889C27.102 15.3261 24.3944 13.9592 22.5223 16.4122C20.4062 19.3487 18.5586 22.4209 17.1838 25.7318C12.9928 33.4462 10.3896 45.3332 11.4505 57.6273C12.2296 63.5357 13.1688 68.4057 14.1079 73.2757C15.2695 79.0941 19.1598 79.5073 24.3117 78.0088C39.7921 74.0789 54.143 58.872 59.7093 49.1011C60.7255 48.0229 61.3494 46.7872 61.9624 45.5729Z",fill:"currentColor",className:"text-primary-950"})]})}function Qe(){return t.useMemo(()=>typeof window>"u"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches,[])}function _e({isCollapsed:s,onToggleCollapse:i,onSelectAction:n}){const{navigateTo:a,currentPath:o}=L(),c=Qe(),r=t.useMemo(()=>({duration:c?0:.15,ease:s?"easeIn":"easeOut"}),[s,c]),l=t.useCallback(u=>{a(u)},[a]),d=t.useCallback((u,N)=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),N())},[]),y=t.useMemo(()=>[{path:"/",icon:ye,label:"Home",id:"home"}],[]),v=t.useMemo(()=>({className:"border-r border-primary-200 h-full overflow-hidden bg-primary-100 flex flex-col"}),[]),f=48,m=300;return e.jsxs(E.aside,{initial:!1,animate:{width:c?s?f:m:void 0},style:{width:c?void 0:s?f:m},transition:r,className:v.className,role:"navigation","aria-label":"File explorer navigation",children:[e.jsxs(E.div,{layout:!0,transition:{layout:r},className:h("flex items-center h-12 px-2 justify-between"),children:[e.jsx(I,{initial:!1,children:s?null:e.jsx(E.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:r,children:e.jsxs(ie,{to:"/new",className:h(ae({variant:"ghost",size:"sm"}),"w-full pl-1.5 justify-start","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),children:[e.jsx(Oe,{className:"size-5 rounded-sm","aria-hidden":"true"}),e.jsx("span",{children:"WebClaw"})]})})}),e.jsx(A,{children:e.jsxs(B,{children:[e.jsx(W,{onClick:i,onKeyDown:u=>d(u,i),render:e.jsx(D,{size:"icon-sm",variant:"ghost","aria-label":s?"Expand sidebar":"Collapse sidebar",className:h("focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),children:e.jsx(j,{icon:je,size:20,strokeWidth:1.5,"aria-hidden":"true"})})}),e.jsx(q,{side:"right",children:s?"Expand sidebar":"Collapse sidebar"})]})})]}),e.jsx("div",{className:"px-2 mb-4",children:e.jsx(E.div,{layout:!0,transition:{layout:r},className:"w-full",children:e.jsx(A,{children:e.jsxs(B,{children:[e.jsx(W,{asChild:!0,children:e.jsxs(ie,{to:"/chat/$sessionKey",params:{sessionKey:"main"},className:h(ae({variant:"ghost",size:"sm"}),"w-full pl-1.5 justify-start","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),onClick:n,children:[e.jsx(j,{icon:we,size:20,strokeWidth:1.5,className:"min-w-5","aria-hidden":"true"}),e.jsx(I,{initial:!1,mode:"wait",children:s?null:e.jsx(E.span,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:r,className:"overflow-hidden whitespace-nowrap",children:"Back to Chat"})})]})}),s?e.jsx(q,{side:"right",children:"Back to Chat"}):null]})})})}),e.jsx("div",{className:"flex-1 min-h-0 relative overflow-hidden",children:e.jsx(I,{initial:!1,children:s?e.jsx(E.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:r,className:"px-2 space-y-1",children:y.map(u=>e.jsx(A,{children:e.jsxs(B,{children:[e.jsx(W,{onClick:()=>l(u.path),onKeyDown:N=>d(N,()=>l(u.path)),render:e.jsx(D,{size:"icon-sm",variant:"ghost","aria-current":o===u.path?"page":void 0,"aria-label":`Navigate to ${u.label}`,className:h("w-full text-primary-600 hover:text-primary-900","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation",o===u.path&&"bg-primary-200 text-primary-900"),children:e.jsx(j,{icon:u.icon,size:20,strokeWidth:1.5,"aria-hidden":"true"})})}),e.jsx(q,{side:"right",children:u.label})]})},u.id))},"collapsed-content"):e.jsx(E.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:r,className:"absolute inset-0 pt-0 flex flex-col w-[300px] min-h-0",children:e.jsxs("div",{className:"flex-1 min-h-0 px-2",children:[e.jsx("div",{className:"mb-4",children:e.jsx("h2",{className:"text-sm font-medium text-primary-700 mb-3 px-1.5",children:"Quick Access"})}),e.jsx("nav",{className:"space-y-1",role:"list","aria-label":"Quick access folders",children:y.map(u=>e.jsx("div",{role:"listitem",children:e.jsxs(D,{variant:"ghost",size:"sm",onClick:()=>l(u.path),onKeyDown:N=>d(N,()=>l(u.path)),"aria-current":o===u.path?"page":void 0,className:h("w-full pl-1.5 justify-start text-primary-600 hover:text-primary-900","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation",o===u.path&&"bg-primary-200 text-primary-900 font-medium"),"aria-label":`Navigate to ${u.label}`,children:[e.jsx(j,{icon:u.icon,size:20,strokeWidth:1.5,className:"min-w-5","aria-hidden":"true"}),e.jsx("span",{className:"overflow-hidden whitespace-nowrap min-w-0 truncate",children:u.label})]})},u.id))})]})},"content")})}),e.jsx("div",{className:"px-2 py-3 border-t border-primary-200 bg-primary-100",children:e.jsx(E.div,{layout:!0,transition:{layout:r},className:"w-full",children:e.jsx(A,{children:e.jsxs(B,{children:[e.jsx(W,{asChild:!0,children:e.jsxs(D,{variant:"ghost",size:s?"icon-sm":"sm",className:h(s?"w-full":"w-full justify-start pl-1.5","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),"aria-label":"Settings",children:[e.jsx(j,{icon:Ce,size:20,strokeWidth:1.5,className:"min-w-5","aria-hidden":"true"}),e.jsx(I,{initial:!1,mode:"wait",children:s?null:e.jsx(E.span,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:r,className:"overflow-hidden whitespace-nowrap",children:"Settings"})})]})}),s?e.jsx(q,{side:"right",children:"Settings"}):null]})})})})]})}function Ve(s,i){return s.isCollapsed===i.isCollapsed}const He=t.memo(_e,Ve);function Ge({path:s}){const{navigateTo:i}=L(),n=s==="/"?[]:s.split("/").filter(Boolean),a=[{name:"Home",path:"/"},...n.map((r,l)=>({name:r,path:"/"+n.slice(0,l+1).join("/")}))],o=t.useCallback(r=>{i(r)},[i]),c=t.useCallback((r,l)=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),i(l))},[i]);return e.jsx("nav",{"aria-label":"File navigation",className:"text-sm text-primary-600",children:e.jsx("ol",{className:"flex items-center gap-1",children:a.map((r,l)=>e.jsxs("li",{className:"flex items-center gap-1",children:[l>0?e.jsx(j,{icon:Ne,size:16,strokeWidth:1.5,className:"text-primary-400","aria-hidden":"true"}):null,e.jsxs("button",{type:"button",onClick:()=>o(r.path),onKeyDown:d=>c(d,r.path),"aria-current":l===a.length-1?"page":void 0,className:h("flex items-center gap-1.5 rounded-md px-2 py-1","transition-colors duration-150 ease-out","hover:bg-primary-100 hover:text-primary-900","focus-visible:bg-primary-100 focus-visible:text-primary-900","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation",l===a.length-1?"text-primary-900 font-medium":"text-primary-600"),children:[l===0?e.jsx(j,{icon:ke,size:16,strokeWidth:1.5,"aria-hidden":"true"}):null,e.jsx("span",{className:"whitespace-nowrap",children:r.name})]})]},r.path))})})}const Z=[{label:"Name",value:"name"},{label:"Size",value:"size"},{label:"Modified",value:"modified"}];function Je({onUpload:s,onCreateFolder:i}){const{viewMode:n,sortBy:a,sortAsc:o,setViewMode:c,setSortBy:r,toggleSort:l}=L(),d=t.useCallback(()=>{c("list")},[c]),y=t.useCallback(()=>{c("grid")},[c]),v=t.useCallback(m=>{r(m)},[r]),f=t.useCallback((m,u)=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),u())},[]);return e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex items-center border border-primary-200 rounded-lg overflow-hidden",role:"group","aria-label":"View mode",children:[e.jsx(D,{size:"sm",variant:n==="list"?"default":"ghost",onClick:d,onKeyDown:m=>f(m,d),"aria-label":"Switch to list view","aria-pressed":n==="list",className:h("rounded-none border-0","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),children:e.jsx(j,{icon:De,size:18,strokeWidth:1.5,"aria-hidden":"true"})}),e.jsx(D,{size:"sm",variant:n==="grid"?"default":"ghost",onClick:y,onKeyDown:m=>f(m,y),"aria-label":"Switch to grid view","aria-pressed":n==="grid",className:h("rounded-none border-0 border-l border-primary-200","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),children:e.jsx(j,{icon:Se,size:18,strokeWidth:1.5,"aria-hidden":"true"})})]}),e.jsxs(Be,{children:[e.jsx(We,{render:e.jsxs(D,{variant:"ghost",size:"sm",className:h("gap-1","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),"aria-label":`Sort by ${Z.find(m=>m.value===a)?.label}, ${o?"ascending":"descending"}`,children:[e.jsxs("span",{children:["Sort: ",Z.find(m=>m.value===a)?.label]}),e.jsx(j,{icon:o?te:re,size:16,strokeWidth:1.5,"aria-hidden":"true"})]})}),e.jsxs(qe,{side:"bottom",align:"start",children:[Z.map(m=>e.jsx(le,{onClick:()=>v(m.value),className:h(a===m.value&&"bg-primary-100 text-primary-900","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none"),"aria-current":a===m.value?"true":"false",children:m.label},m.value)),e.jsxs(le,{onClick:l,className:"focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none",children:[e.jsx(j,{icon:o?re:te,size:16,strokeWidth:1.5,"aria-hidden":"true"}),o?"Sort Descending":"Sort Ascending"]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(D,{variant:"ghost",size:"sm",onClick:s,onKeyDown:m=>f(m,s),className:h("gap-2","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),"aria-label":"Upload files",children:[e.jsx(j,{icon:ce,size:18,strokeWidth:1.5,"aria-hidden":"true"}),e.jsx("span",{children:"Upload"})]}),e.jsxs(D,{variant:"ghost",size:"sm",onClick:i,onKeyDown:m=>f(m,i),className:h("gap-2","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),"aria-label":"Create new folder",children:[e.jsx(j,{icon:Ee,size:18,strokeWidth:1.5,"aria-hidden":"true"}),e.jsx("span",{children:"New Folder"})]})]})]})}const F={all:["files"],listing:s=>["files","listing",s],content:s=>["files","content",s]};function Xe(s){return se({queryKey:F.content(s||""),queryFn:async({signal:i})=>{const n=await fetch(`/api/files/read?path=${encodeURIComponent(s)}`,{signal:i});if(!n.ok){const a=await n.json().catch(()=>({error:"Failed to read file"}));throw new Error(a.error||"Failed to read file")}return n.json()},enabled:!!s,staleTime:30*1e3,gcTime:300*1e3})}function Ye(){const s=T(),i=t.useRef(null);return t.useEffect(()=>()=>{i.current?.abort()},[]),K({mutationFn:async({path:n,content:a})=>{i.current?.abort();const o=new AbortController;i.current=o;const c=await fetch("/api/files/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:n,content:a}),signal:o.signal});if(!c.ok){const r=await c.json().catch(()=>({error:"Failed to save file"}));throw new Error(r.error||"Failed to save file")}return c.json()},onSuccess:(n,a)=>{s.invalidateQueries({queryKey:F.content(a.path)});const o=a.path.split("/").slice(0,-1).join("/")||"/";s.invalidateQueries({queryKey:F.listing(o)})}})}function Ze(s){return se({queryKey:F.listing(s),queryFn:async({signal:i})=>{const n=await fetch(`/api/files/list?path=${encodeURIComponent(s)}`,{signal:i});if(!n.ok){const a=await n.text();throw new Error(`Failed to load files: ${a}`)}return n.json()},staleTime:300*1e3,gcTime:600*1e3,retry:3})}function es(){const s=new Set,i=t.useRef(null);return t.useEffect(()=>()=>{i.current?.abort(),s.forEach(n=>URL.revokeObjectURL(n)),s.clear()},[]),K({mutationFn:async n=>{i.current?.abort();const a=new AbortController;i.current=a;const o=await fetch(`/api/files/download?path=${encodeURIComponent(n)}`,{signal:a.signal});if(!o.ok){const y=await o.text();throw new Error(`Download failed: ${y}`)}const c=await o.blob(),r=window.URL.createObjectURL(c);s.add(r);const l=n.split("/").pop()||"download",d=document.createElement("a");d.href=r,d.download=l,document.body.appendChild(d),d.click(),document.body.removeChild(d),setTimeout(()=>{s.has(r)&&(URL.revokeObjectURL(r),s.delete(r))},100)},onError:n=>{n instanceof Error&&n.name==="AbortError"||console.error("Download failed:",n)}})}function ss(){const s=T(),i=t.useRef(null);return t.useEffect(()=>()=>{i.current?.abort()},[]),K({mutationFn:async({files:n,path:a})=>{i.current?.abort();const o=new AbortController;i.current=o;const c=[];for(let r=0;r<n.length;r++){const l=new FormData;l.append("path",a),l.append("file",n[r]);const d=await fetch("/api/files/upload",{method:"POST",body:l,signal:o.signal});if(!d.ok){const y=await d.text();throw new Error(`Upload failed for ${n[r].name}: ${y}`)}c.push(await d.json())}return c},onSuccess:(n,a)=>{s.invalidateQueries({queryKey:F.listing(a.path)})},onError:n=>{n instanceof Error&&n.name==="AbortError"||console.error("Upload failed:",n)}})}function is(){const s=T(),i=t.useRef(null);return t.useEffect(()=>()=>{i.current?.abort()},[]),K({mutationFn:async n=>{i.current?.abort();const a=new AbortController;i.current=a;const o=await fetch(`/api/files/delete?path=${encodeURIComponent(n)}`,{method:"DELETE",signal:a.signal});if(!o.ok){const c=await o.text();throw new Error(`Delete failed: ${c}`)}return o.json()},onSuccess:(n,a)=>{const o=a.split("/").slice(0,-1).join("/")||"/";s.invalidateQueries({queryKey:F.listing(o)})},onError:n=>{n instanceof Error&&n.name==="AbortError"||console.error("Delete failed:",n)}})}function ns(){const s=T(),i=t.useRef(null);return t.useEffect(()=>()=>{i.current?.abort()},[]),K({mutationFn:async({path:n,name:a})=>{i.current?.abort();const o=new AbortController;i.current=o;const c=await fetch("/api/files/mkdir",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:`${n}/${a}`}),signal:o.signal});if(!c.ok){const r=await c.text();throw new Error(`Create folder failed: ${r}`)}return c.json()},onSuccess:(n,a)=>{s.invalidateQueries({queryKey:F.listing(a.path)})},onError:n=>{n instanceof Error&&n.name==="AbortError"||console.error("Create folder failed:",n)}})}function as(){const s=T(),i=t.useRef(null);return t.useEffect(()=>()=>{i.current?.abort()},[]),K({mutationFn:async({oldPath:n,newName:a})=>{i.current?.abort();const o=new AbortController;i.current=o;const r=`${n.split("/").slice(0,-1).join("/")}/${a}`,l=await fetch("/api/files/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({src:n,dst:r}),signal:o.signal});if(!l.ok){const d=await l.text();throw new Error(`Rename failed: ${d}`)}return l.json()},onSuccess:(n,a)=>{const o=a.oldPath.split("/").slice(0,-1).join("/")||"/";s.invalidateQueries({queryKey:F.listing(o)})},onError:n=>{n instanceof Error&&n.name==="AbortError"||console.error("Rename failed:",n)}})}const ts=new Set(["txt","md","log","json","xml","yaml","yml","csv","ini","conf","cfg","js","ts","jsx","tsx","py","java","cpp","c","h","css","html","htm","php","rb","go","rs","sh","bash","zsh","toml","env","gitignore","dockerfile","makefile","sql","graphql","svelte","vue","scss","less"]);function me({item:s,children:i,onOpenFile:n}){const[a,o]=t.useState(!1),[c,r]=t.useState({x:0,y:0}),[l,d]=t.useState(!1),[y,v]=t.useState(!1),[f,m]=t.useState(s.name),[u,N]=t.useState(""),C=t.useRef(null),{navigateTo:w}=L(),p=es(),x=is(),k=as(),z=t.useCallback(b=>{switch(b){case"open":s.isDir&&w(s.path);break;case"edit":n&&n(s.path);break;case"download":s.isDir||p.mutate(s.path);break;case"rename":m(s.name),N(""),d(!0);break;case"delete":v(!0);break}},[s,p,w]),X=t.useCallback(b=>{b.preventDefault(),b.stopPropagation(),r({x:b.clientX,y:b.clientY}),o(!0)},[]),U=t.useCallback(async()=>{if(!f||f===s.name){d(!1);return}N("");try{await k.mutateAsync({oldPath:s.path,newName:f.trim()}),d(!1)}catch(b){const R=b instanceof Error?b.message:"Failed to rename";N(R)}},[f,s,k]),$=t.useCallback(async()=>{try{await x.mutateAsync(s.path),v(!1)}catch(b){console.error("Delete failed:",b)}},[s.path,x]),Y=t.useCallback(b=>{b.key==="Enter"?(b.preventDefault(),U()):b.key==="Escape"&&(b.preventDefault(),d(!1))},[U]),g=t.useCallback(b=>{m(b.target.value),u&&N("")},[u]);t.useEffect(()=>{if(l&&C.current){const b=C.current;if(b.focus(),!s.isDir&&s.extension){const R=s.name.replace(new RegExp(`\\.${s.extension}$`),"");b.setSelectionRange(0,R.length)}else b.select()}},[l,s]);const S=f.trim().length>0&&!/[<>:"/\\|?*]/.test(f)&&!f.includes("..")&&f!==s.name,M=()=>p.isPending?"Downloading…":"Download",fe=()=>k.isPending?"Renaming…":"Rename",he=()=>x.isPending?"Deleting…":"Delete";t.useEffect(()=>{if(!a)return;const b=()=>o(!1),R=ge=>{ge.key==="Escape"&&o(!1)},xe=setTimeout(()=>{document.addEventListener("click",b),document.addEventListener("contextmenu",b),document.addEventListener("keydown",R)},0);return()=>{clearTimeout(xe),document.removeEventListener("click",b),document.removeEventListener("contextmenu",b),document.removeEventListener("keydown",R)}},[a]);const P=t.useCallback(b=>{o(!1),z(b)},[z]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{onContextMenu:X,children:i}),a?e.jsx("div",{className:"fixed inset-0 z-50","aria-modal":"true",role:"dialog",children:e.jsxs("div",{className:"fixed min-w-[140px] rounded-lg bg-primary-50 p-1 text-sm text-primary-900 shadow-lg outline outline-primary-900/10 z-50",style:{left:c.x,top:c.y},role:"menu",onClick:b=>b.stopPropagation(),children:[s.isDir?e.jsxs("button",{type:"button",role:"menuitem",onClick:()=>P("open"),className:h("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm text-primary-900","hover:bg-primary-100 select-none font-[450]","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none"),children:[e.jsx(j,{icon:Fe,size:16,strokeWidth:1.5,"aria-hidden":"true"}),"Open"]}):null,s.isDir?null:e.jsxs("button",{type:"button",role:"menuitem",onClick:()=>P("download"),disabled:p.isPending,className:h("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm text-primary-900","hover:bg-primary-100 select-none font-[450]","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none"),children:[e.jsx(j,{icon:ze,size:16,strokeWidth:1.5,"aria-hidden":"true"}),M()]}),!s.isDir&&ts.has(s.extension.toLowerCase())?e.jsxs("button",{type:"button",role:"menuitem",onClick:()=>P("edit"),className:h("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm text-primary-900","hover:bg-primary-100 select-none font-[450]","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none"),children:[e.jsx(j,{icon:Me,size:16,strokeWidth:1.5,"aria-hidden":"true"}),"Edit"]}):null,e.jsxs("button",{type:"button",role:"menuitem",onClick:()=>P("rename"),className:h("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm text-primary-900","hover:bg-primary-100 select-none font-[450]","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none"),children:[e.jsx(j,{icon:Re,size:16,strokeWidth:1.5,"aria-hidden":"true"}),"Rename"]}),e.jsxs("button",{type:"button",role:"menuitem",onClick:()=>P("delete"),className:h("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm","text-red-600 hover:bg-red-50 select-none font-[450]","focus-visible:ring-2 focus-visible:ring-red-300 focus-visible:outline-none"),children:[e.jsx(j,{icon:de,size:16,strokeWidth:1.5,"aria-hidden":"true"}),"Delete"]})]})}):null,e.jsx(Q,{open:l,onOpenChange:d,children:e.jsx(_,{children:e.jsxs("div",{className:"p-6",children:[e.jsxs(V,{className:"mb-2",children:["Rename ",s.isDir?"Folder":"File"]}),e.jsxs(H,{className:"mb-4",children:['Enter a new name for "',s.name,'"']}),e.jsxs("div",{className:"mb-6",children:[e.jsxs("label",{htmlFor:"rename-input",className:"block text-sm font-medium text-primary-900 mb-2",children:[s.isDir?"Folder":"File"," Name"]}),e.jsx("input",{id:"rename-input",ref:C,type:"text",value:f,onChange:g,onKeyDown:Y,autoFocus:!0,spellCheck:!1,"aria-describedby":u?"rename-error":void 0,"aria-invalid":u?"true":"false",className:h("w-full px-3 py-2 border rounded-lg","transition-colors duration-150 ease-out","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation",u?"border-red-300 focus-visible:ring-red-300":"border-primary-200 focus:border-primary-300")}),u?e.jsx("p",{id:"rename-error",className:"text-sm text-red-600 mt-1",role:"alert","aria-live":"polite",children:u}):null]}),k.isPending?e.jsx("div",{className:"mb-4 p-3 bg-primary-50 rounded-lg","aria-live":"polite",children:e.jsx("p",{className:"text-sm text-primary-600",children:"Renaming…"})}):null,e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(G,{disabled:k.isPending,className:h("focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),children:"Cancel"}),e.jsx(D,{onClick:U,disabled:!S||k.isPending,className:h("focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation",(!S||k.isPending)&&"opacity-50 cursor-not-allowed"),children:fe()})]})]})})}),e.jsx(Q,{open:y,onOpenChange:v,children:e.jsx(_,{children:e.jsxs("div",{className:"p-6",children:[e.jsxs(V,{className:"mb-2",children:["Delete ",s.isDir?"Folder":"File"]}),e.jsxs(H,{className:"mb-4",children:['Are you sure you want to delete "',s.name,'"?',s.isDir?" This will delete the folder and all its contents.":""," ","This action cannot be undone."]}),x.isPending?e.jsx("div",{className:"mb-4 p-3 bg-red-50 rounded-lg","aria-live":"polite",children:e.jsx("p",{className:"text-sm text-red-700",children:"Deleting…"})}):null,e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(G,{disabled:x.isPending,className:h("focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),children:"Cancel"}),e.jsx(D,{variant:"destructive",onClick:$,disabled:x.isPending,className:h("focus-visible:ring-2 focus-visible:ring-red-300 focus-visible:outline-none","touch-manipulation",x.isPending&&"opacity-50 cursor-not-allowed"),children:he()})]})]})})})]})}const rs=new Set(["txt","md","log","json","xml","yaml","yml","csv","ini","conf","cfg","js","ts","jsx","tsx","py","java","cpp","c","h","css","html","htm","php","rb","go","rs","sh","bash","zsh","toml","env","gitignore","dockerfile","makefile","sql","graphql","svelte","vue","scss","less"]);function J(s){if(s===0)return"0 B";const i=1024,n=["B","KB","MB","GB","TB"],a=Math.floor(Math.log(s)/Math.log(i));return parseFloat((s/Math.pow(i,a)).toFixed(1))+" "+n[a]}function O(s){const i=new Date(s),a=new Date().getTime()-i.getTime(),o=Math.floor(a/1e3),c=Math.floor(o/60),r=Math.floor(c/60),l=Math.floor(r/24);return l>7?i.toLocaleDateString():l>0?l===1?"yesterday":`${l} days ago`:r>0?r===1?"1 hour ago":`${r} hours ago`:c>0?c===1?"1 minute ago":`${c} minutes ago`:"just now"}function pe(s){if(s.isDir)return ue;const i=s.extension.toLowerCase();return["jpg","jpeg","png","gif","webp","svg","bmp"].includes(i)?Te:["mp4","avi","mkv","mov","wmv","flv","webm"].includes(i)?Le:["mp3","wav","flac","aac","ogg","m4a"].includes(i)?Ke:["zip","rar","7z","tar","gz","bz2"].includes(i)?Ue:["txt","md","log","json","xml","yaml","yml"].includes(i)?$e:["js","ts","jsx","tsx","py","java","cpp","c","h","css","html","php","rb","go","rs"].includes(i)?Pe:ee}function ls(s,i,n){return t.useMemo(()=>[...s].sort((o,c)=>{if(o.isDir&&!c.isDir)return-1;if(!o.isDir&&c.isDir)return 1;let r=0;switch(i){case"name":r=o.name.localeCompare(c.name);break;case"size":r=o.size-c.size;break;case"modified":r=new Date(o.modified).getTime()-new Date(c.modified).getTime();break;default:r=o.name.localeCompare(c.name)}return n?r:-r}),[s,i,n])}function os(){return t.useMemo(()=>typeof window>"u"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches,[])}function cs({viewMode:s}){const i=s==="grid"?12:8;return s==="grid"?e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8 gap-3 p-4","aria-busy":"true","aria-label":"Loading files",children:Array.from({length:i},(n,a)=>e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg",children:[e.jsx("div",{className:"w-12 h-12 bg-primary-200 rounded animate-pulse mb-2"}),e.jsx("div",{className:"w-16 h-4 bg-primary-200 rounded animate-pulse"})]},a))}):e.jsx("div",{className:"divide-y divide-primary-200","aria-busy":"true","aria-label":"Loading files",children:Array.from({length:i},(n,a)=>e.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[e.jsx("div",{className:"w-6 h-6 bg-primary-200 rounded animate-pulse"}),e.jsx("div",{className:"flex-1 min-w-0 h-4 bg-primary-200 rounded animate-pulse"}),e.jsx("div",{className:"w-16 h-4 bg-primary-200 rounded animate-pulse"}),e.jsx("div",{className:"w-20 h-4 bg-primary-200 rounded animate-pulse"})]},a))})}const ds=t.memo(function({item:i,isSelected:n,onClick:a,onDoubleClick:o,onKeyDown:c,onOpenFile:r,reduceMotion:l}){const d=t.useCallback(()=>{a(i)},[a,i]),y=t.useCallback(()=>{o(i)},[o,i]),v=t.useCallback(u=>{c(u,i)},[c,i]),f=()=>i.isDir?`${i.name}, folder`:`${i.name}, ${i.extension} file, ${J(i.size)}, modified ${O(i.modified)}`,m=e.jsxs(E.button,{type:"button",whileHover:l?{}:{scale:1.02},whileTap:l?{}:{scale:.98},transition:{duration:l?0:.1},onClick:d,onDoubleClick:y,onKeyDown:v,"aria-label":f(),className:h("flex flex-col items-center p-3 rounded-lg w-full","transition-colors duration-150 ease-out","hover:bg-primary-100 focus-visible:bg-primary-100","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation",n&&"bg-primary-200"),children:[e.jsx(j,{icon:pe(i),size:48,strokeWidth:1,className:h("mb-2",i.isDir?"text-blue-500":"text-primary-600"),"aria-hidden":"true"}),e.jsx("span",{className:"text-xs text-center text-primary-900 font-medium truncate w-full min-w-0",children:i.name}),i.isDir?null:e.jsx("span",{className:"text-xs text-primary-500 mt-1 tabular-nums",children:J(i.size)})]});return e.jsx(me,{item:i,onOpenFile:r,children:m})}),us=t.memo(function({item:i,isSelected:n,onClick:a,onDoubleClick:o,onKeyDown:c,onOpenFile:r,reduceMotion:l}){const d=t.useCallback(()=>{a(i)},[a,i]),y=t.useCallback(()=>{o(i)},[o,i]),v=t.useCallback(u=>{c(u,i)},[c,i]),f=()=>i.isDir?`${i.name}, folder, modified ${O(i.modified)}`:`${i.name}, ${i.extension} file, ${J(i.size)}, modified ${O(i.modified)}`,m=e.jsxs(E.button,{type:"button",whileHover:l?{}:{backgroundColor:"rgb(248 250 252)"},transition:{duration:l?0:.1},onClick:d,onDoubleClick:y,onKeyDown:v,"aria-label":f(),className:h("w-full grid grid-cols-[auto_1fr_auto_auto] gap-4 px-4 py-3 text-left","transition-colors duration-150 ease-out","hover:bg-primary-100 focus-visible:bg-primary-100","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation",n&&"bg-primary-200"),children:[e.jsx(j,{icon:pe(i),size:20,strokeWidth:1.5,className:h("mt-0.5 shrink-0",i.isDir?"text-blue-500":"text-primary-600"),"aria-hidden":"true"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("span",{className:"text-primary-900 font-medium truncate block",children:i.name})}),e.jsx("div",{className:"text-sm text-primary-600 text-right w-16 tabular-nums shrink-0",children:i.isDir?"—":J(i.size)}),e.jsx("div",{className:"text-sm text-primary-600 text-right w-20 tabular-nums shrink-0",children:O(i.modified)})]});return e.jsx(me,{item:i,onOpenFile:r,children:m})}),ms=e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsxs("div",{className:"text-center",children:[e.jsx(j,{icon:ue,size:48,strokeWidth:1,className:"mx-auto text-primary-400 mb-3","aria-hidden":"true"}),e.jsx("p",{className:"text-primary-600 font-medium",children:"This folder is empty"}),e.jsx("p",{className:"text-sm text-primary-500 mt-1",children:"Upload files or create a new folder to get started"})]})});function ps({listing:s,loading:i,onOpenFile:n}){const{viewMode:a,sortBy:o,sortAsc:c,selectedFiles:r,navigateTo:l,toggleFileSelection:d}=L(),[y,v]=t.useState(0),f=t.useRef(null),m=os(),u=ls(s?.items||[],o,c),N=t.useCallback(p=>{d(p.path)},[d]),C=t.useCallback(p=>{p.isDir?l(p.path):n&&rs.has(p.extension.toLowerCase())&&n(p.path)},[l,n]),w=t.useCallback((p,x)=>{p.key==="Enter"?(p.preventDefault(),x.isDir?l(x.path):d(x.path)):p.key===" "&&(p.preventDefault(),d(x.path))},[l,d]);return t.useEffect(()=>{const p=x=>{if(u.length)switch(x.key){case"ArrowDown":x.preventDefault(),v(k=>Math.min(k+1,u.length-1));break;case"ArrowUp":x.preventDefault(),v(k=>Math.max(k-1,0));break;case"Home":x.preventDefault(),v(0);break;case"End":x.preventDefault(),v(u.length-1);break}};if(f.current)return f.current.addEventListener("keydown",p),()=>{f.current?.removeEventListener("keydown",p)}},[u.length]),i?e.jsx(cs,{viewMode:a}):s?u.length===0?ms:a==="grid"?e.jsx("div",{ref:f,className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8 gap-3 p-4 overflow-y-auto",role:"grid","aria-label":"Files grid",tabIndex:0,children:u.map((p,x)=>e.jsx("div",{role:"gridcell",children:e.jsx(ds,{item:p,isSelected:r.has(p.path),onClick:N,onDoubleClick:C,onKeyDown:w,onOpenFile:n,reduceMotion:m})},p.path))}):e.jsx("div",{ref:f,className:"overflow-y-auto",role:"table","aria-label":"Files list",tabIndex:0,children:e.jsxs("div",{className:"divide-y divide-primary-200",children:[e.jsxs("div",{className:"grid grid-cols-[auto_1fr_auto_auto] gap-4 px-4 py-2 text-sm font-medium text-primary-600 bg-primary-50",role:"row",children:[e.jsx("div",{className:"w-6",role:"columnheader","aria-label":"File type"}),e.jsx("div",{role:"columnheader",children:"Name"}),e.jsx("div",{className:"w-16 text-right tabular-nums",role:"columnheader",children:"Size"}),e.jsx("div",{className:"w-20 text-right tabular-nums",role:"columnheader",children:"Modified"})]}),u.map((p,x)=>e.jsx("div",{role:"row",children:e.jsx(us,{item:p,isSelected:r.has(p.path),onClick:N,onDoubleClick:C,onKeyDown:w,onOpenFile:n,reduceMotion:m})},p.path))]})}):e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx("p",{className:"text-primary-500",children:"No listing available"})})}function oe(s){if(s===0)return"0 B";const i=1024,n=["B","KB","MB","GB"],a=Math.floor(Math.log(s)/Math.log(i));return parseFloat((s/Math.pow(i,a)).toFixed(1))+" "+n[a]}function fs({open:s,onOpenChange:i,currentPath:n}){const[a,o]=t.useState([]),[c,r]=t.useState(!1),[l,d]=t.useState("idle"),y=t.useRef(null),v=ss(),f=t.useCallback(()=>{o([]),d("idle"),y.current&&(y.current.value="")},[]),m=t.useCallback(g=>{if(!g)return;const S=Array.from(g).map(M=>({file:M,id:Math.random().toString(36).substr(2,9)}));o(M=>[...M,...S])},[]),u=t.useCallback(g=>{m(g.target.files)},[m]),N=t.useCallback(g=>{g.preventDefault(),r(!1),m(g.dataTransfer.files)},[m]),C=t.useCallback(g=>{g.preventDefault(),r(!0)},[]),w=t.useCallback(g=>{g.preventDefault(),r(!1)},[]),p=t.useCallback(g=>{o(S=>S.filter(M=>M.id!==g))},[]),x=t.useCallback(()=>{y.current?.click()},[]),k=t.useCallback(g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),x())},[x]),z=t.useCallback(async()=>{if(a.length===0)return;const g=new DataTransfer;a.forEach(({file:S})=>{g.items.add(S)}),d("uploading");try{await v.mutateAsync({files:g.files,path:n}),d("success"),f(),i(!1)}catch(S){d("error"),console.error("Upload failed:",S)}},[a,n,v,f,i]),X=t.useCallback(g=>{g||f(),i(g)},[f,i]),U=a.reduce((g,{file:S})=>g+S.size,0),$=a.length,Y=()=>v.isPending||l==="uploading"?"Uploading…":$===0?"Upload":$===1?"Upload 1 File":`Upload ${$} Files`;return e.jsx(Q,{open:s,onOpenChange:X,children:e.jsx(_,{className:"w-[min(500px,92vw)]",children:e.jsxs("div",{className:"p-6",children:[e.jsx(V,{className:"mb-2",children:"Upload Files"}),e.jsxs(H,{className:"mb-6",children:["Upload files to ",n==="/"?"root directory":n]}),e.jsxs("div",{onDrop:N,onDragOver:C,onDragLeave:w,onClick:x,onKeyDown:k,tabIndex:0,role:"button","aria-label":"Drop files here or click to choose files",className:h("border-2 border-dashed rounded-lg p-8 text-center cursor-pointer","transition-colors duration-150 ease-out","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation",c?"border-primary-400 bg-primary-50":"border-primary-200 hover:border-primary-300 hover:bg-primary-50"),children:[e.jsx(j,{icon:ce,size:48,strokeWidth:1,className:"mx-auto text-primary-400 mb-4","aria-hidden":"true"}),e.jsx("p",{className:"text-primary-600 font-medium mb-2",children:"Drag and drop files here"}),e.jsx("p",{className:"text-sm text-primary-500 mb-4",children:"or"}),e.jsxs(D,{variant:"outline",className:h("gap-2","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),"aria-label":"Choose files from computer",children:[e.jsx(j,{icon:ee,size:18,strokeWidth:1.5,"aria-hidden":"true"}),e.jsx("span",{children:"Choose Files"})]}),e.jsx("input",{ref:y,type:"file",multiple:!0,onChange:u,className:"hidden","aria-hidden":"true"})]}),e.jsx(I,{children:a.length>0?e.jsxs(E.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"mt-6",children:[e.jsxs("h4",{className:"text-sm font-medium text-primary-900 mb-3",children:["Selected Files (",a.length,")"]}),e.jsx("div",{className:"max-h-32 overflow-y-auto border border-primary-200 rounded-lg",children:a.map(({file:g,id:S})=>e.jsxs(E.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},exit:{opacity:0,x:10},className:"flex items-center justify-between p-2 border-b border-primary-100 last:border-b-0",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[e.jsx(j,{icon:ee,size:16,strokeWidth:1.5,className:"text-primary-600 shrink-0","aria-hidden":"true"}),e.jsx("span",{className:"text-sm text-primary-900 truncate min-w-0",children:g.name}),e.jsx("span",{className:"text-xs text-primary-500 shrink-0 tabular-nums",children:oe(g.size)})]}),e.jsx(D,{size:"icon-sm",variant:"ghost",onClick:()=>p(S),className:h("text-primary-500 hover:text-red-600 shrink-0","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),"aria-label":`Remove ${g.name} from upload list`,children:e.jsx(j,{icon:de,size:14,strokeWidth:1.5,"aria-hidden":"true"})})]},S))}),e.jsxs("p",{className:"text-xs text-primary-600 mt-2 tabular-nums",children:["Total size: ",oe(U)]})]}):null}),v.isPending||l==="uploading"?e.jsxs(E.div,{initial:{opacity:0},animate:{opacity:1},className:"mt-4 p-3 bg-primary-50 rounded-lg","aria-live":"polite",children:[e.jsx("p",{className:"text-sm text-primary-600 mb-2",children:"Uploading files…"}),e.jsx("div",{className:"bg-primary-200 rounded-full h-2",role:"progressbar","aria-label":"Upload progress",children:e.jsx("div",{className:"bg-primary-600 h-2 rounded-full w-1/2 animate-pulse"})})]}):null,l==="success"?e.jsx("div",{className:"mt-4 p-3 bg-green-50 rounded-lg","aria-live":"polite",children:e.jsx("p",{className:"text-sm text-green-700",children:"Files uploaded successfully!"})}):null,l==="error"?e.jsx("div",{className:"mt-4 p-3 bg-red-50 rounded-lg","aria-live":"polite",children:e.jsx("p",{className:"text-sm text-red-700",children:"Upload failed. Please try again."})}):null,e.jsxs("div",{className:"flex justify-end gap-2 mt-6",children:[e.jsx(G,{disabled:v.isPending||l==="uploading",className:h("focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),children:"Cancel"}),e.jsx(D,{onClick:z,disabled:a.length===0||v.isPending||l==="uploading",className:h("focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),children:Y()})]})]})})})}function hs({open:s,onOpenChange:i,currentPath:n}){const[a,o]=t.useState(""),[c,r]=t.useState(""),l=ns(),d=t.useCallback(async()=>{if(a.trim()){r("");try{await l.mutateAsync({path:n,name:a.trim()}),o(""),i(!1)}catch(p){const x=p instanceof Error?p.message:"Failed to create folder";r(x),console.error("Create folder failed:",p)}}},[a,n,l,i]),y=t.useCallback(p=>{p||(o(""),r("")),i(p)},[i]),v=t.useCallback(p=>{p.key==="Enter"&&(p.preventDefault(),d())},[d]),f=t.useCallback(p=>{const x=p.target.value;o(x),c&&r("")},[c]),m=a.trim().length>0&&!/[<>:"/\\|?*]/.test(a)&&!a.includes(".."),u=()=>l.isPending?"Creating…":"Create Folder",C=a.trim()?a.includes("..")?'Folder name cannot contain ".."':/[<>:"/\\|?*]/.test(a)?'Invalid characters: < > : " / \\ | ? *':"":"",w=c||C;return e.jsx(Q,{open:s,onOpenChange:y,children:e.jsx(_,{children:e.jsxs("div",{className:"p-6",children:[e.jsx(V,{className:"mb-2",children:"Create New Folder"}),e.jsxs(H,{className:"mb-4",children:["Create a new folder in ",n==="/"?"root directory":n]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("label",{htmlFor:"folder-name",className:"block text-sm font-medium text-primary-900 mb-2",children:"Folder Name"}),e.jsx("input",{id:"folder-name",type:"text",value:a,onChange:f,onKeyDown:v,placeholder:"Enter folder name",autoComplete:"off",spellCheck:!1,autoFocus:!0,"aria-describedby":w?"folder-name-error":void 0,"aria-invalid":w?"true":"false",className:h("w-full px-3 py-2 border rounded-lg","transition-colors duration-150 ease-out","focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation",w?"border-red-300 focus-visible:ring-red-300":"border-primary-200 focus:border-primary-300")}),w?e.jsx("p",{id:"folder-name-error",className:"text-sm text-red-600 mt-1",role:"alert","aria-live":"polite",children:c||C}):null]}),l.isPending?e.jsx("div",{className:"mb-4 p-3 bg-primary-50 rounded-lg","aria-live":"polite",children:e.jsx("p",{className:"text-sm text-primary-600",children:"Creating folder…"})}):null,e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(G,{disabled:l.isPending,className:h("focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation"),children:"Cancel"}),e.jsx(D,{onClick:d,disabled:!m||l.isPending,className:h("focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none","touch-manipulation",(!m||l.isPending)&&"opacity-50 cursor-not-allowed"),"aria-describedby":m?void 0:"create-button-help",children:u()})]}),!m&&a.length>0?e.jsx("p",{id:"create-button-help",className:"text-xs text-primary-500 mt-2",children:"Please enter a valid folder name"}):null]})})})}const xs={js:"JavaScript",ts:"TypeScript",jsx:"JSX",tsx:"TSX",py:"Python",json:"JSON",yaml:"YAML",yml:"YAML",md:"Markdown",html:"HTML",css:"CSS",scss:"SCSS",sh:"Shell",bash:"Bash",sql:"SQL",xml:"XML",toml:"TOML",ini:"INI",conf:"Config",cfg:"Config",env:"Env",txt:"Text",log:"Log",csv:"CSV",go:"Go",rs:"Rust",rb:"Ruby",php:"PHP",java:"Java",c:"C",cpp:"C++",h:"Header",dockerfile:"Dockerfile",makefile:"Makefile",graphql:"GraphQL",svelte:"Svelte",vue:"Vue"};function gs({filePath:s,onClose:i}){const n=Xe(s),a=Ye(),o=t.useRef(null),[c,r]=t.useState(null),[l,d]=t.useState(!1);t.useEffect(()=>{n.data&&c===null&&r(n.data.content)},[n.data,c]);const y=t.useMemo(()=>n.data?xs[n.data.extension.toLowerCase()]||n.data.extension.toUpperCase():"",[n.data]),v=t.useCallback(C=>{r(C.target.value),d(C.target.value!==n.data?.content)},[n.data]),f=t.useCallback(async()=>{if(c!==null)try{await a.mutateAsync({path:s,content:c}),d(!1)}catch{}},[s,c,a]),m=t.useCallback(()=>{l&&!window.confirm("You have unsaved changes. Discard them?")||i()},[l,i]);t.useEffect(()=>{const C=w=>{(w.ctrlKey||w.metaKey)&&w.key==="s"&&(w.preventDefault(),l&&f()),w.key==="Escape"&&m()};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[f,m,l]);const u=t.useCallback(C=>{if(C.key==="Tab"){C.preventDefault();const w=C.currentTarget,p=w.selectionStart,x=w.selectionEnd,k=w.value,z=k.substring(0,p)+" "+k.substring(x);r(z),d(z!==n.data?.content),requestAnimationFrame(()=>{w.selectionStart=w.selectionEnd=p+2})}},[n.data]),N=s.split("/").pop()||s;return e.jsxs("div",{className:"fixed inset-0 z-50 bg-surface flex flex-col",children:[e.jsxs("header",{className:"flex items-center justify-between px-4 py-2 border-b border-primary-200 bg-primary-50",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("h2",{className:"text-sm font-semibold text-primary-900 truncate",children:N}),y?e.jsx("span",{className:"text-xs text-primary-500 bg-primary-100 px-2 py-0.5 rounded-full shrink-0",children:y}):null,l?e.jsx("span",{className:"text-xs text-amber-600 bg-amber-50 px-2 py-0.5 rounded-full shrink-0",children:"Unsaved"}):null,a.isError?e.jsx("span",{className:"text-xs text-red-600",children:a.error.message}):null]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsxs(D,{size:"sm",variant:"default",onClick:f,disabled:!l||a.isPending,className:h((!l||a.isPending)&&"opacity-50 cursor-not-allowed"),children:[e.jsx(j,{icon:Ie,size:16,strokeWidth:1.5,"aria-hidden":"true"}),a.isPending?"Saving…":"Save"]}),e.jsx(D,{size:"icon-sm",variant:"ghost",onClick:m,"aria-label":"Close editor",children:e.jsx(j,{icon:Ae,size:20,strokeWidth:1.5,"aria-hidden":"true"})})]})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:n.isLoading?e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx("p",{className:"text-primary-500 text-sm",children:"Loading file…"})}):n.isError?e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-red-600 text-sm mb-2",children:n.error instanceof Error?n.error.message:"Failed to load file"}),e.jsx(D,{size:"sm",variant:"secondary",onClick:()=>{n.refetch()},children:"Retry"})]})}):e.jsx("textarea",{ref:o,value:c??"",onChange:v,onKeyDown:u,spellCheck:!1,autoFocus:!0,className:h("w-full h-full p-4 resize-none","bg-primary-950 text-primary-100","font-mono text-sm leading-relaxed","focus:outline-none","selection:bg-blue-800/50")})}),n.data?e.jsxs("footer",{className:"flex items-center justify-between px-4 py-1 border-t border-primary-200 bg-primary-50 text-xs text-primary-500",children:[e.jsx("span",{children:s}),e.jsx("span",{children:bs(n.data.size)})]}):null]})}function bs(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function Ns(){const s=T(),{currentPath:i}=L(),[n,a]=t.useState(!1),[o,c]=t.useState(!1),[r,l]=t.useState(null),d=Ze(i),v=se({queryKey:ve,queryFn:function(){return ne(s)},initialData:function(){return ne(s)},staleTime:1/0}).data?.isSidebarCollapsed??!1,f=t.useCallback(()=>{be(s,function(k){return{...k,isSidebarCollapsed:!k.isSidebarCollapsed}})},[s]),m=t.useCallback(()=>{a(!0)},[]),u=t.useCallback(()=>{c(!0)},[]),N=t.useCallback(x=>{l(x)},[]),C=t.useCallback(()=>{l(null)},[]),w=t.useMemo(()=>({display:"flex",flexDirection:"column",height:"100%",minHeight:0}),[]),p=e.jsx(He,{isCollapsed:v,onToggleCollapse:f,onSelectAction:()=>{}});return e.jsxs("div",{className:"h-screen bg-surface text-primary-900",children:[e.jsxs("div",{className:h("h-full overflow-hidden grid grid-cols-[auto_1fr]"),children:[p,e.jsxs("main",{"aria-label":"File explorer",style:w,children:[e.jsxs("header",{className:"border-b border-primary-200 px-4 py-3",children:[e.jsx("div",{className:"flex items-center justify-between mb-2",children:e.jsx(Ge,{path:i})}),e.jsx(Je,{onUpload:m,onCreateFolder:u})]}),e.jsxs("div",{className:"flex-1 min-h-0 overflow-auto",children:[e.jsx(ps,{listing:d.data,loading:d.isLoading,onOpenFile:N}),d.isError?e.jsxs("div",{className:"p-4 text-center","aria-live":"polite",children:[e.jsx("p",{className:"text-red-600 text-sm",children:d.error instanceof Error?d.error.message:"Failed to load files"}),e.jsx("button",{onClick:()=>{d.refetch()},className:"mt-2 text-sm text-primary-600 hover:text-primary-900 underline focus-visible:ring-2 focus-visible:ring-primary-300 focus-visible:outline-none rounded-sm",children:"Retry"})]}):null]}),e.jsx(fs,{open:n,onOpenChange:a,currentPath:i}),e.jsx(hs,{open:o,onOpenChange:c,currentPath:i})]})]}),r?e.jsx(gs,{filePath:r,onClose:C}):null]})}export{Ns as FileExplorerScreen};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/file-explorer-screen-hjggspl-.js","assets/main-BlX7CS2-.js","assets/useButton-DhneLsMA.js","assets/button-BcnCTjUT.js","assets/use-file-explorer-state-C6lX-h0n.js","assets/react-ONC2UaeC.js"])))=>i.map(i=>d[i]);
2
- import{j as e,r,_ as s}from"./main-BlX7CS2-.js";const n=r.lazy(()=>s(()=>import("./file-explorer-screen-hjggspl-.js"),__vite__mapDeps([0,1,2,3,4,5])).then(t=>({default:t.FileExplorerScreen})));function o(){return e.jsx(r.Suspense,{fallback:e.jsx("div",{className:"flex h-screen items-center justify-center text-primary-500 text-sm",children:"Loading…"}),children:e.jsx(n,{})})}export{o as component};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/file-explorer-screen-DMUuR1uG.js","assets/main-DrVY5UJU.js","assets/useButton-hZdvKtl_.js","assets/button-CuH8u1uR.js","assets/use-file-explorer-state-Cii59H70.js","assets/react-CzqI3gbN.js"])))=>i.map(i=>d[i]);
2
+ import{j as e,r,_ as s}from"./main-DrVY5UJU.js";const n=r.lazy(()=>s(()=>import("./file-explorer-screen-DMUuR1uG.js"),__vite__mapDeps([0,1,2,3,4,5])).then(t=>({default:t.FileExplorerScreen})));function o(){return e.jsx(r.Suspense,{fallback:e.jsx("div",{className:"flex h-screen items-center justify-center text-primary-500 text-sm",children:"Loading…"}),children:e.jsx(n,{})})}export{o as component};
@@ -1,4 +1,4 @@
1
- import{r as H,j as K}from"./main-BlX7CS2-.js";import{B as yi,H as ki,X as wi,x as xi,c as Ue}from"./button-BcnCTjUT.js";import{c as $i}from"./react-ONC2UaeC.js";let S=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function vi(n){return Yn(n)}function Yn(n){return Array.isArray(n)?Ci(n):n instanceof RegExp?n:typeof n=="object"?ji(n):n}function Ci(n){let e=[];for(let t=0,a=n.length;t<a;t++)e[t]=Yn(n[t]);return e}function ji(n){let e={};for(let t in n)e[t]=Yn(n[t]);return e}function aa(n,...e){return e.forEach(t=>{for(let a in t)n[a]=t[a]}),n}function ia(n){const e=~n.lastIndexOf("/")||~n.lastIndexOf("\\");return e===0?n:~e===n.length-1?ia(n.substring(0,n.length-1)):n.substr(~e+1)}var bn=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Le=class{static hasCaptures(n){return n===null?!1:(bn.lastIndex=0,bn.test(n))}static replaceCaptures(n,e,t){return n.replace(bn,(a,i,r,s)=>{let o=t[parseInt(i||r,10)];if(o){let c=e.substring(o.start,o.end);for(;c[0]===".";)c=c.substring(1);switch(s){case"downcase":return c.toLowerCase();case"upcase":return c.toUpperCase();default:return c}}else return a})}};function ra(n,e){return n<e?-1:n>e?1:0}function sa(n,e){if(n===null&&e===null)return 0;if(!n)return-1;if(!e)return 1;let t=n.length,a=e.length;if(t===a){for(let i=0;i<t;i++){let r=ra(n[i],e[i]);if(r!==0)return r}return 0}return t-a}function gt(n){return!!(/^#[0-9a-f]{6}$/i.test(n)||/^#[0-9a-f]{8}$/i.test(n)||/^#[0-9a-f]{3}$/i.test(n)||/^#[0-9a-f]{4}$/i.test(n))}function oa(n){return n.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var ca=class{constructor(n){this.fn=n}cache=new Map;get(n){if(this.cache.has(n))return this.cache.get(n);const e=this.fn(n);return this.cache.set(n,e),e}},Xe=class{constructor(n,e,t){this._colorMap=n,this._defaults=e,this._root=t}static createFromRawTheme(n,e){return this.createFromParsedTheme(qi(n),e)}static createFromParsedTheme(n,e){return zi(n,e)}_cachedMatchRoot=new ca(n=>this._root.match(n));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(n){if(n===null)return this._defaults;const e=n.scopeName,a=this._cachedMatchRoot.get(e).find(i=>Ai(n.parent,i.parentScopes));return a?new pa(a.fontStyle,a.foreground,a.background):null}},gn=class De{constructor(e,t){this.parent=e,this.scopeName=t}static push(e,t){for(const a of t)e=new De(e,a);return e}static from(...e){let t=null;for(let a=0;a<e.length;a++)t=new De(t,e[a]);return t}push(e){return new De(this,e)}getSegments(){let e=this;const t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(" ")}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){const t=[];let a=this;for(;a&&a!==e;)t.push(a.scopeName),a=a.parent;return a===e?t.reverse():void 0}};function Ai(n,e){if(e.length===0)return!0;for(let t=0;t<e.length;t++){let a=e[t],i=!1;if(a===">"){if(t===e.length-1)return!1;a=e[++t],i=!0}for(;n&&!Ei(n.scopeName,a);){if(i)return!1;n=n.parent}if(!n)return!1;n=n.parent}return!0}function Ei(n,e){return e===n||n.startsWith(e)&&n[e.length]==="."}var pa=class{constructor(n,e,t){this.fontStyle=n,this.foregroundId=e,this.backgroundId=t}};function qi(n){if(!n)return[];if(!n.settings||!Array.isArray(n.settings))return[];let e=n.settings,t=[],a=0;for(let i=0,r=e.length;i<r;i++){let s=e[i];if(!s.settings)continue;let o;if(typeof s.scope=="string"){let m=s.scope;m=m.replace(/^[,]+/,""),m=m.replace(/[,]+$/,""),o=m.split(",")}else Array.isArray(s.scope)?o=s.scope:o=[""];let c=-1;if(typeof s.settings.fontStyle=="string"){c=0;let m=s.settings.fontStyle.split(" ");for(let u=0,b=m.length;u<b;u++)switch(m[u]){case"italic":c=c|1;break;case"bold":c=c|2;break;case"underline":c=c|4;break;case"strikethrough":c=c|8;break}}let p=null;typeof s.settings.foreground=="string"&&gt(s.settings.foreground)&&(p=s.settings.foreground);let l=null;typeof s.settings.background=="string"&&gt(s.settings.background)&&(l=s.settings.background);for(let m=0,u=o.length;m<u;m++){let d=o[m].trim().split(" "),y=d[d.length-1],g=null;d.length>1&&(g=d.slice(0,d.length-1),g.reverse()),t[a++]=new Fi(y,g,i,c,p,l)}}return t}var Fi=class{constructor(n,e,t,a,i,r){this.scope=n,this.parentScopes=e,this.index=t,this.fontStyle=a,this.foreground=i,this.background=r}},Z=(n=>(n[n.NotSet=-1]="NotSet",n[n.None=0]="None",n[n.Italic=1]="Italic",n[n.Bold=2]="Bold",n[n.Underline=4]="Underline",n[n.Strikethrough=8]="Strikethrough",n))(Z||{});function zi(n,e){n.sort((c,p)=>{let l=ra(c.scope,p.scope);return l!==0||(l=sa(c.parentScopes,p.parentScopes),l!==0)?l:c.index-p.index});let t=0,a="#000000",i="#ffffff";for(;n.length>=1&&n[0].scope==="";){let c=n.shift();c.fontStyle!==-1&&(t=c.fontStyle),c.foreground!==null&&(a=c.foreground),c.background!==null&&(i=c.background)}let r=new Si(e),s=new pa(t,r.getId(a),r.getId(i)),o=new Ti(new qn(0,null,-1,0,0),[]);for(let c=0,p=n.length;c<p;c++){let l=n[c];o.insert(0,l.scope,l.parentScopes,l.fontStyle,r.getId(l.foreground),r.getId(l.background))}return new Xe(r,s,o)}var Si=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(n){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(n)){this._isFrozen=!0;for(let e=0,t=n.length;e<t;e++)this._color2id[n[e]]=e,this._id2color[e]=n[e]}else this._isFrozen=!1}getId(n){if(n===null)return 0;n=n.toUpperCase();let e=this._color2id[n];if(e)return e;if(this._isFrozen)throw new Error(`Missing color in color map - ${n}`);return e=++this._lastColorId,this._color2id[n]=e,this._id2color[e]=n,e}getColorMap(){return this._id2color.slice(0)}},Ni=Object.freeze([]),qn=class la{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,a,i,r){this.scopeDepth=e,this.parentScopes=t||Ni,this.fontStyle=a,this.foreground=i,this.background=r}clone(){return new la(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let a=0,i=e.length;a<i;a++)t[a]=e[a].clone();return t}acceptOverwrite(e,t,a,i){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),a!==0&&(this.foreground=a),i!==0&&(this.background=i)}},Ti=class Fn{constructor(e,t=[],a={}){this._mainRule=e,this._children=a,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let a=0,i=0;for(;e.parentScopes[a]===">"&&a++,t.parentScopes[i]===">"&&i++,!(a>=e.parentScopes.length||i>=t.parentScopes.length);){const r=t.parentScopes[i].length-e.parentScopes[a].length;if(r!==0)return r;a++,i++}return t.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let a=e.indexOf("."),i,r;if(a===-1?(i=e,r=""):(i=e.substring(0,a),r=e.substring(a+1)),this._children.hasOwnProperty(i))return this._children[i].match(r)}const t=this._rulesWithParentScopes.concat(this._mainRule);return t.sort(Fn._cmpBySpecificity),t}insert(e,t,a,i,r,s){if(t===""){this._doInsertHere(e,a,i,r,s);return}let o=t.indexOf("."),c,p;o===-1?(c=t,p=""):(c=t.substring(0,o),p=t.substring(o+1));let l;this._children.hasOwnProperty(c)?l=this._children[c]:(l=new Fn(this._mainRule.clone(),qn.cloneArr(this._rulesWithParentScopes)),this._children[c]=l),l.insert(e+1,p,a,i,r,s)}_doInsertHere(e,t,a,i,r){if(t===null){this._mainRule.acceptOverwrite(e,a,i,r);return}for(let s=0,o=this._rulesWithParentScopes.length;s<o;s++){let c=this._rulesWithParentScopes[s];if(sa(c.parentScopes,t)===0){c.acceptOverwrite(e,a,i,r);return}}a===-1&&(a=this._mainRule.fontStyle),i===0&&(i=this._mainRule.foreground),r===0&&(r=this._mainRule.background),this._rulesWithParentScopes.push(new qn(e,t,a,i,r))}},_e=class U{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const t=U.getLanguageId(e),a=U.getTokenType(e),i=U.getFontStyle(e),r=U.getForeground(e),s=U.getBackground(e);console.log({languageId:t,tokenType:a,fontStyle:i,foreground:r,background:s})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(e,t,a,i,r,s,o){let c=U.getLanguageId(e),p=U.getTokenType(e),l=U.containsBalancedBrackets(e)?1:0,m=U.getFontStyle(e),u=U.getForeground(e),b=U.getBackground(e);return t!==0&&(c=t),a!==8&&(p=a),i!==null&&(l=i?1:0),r!==-1&&(m=r),s!==0&&(u=s),o!==0&&(b=o),(c<<0|p<<8|l<<10|m<<11|u<<15|b<<24)>>>0}};function Ve(n,e){const t=[],a=Zi(n);let i=a.next();for(;i!==null;){let c=0;if(i.length===2&&i.charAt(1)===":"){switch(i.charAt(0)){case"R":c=1;break;case"L":c=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=a.next()}let p=s();if(t.push({matcher:p,priority:c}),i!==",")break;i=a.next()}return t;function r(){if(i==="-"){i=a.next();const c=r();return p=>!!c&&!c(p)}if(i==="("){i=a.next();const c=o();return i===")"&&(i=a.next()),c}if(_t(i)){const c=[];do c.push(i),i=a.next();while(_t(i));return p=>e(c,p)}return null}function s(){const c=[];let p=r();for(;p;)c.push(p),p=r();return l=>c.every(m=>m(l))}function o(){const c=[];let p=s();for(;p&&(c.push(p),i==="|"||i===",");){do i=a.next();while(i==="|"||i===",");p=s()}return l=>c.some(m=>m(l))}}function _t(n){return!!n&&!!n.match(/[\w\.:]+/)}function Zi(n){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,t=e.exec(n);return{next:()=>{if(!t)return null;const a=t[0];return t=e.exec(n),a}}}function ma(n){typeof n.dispose=="function"&&n.dispose()}var Ae=class{constructor(n){this.scopeName=n}toKey(){return this.scopeName}},Ii=class{constructor(n,e){this.scopeName=n,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},Ri=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(n){const e=n.toKey();this._seenReferenceKeys.has(e)||(this._seenReferenceKeys.add(e),this._references.push(n))}},Ui=class{constructor(n,e){this.repo=n,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Ae(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const n=this.Q;this.Q=[];const e=new Ri;for(const t of n)Li(t,this.initialScopeName,this.repo,e);for(const t of e.references)if(t instanceof Ae){if(this.seenFullScopeRequests.has(t.scopeName))continue;this.seenFullScopeRequests.add(t.scopeName),this.Q.push(t)}else{if(this.seenFullScopeRequests.has(t.scopeName)||this.seenPartialScopeRequests.has(t.toKey()))continue;this.seenPartialScopeRequests.add(t.toKey()),this.Q.push(t)}}};function Li(n,e,t,a){const i=t.lookup(n.scopeName);if(!i){if(n.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const r=t.lookup(e);n instanceof Ae?Be({baseGrammar:r,selfGrammar:i},a):zn(n.ruleName,{baseGrammar:r,selfGrammar:i,repository:i.repository},a);const s=t.injections(n.scopeName);if(s)for(const o of s)a.add(new Ae(o))}function zn(n,e,t){if(e.repository&&e.repository[n]){const a=e.repository[n];Ye([a],e,t)}}function Be(n,e){n.selfGrammar.patterns&&Array.isArray(n.selfGrammar.patterns)&&Ye(n.selfGrammar.patterns,{...n,repository:n.selfGrammar.repository},e),n.selfGrammar.injections&&Ye(Object.values(n.selfGrammar.injections),{...n,repository:n.selfGrammar.repository},e)}function Ye(n,e,t){for(const a of n){if(t.visitedRule.has(a))continue;t.visitedRule.add(a);const i=a.repository?aa({},e.repository,a.repository):e.repository;Array.isArray(a.patterns)&&Ye(a.patterns,{...e,repository:i},t);const r=a.include;if(!r)continue;const s=ua(r);switch(s.kind){case 0:Be({...e,selfGrammar:e.baseGrammar},t);break;case 1:Be(e,t);break;case 2:zn(s.ruleName,{...e,repository:i},t);break;case 3:case 4:const o=s.scopeName===e.selfGrammar.scopeName?e.selfGrammar:s.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(o){const c={baseGrammar:e.baseGrammar,selfGrammar:o,repository:i};s.kind===4?zn(s.ruleName,c,t):Be(c,t)}else s.kind===4?t.add(new Ii(s.scopeName,s.ruleName)):t.add(new Ae(s.scopeName));break}}}var Wi=class{kind=0},Oi=class{kind=1},Pi=class{constructor(n){this.ruleName=n}kind=2},Gi=class{constructor(n){this.scopeName=n}kind=3},Mi=class{constructor(n,e){this.scopeName=n,this.ruleName=e}kind=4};function ua(n){if(n==="$base")return new Wi;if(n==="$self")return new Oi;const e=n.indexOf("#");if(e===-1)return new Gi(n);if(e===0)return new Pi(n.substring(1));{const t=n.substring(0,e),a=n.substring(e+1);return new Mi(t,a)}}var Di=/\\(\d+)/,ht=/\\(\d+)/g,Bi=-1,da=-2;var Se=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(n,e,t,a){this.$location=n,this.id=e,this._name=t||null,this._nameIsCapturing=Le.hasCaptures(this._name),this._contentName=a||null,this._contentNameIsCapturing=Le.hasCaptures(this._contentName)}get debugName(){const n=this.$location?`${ia(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${n}`}getName(n,e){return!this._nameIsCapturing||this._name===null||n===null||e===null?this._name:Le.replaceCaptures(this._name,n,e)}getContentName(n,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Le.replaceCaptures(this._contentName,n,e)}},Hi=class extends Se{retokenizeCapturedWithRuleId;constructor(n,e,t,a,i){super(n,e,t,a),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(n,e){throw new Error("Not supported!")}compile(n,e){throw new Error("Not supported!")}compileAG(n,e,t,a){throw new Error("Not supported!")}},Xi=class extends Se{_match;captures;_cachedCompiledPatterns;constructor(n,e,t,a,i){super(n,e,t,null),this._match=new Ee(a,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(n,e){e.push(this._match)}compile(n,e){return this._getCachedCompiledPatterns(n).compile(n)}compileAG(n,e,t,a){return this._getCachedCompiledPatterns(n).compileAG(n,t,a)}_getCachedCompiledPatterns(n){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new qe,this.collectPatterns(n,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},ft=class extends Se{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(n,e,t,a,i){super(n,e,t,a),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(n,e){for(const t of this.patterns)n.getRule(t).collectPatterns(n,e)}compile(n,e){return this._getCachedCompiledPatterns(n).compile(n)}compileAG(n,e,t,a){return this._getCachedCompiledPatterns(n).compileAG(n,t,a)}_getCachedCompiledPatterns(n){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new qe,this.collectPatterns(n,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Sn=class extends Se{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(n,e,t,a,i,r,s,o,c,p){super(n,e,t,a),this._begin=new Ee(i,this.id),this.beginCaptures=r,this._end=new Ee(s||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=o,this.applyEndPatternLast=c||!1,this.patterns=p.patterns,this.hasMissingPatterns=p.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(n,e){return this._end.resolveBackReferences(n,e)}collectPatterns(n,e){e.push(this._begin)}compile(n,e){return this._getCachedCompiledPatterns(n,e).compile(n)}compileAG(n,e,t,a){return this._getCachedCompiledPatterns(n,e).compileAG(n,t,a)}_getCachedCompiledPatterns(n,e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new qe;for(const t of this.patterns)n.getRule(t).collectPatterns(n,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,e):this._cachedCompiledPatterns.setSource(0,e)),this._cachedCompiledPatterns}},Ke=class extends Se{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(n,e,t,a,i,r,s,o,c){super(n,e,t,a),this._begin=new Ee(i,this.id),this.beginCaptures=r,this.whileCaptures=o,this._while=new Ee(s,da),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(n,e){return this._while.resolveBackReferences(n,e)}collectPatterns(n,e){e.push(this._begin)}compile(n,e){return this._getCachedCompiledPatterns(n).compile(n)}compileAG(n,e,t,a){return this._getCachedCompiledPatterns(n).compileAG(n,t,a)}_getCachedCompiledPatterns(n){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new qe;for(const e of this.patterns)n.getRule(e).collectPatterns(n,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(n,e){return this._getCachedCompiledWhilePatterns(n,e).compile(n)}compileWhileAG(n,e,t,a){return this._getCachedCompiledWhilePatterns(n,e).compileAG(n,t,a)}_getCachedCompiledWhilePatterns(n,e){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new qe,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,e||"￿"),this._cachedCompiledWhilePatterns}},ba=class T{static createCaptureRule(e,t,a,i,r){return e.registerRule(s=>new Hi(t,s,a,i,r))}static getCompiledRuleId(e,t,a){return e.id||t.registerRule(i=>{if(e.id=i,e.match)return new Xi(e.$vscodeTextmateLocation,e.id,e.name,e.match,T._compileCaptures(e.captures,t,a));if(typeof e.begin>"u"){e.repository&&(a=aa({},a,e.repository));let r=e.patterns;return typeof r>"u"&&e.include&&(r=[{include:e.include}]),new ft(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,T._compilePatterns(r,t,a))}return e.while?new Ke(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,T._compileCaptures(e.beginCaptures||e.captures,t,a),e.while,T._compileCaptures(e.whileCaptures||e.captures,t,a),T._compilePatterns(e.patterns,t,a)):new Sn(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,T._compileCaptures(e.beginCaptures||e.captures,t,a),e.end,T._compileCaptures(e.endCaptures||e.captures,t,a),e.applyEndPatternLast,T._compilePatterns(e.patterns,t,a))}),e.id}static _compileCaptures(e,t,a){let i=[];if(e){let r=0;for(const s in e){if(s==="$vscodeTextmateLocation")continue;const o=parseInt(s,10);o>r&&(r=o)}for(let s=0;s<=r;s++)i[s]=null;for(const s in e){if(s==="$vscodeTextmateLocation")continue;const o=parseInt(s,10);let c=0;e[s].patterns&&(c=T.getCompiledRuleId(e[s],t,a)),i[o]=T.createCaptureRule(t,e[s].$vscodeTextmateLocation,e[s].name,e[s].contentName,c)}}return i}static _compilePatterns(e,t,a){let i=[];if(e)for(let r=0,s=e.length;r<s;r++){const o=e[r];let c=-1;if(o.include){const p=ua(o.include);switch(p.kind){case 0:case 1:c=T.getCompiledRuleId(a[o.include],t,a);break;case 2:let l=a[p.ruleName];l&&(c=T.getCompiledRuleId(l,t,a));break;case 3:case 4:const m=p.scopeName,u=p.kind===4?p.ruleName:null,b=t.getExternalGrammar(m,a);if(b)if(u){let d=b.repository[u];d&&(c=T.getCompiledRuleId(d,t,b.repository))}else c=T.getCompiledRuleId(b.repository.$self,t,b.repository);break}}else c=T.getCompiledRuleId(o,t,a);if(c!==-1){const p=t.getRule(c);let l=!1;if((p instanceof ft||p instanceof Sn||p instanceof Ke)&&p.hasMissingPatterns&&p.patterns.length===0&&(l=!0),l)continue;i.push(c)}}return{patterns:i,hasMissingPatterns:(e?e.length:0)!==i.length}}},Ee=class ga{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&typeof e=="string"){const a=e.length;let i=0,r=[],s=!1;for(let o=0;o<a;o++)if(e.charAt(o)==="\\"&&o+1<a){const p=e.charAt(o+1);p==="z"?(r.push(e.substring(i,o)),r.push("$(?!\\n)(?<!\\n)"),i=o+2):(p==="A"||p==="G")&&(s=!0),o++}this.hasAnchor=s,i===0?this.source=e:(r.push(e.substring(i,a)),this.source=r.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=t,typeof this.source=="string"?this.hasBackReferences=Di.test(this.source):this.hasBackReferences=!1}clone(){return new ga(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let a=t.map(i=>e.substring(i.start,i.end));return ht.lastIndex=0,this.source.replace(ht,(i,r)=>oa(a[parseInt(r,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let e=[],t=[],a=[],i=[],r,s,o,c;for(r=0,s=this.source.length;r<s;r++)o=this.source.charAt(r),e[r]=o,t[r]=o,a[r]=o,i[r]=o,o==="\\"&&r+1<s&&(c=this.source.charAt(r+1),c==="A"?(e[r+1]="￿",t[r+1]="￿",a[r+1]="A",i[r+1]="A"):c==="G"?(e[r+1]="￿",t[r+1]="G",a[r+1]="￿",i[r+1]="G"):(e[r+1]=c,t[r+1]=c,a[r+1]=c,i[r+1]=c),r++);return{A0_G0:e.join(""),A0_G1:t.join(""),A1_G0:a.join(""),A1_G1:i.join("")}}resolveAnchors(e,t){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},qe=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(n){this._items.push(n),this._hasAnchors=this._hasAnchors||n.hasAnchor}unshift(n){this._items.unshift(n),this._hasAnchors=this._hasAnchors||n.hasAnchor}length(){return this._items.length}setSource(n,e){this._items[n].source!==e&&(this._disposeCaches(),this._items[n].setSource(e))}compile(n){if(!this._cached){let e=this._items.map(t=>t.source);this._cached=new yt(n,e,this._items.map(t=>t.ruleId))}return this._cached}compileAG(n,e,t){return this._hasAnchors?e?t?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(n,e,t)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(n,e,t)),this._anchorCache.A1_G0):t?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(n,e,t)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(n,e,t)),this._anchorCache.A0_G0):this.compile(n)}_resolveAnchors(n,e,t){let a=this._items.map(i=>i.resolveAnchors(e,t));return new yt(n,a,this._items.map(i=>i.ruleId))}},yt=class{constructor(n,e,t){this.regExps=e,this.rules=t,this.scanner=n.createOnigScanner(e)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const n=[];for(let e=0,t=this.rules.length;e<t;e++)n.push(" - "+this.rules[e]+": "+this.regExps[e]);return n.join(`
1
+ import{r as H,j as K}from"./main-DrVY5UJU.js";import{B as yi,H as ki,X as wi,x as xi,c as Ue}from"./button-CuH8u1uR.js";import{c as $i}from"./react-CzqI3gbN.js";let S=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function vi(n){return Yn(n)}function Yn(n){return Array.isArray(n)?Ci(n):n instanceof RegExp?n:typeof n=="object"?ji(n):n}function Ci(n){let e=[];for(let t=0,a=n.length;t<a;t++)e[t]=Yn(n[t]);return e}function ji(n){let e={};for(let t in n)e[t]=Yn(n[t]);return e}function aa(n,...e){return e.forEach(t=>{for(let a in t)n[a]=t[a]}),n}function ia(n){const e=~n.lastIndexOf("/")||~n.lastIndexOf("\\");return e===0?n:~e===n.length-1?ia(n.substring(0,n.length-1)):n.substr(~e+1)}var bn=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Le=class{static hasCaptures(n){return n===null?!1:(bn.lastIndex=0,bn.test(n))}static replaceCaptures(n,e,t){return n.replace(bn,(a,i,r,s)=>{let o=t[parseInt(i||r,10)];if(o){let c=e.substring(o.start,o.end);for(;c[0]===".";)c=c.substring(1);switch(s){case"downcase":return c.toLowerCase();case"upcase":return c.toUpperCase();default:return c}}else return a})}};function ra(n,e){return n<e?-1:n>e?1:0}function sa(n,e){if(n===null&&e===null)return 0;if(!n)return-1;if(!e)return 1;let t=n.length,a=e.length;if(t===a){for(let i=0;i<t;i++){let r=ra(n[i],e[i]);if(r!==0)return r}return 0}return t-a}function gt(n){return!!(/^#[0-9a-f]{6}$/i.test(n)||/^#[0-9a-f]{8}$/i.test(n)||/^#[0-9a-f]{3}$/i.test(n)||/^#[0-9a-f]{4}$/i.test(n))}function oa(n){return n.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var ca=class{constructor(n){this.fn=n}cache=new Map;get(n){if(this.cache.has(n))return this.cache.get(n);const e=this.fn(n);return this.cache.set(n,e),e}},Xe=class{constructor(n,e,t){this._colorMap=n,this._defaults=e,this._root=t}static createFromRawTheme(n,e){return this.createFromParsedTheme(qi(n),e)}static createFromParsedTheme(n,e){return zi(n,e)}_cachedMatchRoot=new ca(n=>this._root.match(n));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(n){if(n===null)return this._defaults;const e=n.scopeName,a=this._cachedMatchRoot.get(e).find(i=>Ai(n.parent,i.parentScopes));return a?new pa(a.fontStyle,a.foreground,a.background):null}},gn=class De{constructor(e,t){this.parent=e,this.scopeName=t}static push(e,t){for(const a of t)e=new De(e,a);return e}static from(...e){let t=null;for(let a=0;a<e.length;a++)t=new De(t,e[a]);return t}push(e){return new De(this,e)}getSegments(){let e=this;const t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(" ")}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){const t=[];let a=this;for(;a&&a!==e;)t.push(a.scopeName),a=a.parent;return a===e?t.reverse():void 0}};function Ai(n,e){if(e.length===0)return!0;for(let t=0;t<e.length;t++){let a=e[t],i=!1;if(a===">"){if(t===e.length-1)return!1;a=e[++t],i=!0}for(;n&&!Ei(n.scopeName,a);){if(i)return!1;n=n.parent}if(!n)return!1;n=n.parent}return!0}function Ei(n,e){return e===n||n.startsWith(e)&&n[e.length]==="."}var pa=class{constructor(n,e,t){this.fontStyle=n,this.foregroundId=e,this.backgroundId=t}};function qi(n){if(!n)return[];if(!n.settings||!Array.isArray(n.settings))return[];let e=n.settings,t=[],a=0;for(let i=0,r=e.length;i<r;i++){let s=e[i];if(!s.settings)continue;let o;if(typeof s.scope=="string"){let m=s.scope;m=m.replace(/^[,]+/,""),m=m.replace(/[,]+$/,""),o=m.split(",")}else Array.isArray(s.scope)?o=s.scope:o=[""];let c=-1;if(typeof s.settings.fontStyle=="string"){c=0;let m=s.settings.fontStyle.split(" ");for(let u=0,b=m.length;u<b;u++)switch(m[u]){case"italic":c=c|1;break;case"bold":c=c|2;break;case"underline":c=c|4;break;case"strikethrough":c=c|8;break}}let p=null;typeof s.settings.foreground=="string"&&gt(s.settings.foreground)&&(p=s.settings.foreground);let l=null;typeof s.settings.background=="string"&&gt(s.settings.background)&&(l=s.settings.background);for(let m=0,u=o.length;m<u;m++){let d=o[m].trim().split(" "),y=d[d.length-1],g=null;d.length>1&&(g=d.slice(0,d.length-1),g.reverse()),t[a++]=new Fi(y,g,i,c,p,l)}}return t}var Fi=class{constructor(n,e,t,a,i,r){this.scope=n,this.parentScopes=e,this.index=t,this.fontStyle=a,this.foreground=i,this.background=r}},Z=(n=>(n[n.NotSet=-1]="NotSet",n[n.None=0]="None",n[n.Italic=1]="Italic",n[n.Bold=2]="Bold",n[n.Underline=4]="Underline",n[n.Strikethrough=8]="Strikethrough",n))(Z||{});function zi(n,e){n.sort((c,p)=>{let l=ra(c.scope,p.scope);return l!==0||(l=sa(c.parentScopes,p.parentScopes),l!==0)?l:c.index-p.index});let t=0,a="#000000",i="#ffffff";for(;n.length>=1&&n[0].scope==="";){let c=n.shift();c.fontStyle!==-1&&(t=c.fontStyle),c.foreground!==null&&(a=c.foreground),c.background!==null&&(i=c.background)}let r=new Si(e),s=new pa(t,r.getId(a),r.getId(i)),o=new Ti(new qn(0,null,-1,0,0),[]);for(let c=0,p=n.length;c<p;c++){let l=n[c];o.insert(0,l.scope,l.parentScopes,l.fontStyle,r.getId(l.foreground),r.getId(l.background))}return new Xe(r,s,o)}var Si=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(n){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(n)){this._isFrozen=!0;for(let e=0,t=n.length;e<t;e++)this._color2id[n[e]]=e,this._id2color[e]=n[e]}else this._isFrozen=!1}getId(n){if(n===null)return 0;n=n.toUpperCase();let e=this._color2id[n];if(e)return e;if(this._isFrozen)throw new Error(`Missing color in color map - ${n}`);return e=++this._lastColorId,this._color2id[n]=e,this._id2color[e]=n,e}getColorMap(){return this._id2color.slice(0)}},Ni=Object.freeze([]),qn=class la{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,a,i,r){this.scopeDepth=e,this.parentScopes=t||Ni,this.fontStyle=a,this.foreground=i,this.background=r}clone(){return new la(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let a=0,i=e.length;a<i;a++)t[a]=e[a].clone();return t}acceptOverwrite(e,t,a,i){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),a!==0&&(this.foreground=a),i!==0&&(this.background=i)}},Ti=class Fn{constructor(e,t=[],a={}){this._mainRule=e,this._children=a,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let a=0,i=0;for(;e.parentScopes[a]===">"&&a++,t.parentScopes[i]===">"&&i++,!(a>=e.parentScopes.length||i>=t.parentScopes.length);){const r=t.parentScopes[i].length-e.parentScopes[a].length;if(r!==0)return r;a++,i++}return t.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let a=e.indexOf("."),i,r;if(a===-1?(i=e,r=""):(i=e.substring(0,a),r=e.substring(a+1)),this._children.hasOwnProperty(i))return this._children[i].match(r)}const t=this._rulesWithParentScopes.concat(this._mainRule);return t.sort(Fn._cmpBySpecificity),t}insert(e,t,a,i,r,s){if(t===""){this._doInsertHere(e,a,i,r,s);return}let o=t.indexOf("."),c,p;o===-1?(c=t,p=""):(c=t.substring(0,o),p=t.substring(o+1));let l;this._children.hasOwnProperty(c)?l=this._children[c]:(l=new Fn(this._mainRule.clone(),qn.cloneArr(this._rulesWithParentScopes)),this._children[c]=l),l.insert(e+1,p,a,i,r,s)}_doInsertHere(e,t,a,i,r){if(t===null){this._mainRule.acceptOverwrite(e,a,i,r);return}for(let s=0,o=this._rulesWithParentScopes.length;s<o;s++){let c=this._rulesWithParentScopes[s];if(sa(c.parentScopes,t)===0){c.acceptOverwrite(e,a,i,r);return}}a===-1&&(a=this._mainRule.fontStyle),i===0&&(i=this._mainRule.foreground),r===0&&(r=this._mainRule.background),this._rulesWithParentScopes.push(new qn(e,t,a,i,r))}},_e=class U{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const t=U.getLanguageId(e),a=U.getTokenType(e),i=U.getFontStyle(e),r=U.getForeground(e),s=U.getBackground(e);console.log({languageId:t,tokenType:a,fontStyle:i,foreground:r,background:s})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(e,t,a,i,r,s,o){let c=U.getLanguageId(e),p=U.getTokenType(e),l=U.containsBalancedBrackets(e)?1:0,m=U.getFontStyle(e),u=U.getForeground(e),b=U.getBackground(e);return t!==0&&(c=t),a!==8&&(p=a),i!==null&&(l=i?1:0),r!==-1&&(m=r),s!==0&&(u=s),o!==0&&(b=o),(c<<0|p<<8|l<<10|m<<11|u<<15|b<<24)>>>0}};function Ve(n,e){const t=[],a=Zi(n);let i=a.next();for(;i!==null;){let c=0;if(i.length===2&&i.charAt(1)===":"){switch(i.charAt(0)){case"R":c=1;break;case"L":c=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=a.next()}let p=s();if(t.push({matcher:p,priority:c}),i!==",")break;i=a.next()}return t;function r(){if(i==="-"){i=a.next();const c=r();return p=>!!c&&!c(p)}if(i==="("){i=a.next();const c=o();return i===")"&&(i=a.next()),c}if(_t(i)){const c=[];do c.push(i),i=a.next();while(_t(i));return p=>e(c,p)}return null}function s(){const c=[];let p=r();for(;p;)c.push(p),p=r();return l=>c.every(m=>m(l))}function o(){const c=[];let p=s();for(;p&&(c.push(p),i==="|"||i===",");){do i=a.next();while(i==="|"||i===",");p=s()}return l=>c.some(m=>m(l))}}function _t(n){return!!n&&!!n.match(/[\w\.:]+/)}function Zi(n){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,t=e.exec(n);return{next:()=>{if(!t)return null;const a=t[0];return t=e.exec(n),a}}}function ma(n){typeof n.dispose=="function"&&n.dispose()}var Ae=class{constructor(n){this.scopeName=n}toKey(){return this.scopeName}},Ii=class{constructor(n,e){this.scopeName=n,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},Ri=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(n){const e=n.toKey();this._seenReferenceKeys.has(e)||(this._seenReferenceKeys.add(e),this._references.push(n))}},Ui=class{constructor(n,e){this.repo=n,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Ae(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const n=this.Q;this.Q=[];const e=new Ri;for(const t of n)Li(t,this.initialScopeName,this.repo,e);for(const t of e.references)if(t instanceof Ae){if(this.seenFullScopeRequests.has(t.scopeName))continue;this.seenFullScopeRequests.add(t.scopeName),this.Q.push(t)}else{if(this.seenFullScopeRequests.has(t.scopeName)||this.seenPartialScopeRequests.has(t.toKey()))continue;this.seenPartialScopeRequests.add(t.toKey()),this.Q.push(t)}}};function Li(n,e,t,a){const i=t.lookup(n.scopeName);if(!i){if(n.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const r=t.lookup(e);n instanceof Ae?Be({baseGrammar:r,selfGrammar:i},a):zn(n.ruleName,{baseGrammar:r,selfGrammar:i,repository:i.repository},a);const s=t.injections(n.scopeName);if(s)for(const o of s)a.add(new Ae(o))}function zn(n,e,t){if(e.repository&&e.repository[n]){const a=e.repository[n];Ye([a],e,t)}}function Be(n,e){n.selfGrammar.patterns&&Array.isArray(n.selfGrammar.patterns)&&Ye(n.selfGrammar.patterns,{...n,repository:n.selfGrammar.repository},e),n.selfGrammar.injections&&Ye(Object.values(n.selfGrammar.injections),{...n,repository:n.selfGrammar.repository},e)}function Ye(n,e,t){for(const a of n){if(t.visitedRule.has(a))continue;t.visitedRule.add(a);const i=a.repository?aa({},e.repository,a.repository):e.repository;Array.isArray(a.patterns)&&Ye(a.patterns,{...e,repository:i},t);const r=a.include;if(!r)continue;const s=ua(r);switch(s.kind){case 0:Be({...e,selfGrammar:e.baseGrammar},t);break;case 1:Be(e,t);break;case 2:zn(s.ruleName,{...e,repository:i},t);break;case 3:case 4:const o=s.scopeName===e.selfGrammar.scopeName?e.selfGrammar:s.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(o){const c={baseGrammar:e.baseGrammar,selfGrammar:o,repository:i};s.kind===4?zn(s.ruleName,c,t):Be(c,t)}else s.kind===4?t.add(new Ii(s.scopeName,s.ruleName)):t.add(new Ae(s.scopeName));break}}}var Wi=class{kind=0},Oi=class{kind=1},Pi=class{constructor(n){this.ruleName=n}kind=2},Gi=class{constructor(n){this.scopeName=n}kind=3},Mi=class{constructor(n,e){this.scopeName=n,this.ruleName=e}kind=4};function ua(n){if(n==="$base")return new Wi;if(n==="$self")return new Oi;const e=n.indexOf("#");if(e===-1)return new Gi(n);if(e===0)return new Pi(n.substring(1));{const t=n.substring(0,e),a=n.substring(e+1);return new Mi(t,a)}}var Di=/\\(\d+)/,ht=/\\(\d+)/g,Bi=-1,da=-2;var Se=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(n,e,t,a){this.$location=n,this.id=e,this._name=t||null,this._nameIsCapturing=Le.hasCaptures(this._name),this._contentName=a||null,this._contentNameIsCapturing=Le.hasCaptures(this._contentName)}get debugName(){const n=this.$location?`${ia(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${n}`}getName(n,e){return!this._nameIsCapturing||this._name===null||n===null||e===null?this._name:Le.replaceCaptures(this._name,n,e)}getContentName(n,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Le.replaceCaptures(this._contentName,n,e)}},Hi=class extends Se{retokenizeCapturedWithRuleId;constructor(n,e,t,a,i){super(n,e,t,a),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(n,e){throw new Error("Not supported!")}compile(n,e){throw new Error("Not supported!")}compileAG(n,e,t,a){throw new Error("Not supported!")}},Xi=class extends Se{_match;captures;_cachedCompiledPatterns;constructor(n,e,t,a,i){super(n,e,t,null),this._match=new Ee(a,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(n,e){e.push(this._match)}compile(n,e){return this._getCachedCompiledPatterns(n).compile(n)}compileAG(n,e,t,a){return this._getCachedCompiledPatterns(n).compileAG(n,t,a)}_getCachedCompiledPatterns(n){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new qe,this.collectPatterns(n,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},ft=class extends Se{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(n,e,t,a,i){super(n,e,t,a),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(n,e){for(const t of this.patterns)n.getRule(t).collectPatterns(n,e)}compile(n,e){return this._getCachedCompiledPatterns(n).compile(n)}compileAG(n,e,t,a){return this._getCachedCompiledPatterns(n).compileAG(n,t,a)}_getCachedCompiledPatterns(n){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new qe,this.collectPatterns(n,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Sn=class extends Se{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(n,e,t,a,i,r,s,o,c,p){super(n,e,t,a),this._begin=new Ee(i,this.id),this.beginCaptures=r,this._end=new Ee(s||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=o,this.applyEndPatternLast=c||!1,this.patterns=p.patterns,this.hasMissingPatterns=p.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(n,e){return this._end.resolveBackReferences(n,e)}collectPatterns(n,e){e.push(this._begin)}compile(n,e){return this._getCachedCompiledPatterns(n,e).compile(n)}compileAG(n,e,t,a){return this._getCachedCompiledPatterns(n,e).compileAG(n,t,a)}_getCachedCompiledPatterns(n,e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new qe;for(const t of this.patterns)n.getRule(t).collectPatterns(n,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,e):this._cachedCompiledPatterns.setSource(0,e)),this._cachedCompiledPatterns}},Ke=class extends Se{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(n,e,t,a,i,r,s,o,c){super(n,e,t,a),this._begin=new Ee(i,this.id),this.beginCaptures=r,this.whileCaptures=o,this._while=new Ee(s,da),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(n,e){return this._while.resolveBackReferences(n,e)}collectPatterns(n,e){e.push(this._begin)}compile(n,e){return this._getCachedCompiledPatterns(n).compile(n)}compileAG(n,e,t,a){return this._getCachedCompiledPatterns(n).compileAG(n,t,a)}_getCachedCompiledPatterns(n){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new qe;for(const e of this.patterns)n.getRule(e).collectPatterns(n,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(n,e){return this._getCachedCompiledWhilePatterns(n,e).compile(n)}compileWhileAG(n,e,t,a){return this._getCachedCompiledWhilePatterns(n,e).compileAG(n,t,a)}_getCachedCompiledWhilePatterns(n,e){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new qe,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,e||"￿"),this._cachedCompiledWhilePatterns}},ba=class T{static createCaptureRule(e,t,a,i,r){return e.registerRule(s=>new Hi(t,s,a,i,r))}static getCompiledRuleId(e,t,a){return e.id||t.registerRule(i=>{if(e.id=i,e.match)return new Xi(e.$vscodeTextmateLocation,e.id,e.name,e.match,T._compileCaptures(e.captures,t,a));if(typeof e.begin>"u"){e.repository&&(a=aa({},a,e.repository));let r=e.patterns;return typeof r>"u"&&e.include&&(r=[{include:e.include}]),new ft(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,T._compilePatterns(r,t,a))}return e.while?new Ke(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,T._compileCaptures(e.beginCaptures||e.captures,t,a),e.while,T._compileCaptures(e.whileCaptures||e.captures,t,a),T._compilePatterns(e.patterns,t,a)):new Sn(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,T._compileCaptures(e.beginCaptures||e.captures,t,a),e.end,T._compileCaptures(e.endCaptures||e.captures,t,a),e.applyEndPatternLast,T._compilePatterns(e.patterns,t,a))}),e.id}static _compileCaptures(e,t,a){let i=[];if(e){let r=0;for(const s in e){if(s==="$vscodeTextmateLocation")continue;const o=parseInt(s,10);o>r&&(r=o)}for(let s=0;s<=r;s++)i[s]=null;for(const s in e){if(s==="$vscodeTextmateLocation")continue;const o=parseInt(s,10);let c=0;e[s].patterns&&(c=T.getCompiledRuleId(e[s],t,a)),i[o]=T.createCaptureRule(t,e[s].$vscodeTextmateLocation,e[s].name,e[s].contentName,c)}}return i}static _compilePatterns(e,t,a){let i=[];if(e)for(let r=0,s=e.length;r<s;r++){const o=e[r];let c=-1;if(o.include){const p=ua(o.include);switch(p.kind){case 0:case 1:c=T.getCompiledRuleId(a[o.include],t,a);break;case 2:let l=a[p.ruleName];l&&(c=T.getCompiledRuleId(l,t,a));break;case 3:case 4:const m=p.scopeName,u=p.kind===4?p.ruleName:null,b=t.getExternalGrammar(m,a);if(b)if(u){let d=b.repository[u];d&&(c=T.getCompiledRuleId(d,t,b.repository))}else c=T.getCompiledRuleId(b.repository.$self,t,b.repository);break}}else c=T.getCompiledRuleId(o,t,a);if(c!==-1){const p=t.getRule(c);let l=!1;if((p instanceof ft||p instanceof Sn||p instanceof Ke)&&p.hasMissingPatterns&&p.patterns.length===0&&(l=!0),l)continue;i.push(c)}}return{patterns:i,hasMissingPatterns:(e?e.length:0)!==i.length}}},Ee=class ga{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&typeof e=="string"){const a=e.length;let i=0,r=[],s=!1;for(let o=0;o<a;o++)if(e.charAt(o)==="\\"&&o+1<a){const p=e.charAt(o+1);p==="z"?(r.push(e.substring(i,o)),r.push("$(?!\\n)(?<!\\n)"),i=o+2):(p==="A"||p==="G")&&(s=!0),o++}this.hasAnchor=s,i===0?this.source=e:(r.push(e.substring(i,a)),this.source=r.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=t,typeof this.source=="string"?this.hasBackReferences=Di.test(this.source):this.hasBackReferences=!1}clone(){return new ga(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let a=t.map(i=>e.substring(i.start,i.end));return ht.lastIndex=0,this.source.replace(ht,(i,r)=>oa(a[parseInt(r,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let e=[],t=[],a=[],i=[],r,s,o,c;for(r=0,s=this.source.length;r<s;r++)o=this.source.charAt(r),e[r]=o,t[r]=o,a[r]=o,i[r]=o,o==="\\"&&r+1<s&&(c=this.source.charAt(r+1),c==="A"?(e[r+1]="￿",t[r+1]="￿",a[r+1]="A",i[r+1]="A"):c==="G"?(e[r+1]="￿",t[r+1]="G",a[r+1]="￿",i[r+1]="G"):(e[r+1]=c,t[r+1]=c,a[r+1]=c,i[r+1]=c),r++);return{A0_G0:e.join(""),A0_G1:t.join(""),A1_G0:a.join(""),A1_G1:i.join("")}}resolveAnchors(e,t){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},qe=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(n){this._items.push(n),this._hasAnchors=this._hasAnchors||n.hasAnchor}unshift(n){this._items.unshift(n),this._hasAnchors=this._hasAnchors||n.hasAnchor}length(){return this._items.length}setSource(n,e){this._items[n].source!==e&&(this._disposeCaches(),this._items[n].setSource(e))}compile(n){if(!this._cached){let e=this._items.map(t=>t.source);this._cached=new yt(n,e,this._items.map(t=>t.ruleId))}return this._cached}compileAG(n,e,t){return this._hasAnchors?e?t?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(n,e,t)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(n,e,t)),this._anchorCache.A1_G0):t?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(n,e,t)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(n,e,t)),this._anchorCache.A0_G0):this.compile(n)}_resolveAnchors(n,e,t){let a=this._items.map(i=>i.resolveAnchors(e,t));return new yt(n,a,this._items.map(i=>i.ruleId))}},yt=class{constructor(n,e,t){this.regExps=e,this.rules=t,this.scanner=n.createOnigScanner(e)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const n=[];for(let e=0,t=this.rules.length;e<t;e++)n.push(" - "+this.rules[e]+": "+this.regExps[e]);return n.join(`
2
2
  `)}findNextMatchSync(n,e,t){const a=this.scanner.findNextMatchSync(n,e,t);return a?{ruleId:this.rules[a.index],captureIndices:a.captureIndices}:null}},_n=class{constructor(n,e){this.languageId=n,this.tokenType=e}},Vi=class Nn{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new _n(e,8),this._embeddedLanguagesMatcher=new Yi(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(e){return e===null?Nn._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(e)}static _NULL_SCOPE_METADATA=new _n(0,0);_getBasicScopeAttributes=new ca(e=>{const t=this._scopeToLanguage(e),a=this._toStandardTokenType(e);return new _n(t,a)});_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(e){const t=e.match(Nn.STANDARD_TOKEN_TYPE_REGEXP);if(!t)return 8;switch(t[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},Yi=class{values;scopesRegExp;constructor(n){if(n.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(n);const e=n.map(([t,a])=>oa(t));e.sort(),e.reverse(),this.scopesRegExp=new RegExp(`^((${e.join(")|(")}))($|\\.)`,"")}}match(n){if(!this.scopesRegExp)return;const e=n.match(this.scopesRegExp);if(e)return this.values.get(e[1])}},kt=class{constructor(n,e){this.stack=n,this.stoppedEarly=e}};function _a(n,e,t,a,i,r,s,o){const c=e.content.length;let p=!1,l=-1;if(s){const b=Ki(n,e,t,a,i,r);i=b.stack,a=b.linePos,t=b.isFirstLine,l=b.anchorPosition}const m=Date.now();for(;!p;){if(o!==0&&Date.now()-m>o)return new kt(i,!0);u()}return new kt(i,!1);function u(){const b=Ji(n,e,t,a,i,l);if(!b){r.produce(i,c),p=!0;return}const d=b.captureIndices,y=b.matchedRuleId,g=d&&d.length>0?d[0].end>a:!1;if(y===Bi){const _=i.getRule(n);r.produce(i,d[0].start),i=i.withContentNameScopesList(i.nameScopesList),ve(n,e,t,i,r,_.endCaptures,d),r.produce(i,d[0].end);const k=i;if(i=i.parent,l=k.getAnchorPos(),!g&&k.getEnterPos()===a){i=k,r.produce(i,c),p=!0;return}}else{const _=n.getRule(y);r.produce(i,d[0].start);const k=i,f=_.getName(e.content,d),w=i.contentNameScopesList.pushAttributed(f,n);if(i=i.push(y,a,l,d[0].end===c,null,w,w),_ instanceof Sn){const x=_;ve(n,e,t,i,r,x.beginCaptures,d),r.produce(i,d[0].end),l=d[0].end;const j=x.getContentName(e.content,d),z=w.pushAttributed(j,n);if(i=i.withContentNameScopesList(z),x.endHasBackReferences&&(i=i.withEndRule(x.getEndWithResolvedBackReferences(e.content,d))),!g&&k.hasSameRuleAs(i)){i=i.pop(),r.produce(i,c),p=!0;return}}else if(_ instanceof Ke){const x=_;ve(n,e,t,i,r,x.beginCaptures,d),r.produce(i,d[0].end),l=d[0].end;const j=x.getContentName(e.content,d),z=w.pushAttributed(j,n);if(i=i.withContentNameScopesList(z),x.whileHasBackReferences&&(i=i.withEndRule(x.getWhileWithResolvedBackReferences(e.content,d))),!g&&k.hasSameRuleAs(i)){i=i.pop(),r.produce(i,c),p=!0;return}}else if(ve(n,e,t,i,r,_.captures,d),r.produce(i,d[0].end),i=i.pop(),!g){i=i.safePop(),r.produce(i,c),p=!0;return}}d[0].end>a&&(a=d[0].end,t=!1)}}function Ki(n,e,t,a,i,r){let s=i.beginRuleCapturedEOL?0:-1;const o=[];for(let c=i;c;c=c.pop()){const p=c.getRule(n);p instanceof Ke&&o.push({rule:p,stack:c})}for(let c=o.pop();c;c=o.pop()){const{ruleScanner:p,findOptions:l}=nr(c.rule,n,c.stack.endRule,t,a===s),m=p.findNextMatchSync(e,a,l);if(m){if(m.ruleId!==da){i=c.stack.pop();break}m.captureIndices&&m.captureIndices.length&&(r.produce(c.stack,m.captureIndices[0].start),ve(n,e,t,c.stack,r,c.rule.whileCaptures,m.captureIndices),r.produce(c.stack,m.captureIndices[0].end),s=m.captureIndices[0].end,m.captureIndices[0].end>a&&(a=m.captureIndices[0].end,t=!1))}else{i=c.stack.pop();break}}return{stack:i,linePos:a,anchorPosition:s,isFirstLine:t}}function Ji(n,e,t,a,i,r){const s=Qi(n,e,t,a,i,r),o=n.getInjections();if(o.length===0)return s;const c=er(o,n,e,t,a,i,r);if(!c)return s;if(!s)return c;const p=s.captureIndices[0].start,l=c.captureIndices[0].start;return l<p||c.priorityMatch&&l===p?c:s}function Qi(n,e,t,a,i,r){const s=i.getRule(n),{ruleScanner:o,findOptions:c}=ha(s,n,i.endRule,t,a===r),p=o.findNextMatchSync(e,a,c);return p?{captureIndices:p.captureIndices,matchedRuleId:p.ruleId}:null}function er(n,e,t,a,i,r,s){let o=Number.MAX_VALUE,c=null,p,l=0;const m=r.contentNameScopesList.getScopeNames();for(let u=0,b=n.length;u<b;u++){const d=n[u];if(!d.matcher(m))continue;const y=e.getRule(d.ruleId),{ruleScanner:g,findOptions:_}=ha(y,e,null,a,i===s),k=g.findNextMatchSync(t,i,_);if(!k)continue;const f=k.captureIndices[0].start;if(!(f>=o)&&(o=f,c=k.captureIndices,p=k.ruleId,l=d.priority,o===i))break}return c?{priorityMatch:l===-1,captureIndices:c,matchedRuleId:p}:null}function ha(n,e,t,a,i){return{ruleScanner:n.compileAG(e,t,a,i),findOptions:0}}function nr(n,e,t,a,i){return{ruleScanner:n.compileWhileAG(e,t,a,i),findOptions:0}}function ve(n,e,t,a,i,r,s){if(r.length===0)return;const o=e.content,c=Math.min(r.length,s.length),p=[],l=s[0].end;for(let m=0;m<c;m++){const u=r[m];if(u===null)continue;const b=s[m];if(b.length===0)continue;if(b.start>l)break;for(;p.length>0&&p[p.length-1].endPos<=b.start;)i.produceFromScopes(p[p.length-1].scopes,p[p.length-1].endPos),p.pop();if(p.length>0?i.produceFromScopes(p[p.length-1].scopes,b.start):i.produce(a,b.start),u.retokenizeCapturedWithRuleId){const y=u.getName(o,s),g=a.contentNameScopesList.pushAttributed(y,n),_=u.getContentName(o,s),k=g.pushAttributed(_,n),f=a.push(u.retokenizeCapturedWithRuleId,b.start,-1,!1,null,g,k),w=n.createOnigString(o.substring(0,b.end));_a(n,w,t&&b.start===0,b.start,f,i,!1,0),ma(w);continue}const d=u.getName(o,s);if(d!==null){const g=(p.length>0?p[p.length-1].scopes:a.contentNameScopesList).pushAttributed(d,n);p.push(new tr(g,b.end))}}for(;p.length>0;)i.produceFromScopes(p[p.length-1].scopes,p[p.length-1].endPos),p.pop()}var tr=class{scopes;endPos;constructor(n,e){this.scopes=n,this.endPos=e}};function ar(n,e,t,a,i,r,s,o){return new rr(n,e,t,a,i,r,s,o)}function wt(n,e,t,a,i){const r=Ve(e,Je),s=ba.getCompiledRuleId(t,a,i.repository);for(const o of r)n.push({debugSelector:e,matcher:o.matcher,ruleId:s,grammar:i,priority:o.priority})}function Je(n,e){if(e.length<n.length)return!1;let t=0;return n.every(a=>{for(let i=t;i<e.length;i++)if(ir(e[i],a))return t=i+1,!0;return!1})}function ir(n,e){if(!n)return!1;if(n===e)return!0;const t=e.length;return n.length>t&&n.substr(0,t)===e&&n[t]==="."}var rr=class{constructor(n,e,t,a,i,r,s,o){if(this._rootScopeName=n,this.balancedBracketSelectors=r,this._onigLib=o,this._basicScopeAttributesProvider=new Vi(t,a),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=s,this._grammar=xt(e,null),this._injections=null,this._tokenTypeMatchers=[],i)for(const c of Object.keys(i)){const p=Ve(c,Je);for(const l of p)this._tokenTypeMatchers.push({matcher:l.matcher,type:i[c]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(const n of this._ruleId2desc)n&&n.dispose()}createOnigScanner(n){return this._onigLib.createOnigScanner(n)}createOnigString(n){return this._onigLib.createOnigString(n)}getMetadataForScope(n){return this._basicScopeAttributesProvider.getBasicScopeAttributes(n)}_collectInjections(){const n={lookup:i=>i===this._rootScopeName?this._grammar:this.getExternalGrammar(i),injections:i=>this._grammarRepository.injections(i)},e=[],t=this._rootScopeName,a=n.lookup(t);if(a){const i=a.injections;if(i)for(let s in i)wt(e,s,i[s],this,a);const r=this._grammarRepository.injections(t);r&&r.forEach(s=>{const o=this.getExternalGrammar(s);if(o){const c=o.injectionSelector;c&&wt(e,c,o,this,o)}})}return e.sort((i,r)=>i.priority-r.priority),e}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(n){const e=++this._lastRuleId,t=n(e);return this._ruleId2desc[e]=t,t}getRule(n){return this._ruleId2desc[n]}getExternalGrammar(n,e){if(this._includedGrammars[n])return this._includedGrammars[n];if(this._grammarRepository){const t=this._grammarRepository.lookup(n);if(t)return this._includedGrammars[n]=xt(t,e&&e.$base),this._includedGrammars[n]}}tokenizeLine(n,e,t=0){const a=this._tokenize(n,e,!1,t);return{tokens:a.lineTokens.getResult(a.ruleStack,a.lineLength),ruleStack:a.ruleStack,stoppedEarly:a.stoppedEarly}}tokenizeLine2(n,e,t=0){const a=this._tokenize(n,e,!0,t);return{tokens:a.lineTokens.getBinaryResult(a.ruleStack,a.lineLength),ruleStack:a.ruleStack,stoppedEarly:a.stoppedEarly}}_tokenize(n,e,t,a){this._rootId===-1&&(this._rootId=ba.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!e||e===Tn.NULL){i=!0;const p=this._basicScopeAttributesProvider.getDefaultAttributes(),l=this.themeProvider.getDefaults(),m=_e.set(0,p.languageId,p.tokenType,null,l.fontStyle,l.foregroundId,l.backgroundId),u=this.getRule(this._rootId).getName(null,null);let b;u?b=Ce.createRootAndLookUpScopeName(u,m,this):b=Ce.createRoot("unknown",m),e=new Tn(null,this._rootId,-1,-1,!1,null,b,b)}else i=!1,e.reset();n=n+`
3
3
  `;const r=this.createOnigString(n),s=r.content.length,o=new or(t,n,this._tokenTypeMatchers,this.balancedBracketSelectors),c=_a(this,r,i,0,e,o,!0,a);return ma(r),{lineLength:s,lineTokens:o,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function xt(n,e){return n=vi(n),n.repository=n.repository||{},n.repository.$self={$vscodeTextmateLocation:n.$vscodeTextmateLocation,patterns:n.patterns,name:n.scopeName},n.repository.$base=e||n.repository.$self,n}var Ce=class P{constructor(e,t,a){this.parent=e,this.scopePath=t,this.tokenAttributes=a}static fromExtension(e,t){let a=e,i=e?.scopePath??null;for(const r of t)i=gn.push(i,r.scopeNames),a=new P(a,i,r.encodedTokenAttributes);return a}static createRoot(e,t){return new P(null,new gn(null,e),t)}static createRootAndLookUpScopeName(e,t,a){const i=a.getMetadataForScope(e),r=new gn(null,e),s=a.themeProvider.themeMatch(r),o=P.mergeAttributes(t,i,s);return new P(null,r,o)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(e){return P.equals(this,e)}static equals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}while(!0)}static mergeAttributes(e,t,a){let i=-1,r=0,s=0;return a!==null&&(i=a.fontStyle,r=a.foregroundId,s=a.backgroundId),_e.set(e,t.languageId,t.tokenType,null,i,r,s)}pushAttributed(e,t){if(e===null)return this;if(e.indexOf(" ")===-1)return P._pushAttributed(this,e,t);const a=e.split(/ /g);let i=this;for(const r of a)i=P._pushAttributed(i,r,t);return i}static _pushAttributed(e,t,a){const i=a.getMetadataForScope(t),r=e.scopePath.push(t),s=a.themeProvider.themeMatch(r),o=P.mergeAttributes(e.tokenAttributes,i,s);return new P(e,r,o)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){const t=[];let a=this;for(;a&&a!==e;)t.push({encodedTokenAttributes:a.tokenAttributes,scopeNames:a.scopePath.getExtensionIfDefined(a.parent?.scopePath??null)}),a=a.parent;return a===e?t.reverse():void 0}},Tn=class te{constructor(e,t,a,i,r,s,o,c){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=r,this.endRule=s,this.nameScopesList=o,this.contentNameScopesList=c,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=a,this._anchorPos=i}_stackElementBrand=void 0;static NULL=new te(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(e){return e===null?!1:te._equals(this,e)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?Ce.equals(e.contentNameScopesList,t.contentNameScopesList):!1}static _structuralEquals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){te._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(e,t,a,i,r,s,o){return new te(this,e,t,a,i,r,s,o)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){const e=[];return this._writeString(e,0),"["+e.join(",")+"]"}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(e){return this.endRule===e?this:new te(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,e,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(e,t){const a=Ce.fromExtension(e?.nameScopesList??null,t.nameScopesList);return new te(e,t.ruleId,t.enterPos??-1,t.anchorPos??-1,t.beginRuleCapturedEOL,t.endRule,a,Ce.fromExtension(a,t.contentNameScopesList))}},sr=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(n,e){this.balancedBracketScopes=n.flatMap(t=>t==="*"?(this.allowAny=!0,[]):Ve(t,Je).map(a=>a.matcher)),this.unbalancedBracketScopes=e.flatMap(t=>Ve(t,Je).map(a=>a.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(n){for(const e of this.unbalancedBracketScopes)if(e(n))return!1;for(const e of this.balancedBracketScopes)if(e(n))return!0;return this.allowAny}},or=class{constructor(n,e,t,a){this.balancedBracketSelectors=a,this._emitBinaryTokens=n,this._tokenTypeOverrides=t,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(n,e){this.produceFromScopes(n.contentNameScopesList,e)}produceFromScopes(n,e){if(this._lastTokenEndIndex>=e)return;if(this._emitBinaryTokens){let a=n?.tokenAttributes??0,i=!1;if(this.balancedBracketSelectors?.matchesAlways&&(i=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const r=n?.getScopeNames()??[];for(const s of this._tokenTypeOverrides)s.matcher(r)&&(a=_e.set(a,0,s.type,null,-1,0,0));this.balancedBracketSelectors&&(i=this.balancedBracketSelectors.match(r))}if(i&&(a=_e.set(a,0,8,i,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===a){this._lastTokenEndIndex=e;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(a),this._lastTokenEndIndex=e;return}const t=n?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:e,scopes:t}),this._lastTokenEndIndex=e}getResult(n,e){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===e-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(n,e),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(n,e){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===e-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(n,e),this._binaryTokens[this._binaryTokens.length-2]=0);const t=new Uint32Array(this._binaryTokens.length);for(let a=0,i=this._binaryTokens.length;a<i;a++)t[a]=this._binaryTokens[a];return t}},cr=class{constructor(n,e){this._onigLib=e,this._theme=n}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(const n of this._grammars.values())n.dispose()}setTheme(n){this._theme=n}getColorMap(){return this._theme.getColorMap()}addGrammar(n,e){this._rawGrammars.set(n.scopeName,n),e&&this._injectionGrammars.set(n.scopeName,e)}lookup(n){return this._rawGrammars.get(n)}injections(n){return this._injectionGrammars.get(n)}getDefaults(){return this._theme.getDefaults()}themeMatch(n){return this._theme.match(n)}grammarForScopeName(n,e,t,a,i){if(!this._grammars.has(n)){let r=this._rawGrammars.get(n);if(!r)return null;this._grammars.set(n,ar(n,r,e,t,a,i,this,this._onigLib))}return this._grammars.get(n)}},pr=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new cr(Xe.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(Xe.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,a){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:a})}loadGrammarWithConfiguration(e,t,a){return this._loadGrammar(e,t,a.embeddedLanguages,a.tokenTypes,new sr(a.balancedBracketSelectors||[],a.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,a,i,r){const s=new Ui(this._syncRegistry,e);for(;s.Q.length>0;)s.Q.map(o=>this._loadSingleGrammar(o.scopeName)),s.processQueue();return this._grammarForScopeName(e,t,a,i,r)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){const t=this._options.loadGrammar(e);if(t){const a=typeof this._options.getInjections=="function"?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,a)}}addGrammar(e,t=[],a=0,i=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,a,i)}_grammarForScopeName(e,t=0,a=null,i=null,r=null){return this._syncRegistry.grammarForScopeName(e,t,a,i,r)}},Zn=Tn.NULL;const lr=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class Ne{constructor(e,t,a){this.normal=t,this.property=e,a&&(this.space=a)}}Ne.prototype.normal={};Ne.prototype.property={};Ne.prototype.space=void 0;function fa(n,e){const t={},a={};for(const i of n)Object.assign(t,i.property),Object.assign(a,i.normal);return new Ne(t,a,e)}function In(n){return n.toLowerCase()}class I{constructor(e,t){this.attribute=t,this.property=e}}I.prototype.attribute="";I.prototype.booleanish=!1;I.prototype.boolean=!1;I.prototype.commaOrSpaceSeparated=!1;I.prototype.commaSeparated=!1;I.prototype.defined=!1;I.prototype.mustUseProperty=!1;I.prototype.number=!1;I.prototype.overloadedBoolean=!1;I.prototype.property="";I.prototype.spaceSeparated=!1;I.prototype.space=void 0;let mr=0;const v=oe(),E=oe(),Rn=oe(),h=oe(),C=oe(),be=oe(),R=oe();function oe(){return 2**++mr}const Un=Object.freeze(Object.defineProperty({__proto__:null,boolean:v,booleanish:E,commaOrSpaceSeparated:R,commaSeparated:be,number:h,overloadedBoolean:Rn,spaceSeparated:C},Symbol.toStringTag,{value:"Module"})),hn=Object.keys(Un);class Kn extends I{constructor(e,t,a,i){let r=-1;if(super(e,t),$t(this,"space",i),typeof a=="number")for(;++r<hn.length;){const s=hn[r];$t(this,hn[r],(a&Un[s])===Un[s])}}}Kn.prototype.defined=!0;function $t(n,e,t){t&&(n[e]=t)}function he(n){const e={},t={};for(const[a,i]of Object.entries(n.properties)){const r=new Kn(a,n.transform(n.attributes||{},a),i,n.space);n.mustUseProperty&&n.mustUseProperty.includes(a)&&(r.mustUseProperty=!0),e[a]=r,t[In(a)]=a,t[In(r.attribute)]=a}return new Ne(e,t,n.space)}const ya=he({properties:{ariaActiveDescendant:null,ariaAtomic:E,ariaAutoComplete:null,ariaBusy:E,ariaChecked:E,ariaColCount:h,ariaColIndex:h,ariaColSpan:h,ariaControls:C,ariaCurrent:null,ariaDescribedBy:C,ariaDetails:null,ariaDisabled:E,ariaDropEffect:C,ariaErrorMessage:null,ariaExpanded:E,ariaFlowTo:C,ariaGrabbed:E,ariaHasPopup:null,ariaHidden:E,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:C,ariaLevel:h,ariaLive:null,ariaModal:E,ariaMultiLine:E,ariaMultiSelectable:E,ariaOrientation:null,ariaOwns:C,ariaPlaceholder:null,ariaPosInSet:h,ariaPressed:E,ariaReadOnly:E,ariaRelevant:null,ariaRequired:E,ariaRoleDescription:C,ariaRowCount:h,ariaRowIndex:h,ariaRowSpan:h,ariaSelected:E,ariaSetSize:h,ariaSort:null,ariaValueMax:h,ariaValueMin:h,ariaValueNow:h,ariaValueText:null,role:null},transform(n,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function ka(n,e){return e in n?n[e]:e}function wa(n,e){return ka(n,e.toLowerCase())}const ur=he({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:be,acceptCharset:C,accessKey:C,action:null,allow:null,allowFullScreen:v,allowPaymentRequest:v,allowUserMedia:v,alt:null,as:null,async:v,autoCapitalize:null,autoComplete:C,autoFocus:v,autoPlay:v,blocking:C,capture:null,charSet:null,checked:v,cite:null,className:C,cols:h,colSpan:null,content:null,contentEditable:E,controls:v,controlsList:C,coords:h|be,crossOrigin:null,data:null,dateTime:null,decoding:null,default:v,defer:v,dir:null,dirName:null,disabled:v,download:Rn,draggable:E,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:v,formTarget:null,headers:C,height:h,hidden:Rn,high:h,href:null,hrefLang:null,htmlFor:C,httpEquiv:C,id:null,imageSizes:null,imageSrcSet:null,inert:v,inputMode:null,integrity:null,is:null,isMap:v,itemId:null,itemProp:C,itemRef:C,itemScope:v,itemType:C,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:v,low:h,manifest:null,max:null,maxLength:h,media:null,method:null,min:null,minLength:h,multiple:v,muted:v,name:null,nonce:null,noModule:v,noValidate:v,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:v,optimum:h,pattern:null,ping:C,placeholder:null,playsInline:v,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:v,referrerPolicy:null,rel:C,required:v,reversed:v,rows:h,rowSpan:h,sandbox:C,scope:null,scoped:v,seamless:v,selected:v,shadowRootClonable:v,shadowRootDelegatesFocus:v,shadowRootMode:null,shape:null,size:h,sizes:null,slot:null,span:h,spellCheck:E,src:null,srcDoc:null,srcLang:null,srcSet:null,start:h,step:null,style:null,tabIndex:h,target:null,title:null,translate:null,type:null,typeMustMatch:v,useMap:null,value:E,width:h,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:C,axis:null,background:null,bgColor:null,border:h,borderColor:null,bottomMargin:h,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:v,declare:v,event:null,face:null,frame:null,frameBorder:null,hSpace:h,leftMargin:h,link:null,longDesc:null,lowSrc:null,marginHeight:h,marginWidth:h,noResize:v,noHref:v,noShade:v,noWrap:v,object:null,profile:null,prompt:null,rev:null,rightMargin:h,rules:null,scheme:null,scrolling:E,standby:null,summary:null,text:null,topMargin:h,valueType:null,version:null,vAlign:null,vLink:null,vSpace:h,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:v,disableRemotePlayback:v,prefix:null,property:null,results:h,security:null,unselectable:null},space:"html",transform:wa}),dr=he({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:R,accentHeight:h,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:h,amplitude:h,arabicForm:null,ascent:h,attributeName:null,attributeType:null,azimuth:h,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:h,by:null,calcMode:null,capHeight:h,className:C,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:h,diffuseConstant:h,direction:null,display:null,dur:null,divisor:h,dominantBaseline:null,download:v,dx:null,dy:null,edgeMode:null,editable:null,elevation:h,enableBackground:null,end:null,event:null,exponent:h,externalResourcesRequired:null,fill:null,fillOpacity:h,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:be,g2:be,glyphName:be,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:h,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:h,horizOriginX:h,horizOriginY:h,id:null,ideographic:h,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:h,k:h,k1:h,k2:h,k3:h,k4:h,kernelMatrix:R,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:h,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:h,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:h,overlineThickness:h,paintOrder:null,panose1:null,path:null,pathLength:h,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:C,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:h,pointsAtY:h,pointsAtZ:h,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:R,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:R,rev:R,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:R,requiredFeatures:R,requiredFonts:R,requiredFormats:R,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:h,specularExponent:h,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:h,strikethroughThickness:h,string:null,stroke:null,strokeDashArray:R,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:h,strokeOpacity:h,strokeWidth:null,style:null,surfaceScale:h,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:R,tabIndex:h,tableValues:null,target:null,targetX:h,targetY:h,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:R,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:h,underlineThickness:h,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:h,values:null,vAlphabetic:h,vMathematical:h,vectorEffect:null,vHanging:h,vIdeographic:h,version:null,vertAdvY:h,vertOriginX:h,vertOriginY:h,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:h,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:ka}),xa=he({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(n,e){return"xlink:"+e.slice(5).toLowerCase()}}),$a=he({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:wa}),va=he({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(n,e){return"xml:"+e.slice(3).toLowerCase()}}),br=/[A-Z]/g,vt=/-[a-z]/g,gr=/^data[-\w.:]+$/i;function _r(n,e){const t=In(e);let a=e,i=I;if(t in n.normal)return n.property[n.normal[t]];if(t.length>4&&t.slice(0,4)==="data"&&gr.test(e)){if(e.charAt(4)==="-"){const r=e.slice(5).replace(vt,fr);a="data"+r.charAt(0).toUpperCase()+r.slice(1)}else{const r=e.slice(4);if(!vt.test(r)){let s=r.replace(br,hr);s.charAt(0)!=="-"&&(s="-"+s),e="data"+s}}i=Kn}return new i(a,e)}function hr(n){return"-"+n.toLowerCase()}function fr(n){return n.charAt(1).toUpperCase()}const yr=fa([ya,ur,xa,$a,va],"html"),Ca=fa([ya,dr,xa,$a,va],"svg"),Ct={}.hasOwnProperty;function kr(n,e){const t=e||{};function a(i,...r){let s=a.invalid;const o=a.handlers;if(i&&Ct.call(i,n)){const c=String(i[n]);s=Ct.call(o,c)?o[c]:a.unknown}if(s)return s.call(this,i,...r)}return a.handlers=t.handlers||{},a.invalid=t.invalid,a.unknown=t.unknown,a}const wr=/["&'<>`]/g,xr=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,$r=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,vr=/[|\\{}()[\]^$+*?.]/g,jt=new WeakMap;function Cr(n,e){if(n=n.replace(e.subset?jr(e.subset):wr,a),e.subset||e.escapeOnly)return n;return n.replace(xr,t).replace($r,a);function t(i,r,s){return e.format((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536,s.charCodeAt(r+2),e)}function a(i,r,s){return e.format(i.charCodeAt(0),s.charCodeAt(r+1),e)}}function jr(n){let e=jt.get(n);return e||(e=Ar(n),jt.set(n,e)),e}function Ar(n){const e=[];let t=-1;for(;++t<n.length;)e.push(n[t].replace(vr,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}const Er=/[\dA-Fa-f]/;function qr(n,e,t){const a="&#x"+n.toString(16).toUpperCase();return t&&e&&!Er.test(String.fromCharCode(e))?a:a+";"}const Fr=/\d/;function zr(n,e,t){const a="&#"+String(n);return t&&e&&!Fr.test(String.fromCharCode(e))?a:a+";"}const Sr=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],fn={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},Nr=["cent","copy","divide","gt","lt","not","para","times"],ja={}.hasOwnProperty,Ln={};let We;for(We in fn)ja.call(fn,We)&&(Ln[fn[We]]=We);const Tr=/[^\dA-Za-z]/;function Zr(n,e,t,a){const i=String.fromCharCode(n);if(ja.call(Ln,i)){const r=Ln[i],s="&"+r;return t&&Sr.includes(r)&&!Nr.includes(r)&&(!a||e&&e!==61&&Tr.test(String.fromCharCode(e)))?s:s+";"}return""}function Ir(n,e,t){let a=qr(n,e,t.omitOptionalSemicolons),i;if((t.useNamedReferences||t.useShortestReferences)&&(i=Zr(n,e,t.omitOptionalSemicolons,t.attribute)),(t.useShortestReferences||!i)&&t.useShortestReferences){const r=zr(n,e,t.omitOptionalSemicolons);r.length<a.length&&(a=r)}return i&&(!t.useShortestReferences||i.length<a.length)?i:a}function ge(n,e){return Cr(n,Object.assign({format:Ir},e))}const Rr=/^>|^->|<!--|-->|--!>|<!-$/g,Ur=[">"],Lr=["<",">"];function Wr(n,e,t,a){return a.settings.bogusComments?"<?"+ge(n.value,Object.assign({},a.settings.characterReferences,{subset:Ur}))+">":"<!--"+n.value.replace(Rr,i)+"-->";function i(r){return ge(r,Object.assign({},a.settings.characterReferences,{subset:Lr}))}}function Or(n,e,t,a){return"<!"+(a.settings.upperDoctype?"DOCTYPE":"doctype")+(a.settings.tightDoctype?"":" ")+"html>"}function At(n,e){const t=String(n);if(typeof e!="string")throw new TypeError("Expected character");let a=0,i=t.indexOf(e);for(;i!==-1;)a++,i=t.indexOf(e,i+e.length);return a}function Pr(n,e){const t=e||{};return(n[n.length-1]===""?[...n,""]:n).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}function Gr(n){return n.join(" ").trim()}const Mr=/[ \t\n\f\r]/g;function Jn(n){return typeof n=="object"?n.type==="text"?Et(n.value):!1:Et(n)}function Et(n){return n.replace(Mr,"")===""}const F=Ea(1),Aa=Ea(-1),Dr=[];function Ea(n){return e;function e(t,a,i){const r=t?t.children:Dr;let s=(a||0)+n,o=r[s];if(!i)for(;o&&Jn(o);)s+=n,o=r[s];return o}}const Br={}.hasOwnProperty;function qa(n){return e;function e(t,a,i){return Br.call(n,t.tagName)&&n[t.tagName](t,a,i)}}const Qn=qa({body:Xr,caption:yn,colgroup:yn,dd:Jr,dt:Kr,head:yn,html:Hr,li:Yr,optgroup:Qr,option:es,p:Vr,rp:qt,rt:qt,tbody:ts,td:Ft,tfoot:as,th:Ft,thead:ns,tr:is});function yn(n,e,t){const a=F(t,e,!0);return!a||a.type!=="comment"&&!(a.type==="text"&&Jn(a.value.charAt(0)))}function Hr(n,e,t){const a=F(t,e);return!a||a.type!=="comment"}function Xr(n,e,t){const a=F(t,e);return!a||a.type!=="comment"}function Vr(n,e,t){const a=F(t,e);return a?a.type==="element"&&(a.tagName==="address"||a.tagName==="article"||a.tagName==="aside"||a.tagName==="blockquote"||a.tagName==="details"||a.tagName==="div"||a.tagName==="dl"||a.tagName==="fieldset"||a.tagName==="figcaption"||a.tagName==="figure"||a.tagName==="footer"||a.tagName==="form"||a.tagName==="h1"||a.tagName==="h2"||a.tagName==="h3"||a.tagName==="h4"||a.tagName==="h5"||a.tagName==="h6"||a.tagName==="header"||a.tagName==="hgroup"||a.tagName==="hr"||a.tagName==="main"||a.tagName==="menu"||a.tagName==="nav"||a.tagName==="ol"||a.tagName==="p"||a.tagName==="pre"||a.tagName==="section"||a.tagName==="table"||a.tagName==="ul"):!t||!(t.type==="element"&&(t.tagName==="a"||t.tagName==="audio"||t.tagName==="del"||t.tagName==="ins"||t.tagName==="map"||t.tagName==="noscript"||t.tagName==="video"))}function Yr(n,e,t){const a=F(t,e);return!a||a.type==="element"&&a.tagName==="li"}function Kr(n,e,t){const a=F(t,e);return!!(a&&a.type==="element"&&(a.tagName==="dt"||a.tagName==="dd"))}function Jr(n,e,t){const a=F(t,e);return!a||a.type==="element"&&(a.tagName==="dt"||a.tagName==="dd")}function qt(n,e,t){const a=F(t,e);return!a||a.type==="element"&&(a.tagName==="rp"||a.tagName==="rt")}function Qr(n,e,t){const a=F(t,e);return!a||a.type==="element"&&a.tagName==="optgroup"}function es(n,e,t){const a=F(t,e);return!a||a.type==="element"&&(a.tagName==="option"||a.tagName==="optgroup")}function ns(n,e,t){const a=F(t,e);return!!(a&&a.type==="element"&&(a.tagName==="tbody"||a.tagName==="tfoot"))}function ts(n,e,t){const a=F(t,e);return!a||a.type==="element"&&(a.tagName==="tbody"||a.tagName==="tfoot")}function as(n,e,t){return!F(t,e)}function is(n,e,t){const a=F(t,e);return!a||a.type==="element"&&a.tagName==="tr"}function Ft(n,e,t){const a=F(t,e);return!a||a.type==="element"&&(a.tagName==="td"||a.tagName==="th")}const rs=qa({body:cs,colgroup:ps,head:os,html:ss,tbody:ls});function ss(n){const e=F(n,-1);return!e||e.type!=="comment"}function os(n){const e=new Set;for(const a of n.children)if(a.type==="element"&&(a.tagName==="base"||a.tagName==="title")){if(e.has(a.tagName))return!1;e.add(a.tagName)}const t=n.children[0];return!t||t.type==="element"}function cs(n){const e=F(n,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&Jn(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function ps(n,e,t){const a=Aa(t,e),i=F(n,-1,!0);return t&&a&&a.type==="element"&&a.tagName==="colgroup"&&Qn(a,t.children.indexOf(a),t)?!1:!!(i&&i.type==="element"&&i.tagName==="col")}function ls(n,e,t){const a=Aa(t,e),i=F(n,-1);return t&&a&&a.type==="element"&&(a.tagName==="thead"||a.tagName==="tbody")&&Qn(a,t.children.indexOf(a),t)?!1:!!(i&&i.type==="element"&&i.tagName==="tr")}const Oe={name:[[`
4
4
  \f\r &/=>`.split(""),`
@@ -1 +1 @@
1
- import{R as t,r as s,j as a}from"./main-BlX7CS2-.js";function n(){const e=t.useNavigate();return s.useEffect(()=>{e({to:"/chat/$sessionKey",params:{sessionKey:"main"},replace:!0})},[e]),a.jsx("div",{className:"h-screen flex items-center justify-center text-primary-600",children:"Loading…"})}export{n as component};
1
+ import{R as t,r as s,j as a}from"./main-DrVY5UJU.js";function n(){const e=t.useNavigate();return s.useEffect(()=>{e({to:"/chat/$sessionKey",params:{sessionKey:"main"},replace:!0})},[e]),a.jsx("div",{className:"h-screen flex items-center justify-center text-primary-600",children:"Loading…"})}export{n as component};
@@ -1 +1 @@
1
- import{j as e}from"./main-BlX7CS2-.js";import{D as l,a as c,b as d,c as p,d as m}from"./use-file-explorer-state-C6lX-h0n.js";import{B as x}from"./button-BcnCTjUT.js";import"./useButton-DhneLsMA.js";import"./react-ONC2UaeC.js";const s=typeof navigator<"u"&&navigator.platform.toUpperCase().indexOf("MAC")>=0,h=[{keys:[s?"⌘":"Ctrl","K"],description:"Start a new chat"},{keys:[s?"⌘":"Ctrl","F"],description:"Search current conversation"},{keys:[s?"⌘":"Ctrl","Shift","F"],description:"Search all conversations"},{keys:[s?"⌘":"Ctrl","/"],description:"Focus message input"},{keys:["Esc"],description:"Close dialogs / Clear focus"},{keys:[s?"⌘":"Ctrl","Shift","C"],description:"Copy last response"},{keys:["?"],description:"Show this help dialog"}];function g({open:t,onOpenChange:a}){return e.jsx(l,{open:t,onOpenChange:a,children:e.jsx(c,{className:"w-[min(500px,92vw)]",children:e.jsxs("div",{className:"p-6",children:[e.jsx(d,{className:"mb-2",children:"Keyboard Shortcuts"}),e.jsx(p,{className:"mb-6",children:"Speed up your workflow with these keyboard shortcuts"}),e.jsx("div",{className:"space-y-3",children:h.map((r,o)=>e.jsxs("div",{className:"flex items-center justify-between py-2 border-b border-primary-100 last:border-0",children:[e.jsx("span",{className:"text-sm text-primary-700",children:r.description}),e.jsx("div",{className:"flex items-center gap-1",children:r.keys.map((n,i)=>e.jsxs("span",{className:"inline-flex items-center",children:[e.jsx("kbd",{className:"px-2 py-1 text-xs font-semibold text-primary-800 bg-primary-100 border border-primary-200 rounded",children:n}),i<r.keys.length-1&&e.jsx("span",{className:"mx-1 text-primary-400",children:"+"})]},i))})]},o))}),e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx(m,{children:e.jsx(x,{variant:"outline",children:"Close"})})})]})})})}export{g as KeyboardShortcutsDialog};
1
+ import{j as e}from"./main-DrVY5UJU.js";import{D as l,a as c,b as d,c as p,d as m}from"./use-file-explorer-state-Cii59H70.js";import{B as x}from"./button-CuH8u1uR.js";import"./useButton-hZdvKtl_.js";import"./react-CzqI3gbN.js";const s=typeof navigator<"u"&&navigator.platform.toUpperCase().indexOf("MAC")>=0,h=[{keys:[s?"⌘":"Ctrl","K"],description:"Start a new chat"},{keys:[s?"⌘":"Ctrl","F"],description:"Search current conversation"},{keys:[s?"⌘":"Ctrl","Shift","F"],description:"Search all conversations"},{keys:[s?"⌘":"Ctrl","/"],description:"Focus message input"},{keys:["Esc"],description:"Close dialogs / Clear focus"},{keys:[s?"⌘":"Ctrl","Shift","C"],description:"Copy last response"},{keys:["?"],description:"Show this help dialog"}];function g({open:t,onOpenChange:a}){return e.jsx(l,{open:t,onOpenChange:a,children:e.jsx(c,{className:"w-[min(500px,92vw)]",children:e.jsxs("div",{className:"p-6",children:[e.jsx(d,{className:"mb-2",children:"Keyboard Shortcuts"}),e.jsx(p,{className:"mb-6",children:"Speed up your workflow with these keyboard shortcuts"}),e.jsx("div",{className:"space-y-3",children:h.map((r,o)=>e.jsxs("div",{className:"flex items-center justify-between py-2 border-b border-primary-100 last:border-0",children:[e.jsx("span",{className:"text-sm text-primary-700",children:r.description}),e.jsx("div",{className:"flex items-center gap-1",children:r.keys.map((n,i)=>e.jsxs("span",{className:"inline-flex items-center",children:[e.jsx("kbd",{className:"px-2 py-1 text-xs font-semibold text-primary-800 bg-primary-100 border border-primary-200 rounded",children:n}),i<r.keys.length-1&&e.jsx("span",{className:"mx-1 text-primary-400",children:"+"})]},i))})]},o))}),e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx(m,{children:e.jsx(x,{variant:"outline",children:"Close"})})})]})})})}export{g as KeyboardShortcutsDialog};
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/connect-B8sfEQyb.js","assets/index-CxJ4zG_W.js","assets/button-BcnCTjUT.js","assets/react-ONC2UaeC.js","assets/_sessionKey-CaDTbjXx.js","assets/useButton-DhneLsMA.js","assets/use-file-explorer-state-C6lX-h0n.js","assets/opencami-logo-5KynvViW.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/connect-CtDn993i.js","assets/index-IGP-Igwt.js","assets/button-CuH8u1uR.js","assets/react-CzqI3gbN.js","assets/_sessionKey-Z6Wcnj0N.js","assets/useButton-hZdvKtl_.js","assets/use-file-explorer-state-Cii59H70.js","assets/opencami-logo-ChD2XR2j.js"])))=>i.map(i=>d[i]);
2
2
  function x0(a,i){for(var s=0;s<i.length;s++){const r=i[s];if(typeof r!="string"&&!Array.isArray(r)){for(const c in r)if(c!=="default"&&!(c in a)){const f=Object.getOwnPropertyDescriptor(r,c);f&&Object.defineProperty(a,c,f.get?f:{enumerable:!0,get:()=>r[c]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}function z0(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var sc={exports:{}},Li={};var Im;function D0(){if(Im)return Li;Im=1;var a=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function s(r,c,f){var m=null;if(f!==void 0&&(m=""+f),c.key!==void 0&&(m=""+c.key),"key"in c){f={};for(var d in c)d!=="key"&&(f[d]=c[d])}else f=c;return c=f.ref,{$$typeof:a,type:r,key:m,ref:c!==void 0?c:null,props:f}}return Li.Fragment=i,Li.jsx=s,Li.jsxs=s,Li}var ty;function U0(){return ty||(ty=1,sc.exports=D0()),sc.exports}var F=U0(),uc={exports:{}},ot={};var ey;function L0(){if(ey)return ot;ey=1;var a=Symbol.for("react.transitional.element"),i=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),m=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),_=Symbol.iterator;function O(A){return A===null||typeof A!="object"?null:(A=_&&A[_]||A["@@iterator"],typeof A=="function"?A:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},R=Object.assign,C={};function B(A,Y,P){this.props=A,this.context=Y,this.refs=C,this.updater=P||x}B.prototype.isReactComponent={},B.prototype.setState=function(A,Y){if(typeof A!="object"&&typeof A!="function"&&A!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,A,Y,"setState")},B.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function K(){}K.prototype=B.prototype;function Q(A,Y,P){this.props=A,this.context=Y,this.refs=C,this.updater=P||x}var G=Q.prototype=new K;G.constructor=Q,R(G,B.prototype),G.isPureReactComponent=!0;var $=Array.isArray;function W(){}var X={H:null,A:null,T:null,S:null},V=Object.prototype.hasOwnProperty;function k(A,Y,P){var J=P.ref;return{$$typeof:a,type:A,key:Y,ref:J!==void 0?J:null,props:P}}function ct(A,Y){return k(A.type,Y,A.props)}function st(A){return typeof A=="object"&&A!==null&&A.$$typeof===a}function it(A){var Y={"=":"=0",":":"=2"};return"$"+A.replace(/[=:]/g,function(P){return Y[P]})}var St=/\/+/g;function rt(A,Y){return typeof A=="object"&&A!==null&&A.key!=null?it(""+A.key):Y.toString(36)}function Vt(A){switch(A.status){case"fulfilled":return A.value;case"rejected":throw A.reason;default:switch(typeof A.status=="string"?A.then(W,W):(A.status="pending",A.then(function(Y){A.status==="pending"&&(A.status="fulfilled",A.value=Y)},function(Y){A.status==="pending"&&(A.status="rejected",A.reason=Y)})),A.status){case"fulfilled":return A.value;case"rejected":throw A.reason}}throw A}function N(A,Y,P,J,ut){var dt=typeof A;(dt==="undefined"||dt==="boolean")&&(A=null);var pt=!1;if(A===null)pt=!0;else switch(dt){case"bigint":case"string":case"number":pt=!0;break;case"object":switch(A.$$typeof){case a:case i:pt=!0;break;case S:return pt=A._init,N(pt(A._payload),Y,P,J,ut)}}if(pt)return ut=ut(A),pt=J===""?"."+rt(A,0):J,$(ut)?(P="",pt!=null&&(P=pt.replace(St,"$&/")+"/"),N(ut,Y,P,"",function(ke){return ke})):ut!=null&&(st(ut)&&(ut=ct(ut,P+(ut.key==null||A&&A.key===ut.key?"":(""+ut.key).replace(St,"$&/")+"/")+pt)),Y.push(ut)),1;pt=0;var Xt=J===""?".":J+":";if($(A))for(var Lt=0;Lt<A.length;Lt++)J=A[Lt],dt=Xt+rt(J,Lt),pt+=N(J,Y,P,dt,ut);else if(Lt=O(A),typeof Lt=="function")for(A=Lt.call(A),Lt=0;!(J=A.next()).done;)J=J.value,dt=Xt+rt(J,Lt++),pt+=N(J,Y,P,dt,ut);else if(dt==="object"){if(typeof A.then=="function")return N(Vt(A),Y,P,J,ut);throw Y=String(A),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(A).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.")}return pt}function Z(A,Y,P){if(A==null)return A;var J=[],ut=0;return N(A,J,"","",function(dt){return Y.call(P,dt,ut++)}),J}function lt(A){if(A._status===-1){var Y=A._result;Y=Y(),Y.then(function(P){(A._status===0||A._status===-1)&&(A._status=1,A._result=P)},function(P){(A._status===0||A._status===-1)&&(A._status=2,A._result=P)}),A._status===-1&&(A._status=0,A._result=Y)}if(A._status===1)return A._result.default;throw A._result}var Tt=typeof reportError=="function"?reportError:function(A){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Y=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof A=="object"&&A!==null&&typeof A.message=="string"?String(A.message):String(A),error:A});if(!window.dispatchEvent(Y))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",A);return}console.error(A)},At={map:Z,forEach:function(A,Y,P){Z(A,function(){Y.apply(this,arguments)},P)},count:function(A){var Y=0;return Z(A,function(){Y++}),Y},toArray:function(A){return Z(A,function(Y){return Y})||[]},only:function(A){if(!st(A))throw Error("React.Children.only expected to receive a single React element child.");return A}};return ot.Activity=g,ot.Children=At,ot.Component=B,ot.Fragment=s,ot.Profiler=c,ot.PureComponent=Q,ot.StrictMode=r,ot.Suspense=y,ot.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=X,ot.__COMPILER_RUNTIME={__proto__:null,c:function(A){return X.H.useMemoCache(A)}},ot.cache=function(A){return function(){return A.apply(null,arguments)}},ot.cacheSignal=function(){return null},ot.cloneElement=function(A,Y,P){if(A==null)throw Error("The argument must be a React element, but you passed "+A+".");var J=R({},A.props),ut=A.key;if(Y!=null)for(dt in Y.key!==void 0&&(ut=""+Y.key),Y)!V.call(Y,dt)||dt==="key"||dt==="__self"||dt==="__source"||dt==="ref"&&Y.ref===void 0||(J[dt]=Y[dt]);var dt=arguments.length-2;if(dt===1)J.children=P;else if(1<dt){for(var pt=Array(dt),Xt=0;Xt<dt;Xt++)pt[Xt]=arguments[Xt+2];J.children=pt}return k(A.type,ut,J)},ot.createContext=function(A){return A={$$typeof:m,_currentValue:A,_currentValue2:A,_threadCount:0,Provider:null,Consumer:null},A.Provider=A,A.Consumer={$$typeof:f,_context:A},A},ot.createElement=function(A,Y,P){var J,ut={},dt=null;if(Y!=null)for(J in Y.key!==void 0&&(dt=""+Y.key),Y)V.call(Y,J)&&J!=="key"&&J!=="__self"&&J!=="__source"&&(ut[J]=Y[J]);var pt=arguments.length-2;if(pt===1)ut.children=P;else if(1<pt){for(var Xt=Array(pt),Lt=0;Lt<pt;Lt++)Xt[Lt]=arguments[Lt+2];ut.children=Xt}if(A&&A.defaultProps)for(J in pt=A.defaultProps,pt)ut[J]===void 0&&(ut[J]=pt[J]);return k(A,dt,ut)},ot.createRef=function(){return{current:null}},ot.forwardRef=function(A){return{$$typeof:d,render:A}},ot.isValidElement=st,ot.lazy=function(A){return{$$typeof:S,_payload:{_status:-1,_result:A},_init:lt}},ot.memo=function(A,Y){return{$$typeof:p,type:A,compare:Y===void 0?null:Y}},ot.startTransition=function(A){var Y=X.T,P={};X.T=P;try{var J=A(),ut=X.S;ut!==null&&ut(P,J),typeof J=="object"&&J!==null&&typeof J.then=="function"&&J.then(W,Tt)}catch(dt){Tt(dt)}finally{Y!==null&&P.types!==null&&(Y.types=P.types),X.T=Y}},ot.unstable_useCacheRefresh=function(){return X.H.useCacheRefresh()},ot.use=function(A){return X.H.use(A)},ot.useActionState=function(A,Y,P){return X.H.useActionState(A,Y,P)},ot.useCallback=function(A,Y){return X.H.useCallback(A,Y)},ot.useContext=function(A){return X.H.useContext(A)},ot.useDebugValue=function(){},ot.useDeferredValue=function(A,Y){return X.H.useDeferredValue(A,Y)},ot.useEffect=function(A,Y){return X.H.useEffect(A,Y)},ot.useEffectEvent=function(A){return X.H.useEffectEvent(A)},ot.useId=function(){return X.H.useId()},ot.useImperativeHandle=function(A,Y,P){return X.H.useImperativeHandle(A,Y,P)},ot.useInsertionEffect=function(A,Y){return X.H.useInsertionEffect(A,Y)},ot.useLayoutEffect=function(A,Y){return X.H.useLayoutEffect(A,Y)},ot.useMemo=function(A,Y){return X.H.useMemo(A,Y)},ot.useOptimistic=function(A,Y){return X.H.useOptimistic(A,Y)},ot.useReducer=function(A,Y,P){return X.H.useReducer(A,Y,P)},ot.useRef=function(A){return X.H.useRef(A)},ot.useState=function(A){return X.H.useState(A)},ot.useSyncExternalStore=function(A,Y,P){return X.H.useSyncExternalStore(A,Y,P)},ot.useTransition=function(){return X.H.useTransition()},ot.version="19.2.4",ot}var ny;function ki(){return ny||(ny=1,uc.exports=L0()),uc.exports}var nt=ki();const Nl=z0(nt),N0=x0({__proto__:null,default:Nl},[nt]);var rc={exports:{}},Ni={},oc={exports:{}},cc={};var ay;function j0(){return ay||(ay=1,(function(a){function i(N,Z){var lt=N.length;N.push(Z);t:for(;0<lt;){var Tt=lt-1>>>1,At=N[Tt];if(0<c(At,Z))N[Tt]=Z,N[lt]=At,lt=Tt;else break t}}function s(N){return N.length===0?null:N[0]}function r(N){if(N.length===0)return null;var Z=N[0],lt=N.pop();if(lt!==Z){N[0]=lt;t:for(var Tt=0,At=N.length,A=At>>>1;Tt<A;){var Y=2*(Tt+1)-1,P=N[Y],J=Y+1,ut=N[J];if(0>c(P,lt))J<At&&0>c(ut,P)?(N[Tt]=ut,N[J]=lt,Tt=J):(N[Tt]=P,N[Y]=lt,Tt=Y);else if(J<At&&0>c(ut,lt))N[Tt]=ut,N[J]=lt,Tt=J;else break t}}return Z}function c(N,Z){var lt=N.sortIndex-Z.sortIndex;return lt!==0?lt:N.id-Z.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;a.unstable_now=function(){return f.now()}}else{var m=Date,d=m.now();a.unstable_now=function(){return m.now()-d}}var y=[],p=[],S=1,g=null,_=3,O=!1,x=!1,R=!1,C=!1,B=typeof setTimeout=="function"?setTimeout:null,K=typeof clearTimeout=="function"?clearTimeout:null,Q=typeof setImmediate<"u"?setImmediate:null;function G(N){for(var Z=s(p);Z!==null;){if(Z.callback===null)r(p);else if(Z.startTime<=N)r(p),Z.sortIndex=Z.expirationTime,i(y,Z);else break;Z=s(p)}}function $(N){if(R=!1,G(N),!x)if(s(y)!==null)x=!0,W||(W=!0,it());else{var Z=s(p);Z!==null&&Vt($,Z.startTime-N)}}var W=!1,X=-1,V=5,k=-1;function ct(){return C?!0:!(a.unstable_now()-k<V)}function st(){if(C=!1,W){var N=a.unstable_now();k=N;var Z=!0;try{t:{x=!1,R&&(R=!1,K(X),X=-1),O=!0;var lt=_;try{e:{for(G(N),g=s(y);g!==null&&!(g.expirationTime>N&&ct());){var Tt=g.callback;if(typeof Tt=="function"){g.callback=null,_=g.priorityLevel;var At=Tt(g.expirationTime<=N);if(N=a.unstable_now(),typeof At=="function"){g.callback=At,G(N),Z=!0;break e}g===s(y)&&r(y),G(N)}else r(y);g=s(y)}if(g!==null)Z=!0;else{var A=s(p);A!==null&&Vt($,A.startTime-N),Z=!1}}break t}finally{g=null,_=lt,O=!1}Z=void 0}}finally{Z?it():W=!1}}}var it;if(typeof Q=="function")it=function(){Q(st)};else if(typeof MessageChannel<"u"){var St=new MessageChannel,rt=St.port2;St.port1.onmessage=st,it=function(){rt.postMessage(null)}}else it=function(){B(st,0)};function Vt(N,Z){X=B(function(){N(a.unstable_now())},Z)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(N){N.callback=null},a.unstable_forceFrameRate=function(N){0>N||125<N?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):V=0<N?Math.floor(1e3/N):5},a.unstable_getCurrentPriorityLevel=function(){return _},a.unstable_next=function(N){switch(_){case 1:case 2:case 3:var Z=3;break;default:Z=_}var lt=_;_=Z;try{return N()}finally{_=lt}},a.unstable_requestPaint=function(){C=!0},a.unstable_runWithPriority=function(N,Z){switch(N){case 1:case 2:case 3:case 4:case 5:break;default:N=3}var lt=_;_=N;try{return Z()}finally{_=lt}},a.unstable_scheduleCallback=function(N,Z,lt){var Tt=a.unstable_now();switch(typeof lt=="object"&&lt!==null?(lt=lt.delay,lt=typeof lt=="number"&&0<lt?Tt+lt:Tt):lt=Tt,N){case 1:var At=-1;break;case 2:At=250;break;case 5:At=1073741823;break;case 4:At=1e4;break;default:At=5e3}return At=lt+At,N={id:S++,callback:Z,priorityLevel:N,startTime:lt,expirationTime:At,sortIndex:-1},lt>Tt?(N.sortIndex=lt,i(p,N),s(y)===null&&N===s(p)&&(R?(K(X),X=-1):R=!0,Vt($,lt-Tt))):(N.sortIndex=At,i(y,N),x||O||(x=!0,W||(W=!0,it()))),N},a.unstable_shouldYield=ct,a.unstable_wrapCallback=function(N){var Z=_;return function(){var lt=_;_=Z;try{return N.apply(this,arguments)}finally{_=lt}}}})(cc)),cc}var ly;function B0(){return ly||(ly=1,oc.exports=j0()),oc.exports}var fc={exports:{}},re={};var iy;function H0(){if(iy)return re;iy=1;var a=ki();function i(y){var p="https://react.dev/errors/"+y;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var S=2;S<arguments.length;S++)p+="&args[]="+encodeURIComponent(arguments[S])}return"Minified React error #"+y+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var r={d:{f:s,r:function(){throw Error(i(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},c=Symbol.for("react.portal");function f(y,p,S){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:g==null?null:""+g,children:y,containerInfo:p,implementation:S}}var m=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(y,p){if(y==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return re.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,re.createPortal=function(y,p){var S=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(i(299));return f(y,p,null,S)},re.flushSync=function(y){var p=m.T,S=r.p;try{if(m.T=null,r.p=2,y)return y()}finally{m.T=p,r.p=S,r.d.f()}},re.preconnect=function(y,p){typeof y=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,r.d.C(y,p))},re.prefetchDNS=function(y){typeof y=="string"&&r.d.D(y)},re.preinit=function(y,p){if(typeof y=="string"&&p&&typeof p.as=="string"){var S=p.as,g=d(S,p.crossOrigin),_=typeof p.integrity=="string"?p.integrity:void 0,O=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;S==="style"?r.d.S(y,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:g,integrity:_,fetchPriority:O}):S==="script"&&r.d.X(y,{crossOrigin:g,integrity:_,fetchPriority:O,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},re.preinitModule=function(y,p){if(typeof y=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var S=d(p.as,p.crossOrigin);r.d.M(y,{crossOrigin:S,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&r.d.M(y)},re.preload=function(y,p){if(typeof y=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var S=p.as,g=d(S,p.crossOrigin);r.d.L(y,S,{crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},re.preloadModule=function(y,p){if(typeof y=="string")if(p){var S=d(p.as,p.crossOrigin);r.d.m(y,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:S,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else r.d.m(y)},re.requestFormReset=function(y){r.d.r(y)},re.unstable_batchedUpdates=function(y,p){return y(p)},re.useFormState=function(y,p,S){return m.H.useFormState(y,p,S)},re.useFormStatus=function(){return m.H.useHostTransitionStatus()},re.version="19.2.4",re}var sy;function $y(){if(sy)return fc.exports;sy=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(i){console.error(i)}}return a(),fc.exports=H0(),fc.exports}var uy;function q0(){if(uy)return Ni;uy=1;var a=B0(),i=ki(),s=$y();function r(t){var e="https://react.dev/errors/"+t;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function f(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,(e.flags&4098)!==0&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function m(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function d(t){if(t.tag===31){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function y(t){if(f(t)!==t)throw Error(r(188))}function p(t){var e=t.alternate;if(!e){if(e=f(t),e===null)throw Error(r(188));return e!==t?null:t}for(var n=t,l=e;;){var u=n.return;if(u===null)break;var o=u.alternate;if(o===null){if(l=u.return,l!==null){n=l;continue}break}if(u.child===o.child){for(o=u.child;o;){if(o===n)return y(u),t;if(o===l)return y(u),e;o=o.sibling}throw Error(r(188))}if(n.return!==l.return)n=u,l=o;else{for(var h=!1,v=u.child;v;){if(v===n){h=!0,n=u,l=o;break}if(v===l){h=!0,l=u,n=o;break}v=v.sibling}if(!h){for(v=o.child;v;){if(v===n){h=!0,n=o,l=u;break}if(v===l){h=!0,l=o,n=u;break}v=v.sibling}if(!h)throw Error(r(189))}}if(n.alternate!==l)throw Error(r(190))}if(n.tag!==3)throw Error(r(188));return n.stateNode.current===n?t:e}function S(t){var e=t.tag;if(e===5||e===26||e===27||e===6)return t;for(t=t.child;t!==null;){if(e=S(t),e!==null)return e;t=t.sibling}return null}var g=Object.assign,_=Symbol.for("react.element"),O=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),R=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),B=Symbol.for("react.profiler"),K=Symbol.for("react.consumer"),Q=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),$=Symbol.for("react.suspense"),W=Symbol.for("react.suspense_list"),X=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),k=Symbol.for("react.activity"),ct=Symbol.for("react.memo_cache_sentinel"),st=Symbol.iterator;function it(t){return t===null||typeof t!="object"?null:(t=st&&t[st]||t["@@iterator"],typeof t=="function"?t:null)}var St=Symbol.for("react.client.reference");function rt(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===St?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case R:return"Fragment";case B:return"Profiler";case C:return"StrictMode";case $:return"Suspense";case W:return"SuspenseList";case k:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case x:return"Portal";case Q:return t.displayName||"Context";case K:return(t._context.displayName||"Context")+".Consumer";case G:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case X:return e=t.displayName||null,e!==null?e:rt(t.type)||"Memo";case V:e=t._payload,t=t._init;try{return rt(t(e))}catch{}}return null}var Vt=Array.isArray,N=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,lt={pending:!1,data:null,method:null,action:null},Tt=[],At=-1;function A(t){return{current:t}}function Y(t){0>At||(t.current=Tt[At],Tt[At]=null,At--)}function P(t,e){At++,Tt[At]=t.current,t.current=e}var J=A(null),ut=A(null),dt=A(null),pt=A(null);function Xt(t,e){switch(P(dt,e),P(ut,t),P(J,null),e.nodeType){case 9:case 11:t=(t=e.documentElement)&&(t=t.namespaceURI)?Em(t):0;break;default:if(t=e.tagName,e=e.namespaceURI)e=Em(e),t=Rm(e,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}Y(J),P(J,t)}function Lt(){Y(J),Y(ut),Y(dt)}function ke(t){t.memoizedState!==null&&P(pt,t);var e=J.current,n=Rm(e,t.type);e!==n&&(P(ut,t),P(J,n))}function nn(t){ut.current===t&&(Y(J),Y(ut)),pt.current===t&&(Y(pt),xi._currentValue=lt)}var Ha,ql;function an(t){if(Ha===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);Ha=e&&e[1]||"",ql=-1<n.stack.indexOf(`
3
3
  at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
4
4
  `+Ha+t+ql}var qa=!1;function Ya(t,e){if(!t||qa)return"";qa=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(e){var q=function(){throw Error()};if(Object.defineProperty(q.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(q,[])}catch(L){var U=L}Reflect.construct(t,[],q)}else{try{q.call()}catch(L){U=L}t.call(q.prototype)}}else{try{throw Error()}catch(L){U=L}(q=t())&&typeof q.catch=="function"&&q.catch(function(){})}}catch(L){if(L&&U&&typeof L.stack=="string")return[L.stack,U.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var o=l.DetermineComponentFrameRoot(),h=o[0],v=o[1];if(h&&v){var E=h.split(`
@@ -78,4 +78,4 @@ Error generating stack: `+l.message+`
78
78
  document.documentElement.style.setProperty('--opencami-text-size', value)
79
79
  } catch {}
80
80
  })()
81
- `;function zR(){return typeof window<"u"&&(window.location.href="/chat/main"),null}const Ba=vE({notFoundComponent:zR,head:()=>({meta:[{charSet:"utf-8"},{name:"viewport",content:"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover"},{title:"OpenCami"},{name:"description",content:"a fast web client for OpenClaw"},{property:"og:image",content:"/cover.webp"},{property:"og:image:type",content:"image/webp"},{name:"twitter:card",content:"summary_large_image"},{name:"twitter:image",content:"/cover.webp"},{name:"theme-color",content:"#0a0a0a"},{name:"apple-mobile-web-app-capable",content:"yes"},{name:"apple-mobile-web-app-status-bar-style",content:"black-translucent"},{name:"apple-mobile-web-app-title",content:"OpenCami"},{name:"mobile-web-app-capable",content:"yes"}],links:[{rel:"stylesheet",href:OR},{rel:"icon",type:"image/svg+xml",href:"/favicon.svg"},{rel:"apple-touch-icon",href:"/apple-touch-icon-180x180.png"},{rel:"manifest",href:"/manifest.json"}]}),shellComponent:LR,component:UR}),DR=new wR;function UR(){return F.jsx(AR,{client:DR,children:F.jsx(Wp,{})})}function LR({children:a}){return F.jsxs("html",{lang:"en",suppressHydrationWarning:!0,children:[F.jsxs("head",{children:[F.jsx("script",{dangerouslySetInnerHTML:{__html:xR}}),F.jsx("script",{dangerouslySetInnerHTML:{__html:CR}}),F.jsx("script",{dangerouslySetInnerHTML:{__html:MR}}),F.jsx(DE,{})]}),F.jsxs("body",{children:[F.jsx("div",{className:"root",children:a}),F.jsx(UE,{})]})]})}const NR="modulepreload",jR=function(a){return"/"+a},Jy={},Hl=function(i,s,r){let c=Promise.resolve();if(s&&s.length>0){let y=function(p){return Promise.all(p.map(S=>Promise.resolve(S).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),d=m?.nonce||m?.getAttribute("nonce");c=y(s.map(p=>{if(p=jR(p),p in Jy)return;Jy[p]=!0;const S=p.endsWith(".css"),g=S?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${g}`))return;const _=document.createElement("link");if(_.rel=S?"stylesheet":NR,S||(_.as="script"),_.crossOrigin="",_.href=p,d&&_.setAttribute("nonce",d),document.head.appendChild(_),S)return new Promise((O,x)=>{_.addEventListener("load",O),_.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${p}`)))})}))}function f(m){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=m,window.dispatchEvent(d),!d.defaultPrevented)throw m}return c.then(m=>{for(const d of m||[])d.status==="rejected"&&f(d.reason);return i().catch(f)})},BR=()=>Hl(()=>import("./new-DLlBm66g.js"),[]),HR=ia("/new")({beforeLoad:function(){throw Gc({to:"/chat/$sessionKey",params:{sessionKey:"new"},replace:!0})},component:Bl(BR,"component")}),qR=()=>Hl(()=>import("./files-BHXmS1J5.js"),[]),YR=ia("/files")({component:Bl(qR,"component")}),QR=()=>Hl(()=>import("./connect-B8sfEQyb.js"),__vite__mapDeps([0,1,2,3])),GR=ia("/connect")({component:Bl(QR,"component")}),VR=()=>Hl(()=>import("./agents-CGtqdyBi.js"),[]),XR=ia("/agents")({component:Bl(VR,"component")}),KR=()=>Hl(()=>import("./index-BfhiL2JN.js"),[]),ZR=ia("/")({component:Bl(KR,"component")}),PR=()=>Hl(()=>import("./_sessionKey-CaDTbjXx.js").then(a=>a.$),__vite__mapDeps([4,5,2,6,3,7,1])),FR=ia("/chat/$sessionKey")({component:Bl(PR,"component")}),kR=HR.update({id:"/new",path:"/new",getParentRoute:()=>Ba}),JR=YR.update({id:"/files",path:"/files",getParentRoute:()=>Ba}),$R=GR.update({id:"/connect",path:"/connect",getParentRoute:()=>Ba}),WR=XR.update({id:"/agents",path:"/agents",getParentRoute:()=>Ba}),IR=ZR.update({id:"/",path:"/",getParentRoute:()=>Ba}),t2=FR.update({id:"/chat/$sessionKey",path:"/chat/$sessionKey",getParentRoute:()=>Ba}),e2={IndexRoute:IR,AgentsRoute:WR,ConnectRoute:$R,FilesRoute:JR,NewRoute:kR,ChatSessionKeyRoute:t2},n2=Ba._addFileChildren(e2),a2=()=>wE({routeTree:n2,context:{},scrollRestoration:!0,defaultPreloadStaleTime:0});async function l2(){const a=await a2();let i;return i=[],window.__TSS_START_OPTIONS__={serializationAdapters:i},i.push(WE),a.options.serializationAdapters&&i.push(...a.options.serializationAdapters),a.update({basepath:"",serializationAdapters:i}),a.state.matches.length||await NE(a),a}async function i2(){const a=await l2();return window.$_TSR?.h(),a}let Mc;function s2(){return Mc||(Mc=i2()),F.jsx(K_,{promise:Mc,children:a=>F.jsx(ME,{router:a})})}nt.startTransition(()=>{Q0.hydrateRoot(document,F.jsx(nt.StrictMode,{children:F.jsx(s2,{})}))});export{tE as A,kp as L,ZR as R,Vu as S,Hl as _,lE as a,Nl as b,Wc as c,FR as d,ER as e,Fe as f,z0 as g,Pi as h,h2 as i,F as j,iR as k,Nc as l,Xu as m,he as n,aR as o,dR as p,Lc as q,nt as r,f2 as s,lR as t,d2 as u,uv as v,SR as w,rR as x,N0 as y,$_ as z};
81
+ `;function zR(){return typeof window<"u"&&(window.location.href="/chat/main"),null}const Ba=vE({notFoundComponent:zR,head:()=>({meta:[{charSet:"utf-8"},{name:"viewport",content:"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover"},{title:"OpenCami"},{name:"description",content:"a fast web client for OpenClaw"},{property:"og:image",content:"/cover.webp"},{property:"og:image:type",content:"image/webp"},{name:"twitter:card",content:"summary_large_image"},{name:"twitter:image",content:"/cover.webp"},{name:"theme-color",content:"#0a0a0a"},{name:"apple-mobile-web-app-capable",content:"yes"},{name:"apple-mobile-web-app-status-bar-style",content:"black-translucent"},{name:"apple-mobile-web-app-title",content:"OpenCami"},{name:"mobile-web-app-capable",content:"yes"}],links:[{rel:"stylesheet",href:OR},{rel:"icon",type:"image/svg+xml",href:"/favicon.svg"},{rel:"apple-touch-icon",href:"/apple-touch-icon-180x180.png"},{rel:"manifest",href:"/manifest.json"}]}),shellComponent:LR,component:UR}),DR=new wR;function UR(){return F.jsx(AR,{client:DR,children:F.jsx(Wp,{})})}function LR({children:a}){return F.jsxs("html",{lang:"en",suppressHydrationWarning:!0,children:[F.jsxs("head",{children:[F.jsx("script",{dangerouslySetInnerHTML:{__html:xR}}),F.jsx("script",{dangerouslySetInnerHTML:{__html:CR}}),F.jsx("script",{dangerouslySetInnerHTML:{__html:MR}}),F.jsx(DE,{})]}),F.jsxs("body",{children:[F.jsx("div",{className:"root",children:a}),F.jsx(UE,{})]})]})}const NR="modulepreload",jR=function(a){return"/"+a},Jy={},Hl=function(i,s,r){let c=Promise.resolve();if(s&&s.length>0){let y=function(p){return Promise.all(p.map(S=>Promise.resolve(S).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),d=m?.nonce||m?.getAttribute("nonce");c=y(s.map(p=>{if(p=jR(p),p in Jy)return;Jy[p]=!0;const S=p.endsWith(".css"),g=S?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${g}`))return;const _=document.createElement("link");if(_.rel=S?"stylesheet":NR,S||(_.as="script"),_.crossOrigin="",_.href=p,d&&_.setAttribute("nonce",d),document.head.appendChild(_),S)return new Promise((O,x)=>{_.addEventListener("load",O),_.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${p}`)))})}))}function f(m){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=m,window.dispatchEvent(d),!d.defaultPrevented)throw m}return c.then(m=>{for(const d of m||[])d.status==="rejected"&&f(d.reason);return i().catch(f)})},BR=()=>Hl(()=>import("./new-DLlBm66g.js"),[]),HR=ia("/new")({beforeLoad:function(){throw Gc({to:"/chat/$sessionKey",params:{sessionKey:"new"},replace:!0})},component:Bl(BR,"component")}),qR=()=>Hl(()=>import("./files-CDMLoJ0u.js"),[]),YR=ia("/files")({component:Bl(qR,"component")}),QR=()=>Hl(()=>import("./connect-CtDn993i.js"),__vite__mapDeps([0,1,2,3])),GR=ia("/connect")({component:Bl(QR,"component")}),VR=()=>Hl(()=>import("./agents-D8ZHVQ1Z.js"),[]),XR=ia("/agents")({component:Bl(VR,"component")}),KR=()=>Hl(()=>import("./index-N9-2R5hZ.js"),[]),ZR=ia("/")({component:Bl(KR,"component")}),PR=()=>Hl(()=>import("./_sessionKey-Z6Wcnj0N.js").then(a=>a.$),__vite__mapDeps([4,5,2,6,3,7,1])),FR=ia("/chat/$sessionKey")({component:Bl(PR,"component")}),kR=HR.update({id:"/new",path:"/new",getParentRoute:()=>Ba}),JR=YR.update({id:"/files",path:"/files",getParentRoute:()=>Ba}),$R=GR.update({id:"/connect",path:"/connect",getParentRoute:()=>Ba}),WR=XR.update({id:"/agents",path:"/agents",getParentRoute:()=>Ba}),IR=ZR.update({id:"/",path:"/",getParentRoute:()=>Ba}),t2=FR.update({id:"/chat/$sessionKey",path:"/chat/$sessionKey",getParentRoute:()=>Ba}),e2={IndexRoute:IR,AgentsRoute:WR,ConnectRoute:$R,FilesRoute:JR,NewRoute:kR,ChatSessionKeyRoute:t2},n2=Ba._addFileChildren(e2),a2=()=>wE({routeTree:n2,context:{},scrollRestoration:!0,defaultPreloadStaleTime:0});async function l2(){const a=await a2();let i;return i=[],window.__TSS_START_OPTIONS__={serializationAdapters:i},i.push(WE),a.options.serializationAdapters&&i.push(...a.options.serializationAdapters),a.update({basepath:"",serializationAdapters:i}),a.state.matches.length||await NE(a),a}async function i2(){const a=await l2();return window.$_TSR?.h(),a}let Mc;function s2(){return Mc||(Mc=i2()),F.jsx(K_,{promise:Mc,children:a=>F.jsx(ME,{router:a})})}nt.startTransition(()=>{Q0.hydrateRoot(document,F.jsx(nt.StrictMode,{children:F.jsx(s2,{})}))});export{tE as A,kp as L,ZR as R,Vu as S,Hl as _,lE as a,Nl as b,Wc as c,FR as d,ER as e,Fe as f,z0 as g,Pi as h,h2 as i,F as j,iR as k,Nc as l,Xu as m,he as n,aR as o,dR as p,Lc as q,nt as r,f2 as s,lR as t,d2 as u,uv as v,SR as w,rR as x,N0 as y,$_ as z};
@@ -1 +1 @@
1
- import{r as t,j as n}from"./main-BlX7CS2-.js";function p({controlled:e,default:s,name:c,state:d="value"}){const{current:a}=t.useRef(e!==void 0),[r,o]=t.useState(s),l=a?e:r,i=t.useCallback(u=>{a||o(u)},[]);return[l,i]}function f({className:e}){return n.jsx("div",{className:e,children:n.jsx("span",{className:"text-xl",children:"🦎"})})}function b({className:e}){return n.jsx("span",{className:e,style:{background:"linear-gradient(90deg, #10b981, #14b8a6, #06b6d4, #8b5cf6, #ec4899)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text",fontWeight:600},children:"OpenCami"})}export{f as O,b as a,p as u};
1
+ import{r as t,j as n}from"./main-DrVY5UJU.js";function p({controlled:e,default:s,name:c,state:d="value"}){const{current:a}=t.useRef(e!==void 0),[r,o]=t.useState(s),l=a?e:r,i=t.useCallback(u=>{a||o(u)},[]);return[l,i]}function f({className:e}){return n.jsx("div",{className:e,children:n.jsx("span",{className:"text-xl",children:"🦎"})})}function b({className:e}){return n.jsx("span",{className:e,style:{background:"linear-gradient(90deg, #10b981, #14b8a6, #06b6d4, #8b5cf6, #ec4899)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text",fontWeight:600},children:"OpenCami"})}export{f as O,b as a,p as u};
@@ -1 +1 @@
1
- import{b as u}from"./main-BlX7CS2-.js";const b=t=>{let e;const n=new Set,o=(s,r)=>{const c=typeof s=="function"?s(e):s;if(!Object.is(c,e)){const g=e;e=r??(typeof c!="object"||c===null)?c:Object.assign({},e,c),n.forEach(f=>f(e,g))}},a=()=>e,i={setState:o,getState:a,getInitialState:()=>l,subscribe:s=>(n.add(s),()=>n.delete(s))},l=e=t(o,a,i);return i},d=(t=>t?b(t):b),I=t=>t;function j(t,e=I){const n=u.useSyncExternalStore(t.subscribe,u.useCallback(()=>e(t.getState()),[t,e]),u.useCallback(()=>e(t.getInitialState()),[t,e]));return u.useDebugValue(n),n}const S=t=>{const e=d(t),n=o=>j(e,o);return Object.assign(n,e),n},O=(t=>t?S(t):S);export{O as c};
1
+ import{b as u}from"./main-DrVY5UJU.js";const b=t=>{let e;const n=new Set,o=(s,r)=>{const c=typeof s=="function"?s(e):s;if(!Object.is(c,e)){const g=e;e=r??(typeof c!="object"||c===null)?c:Object.assign({},e,c),n.forEach(f=>f(e,g))}},a=()=>e,i={setState:o,getState:a,getInitialState:()=>l,subscribe:s=>(n.add(s),()=>n.delete(s))},l=e=t(o,a,i);return i},d=(t=>t?b(t):b),I=t=>t;function j(t,e=I){const n=u.useSyncExternalStore(t.subscribe,u.useCallback(()=>e(t.getState()),[t,e]),u.useCallback(()=>e(t.getInitialState()),[t,e]));return u.useDebugValue(n),n}const S=t=>{const e=d(t),n=o=>j(e,o);return Object.assign(n,e),n},O=(t=>t?S(t):S);export{O as c};
@@ -0,0 +1 @@
1
+ import{u as O,r as n,c as $,j as t}from"./main-DrVY5UJU.js";import{H as A,A as B,V as H,r as V,c as Q}from"./button-CuH8u1uR.js";import{D as P,a as U}from"./use-file-explorer-state-Cii59H70.js";import{c as M}from"./_sessionKey-Z6Wcnj0N.js";import"./useButton-hZdvKtl_.js";import"./react-CzqI3gbN.js";import"./opencami-logo-ChD2XR2j.js";import"./index-IGP-Igwt.js";function G(e){return Array.isArray(e)?e.map(s=>s?.type==="text"&&typeof s.text=="string"?s.text:"").filter(Boolean).join(" "):""}function K(e){const s=G(e.content);return s||(typeof e.text=="string"?e.text:"")}function Y({sessions:e,currentFriendlyId:s,currentSessionKey:p}){const y=O(),[m,o]=n.useState(""),[d,x]=n.useState(!1),[b,c]=n.useState([]),i=n.useRef(null);n.useEffect(()=>()=>{i.current?.abort(),i.current=null},[]);const j=n.useCallback(v=>{if(!v.trim()||!s||!p)return[];const k=M.history(s,p),w=y.getQueryData(k);if(!w?.messages)return[];const S=v.toLowerCase(),h=[],N=e.find(g=>g.friendlyId===s),a=N?.label||N?.title||N?.derivedTitle||s;return w.messages.forEach((g,R)=>{const l=K(g);if(!l)return;const u=l.toLowerCase().indexOf(S);u!==-1&&h.push({sessionKey:p,friendlyId:s,sessionTitle:a,messageIndex:R,messageRole:g.role||"unknown",messageText:l,matchStart:u,matchEnd:u+v.length,timestamp:g.timestamp})}),h},[s,p,y,e]),f=n.useCallback(async v=>{const k=v.trim();if(!k)return i.current?.abort(),i.current=null,c([]),[];i.current?.abort();const w=new AbortController;i.current=w,x(!0),c([]);const S=k.toLowerCase(),h=[],N=10;try{for(let a=0;a<e.length;a+=N){if(w.signal.aborted)throw new DOMException("Search aborted","AbortError");const g=e.slice(a,a+N),R=await Promise.all(g.map(async l=>{try{const r=M.history(l.friendlyId,l.key);let u=y.getQueryData(r);if(!u){const C=new URLSearchParams({sessionKey:l.key,friendlyId:l.friendlyId,limit:"200"}),I=await fetch(`/api/history?${C.toString()}`,{signal:w.signal});I.ok&&(u=await I.json(),y.setQueryData(r,u))}if(!u?.messages)return[];const z=l.label||l.title||l.derivedTitle||l.friendlyId,L=[];return u.messages.forEach((C,I)=>{const T=K(C);if(!T)return;const D=T.toLowerCase().indexOf(S);D!==-1&&L.push({sessionKey:l.key,friendlyId:l.friendlyId,sessionTitle:z,messageIndex:I,messageRole:C.role||"unknown",messageText:T,matchStart:D,matchEnd:D+k.length,timestamp:C.timestamp})}),L}catch(r){if(r instanceof DOMException&&r.name==="AbortError")throw r;return[]}}));h.push(...R.flat()),h.sort((l,r)=>(r.timestamp||0)-(l.timestamp||0)),c([...h])}return h}catch(a){if(!(a instanceof DOMException&&a.name==="AbortError"))throw a;return[]}finally{i.current===w&&(i.current=null,x(!1))}},[e,y]),E=n.useCallback(()=>{i.current?.abort(),i.current=null,x(!1),o(""),c([])},[]);return{query:m,setQuery:o,isSearching:d,globalResults:b,searchCurrentConversation:j,searchAllSessions:f,clearSearch:E}}function Z(e,s){if(!s.trim())return null;const p=e.toLowerCase(),y=s.toLowerCase(),m=p.indexOf(y);if(m===-1)return null;const o=40,d=80;let x=Math.max(0,m-o),b=Math.min(e.length,m+s.length+d);if(x>0){const f=e.indexOf(" ",x);f!==-1&&f<m&&(x=f+1)}if(b<e.length){const f=e.lastIndexOf(" ",b);f>m+s.length&&(b=f)}const c=(x>0?"...":"")+e.slice(x,m),i=e.slice(m,m+s.length),j=e.slice(m+s.length,b)+(b<e.length?"...":"");return{before:c,match:i,after:j}}function ae({open:e,onOpenChange:s,sessions:p,currentFriendlyId:y,currentSessionKey:m,mode:o,onJumpToMessage:d}){const x=$(),b=n.useRef(null),[c,i]=n.useState(""),[j,f]=n.useState(0),E=n.useRef(null),{isSearching:v,globalResults:k,searchCurrentConversation:w,searchAllSessions:S,clearSearch:h}=Y({sessions:p,currentFriendlyId:y,currentSessionKey:m}),N=n.useMemo(()=>o!=="current"?[]:w(c),[o,c,w]),a=o==="global"?k:N;n.useEffect(()=>{if(o!=="global")return;if(!c.trim()){h();return}const r=setTimeout(()=>{S(c)},300);return()=>clearTimeout(r)},[c,o,S,h]),n.useEffect(()=>{if(!e){h();return}i(""),f(0),h(),setTimeout(()=>{b.current?.focus()},50)},[e,h]),n.useEffect(()=>{f(0)},[a]),n.useEffect(()=>{if(!E.current)return;const r=E.current.querySelector('[data-selected="true"]');r&&r.scrollIntoView({block:"nearest"})},[j]);const g=n.useCallback(r=>{s(!1),o==="current"&&d?d(r):x({to:"/chat/$sessionKey",params:{sessionKey:r.friendlyId}})},[o,x,d,s]),R=n.useCallback(r=>{switch(r.key){case"ArrowDown":r.preventDefault(),f(u=>Math.min(u+1,a.length-1));break;case"ArrowUp":r.preventDefault(),f(u=>Math.max(u-1,0));break;case"Enter":r.preventDefault(),a[j]&&g(a[j]);break;case"Escape":r.preventDefault(),s(!1);break}},[a,j,g,s]),l=o==="global"?"Search across all conversations...":"Search in this conversation...";return t.jsx(P,{open:e,onOpenChange:s,children:t.jsxs(U,{className:"w-[min(600px,92vw)] max-h-[80vh] flex flex-col overflow-hidden",children:[t.jsxs("div",{className:"flex items-center gap-3 p-4 border-b border-primary-200",children:[t.jsx(A,{icon:B,size:20,className:"text-primary-500 shrink-0"}),t.jsx("input",{ref:b,type:"text",value:c,onChange:r=>i(r.target.value),onKeyDown:R,placeholder:l,className:"flex-1 bg-transparent text-primary-900 placeholder:text-primary-400 outline-none text-base"}),c&&t.jsx("button",{type:"button",onClick:()=>{i(""),h()},className:"p-1 hover:bg-primary-200 rounded transition-colors",children:t.jsx(A,{icon:H,size:16,className:"text-primary-500"})}),v&&t.jsx(A,{icon:V,size:20,className:"text-primary-500 animate-spin"})]}),t.jsx("div",{ref:E,className:"flex-1 overflow-y-auto p-2 min-h-0",children:c.trim()?a.length===0&&!v?t.jsxs("div",{className:"text-center text-primary-500 py-8 text-sm",children:['No results found for "',c,'"']}):t.jsx("div",{className:"flex flex-col gap-1",children:a.map((r,u)=>t.jsx(_,{result:r,query:c,isSelected:u===j,showSessionTitle:o==="global",onClick:()=>g(r),onMouseEnter:()=>f(u)},`${r.friendlyId}-${r.messageIndex}`))}):t.jsx("div",{className:"text-center text-primary-500 py-8 text-sm",children:o==="global"?"Type to search across all your conversations":"Type to search within this conversation"})}),t.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-t border-primary-200 text-xs text-primary-500",children:[t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx("kbd",{className:"px-1.5 py-0.5 bg-primary-100 rounded text-[10px]",children:"↑"}),t.jsx("kbd",{className:"px-1.5 py-0.5 bg-primary-100 rounded text-[10px]",children:"↓"}),"to navigate"]}),t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx("kbd",{className:"px-1.5 py-0.5 bg-primary-100 rounded text-[10px]",children:"Enter"}),"to select"]}),t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx("kbd",{className:"px-1.5 py-0.5 bg-primary-100 rounded text-[10px]",children:"Esc"}),"to close"]})]}),a.length>0&&t.jsxs("span",{children:[a.length," result",a.length!==1?"s":""]})]})]})})}function _({result:e,query:s,isSelected:p,showSessionTitle:y,onClick:m,onMouseEnter:o}){const d=Z(e.messageText,s),x=e.messageRole==="assistant"?"Assistant":"You";return t.jsxs("button",{type:"button",onClick:m,onMouseEnter:o,"data-selected":p,className:Q("w-full text-left px-3 py-2 rounded-lg transition-colors",p?"bg-primary-200":"hover:bg-primary-100"),children:[y&&t.jsx("div",{className:"text-xs font-medium text-primary-600 mb-1 truncate",children:e.sessionTitle}),t.jsx("div",{className:"flex items-center gap-2 mb-0.5",children:t.jsx("span",{className:Q("text-[10px] font-medium px-1.5 py-0.5 rounded",e.messageRole==="assistant"?"bg-blue-100 text-blue-700":"bg-green-100 text-green-700"),children:x})}),d&&t.jsxs("div",{className:"text-sm text-primary-700 line-clamp-2",children:[t.jsx("span",{children:d.before}),t.jsx("mark",{className:"bg-yellow-200 text-primary-900 rounded px-0.5",children:d.match}),t.jsx("span",{children:d.after})]})]})}export{ae as SearchDialog};
@@ -1 +1 @@
1
- import{r as m,j as e}from"./main-BlX7CS2-.js";import{D as x,a as p,b as h,c as u,d as j}from"./use-file-explorer-state-C6lX-h0n.js";import{B as v}from"./button-BcnCTjUT.js";import"./useButton-DhneLsMA.js";import"./react-ONC2UaeC.js";const f=[{value:"markdown",label:"Markdown (.md)",description:"Nicely formatted with headers and sections"},{value:"json",label:"JSON (.json)",description:"Full data with metadata"},{value:"txt",label:"Plain Text (.txt)",description:"Simple text format"}];function C({open:r,onOpenChange:t,sessionTitle:l,onExport:i,onCancel:o}){const[s,n]=m.useState("markdown"),c=()=>{i(s)};return e.jsx(x,{open:r,onOpenChange:t,children:e.jsx(p,{children:e.jsxs("div",{className:"p-4",children:[e.jsx(h,{className:"mb-1",children:"Export Conversation"}),e.jsxs(u,{className:"mb-4",children:['Export "',l,'" in your preferred format']}),e.jsx("div",{className:"space-y-2 mb-4",children:f.map(a=>e.jsxs("label",{className:"flex items-start gap-3 p-3 rounded-lg border border-primary-200 cursor-pointer hover:bg-primary-100 transition-colors",children:[e.jsx("input",{type:"radio",name:"export-format",value:a.value,checked:s===a.value,onChange:d=>n(d.target.value),className:"mt-1"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"font-medium text-sm text-primary-900",children:a.label}),e.jsx("div",{className:"text-xs text-primary-600",children:a.description})]})]},a.value))}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(j,{onClick:o,children:"Cancel"}),e.jsx(v,{onClick:c,children:"Export"})]})]})})})}export{C as SessionExportDialog};
1
+ import{r as m,j as e}from"./main-DrVY5UJU.js";import{D as x,a as p,b as h,c as u,d as j}from"./use-file-explorer-state-Cii59H70.js";import{B as v}from"./button-CuH8u1uR.js";import"./useButton-hZdvKtl_.js";import"./react-CzqI3gbN.js";const f=[{value:"markdown",label:"Markdown (.md)",description:"Nicely formatted with headers and sections"},{value:"json",label:"JSON (.json)",description:"Full data with metadata"},{value:"txt",label:"Plain Text (.txt)",description:"Simple text format"}];function C({open:r,onOpenChange:t,sessionTitle:l,onExport:i,onCancel:o}){const[s,n]=m.useState("markdown"),c=()=>{i(s)};return e.jsx(x,{open:r,onOpenChange:t,children:e.jsx(p,{children:e.jsxs("div",{className:"p-4",children:[e.jsx(h,{className:"mb-1",children:"Export Conversation"}),e.jsxs(u,{className:"mb-4",children:['Export "',l,'" in your preferred format']}),e.jsx("div",{className:"space-y-2 mb-4",children:f.map(a=>e.jsxs("label",{className:"flex items-start gap-3 p-3 rounded-lg border border-primary-200 cursor-pointer hover:bg-primary-100 transition-colors",children:[e.jsx("input",{type:"radio",name:"export-format",value:a.value,checked:s===a.value,onChange:d=>n(d.target.value),className:"mt-1"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"font-medium text-sm text-primary-900",children:a.label}),e.jsx("div",{className:"text-xs text-primary-600",children:a.description})]})]},a.value))}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(j,{onClick:o,children:"Cancel"}),e.jsx(v,{onClick:c,children:"Export"})]})]})})})}export{C as SessionExportDialog};