limixbot 0.3.19 → 0.3.21

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 (47) hide show
  1. package/dist/assets/{ActivityPanel-D0V5shGd.js → ActivityPanel-Mm1AdBsr.js} +1 -1
  2. package/dist/assets/{App-DXv-5ZTc.js → App-BgFOjdcx.js} +85 -85
  3. package/dist/assets/{AppEventEditor-mJOa46It.js → AppEventEditor-Cgwtkp8X.js} +1 -1
  4. package/dist/assets/{BotSettingsDialog-DOF82zFt.js → BotSettingsDialog-9DJvaJyA.js} +1 -1
  5. package/dist/assets/{BrowserPanel-Cbp7LssC.js → BrowserPanel-Bf3wrH1-.js} +1 -1
  6. package/dist/assets/{BrowserProfilesManager-LC4INRs7.js → BrowserProfilesManager-CV3LMXnH.js} +1 -1
  7. package/dist/assets/{CloudAddDialog-DywJ4txo.js → CloudAddDialog-B6_ctBlp.js} +1 -1
  8. package/dist/assets/{ComputerFilesPane-BjzS9ZTa.js → ComputerFilesPane-DUKJxzPV.js} +1 -1
  9. package/dist/assets/{ComputerPanel-DGPKl9mx.js → ComputerPanel-DQLD56ji.js} +2 -2
  10. package/dist/assets/{DataPanel-CowhAHcc.js → DataPanel-CqPvkhZs.js} +1 -1
  11. package/dist/assets/{FilesView-Di6bZ56Z.js → FilesView-BTIH8GhL.js} +1 -1
  12. package/dist/assets/{GrokMoveDialog-BXwNEoZf.js → GrokMoveDialog-ipjhCMdt.js} +1 -1
  13. package/dist/assets/{InspectorPanel-gvViZQrp.js → InspectorPanel-CYJ3PKQE.js} +1 -1
  14. package/dist/assets/{KeyboardShortcutsModal-C6gDEGpK.js → KeyboardShortcutsModal-DbroQplB.js} +1 -1
  15. package/dist/assets/{LiveDesktop-BklBBcgn.js → LiveDesktop-CjcPYyQC.js} +1 -1
  16. package/dist/assets/{LocalVmWorkspace-D1xWHo1G.js → LocalVmWorkspace-DLOgAgD1.js} +1 -1
  17. package/dist/assets/{MacLocalControl-BfwVFZRa.js → MacLocalControl-BKOo9Q9t.js} +1 -1
  18. package/dist/assets/{MarkdownFilePreview-Cy-DECsV.js → MarkdownFilePreview-Ck90v9JO.js} +1 -1
  19. package/dist/assets/{NewBotDialog-CRCIYvfv.js → NewBotDialog-CPh_4jgn.js} +1 -1
  20. package/dist/assets/{PhoneAppDialog-CmcHLaYr.js → PhoneAppDialog-C8LY6ZYR.js} +1 -1
  21. package/dist/assets/{PluginsPanel-C46LU5EJ.js → PluginsPanel-CPNu9R4X.js} +1 -1
  22. package/dist/assets/{ProIntroduction-DuPsMUld.js → ProIntroduction-mmdyWV6u.js} +1 -1
  23. package/dist/assets/{RemoteAgentSettingsPanel-BauS0Y0t.js → RemoteAgentSettingsPanel-D_-DQsXX.js} +1 -1
  24. package/dist/assets/{RoomPanel-BiaRLuVx.js → RoomPanel-Bl074tib.js} +1 -1
  25. package/dist/assets/{RoutinesPage-BeldL46G.js → RoutinesPage-BBqOFUgN.js} +1 -1
  26. package/dist/assets/SettingsModal-CZC8Y2Ps.js +11 -0
  27. package/dist/assets/{ShareTeamDialog-uEP_ILfa.js → ShareTeamDialog-lWV9SoFf.js} +1 -1
  28. package/dist/assets/{SignedInSites-BgqjFXnz.js → SignedInSites-BtB_gJc5.js} +1 -1
  29. package/dist/assets/{TeamLibraryPanel-Bd7HFgTR.js → TeamLibraryPanel-CicCxQWY.js} +1 -1
  30. package/dist/assets/{TeamMapPage-DslnWFG2.js → TeamMapPage-DC2UVHtD.js} +1 -1
  31. package/dist/assets/{TriggersPage-BK73CwJR.js → TriggersPage-DV-VkZxS.js} +1 -1
  32. package/dist/assets/{VisibilitySection-CZVuYCfP.js → VisibilitySection-DxS0LSuh.js} +1 -1
  33. package/dist/assets/{WebhookTrigger-DXr8EYFe.js → WebhookTrigger-CbjFXdP6.js} +1 -1
  34. package/dist/assets/{WorksOnGrid-DJJIaPGa.js → WorksOnGrid-DwzG9r3j.js} +1 -1
  35. package/dist/assets/{core-DIFUUeI5.js → core-zyskLUd7.js} +1 -1
  36. package/dist/assets/{import-name-CFjzsLGq.js → import-name-DT6x8SH1.js} +1 -1
  37. package/dist/assets/{index-BBObcTo5.js → index--etc8Lh7.js} +2 -2
  38. package/dist/assets/{index-D2Hr2dxf.js → index-BK27ZkYf.js} +1 -1
  39. package/dist/assets/{mcp-servers-5_CMZE0a.js → mcp-servers-DyW90x_D.js} +1 -1
  40. package/dist/assets/{new-bot-BNUINkXW.js → new-bot-vTUVmgdn.js} +1 -1
  41. package/dist/assets/{org-library-D71rjidw.js → org-library-DZclNfAa.js} +1 -1
  42. package/dist/assets/{package-format-Bc1BWLbR.js → package-format-Bf1YgVUD.js} +1 -1
  43. package/dist/assets/{remote-desktop-panel-CG1BY1IR.js → remote-desktop-panel-AqU9h8PU.js} +1 -1
  44. package/dist/index.html +1 -1
  45. package/dist-server/package.json +1 -1
  46. package/package.json +1 -1
  47. package/dist/assets/SettingsModal-DBLLYSR2.js +0 -11
@@ -1 +1 @@
1
- import{r,j as e,t as a,X as D,a as p,L as A,g as H}from"./styles-BHtUK2qB.js";import{c as F,B as U,L as W}from"./PlacesRail-CUntVv3u.js";import{b as X}from"./remote-desktop-DDRRx8uY.js";import{u as $,n as G}from"./App-DXv-5ZTc.js";import"./monitor-7oLB-7rZ.js";import"./index-BBObcTo5.js";import"./MenuMotion-CobYpP7L.js";function K(n){return{enabled:n?.enabled??!0,verificationPending:n?.verificationPending??!1}}const E=3,b=50;function J(n){const s=n.trim();if(!s)return null;if(!/^\d+$/.test(s))return;const o=Number(s);return o>=1&&o<=b?o:void 0}function P(n,s){return n.trim().split(/[.!?\n]/)[0]?.trim().slice(0,60)||`${s?.name??"Bot"} automation`}const x="w-full rounded-xl border border-hairline/60 bg-panel px-3.5 py-2.5 text-[13px] text-ink outline-none placeholder:text-ink-tertiary focus:border-accent/70";function ae({webhook:n,bots:s,initialBotId:o,onClose:l,onCredential:R}){const{state:h,dispatch:C}=$(),[d,T]=r.useState(n?.botId??(o&&s.some(t=>t.id===o)?o:s[0]?.id)??""),[f,O]=r.useState(n?.name??""),[c,I]=r.useState(n?.prompt??""),[m,g]=r.useState(n?.runOn??"maus"),[v,_]=r.useState((n?.eventTypes??[]).join(", ")),[j,B]=r.useState(n?.maxPendingRuns?.toString()??""),[y,N]=r.useState(!1),[k,u]=r.useState(""),S=r.useRef(null);F(S,l);const L=!!(h.config?.box.configured&&X(h.instances,s.find(t=>t.id===d)?.modelSelection.instanceId)?.snapshot.state==="available"),M=async()=>{const t=s.find(i=>i.id===d),w=J(j);if(w===void 0){u(a("automations.editor.app.limitError",{max:b}));return}const z={name:f.trim()||P(c,t),prompt:c.trim(),botId:d,runOn:m,...K(n),eventTypes:v.split(",").map(i=>i.trim()).filter(Boolean),maxPendingRuns:w};N(!0),u("");try{const i=await G(n?`/api/webhooks/${n.id}`:"/api/webhooks",{method:n?"PATCH":"POST",body:JSON.stringify(z)});C({type:"webhookPatched",webhook:i.webhook}),l(),i.credential&&R(i.credential,i.webhook.id)}catch(i){u(i instanceof Error?i.message:String(i))}finally{N(!1)}};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-5",onMouseDown:t=>t.target===t.currentTarget&&l(),children:e.jsxs("div",{ref:S,role:"dialog","aria-modal":"true","aria-label":n?a("automations.editor.app.editTitle"):a("automations.editor.app.title"),tabIndex:-1,className:"flex max-h-[90vh] w-full max-w-[560px] flex-col overflow-hidden rounded-2xl border border-hairline/60 bg-panel shadow-2xl",children:[e.jsxs("div",{className:"flex items-start justify-between border-b border-hairline/40 px-5 py-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[17px] font-semibold text-ink",children:n?a("automations.editor.app.editTitle"):a("automations.editor.app.title")}),e.jsx("div",{className:"mt-1 text-[12px] text-ink-secondary",children:a("automations.editor.app.subtitle")})]}),e.jsx("button",{type:"button",onClick:l,"aria-label":a("automations.newBox.cancel"),className:"rounded-lg p-2 text-ink-secondary hover:bg-raised hover:text-ink",children:e.jsx(D,{size:18})})]}),e.jsxs("div",{className:"min-h-0 flex-1 space-y-5 overflow-y-auto p-5",children:[e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-[13px] font-medium text-ink",children:a("automations.editor.app.who")}),e.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:s.map(t=>e.jsxs("button",{type:"button",onClick:()=>T(t.id),className:p("flex min-w-0 items-center gap-2 rounded-xl border px-3 py-2 text-left",d===t.id?"border-accent/70 bg-accent/10":"border-hairline/50 bg-inset hover:bg-raised/60"),children:[e.jsx(U,{bot:t,state:d===t.id?"happy":"idle",size:32,animated:!1}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-medium text-ink",children:t.name})]},t.id))})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-2 block text-[13px] font-medium text-ink",children:a("automations.editor.app.what")}),e.jsx("textarea",{autoFocus:!0,value:c,onChange:t=>I(t.target.value),rows:3,placeholder:a("automations.editor.app.whatPlaceholder"),className:p(x,"resize-y py-3 leading-relaxed")})]}),e.jsxs("details",{className:"rounded-xl border border-hairline/45 bg-inset/45 px-4 py-3",children:[e.jsx("summary",{className:"cursor-pointer text-[13px] font-medium text-ink",children:a("automations.more")}),e.jsxs("div",{className:"mt-4 space-y-4",children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1.5 block text-[12px] font-medium text-ink-secondary",children:a("automations.editor.app.name")}),e.jsx("input",{value:f,onChange:t=>O(t.target.value),placeholder:P(c,s.find(t=>t.id===d)),className:x})]}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-[12px] font-medium text-ink-secondary",children:a("automations.editor.app.runOn")}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>g("maus"),className:p("flex items-center gap-2 rounded-xl border p-3 text-left text-[13px] font-medium text-ink",m==="maus"?"border-accent/70 bg-accent/10":"border-hairline/50 bg-panel hover:bg-raised/60"),children:[e.jsx(A,{size:14}),a("automations.editor.app.thisComputer")]}),e.jsxs("button",{type:"button",disabled:!L&&m!=="cloud",onClick:()=>g("cloud"),className:p("flex items-center gap-2 rounded-xl border p-3 text-left text-[13px] font-medium text-ink disabled:cursor-not-allowed disabled:opacity-45",m==="cloud"?"border-accent/70 bg-accent/10":"border-hairline/50 bg-panel hover:bg-raised/60"),children:[e.jsx(H,{size:14}),a("automations.editor.app.cloud")]})]})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1.5 block text-[12px] font-medium text-ink-secondary",children:a("automations.editor.app.events")}),e.jsx("input",{value:v,onChange:t=>_(t.target.value),placeholder:"push, workflow_run",className:x}),e.jsx("span",{className:"mt-1.5 block text-[11px] text-ink-secondary",children:a("automations.editor.app.eventsHelp")})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1.5 block text-[12px] font-medium text-ink-secondary",children:a("automations.editor.app.limit")}),e.jsx("input",{type:"number",inputMode:"numeric",min:1,max:b,step:1,value:j,onChange:t=>B(t.target.value),placeholder:String(E),className:x}),e.jsx("span",{className:"mt-1.5 block text-[11px] text-ink-secondary",children:a("automations.editor.app.limitHelp",{count:E})})]})]})]}),k&&e.jsx("div",{className:"rounded-xl border border-danger/30 bg-danger/10 px-3.5 py-3 text-[12px] text-danger",children:k})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-hairline/40 px-5 py-4",children:[e.jsx("button",{type:"button",onClick:l,className:"rounded-xl px-4 py-2 text-[13px] text-ink-secondary hover:bg-raised hover:text-ink",children:a("automations.newBox.cancel")}),e.jsxs("button",{type:"button",disabled:y||!d,onClick:()=>{M()},className:"flex items-center gap-2 rounded-xl bg-accent px-4 py-2 text-[13px] font-medium text-accent-ink hover:brightness-110 disabled:opacity-40",children:[y&&e.jsx(W,{size:14,className:"animate-spin"}),n?a("automations.editor.app.save"):a("automations.editor.app.create")]})]})]})})}export{ae as WebhookEditor,P as suggestedName};
1
+ import{r,j as e,t as a,X as D,a as p,L as A,g as H}from"./styles-BHtUK2qB.js";import{c as F,B as U,L as W}from"./PlacesRail-CUntVv3u.js";import{b as X}from"./remote-desktop-DDRRx8uY.js";import{u as $,n as G}from"./App-BgFOjdcx.js";import"./monitor-7oLB-7rZ.js";import"./index--etc8Lh7.js";import"./MenuMotion-CobYpP7L.js";function K(n){return{enabled:n?.enabled??!0,verificationPending:n?.verificationPending??!1}}const E=3,b=50;function J(n){const s=n.trim();if(!s)return null;if(!/^\d+$/.test(s))return;const o=Number(s);return o>=1&&o<=b?o:void 0}function P(n,s){return n.trim().split(/[.!?\n]/)[0]?.trim().slice(0,60)||`${s?.name??"Bot"} automation`}const x="w-full rounded-xl border border-hairline/60 bg-panel px-3.5 py-2.5 text-[13px] text-ink outline-none placeholder:text-ink-tertiary focus:border-accent/70";function ae({webhook:n,bots:s,initialBotId:o,onClose:l,onCredential:R}){const{state:h,dispatch:C}=$(),[d,T]=r.useState(n?.botId??(o&&s.some(t=>t.id===o)?o:s[0]?.id)??""),[f,O]=r.useState(n?.name??""),[c,I]=r.useState(n?.prompt??""),[m,g]=r.useState(n?.runOn??"maus"),[v,_]=r.useState((n?.eventTypes??[]).join(", ")),[j,B]=r.useState(n?.maxPendingRuns?.toString()??""),[y,N]=r.useState(!1),[k,u]=r.useState(""),S=r.useRef(null);F(S,l);const L=!!(h.config?.box.configured&&X(h.instances,s.find(t=>t.id===d)?.modelSelection.instanceId)?.snapshot.state==="available"),M=async()=>{const t=s.find(i=>i.id===d),w=J(j);if(w===void 0){u(a("automations.editor.app.limitError",{max:b}));return}const z={name:f.trim()||P(c,t),prompt:c.trim(),botId:d,runOn:m,...K(n),eventTypes:v.split(",").map(i=>i.trim()).filter(Boolean),maxPendingRuns:w};N(!0),u("");try{const i=await G(n?`/api/webhooks/${n.id}`:"/api/webhooks",{method:n?"PATCH":"POST",body:JSON.stringify(z)});C({type:"webhookPatched",webhook:i.webhook}),l(),i.credential&&R(i.credential,i.webhook.id)}catch(i){u(i instanceof Error?i.message:String(i))}finally{N(!1)}};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-5",onMouseDown:t=>t.target===t.currentTarget&&l(),children:e.jsxs("div",{ref:S,role:"dialog","aria-modal":"true","aria-label":n?a("automations.editor.app.editTitle"):a("automations.editor.app.title"),tabIndex:-1,className:"flex max-h-[90vh] w-full max-w-[560px] flex-col overflow-hidden rounded-2xl border border-hairline/60 bg-panel shadow-2xl",children:[e.jsxs("div",{className:"flex items-start justify-between border-b border-hairline/40 px-5 py-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[17px] font-semibold text-ink",children:n?a("automations.editor.app.editTitle"):a("automations.editor.app.title")}),e.jsx("div",{className:"mt-1 text-[12px] text-ink-secondary",children:a("automations.editor.app.subtitle")})]}),e.jsx("button",{type:"button",onClick:l,"aria-label":a("automations.newBox.cancel"),className:"rounded-lg p-2 text-ink-secondary hover:bg-raised hover:text-ink",children:e.jsx(D,{size:18})})]}),e.jsxs("div",{className:"min-h-0 flex-1 space-y-5 overflow-y-auto p-5",children:[e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-[13px] font-medium text-ink",children:a("automations.editor.app.who")}),e.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:s.map(t=>e.jsxs("button",{type:"button",onClick:()=>T(t.id),className:p("flex min-w-0 items-center gap-2 rounded-xl border px-3 py-2 text-left",d===t.id?"border-accent/70 bg-accent/10":"border-hairline/50 bg-inset hover:bg-raised/60"),children:[e.jsx(U,{bot:t,state:d===t.id?"happy":"idle",size:32,animated:!1}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-medium text-ink",children:t.name})]},t.id))})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-2 block text-[13px] font-medium text-ink",children:a("automations.editor.app.what")}),e.jsx("textarea",{autoFocus:!0,value:c,onChange:t=>I(t.target.value),rows:3,placeholder:a("automations.editor.app.whatPlaceholder"),className:p(x,"resize-y py-3 leading-relaxed")})]}),e.jsxs("details",{className:"rounded-xl border border-hairline/45 bg-inset/45 px-4 py-3",children:[e.jsx("summary",{className:"cursor-pointer text-[13px] font-medium text-ink",children:a("automations.more")}),e.jsxs("div",{className:"mt-4 space-y-4",children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1.5 block text-[12px] font-medium text-ink-secondary",children:a("automations.editor.app.name")}),e.jsx("input",{value:f,onChange:t=>O(t.target.value),placeholder:P(c,s.find(t=>t.id===d)),className:x})]}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-[12px] font-medium text-ink-secondary",children:a("automations.editor.app.runOn")}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>g("maus"),className:p("flex items-center gap-2 rounded-xl border p-3 text-left text-[13px] font-medium text-ink",m==="maus"?"border-accent/70 bg-accent/10":"border-hairline/50 bg-panel hover:bg-raised/60"),children:[e.jsx(A,{size:14}),a("automations.editor.app.thisComputer")]}),e.jsxs("button",{type:"button",disabled:!L&&m!=="cloud",onClick:()=>g("cloud"),className:p("flex items-center gap-2 rounded-xl border p-3 text-left text-[13px] font-medium text-ink disabled:cursor-not-allowed disabled:opacity-45",m==="cloud"?"border-accent/70 bg-accent/10":"border-hairline/50 bg-panel hover:bg-raised/60"),children:[e.jsx(H,{size:14}),a("automations.editor.app.cloud")]})]})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1.5 block text-[12px] font-medium text-ink-secondary",children:a("automations.editor.app.events")}),e.jsx("input",{value:v,onChange:t=>_(t.target.value),placeholder:"push, workflow_run",className:x}),e.jsx("span",{className:"mt-1.5 block text-[11px] text-ink-secondary",children:a("automations.editor.app.eventsHelp")})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1.5 block text-[12px] font-medium text-ink-secondary",children:a("automations.editor.app.limit")}),e.jsx("input",{type:"number",inputMode:"numeric",min:1,max:b,step:1,value:j,onChange:t=>B(t.target.value),placeholder:String(E),className:x}),e.jsx("span",{className:"mt-1.5 block text-[11px] text-ink-secondary",children:a("automations.editor.app.limitHelp",{count:E})})]})]})]}),k&&e.jsx("div",{className:"rounded-xl border border-danger/30 bg-danger/10 px-3.5 py-3 text-[12px] text-danger",children:k})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-hairline/40 px-5 py-4",children:[e.jsx("button",{type:"button",onClick:l,className:"rounded-xl px-4 py-2 text-[13px] text-ink-secondary hover:bg-raised hover:text-ink",children:a("automations.newBox.cancel")}),e.jsxs("button",{type:"button",disabled:y||!d,onClick:()=>{M()},className:"flex items-center gap-2 rounded-xl bg-accent px-4 py-2 text-[13px] font-medium text-accent-ink hover:brightness-110 disabled:opacity-40",children:[y&&e.jsx(W,{size:14,className:"animate-spin"}),n?a("automations.editor.app.save"):a("automations.editor.app.create")]})]})]})})}export{ae as WebhookEditor,P as suggestedName};
@@ -1 +1 @@
1
- import{j as r,t,a as u,g as v,f as g}from"./styles-BHtUK2qB.js";import{u as h,a2 as k,a3 as j,G as N,a4 as w,a5 as p}from"./App-DXv-5ZTc.js";import{M as A}from"./monitor-7oLB-7rZ.js";import{g as C}from"./PlacesRail-CUntVv3u.js";function z({value:s,compact:o=!1,onChange:e}){const{state:c}=h();return c.config?.cloudHome?null:r.jsxs("div",{className:"mt-3 rounded-lg bg-inset p-3",children:[r.jsx("div",{className:"text-[12px] font-medium text-ink",children:o?t("botAccess.cloud.provider"):t("botAccess.cloud.backend")}),r.jsx("div",{className:"mt-0.5 text-[12px] text-ink-secondary",children:o?s==="vps"?t("botAccess.cloud.vpsDescription"):t("botAccess.cloud.hostedDescription"):s==="vps"?t("botAccess.cloud.vpsAutoDescription"):t("botAccess.cloud.hostedBackendDescription")}),r.jsx("div",{className:"mt-2 flex overflow-hidden rounded-lg border border-hairline/40",children:["box","vps"].map((n,a)=>r.jsx("button",{onClick:()=>e(n),className:u("flex-1 py-1.5 text-[12px]",a>0&&"border-l border-hairline/40",s===n?"bg-raised text-ink":"text-ink-secondary hover:bg-raised/60 hover:text-ink"),children:n==="vps"?t("botAccess.cloud.selfHostedVps"):t("botAccess.cloud.boat")},n))})]})}const D=[[null,"vm.dest.auto","computer.dest.autoDesc",k],["cloud","place.cloud","computer.dest.cloudDesc",v],["vm","vm.dest.vm","computer.dest.vmDesc",j],["local","vm.dest.local","computer.dest.localDesc",A],["browser","vm.dest.browser","computer.dest.browserDesc",N],["off","vm.dest.off","computer.dest.offDesc",C]];function G(s,o){return D.filter(([e])=>e===null||e==="off"||w(e,s)&&!(e==="local"&&p(o)))}function H(s,o,e){return s===null?!o||o==="local"&&p(e):o===s}function M(s,o,e){const c=s==="local"?"thisComputer":s==="vm"?"localVm":s==="cloud"?o==="vps"?"vps":"box":null;return e&&c&&!e.computers[c]?t("policy.managedBy",{organization:e.organizationName}):void 0}function R({options:s,onSelect:o}){return r.jsx("div",{role:"group","aria-label":t("computer.destinationAria"),className:"mt-3 grid auto-rows-fr grid-cols-2 gap-2",children:s.map(({mode:e,labelKey:c,descriptionKey:n,Icon:a,selected:i,managedBy:m,disabled:l,unavailableTitle:x,note:f,issue:b,view:d})=>r.jsxs("button",{disabled:l,title:x,onClick:()=>o(e),type:"button","aria-pressed":i,className:u("min-w-0 rounded-lg border px-2.5 py-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-card",i?"border-accent/60 bg-accent/10 text-ink":"border-hairline/50 bg-panel/30 text-ink-secondary",l?"cursor-not-allowed":"hover:border-accent/40 hover:bg-control/60"),children:[r.jsxs("span",{className:"flex items-center gap-2 text-[12px] font-medium leading-4",children:[i?r.jsx(g,{size:14,className:"shrink-0 text-accent"}):r.jsx(a,{size:14,className:"shrink-0 text-ink-secondary"}),r.jsx("span",{children:t(c)})]}),r.jsx("span",{className:"mt-1.5 block text-[11px] leading-4 text-ink-secondary",children:m??f??(l?d.line:b?d.short:t(n))})]},e??"auto"))})}export{z as C,R as W,H as a,M as p,G as w};
1
+ import{j as r,t,a as u,g as v,f as g}from"./styles-BHtUK2qB.js";import{u as h,a2 as k,a3 as j,G as N,a4 as w,a5 as p}from"./App-BgFOjdcx.js";import{M as A}from"./monitor-7oLB-7rZ.js";import{g as C}from"./PlacesRail-CUntVv3u.js";function z({value:s,compact:o=!1,onChange:e}){const{state:c}=h();return c.config?.cloudHome?null:r.jsxs("div",{className:"mt-3 rounded-lg bg-inset p-3",children:[r.jsx("div",{className:"text-[12px] font-medium text-ink",children:o?t("botAccess.cloud.provider"):t("botAccess.cloud.backend")}),r.jsx("div",{className:"mt-0.5 text-[12px] text-ink-secondary",children:o?s==="vps"?t("botAccess.cloud.vpsDescription"):t("botAccess.cloud.hostedDescription"):s==="vps"?t("botAccess.cloud.vpsAutoDescription"):t("botAccess.cloud.hostedBackendDescription")}),r.jsx("div",{className:"mt-2 flex overflow-hidden rounded-lg border border-hairline/40",children:["box","vps"].map((n,a)=>r.jsx("button",{onClick:()=>e(n),className:u("flex-1 py-1.5 text-[12px]",a>0&&"border-l border-hairline/40",s===n?"bg-raised text-ink":"text-ink-secondary hover:bg-raised/60 hover:text-ink"),children:n==="vps"?t("botAccess.cloud.selfHostedVps"):t("botAccess.cloud.boat")},n))})]})}const D=[[null,"vm.dest.auto","computer.dest.autoDesc",k],["cloud","place.cloud","computer.dest.cloudDesc",v],["vm","vm.dest.vm","computer.dest.vmDesc",j],["local","vm.dest.local","computer.dest.localDesc",A],["browser","vm.dest.browser","computer.dest.browserDesc",N],["off","vm.dest.off","computer.dest.offDesc",C]];function G(s,o){return D.filter(([e])=>e===null||e==="off"||w(e,s)&&!(e==="local"&&p(o)))}function H(s,o,e){return s===null?!o||o==="local"&&p(e):o===s}function M(s,o,e){const c=s==="local"?"thisComputer":s==="vm"?"localVm":s==="cloud"?o==="vps"?"vps":"box":null;return e&&c&&!e.computers[c]?t("policy.managedBy",{organization:e.organizationName}):void 0}function R({options:s,onSelect:o}){return r.jsx("div",{role:"group","aria-label":t("computer.destinationAria"),className:"mt-3 grid auto-rows-fr grid-cols-2 gap-2",children:s.map(({mode:e,labelKey:c,descriptionKey:n,Icon:a,selected:i,managedBy:m,disabled:l,unavailableTitle:x,note:f,issue:b,view:d})=>r.jsxs("button",{disabled:l,title:x,onClick:()=>o(e),type:"button","aria-pressed":i,className:u("min-w-0 rounded-lg border px-2.5 py-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-card",i?"border-accent/60 bg-accent/10 text-ink":"border-hairline/50 bg-panel/30 text-ink-secondary",l?"cursor-not-allowed":"hover:border-accent/40 hover:bg-control/60"),children:[r.jsxs("span",{className:"flex items-center gap-2 text-[12px] font-medium leading-4",children:[i?r.jsx(g,{size:14,className:"shrink-0 text-accent"}):r.jsx(a,{size:14,className:"shrink-0 text-ink-secondary"}),r.jsx("span",{children:t(c)})]}),r.jsx("span",{className:"mt-1.5 block text-[11px] leading-4 text-ink-secondary",children:m??f??(l?d.line:b?d.short:t(n))})]},e??"auto"))})}export{z as C,R as W,H as a,M as p,G as w};
@@ -1,4 +1,4 @@
1
- import{fc as xe,de as rt,d9 as Mt,fd as jt,fe as Dt,ff as Me,dd as Wt}from"./App-DXv-5ZTc.js";import"./styles-BHtUK2qB.js";import"./index-BBObcTo5.js";import"./PlacesRail-CUntVv3u.js";import"./monitor-7oLB-7rZ.js";import"./MenuMotion-CobYpP7L.js";const je={}.hasOwnProperty;function Ft(t,e){const n=e||{};function s(r,...i){let o=s.invalid;const c=s.handlers;if(r&&je.call(r,t)){const a=String(r[t]);o=je.call(c,a)?c[a]:s.unknown}if(o)return o.call(this,r,...i)}return s.handlers=n.handlers||{},s.invalid=n.invalid,s.unknown=n.unknown,s}var S=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function qt(t){return Le(t)}function Le(t){return Array.isArray(t)?zt(t):t instanceof RegExp?t:typeof t=="object"?Ht(t):t}function zt(t){let e=[];for(let n=0,s=t.length;n<s;n++)e[n]=Le(t[n]);return e}function Ht(t){let e={};for(let n in t)e[n]=Le(t[n]);return e}function it(t,...e){return e.forEach(n=>{for(let s in n)t[s]=n[s]}),t}function ot(t){const e=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return e===0?t:~e===t.length-1?ot(t.substring(0,t.length-1)):t.substr(~e+1)}var ge=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,U=class{static hasCaptures(t){return t===null?!1:(ge.lastIndex=0,ge.test(t))}static replaceCaptures(t,e,n){return t.replace(ge,(s,r,i,o)=>{let c=n[parseInt(r||i,10)];if(c){let a=e.substring(c.start,c.end);for(;a[0]===".";)a=a.substring(1);switch(o){case"downcase":return a.toLowerCase();case"upcase":return a.toUpperCase();default:return a}}else return s})}};function at(t,e){return t<e?-1:t>e?1:0}function ct(t,e){if(t===null&&e===null)return 0;if(!t)return-1;if(!e)return 1;let n=t.length,s=e.length;if(n===s){for(let r=0;r<n;r++){let i=at(t[r],e[r]);if(i!==0)return i}return 0}return n-s}function De(t){return!!(/^#[0-9a-f]{6}$/i.test(t)||/^#[0-9a-f]{8}$/i.test(t)||/^#[0-9a-f]{3}$/i.test(t)||/^#[0-9a-f]{4}$/i.test(t))}function lt(t){return t.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var ut=class{constructor(t){this.fn=t}cache=new Map;get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.fn(t);return this.cache.set(t,e),e}},Q=class{constructor(t,e,n){this._colorMap=t,this._defaults=e,this._root=n}static createFromRawTheme(t,e){return this.createFromParsedTheme(Vt(t),e)}static createFromParsedTheme(t,e){return Jt(t,e)}_cachedMatchRoot=new ut(t=>this._root.match(t));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(t){if(t===null)return this._defaults;const e=t.scopeName,s=this._cachedMatchRoot.get(e).find(r=>Ut(t.parent,r.parentScopes));return s?new ht(s.fontStyle,s.foreground,s.background):null}},me=class Y{constructor(e,n){this.parent=e,this.scopeName=n}static push(e,n){for(const s of n)e=new Y(e,s);return e}static from(...e){let n=null;for(let s=0;s<e.length;s++)n=new Y(n,e[s]);return n}push(e){return new Y(this,e)}getSegments(){let e=this;const n=[];for(;e;)n.push(e.scopeName),e=e.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){const n=[];let s=this;for(;s&&s!==e;)n.push(s.scopeName),s=s.parent;return s===e?n.reverse():void 0}};function Ut(t,e){if(e.length===0)return!0;for(let n=0;n<e.length;n++){let s=e[n],r=!1;if(s===">"){if(n===e.length-1)return!1;s=e[++n],r=!0}for(;t&&!Kt(t.scopeName,s);){if(r)return!1;t=t.parent}if(!t)return!1;t=t.parent}return!0}function Kt(t,e){return e===t||t.startsWith(e)&&t[e.length]==="."}var ht=class{constructor(t,e,n){this.fontStyle=t,this.foregroundId=e,this.backgroundId=n}};function Vt(t){if(!t)return[];if(!t.settings||!Array.isArray(t.settings))return[];let e=t.settings,n=[],s=0;for(let r=0,i=e.length;r<i;r++){let o=e[r];if(!o.settings)continue;let c;if(typeof o.scope=="string"){let h=o.scope;h=h.replace(/^[,]+/,""),h=h.replace(/[,]+$/,""),c=h.split(",")}else Array.isArray(o.scope)?c=o.scope:c=[""];let a=-1;if(typeof o.settings.fontStyle=="string"){a=0;let h=o.settings.fontStyle.split(" ");for(let d=0,f=h.length;d<f;d++)switch(h[d]){case"italic":a=a|1;break;case"bold":a=a|2;break;case"underline":a=a|4;break;case"strikethrough":a=a|8;break}}let l=null;typeof o.settings.foreground=="string"&&De(o.settings.foreground)&&(l=o.settings.foreground);let u=null;typeof o.settings.background=="string"&&De(o.settings.background)&&(u=o.settings.background);for(let h=0,d=c.length;h<d;h++){let p=c[h].trim().split(" "),y=p[p.length-1],_=null;p.length>1&&(_=p.slice(0,p.length-1),_.reverse()),n[s++]=new Yt(y,_,r,a,l,u)}}return n}var Yt=class{constructor(t,e,n,s,r,i){this.scope=t,this.parentScopes=e,this.index=n,this.fontStyle=s,this.foreground=r,this.background=i}},k=(t=>(t[t.NotSet=-1]="NotSet",t[t.None=0]="None",t[t.Italic=1]="Italic",t[t.Bold=2]="Bold",t[t.Underline=4]="Underline",t[t.Strikethrough=8]="Strikethrough",t))(k||{});function Jt(t,e){t.sort((a,l)=>{let u=at(a.scope,l.scope);return u!==0||(u=ct(a.parentScopes,l.parentScopes),u!==0)?u:a.index-l.index});let n=0,s="#000000",r="#ffffff";for(;t.length>=1&&t[0].scope==="";){let a=t.shift();a.fontStyle!==-1&&(n=a.fontStyle),a.foreground!==null&&(s=a.foreground),a.background!==null&&(r=a.background)}let i=new Qt(e),o=new ht(n,i.getId(s),i.getId(r)),c=new Zt(new Ce(0,null,-1,0,0),[]);for(let a=0,l=t.length;a<l;a++){let u=t[a];c.insert(0,u.scope,u.parentScopes,u.fontStyle,i.getId(u.foreground),i.getId(u.background))}return new Q(i,o,c)}var Qt=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(t){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(t)){this._isFrozen=!0;for(let e=0,n=t.length;e<n;e++)this._color2id[t[e]]=e,this._id2color[e]=t[e]}else this._isFrozen=!1}getId(t){if(t===null)return 0;t=t.toUpperCase();let e=this._color2id[t];if(e)return e;if(this._isFrozen)throw new Error(`Missing color in color map - ${t}`);return e=++this._lastColorId,this._color2id[t]=e,this._id2color[e]=t,e}getColorMap(){return this._id2color.slice(0)}},Xt=Object.freeze([]),Ce=class ft{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,n,s,r,i){this.scopeDepth=e,this.parentScopes=n||Xt,this.fontStyle=s,this.foreground=r,this.background=i}clone(){return new ft(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let n=[];for(let s=0,r=e.length;s<r;s++)n[s]=e[s].clone();return n}acceptOverwrite(e,n,s,r){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,n!==-1&&(this.fontStyle=n),s!==0&&(this.foreground=s),r!==0&&(this.background=r)}},Zt=class we{constructor(e,n=[],s={}){this._mainRule=e,this._children=s,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(e,n){if(e.scopeDepth!==n.scopeDepth)return n.scopeDepth-e.scopeDepth;let s=0,r=0;for(;e.parentScopes[s]===">"&&s++,n.parentScopes[r]===">"&&r++,!(s>=e.parentScopes.length||r>=n.parentScopes.length);){const i=n.parentScopes[r].length-e.parentScopes[s].length;if(i!==0)return i;s++,r++}return n.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let s=e.indexOf("."),r,i;if(s===-1?(r=e,i=""):(r=e.substring(0,s),i=e.substring(s+1)),this._children.hasOwnProperty(r))return this._children[r].match(i)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(we._cmpBySpecificity),n}insert(e,n,s,r,i,o){if(n===""){this._doInsertHere(e,s,r,i,o);return}let c=n.indexOf("."),a,l;c===-1?(a=n,l=""):(a=n.substring(0,c),l=n.substring(c+1));let u;this._children.hasOwnProperty(a)?u=this._children[a]:(u=new we(this._mainRule.clone(),Ce.cloneArr(this._rulesWithParentScopes)),this._children[a]=u),u.insert(e+1,l,s,r,i,o)}_doInsertHere(e,n,s,r,i){if(n===null){this._mainRule.acceptOverwrite(e,s,r,i);return}for(let o=0,c=this._rulesWithParentScopes.length;o<c;o++){let a=this._rulesWithParentScopes[o];if(ct(a.parentScopes,n)===0){a.acceptOverwrite(e,s,r,i);return}}s===-1&&(s=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new Ce(e,n,s,r,i))}},G=class v{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const n=v.getLanguageId(e),s=v.getTokenType(e),r=v.getFontStyle(e),i=v.getForeground(e),o=v.getBackground(e);console.log({languageId:n,tokenType:s,fontStyle:r,foreground:i,background:o})}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,n,s,r,i,o,c){let a=v.getLanguageId(e),l=v.getTokenType(e),u=v.containsBalancedBrackets(e)?1:0,h=v.getFontStyle(e),d=v.getForeground(e),f=v.getBackground(e);return n!==0&&(a=n),s!==8&&(l=s),r!==null&&(u=r?1:0),i!==-1&&(h=i),o!==0&&(d=o),c!==0&&(f=c),(a<<0|l<<8|u<<10|h<<11|d<<15|f<<24)>>>0}};function X(t,e){const n=[],s=en(t);let r=s.next();for(;r!==null;){let a=0;if(r.length===2&&r.charAt(1)===":"){switch(r.charAt(0)){case"R":a=1;break;case"L":a=-1;break;default:console.log(`Unknown priority ${r} in scope selector`)}r=s.next()}let l=o();if(n.push({matcher:l,priority:a}),r!==",")break;r=s.next()}return n;function i(){if(r==="-"){r=s.next();const a=i();return l=>!!a&&!a(l)}if(r==="("){r=s.next();const a=c();return r===")"&&(r=s.next()),a}if(We(r)){const a=[];do a.push(r),r=s.next();while(We(r));return l=>e(a,l)}return null}function o(){const a=[];let l=i();for(;l;)a.push(l),l=i();return u=>a.every(h=>h(u))}function c(){const a=[];let l=o();for(;l&&(a.push(l),r==="|"||r===",");){do r=s.next();while(r==="|"||r===",");l=o()}return u=>a.some(h=>h(u))}}function We(t){return!!t&&!!t.match(/[\w\.:]+/)}function en(t){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=e.exec(t);return{next:()=>{if(!n)return null;const s=n[0];return n=e.exec(t),s}}}function dt(t){typeof t.dispose=="function"&&t.dispose()}var D=class{constructor(t){this.scopeName=t}toKey(){return this.scopeName}},tn=class{constructor(t,e){this.scopeName=t,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},nn=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(t){const e=t.toKey();this._seenReferenceKeys.has(e)||(this._seenReferenceKeys.add(e),this._references.push(t))}},sn=class{constructor(t,e){this.repo=t,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new D(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const t=this.Q;this.Q=[];const e=new nn;for(const n of t)rn(n,this.initialScopeName,this.repo,e);for(const n of e.references)if(n instanceof D){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function rn(t,e,n,s){const r=n.lookup(t.scopeName);if(!r){if(t.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const i=n.lookup(e);t instanceof D?J({baseGrammar:i,selfGrammar:r},s):Re(t.ruleName,{baseGrammar:i,selfGrammar:r,repository:r.repository},s);const o=n.injections(t.scopeName);if(o)for(const c of o)s.add(new D(c))}function Re(t,e,n){if(e.repository&&e.repository[t]){const s=e.repository[t];Z([s],e,n)}}function J(t,e){t.selfGrammar.patterns&&Array.isArray(t.selfGrammar.patterns)&&Z(t.selfGrammar.patterns,{...t,repository:t.selfGrammar.repository},e),t.selfGrammar.injections&&Z(Object.values(t.selfGrammar.injections),{...t,repository:t.selfGrammar.repository},e)}function Z(t,e,n){for(const s of t){if(n.visitedRule.has(s))continue;n.visitedRule.add(s);const r=s.repository?it({},e.repository,s.repository):e.repository;Array.isArray(s.patterns)&&Z(s.patterns,{...e,repository:r},n);const i=s.include;if(!i)continue;const o=pt(i);switch(o.kind){case 0:J({...e,selfGrammar:e.baseGrammar},n);break;case 1:J(e,n);break;case 2:Re(o.ruleName,{...e,repository:r},n);break;case 3:case 4:const c=o.scopeName===e.selfGrammar.scopeName?e.selfGrammar:o.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(c){const a={baseGrammar:e.baseGrammar,selfGrammar:c,repository:r};o.kind===4?Re(o.ruleName,a,n):J(a,n)}else o.kind===4?n.add(new tn(o.scopeName,o.ruleName)):n.add(new D(o.scopeName));break}}}var on=class{kind=0},an=class{kind=1},cn=class{constructor(t){this.ruleName=t}kind=2},ln=class{constructor(t){this.scopeName=t}kind=3},un=class{constructor(t,e){this.scopeName=t,this.ruleName=e}kind=4};function pt(t){if(t==="$base")return new on;if(t==="$self")return new an;const e=t.indexOf("#");if(e===-1)return new ln(t);if(e===0)return new cn(t.substring(1));{const n=t.substring(0,e),s=t.substring(e+1);return new un(n,s)}}var hn=/\\(\d+)/,Fe=/\\(\d+)/g,fn=-1,gt=-2;var z=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(t,e,n,s){this.$location=t,this.id=e,this._name=n||null,this._nameIsCapturing=U.hasCaptures(this._name),this._contentName=s||null,this._contentNameIsCapturing=U.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${ot(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${t}`}getName(t,e){return!this._nameIsCapturing||this._name===null||t===null||e===null?this._name:U.replaceCaptures(this._name,t,e)}getContentName(t,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:U.replaceCaptures(this._contentName,t,e)}},dn=class extends z{retokenizeCapturedWithRuleId;constructor(t,e,n,s,r){super(t,e,n,s),this.retokenizeCapturedWithRuleId=r}dispose(){}collectPatterns(t,e){throw new Error("Not supported!")}compile(t,e){throw new Error("Not supported!")}compileAG(t,e,n,s){throw new Error("Not supported!")}},pn=class extends z{_match;captures;_cachedCompiledPatterns;constructor(t,e,n,s,r){super(t,e,n,null),this._match=new W(s,this.id),this.captures=r,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,e){e.push(this._match)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,s){return this._getCachedCompiledPatterns(t).compileAG(t,n,s)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new F,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},qe=class extends z{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,s,r){super(t,e,n,s),this.patterns=r.patterns,this.hasMissingPatterns=r.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,e){for(const n of this.patterns)t.getRule(n).collectPatterns(t,e)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,s){return this._getCachedCompiledPatterns(t).compileAG(t,n,s)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new F,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Ne=class extends z{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,s,r,i,o,c,a,l){super(t,e,n,s),this._begin=new W(r,this.id),this.beginCaptures=i,this._end=new W(o||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=c,this.applyEndPatternLast=a||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.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(t,e){return this._end.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t,e).compile(t)}compileAG(t,e,n,s){return this._getCachedCompiledPatterns(t,e).compileAG(t,n,s)}_getCachedCompiledPatterns(t,e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new F;for(const n of this.patterns)t.getRule(n).collectPatterns(t,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}},ee=class extends z{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(t,e,n,s,r,i,o,c,a){super(t,e,n,s),this._begin=new W(r,this.id),this.beginCaptures=i,this.whileCaptures=c,this._while=new W(o,gt),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=a.patterns,this.hasMissingPatterns=a.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(t,e){return this._while.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,s){return this._getCachedCompiledPatterns(t).compileAG(t,n,s)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new F;for(const e of this.patterns)t.getRule(e).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,e){return this._getCachedCompiledWhilePatterns(t,e).compile(t)}compileWhileAG(t,e,n,s){return this._getCachedCompiledWhilePatterns(t,e).compileAG(t,n,s)}_getCachedCompiledWhilePatterns(t,e){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new F,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,e||"￿"),this._cachedCompiledWhilePatterns}},mt=class N{static createCaptureRule(e,n,s,r,i){return e.registerRule(o=>new dn(n,o,s,r,i))}static getCompiledRuleId(e,n,s){return e.id||n.registerRule(r=>{if(e.id=r,e.match)return new pn(e.$vscodeTextmateLocation,e.id,e.name,e.match,N._compileCaptures(e.captures,n,s));if(typeof e.begin>"u"){e.repository&&(s=it({},s,e.repository));let i=e.patterns;return typeof i>"u"&&e.include&&(i=[{include:e.include}]),new qe(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,N._compilePatterns(i,n,s))}return e.while?new ee(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,N._compileCaptures(e.beginCaptures||e.captures,n,s),e.while,N._compileCaptures(e.whileCaptures||e.captures,n,s),N._compilePatterns(e.patterns,n,s)):new Ne(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,N._compileCaptures(e.beginCaptures||e.captures,n,s),e.end,N._compileCaptures(e.endCaptures||e.captures,n,s),e.applyEndPatternLast,N._compilePatterns(e.patterns,n,s))}),e.id}static _compileCaptures(e,n,s){let r=[];if(e){let i=0;for(const o in e){if(o==="$vscodeTextmateLocation")continue;const c=parseInt(o,10);c>i&&(i=c)}for(let o=0;o<=i;o++)r[o]=null;for(const o in e){if(o==="$vscodeTextmateLocation")continue;const c=parseInt(o,10);let a=0;e[o].patterns&&(a=N.getCompiledRuleId(e[o],n,s)),r[c]=N.createCaptureRule(n,e[o].$vscodeTextmateLocation,e[o].name,e[o].contentName,a)}}return r}static _compilePatterns(e,n,s){let r=[];if(e)for(let i=0,o=e.length;i<o;i++){const c=e[i];let a=-1;if(c.include){const l=pt(c.include);switch(l.kind){case 0:case 1:a=N.getCompiledRuleId(s[c.include],n,s);break;case 2:let u=s[l.ruleName];u&&(a=N.getCompiledRuleId(u,n,s));break;case 3:case 4:const h=l.scopeName,d=l.kind===4?l.ruleName:null,f=n.getExternalGrammar(h,s);if(f)if(d){let p=f.repository[d];p&&(a=N.getCompiledRuleId(p,n,f.repository))}else a=N.getCompiledRuleId(f.repository.$self,n,f.repository);break}}else a=N.getCompiledRuleId(c,n,s);if(a!==-1){const l=n.getRule(a);let u=!1;if((l instanceof qe||l instanceof Ne||l instanceof ee)&&l.hasMissingPatterns&&l.patterns.length===0&&(u=!0),u)continue;r.push(a)}}return{patterns:r,hasMissingPatterns:(e?e.length:0)!==r.length}}},W=class _t{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,n){if(e&&typeof e=="string"){const s=e.length;let r=0,i=[],o=!1;for(let c=0;c<s;c++)if(e.charAt(c)==="\\"&&c+1<s){const l=e.charAt(c+1);l==="z"?(i.push(e.substring(r,c)),i.push("$(?!\\n)(?<!\\n)"),r=c+2):(l==="A"||l==="G")&&(o=!0),c++}this.hasAnchor=o,r===0?this.source=e:(i.push(e.substring(r,s)),this.source=i.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=hn.test(this.source):this.hasBackReferences=!1}clone(){return new _t(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let s=n.map(r=>e.substring(r.start,r.end));return Fe.lastIndex=0,this.source.replace(Fe,(r,i)=>lt(s[parseInt(i,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let e=[],n=[],s=[],r=[],i,o,c,a;for(i=0,o=this.source.length;i<o;i++)c=this.source.charAt(i),e[i]=c,n[i]=c,s[i]=c,r[i]=c,c==="\\"&&i+1<o&&(a=this.source.charAt(i+1),a==="A"?(e[i+1]="￿",n[i+1]="￿",s[i+1]="A",r[i+1]="A"):a==="G"?(e[i+1]="￿",n[i+1]="G",s[i+1]="￿",r[i+1]="G"):(e[i+1]=a,n[i+1]=a,s[i+1]=a,r[i+1]=a),i++);return{A0_G0:e.join(""),A0_G1:n.join(""),A1_G0:s.join(""),A1_G1:r.join("")}}resolveAnchors(e,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:e?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},F=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(t){this._items.push(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}unshift(t){this._items.unshift(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}length(){return this._items.length}setSource(t,e){this._items[t].source!==e&&(this._disposeCaches(),this._items[t].setSource(e))}compile(t){if(!this._cached){let e=this._items.map(n=>n.source);this._cached=new ze(t,e,this._items.map(n=>n.ruleId))}return this._cached}compileAG(t,e,n){return this._hasAnchors?e?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G0):this.compile(t)}_resolveAnchors(t,e,n){let s=this._items.map(r=>r.resolveAnchors(e,n));return new ze(t,s,this._items.map(r=>r.ruleId))}},ze=class{constructor(t,e,n){this.regExps=e,this.rules=n,this.scanner=t.createOnigScanner(e)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const t=[];for(let e=0,n=this.rules.length;e<n;e++)t.push(" - "+this.rules[e]+": "+this.regExps[e]);return t.join(`
1
+ import{fc as xe,de as rt,d9 as Mt,fd as jt,fe as Dt,ff as Me,dd as Wt}from"./App-BgFOjdcx.js";import"./styles-BHtUK2qB.js";import"./index--etc8Lh7.js";import"./PlacesRail-CUntVv3u.js";import"./monitor-7oLB-7rZ.js";import"./MenuMotion-CobYpP7L.js";const je={}.hasOwnProperty;function Ft(t,e){const n=e||{};function s(r,...i){let o=s.invalid;const c=s.handlers;if(r&&je.call(r,t)){const a=String(r[t]);o=je.call(c,a)?c[a]:s.unknown}if(o)return o.call(this,r,...i)}return s.handlers=n.handlers||{},s.invalid=n.invalid,s.unknown=n.unknown,s}var S=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function qt(t){return Le(t)}function Le(t){return Array.isArray(t)?zt(t):t instanceof RegExp?t:typeof t=="object"?Ht(t):t}function zt(t){let e=[];for(let n=0,s=t.length;n<s;n++)e[n]=Le(t[n]);return e}function Ht(t){let e={};for(let n in t)e[n]=Le(t[n]);return e}function it(t,...e){return e.forEach(n=>{for(let s in n)t[s]=n[s]}),t}function ot(t){const e=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return e===0?t:~e===t.length-1?ot(t.substring(0,t.length-1)):t.substr(~e+1)}var ge=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,U=class{static hasCaptures(t){return t===null?!1:(ge.lastIndex=0,ge.test(t))}static replaceCaptures(t,e,n){return t.replace(ge,(s,r,i,o)=>{let c=n[parseInt(r||i,10)];if(c){let a=e.substring(c.start,c.end);for(;a[0]===".";)a=a.substring(1);switch(o){case"downcase":return a.toLowerCase();case"upcase":return a.toUpperCase();default:return a}}else return s})}};function at(t,e){return t<e?-1:t>e?1:0}function ct(t,e){if(t===null&&e===null)return 0;if(!t)return-1;if(!e)return 1;let n=t.length,s=e.length;if(n===s){for(let r=0;r<n;r++){let i=at(t[r],e[r]);if(i!==0)return i}return 0}return n-s}function De(t){return!!(/^#[0-9a-f]{6}$/i.test(t)||/^#[0-9a-f]{8}$/i.test(t)||/^#[0-9a-f]{3}$/i.test(t)||/^#[0-9a-f]{4}$/i.test(t))}function lt(t){return t.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var ut=class{constructor(t){this.fn=t}cache=new Map;get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.fn(t);return this.cache.set(t,e),e}},Q=class{constructor(t,e,n){this._colorMap=t,this._defaults=e,this._root=n}static createFromRawTheme(t,e){return this.createFromParsedTheme(Vt(t),e)}static createFromParsedTheme(t,e){return Jt(t,e)}_cachedMatchRoot=new ut(t=>this._root.match(t));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(t){if(t===null)return this._defaults;const e=t.scopeName,s=this._cachedMatchRoot.get(e).find(r=>Ut(t.parent,r.parentScopes));return s?new ht(s.fontStyle,s.foreground,s.background):null}},me=class Y{constructor(e,n){this.parent=e,this.scopeName=n}static push(e,n){for(const s of n)e=new Y(e,s);return e}static from(...e){let n=null;for(let s=0;s<e.length;s++)n=new Y(n,e[s]);return n}push(e){return new Y(this,e)}getSegments(){let e=this;const n=[];for(;e;)n.push(e.scopeName),e=e.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){const n=[];let s=this;for(;s&&s!==e;)n.push(s.scopeName),s=s.parent;return s===e?n.reverse():void 0}};function Ut(t,e){if(e.length===0)return!0;for(let n=0;n<e.length;n++){let s=e[n],r=!1;if(s===">"){if(n===e.length-1)return!1;s=e[++n],r=!0}for(;t&&!Kt(t.scopeName,s);){if(r)return!1;t=t.parent}if(!t)return!1;t=t.parent}return!0}function Kt(t,e){return e===t||t.startsWith(e)&&t[e.length]==="."}var ht=class{constructor(t,e,n){this.fontStyle=t,this.foregroundId=e,this.backgroundId=n}};function Vt(t){if(!t)return[];if(!t.settings||!Array.isArray(t.settings))return[];let e=t.settings,n=[],s=0;for(let r=0,i=e.length;r<i;r++){let o=e[r];if(!o.settings)continue;let c;if(typeof o.scope=="string"){let h=o.scope;h=h.replace(/^[,]+/,""),h=h.replace(/[,]+$/,""),c=h.split(",")}else Array.isArray(o.scope)?c=o.scope:c=[""];let a=-1;if(typeof o.settings.fontStyle=="string"){a=0;let h=o.settings.fontStyle.split(" ");for(let d=0,f=h.length;d<f;d++)switch(h[d]){case"italic":a=a|1;break;case"bold":a=a|2;break;case"underline":a=a|4;break;case"strikethrough":a=a|8;break}}let l=null;typeof o.settings.foreground=="string"&&De(o.settings.foreground)&&(l=o.settings.foreground);let u=null;typeof o.settings.background=="string"&&De(o.settings.background)&&(u=o.settings.background);for(let h=0,d=c.length;h<d;h++){let p=c[h].trim().split(" "),y=p[p.length-1],_=null;p.length>1&&(_=p.slice(0,p.length-1),_.reverse()),n[s++]=new Yt(y,_,r,a,l,u)}}return n}var Yt=class{constructor(t,e,n,s,r,i){this.scope=t,this.parentScopes=e,this.index=n,this.fontStyle=s,this.foreground=r,this.background=i}},k=(t=>(t[t.NotSet=-1]="NotSet",t[t.None=0]="None",t[t.Italic=1]="Italic",t[t.Bold=2]="Bold",t[t.Underline=4]="Underline",t[t.Strikethrough=8]="Strikethrough",t))(k||{});function Jt(t,e){t.sort((a,l)=>{let u=at(a.scope,l.scope);return u!==0||(u=ct(a.parentScopes,l.parentScopes),u!==0)?u:a.index-l.index});let n=0,s="#000000",r="#ffffff";for(;t.length>=1&&t[0].scope==="";){let a=t.shift();a.fontStyle!==-1&&(n=a.fontStyle),a.foreground!==null&&(s=a.foreground),a.background!==null&&(r=a.background)}let i=new Qt(e),o=new ht(n,i.getId(s),i.getId(r)),c=new Zt(new Ce(0,null,-1,0,0),[]);for(let a=0,l=t.length;a<l;a++){let u=t[a];c.insert(0,u.scope,u.parentScopes,u.fontStyle,i.getId(u.foreground),i.getId(u.background))}return new Q(i,o,c)}var Qt=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(t){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(t)){this._isFrozen=!0;for(let e=0,n=t.length;e<n;e++)this._color2id[t[e]]=e,this._id2color[e]=t[e]}else this._isFrozen=!1}getId(t){if(t===null)return 0;t=t.toUpperCase();let e=this._color2id[t];if(e)return e;if(this._isFrozen)throw new Error(`Missing color in color map - ${t}`);return e=++this._lastColorId,this._color2id[t]=e,this._id2color[e]=t,e}getColorMap(){return this._id2color.slice(0)}},Xt=Object.freeze([]),Ce=class ft{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,n,s,r,i){this.scopeDepth=e,this.parentScopes=n||Xt,this.fontStyle=s,this.foreground=r,this.background=i}clone(){return new ft(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let n=[];for(let s=0,r=e.length;s<r;s++)n[s]=e[s].clone();return n}acceptOverwrite(e,n,s,r){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,n!==-1&&(this.fontStyle=n),s!==0&&(this.foreground=s),r!==0&&(this.background=r)}},Zt=class we{constructor(e,n=[],s={}){this._mainRule=e,this._children=s,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(e,n){if(e.scopeDepth!==n.scopeDepth)return n.scopeDepth-e.scopeDepth;let s=0,r=0;for(;e.parentScopes[s]===">"&&s++,n.parentScopes[r]===">"&&r++,!(s>=e.parentScopes.length||r>=n.parentScopes.length);){const i=n.parentScopes[r].length-e.parentScopes[s].length;if(i!==0)return i;s++,r++}return n.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let s=e.indexOf("."),r,i;if(s===-1?(r=e,i=""):(r=e.substring(0,s),i=e.substring(s+1)),this._children.hasOwnProperty(r))return this._children[r].match(i)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(we._cmpBySpecificity),n}insert(e,n,s,r,i,o){if(n===""){this._doInsertHere(e,s,r,i,o);return}let c=n.indexOf("."),a,l;c===-1?(a=n,l=""):(a=n.substring(0,c),l=n.substring(c+1));let u;this._children.hasOwnProperty(a)?u=this._children[a]:(u=new we(this._mainRule.clone(),Ce.cloneArr(this._rulesWithParentScopes)),this._children[a]=u),u.insert(e+1,l,s,r,i,o)}_doInsertHere(e,n,s,r,i){if(n===null){this._mainRule.acceptOverwrite(e,s,r,i);return}for(let o=0,c=this._rulesWithParentScopes.length;o<c;o++){let a=this._rulesWithParentScopes[o];if(ct(a.parentScopes,n)===0){a.acceptOverwrite(e,s,r,i);return}}s===-1&&(s=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new Ce(e,n,s,r,i))}},G=class v{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const n=v.getLanguageId(e),s=v.getTokenType(e),r=v.getFontStyle(e),i=v.getForeground(e),o=v.getBackground(e);console.log({languageId:n,tokenType:s,fontStyle:r,foreground:i,background:o})}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,n,s,r,i,o,c){let a=v.getLanguageId(e),l=v.getTokenType(e),u=v.containsBalancedBrackets(e)?1:0,h=v.getFontStyle(e),d=v.getForeground(e),f=v.getBackground(e);return n!==0&&(a=n),s!==8&&(l=s),r!==null&&(u=r?1:0),i!==-1&&(h=i),o!==0&&(d=o),c!==0&&(f=c),(a<<0|l<<8|u<<10|h<<11|d<<15|f<<24)>>>0}};function X(t,e){const n=[],s=en(t);let r=s.next();for(;r!==null;){let a=0;if(r.length===2&&r.charAt(1)===":"){switch(r.charAt(0)){case"R":a=1;break;case"L":a=-1;break;default:console.log(`Unknown priority ${r} in scope selector`)}r=s.next()}let l=o();if(n.push({matcher:l,priority:a}),r!==",")break;r=s.next()}return n;function i(){if(r==="-"){r=s.next();const a=i();return l=>!!a&&!a(l)}if(r==="("){r=s.next();const a=c();return r===")"&&(r=s.next()),a}if(We(r)){const a=[];do a.push(r),r=s.next();while(We(r));return l=>e(a,l)}return null}function o(){const a=[];let l=i();for(;l;)a.push(l),l=i();return u=>a.every(h=>h(u))}function c(){const a=[];let l=o();for(;l&&(a.push(l),r==="|"||r===",");){do r=s.next();while(r==="|"||r===",");l=o()}return u=>a.some(h=>h(u))}}function We(t){return!!t&&!!t.match(/[\w\.:]+/)}function en(t){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=e.exec(t);return{next:()=>{if(!n)return null;const s=n[0];return n=e.exec(t),s}}}function dt(t){typeof t.dispose=="function"&&t.dispose()}var D=class{constructor(t){this.scopeName=t}toKey(){return this.scopeName}},tn=class{constructor(t,e){this.scopeName=t,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},nn=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(t){const e=t.toKey();this._seenReferenceKeys.has(e)||(this._seenReferenceKeys.add(e),this._references.push(t))}},sn=class{constructor(t,e){this.repo=t,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new D(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const t=this.Q;this.Q=[];const e=new nn;for(const n of t)rn(n,this.initialScopeName,this.repo,e);for(const n of e.references)if(n instanceof D){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function rn(t,e,n,s){const r=n.lookup(t.scopeName);if(!r){if(t.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const i=n.lookup(e);t instanceof D?J({baseGrammar:i,selfGrammar:r},s):Re(t.ruleName,{baseGrammar:i,selfGrammar:r,repository:r.repository},s);const o=n.injections(t.scopeName);if(o)for(const c of o)s.add(new D(c))}function Re(t,e,n){if(e.repository&&e.repository[t]){const s=e.repository[t];Z([s],e,n)}}function J(t,e){t.selfGrammar.patterns&&Array.isArray(t.selfGrammar.patterns)&&Z(t.selfGrammar.patterns,{...t,repository:t.selfGrammar.repository},e),t.selfGrammar.injections&&Z(Object.values(t.selfGrammar.injections),{...t,repository:t.selfGrammar.repository},e)}function Z(t,e,n){for(const s of t){if(n.visitedRule.has(s))continue;n.visitedRule.add(s);const r=s.repository?it({},e.repository,s.repository):e.repository;Array.isArray(s.patterns)&&Z(s.patterns,{...e,repository:r},n);const i=s.include;if(!i)continue;const o=pt(i);switch(o.kind){case 0:J({...e,selfGrammar:e.baseGrammar},n);break;case 1:J(e,n);break;case 2:Re(o.ruleName,{...e,repository:r},n);break;case 3:case 4:const c=o.scopeName===e.selfGrammar.scopeName?e.selfGrammar:o.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(c){const a={baseGrammar:e.baseGrammar,selfGrammar:c,repository:r};o.kind===4?Re(o.ruleName,a,n):J(a,n)}else o.kind===4?n.add(new tn(o.scopeName,o.ruleName)):n.add(new D(o.scopeName));break}}}var on=class{kind=0},an=class{kind=1},cn=class{constructor(t){this.ruleName=t}kind=2},ln=class{constructor(t){this.scopeName=t}kind=3},un=class{constructor(t,e){this.scopeName=t,this.ruleName=e}kind=4};function pt(t){if(t==="$base")return new on;if(t==="$self")return new an;const e=t.indexOf("#");if(e===-1)return new ln(t);if(e===0)return new cn(t.substring(1));{const n=t.substring(0,e),s=t.substring(e+1);return new un(n,s)}}var hn=/\\(\d+)/,Fe=/\\(\d+)/g,fn=-1,gt=-2;var z=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(t,e,n,s){this.$location=t,this.id=e,this._name=n||null,this._nameIsCapturing=U.hasCaptures(this._name),this._contentName=s||null,this._contentNameIsCapturing=U.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${ot(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${t}`}getName(t,e){return!this._nameIsCapturing||this._name===null||t===null||e===null?this._name:U.replaceCaptures(this._name,t,e)}getContentName(t,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:U.replaceCaptures(this._contentName,t,e)}},dn=class extends z{retokenizeCapturedWithRuleId;constructor(t,e,n,s,r){super(t,e,n,s),this.retokenizeCapturedWithRuleId=r}dispose(){}collectPatterns(t,e){throw new Error("Not supported!")}compile(t,e){throw new Error("Not supported!")}compileAG(t,e,n,s){throw new Error("Not supported!")}},pn=class extends z{_match;captures;_cachedCompiledPatterns;constructor(t,e,n,s,r){super(t,e,n,null),this._match=new W(s,this.id),this.captures=r,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,e){e.push(this._match)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,s){return this._getCachedCompiledPatterns(t).compileAG(t,n,s)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new F,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},qe=class extends z{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,s,r){super(t,e,n,s),this.patterns=r.patterns,this.hasMissingPatterns=r.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,e){for(const n of this.patterns)t.getRule(n).collectPatterns(t,e)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,s){return this._getCachedCompiledPatterns(t).compileAG(t,n,s)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new F,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Ne=class extends z{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,s,r,i,o,c,a,l){super(t,e,n,s),this._begin=new W(r,this.id),this.beginCaptures=i,this._end=new W(o||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=c,this.applyEndPatternLast=a||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.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(t,e){return this._end.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t,e).compile(t)}compileAG(t,e,n,s){return this._getCachedCompiledPatterns(t,e).compileAG(t,n,s)}_getCachedCompiledPatterns(t,e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new F;for(const n of this.patterns)t.getRule(n).collectPatterns(t,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}},ee=class extends z{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(t,e,n,s,r,i,o,c,a){super(t,e,n,s),this._begin=new W(r,this.id),this.beginCaptures=i,this.whileCaptures=c,this._while=new W(o,gt),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=a.patterns,this.hasMissingPatterns=a.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(t,e){return this._while.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,s){return this._getCachedCompiledPatterns(t).compileAG(t,n,s)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new F;for(const e of this.patterns)t.getRule(e).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,e){return this._getCachedCompiledWhilePatterns(t,e).compile(t)}compileWhileAG(t,e,n,s){return this._getCachedCompiledWhilePatterns(t,e).compileAG(t,n,s)}_getCachedCompiledWhilePatterns(t,e){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new F,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,e||"￿"),this._cachedCompiledWhilePatterns}},mt=class N{static createCaptureRule(e,n,s,r,i){return e.registerRule(o=>new dn(n,o,s,r,i))}static getCompiledRuleId(e,n,s){return e.id||n.registerRule(r=>{if(e.id=r,e.match)return new pn(e.$vscodeTextmateLocation,e.id,e.name,e.match,N._compileCaptures(e.captures,n,s));if(typeof e.begin>"u"){e.repository&&(s=it({},s,e.repository));let i=e.patterns;return typeof i>"u"&&e.include&&(i=[{include:e.include}]),new qe(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,N._compilePatterns(i,n,s))}return e.while?new ee(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,N._compileCaptures(e.beginCaptures||e.captures,n,s),e.while,N._compileCaptures(e.whileCaptures||e.captures,n,s),N._compilePatterns(e.patterns,n,s)):new Ne(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,N._compileCaptures(e.beginCaptures||e.captures,n,s),e.end,N._compileCaptures(e.endCaptures||e.captures,n,s),e.applyEndPatternLast,N._compilePatterns(e.patterns,n,s))}),e.id}static _compileCaptures(e,n,s){let r=[];if(e){let i=0;for(const o in e){if(o==="$vscodeTextmateLocation")continue;const c=parseInt(o,10);c>i&&(i=c)}for(let o=0;o<=i;o++)r[o]=null;for(const o in e){if(o==="$vscodeTextmateLocation")continue;const c=parseInt(o,10);let a=0;e[o].patterns&&(a=N.getCompiledRuleId(e[o],n,s)),r[c]=N.createCaptureRule(n,e[o].$vscodeTextmateLocation,e[o].name,e[o].contentName,a)}}return r}static _compilePatterns(e,n,s){let r=[];if(e)for(let i=0,o=e.length;i<o;i++){const c=e[i];let a=-1;if(c.include){const l=pt(c.include);switch(l.kind){case 0:case 1:a=N.getCompiledRuleId(s[c.include],n,s);break;case 2:let u=s[l.ruleName];u&&(a=N.getCompiledRuleId(u,n,s));break;case 3:case 4:const h=l.scopeName,d=l.kind===4?l.ruleName:null,f=n.getExternalGrammar(h,s);if(f)if(d){let p=f.repository[d];p&&(a=N.getCompiledRuleId(p,n,f.repository))}else a=N.getCompiledRuleId(f.repository.$self,n,f.repository);break}}else a=N.getCompiledRuleId(c,n,s);if(a!==-1){const l=n.getRule(a);let u=!1;if((l instanceof qe||l instanceof Ne||l instanceof ee)&&l.hasMissingPatterns&&l.patterns.length===0&&(u=!0),u)continue;r.push(a)}}return{patterns:r,hasMissingPatterns:(e?e.length:0)!==r.length}}},W=class _t{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,n){if(e&&typeof e=="string"){const s=e.length;let r=0,i=[],o=!1;for(let c=0;c<s;c++)if(e.charAt(c)==="\\"&&c+1<s){const l=e.charAt(c+1);l==="z"?(i.push(e.substring(r,c)),i.push("$(?!\\n)(?<!\\n)"),r=c+2):(l==="A"||l==="G")&&(o=!0),c++}this.hasAnchor=o,r===0?this.source=e:(i.push(e.substring(r,s)),this.source=i.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=hn.test(this.source):this.hasBackReferences=!1}clone(){return new _t(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let s=n.map(r=>e.substring(r.start,r.end));return Fe.lastIndex=0,this.source.replace(Fe,(r,i)=>lt(s[parseInt(i,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let e=[],n=[],s=[],r=[],i,o,c,a;for(i=0,o=this.source.length;i<o;i++)c=this.source.charAt(i),e[i]=c,n[i]=c,s[i]=c,r[i]=c,c==="\\"&&i+1<o&&(a=this.source.charAt(i+1),a==="A"?(e[i+1]="￿",n[i+1]="￿",s[i+1]="A",r[i+1]="A"):a==="G"?(e[i+1]="￿",n[i+1]="G",s[i+1]="￿",r[i+1]="G"):(e[i+1]=a,n[i+1]=a,s[i+1]=a,r[i+1]=a),i++);return{A0_G0:e.join(""),A0_G1:n.join(""),A1_G0:s.join(""),A1_G1:r.join("")}}resolveAnchors(e,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:e?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},F=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(t){this._items.push(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}unshift(t){this._items.unshift(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}length(){return this._items.length}setSource(t,e){this._items[t].source!==e&&(this._disposeCaches(),this._items[t].setSource(e))}compile(t){if(!this._cached){let e=this._items.map(n=>n.source);this._cached=new ze(t,e,this._items.map(n=>n.ruleId))}return this._cached}compileAG(t,e,n){return this._hasAnchors?e?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G0):this.compile(t)}_resolveAnchors(t,e,n){let s=this._items.map(r=>r.resolveAnchors(e,n));return new ze(t,s,this._items.map(r=>r.ruleId))}},ze=class{constructor(t,e,n){this.regExps=e,this.rules=n,this.scanner=t.createOnigScanner(e)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const t=[];for(let e=0,n=this.rules.length;e<n;e++)t.push(" - "+this.rules[e]+": "+this.regExps[e]);return t.join(`
2
2
  `)}findNextMatchSync(t,e,n){const s=this.scanner.findNextMatchSync(t,e,n);return s?{ruleId:this.rules[s.index],captureIndices:s.captureIndices}:null}},_e=class{constructor(t,e){this.languageId=t,this.tokenType=e}},gn=class ke{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,n){this._defaultAttributes=new _e(e,8),this._embeddedLanguagesMatcher=new mn(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(e){return e===null?ke._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(e)}static _NULL_SCOPE_METADATA=new _e(0,0);_getBasicScopeAttributes=new ut(e=>{const n=this._scopeToLanguage(e),s=this._toStandardTokenType(e);return new _e(n,s)});_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(e){const n=e.match(ke.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[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/},mn=class{values;scopesRegExp;constructor(t){if(t.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(t);const e=t.map(([n,s])=>lt(n));e.sort(),e.reverse(),this.scopesRegExp=new RegExp(`^((${e.join(")|(")}))($|\\.)`,"")}}match(t){if(!this.scopesRegExp)return;const e=t.match(this.scopesRegExp);if(e)return this.values.get(e[1])}},He=class{constructor(t,e){this.stack=t,this.stoppedEarly=e}};function yt(t,e,n,s,r,i,o,c){const a=e.content.length;let l=!1,u=-1;if(o){const f=_n(t,e,n,s,r,i);r=f.stack,s=f.linePos,n=f.isFirstLine,u=f.anchorPosition}const h=Date.now();for(;!l;){if(c!==0&&Date.now()-h>c)return new He(r,!0);d()}return new He(r,!1);function d(){const f=yn(t,e,n,s,r,u);if(!f){i.produce(r,a),l=!0;return}const p=f.captureIndices,y=f.matchedRuleId,_=p&&p.length>0?p[0].end>s:!1;if(y===fn){const m=r.getRule(t);i.produce(r,p[0].start),r=r.withContentNameScopesList(r.nameScopesList),M(t,e,n,r,i,m.endCaptures,p),i.produce(r,p[0].end);const g=r;if(r=r.parent,u=g.getAnchorPos(),!_&&g.getEnterPos()===s){r=g,i.produce(r,a),l=!0;return}}else{const m=t.getRule(y);i.produce(r,p[0].start);const g=r,b=m.getName(e.content,p),C=r.contentNameScopesList.pushAttributed(b,t);if(r=r.push(y,s,u,p[0].end===a,null,C,C),m instanceof Ne){const R=m;M(t,e,n,r,i,R.beginCaptures,p),i.produce(r,p[0].end),u=p[0].end;const A=R.getContentName(e.content,p),E=C.pushAttributed(A,t);if(r=r.withContentNameScopesList(E),R.endHasBackReferences&&(r=r.withEndRule(R.getEndWithResolvedBackReferences(e.content,p))),!_&&g.hasSameRuleAs(r)){r=r.pop(),i.produce(r,a),l=!0;return}}else if(m instanceof ee){const R=m;M(t,e,n,r,i,R.beginCaptures,p),i.produce(r,p[0].end),u=p[0].end;const A=R.getContentName(e.content,p),E=C.pushAttributed(A,t);if(r=r.withContentNameScopesList(E),R.whileHasBackReferences&&(r=r.withEndRule(R.getWhileWithResolvedBackReferences(e.content,p))),!_&&g.hasSameRuleAs(r)){r=r.pop(),i.produce(r,a),l=!0;return}}else if(M(t,e,n,r,i,m.captures,p),i.produce(r,p[0].end),r=r.pop(),!_){r=r.safePop(),i.produce(r,a),l=!0;return}}p[0].end>s&&(s=p[0].end,n=!1)}}function _n(t,e,n,s,r,i){let o=r.beginRuleCapturedEOL?0:-1;const c=[];for(let a=r;a;a=a.pop()){const l=a.getRule(t);l instanceof ee&&c.push({rule:l,stack:a})}for(let a=c.pop();a;a=c.pop()){const{ruleScanner:l,findOptions:u}=Cn(a.rule,t,a.stack.endRule,n,s===o),h=l.findNextMatchSync(e,s,u);if(h){if(h.ruleId!==gt){r=a.stack.pop();break}h.captureIndices&&h.captureIndices.length&&(i.produce(a.stack,h.captureIndices[0].start),M(t,e,n,a.stack,i,a.rule.whileCaptures,h.captureIndices),i.produce(a.stack,h.captureIndices[0].end),o=h.captureIndices[0].end,h.captureIndices[0].end>s&&(s=h.captureIndices[0].end,n=!1))}else{r=a.stack.pop();break}}return{stack:r,linePos:s,anchorPosition:o,isFirstLine:n}}function yn(t,e,n,s,r,i){const o=bn(t,e,n,s,r,i),c=t.getInjections();if(c.length===0)return o;const a=Sn(c,t,e,n,s,r,i);if(!a)return o;if(!o)return a;const l=o.captureIndices[0].start,u=a.captureIndices[0].start;return u<l||a.priorityMatch&&u===l?a:o}function bn(t,e,n,s,r,i){const o=r.getRule(t),{ruleScanner:c,findOptions:a}=bt(o,t,r.endRule,n,s===i),l=c.findNextMatchSync(e,s,a);return l?{captureIndices:l.captureIndices,matchedRuleId:l.ruleId}:null}function Sn(t,e,n,s,r,i,o){let c=Number.MAX_VALUE,a=null,l,u=0;const h=i.contentNameScopesList.getScopeNames();for(let d=0,f=t.length;d<f;d++){const p=t[d];if(!p.matcher(h))continue;const y=e.getRule(p.ruleId),{ruleScanner:_,findOptions:m}=bt(y,e,null,s,r===o),g=_.findNextMatchSync(n,r,m);if(!g)continue;const b=g.captureIndices[0].start;if(!(b>=c)&&(c=b,a=g.captureIndices,l=g.ruleId,u=p.priority,c===r))break}return a?{priorityMatch:u===-1,captureIndices:a,matchedRuleId:l}:null}function bt(t,e,n,s,r){return{ruleScanner:t.compileAG(e,n,s,r),findOptions:0}}function Cn(t,e,n,s,r){return{ruleScanner:t.compileWhileAG(e,n,s,r),findOptions:0}}function M(t,e,n,s,r,i,o){if(i.length===0)return;const c=e.content,a=Math.min(i.length,o.length),l=[],u=o[0].end;for(let h=0;h<a;h++){const d=i[h];if(d===null)continue;const f=o[h];if(f.length===0)continue;if(f.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=f.start;)r.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?r.produceFromScopes(l[l.length-1].scopes,f.start):r.produce(s,f.start),d.retokenizeCapturedWithRuleId){const y=d.getName(c,o),_=s.contentNameScopesList.pushAttributed(y,t),m=d.getContentName(c,o),g=_.pushAttributed(m,t),b=s.push(d.retokenizeCapturedWithRuleId,f.start,-1,!1,null,_,g),C=t.createOnigString(c.substring(0,f.end));yt(t,C,n&&f.start===0,f.start,b,r,!1,0),dt(C);continue}const p=d.getName(c,o);if(p!==null){const _=(l.length>0?l[l.length-1].scopes:s.contentNameScopesList).pushAttributed(p,t);l.push(new wn(_,f.end))}}for(;l.length>0;)r.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var wn=class{scopes;endPos;constructor(t,e){this.scopes=t,this.endPos=e}};function Rn(t,e,n,s,r,i,o,c){return new kn(t,e,n,s,r,i,o,c)}function Ue(t,e,n,s,r){const i=X(e,te),o=mt.getCompiledRuleId(n,s,r.repository);for(const c of i)t.push({debugSelector:e,matcher:c.matcher,ruleId:o,grammar:r,priority:c.priority})}function te(t,e){if(e.length<t.length)return!1;let n=0;return t.every(s=>{for(let r=n;r<e.length;r++)if(Nn(e[r],s))return n=r+1,!0;return!1})}function Nn(t,e){if(!t)return!1;if(t===e)return!0;const n=e.length;return t.length>n&&t.substr(0,n)===e&&t[n]==="."}var kn=class{constructor(t,e,n,s,r,i,o,c){if(this._rootScopeName=t,this.balancedBracketSelectors=i,this._onigLib=c,this._basicScopeAttributesProvider=new gn(n,s),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=Ke(e,null),this._injections=null,this._tokenTypeMatchers=[],r)for(const a of Object.keys(r)){const l=X(a,te);for(const u of l)this._tokenTypeMatchers.push({matcher:u.matcher,type:r[a]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(const t of this._ruleId2desc)t&&t.dispose()}createOnigScanner(t){return this._onigLib.createOnigScanner(t)}createOnigString(t){return this._onigLib.createOnigString(t)}getMetadataForScope(t){return this._basicScopeAttributesProvider.getBasicScopeAttributes(t)}_collectInjections(){const t={lookup:r=>r===this._rootScopeName?this._grammar:this.getExternalGrammar(r),injections:r=>this._grammarRepository.injections(r)},e=[],n=this._rootScopeName,s=t.lookup(n);if(s){const r=s.injections;if(r)for(let o in r)Ue(e,o,r[o],this,s);const i=this._grammarRepository.injections(n);i&&i.forEach(o=>{const c=this.getExternalGrammar(o);if(c){const a=c.injectionSelector;a&&Ue(e,a,c,this,c)}})}return e.sort((r,i)=>r.priority-i.priority),e}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(t){const e=++this._lastRuleId,n=t(e);return this._ruleId2desc[e]=n,n}getRule(t){return this._ruleId2desc[t]}getExternalGrammar(t,e){if(this._includedGrammars[t])return this._includedGrammars[t];if(this._grammarRepository){const n=this._grammarRepository.lookup(t);if(n)return this._includedGrammars[t]=Ke(n,e&&e.$base),this._includedGrammars[t]}}tokenizeLine(t,e,n=0){const s=this._tokenize(t,e,!1,n);return{tokens:s.lineTokens.getResult(s.ruleStack,s.lineLength),ruleStack:s.ruleStack,stoppedEarly:s.stoppedEarly}}tokenizeLine2(t,e,n=0){const s=this._tokenize(t,e,!0,n);return{tokens:s.lineTokens.getBinaryResult(s.ruleStack,s.lineLength),ruleStack:s.ruleStack,stoppedEarly:s.stoppedEarly}}_tokenize(t,e,n,s){this._rootId===-1&&(this._rootId=mt.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let r;if(!e||e===Ae.NULL){r=!0;const l=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),h=G.set(0,l.languageId,l.tokenType,null,u.fontStyle,u.foregroundId,u.backgroundId),d=this.getRule(this._rootId).getName(null,null);let f;d?f=j.createRootAndLookUpScopeName(d,h,this):f=j.createRoot("unknown",h),e=new Ae(null,this._rootId,-1,-1,!1,null,f,f)}else r=!1,e.reset();t=t+`
3
3
  `;const i=this.createOnigString(t),o=i.content.length,c=new vn(n,t,this._tokenTypeMatchers,this.balancedBracketSelectors),a=yt(this,i,r,0,e,c,!0,s);return dt(i),{lineLength:o,lineTokens:c,ruleStack:a.stack,stoppedEarly:a.stoppedEarly}}};function Ke(t,e){return t=qt(t),t.repository=t.repository||{},t.repository.$self={$vscodeTextmateLocation:t.$vscodeTextmateLocation,patterns:t.patterns,name:t.scopeName},t.repository.$base=e||t.repository.$self,t}var j=class I{constructor(e,n,s){this.parent=e,this.scopePath=n,this.tokenAttributes=s}static fromExtension(e,n){let s=e,r=e?.scopePath??null;for(const i of n)r=me.push(r,i.scopeNames),s=new I(s,r,i.encodedTokenAttributes);return s}static createRoot(e,n){return new I(null,new me(null,e),n)}static createRootAndLookUpScopeName(e,n,s){const r=s.getMetadataForScope(e),i=new me(null,e),o=s.themeProvider.themeMatch(i),c=I.mergeAttributes(n,r,o);return new I(null,i,c)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(e){return I.equals(this,e)}static equals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.scopeName!==n.scopeName||e.tokenAttributes!==n.tokenAttributes)return!1;e=e.parent,n=n.parent}while(!0)}static mergeAttributes(e,n,s){let r=-1,i=0,o=0;return s!==null&&(r=s.fontStyle,i=s.foregroundId,o=s.backgroundId),G.set(e,n.languageId,n.tokenType,null,r,i,o)}pushAttributed(e,n){if(e===null)return this;if(e.indexOf(" ")===-1)return I._pushAttributed(this,e,n);const s=e.split(/ /g);let r=this;for(const i of s)r=I._pushAttributed(r,i,n);return r}static _pushAttributed(e,n,s){const r=s.getMetadataForScope(n),i=e.scopePath.push(n),o=s.themeProvider.themeMatch(i),c=I.mergeAttributes(e.tokenAttributes,r,o);return new I(e,i,c)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){const n=[];let s=this;for(;s&&s!==e;)n.push({encodedTokenAttributes:s.tokenAttributes,scopeNames:s.scopePath.getExtensionIfDefined(s.parent?.scopePath??null)}),s=s.parent;return s===e?n.reverse():void 0}},Ae=class L{constructor(e,n,s,r,i,o,c,a){this.parent=e,this.ruleId=n,this.beginRuleCapturedEOL=i,this.endRule=o,this.nameScopesList=c,this.contentNameScopesList=a,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=s,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new L(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(e){return e===null?!1:L._equals(this,e)}static _equals(e,n){return e===n?!0:this._structuralEquals(e,n)?j.equals(e.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.depth!==n.depth||e.ruleId!==n.ruleId||e.endRule!==n.endRule)return!1;e=e.parent,n=n.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){L._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(e,n,s,r,i,o,c){return new L(this,e,n,s,r,i,o,c)}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,n){return this.parent&&(n=this.parent._writeString(e,n)),e[n++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,n}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 L(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,e,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let n=this;for(;n&&n._enterPos===e._enterPos;){if(n.ruleId===e.ruleId)return!0;n=n.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,n){const s=j.fromExtension(e?.nameScopesList??null,n.nameScopesList);return new L(e,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,s,j.fromExtension(s,n.contentNameScopesList))}},An=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(t,e){this.balancedBracketScopes=t.flatMap(n=>n==="*"?(this.allowAny=!0,[]):X(n,te).map(s=>s.matcher)),this.unbalancedBracketScopes=e.flatMap(n=>X(n,te).map(s=>s.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(t){for(const e of this.unbalancedBracketScopes)if(e(t))return!1;for(const e of this.balancedBracketScopes)if(e(t))return!0;return this.allowAny}},vn=class{constructor(t,e,n,s){this.balancedBracketSelectors=s,this._emitBinaryTokens=t,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(t,e){this.produceFromScopes(t.contentNameScopesList,e)}produceFromScopes(t,e){if(this._lastTokenEndIndex>=e)return;if(this._emitBinaryTokens){let s=t?.tokenAttributes??0,r=!1;if(this.balancedBracketSelectors?.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const i=t?.getScopeNames()??[];for(const o of this._tokenTypeOverrides)o.matcher(i)&&(s=G.set(s,0,o.type,null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(i))}if(r&&(s=G.set(s,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===s){this._lastTokenEndIndex=e;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(s),this._lastTokenEndIndex=e;return}const n=t?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:e,scopes:n}),this._lastTokenEndIndex=e}getResult(t,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(t,e),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(t,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(t,e),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let s=0,r=this._binaryTokens.length;s<r;s++)n[s]=this._binaryTokens[s];return n}},In=class{constructor(t,e){this._onigLib=e,this._theme=t}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(const t of this._grammars.values())t.dispose()}setTheme(t){this._theme=t}getColorMap(){return this._theme.getColorMap()}addGrammar(t,e){this._rawGrammars.set(t.scopeName,t),e&&this._injectionGrammars.set(t.scopeName,e)}lookup(t){return this._rawGrammars.get(t)}injections(t){return this._injectionGrammars.get(t)}getDefaults(){return this._theme.getDefaults()}themeMatch(t){return this._theme.match(t)}grammarForScopeName(t,e,n,s,r){if(!this._grammars.has(t)){let i=this._rawGrammars.get(t);if(!i)return null;this._grammars.set(t,Rn(t,i,e,n,s,r,this,this._onigLib))}return this._grammars.get(t)}},Tn=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new In(Q.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,n){this._syncRegistry.setTheme(Q.createFromRawTheme(e,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,n,s){return this.loadGrammarWithConfiguration(e,n,{embeddedLanguages:s})}loadGrammarWithConfiguration(e,n,s){return this._loadGrammar(e,n,s.embeddedLanguages,s.tokenTypes,new An(s.balancedBracketSelectors||[],s.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,n,s,r,i){const o=new sn(this._syncRegistry,e);for(;o.Q.length>0;)o.Q.map(c=>this._loadSingleGrammar(c.scopeName)),o.processQueue();return this._grammarForScopeName(e,n,s,r,i)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){const n=this._options.loadGrammar(e);if(n){const s=typeof this._options.getInjections=="function"?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(n,s)}}addGrammar(e,n=[],s=0,r=null){return this._syncRegistry.addGrammar(e,n),this._grammarForScopeName(e.scopeName,s,r)}_grammarForScopeName(e,n=0,s=null,r=null,i=null){return this._syncRegistry.grammarForScopeName(e,n,s,r,i)}},ve=Ae.NULL;function ne(t,e){const n=typeof t=="string"?{}:{...t.colorReplacements},s=typeof t=="string"?t:t.name;for(const[r,i]of Object.entries(e?.colorReplacements||{}))typeof i=="string"?n[r]=i:r===s&&Object.assign(n,i);return n}function x(t,e){return t&&(e?.[t?.toLowerCase()]||t)}function En(t){return Array.isArray(t)?t:[t]}async function St(t){return Promise.resolve(typeof t=="function"?t():t).then(e=>e.default||e)}function ae(t){return!t||["plaintext","txt","text","plain"].includes(t)}function xn(t){return t==="ansi"||ae(t)}function ce(t){return t==="none"}function Ln(t){return ce(t)}const Pn=/(\r?\n)/g;function le(t,e=!1){if(t.length===0)return[["",0]];const n=t.split(Pn);let s=0;const r=[];for(let i=0;i<n.length;i+=2){const o=e?n[i]+(n[i+1]||""):n[i];r.push([o,s]),s+=n[i].length,s+=n[i+1]?.length||0}return r}const Ve={light:"#333333",dark:"#bbbbbb"},Ye={light:"#fffffe",dark:"#1e1e1e"},Je="__shiki_resolved";function Pe(t){if(t?.[Je])return t;const e={...t};e.tokenColors&&!e.settings&&(e.settings=e.tokenColors,delete e.tokenColors),e.type||="dark",e.colorReplacements={...e.colorReplacements},e.settings||=[];let{bg:n,fg:s}=e;if(!n||!s){const c=e.settings?e.settings.find(a=>!a.name&&!a.scope):void 0;c?.settings?.foreground&&(s=c.settings.foreground),c?.settings?.background&&(n=c.settings.background),!s&&e?.colors?.["editor.foreground"]&&(s=e.colors["editor.foreground"]),!n&&e?.colors?.["editor.background"]&&(n=e.colors["editor.background"]),s||(s=e.type==="light"?Ve.light:Ve.dark),n||(n=e.type==="light"?Ye.light:Ye.dark),e.fg=s,e.bg=n}e.settings[0]&&e.settings[0].settings&&!e.settings[0].scope||e.settings.unshift({settings:{foreground:e.fg,background:e.bg}});let r=0;const i=new Map;function o(c){if(i.has(c))return i.get(c);r+=1;const a=`#${r.toString(16).padStart(8,"0").toLowerCase()}`;return e.colorReplacements?.[`#${a}`]?o(c):(i.set(c,a),a)}e.settings=e.settings.map(c=>{const a=c.settings?.foreground&&!c.settings.foreground.startsWith("#"),l=c.settings?.background&&!c.settings.background.startsWith("#");if(!a&&!l)return c;const u={...c,settings:{...c.settings}};if(a){const h=o(c.settings.foreground);e.colorReplacements[h]=c.settings.foreground,u.settings.foreground=h}if(l){const h=o(c.settings.background);e.colorReplacements[h]=c.settings.background,u.settings.background=h}return u});for(const c of Object.keys(e.colors||{}))if((c==="editor.foreground"||c==="editor.background"||c.startsWith("terminal.ansi"))&&!e.colors[c]?.startsWith("#")){const a=o(e.colors[c]);e.colorReplacements[a]=e.colors[c],e.colors[c]=a}return Object.defineProperty(e,Je,{enumerable:!1,writable:!1,value:!0}),e}async function Ct(t){return[...new Set((await Promise.all(t.filter(e=>!xn(e)).map(async e=>await St(e).then(n=>Array.isArray(n)?n:[n])))).flat())]}async function wt(t){return(await Promise.all(t.map(async e=>Ln(e)?null:Pe(await St(e))))).filter(e=>!!e)}function Rt(t,e){if(!e)return t;if(e[t]){const n=new Set([t]);for(;e[t];){if(t=e[t],n.has(t))throw new S(`Circular alias \`${[...n].join(" -> ")} -> ${t}\``);n.add(t)}}return t}var Gn=class extends Tn{_resolver;_themes;_langs;_alias;_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(t,e,n,s={}){super(t),this._resolver=t,this._themes=e,this._langs=n,this._alias=s,this._themes.map(r=>this.loadTheme(r)),this.loadLanguages(this._langs)}getTheme(t){return typeof t=="string"?this._resolvedThemes.get(t):this.loadTheme(t)}loadTheme(t){const e=Pe(t);return e.name&&(this._resolvedThemes.set(e.name,e),this._loadedThemesCache=null),e}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(t){let e=this._textmateThemeCache.get(t);e||(e=Q.createFromRawTheme(t),this._textmateThemeCache.set(t,e)),this._syncRegistry.setTheme(e)}getGrammar(t){return t=Rt(t,this._alias),this._resolvedGrammars.get(t)}loadLanguage(t){if(this.getGrammar(t.name))return;const e=new Set([...this._langMap.values()].filter(r=>r.embeddedLangsLazy?.includes(t.name)));this._resolver.addLanguage(t);const n={balancedBracketSelectors:t.balancedBracketSelectors||["*"],unbalancedBracketSelectors:t.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(t.scopeName,t);const s=this.loadGrammarWithConfiguration(t.scopeName,1,n);if(s.name=t.name,this._resolvedGrammars.set(t.name,s),t.aliases&&t.aliases.forEach(r=>{this._alias[r]=t.name}),this._loadedLanguagesCache=null,e.size)for(const r of e)this._resolvedGrammars.delete(r.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(r.scopeName),this._syncRegistry?._grammars?.delete(r.scopeName),this.loadLanguage(this._langMap.get(r.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(t){for(const s of t)this.resolveEmbeddedLanguages(s);const e=[...this._langGraph.entries()],n=e.filter(([s,r])=>!r);if(n.length){const s=e.filter(([r,i])=>i?(i.embeddedLanguages||i.embeddedLangs)?.some(o=>n.map(([c])=>c).includes(o)):!1).filter(r=>!n.includes(r));throw new S(`Missing languages ${n.map(([r])=>`\`${r}\``).join(", ")}, required by ${s.map(([r])=>`\`${r}\``).join(", ")}`)}for(const[s,r]of e)this._resolver.addLanguage(r);for(const[s,r]of e)this.loadLanguage(r)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(t){this._langMap.set(t.name,t),this._langGraph.set(t.name,t);const e=t.embeddedLanguages??t.embeddedLangs;if(e)for(const n of e)this._langGraph.set(n,this._langMap.get(n))}},On=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(t,e){this._onigLib={createOnigScanner:n=>t.createScanner(n),createOnigString:n=>t.createString(n)},e.forEach(n=>this.addLanguage(n))}get onigLib(){return this._onigLib}getLangRegistration(t){return this._langs.get(t)}loadGrammar(t){return this._scopeToLang.get(t)}addLanguage(t){this._langs.set(t.name,t),t.aliases&&t.aliases.forEach(e=>{this._langs.set(e,t)}),this._scopeToLang.set(t.scopeName,t),t.injectTo&&t.injectTo.forEach(e=>{this._injections.get(e)||this._injections.set(e,[]),this._injections.get(e).push(t.scopeName)})}getInjections(t){const e=t.split(".");let n=[];for(let s=1;s<=e.length;s++){const r=e.slice(0,s).join(".");n=[...n,...this._injections.get(r)||[]]}return n}};let B=0;function $n(t){B+=1,t.warnings!==!1&&B>=10&&B%10===0&&console.warn(`[Shiki] ${B} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let e=!1;if(!t.engine)throw new S("`engine` option is required for synchronous mode");const n=(t.langs||[]).flat(1),s=(t.themes||[]).flat(1).map(Pe),r=new Gn(new On(t.engine,n),s,n,t.langAlias);let i;function o(g){return Rt(g,t.langAlias)}function c(g){_();const b=r.getGrammar(typeof g=="string"?g:g.name);if(!b)throw new S(`Language \`${g}\` not found, you may need to load it first`);return b}function a(g){if(g==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};_();const b=r.getTheme(g);if(!b)throw new S(`Theme \`${g}\` not found, you may need to load it first`);return b}function l(g){_();const b=a(g);return i!==g&&(r.setTheme(b),i=g),{theme:b,colorMap:r.getColorMap()}}function u(){return _(),r.getLoadedThemes()}function h(){return _(),r.getLoadedLanguages()}function d(...g){_(),r.loadLanguages(g.flat(1))}async function f(...g){return d(await Ct(g))}function p(...g){_();for(const b of g.flat(1))r.loadTheme(b)}async function y(...g){return _(),p(await wt(g))}function _(){if(e)throw new S("Shiki instance has been disposed")}function m(){e||(e=!0,r.dispose(),B-=1)}return{setTheme:l,getTheme:a,getLanguage:c,getLoadedThemes:u,getLoadedLanguages:h,resolveLangAlias:o,loadLanguage:f,loadLanguageSync:d,loadTheme:y,loadThemeSync:p,dispose:m,[Symbol.dispose]:m}}async function Bn(t){t.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[e,n,s]=await Promise.all([wt(t.themes||[]),Ct(t.langs||[]),t.engine]);return $n({...t,themes:e,langs:n,engine:s})}const Nt=new WeakMap;function ue(t,e){Nt.set(t,e)}function q(t){return Nt.get(t)}var he=class kt{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(e,n){return new kt(Object.fromEntries(En(n).map(s=>[s,ve])),e)}constructor(...e){if(e.length===2){const[n,s]=e;this.lang=s,this._stacks=n}else{const[n,s,r]=e;this.lang=s,this._stacks={[r]:n}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return Mn(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function Mn(t){const e=[],n=new Set;function s(r){if(n.has(r))return;n.add(r);const i=r?.nameScopesList?.scopeName;i&&e.push(i),r.parent&&s(r.parent)}return s(t),e}function jn(t,e){if(!(t instanceof he))throw new S("Invalid grammar state");return t.getInternalStack(e)}const Dn=/,/,Wn=/ /;function At(t,e,n={}){const{theme:s=t.getLoadedThemes()[0]}=n;if(ae(t.resolveLangAlias(n.lang||"text"))||ce(s))return le(e).map(c=>[{content:c[0],offset:c[1]}]);const{theme:r,colorMap:i}=t.setTheme(s),o=t.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==o.name)throw new S(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${o.name}"`);if(!n.grammarState.themes.includes(r.name))throw new S(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${r.name}"`)}return qn(e,o,r,i,n)}function Fn(...t){if(t.length===2)return q(t[1]);const[e,n,s={}]=t,{lang:r="text",theme:i=e.getLoadedThemes()[0]}=s;if(ae(r)||ce(i))throw new S("Plain language does not have grammar state");if(r==="ansi")throw new S("ANSI language does not have grammar state");const{theme:o,colorMap:c}=e.setTheme(i),a=e.getLanguage(r);return new he(Ge(n,a,o,c,s).stateStack,a.name,o.name)}function qn(t,e,n,s,r){const i=Ge(t,e,n,s,r),o=new he(i.stateStack,e.name,n.name);return ue(i.tokens,o),i.tokens}function Ge(t,e,n,s,r){const i=ne(n,r),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:c=500,includeExplanation:a=!1}=r,l=le(t);let u=r.grammarState?jn(r.grammarState,n.name)??ve:r.grammarContextCode!=null?Ge(r.grammarContextCode,e,n,s,{...r,grammarState:void 0,grammarContextCode:void 0}).stateStack:ve,h=[];const d=[];for(let f=0,p=l.length;f<p;f++){const[y,_]=l[f];if(y===""){h=[],d.push([]);continue}if(o>0&&y.length>=o){h=[],d.push([{content:y,offset:_,color:"",fontStyle:0}]);continue}let m,g,b;a&&a!=="tokenType"&&(m=e.tokenizeLine(y,u,c),g=m.tokens,b=0);const C=e.tokenizeLine2(y,u,c),R=C.tokens.length/2;for(let A=0;A<R;A++){const E=C.tokens[2*A],fe=A+1<R?C.tokens[2*A+2]:y.length;if(E===fe)continue;const de=C.tokens[2*A+1],$t=x(s[G.getForeground(de)],i),Bt=G.getFontStyle(de),H={content:y.substring(E,fe),offset:_+E,color:$t,fontStyle:Bt};if(a==="tokenType")H.type=G.getTokenType(de);else if(a){const $e=[];if(a!=="scopeName")for(const T of n.settings){let O;switch(typeof T.scope){case"string":O=T.scope.split(Dn).map(pe=>pe.trim());break;case"object":O=T.scope;break;default:continue}$e.push({settings:T,selectors:O.map(pe=>pe.split(Wn))})}H.explanation=[];let Be=0;for(;E+Be<fe;){const T=g[b],O=y.substring(T.startIndex,T.endIndex);Be+=O.length,H.explanation.push({content:O,scopes:a==="scopeName"?zn(T.scopes):Hn($e,T.scopes)}),b+=1}}h.push(H)}d.push(h),h=[],u=C.ruleStack}return{tokens:d,stateStack:u}}function zn(t){return t.map(e=>({scopeName:e}))}function Hn(t,e){const n=[];for(let s=0,r=e.length;s<r;s++){const i=e[s];n[s]={scopeName:i,themeMatches:Kn(t,i,e.slice(0,s))}}return n}function Qe(t,e){return t===e||e.substring(0,t.length)===t&&e[t.length]==="."}function Un(t,e,n){if(!Qe(t.at(-1),e))return!1;let s=t.length-2,r=n.length-1;for(;s>=0&&r>=0;)Qe(t[s],n[r])&&(s-=1),r-=1;return s===-1}function Kn(t,e,n){const s=[];for(const{selectors:r,settings:i}of t)for(const o of r)if(Un(o,e,n)){s.push(i);break}return s}function vt(t,e,n,s=At){const r=Object.entries(n.themes).filter(l=>l[1]).map(l=>({color:l[0],theme:l[1]})),i=r.map(l=>{const u=s(t,e,{...n,theme:l.theme});return{tokens:u,state:q(u),theme:typeof l.theme=="string"?l.theme:l.theme.name}}),o=Vn(...i.map(l=>l.tokens)),c=o[0].map((l,u)=>l.map((h,d)=>{const f={content:h.content,variants:{},offset:h.offset};return"includeExplanation"in n&&n.includeExplanation&&(f.explanation=h.explanation),o.forEach((p,y)=>{const{content:_,explanation:m,offset:g,...b}=p[u][d];f.variants[r[y].color]=b}),f})),a=i[0].state?new he(Object.fromEntries(i.map(l=>[l.theme,l.state?.getInternalStack(l.theme)])),i[0].state.lang):void 0;return a&&ue(c,a),c}function Vn(...t){const e=t.map(()=>[]),n=t.length;for(let s=0;s<t[0].length;s++){const r=t.map(a=>a[s]),i=e.map(()=>[]);e.forEach((a,l)=>a.push(i[l]));const o=r.map(()=>0),c=r.map(a=>a[0]);for(;c.every(a=>a);){const a=Math.min(...c.map(l=>l.content.length));for(let l=0;l<n;l++){const u=c[l];u.content.length===a?(i[l].push(u),o[l]+=1,c[l]=r[l][o[l]]):(i[l].push({...u,content:u.content.slice(0,a)}),c[l]={...u,content:u.content.slice(a),offset:u.offset+a})}}}return e}const Yn=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],Jn=/["&'<>`]/g,Qn=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Xn=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Zn=/[|\\{}()[\]^$+*?.]/g,Xe=new WeakMap;function es(t,e){if(t=t.replace(e.subset?ts(e.subset):Jn,s),e.subset||e.escapeOnly)return t;return t.replace(Qn,n).replace(Xn,s);function n(r,i,o){return e.format((r.charCodeAt(0)-55296)*1024+r.charCodeAt(1)-56320+65536,o.charCodeAt(i+2),e)}function s(r,i,o){return e.format(r.charCodeAt(0),o.charCodeAt(i+1),e)}}function ts(t){let e=Xe.get(t);return e||(e=ns(t),Xe.set(t,e)),e}function ns(t){const e=[];let n=-1;for(;++n<t.length;)e.push(t[n].replace(Zn,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}const ss=/[\dA-Fa-f]/;function rs(t,e,n){const s="&#x"+t.toString(16).toUpperCase();return n&&e&&!ss.test(String.fromCharCode(e))?s:s+";"}const is=/\d/;function os(t,e,n){const s="&#"+String(t);return n&&e&&!is.test(String.fromCharCode(e))?s:s+";"}const as=["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"],ye={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:"€"},cs=["cent","copy","divide","gt","lt","not","para","times"],It={}.hasOwnProperty,Ie={};let K;for(K in ye)It.call(ye,K)&&(Ie[ye[K]]=K);const ls=/[^\dA-Za-z]/;function us(t,e,n,s){const r=String.fromCharCode(t);if(It.call(Ie,r)){const i=Ie[r],o="&"+i;return n&&as.includes(i)&&!cs.includes(i)&&(!s||e&&e!==61&&ls.test(String.fromCharCode(e)))?o:o+";"}return""}function hs(t,e,n){let s=rs(t,e,n.omitOptionalSemicolons),r;if((n.useNamedReferences||n.useShortestReferences)&&(r=us(t,e,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!r)&&n.useShortestReferences){const i=os(t,e,n.omitOptionalSemicolons);i.length<s.length&&(s=i)}return r&&(!n.useShortestReferences||r.length<s.length)?r:s}function $(t,e){return es(t,Object.assign({format:hs},e))}const fs=/^>|^->|<!--|-->|--!>|<!-$/g,ds=[">"],ps=["<",">"];function gs(t,e,n,s){return s.settings.bogusComments?"<?"+$(t.value,Object.assign({},s.settings.characterReferences,{subset:ds}))+">":"<!--"+t.value.replace(fs,r)+"-->";function r(i){return $(i,Object.assign({},s.settings.characterReferences,{subset:ps}))}}function ms(t,e,n,s){return"<!"+(s.settings.upperDoctype?"DOCTYPE":"doctype")+(s.settings.tightDoctype?"":" ")+"html>"}const w=Et(1),Tt=Et(-1),_s=[];function Et(t){return e;function e(n,s,r){const i=n?n.children:_s;let o=(s||0)+t,c=i[o];if(!r)for(;c&&xe(c);)o+=t,c=i[o];return c}}const ys={}.hasOwnProperty;function xt(t){return e;function e(n,s,r){return ys.call(t,n.tagName)&&t[n.tagName](n,s,r)}}const Oe=xt({body:Ss,caption:be,colgroup:be,dd:Ns,dt:Rs,head:be,html:bs,li:ws,optgroup:ks,option:As,p:Cs,rp:Ze,rt:Ze,tbody:Is,td:et,tfoot:Ts,th:et,thead:vs,tr:Es});function be(t,e,n){const s=w(n,e,!0);return!s||s.type!=="comment"&&!(s.type==="text"&&xe(s.value.charAt(0)))}function bs(t,e,n){const s=w(n,e);return!s||s.type!=="comment"}function Ss(t,e,n){const s=w(n,e);return!s||s.type!=="comment"}function Cs(t,e,n){const s=w(n,e);return s?s.type==="element"&&(s.tagName==="address"||s.tagName==="article"||s.tagName==="aside"||s.tagName==="blockquote"||s.tagName==="details"||s.tagName==="div"||s.tagName==="dl"||s.tagName==="fieldset"||s.tagName==="figcaption"||s.tagName==="figure"||s.tagName==="footer"||s.tagName==="form"||s.tagName==="h1"||s.tagName==="h2"||s.tagName==="h3"||s.tagName==="h4"||s.tagName==="h5"||s.tagName==="h6"||s.tagName==="header"||s.tagName==="hgroup"||s.tagName==="hr"||s.tagName==="main"||s.tagName==="menu"||s.tagName==="nav"||s.tagName==="ol"||s.tagName==="p"||s.tagName==="pre"||s.tagName==="section"||s.tagName==="table"||s.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function ws(t,e,n){const s=w(n,e);return!s||s.type==="element"&&s.tagName==="li"}function Rs(t,e,n){const s=w(n,e);return!!(s&&s.type==="element"&&(s.tagName==="dt"||s.tagName==="dd"))}function Ns(t,e,n){const s=w(n,e);return!s||s.type==="element"&&(s.tagName==="dt"||s.tagName==="dd")}function Ze(t,e,n){const s=w(n,e);return!s||s.type==="element"&&(s.tagName==="rp"||s.tagName==="rt")}function ks(t,e,n){const s=w(n,e);return!s||s.type==="element"&&s.tagName==="optgroup"}function As(t,e,n){const s=w(n,e);return!s||s.type==="element"&&(s.tagName==="option"||s.tagName==="optgroup")}function vs(t,e,n){const s=w(n,e);return!!(s&&s.type==="element"&&(s.tagName==="tbody"||s.tagName==="tfoot"))}function Is(t,e,n){const s=w(n,e);return!s||s.type==="element"&&(s.tagName==="tbody"||s.tagName==="tfoot")}function Ts(t,e,n){return!w(n,e)}function Es(t,e,n){const s=w(n,e);return!s||s.type==="element"&&s.tagName==="tr"}function et(t,e,n){const s=w(n,e);return!s||s.type==="element"&&(s.tagName==="td"||s.tagName==="th")}const xs=xt({body:Gs,colgroup:Os,head:Ps,html:Ls,tbody:$s});function Ls(t){const e=w(t,-1);return!e||e.type!=="comment"}function Ps(t){const e=new Set;for(const s of t.children)if(s.type==="element"&&(s.tagName==="base"||s.tagName==="title")){if(e.has(s.tagName))return!1;e.add(s.tagName)}const n=t.children[0];return!n||n.type==="element"}function Gs(t){const e=w(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&xe(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function Os(t,e,n){const s=Tt(n,e),r=w(t,-1,!0);return n&&s&&s.type==="element"&&s.tagName==="colgroup"&&Oe(s,n.children.indexOf(s),n)?!1:!!(r&&r.type==="element"&&r.tagName==="col")}function $s(t,e,n){const s=Tt(n,e),r=w(t,-1);return n&&s&&s.type==="element"&&(s.tagName==="thead"||s.tagName==="tbody")&&Oe(s,n.children.indexOf(s),n)?!1:!!(r&&r.type==="element"&&r.tagName==="tr")}const V={name:[[`
4
4
  \f\r &/=>`.split(""),`
@@ -1 +1 @@
1
- import{n as a}from"./App-DXv-5ZTc.js";async function f(s,e){const t=await a("/api/teams/import?mode=add",{method:"POST",body:JSON.stringify(s)});for(const o of t.bots)e({type:"botAdded",bot:o});for(const o of t.groups??[])e({type:"groupPatched",group:o});for(const o of t.routines??[])e({type:"routinePatched",routine:o});const r=t.bots.find(o=>!o.hidden);return r&&e({type:"select",id:r.id}),{...t,...r?{first:r}:{}}}function c(s,e,t=100){const r=s.trim().slice(0,t);let o=r;for(let n=2;e.has(o.toLowerCase());n++){const i=` ${n}`;o=`${r.slice(0,t-i.length).trimEnd()}${i}`}return e.add(o.toLowerCase()),o}export{f as a,c as t};
1
+ import{n as a}from"./App-BgFOjdcx.js";async function f(s,e){const t=await a("/api/teams/import?mode=add",{method:"POST",body:JSON.stringify(s)});for(const o of t.bots)e({type:"botAdded",bot:o});for(const o of t.groups??[])e({type:"groupPatched",group:o});for(const o of t.routines??[])e({type:"routinePatched",routine:o});const r=t.bots.find(o=>!o.hidden);return r&&e({type:"select",id:r.id}),{...t,...r?{first:r}:{}}}function c(s,e,t=100){const r=s.trim().slice(0,t);let o=r;for(let n=2;e.has(o.toLowerCase());n++){const i=` ${n}`;o=`${r.slice(0,t-i.length).trimEnd()}${i}`}return e.add(o.toLowerCase()),o}export{f as a,c as t};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/App-DXv-5ZTc.js","assets/styles-BHtUK2qB.js","assets/styles-B9SGxFnK.css","assets/PlacesRail-CUntVv3u.js","assets/monitor-7oLB-7rZ.js","assets/MenuMotion-CobYpP7L.js","assets/DesktopViewer-DTBmRKHz.js","assets/desktop-connection-Dfaq6k5a.js","assets/desktop-viewer-CF-OpSo0.js","assets/minimize-o-OFVasg.js"])))=>i.map(i=>d[i]);
2
- import{t as o,al as Pe,r as i,j as n,S as pe,X as Ie,a as I,am as Ae,an as Te,g as $,L as _e,a0 as M,B as W,a9 as ne,ao as Le,ap as Oe,p as A,aq as Re,b as $e,s as De,l as Be,m as He,o as Fe,q as Ue,ar as ze,as as Me,x as We,v as Xe,y as Ge,P as Ve,_ as me}from"./styles-BHtUK2qB.js";function Zt(e,t){if(!t)return;if(t.kind!=="session")return t.kind==="loopback"?e:void 0;if(t.team||t.scopes.includes("admin"))return e;const r=t.email;if(r?.trim())return e?.email?.trim().toLowerCase()===r.trim().toLowerCase()?e:{email:r}}const fe="omb.team-sign-in";function Ke(e){try{e&&globalThis.localStorage?.setItem(fe,e)}catch{}}function qe(){try{return globalThis.localStorage?.getItem(fe)??null}catch{return null}}async function F(e=fetch){let t;try{t=await e("/api/auth/session",{credentials:"same-origin"})}catch(s){return{kind:"unreachable",error:s instanceof Error?s.message:String(s)}}const r=await t.json().catch(()=>({})),a=Object(r);return t.status===401||t.status===403?{kind:"unauthenticated",error:typeof a.error=="string"?a.error:`${t.status}`}:t.ok?a.kind==="session"&&typeof a.id=="string"?{kind:"session",id:a.id,label:typeof a.label=="string"?a.label:"",...typeof a.email=="string"?{email:a.email}:{},scopes:Array.isArray(a.scopes)?a.scopes.filter(s=>typeof s=="string"):[],expiresAt:typeof a.expiresAt=="number"?a.expiresAt:0,...typeof a.reactor=="string"?{reactor:a.reactor}:{},...typeof a.teamSignIn=="string"?{teamSignIn:a.teamSignIn}:{},...re(a.team)?{team:re(a.team),openedThreads:Array.isArray(a.openedThreads)?a.openedThreads.filter(s=>typeof s=="string"):[]}:{},...a.cloudGuest===!0?{cloudGuest:!0,openedThreads:Array.isArray(a.openedThreads)?a.openedThreads.filter(s=>typeof s=="string"):[]}:{}}:a.trust==="service"?{kind:"loopback",trust:"service"}:{kind:"loopback"}:{kind:"unreachable",error:`${t.status} ${t.statusText}`}}function re(e){const t=Object(e);return typeof t.id=="string"&&typeof t.name=="string"&&typeof t.role=="string"?{id:t.id,name:t.name,role:t.role}:null}function Ye(e){return e?.kind==="session"||e?.kind==="loopback"&&e.trust!=="service"}function he(e){return e?e.kind==="loopback"?e.trust!=="service":e.kind==="session"&&e.scopes.includes("admin"):!1}function Je(){const e=/[#&]code=([^&]+)/.exec(location.hash);return e?(history.replaceState(null,"",location.pathname+location.search),decodeURIComponent(e[1])):null}function Ze(){if(!/[#&]signin=/.test(location.hash))return null;const e=/[#&]signin=(omb_pair_[A-Za-z0-9_-]{43})(?:&|$)/.exec(location.hash);return history.replaceState(null,"",location.pathname+location.search),e?e[1]:null}function Qe(){const e=new URLSearchParams(location.search),t=e.get("email")?.trim().toLowerCase()??"";if(!t)return null;e.delete("email");const r=e.toString();return history.replaceState(null,"",location.pathname+(r?`?${r}`:"")+location.hash),/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(t)?t:null}function xe(e=navigator.userAgent){const t=/Edg\//.test(e)?"Edge":/OPR\//.test(e)?"Opera":/Chrome\//.test(e)?"Chrome":/Firefox\//.test(e)?"Firefox":/Safari\//.test(e)?"Safari":"Browser",r=/iPhone/.test(e)?"iPhone":/iPad/.test(e)?"iPad":/Android/.test(e)?"Android":/Mac OS X/.test(e)?"Mac":/Windows/.test(e)?"Windows":/Linux/.test(e)?"Linux":"";return r?`${t} on ${r}`:t}function H(){return typeof crypto?.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,14)}`}function be(e,t){const r=Reflect.get(Object(e),"error");return Pe(e,typeof r=="string"?r:`${t.status} ${t.statusText}`)}async function V(e,t=fetch){let r;try{r=await t("/api/auth/pair",{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json"},body:JSON.stringify({code:e.code,label:e.label,cookie:!0,attemptId:e.attemptId??H(),...e.browser?{browser:!0}:{}})})}catch(s){return{ok:!1,error:o("pair.unreachable",{error:s instanceof Error?s.message:String(s)})}}const a=await r.json().catch(()=>({}));return r.ok?{ok:!0}:{ok:!1,error:be(a,r)}}async function et(e,t=fetch){try{const r=await t("/api/auth/pair",{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json"},body:JSON.stringify({code:e,browser:!0,preview:!0})}),a=Object(await r.json().catch(()=>({}))),s=Reflect.get(a,"owner"),c=Reflect.get(a,"team");return r.ok&&typeof s=="string"&&s?{owner:s,...typeof c=="string"&&c.trim()?{team:c.trim()}:{}}:null}catch{return null}}function tt(e,t,r=fetch){return V({code:e,label:xe(),attemptId:t,browser:!0},r)}function Qt(e){const t=Object(e);return t.cloudHome===!0&&typeof t.owner=="string"&&t.owner?t.owner:null}async function ge(e,t,r){let a;try{a=await r(e,{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json"},body:JSON.stringify(t)})}catch(c){return{ok:!1,error:o("pair.unreachable",{error:c instanceof Error?c.message:String(c)})}}const s=await a.json().catch(()=>({}));return a.ok?{ok:!0}:{ok:!1,error:be(s,a)}}function nt(e,t=fetch){return ge("/api/auth/email/start",{email:e},t)}function rt(e,t=fetch){return ge("/api/auth/email/verify",{email:e.email,code:e.code,label:e.label},t)}function ae(e){return!e||/through a proxy|loopback host required|cross-origin request|^40[13]$/i.test(e)?null:e}function at(){window.ogb?.softwareRendering===!0&&(document.documentElement.dataset.softwareRendering="")}function ot({credential:e,owner:t,team:r}){const[a]=i.useState(()=>H()),[s,c]=i.useState(!1),[u,l]=i.useState(null);async function y(){c(!0),l(null);const f=await tt(e,a);if(f.ok){location.replace("/");return}c(!1),l(f.error)}return n.jsx("main",{className:"flex min-h-screen items-center justify-center bg-app px-6 text-ink",children:n.jsxs("div",{className:"w-full max-w-[420px]",children:[n.jsx("h1",{className:"text-[20px] font-semibold",children:r?o("pair.browser.teamTitle",{team:r,owner:t}):o("pair.browser.title",{owner:t})}),n.jsx("p",{className:"mt-1.5 text-[14px] text-ink-secondary",children:o("pair.browser.notYou")}),u?n.jsx("p",{role:"alert",className:"mt-3 text-[13px] text-danger",children:u}):null,n.jsx("button",{type:"button",onClick:()=>{y()},disabled:s,className:"mt-5 w-full rounded-md bg-accent px-4 py-2 text-[14px] font-medium text-accent-ink disabled:opacity-50",children:o(s?"pair.signingIn":"pair.continue")})]})})}const Y="bg-composer ring-1 ring-inset ring-ink/[0.07]",st="bg-composer ring-[0.5px] ring-ink/10",en=`${st} shadow-(--shadow-float)`,ye="transition-colors duration-[120ms] hover:bg-[color-mix(in_srgb,var(--color-composer),var(--color-ink)_7%)]",it=`${ye} aria-expanded:bg-[color-mix(in_srgb,var(--color-composer),var(--color-ink)_7%)]`,tn="bg-[color-mix(in_srgb,var(--color-composer),var(--color-ink)_7%)]",nn="focus-visible:outline-2 focus-visible:-outline-offset-2! focus-visible:outline-focus",ke="flex size-9 shrink-0 items-center justify-center rounded-full text-ink/90",J="focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",lt=`${ke} ${Y} ${it} ${J}`,rn=`${ke} ${Y} ${ye} ${J}`,ct=`flex size-[26px] shrink-0 items-center justify-center rounded-lg text-ink-secondary transition-colors hover:bg-ink/[0.06] hover:text-ink aria-expanded:bg-ink/[0.06] aria-expanded:text-ink ${J}`,an="flex size-10 shrink-0 items-center justify-center rounded-full border border-hairline bg-card text-ink hover:bg-raised focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",ut="flex size-9 shrink-0 items-center justify-center rounded-xl text-ink-secondary hover:bg-raised/60 hover:text-ink focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus";function on({open:e,onToggle:t,corner:r=!1,ref:a}){return n.jsx("button",{ref:a,type:"button","data-sidebar-search-toggle":!0,onClick:t,"aria-label":o("sidebar.searchAria"),"aria-expanded":e,title:o("sidebar.searchAria"),className:r?ct:lt,children:n.jsx(pe,{size:r?17:18,strokeWidth:1.5,"aria-hidden":"true"})})}function sn({query:e,onQuery:t,onClose:r}){return n.jsx("div",{"data-sidebar-search-pill":!0,className:"px-3 pb-2 pt-0.5",children:n.jsxs("div",{className:I("flex h-[34px] items-center gap-2 rounded-full pl-3 pr-1.5 text-ink-secondary focus-within:ring-focus",Y),children:[n.jsx(pe,{size:15,"aria-hidden":"true",className:"shrink-0"}),n.jsx("input",{autoFocus:!0,value:e,onChange:a=>t(a.target.value),onKeyDown:a=>{a.key==="Escape"&&(a.preventDefault(),r())},placeholder:o("sidebar.searchAria"),"aria-label":o("sidebar.searchAria"),className:"min-w-0 flex-1 bg-transparent text-[13px] text-ink placeholder:text-ink-tertiary focus:outline-none"}),n.jsx("button",{type:"button",onClick:r,"aria-label":o("sidebar.searchClose"),title:o("sidebar.searchClose"),className:"flex size-6 shrink-0 items-center justify-center rounded-full text-ink-tertiary hover:bg-raised hover:text-ink focus-visible:outline focus-visible:outline-2 focus-visible:outline-focus",children:n.jsx(Ie,{size:14,"aria-hidden":"true"})})]})})}function dt(e,{howTo:t=!1,onClosed:r}={}){return e.menu(t?{from:"howto"}:void 0).finally(()=>{t&&r?.()})}function ln(e){e({type:"cloudHowTo",open:!1})}function oe({text:e}){return n.jsxs("span",{className:"font-normal text-ink-secondary",children:[" · ",e]})}function pt(e){return e?.sleeps===!0?!0:e?.status==="paid"?!1:null}function mt(e){const t=e&&!window.ogb?.remoteClient?.active?window.ogb?.cloudPlan:void 0,r=e||window.ogb?.remoteClient?.active?void 0:window.ogb?.cloudAccount,[a,s]=i.useState(null),[c,u]=i.useState(!1);return i.useEffect(()=>{if(!t)return;let l=!0;return t.state().then(y=>{l&&s(pt(y))}).catch(()=>{}),()=>{l=!1}},[t]),i.useEffect(()=>r?.onState(l=>u(l.waking===!0)),[r]),{sleeps:t?a:null,waking:c}}function ft({cloudHome:e=!1,howTo:t=!1,onMenuClosed:r}){const a=window.ogb?.workspaces,[s,c]=i.useState(null),[u,l]=i.useState(!1),[y,f]=i.useState("");i.useEffect(()=>{let p=!0;const g=()=>{a?.state().then(j=>{p&&c(j)}).catch(()=>{})};g();const S=a?.onChanged?.(g);return()=>{p=!1,S?.()}},[a]);const k=mt(e||s?.home===!0),d=k.sleeps===null?"":o(k.sleeps?"cloudSetup.sleepsWhenIdle":"cloudSetup.alwaysOn"),x=k.waking?o("cloudHome.waking"):"";return{bridge:a,current:s,cloudHome:e,open:u,error:y,onLine:d,waking:x,openMenu:()=>{!a||u||(f(""),l(!0),dt(a,{howTo:t,onClosed:r}).catch(()=>f(o("sidebar.switchServerError"))).finally(()=>l(!1)))},switchable:!!a&&s?.home!==!0}}function ht(e){const t=Ae(),r=n.jsx(xt,{...e});return Te(t)?n.jsx("div",{"data-switcher-beside-rail":!0,className:t.beside?"hidden":"contents md:hidden",children:r}):r}function xt({compact:e=!1,inline:t=!1,pill:r=!1,rail:a=!1,cloudHome:s=!1,owner:c=null,howTo:u=!1,place:l,onMenuClosed:y}){const f=l||o("cloudSetup.myCloud"),{bridge:k,current:d,open:x,error:b,onLine:p,waking:g,openMenu:S}=ft({cloudHome:s,howTo:u,onMenuClosed:y}),j=h=>p?`${h} · ${p}`:h;if(!k||d?.home===!0){if(!s&&!d?.home)return null;const h=c?o("sidebar.cloudOwner",{email:c}):"",v=`${j(f)}${h?` · ${h}`:""}`;return a?n.jsx("div",{"data-cloud-home-indicator":!0,"data-workspace-switcher":"rail",role:"img","aria-label":v,title:v,className:"flex size-9 items-center justify-center text-ink-secondary",children:n.jsx($,{size:18,"aria-hidden":"true"})}):t?n.jsxs("div",{"data-cloud-home-indicator":!0,"data-workspace-switcher":"inline",title:v,className:r?"flex h-8 min-w-0 items-center gap-1 rounded-full bg-raised/50 px-3 text-[13px] font-medium text-ink":"flex min-w-0 items-center gap-1.5 px-1.5 text-[13px] font-medium text-ink",children:[n.jsx($,{size:r?15:14,"aria-hidden":"true",className:r?"hidden shrink-0 text-ink-secondary @max-[124px]/sidebar-top:block":"shrink-0 text-ink-secondary"}),n.jsx("span",{className:r?"min-w-0 truncate @max-[124px]/sidebar-top:hidden":"min-w-0 truncate",children:f}),(p||h)&&n.jsxs("span",{className:"sr-only",children:[p?` · ${p}`:"",h?` · ${h}`:""]})]}):n.jsx("div",{"data-cloud-home-indicator":!0,className:I("py-1.5",e?"px-2":"px-3"),children:n.jsxs("div",{title:v,className:I("flex items-center gap-2 py-2 text-[13px] font-medium text-ink",e?"justify-center px-1":"px-2"),children:[n.jsx($,{size:16,"aria-hidden":"true",className:"shrink-0 text-ink-secondary"}),e?n.jsx("span",{className:"sr-only",children:v}):n.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[f,p&&n.jsx(oe,{text:p}),h&&n.jsx("span",{className:"block truncate text-[12px] font-normal text-ink-secondary",children:h})]})]})})}const C=d?.profileName??(d?.local&&!d.localPath?o("place.local"):d?.name)??(s?f:o("sidebar.servers")),w=d?.local===!1||s&&!d?$:_e,T=s?j(C):C,E=d?.origin?`${T} · ${d.origin}`:T,P=o("sidebar.switchServer",{name:T});return a?n.jsxs("div",{"data-workspace-switcher":"rail",className:"relative",children:[n.jsx("button",{type:"button","aria-label":P,"aria-haspopup":"menu","aria-expanded":x,"data-cloud-home-indicator":s||void 0,"data-tour":"server-switcher",title:E,onClick:S,className:I(ut,"aria-expanded:bg-raised"),style:{WebkitAppRegion:"no-drag"},children:M(d?.color)?n.jsx(W,{color:d?.color,size:18}):n.jsx(w,{size:18,"aria-hidden":"true"})}),b&&n.jsx("p",{role:"alert",className:"absolute bottom-0 left-full z-40 ml-2 w-56 rounded-md bg-menu px-2 py-1 text-[11px] text-danger shadow-lg",children:b}),g&&!b&&n.jsx("p",{role:"status","data-cloud-waking":!0,className:"absolute bottom-0 left-full z-40 ml-2 w-56 rounded-md bg-menu px-2 py-1 text-[11px] text-ink-secondary shadow-lg",children:g})]}):t?n.jsxs("div",{"data-workspace-switcher":"inline",className:"flex min-w-0",children:[n.jsxs("button",{type:"button","aria-label":P,"aria-haspopup":"menu","aria-expanded":x,"data-cloud-home-indicator":s||void 0,"data-tour":"server-switcher",title:E,onClick:S,className:r?"flex h-8 min-w-0 max-w-full items-center gap-1 overflow-hidden rounded-full bg-raised/50 pl-2.5 pr-1.5 text-left text-[13px] font-medium text-ink hover:bg-raised aria-expanded:bg-raised focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus":"flex h-7 min-w-0 max-w-full items-center gap-1.5 overflow-hidden rounded-md px-1.5 text-left text-[13px] font-medium text-ink hover:bg-control focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",style:{WebkitAppRegion:"no-drag"},children:[M(d?.color)?n.jsx(W,{color:d?.color,size:16}):n.jsx(w,{size:r?15:14,"aria-hidden":"true","data-switcher-icon":!0,className:r?"hidden shrink-0 text-ink-secondary @max-[124px]/sidebar-top:block":"shrink-0 text-ink-secondary"}),n.jsx("span",{className:r?"min-w-0 truncate @max-[124px]/sidebar-top:hidden":"min-w-0 truncate @max-[96px]/sidebar-top:hidden",children:C}),n.jsx(ne,{size:r?12:11,"aria-hidden":"true",className:r?"shrink-0 text-ink-tertiary":"shrink-0 text-ink-secondary"})]}),b&&n.jsx("p",{role:"alert",className:"absolute right-2 top-full z-40 mt-1 w-56 max-w-[calc(100%-1rem)] rounded-md bg-menu px-2 py-1 text-[11px] text-danger shadow-lg",children:b}),g&&!b&&n.jsx("p",{role:"status","data-cloud-waking":!0,className:"absolute right-2 top-full z-40 mt-1 w-56 max-w-[calc(100%-1rem)] rounded-md bg-menu px-2 py-1 text-[11px] text-ink-secondary shadow-lg",children:g})]}):n.jsxs("div",{className:I("py-1.5",e?"px-2":"px-3"),children:[n.jsxs("button",{type:"button","aria-label":P,"aria-haspopup":"menu","aria-expanded":x,"data-cloud-home-indicator":s||void 0,"data-tour":"server-switcher",title:E,onClick:S,className:I("flex w-full items-center gap-2 rounded-lg py-2 text-left text-[13px] font-medium text-ink hover:bg-control focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",e?"justify-center px-1":"px-2"),style:{WebkitAppRegion:"no-drag"},children:[M(d?.color)?n.jsx(W,{color:d?.color,size:20}):n.jsx(w,{size:16,className:"shrink-0 text-ink-secondary"}),!e&&n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[C,s&&p&&n.jsx(oe,{text:p})]}),n.jsx(ne,{size:13,className:"shrink-0 text-ink-secondary"})]})]}),b&&n.jsx("p",{role:"alert",className:"mt-1 text-[11px] text-danger",children:b}),g&&!b&&n.jsx("p",{role:"status","data-cloud-waking":!0,className:"mt-1 text-[11px] text-ink-secondary",children:g})]})}function bt(e){const t=e&&typeof e=="object"?e.membership:void 0,r=t&&typeof t=="object"?t:{};let a=null;if(typeof r.peopleUrl=="string")try{new URL(r.peopleUrl).protocol==="https:"&&(a=r.peopleUrl)}catch{a=null}return{authority:r.authority==="portal"?"portal":"local",pairingCodes:r.pairingCodes!==!1,peopleUrl:a}}const cn=()=>({type:"toggleAppSettings",open:!0,section:"companion",phonePairing:!0});function un(e){const t=typeof window>"u"?void 0:window.ogb;return gt({companion:!!t?.companion,remoteClient:t?.remoteClient?.active===!0,cloudHome:e})}function gt(e){return e.cloudHome?"cloud":e.companion&&!e.remoteClient?"computer":"server"}const yt={computer:"sidebar.menu.connectPhone.computer",cloud:"sidebar.menu.connectPhone.cloud",server:"sidebar.menu.connectPhone.server"};function dn(e,t){const r=t?.session?.kind==="session"?t.session.team?.name:void 0;return r?{target:e,subtitleKey:"sidebar.menu.connectPhone.team",team:r}:e!=="computer"&&!(t&&t.pairingCodes&&he(t.session))?null:{target:e,subtitleKey:yt[e]}}function pn(e){return Le(e).kind!=="paid"||Oe(e)?null:e?.status==="connected"&&e.machine?.status==="ready"?"ready":"not-ready"}function mn(e,t){if(!e)return[];const r={...e,id:"here"};return e.target!=="computer"||!t?[r]:t==="not-ready"?[{...r,noteKey:"sidebar.menu.connectPhone.cloudNotReady"}]:[{id:"cloud",target:"cloud",subtitleKey:"sidebar.menu.connectPhone.cloudAlwaysOn"},r]}let se=null;function fn(e=fetch){return se??=F(e).then(async t=>{if(!he(t))return{session:t,pairingCodes:!1};const r=await e("/api/config",{credentials:"same-origin"}).then(a=>a.ok?a.json():null).catch(()=>null);return{session:t,pairingCodes:bt(r).pairingCodes}}),se}const kt="data-phone-pairing-action";function hn(e,t=r=>window.requestAnimationFrame(r)){return e?(t(()=>{e.scrollIntoView?.({block:"start"}),(e.querySelector(`[${kt}]:not([disabled])`)??e).focus({preventScroll:!0})}),!0):!1}function xn(e){const t=new URL(e);return t.searchParams.get("desktop-settings")!=="phone"?null:(t.searchParams.delete("desktop-settings"),`${t.pathname}${t.search}${t.hash}`)}function X(e){const t=new URLSearchParams(e);if(t.get("desktop-settings")==="phone")return"/?desktop-settings=phone";const r=t.get("next");return r&&/^\/(?!\/)/.test(r)&&!r.startsWith("/pair")&&!/[\\\s]/.test(r)?r:"/"}const wt="23456789ABCDEFGHJKLMNPQRSTUVWXYZ",vt=12,jt="omb_pair_",Nt=/^omb_pair_[A-Za-z0-9_-]{43}$/;function we(e){return e.toUpperCase().replace(/[^A-Z0-9]/g,"").replace(/0/g,"O").replace(/1/g,"I")}function St(e){return we(e).match(/.{1,4}/g)?.join("-")??e}const Et={emailCode:"serverError.pair.emailCode",oldCode:"serverError.pair.oldCode",scriptKey:"serverError.pair.scriptKey",notACode:"serverError.pair.notACode"};function Ct(e){let t;try{t=new URL(e)}catch{return null}const r=new URLSearchParams(t.hash.replace(/^#/,""));return t.searchParams.get("token")??t.searchParams.get("code")??r.get("code")}function Z(e){let t=e.trim();if(!t)return{kind:"empty"};if(/^[a-z][a-z0-9+.-]*:\/\//i.test(t)){const s=Ct(t);if(!s)return{kind:"wrong",problem:"notACode"};t=s.trim()}if(t.startsWith("omb_sess_"))return{kind:"wrong",problem:"scriptKey"};if(t.startsWith(jt))return Nt.test(t)?{kind:"credential",credential:t}:{kind:"wrong",problem:"notACode"};const r=t.replace(/[\s-]/g,"");if(/^\d{8}$/.test(r))return{kind:"wrong",problem:"emailCode"};if(/^\d{6}$/.test(r))return{kind:"wrong",problem:"oldCode"};const a=we(t);return a.length!==vt||[...a].some(s=>!wt.includes(s))?{kind:"wrong",problem:"notACode"}:{kind:"code",code:a}}const L="mt-1 w-full rounded-md border border-hairline/40 bg-inset px-3 py-2 text-[14px] text-ink outline-none focus:border-accent-border",ie="mt-5 w-full rounded-md bg-accent px-4 py-2 text-[14px] font-medium text-accent-ink disabled:opacity-50",O="mt-4 block text-[12px] font-medium text-ink-secondary";function Pt(e,t=typeof window<"u"&&!!window.ogb?.workspaces){return!!e&&t}function It({mode:e,sent:t,email:r,cloudHome:a}){return e==="email"?t?o("pair.intro.emailSent",{email:r}):o("pair.intro.email"):a?o("pair.intro.cloud",{app:A(),open:o("cloudHome.connect"),section:o("settings.section.cloudAccount")}):o("pair.intro.code")}function At(e){const t=Z(e);return t.kind==="wrong"&&t.problem!=="notACode"?o(Et[t.problem]):null}function Tt(e){const t=Z(e).kind;return t==="code"||t==="credential"}function _t(e,t){const r=Z(t),a=r.kind==="code"?`&code=${encodeURIComponent(St(r.code))}`:"";return`openmausbot://pair?address=${encodeURIComponent(e)}${a}`}function Lt(e){return e.protocol==="http:"&&!Re(e.hostname)}function le(e,t=qe()){if(!e?.capabilities.cloudTeam||typeof t!="string")return null;try{const r=new URL(t),a=r.protocol==="http:"&&["127.0.0.1","localhost","[::1]"].includes(r.hostname);return(r.protocol==="https:"||a)&&!r.username&&!r.password&&!r.hash?r.href:null}catch{return null}}function Ot(e,t){return e?.capabilities.cloudTeam?e.label:e?.capabilities.cloudHome?o("pair.myCloud"):o(t==="email"?"pair.signInTo":"pair.connectTo",{name:e?.label??o("pair.thisOpenMausBot",{app:A()})})}function Rt({team:e}){return n.jsx("main",{"data-team-left":!0,className:"flex min-h-screen items-center justify-center bg-app px-6 text-ink",children:n.jsx("p",{role:"status",className:"max-w-[420px] text-[16px]",children:o("homeLine.left",{name:e??o("pair.thisOpenMausBot",{app:A()})})})})}function D({initialCode:e,initialEmail:t=null,reason:r}){const[a,s]=i.useState(e??""),[c,u]=i.useState(xe()),[l,y]=i.useState(null),[f,k]=i.useState(null),[d,x]=i.useState(!1),[b,p]=i.useState(null),[g,S]=i.useState(()=>H()),[j,C]=i.useState(t&&!e?"email":"code"),[w,T]=i.useState(t??""),[E,P]=i.useState(""),[h,v]=i.useState(!1),[U,je]=i.useState(()=>Pt(e));i.useEffect(()=>{if(!U||!e)return;let m=!0;return V({code:e,label:c,attemptId:g}).then(N=>{if(m){if(N.ok){location.replace(X(location.search));return}je(!1),p(N.error)}}),()=>{m=!1}},[]),i.useEffect(()=>{fetch("/.well-known/openmausbot/environment").then(m=>m.ok?m.json():null).then(m=>{y(m)}).catch(()=>{y(null)}),F().then(k)},[]);const z=Ye(f),Ne=l?.capabilities.emailSignIn===!0,_=l?.capabilities.cloudHome===!0,Se=!_&&l?.capabilities.cloudTeam!==!0,ee=At(a),R=typeof location<"u"&&typeof location.protocol=="string"?location:null;async function Ee(m){m.preventDefault(),x(!0),p(null);const N=await V({code:a,label:c,attemptId:g});if(x(!1),N.ok){location.replace(X(location.search));return}p(N.error)}async function Ce(m){m.preventDefault(),x(!0),p(null);const N=h?await rt({email:w,code:E,label:c}):await nt(w);if(x(!1),!N.ok){p(N.error);return}if(h){location.replace(X(location.search));return}v(!0)}function te(m){C(m),p(null)}return n.jsxs("main",{className:"flex min-h-screen items-center justify-center bg-app px-6 text-ink",children:[n.jsx("div",{className:"absolute left-3 top-12 max-w-[280px]",children:n.jsx(ht,{})}),n.jsxs("div",{className:"w-full max-w-[420px]",children:[R&&Lt(R)?n.jsx("p",{role:"alert",className:"mb-4 rounded-md border border-warning/30 bg-warning/10 px-3 py-2 text-[13px] text-warning",children:o("pair.notEncrypted")}):null,U?n.jsx("p",{role:"status",className:"text-[20px] font-semibold",children:_?o("pair.openingCloud"):o("pair.connectingTo",{name:l?.label??o("pair.thisOpenMausBot")})}):n.jsxs(n.Fragment,{children:[n.jsx("h1",{className:"text-[20px] font-semibold",children:Ot(l,j)}),n.jsxs("p",{className:"mt-1.5 text-[14px] leading-relaxed text-ink-secondary",children:[l&&!_?`${o("pair.version",{version:l.version,platform:l.platform})} `:"",It({mode:j,sent:h,email:w,cloudHome:_})]}),ae(r)&&!z?n.jsx("p",{className:"mt-3 text-[13px] text-ink-secondary",children:ae(r)}):null,b&&_&&e?n.jsx("p",{className:"mt-3 text-[13px] text-ink-secondary",children:o("pair.expired",{app:A(),open:o("cloudHome.connect"),section:o("settings.section.cloudAccount")})}):null,!z&&le(l)?n.jsxs("div",{"data-team-sign-in":!0,className:"mt-4 flex flex-col items-start gap-1.5",children:[n.jsx("a",{href:le(l),className:"rounded-md bg-accent px-4 py-2 text-[14px] font-medium text-accent-ink",children:o("pair.team.open",{team:l.label})}),n.jsx("p",{className:"text-[13px] text-ink-secondary",children:o("pair.team.openHint")})]}):null]}),U?null:z?n.jsxs("p",{className:"mt-4 text-[14px]",children:[o("pair.alreadyConnected")," ",n.jsx("a",{href:"/",className:"text-accent underline",children:o("pair.openApp")})]}):j==="email"?n.jsxs("form",{onSubmit:Ce,children:[n.jsx("label",{className:O,htmlFor:"signin-email",children:o("cloudBuy.signIn.email")}),n.jsx("input",{id:"signin-email",type:"email",value:w,onChange:m=>{T(m.target.value),v(!1),P("")},autoComplete:"email",inputMode:"email",spellCheck:!1,className:L}),h?n.jsxs(n.Fragment,{children:[n.jsx("label",{className:O,htmlFor:"signin-code",children:o("pair.emailCode")}),n.jsx("input",{id:"signin-code",value:E,onChange:m=>P(m.target.value),placeholder:"12345678",autoComplete:"one-time-code",inputMode:"numeric",spellCheck:!1,className:`${L} font-mono text-[15px] tracking-[0.12em]`}),n.jsx("label",{className:O,htmlFor:"signin-label",children:o("pair.deviceLabel")}),n.jsx("input",{id:"signin-label",value:c,onChange:m=>u(m.target.value),maxLength:80,className:L})]}):null,b?n.jsx("p",{className:"mt-3 text-[13px] text-danger",children:b}):null,n.jsx("button",{type:"submit",disabled:d||!w.includes("@")||h&&E.replace(/\D/g,"").length<8,className:ie,children:o(d?h?"pair.signingIn":"pair.sending":h?"pair.signIn":"cloudBuy.signIn.send")}),h?n.jsx("button",{type:"button",onClick:()=>v(!1),className:"mt-3 w-full text-[13px] text-ink-secondary underline",children:o("pair.resend")}):null,n.jsx("button",{type:"button",onClick:()=>te("code"),className:"mt-3 w-full text-[13px] text-ink-secondary underline",children:o("pair.useCode")})]}):n.jsxs("form",{onSubmit:Ee,children:[n.jsx("label",{className:O,htmlFor:"pair-code",children:o("pair.code")}),n.jsx("input",{id:"pair-code",value:a,onChange:m=>{s(m.target.value),S(H())},placeholder:"XXXX-XXXX-XXXX","aria-describedby":e&&a===e?"pair-code-from-link":void 0,autoComplete:"one-time-code",autoCapitalize:"characters",spellCheck:!1,className:`${L} font-mono text-[15px] tracking-[0.12em]`}),e&&a===e?n.jsx("p",{id:"pair-code-from-link",className:"mt-1 text-[12px] text-ink-secondary",children:o("pair.fromLink")}):null,n.jsx("label",{className:O,htmlFor:"pair-label",children:o("pair.deviceLabel")}),n.jsx("input",{id:"pair-label",value:c,onChange:m=>u(m.target.value),maxLength:80,className:L}),ee?n.jsx("p",{role:"alert",className:"mt-3 text-[13px] text-danger",children:ee}):b?n.jsx("p",{className:"mt-3 text-[13px] text-danger",children:b}):null,n.jsx("button",{type:"submit",disabled:d||!Tt(a),className:ie,children:o(d?"pair.connecting":"pair.connect")}),R?.origin?n.jsxs("p",{className:"mt-3 text-[13px] text-ink-secondary",children:[o("pair.onPhone")," ",n.jsx("a",{href:_t(R.origin,a),className:"text-accent underline",children:o("pair.openInApp",{app:A()})})]}):null,Se?n.jsxs("p",{className:"mt-3 text-[13px] text-ink-secondary",children:[o("pair.noCode")," ",n.jsx("code",{className:"select-all rounded bg-inset px-1.5 py-0.5 text-[12px] text-ink",children:"npx limixbot pair"})]}):null,Ne?n.jsxs("p",{className:"mt-5 border-t border-hairline/40 pt-4 text-[13px] text-ink-secondary",children:[o("pair.invitedByEmail")," ",n.jsx("button",{type:"button",onClick:()=>te("email"),className:"text-accent underline",children:o("pair.useEmail")})]}):null]})]})]})}const bn="cloud-welcome-done",$t="unauthorized: you are no longer in this team",ce=[["reserving","cloudHome.step.reserving"],["storage","cloudHome.step.storage"],["starting","cloudHome.step.starting"],["checking","cloudHome.step.checking"]];function Dt({step:e}){const t=ce.findIndex(([r])=>r===e);return n.jsx("ol",{"data-cloud-setup":e,className:"flex flex-col gap-1 text-[13px]",children:ce.map(([r,a],s)=>n.jsx("li",{"aria-current":s===t?"step":void 0,className:s===t?"font-medium text-ink":s<t?"text-ink-secondary line-through decoration-ink-secondary/40":"text-ink-secondary",children:o(a)},r))})}const Bt={stopped:"cloudHome.stopped","payment-problem":"cloudHome.paymentProblem",failed:"cloudHome.failed"},ue={host:"cloudHome.unreachableHost",no_answer:"cloudHome.unreachable"};function Ht(e,t=Date.now()){const r=new Date(e).getFullYear()!==new Date(t).getFullYear();return new Intl.DateTimeFormat($e(),{day:"numeric",month:"long",...r?{year:"numeric"}:{}}).format(new Date(e))}function Ft(e,t=Date.now()){const r=e?.name??null,a=(s,c)=>r?o(c,{name:r}):o(s);return e?.screen==="setup"?{title:a("homeScreen.setup","homeScreen.setupNamed"),body:o(e.slow?"cloudHome.slow":"homeScreen.setupBody"),reason:null,action:null,busy:!0}:e?.screen==="offline"?{title:a("homeScreen.offline","homeScreen.offlineNamed"),body:o("homeScreen.offlineBack"),reason:e.cause&&Object.hasOwn(ue,e.cause)?o(ue[e.cause]):e.reason??null,action:"retry",busy:!1}:e?.screen==="signin"?{title:a("homeScreen.signIn","homeScreen.signInNamed"),body:o(e.other?"homeScreen.signInOther":"homeScreen.signInEnded"),reason:null,action:"sign-in",busy:!1}:e?.screen==="plan"&&e.member&&e.machine!=="failed"?{title:a("homeScreen.plan","homeScreen.planNamed"),body:o("cloudHome.stoppedMember"),reason:null,action:null,busy:!1}:e?.screen==="plan"?{title:a("homeScreen.plan","homeScreen.planNamed"),body:o(Bt[e.machine]??"cloudHome.failed"),reason:null,action:e.machine==="failed"?null:"manage",busy:!1}:e?.screen==="ended"?{title:a("cloudHome.ended","cloudHome.endedNamed"),body:e.deleteAt?o("cloudHome.endedFiles",{date:Ht(e.deleteAt,t)}):null,reason:null,action:"buy",busy:!1}:e?.screen==="checkout"?{title:a("cloudHome.checkout","cloudHome.checkoutNamed"),body:null,reason:null,action:"continue",busy:!1}:e?.screen==="payment"?{title:a("cloudHome.payment","cloudHome.paymentNamed"),body:o("cloudHome.paymentBody"),reason:null,action:"card",busy:!1}:e?.screen==="waking"?{title:o("homeScreen.waking"),body:null,reason:null,action:null,busy:!0}:e?.screen==="moving"?{title:a("homeScreen.moving","homeScreen.movingNamed"),body:null,reason:null,action:null,busy:!0}:{title:a("homeScreen.opening","homeScreen.openingNamed"),body:null,reason:null,action:null,busy:!0}}const Ut={retry:"cloudHome.tryAgain",buy:"cloudHome.buyAgain",continue:"cloudHome.continue",card:"cloudHome.updateCard"};function zt({name:e,remove:t}){const[r,a]=i.useState(!1),[s,c]=i.useState(!1),[u,l]=i.useState(null),y=()=>{c(!0),l(null),t().then(f=>{c(!1),f!=="removed"&&f!=="gone"&&(a(!1),l(f==="refused"?"refused":"failed"))},()=>{c(!1),a(!1),l("failed")})};return n.jsxs("div",{"data-home-remove":!0,className:"flex flex-col items-start gap-2",children:[r?n.jsxs("div",{role:"alertdialog","aria-label":o("rail.remove"),className:"flex flex-col gap-2 rounded-xl border border-hairline/70 bg-card/70 px-4 py-3",children:[n.jsx("p",{className:"text-[13px] leading-relaxed text-ink",children:o("rail.removeAsk",{name:e})}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{type:"button","data-home-remove-confirm":!0,className:"ui-button ui-button-primary",disabled:s,onClick:y,children:o("rail.removeYes")}),n.jsx("button",{type:"button",className:"ui-button",disabled:s,onClick:()=>a(!1),children:o("rail.removeNo")})]})]}):n.jsx("button",{type:"button","data-home-remove-ask":!0,className:"text-[13px] text-ink-secondary underline-offset-2 hover:text-ink hover:underline",onClick:()=>{l(null),a(!0)},children:o("rail.remove")}),u&&n.jsx("p",{role:"alert",className:"text-[13px] text-danger",children:o(u==="refused"?"rail.removeRefused":"rail.removeFailed")})]})}function Mt({bridge:e,manage:t}){const[r,a]=i.useState(null),[s,c]=i.useState(!1);i.useEffect(()=>{let x=!0;const b=e.onState(g=>a(g)),p=()=>{e.retry().then(g=>{x&&a(g)}).catch(()=>{})};return e.state().then(g=>{x&&a(g)}).catch(()=>{}).then(p),window.addEventListener("online",p),window.addEventListener("focus",p),()=>{x=!1,b(),window.removeEventListener("online",p),window.removeEventListener("focus",p)}},[e]);const u=Ft(r),l=x=>{c(!1),x().catch(()=>c(!0))},y=window.ogb?.cloudAdd?.reopen,f={retry:()=>e.retry().then(x=>a(x)),...t?{manage:t,buy:t,card:t,continue:async()=>{y&&await y().catch(()=>!1)||await t()}}:{}},k=u.action&&u.action!=="sign-in"&&u.action!=="manage"?u.action:null,d=(r?.screen==="ended"||r?.screen==="payment")&&r.removable===!0&&typeof e.remove=="function";return n.jsx("main",{"data-home-screen":r?.screen??"opening",className:"flex min-h-screen items-center justify-center bg-app px-6 text-ink",style:{WebkitAppRegion:"drag"},children:n.jsxs("div",{className:"flex w-full max-w-[420px] flex-col items-start gap-3",style:{WebkitAppRegion:"no-drag"},children:[n.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[20px] font-semibold",children:[u.busy&&n.jsx("span",{"aria-hidden":"true",className:"size-3.5 shrink-0 animate-spin rounded-full border-2 border-hairline border-t-accent"}),u.title]}),u.body&&n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:u.body}),r?.screen==="setup"&&n.jsx(Dt,{step:r.step??"reserving"}),u.reason&&n.jsx("p",{"data-home-reason":!0,className:"text-[13px] leading-relaxed text-ink-secondary",children:u.reason}),u.action==="sign-in"&&n.jsx("button",{type:"button",className:"ui-button ui-button-primary mt-2",onClick:()=>l(()=>e.signIn()),children:o("homeScreen.signInButton")}),u.action==="manage"&&t&&n.jsx("button",{type:"button",className:"ui-button mt-2",onClick:()=>l(t),children:o("cloudAccount.manageInBrowser")}),k&&f[k]&&n.jsx("button",{type:"button","data-home-action":k,className:k==="retry"?"ui-button mt-2":"ui-button ui-button-primary mt-2",onClick:()=>l(f[k]),children:o(Ut[k])}),d&&n.jsx(zt,{name:r.name??o("cloudSetup.myCloud"),remove:()=>e.remove()}),s&&n.jsx("p",{role:"alert",className:"text-[13px] text-danger",children:o("cloudAccount.actionFailed")})]})})}function Wt({bridge:e,fallback:t}){const[r,a]=i.useState(!1);return i.useEffect(()=>{e.repair().catch(()=>a(!0))},[e]),r?n.jsx(n.Fragment,{children:t}):n.jsx("main",{"data-home-screen":"opening",className:"flex min-h-screen items-center justify-center bg-app px-6 text-ink",children:n.jsx("p",{role:"status",className:"w-full max-w-[420px] text-[20px] font-semibold",children:o("homeScreen.opening")})})}const Q="omb.session-ended";let K=!1,G=null;const q=new Set;function gn(){K||G||(G=F().then(e=>{if(e.kind==="unauthenticated"){K=!0;try{sessionStorage.setItem(Q,"1")}catch{}for(const t of q)t()}}).finally(()=>{G=null}))}function de(){return K}function yn(){return i.useSyncExternalStore(e=>(q.add(e),()=>q.delete(e)),de,de)}function Xt(){try{return sessionStorage.getItem(Q)==="1"}catch{return!1}}function Gt(){try{sessionStorage.removeItem(Q)}catch{}}De();Be(He());Fe(Ue());at();ze(Me());const B=We(),Vt=new Set(["/home","/pair","/desktop-viewer"]),ve=()=>me(()=>import("./App-DXv-5ZTc.js").then(e=>e.jR),__vite__mapDeps([0,1,2,3,4,5])).catch(e=>({default:()=>{throw e}})),Kt=Vt.has(location.pathname)?null:ve(),qt=()=>fetch("/.well-known/openmausbot/environment").then(e=>e.json()).then(e=>e.capabilities?.cloudTeam===!0&&typeof e.label=="string"?e.label:null,()=>null);async function Yt(){const e=window.ogb?.home;if(location.pathname==="/home"&&e)return n.jsx(Mt,{bridge:e,manage:window.ogb?.cloudPlan?.manage});if(location.pathname==="/pair"){const a=Ze();if(a){const s=await et(a);return await B,s?n.jsx(ot,{credential:a,owner:s.owner,team:s.team}):n.jsx(D,{initialCode:null,reason:o("pair.browser.signInFailed")})}return n.jsx(D,{initialCode:Je(),initialEmail:Qe()})}const t=await F();if(t.kind==="unauthenticated"){if(await B,t.error===$t)return n.jsx(Rt,{team:await qt()});const a=n.jsx(D,{initialCode:null,reason:Xt()?o("pair.sessionEnded"):t.error});return e?n.jsx(Wt,{bridge:e,fallback:a}):a}if(Gt(),t.kind==="session"&&Ke(t.teamSignIn),t.kind==="loopback"&&t.trust==="service")return await B,n.jsx(D,{initialCode:null,reason:o("pair.serviceTrust")});if(location.pathname==="/desktop-viewer"){const{DesktopViewer:a}=await me(async()=>{const{DesktopViewer:s}=await import("./DesktopViewer-DTBmRKHz.js");return{DesktopViewer:s}},__vite__mapDeps([6,1,2,7,8,5,4,9]));return n.jsx(a,{})}const{default:r}=await(Kt??ve());return n.jsx(r,{})}document.title=A();Promise.all([Xe(),Yt(),B]).then(([,e])=>{Ge.createRoot(document.getElementById("root")).render(n.jsx(i.StrictMode,{children:n.jsx(Ve,{children:e})}))});export{yn as A,D as B,Dt as C,ht as D,en as E,xn as F,an as P,lt as S,bt as a,hn as b,un as c,it as d,Y as e,mn as f,Zt as g,dn as h,he as i,pn as j,ln as k,fn as l,rn as m,gn as n,dt as o,cn as p,Qt as q,F as r,nn as s,ct as t,ft as u,on as v,sn as w,st as x,tn as y,bn as z};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/App-BgFOjdcx.js","assets/styles-BHtUK2qB.js","assets/styles-B9SGxFnK.css","assets/PlacesRail-CUntVv3u.js","assets/monitor-7oLB-7rZ.js","assets/MenuMotion-CobYpP7L.js","assets/DesktopViewer-DTBmRKHz.js","assets/desktop-connection-Dfaq6k5a.js","assets/desktop-viewer-CF-OpSo0.js","assets/minimize-o-OFVasg.js"])))=>i.map(i=>d[i]);
2
+ import{t as o,al as Pe,r as i,j as n,S as pe,X as Ie,a as I,am as Ae,an as Te,g as $,L as _e,a0 as M,B as W,a9 as ne,ao as Le,ap as Oe,p as A,aq as Re,b as $e,s as De,l as Be,m as He,o as Fe,q as Ue,ar as ze,as as Me,x as We,v as Xe,y as Ge,P as Ve,_ as me}from"./styles-BHtUK2qB.js";function Zt(e,t){if(!t)return;if(t.kind!=="session")return t.kind==="loopback"?e:void 0;if(t.team||t.scopes.includes("admin"))return e;const r=t.email;if(r?.trim())return e?.email?.trim().toLowerCase()===r.trim().toLowerCase()?e:{email:r}}const fe="omb.team-sign-in";function Ke(e){try{e&&globalThis.localStorage?.setItem(fe,e)}catch{}}function qe(){try{return globalThis.localStorage?.getItem(fe)??null}catch{return null}}async function F(e=fetch){let t;try{t=await e("/api/auth/session",{credentials:"same-origin"})}catch(s){return{kind:"unreachable",error:s instanceof Error?s.message:String(s)}}const r=await t.json().catch(()=>({})),a=Object(r);return t.status===401||t.status===403?{kind:"unauthenticated",error:typeof a.error=="string"?a.error:`${t.status}`}:t.ok?a.kind==="session"&&typeof a.id=="string"?{kind:"session",id:a.id,label:typeof a.label=="string"?a.label:"",...typeof a.email=="string"?{email:a.email}:{},scopes:Array.isArray(a.scopes)?a.scopes.filter(s=>typeof s=="string"):[],expiresAt:typeof a.expiresAt=="number"?a.expiresAt:0,...typeof a.reactor=="string"?{reactor:a.reactor}:{},...typeof a.teamSignIn=="string"?{teamSignIn:a.teamSignIn}:{},...re(a.team)?{team:re(a.team),openedThreads:Array.isArray(a.openedThreads)?a.openedThreads.filter(s=>typeof s=="string"):[]}:{},...a.cloudGuest===!0?{cloudGuest:!0,openedThreads:Array.isArray(a.openedThreads)?a.openedThreads.filter(s=>typeof s=="string"):[]}:{}}:a.trust==="service"?{kind:"loopback",trust:"service"}:{kind:"loopback"}:{kind:"unreachable",error:`${t.status} ${t.statusText}`}}function re(e){const t=Object(e);return typeof t.id=="string"&&typeof t.name=="string"&&typeof t.role=="string"?{id:t.id,name:t.name,role:t.role}:null}function Ye(e){return e?.kind==="session"||e?.kind==="loopback"&&e.trust!=="service"}function he(e){return e?e.kind==="loopback"?e.trust!=="service":e.kind==="session"&&e.scopes.includes("admin"):!1}function Je(){const e=/[#&]code=([^&]+)/.exec(location.hash);return e?(history.replaceState(null,"",location.pathname+location.search),decodeURIComponent(e[1])):null}function Ze(){if(!/[#&]signin=/.test(location.hash))return null;const e=/[#&]signin=(omb_pair_[A-Za-z0-9_-]{43})(?:&|$)/.exec(location.hash);return history.replaceState(null,"",location.pathname+location.search),e?e[1]:null}function Qe(){const e=new URLSearchParams(location.search),t=e.get("email")?.trim().toLowerCase()??"";if(!t)return null;e.delete("email");const r=e.toString();return history.replaceState(null,"",location.pathname+(r?`?${r}`:"")+location.hash),/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(t)?t:null}function xe(e=navigator.userAgent){const t=/Edg\//.test(e)?"Edge":/OPR\//.test(e)?"Opera":/Chrome\//.test(e)?"Chrome":/Firefox\//.test(e)?"Firefox":/Safari\//.test(e)?"Safari":"Browser",r=/iPhone/.test(e)?"iPhone":/iPad/.test(e)?"iPad":/Android/.test(e)?"Android":/Mac OS X/.test(e)?"Mac":/Windows/.test(e)?"Windows":/Linux/.test(e)?"Linux":"";return r?`${t} on ${r}`:t}function H(){return typeof crypto?.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,14)}`}function be(e,t){const r=Reflect.get(Object(e),"error");return Pe(e,typeof r=="string"?r:`${t.status} ${t.statusText}`)}async function V(e,t=fetch){let r;try{r=await t("/api/auth/pair",{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json"},body:JSON.stringify({code:e.code,label:e.label,cookie:!0,attemptId:e.attemptId??H(),...e.browser?{browser:!0}:{}})})}catch(s){return{ok:!1,error:o("pair.unreachable",{error:s instanceof Error?s.message:String(s)})}}const a=await r.json().catch(()=>({}));return r.ok?{ok:!0}:{ok:!1,error:be(a,r)}}async function et(e,t=fetch){try{const r=await t("/api/auth/pair",{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json"},body:JSON.stringify({code:e,browser:!0,preview:!0})}),a=Object(await r.json().catch(()=>({}))),s=Reflect.get(a,"owner"),c=Reflect.get(a,"team");return r.ok&&typeof s=="string"&&s?{owner:s,...typeof c=="string"&&c.trim()?{team:c.trim()}:{}}:null}catch{return null}}function tt(e,t,r=fetch){return V({code:e,label:xe(),attemptId:t,browser:!0},r)}function Qt(e){const t=Object(e);return t.cloudHome===!0&&typeof t.owner=="string"&&t.owner?t.owner:null}async function ge(e,t,r){let a;try{a=await r(e,{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json"},body:JSON.stringify(t)})}catch(c){return{ok:!1,error:o("pair.unreachable",{error:c instanceof Error?c.message:String(c)})}}const s=await a.json().catch(()=>({}));return a.ok?{ok:!0}:{ok:!1,error:be(s,a)}}function nt(e,t=fetch){return ge("/api/auth/email/start",{email:e},t)}function rt(e,t=fetch){return ge("/api/auth/email/verify",{email:e.email,code:e.code,label:e.label},t)}function ae(e){return!e||/through a proxy|loopback host required|cross-origin request|^40[13]$/i.test(e)?null:e}function at(){window.ogb?.softwareRendering===!0&&(document.documentElement.dataset.softwareRendering="")}function ot({credential:e,owner:t,team:r}){const[a]=i.useState(()=>H()),[s,c]=i.useState(!1),[u,l]=i.useState(null);async function y(){c(!0),l(null);const f=await tt(e,a);if(f.ok){location.replace("/");return}c(!1),l(f.error)}return n.jsx("main",{className:"flex min-h-screen items-center justify-center bg-app px-6 text-ink",children:n.jsxs("div",{className:"w-full max-w-[420px]",children:[n.jsx("h1",{className:"text-[20px] font-semibold",children:r?o("pair.browser.teamTitle",{team:r,owner:t}):o("pair.browser.title",{owner:t})}),n.jsx("p",{className:"mt-1.5 text-[14px] text-ink-secondary",children:o("pair.browser.notYou")}),u?n.jsx("p",{role:"alert",className:"mt-3 text-[13px] text-danger",children:u}):null,n.jsx("button",{type:"button",onClick:()=>{y()},disabled:s,className:"mt-5 w-full rounded-md bg-accent px-4 py-2 text-[14px] font-medium text-accent-ink disabled:opacity-50",children:o(s?"pair.signingIn":"pair.continue")})]})})}const Y="bg-composer ring-1 ring-inset ring-ink/[0.07]",st="bg-composer ring-[0.5px] ring-ink/10",en=`${st} shadow-(--shadow-float)`,ye="transition-colors duration-[120ms] hover:bg-[color-mix(in_srgb,var(--color-composer),var(--color-ink)_7%)]",it=`${ye} aria-expanded:bg-[color-mix(in_srgb,var(--color-composer),var(--color-ink)_7%)]`,tn="bg-[color-mix(in_srgb,var(--color-composer),var(--color-ink)_7%)]",nn="focus-visible:outline-2 focus-visible:-outline-offset-2! focus-visible:outline-focus",ke="flex size-9 shrink-0 items-center justify-center rounded-full text-ink/90",J="focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",lt=`${ke} ${Y} ${it} ${J}`,rn=`${ke} ${Y} ${ye} ${J}`,ct=`flex size-[26px] shrink-0 items-center justify-center rounded-lg text-ink-secondary transition-colors hover:bg-ink/[0.06] hover:text-ink aria-expanded:bg-ink/[0.06] aria-expanded:text-ink ${J}`,an="flex size-10 shrink-0 items-center justify-center rounded-full border border-hairline bg-card text-ink hover:bg-raised focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",ut="flex size-9 shrink-0 items-center justify-center rounded-xl text-ink-secondary hover:bg-raised/60 hover:text-ink focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus";function on({open:e,onToggle:t,corner:r=!1,ref:a}){return n.jsx("button",{ref:a,type:"button","data-sidebar-search-toggle":!0,onClick:t,"aria-label":o("sidebar.searchAria"),"aria-expanded":e,title:o("sidebar.searchAria"),className:r?ct:lt,children:n.jsx(pe,{size:r?17:18,strokeWidth:1.5,"aria-hidden":"true"})})}function sn({query:e,onQuery:t,onClose:r}){return n.jsx("div",{"data-sidebar-search-pill":!0,className:"px-3 pb-2 pt-0.5",children:n.jsxs("div",{className:I("flex h-[34px] items-center gap-2 rounded-full pl-3 pr-1.5 text-ink-secondary focus-within:ring-focus",Y),children:[n.jsx(pe,{size:15,"aria-hidden":"true",className:"shrink-0"}),n.jsx("input",{autoFocus:!0,value:e,onChange:a=>t(a.target.value),onKeyDown:a=>{a.key==="Escape"&&(a.preventDefault(),r())},placeholder:o("sidebar.searchAria"),"aria-label":o("sidebar.searchAria"),className:"min-w-0 flex-1 bg-transparent text-[13px] text-ink placeholder:text-ink-tertiary focus:outline-none"}),n.jsx("button",{type:"button",onClick:r,"aria-label":o("sidebar.searchClose"),title:o("sidebar.searchClose"),className:"flex size-6 shrink-0 items-center justify-center rounded-full text-ink-tertiary hover:bg-raised hover:text-ink focus-visible:outline focus-visible:outline-2 focus-visible:outline-focus",children:n.jsx(Ie,{size:14,"aria-hidden":"true"})})]})})}function dt(e,{howTo:t=!1,onClosed:r}={}){return e.menu(t?{from:"howto"}:void 0).finally(()=>{t&&r?.()})}function ln(e){e({type:"cloudHowTo",open:!1})}function oe({text:e}){return n.jsxs("span",{className:"font-normal text-ink-secondary",children:[" · ",e]})}function pt(e){return e?.sleeps===!0?!0:e?.status==="paid"?!1:null}function mt(e){const t=e&&!window.ogb?.remoteClient?.active?window.ogb?.cloudPlan:void 0,r=e||window.ogb?.remoteClient?.active?void 0:window.ogb?.cloudAccount,[a,s]=i.useState(null),[c,u]=i.useState(!1);return i.useEffect(()=>{if(!t)return;let l=!0;return t.state().then(y=>{l&&s(pt(y))}).catch(()=>{}),()=>{l=!1}},[t]),i.useEffect(()=>r?.onState(l=>u(l.waking===!0)),[r]),{sleeps:t?a:null,waking:c}}function ft({cloudHome:e=!1,howTo:t=!1,onMenuClosed:r}){const a=window.ogb?.workspaces,[s,c]=i.useState(null),[u,l]=i.useState(!1),[y,f]=i.useState("");i.useEffect(()=>{let p=!0;const g=()=>{a?.state().then(j=>{p&&c(j)}).catch(()=>{})};g();const S=a?.onChanged?.(g);return()=>{p=!1,S?.()}},[a]);const k=mt(e||s?.home===!0),d=k.sleeps===null?"":o(k.sleeps?"cloudSetup.sleepsWhenIdle":"cloudSetup.alwaysOn"),x=k.waking?o("cloudHome.waking"):"";return{bridge:a,current:s,cloudHome:e,open:u,error:y,onLine:d,waking:x,openMenu:()=>{!a||u||(f(""),l(!0),dt(a,{howTo:t,onClosed:r}).catch(()=>f(o("sidebar.switchServerError"))).finally(()=>l(!1)))},switchable:!!a&&s?.home!==!0}}function ht(e){const t=Ae(),r=n.jsx(xt,{...e});return Te(t)?n.jsx("div",{"data-switcher-beside-rail":!0,className:t.beside?"hidden":"contents md:hidden",children:r}):r}function xt({compact:e=!1,inline:t=!1,pill:r=!1,rail:a=!1,cloudHome:s=!1,owner:c=null,howTo:u=!1,place:l,onMenuClosed:y}){const f=l||o("cloudSetup.myCloud"),{bridge:k,current:d,open:x,error:b,onLine:p,waking:g,openMenu:S}=ft({cloudHome:s,howTo:u,onMenuClosed:y}),j=h=>p?`${h} · ${p}`:h;if(!k||d?.home===!0){if(!s&&!d?.home)return null;const h=c?o("sidebar.cloudOwner",{email:c}):"",v=`${j(f)}${h?` · ${h}`:""}`;return a?n.jsx("div",{"data-cloud-home-indicator":!0,"data-workspace-switcher":"rail",role:"img","aria-label":v,title:v,className:"flex size-9 items-center justify-center text-ink-secondary",children:n.jsx($,{size:18,"aria-hidden":"true"})}):t?n.jsxs("div",{"data-cloud-home-indicator":!0,"data-workspace-switcher":"inline",title:v,className:r?"flex h-8 min-w-0 items-center gap-1 rounded-full bg-raised/50 px-3 text-[13px] font-medium text-ink":"flex min-w-0 items-center gap-1.5 px-1.5 text-[13px] font-medium text-ink",children:[n.jsx($,{size:r?15:14,"aria-hidden":"true",className:r?"hidden shrink-0 text-ink-secondary @max-[124px]/sidebar-top:block":"shrink-0 text-ink-secondary"}),n.jsx("span",{className:r?"min-w-0 truncate @max-[124px]/sidebar-top:hidden":"min-w-0 truncate",children:f}),(p||h)&&n.jsxs("span",{className:"sr-only",children:[p?` · ${p}`:"",h?` · ${h}`:""]})]}):n.jsx("div",{"data-cloud-home-indicator":!0,className:I("py-1.5",e?"px-2":"px-3"),children:n.jsxs("div",{title:v,className:I("flex items-center gap-2 py-2 text-[13px] font-medium text-ink",e?"justify-center px-1":"px-2"),children:[n.jsx($,{size:16,"aria-hidden":"true",className:"shrink-0 text-ink-secondary"}),e?n.jsx("span",{className:"sr-only",children:v}):n.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[f,p&&n.jsx(oe,{text:p}),h&&n.jsx("span",{className:"block truncate text-[12px] font-normal text-ink-secondary",children:h})]})]})})}const C=d?.profileName??(d?.local&&!d.localPath?o("place.local"):d?.name)??(s?f:o("sidebar.servers")),w=d?.local===!1||s&&!d?$:_e,T=s?j(C):C,E=d?.origin?`${T} · ${d.origin}`:T,P=o("sidebar.switchServer",{name:T});return a?n.jsxs("div",{"data-workspace-switcher":"rail",className:"relative",children:[n.jsx("button",{type:"button","aria-label":P,"aria-haspopup":"menu","aria-expanded":x,"data-cloud-home-indicator":s||void 0,"data-tour":"server-switcher",title:E,onClick:S,className:I(ut,"aria-expanded:bg-raised"),style:{WebkitAppRegion:"no-drag"},children:M(d?.color)?n.jsx(W,{color:d?.color,size:18}):n.jsx(w,{size:18,"aria-hidden":"true"})}),b&&n.jsx("p",{role:"alert",className:"absolute bottom-0 left-full z-40 ml-2 w-56 rounded-md bg-menu px-2 py-1 text-[11px] text-danger shadow-lg",children:b}),g&&!b&&n.jsx("p",{role:"status","data-cloud-waking":!0,className:"absolute bottom-0 left-full z-40 ml-2 w-56 rounded-md bg-menu px-2 py-1 text-[11px] text-ink-secondary shadow-lg",children:g})]}):t?n.jsxs("div",{"data-workspace-switcher":"inline",className:"flex min-w-0",children:[n.jsxs("button",{type:"button","aria-label":P,"aria-haspopup":"menu","aria-expanded":x,"data-cloud-home-indicator":s||void 0,"data-tour":"server-switcher",title:E,onClick:S,className:r?"flex h-8 min-w-0 max-w-full items-center gap-1 overflow-hidden rounded-full bg-raised/50 pl-2.5 pr-1.5 text-left text-[13px] font-medium text-ink hover:bg-raised aria-expanded:bg-raised focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus":"flex h-7 min-w-0 max-w-full items-center gap-1.5 overflow-hidden rounded-md px-1.5 text-left text-[13px] font-medium text-ink hover:bg-control focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",style:{WebkitAppRegion:"no-drag"},children:[M(d?.color)?n.jsx(W,{color:d?.color,size:16}):n.jsx(w,{size:r?15:14,"aria-hidden":"true","data-switcher-icon":!0,className:r?"hidden shrink-0 text-ink-secondary @max-[124px]/sidebar-top:block":"shrink-0 text-ink-secondary"}),n.jsx("span",{className:r?"min-w-0 truncate @max-[124px]/sidebar-top:hidden":"min-w-0 truncate @max-[96px]/sidebar-top:hidden",children:C}),n.jsx(ne,{size:r?12:11,"aria-hidden":"true",className:r?"shrink-0 text-ink-tertiary":"shrink-0 text-ink-secondary"})]}),b&&n.jsx("p",{role:"alert",className:"absolute right-2 top-full z-40 mt-1 w-56 max-w-[calc(100%-1rem)] rounded-md bg-menu px-2 py-1 text-[11px] text-danger shadow-lg",children:b}),g&&!b&&n.jsx("p",{role:"status","data-cloud-waking":!0,className:"absolute right-2 top-full z-40 mt-1 w-56 max-w-[calc(100%-1rem)] rounded-md bg-menu px-2 py-1 text-[11px] text-ink-secondary shadow-lg",children:g})]}):n.jsxs("div",{className:I("py-1.5",e?"px-2":"px-3"),children:[n.jsxs("button",{type:"button","aria-label":P,"aria-haspopup":"menu","aria-expanded":x,"data-cloud-home-indicator":s||void 0,"data-tour":"server-switcher",title:E,onClick:S,className:I("flex w-full items-center gap-2 rounded-lg py-2 text-left text-[13px] font-medium text-ink hover:bg-control focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",e?"justify-center px-1":"px-2"),style:{WebkitAppRegion:"no-drag"},children:[M(d?.color)?n.jsx(W,{color:d?.color,size:20}):n.jsx(w,{size:16,className:"shrink-0 text-ink-secondary"}),!e&&n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[C,s&&p&&n.jsx(oe,{text:p})]}),n.jsx(ne,{size:13,className:"shrink-0 text-ink-secondary"})]})]}),b&&n.jsx("p",{role:"alert",className:"mt-1 text-[11px] text-danger",children:b}),g&&!b&&n.jsx("p",{role:"status","data-cloud-waking":!0,className:"mt-1 text-[11px] text-ink-secondary",children:g})]})}function bt(e){const t=e&&typeof e=="object"?e.membership:void 0,r=t&&typeof t=="object"?t:{};let a=null;if(typeof r.peopleUrl=="string")try{new URL(r.peopleUrl).protocol==="https:"&&(a=r.peopleUrl)}catch{a=null}return{authority:r.authority==="portal"?"portal":"local",pairingCodes:r.pairingCodes!==!1,peopleUrl:a}}const cn=()=>({type:"toggleAppSettings",open:!0,section:"companion",phonePairing:!0});function un(e){const t=typeof window>"u"?void 0:window.ogb;return gt({companion:!!t?.companion,remoteClient:t?.remoteClient?.active===!0,cloudHome:e})}function gt(e){return e.cloudHome?"cloud":e.companion&&!e.remoteClient?"computer":"server"}const yt={computer:"sidebar.menu.connectPhone.computer",cloud:"sidebar.menu.connectPhone.cloud",server:"sidebar.menu.connectPhone.server"};function dn(e,t){const r=t?.session?.kind==="session"?t.session.team?.name:void 0;return r?{target:e,subtitleKey:"sidebar.menu.connectPhone.team",team:r}:e!=="computer"&&!(t&&t.pairingCodes&&he(t.session))?null:{target:e,subtitleKey:yt[e]}}function pn(e){return Le(e).kind!=="paid"||Oe(e)?null:e?.status==="connected"&&e.machine?.status==="ready"?"ready":"not-ready"}function mn(e,t){if(!e)return[];const r={...e,id:"here"};return e.target!=="computer"||!t?[r]:t==="not-ready"?[{...r,noteKey:"sidebar.menu.connectPhone.cloudNotReady"}]:[{id:"cloud",target:"cloud",subtitleKey:"sidebar.menu.connectPhone.cloudAlwaysOn"},r]}let se=null;function fn(e=fetch){return se??=F(e).then(async t=>{if(!he(t))return{session:t,pairingCodes:!1};const r=await e("/api/config",{credentials:"same-origin"}).then(a=>a.ok?a.json():null).catch(()=>null);return{session:t,pairingCodes:bt(r).pairingCodes}}),se}const kt="data-phone-pairing-action";function hn(e,t=r=>window.requestAnimationFrame(r)){return e?(t(()=>{e.scrollIntoView?.({block:"start"}),(e.querySelector(`[${kt}]:not([disabled])`)??e).focus({preventScroll:!0})}),!0):!1}function xn(e){const t=new URL(e);return t.searchParams.get("desktop-settings")!=="phone"?null:(t.searchParams.delete("desktop-settings"),`${t.pathname}${t.search}${t.hash}`)}function X(e){const t=new URLSearchParams(e);if(t.get("desktop-settings")==="phone")return"/?desktop-settings=phone";const r=t.get("next");return r&&/^\/(?!\/)/.test(r)&&!r.startsWith("/pair")&&!/[\\\s]/.test(r)?r:"/"}const wt="23456789ABCDEFGHJKLMNPQRSTUVWXYZ",vt=12,jt="omb_pair_",Nt=/^omb_pair_[A-Za-z0-9_-]{43}$/;function we(e){return e.toUpperCase().replace(/[^A-Z0-9]/g,"").replace(/0/g,"O").replace(/1/g,"I")}function St(e){return we(e).match(/.{1,4}/g)?.join("-")??e}const Et={emailCode:"serverError.pair.emailCode",oldCode:"serverError.pair.oldCode",scriptKey:"serverError.pair.scriptKey",notACode:"serverError.pair.notACode"};function Ct(e){let t;try{t=new URL(e)}catch{return null}const r=new URLSearchParams(t.hash.replace(/^#/,""));return t.searchParams.get("token")??t.searchParams.get("code")??r.get("code")}function Z(e){let t=e.trim();if(!t)return{kind:"empty"};if(/^[a-z][a-z0-9+.-]*:\/\//i.test(t)){const s=Ct(t);if(!s)return{kind:"wrong",problem:"notACode"};t=s.trim()}if(t.startsWith("omb_sess_"))return{kind:"wrong",problem:"scriptKey"};if(t.startsWith(jt))return Nt.test(t)?{kind:"credential",credential:t}:{kind:"wrong",problem:"notACode"};const r=t.replace(/[\s-]/g,"");if(/^\d{8}$/.test(r))return{kind:"wrong",problem:"emailCode"};if(/^\d{6}$/.test(r))return{kind:"wrong",problem:"oldCode"};const a=we(t);return a.length!==vt||[...a].some(s=>!wt.includes(s))?{kind:"wrong",problem:"notACode"}:{kind:"code",code:a}}const L="mt-1 w-full rounded-md border border-hairline/40 bg-inset px-3 py-2 text-[14px] text-ink outline-none focus:border-accent-border",ie="mt-5 w-full rounded-md bg-accent px-4 py-2 text-[14px] font-medium text-accent-ink disabled:opacity-50",O="mt-4 block text-[12px] font-medium text-ink-secondary";function Pt(e,t=typeof window<"u"&&!!window.ogb?.workspaces){return!!e&&t}function It({mode:e,sent:t,email:r,cloudHome:a}){return e==="email"?t?o("pair.intro.emailSent",{email:r}):o("pair.intro.email"):a?o("pair.intro.cloud",{app:A(),open:o("cloudHome.connect"),section:o("settings.section.cloudAccount")}):o("pair.intro.code")}function At(e){const t=Z(e);return t.kind==="wrong"&&t.problem!=="notACode"?o(Et[t.problem]):null}function Tt(e){const t=Z(e).kind;return t==="code"||t==="credential"}function _t(e,t){const r=Z(t),a=r.kind==="code"?`&code=${encodeURIComponent(St(r.code))}`:"";return`openmausbot://pair?address=${encodeURIComponent(e)}${a}`}function Lt(e){return e.protocol==="http:"&&!Re(e.hostname)}function le(e,t=qe()){if(!e?.capabilities.cloudTeam||typeof t!="string")return null;try{const r=new URL(t),a=r.protocol==="http:"&&["127.0.0.1","localhost","[::1]"].includes(r.hostname);return(r.protocol==="https:"||a)&&!r.username&&!r.password&&!r.hash?r.href:null}catch{return null}}function Ot(e,t){return e?.capabilities.cloudTeam?e.label:e?.capabilities.cloudHome?o("pair.myCloud"):o(t==="email"?"pair.signInTo":"pair.connectTo",{name:e?.label??o("pair.thisOpenMausBot",{app:A()})})}function Rt({team:e}){return n.jsx("main",{"data-team-left":!0,className:"flex min-h-screen items-center justify-center bg-app px-6 text-ink",children:n.jsx("p",{role:"status",className:"max-w-[420px] text-[16px]",children:o("homeLine.left",{name:e??o("pair.thisOpenMausBot",{app:A()})})})})}function D({initialCode:e,initialEmail:t=null,reason:r}){const[a,s]=i.useState(e??""),[c,u]=i.useState(xe()),[l,y]=i.useState(null),[f,k]=i.useState(null),[d,x]=i.useState(!1),[b,p]=i.useState(null),[g,S]=i.useState(()=>H()),[j,C]=i.useState(t&&!e?"email":"code"),[w,T]=i.useState(t??""),[E,P]=i.useState(""),[h,v]=i.useState(!1),[U,je]=i.useState(()=>Pt(e));i.useEffect(()=>{if(!U||!e)return;let m=!0;return V({code:e,label:c,attemptId:g}).then(N=>{if(m){if(N.ok){location.replace(X(location.search));return}je(!1),p(N.error)}}),()=>{m=!1}},[]),i.useEffect(()=>{fetch("/.well-known/openmausbot/environment").then(m=>m.ok?m.json():null).then(m=>{y(m)}).catch(()=>{y(null)}),F().then(k)},[]);const z=Ye(f),Ne=l?.capabilities.emailSignIn===!0,_=l?.capabilities.cloudHome===!0,Se=!_&&l?.capabilities.cloudTeam!==!0,ee=At(a),R=typeof location<"u"&&typeof location.protocol=="string"?location:null;async function Ee(m){m.preventDefault(),x(!0),p(null);const N=await V({code:a,label:c,attemptId:g});if(x(!1),N.ok){location.replace(X(location.search));return}p(N.error)}async function Ce(m){m.preventDefault(),x(!0),p(null);const N=h?await rt({email:w,code:E,label:c}):await nt(w);if(x(!1),!N.ok){p(N.error);return}if(h){location.replace(X(location.search));return}v(!0)}function te(m){C(m),p(null)}return n.jsxs("main",{className:"flex min-h-screen items-center justify-center bg-app px-6 text-ink",children:[n.jsx("div",{className:"absolute left-3 top-12 max-w-[280px]",children:n.jsx(ht,{})}),n.jsxs("div",{className:"w-full max-w-[420px]",children:[R&&Lt(R)?n.jsx("p",{role:"alert",className:"mb-4 rounded-md border border-warning/30 bg-warning/10 px-3 py-2 text-[13px] text-warning",children:o("pair.notEncrypted")}):null,U?n.jsx("p",{role:"status",className:"text-[20px] font-semibold",children:_?o("pair.openingCloud"):o("pair.connectingTo",{name:l?.label??o("pair.thisOpenMausBot")})}):n.jsxs(n.Fragment,{children:[n.jsx("h1",{className:"text-[20px] font-semibold",children:Ot(l,j)}),n.jsxs("p",{className:"mt-1.5 text-[14px] leading-relaxed text-ink-secondary",children:[l&&!_?`${o("pair.version",{version:l.version,platform:l.platform})} `:"",It({mode:j,sent:h,email:w,cloudHome:_})]}),ae(r)&&!z?n.jsx("p",{className:"mt-3 text-[13px] text-ink-secondary",children:ae(r)}):null,b&&_&&e?n.jsx("p",{className:"mt-3 text-[13px] text-ink-secondary",children:o("pair.expired",{app:A(),open:o("cloudHome.connect"),section:o("settings.section.cloudAccount")})}):null,!z&&le(l)?n.jsxs("div",{"data-team-sign-in":!0,className:"mt-4 flex flex-col items-start gap-1.5",children:[n.jsx("a",{href:le(l),className:"rounded-md bg-accent px-4 py-2 text-[14px] font-medium text-accent-ink",children:o("pair.team.open",{team:l.label})}),n.jsx("p",{className:"text-[13px] text-ink-secondary",children:o("pair.team.openHint")})]}):null]}),U?null:z?n.jsxs("p",{className:"mt-4 text-[14px]",children:[o("pair.alreadyConnected")," ",n.jsx("a",{href:"/",className:"text-accent underline",children:o("pair.openApp")})]}):j==="email"?n.jsxs("form",{onSubmit:Ce,children:[n.jsx("label",{className:O,htmlFor:"signin-email",children:o("cloudBuy.signIn.email")}),n.jsx("input",{id:"signin-email",type:"email",value:w,onChange:m=>{T(m.target.value),v(!1),P("")},autoComplete:"email",inputMode:"email",spellCheck:!1,className:L}),h?n.jsxs(n.Fragment,{children:[n.jsx("label",{className:O,htmlFor:"signin-code",children:o("pair.emailCode")}),n.jsx("input",{id:"signin-code",value:E,onChange:m=>P(m.target.value),placeholder:"12345678",autoComplete:"one-time-code",inputMode:"numeric",spellCheck:!1,className:`${L} font-mono text-[15px] tracking-[0.12em]`}),n.jsx("label",{className:O,htmlFor:"signin-label",children:o("pair.deviceLabel")}),n.jsx("input",{id:"signin-label",value:c,onChange:m=>u(m.target.value),maxLength:80,className:L})]}):null,b?n.jsx("p",{className:"mt-3 text-[13px] text-danger",children:b}):null,n.jsx("button",{type:"submit",disabled:d||!w.includes("@")||h&&E.replace(/\D/g,"").length<8,className:ie,children:o(d?h?"pair.signingIn":"pair.sending":h?"pair.signIn":"cloudBuy.signIn.send")}),h?n.jsx("button",{type:"button",onClick:()=>v(!1),className:"mt-3 w-full text-[13px] text-ink-secondary underline",children:o("pair.resend")}):null,n.jsx("button",{type:"button",onClick:()=>te("code"),className:"mt-3 w-full text-[13px] text-ink-secondary underline",children:o("pair.useCode")})]}):n.jsxs("form",{onSubmit:Ee,children:[n.jsx("label",{className:O,htmlFor:"pair-code",children:o("pair.code")}),n.jsx("input",{id:"pair-code",value:a,onChange:m=>{s(m.target.value),S(H())},placeholder:"XXXX-XXXX-XXXX","aria-describedby":e&&a===e?"pair-code-from-link":void 0,autoComplete:"one-time-code",autoCapitalize:"characters",spellCheck:!1,className:`${L} font-mono text-[15px] tracking-[0.12em]`}),e&&a===e?n.jsx("p",{id:"pair-code-from-link",className:"mt-1 text-[12px] text-ink-secondary",children:o("pair.fromLink")}):null,n.jsx("label",{className:O,htmlFor:"pair-label",children:o("pair.deviceLabel")}),n.jsx("input",{id:"pair-label",value:c,onChange:m=>u(m.target.value),maxLength:80,className:L}),ee?n.jsx("p",{role:"alert",className:"mt-3 text-[13px] text-danger",children:ee}):b?n.jsx("p",{className:"mt-3 text-[13px] text-danger",children:b}):null,n.jsx("button",{type:"submit",disabled:d||!Tt(a),className:ie,children:o(d?"pair.connecting":"pair.connect")}),R?.origin?n.jsxs("p",{className:"mt-3 text-[13px] text-ink-secondary",children:[o("pair.onPhone")," ",n.jsx("a",{href:_t(R.origin,a),className:"text-accent underline",children:o("pair.openInApp",{app:A()})})]}):null,Se?n.jsxs("p",{className:"mt-3 text-[13px] text-ink-secondary",children:[o("pair.noCode")," ",n.jsx("code",{className:"select-all rounded bg-inset px-1.5 py-0.5 text-[12px] text-ink",children:"npx limixbot pair"})]}):null,Ne?n.jsxs("p",{className:"mt-5 border-t border-hairline/40 pt-4 text-[13px] text-ink-secondary",children:[o("pair.invitedByEmail")," ",n.jsx("button",{type:"button",onClick:()=>te("email"),className:"text-accent underline",children:o("pair.useEmail")})]}):null]})]})]})}const bn="cloud-welcome-done",$t="unauthorized: you are no longer in this team",ce=[["reserving","cloudHome.step.reserving"],["storage","cloudHome.step.storage"],["starting","cloudHome.step.starting"],["checking","cloudHome.step.checking"]];function Dt({step:e}){const t=ce.findIndex(([r])=>r===e);return n.jsx("ol",{"data-cloud-setup":e,className:"flex flex-col gap-1 text-[13px]",children:ce.map(([r,a],s)=>n.jsx("li",{"aria-current":s===t?"step":void 0,className:s===t?"font-medium text-ink":s<t?"text-ink-secondary line-through decoration-ink-secondary/40":"text-ink-secondary",children:o(a)},r))})}const Bt={stopped:"cloudHome.stopped","payment-problem":"cloudHome.paymentProblem",failed:"cloudHome.failed"},ue={host:"cloudHome.unreachableHost",no_answer:"cloudHome.unreachable"};function Ht(e,t=Date.now()){const r=new Date(e).getFullYear()!==new Date(t).getFullYear();return new Intl.DateTimeFormat($e(),{day:"numeric",month:"long",...r?{year:"numeric"}:{}}).format(new Date(e))}function Ft(e,t=Date.now()){const r=e?.name??null,a=(s,c)=>r?o(c,{name:r}):o(s);return e?.screen==="setup"?{title:a("homeScreen.setup","homeScreen.setupNamed"),body:o(e.slow?"cloudHome.slow":"homeScreen.setupBody"),reason:null,action:null,busy:!0}:e?.screen==="offline"?{title:a("homeScreen.offline","homeScreen.offlineNamed"),body:o("homeScreen.offlineBack"),reason:e.cause&&Object.hasOwn(ue,e.cause)?o(ue[e.cause]):e.reason??null,action:"retry",busy:!1}:e?.screen==="signin"?{title:a("homeScreen.signIn","homeScreen.signInNamed"),body:o(e.other?"homeScreen.signInOther":"homeScreen.signInEnded"),reason:null,action:"sign-in",busy:!1}:e?.screen==="plan"&&e.member&&e.machine!=="failed"?{title:a("homeScreen.plan","homeScreen.planNamed"),body:o("cloudHome.stoppedMember"),reason:null,action:null,busy:!1}:e?.screen==="plan"?{title:a("homeScreen.plan","homeScreen.planNamed"),body:o(Bt[e.machine]??"cloudHome.failed"),reason:null,action:e.machine==="failed"?null:"manage",busy:!1}:e?.screen==="ended"?{title:a("cloudHome.ended","cloudHome.endedNamed"),body:e.deleteAt?o("cloudHome.endedFiles",{date:Ht(e.deleteAt,t)}):null,reason:null,action:"buy",busy:!1}:e?.screen==="checkout"?{title:a("cloudHome.checkout","cloudHome.checkoutNamed"),body:null,reason:null,action:"continue",busy:!1}:e?.screen==="payment"?{title:a("cloudHome.payment","cloudHome.paymentNamed"),body:o("cloudHome.paymentBody"),reason:null,action:"card",busy:!1}:e?.screen==="waking"?{title:o("homeScreen.waking"),body:null,reason:null,action:null,busy:!0}:e?.screen==="moving"?{title:a("homeScreen.moving","homeScreen.movingNamed"),body:null,reason:null,action:null,busy:!0}:{title:a("homeScreen.opening","homeScreen.openingNamed"),body:null,reason:null,action:null,busy:!0}}const Ut={retry:"cloudHome.tryAgain",buy:"cloudHome.buyAgain",continue:"cloudHome.continue",card:"cloudHome.updateCard"};function zt({name:e,remove:t}){const[r,a]=i.useState(!1),[s,c]=i.useState(!1),[u,l]=i.useState(null),y=()=>{c(!0),l(null),t().then(f=>{c(!1),f!=="removed"&&f!=="gone"&&(a(!1),l(f==="refused"?"refused":"failed"))},()=>{c(!1),a(!1),l("failed")})};return n.jsxs("div",{"data-home-remove":!0,className:"flex flex-col items-start gap-2",children:[r?n.jsxs("div",{role:"alertdialog","aria-label":o("rail.remove"),className:"flex flex-col gap-2 rounded-xl border border-hairline/70 bg-card/70 px-4 py-3",children:[n.jsx("p",{className:"text-[13px] leading-relaxed text-ink",children:o("rail.removeAsk",{name:e})}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{type:"button","data-home-remove-confirm":!0,className:"ui-button ui-button-primary",disabled:s,onClick:y,children:o("rail.removeYes")}),n.jsx("button",{type:"button",className:"ui-button",disabled:s,onClick:()=>a(!1),children:o("rail.removeNo")})]})]}):n.jsx("button",{type:"button","data-home-remove-ask":!0,className:"text-[13px] text-ink-secondary underline-offset-2 hover:text-ink hover:underline",onClick:()=>{l(null),a(!0)},children:o("rail.remove")}),u&&n.jsx("p",{role:"alert",className:"text-[13px] text-danger",children:o(u==="refused"?"rail.removeRefused":"rail.removeFailed")})]})}function Mt({bridge:e,manage:t}){const[r,a]=i.useState(null),[s,c]=i.useState(!1);i.useEffect(()=>{let x=!0;const b=e.onState(g=>a(g)),p=()=>{e.retry().then(g=>{x&&a(g)}).catch(()=>{})};return e.state().then(g=>{x&&a(g)}).catch(()=>{}).then(p),window.addEventListener("online",p),window.addEventListener("focus",p),()=>{x=!1,b(),window.removeEventListener("online",p),window.removeEventListener("focus",p)}},[e]);const u=Ft(r),l=x=>{c(!1),x().catch(()=>c(!0))},y=window.ogb?.cloudAdd?.reopen,f={retry:()=>e.retry().then(x=>a(x)),...t?{manage:t,buy:t,card:t,continue:async()=>{y&&await y().catch(()=>!1)||await t()}}:{}},k=u.action&&u.action!=="sign-in"&&u.action!=="manage"?u.action:null,d=(r?.screen==="ended"||r?.screen==="payment")&&r.removable===!0&&typeof e.remove=="function";return n.jsx("main",{"data-home-screen":r?.screen??"opening",className:"flex min-h-screen items-center justify-center bg-app px-6 text-ink",style:{WebkitAppRegion:"drag"},children:n.jsxs("div",{className:"flex w-full max-w-[420px] flex-col items-start gap-3",style:{WebkitAppRegion:"no-drag"},children:[n.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[20px] font-semibold",children:[u.busy&&n.jsx("span",{"aria-hidden":"true",className:"size-3.5 shrink-0 animate-spin rounded-full border-2 border-hairline border-t-accent"}),u.title]}),u.body&&n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:u.body}),r?.screen==="setup"&&n.jsx(Dt,{step:r.step??"reserving"}),u.reason&&n.jsx("p",{"data-home-reason":!0,className:"text-[13px] leading-relaxed text-ink-secondary",children:u.reason}),u.action==="sign-in"&&n.jsx("button",{type:"button",className:"ui-button ui-button-primary mt-2",onClick:()=>l(()=>e.signIn()),children:o("homeScreen.signInButton")}),u.action==="manage"&&t&&n.jsx("button",{type:"button",className:"ui-button mt-2",onClick:()=>l(t),children:o("cloudAccount.manageInBrowser")}),k&&f[k]&&n.jsx("button",{type:"button","data-home-action":k,className:k==="retry"?"ui-button mt-2":"ui-button ui-button-primary mt-2",onClick:()=>l(f[k]),children:o(Ut[k])}),d&&n.jsx(zt,{name:r.name??o("cloudSetup.myCloud"),remove:()=>e.remove()}),s&&n.jsx("p",{role:"alert",className:"text-[13px] text-danger",children:o("cloudAccount.actionFailed")})]})})}function Wt({bridge:e,fallback:t}){const[r,a]=i.useState(!1);return i.useEffect(()=>{e.repair().catch(()=>a(!0))},[e]),r?n.jsx(n.Fragment,{children:t}):n.jsx("main",{"data-home-screen":"opening",className:"flex min-h-screen items-center justify-center bg-app px-6 text-ink",children:n.jsx("p",{role:"status",className:"w-full max-w-[420px] text-[20px] font-semibold",children:o("homeScreen.opening")})})}const Q="omb.session-ended";let K=!1,G=null;const q=new Set;function gn(){K||G||(G=F().then(e=>{if(e.kind==="unauthenticated"){K=!0;try{sessionStorage.setItem(Q,"1")}catch{}for(const t of q)t()}}).finally(()=>{G=null}))}function de(){return K}function yn(){return i.useSyncExternalStore(e=>(q.add(e),()=>q.delete(e)),de,de)}function Xt(){try{return sessionStorage.getItem(Q)==="1"}catch{return!1}}function Gt(){try{sessionStorage.removeItem(Q)}catch{}}De();Be(He());Fe(Ue());at();ze(Me());const B=We(),Vt=new Set(["/home","/pair","/desktop-viewer"]),ve=()=>me(()=>import("./App-BgFOjdcx.js").then(e=>e.jS),__vite__mapDeps([0,1,2,3,4,5])).catch(e=>({default:()=>{throw e}})),Kt=Vt.has(location.pathname)?null:ve(),qt=()=>fetch("/.well-known/openmausbot/environment").then(e=>e.json()).then(e=>e.capabilities?.cloudTeam===!0&&typeof e.label=="string"?e.label:null,()=>null);async function Yt(){const e=window.ogb?.home;if(location.pathname==="/home"&&e)return n.jsx(Mt,{bridge:e,manage:window.ogb?.cloudPlan?.manage});if(location.pathname==="/pair"){const a=Ze();if(a){const s=await et(a);return await B,s?n.jsx(ot,{credential:a,owner:s.owner,team:s.team}):n.jsx(D,{initialCode:null,reason:o("pair.browser.signInFailed")})}return n.jsx(D,{initialCode:Je(),initialEmail:Qe()})}const t=await F();if(t.kind==="unauthenticated"){if(await B,t.error===$t)return n.jsx(Rt,{team:await qt()});const a=n.jsx(D,{initialCode:null,reason:Xt()?o("pair.sessionEnded"):t.error});return e?n.jsx(Wt,{bridge:e,fallback:a}):a}if(Gt(),t.kind==="session"&&Ke(t.teamSignIn),t.kind==="loopback"&&t.trust==="service")return await B,n.jsx(D,{initialCode:null,reason:o("pair.serviceTrust")});if(location.pathname==="/desktop-viewer"){const{DesktopViewer:a}=await me(async()=>{const{DesktopViewer:s}=await import("./DesktopViewer-DTBmRKHz.js");return{DesktopViewer:s}},__vite__mapDeps([6,1,2,7,8,5,4,9]));return n.jsx(a,{})}const{default:r}=await(Kt??ve());return n.jsx(r,{})}document.title=A();Promise.all([Xe(),Yt(),B]).then(([,e])=>{Ge.createRoot(document.getElementById("root")).render(n.jsx(i.StrictMode,{children:n.jsx(Ve,{children:e})}))});export{yn as A,D as B,Dt as C,ht as D,en as E,xn as F,an as P,lt as S,bt as a,hn as b,un as c,it as d,Y as e,mn as f,Zt as g,dn as h,he as i,pn as j,ln as k,fn as l,rn as m,gn as n,dt as o,cn as p,Qt as q,F as r,nn as s,ct as t,ft as u,on as v,sn as w,st as x,tn as y,bn as z};
@@ -1,3 +1,3 @@
1
- import{d9 as W,da as A,db as k,dc as C,dd as $,de as q,df as z,dg as U,dh as X}from"./App-DXv-5ZTc.js";import T from"./katex-HP8lGamR.js";import"./styles-BHtUK2qB.js";import"./index-BBObcTo5.js";import"./PlacesRail-CUntVv3u.js";import"./monitor-7oLB-7rZ.js";import"./MenuMotion-CobYpP7L.js";const j=/[#.]/g;function Y(e,t){const n=e||"",r={};let o=0,i,s;for(;o<n.length;){j.lastIndex=o;const a=j.exec(n),c=n.slice(o,a?a.index:n.length);c&&(i?i==="#"?r.id=c:Array.isArray(r.className)?r.className.push(c):r.className=[c]:s=c,o+=c.length),a&&(i=a[0],o++)}return{type:"element",tagName:s||t||"div",properties:r,children:[]}}function B(e,t,n){const r=n?v(n):void 0;function o(i,s,...a){let c;if(i==null){c={type:"root",children:[]};const f=s;a.unshift(f)}else{c=Y(i,t);const f=c.tagName.toLowerCase(),l=r?r.get(f):void 0;if(c.tagName=l||f,J(s))a.unshift(s);else for(const[u,d]of Object.entries(s))Q(e,c.properties,u,d)}for(const f of a)w(c.children,f);return c.type==="element"&&c.tagName==="template"&&(c.content={type:"root",children:c.children},c.children=[]),c}return o}function J(e){if(e===null||typeof e!="object"||Array.isArray(e))return!0;if(typeof e.type!="string")return!1;const t=e,n=Object.keys(e);for(const r of n){const o=t[r];if(o&&typeof o=="object"){if(!Array.isArray(o))return!0;const i=o;for(const s of i)if(typeof s!="number"&&typeof s!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function Q(e,t,n,r){const o=W(e,n);let i;if(r!=null){if(typeof r=="number"){if(Number.isNaN(r))return;i=r}else typeof r=="boolean"?i=r:typeof r=="string"?o.spaceSeparated?i=A(r):o.commaSeparated?i=k(r):o.commaOrSpaceSeparated?i=A(k(r).join(" ")):i=E(o,o.property,r):Array.isArray(r)?i=[...r]:i=o.property==="style"?Z(r):String(r);if(Array.isArray(i)){const s=[];for(const a of i)s.push(E(o,o.property,a));i=s}o.property==="className"&&Array.isArray(t.className)&&(i=t.className.concat(i)),t[o.property]=i}}function w(e,t){if(t!=null)if(typeof t=="number"||typeof t=="string")e.push({type:"text",value:String(t)});else if(Array.isArray(t))for(const n of t)w(e,n);else if(typeof t=="object"&&"type"in t)t.type==="root"?w(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function E(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||C(n)===C(t)))return!0}return n}function Z(e){const t=[];for(const[n,r]of Object.entries(e))t.push([n,r].join(": "));return t.join("; ")}function v(e){const t=new Map;for(const n of e)t.set(n.toLowerCase(),n);return t}const ee=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],te=B($,"div"),ne=B(q,"g",ee),y={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function re(e,t){return P(e,{})||{type:"root",children:[]}}function P(e,t){const n=oe(e,t);return n&&t.afterTransform&&t.afterTransform(e,n),n}function oe(e,t){switch(e.nodeType){case 1:return ae(e,t);case 3:return se(e);case 8:return ce(e);case 9:return S(e,t);case 10:return ie();case 11:return S(e,t);default:return}}function S(e,t){return{type:"root",children:D(e,t)}}function ie(){return{type:"doctype"}}function se(e){return{type:"text",value:e.nodeValue||""}}function ce(e){return{type:"comment",value:e.nodeValue||""}}function ae(e,t){const n=e.namespaceURI,r=n===y.svg?ne:te,o=n===y.html?e.tagName.toLowerCase():e.tagName,i=n===y.html&&o==="template"?e.content:e,s=e.getAttributeNames(),a={};let c=-1;for(;++c<s.length;)a[s[c]]=e.getAttribute(s[c])||"";return r(o,a,D(i,t))}function D(e,t){const n=e.childNodes,r=[];let o=-1;for(;++o<n.length;){const i=P(n[o],t);i!==void 0&&r.push(i)}return r}new DOMParser;function fe(e,t){const n=le(e);return re(n)}function le(e){const t=document.createElement("template");return t.innerHTML=e,t.content}const I=(function(e,t,n){const r=z(n);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if(typeof t=="number"){if(t<0||t===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(t=e.children.indexOf(t),t<0)throw new Error("Expected child node or index");for(;++t<e.children.length;)if(r(e.children[t],t,e))return e.children[t]}),h=(function(e){if(e==null)return he;if(typeof e=="string")return pe(e);if(typeof e=="object")return ue(e);if(typeof e=="function")return b(e);throw new Error("Expected function, string, or array as `test`")});function ue(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=h(e[n]);return b(r);function r(...o){let i=-1;for(;++i<t.length;)if(t[i].apply(this,o))return!0;return!1}}function pe(e){return b(t);function t(n){return n.tagName===e}}function b(e){return t;function t(n,r,o){return!!(de(n)&&e.call(this,n,typeof r=="number"?r:void 0,o||void 0))}}function he(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function de(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const O=/\n/g,M=/[\t ]+/g,N=h("br"),F=h(Ae),me=h("p"),L=h("tr"),ge=h(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",xe,ke]),G=h(["address","article","aside","blockquote","body","caption","center","dd","dialog","dir","dl","dt","div","figure","figcaption","footer","form,","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","p","plaintext","pre","section","ul","xmp"]);function ye(e,t){const n=t||{},r="children"in e?e.children:[],o=G(e),i=H(e,{whitespace:n.whitespace||"normal"}),s=[];(e.type==="text"||e.type==="comment")&&s.push(..._(e,{breakBefore:!0,breakAfter:!0}));let a=-1;for(;++a<r.length;)s.push(...R(r[a],e,{whitespace:i,breakBefore:a?void 0:o,breakAfter:a<r.length-1?N(r[a+1]):o}));const c=[];let f;for(a=-1;++a<s.length;){const l=s[a];typeof l=="number"?f!==void 0&&l>f&&(f=l):l&&(f!==void 0&&f>-1&&c.push(`
1
+ import{d9 as W,da as A,db as k,dc as C,dd as $,de as q,df as z,dg as U,dh as X}from"./App-BgFOjdcx.js";import T from"./katex-HP8lGamR.js";import"./styles-BHtUK2qB.js";import"./index--etc8Lh7.js";import"./PlacesRail-CUntVv3u.js";import"./monitor-7oLB-7rZ.js";import"./MenuMotion-CobYpP7L.js";const j=/[#.]/g;function Y(e,t){const n=e||"",r={};let o=0,i,s;for(;o<n.length;){j.lastIndex=o;const a=j.exec(n),c=n.slice(o,a?a.index:n.length);c&&(i?i==="#"?r.id=c:Array.isArray(r.className)?r.className.push(c):r.className=[c]:s=c,o+=c.length),a&&(i=a[0],o++)}return{type:"element",tagName:s||t||"div",properties:r,children:[]}}function B(e,t,n){const r=n?v(n):void 0;function o(i,s,...a){let c;if(i==null){c={type:"root",children:[]};const f=s;a.unshift(f)}else{c=Y(i,t);const f=c.tagName.toLowerCase(),l=r?r.get(f):void 0;if(c.tagName=l||f,J(s))a.unshift(s);else for(const[u,d]of Object.entries(s))Q(e,c.properties,u,d)}for(const f of a)w(c.children,f);return c.type==="element"&&c.tagName==="template"&&(c.content={type:"root",children:c.children},c.children=[]),c}return o}function J(e){if(e===null||typeof e!="object"||Array.isArray(e))return!0;if(typeof e.type!="string")return!1;const t=e,n=Object.keys(e);for(const r of n){const o=t[r];if(o&&typeof o=="object"){if(!Array.isArray(o))return!0;const i=o;for(const s of i)if(typeof s!="number"&&typeof s!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function Q(e,t,n,r){const o=W(e,n);let i;if(r!=null){if(typeof r=="number"){if(Number.isNaN(r))return;i=r}else typeof r=="boolean"?i=r:typeof r=="string"?o.spaceSeparated?i=A(r):o.commaSeparated?i=k(r):o.commaOrSpaceSeparated?i=A(k(r).join(" ")):i=E(o,o.property,r):Array.isArray(r)?i=[...r]:i=o.property==="style"?Z(r):String(r);if(Array.isArray(i)){const s=[];for(const a of i)s.push(E(o,o.property,a));i=s}o.property==="className"&&Array.isArray(t.className)&&(i=t.className.concat(i)),t[o.property]=i}}function w(e,t){if(t!=null)if(typeof t=="number"||typeof t=="string")e.push({type:"text",value:String(t)});else if(Array.isArray(t))for(const n of t)w(e,n);else if(typeof t=="object"&&"type"in t)t.type==="root"?w(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function E(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||C(n)===C(t)))return!0}return n}function Z(e){const t=[];for(const[n,r]of Object.entries(e))t.push([n,r].join(": "));return t.join("; ")}function v(e){const t=new Map;for(const n of e)t.set(n.toLowerCase(),n);return t}const ee=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],te=B($,"div"),ne=B(q,"g",ee),y={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function re(e,t){return P(e,{})||{type:"root",children:[]}}function P(e,t){const n=oe(e,t);return n&&t.afterTransform&&t.afterTransform(e,n),n}function oe(e,t){switch(e.nodeType){case 1:return ae(e,t);case 3:return se(e);case 8:return ce(e);case 9:return S(e,t);case 10:return ie();case 11:return S(e,t);default:return}}function S(e,t){return{type:"root",children:D(e,t)}}function ie(){return{type:"doctype"}}function se(e){return{type:"text",value:e.nodeValue||""}}function ce(e){return{type:"comment",value:e.nodeValue||""}}function ae(e,t){const n=e.namespaceURI,r=n===y.svg?ne:te,o=n===y.html?e.tagName.toLowerCase():e.tagName,i=n===y.html&&o==="template"?e.content:e,s=e.getAttributeNames(),a={};let c=-1;for(;++c<s.length;)a[s[c]]=e.getAttribute(s[c])||"";return r(o,a,D(i,t))}function D(e,t){const n=e.childNodes,r=[];let o=-1;for(;++o<n.length;){const i=P(n[o],t);i!==void 0&&r.push(i)}return r}new DOMParser;function fe(e,t){const n=le(e);return re(n)}function le(e){const t=document.createElement("template");return t.innerHTML=e,t.content}const I=(function(e,t,n){const r=z(n);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if(typeof t=="number"){if(t<0||t===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(t=e.children.indexOf(t),t<0)throw new Error("Expected child node or index");for(;++t<e.children.length;)if(r(e.children[t],t,e))return e.children[t]}),h=(function(e){if(e==null)return he;if(typeof e=="string")return pe(e);if(typeof e=="object")return ue(e);if(typeof e=="function")return b(e);throw new Error("Expected function, string, or array as `test`")});function ue(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=h(e[n]);return b(r);function r(...o){let i=-1;for(;++i<t.length;)if(t[i].apply(this,o))return!0;return!1}}function pe(e){return b(t);function t(n){return n.tagName===e}}function b(e){return t;function t(n,r,o){return!!(de(n)&&e.call(this,n,typeof r=="number"?r:void 0,o||void 0))}}function he(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function de(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const O=/\n/g,M=/[\t ]+/g,N=h("br"),F=h(Ae),me=h("p"),L=h("tr"),ge=h(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",xe,ke]),G=h(["address","article","aside","blockquote","body","caption","center","dd","dialog","dir","dl","dt","div","figure","figcaption","footer","form,","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","p","plaintext","pre","section","ul","xmp"]);function ye(e,t){const n=t||{},r="children"in e?e.children:[],o=G(e),i=H(e,{whitespace:n.whitespace||"normal"}),s=[];(e.type==="text"||e.type==="comment")&&s.push(..._(e,{breakBefore:!0,breakAfter:!0}));let a=-1;for(;++a<r.length;)s.push(...R(r[a],e,{whitespace:i,breakBefore:a?void 0:o,breakAfter:a<r.length-1?N(r[a+1]):o}));const c=[];let f;for(a=-1;++a<s.length;){const l=s[a];typeof l=="number"?f!==void 0&&l>f&&(f=l):l&&(f!==void 0&&f>-1&&c.push(`
2
2
  `.repeat(f)||" "),f=-1,c.push(l))}return c.join("")}function R(e,t,n){return e.type==="element"?we(e,t,n):e.type==="text"?n.whitespace==="normal"?_(e,n):Ne(e):[]}function we(e,t,n){const r=H(e,n),o=e.children||[];let i=-1,s=[];if(ge(e))return s;let a,c;for(N(e)||L(e)&&I(t,e,L)?c=`
3
3
  `:me(e)?(a=2,c=2):G(e)&&(a=1,c=1);++i<o.length;)s=s.concat(R(o[i],e,{whitespace:r,breakBefore:i?void 0:a,breakAfter:i<o.length-1?N(o[i+1]):c}));return F(e)&&I(t,e,F)&&s.push(" "),a&&s.unshift(a),c&&s.push(c),s}function _(e,t){const n=String(e.value),r=[],o=[];let i=0;for(;i<=n.length;){O.lastIndex=i;const c=O.exec(n),f=c&&"index"in c?c.index:n.length;r.push(be(n.slice(i,f).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),i===0?t.breakBefore:!0,f===n.length?t.breakAfter:!0)),i=f+1}let s=-1,a;for(;++s<r.length;)r[s].charCodeAt(r[s].length-1)===8203||s<r.length-1&&r[s+1].charCodeAt(0)===8203?(o.push(r[s]),a=void 0):r[s]?(typeof a=="number"&&o.push(a),o.push(r[s]),a=0):(s===0||s===r.length-1)&&o.push(0);return o}function Ne(e){return[String(e.value)]}function be(e,t,n){const r=[];let o=0,i;for(;o<e.length;){M.lastIndex=o;const s=M.exec(e);i=s?s.index:e.length,!o&&!i&&s&&!t&&r.push(""),o!==i&&r.push(e.slice(o,i)),o=s?i+s[0].length:i}return o!==i&&!n&&r.push(""),r.join(" ")}function H(e,t){if(e.type==="element"){const n=e.properties||{};switch(e.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return n.wrap?"pre-wrap":"pre";case"td":case"th":return n.noWrap?"nowrap":t.whitespace;case"textarea":return"pre-wrap"}}return t.whitespace}function xe(e){return!!(e.properties||{}).hidden}function Ae(e){return e.tagName==="td"||e.tagName==="th"}function ke(e){return e.tagName==="dialog"&&!(e.properties||{}).open}const Ce={},Te=[];function Le(e){const t=e||Ce;return function(n,r){U(n,"element",function(o,i){const s=Array.isArray(o.properties.className)?o.properties.className:Te,a=s.includes("language-math"),c=s.includes("math-display"),f=s.includes("math-inline");let l=c;if(!a&&!c&&!f)return;let u=i[i.length-1],d=o;if(o.tagName==="code"&&a&&u&&u.type==="element"&&u.tagName==="pre"&&(d=u,u=i[i.length-2],l=!0),!u)return;const m=ye(d,{whitespace:"pre"});let p;try{p=T.renderToString(m,{...t,displayMode:l,throwOnError:!0})}catch(g){const x=g,V=x.name.toLowerCase();r.message("Could not render math with KaTeX",{ancestors:[...i,o],cause:x,place:o.position,ruleId:V,source:"rehype-katex"});try{p=T.renderToString(m,{...t,displayMode:l,strict:"ignore",throwOnError:!1})}catch{p=[{type:"element",tagName:"span",properties:{className:["katex-error"],style:"color:"+(t.errorColor||"#cc0000"),title:String(g)},children:[{type:"text",value:m}]}]}}typeof p=="string"&&(p=fe(p).children);const K=u.children.indexOf(d);return u.children.splice(K,1,...p),X})}}export{Le as default};
@@ -1 +1 @@
1
- import{r as i}from"./styles-BHtUK2qB.js";import{n as p}from"./App-DXv-5ZTc.js";let l={servers:null,error:!1},o=null,u=0;const c=new Set,a=()=>l,v=e=>(c.add(e),()=>{c.delete(e)});function d(e){u+=1,o=null,l={servers:e.map(({name:r,enabled:t,bot:s,offFor:n})=>({name:r,enabled:!!t,...s?{bot:s}:{},...n?.length?{offFor:n}:{}})),error:!1};for(const r of c)r()}function f(e=!1){if(!e&&l.servers&&!l.error)return Promise.resolve(l.servers);if(!e&&o)return o;const r=++u;return o=p("/api/mcp/servers").then(t=>(r===u&&d(t.servers??[]),l.servers??[])).catch(()=>{if(r===u){l={...l,error:!0};for(const t of c)t()}return l.servers??[]}).finally(()=>{r===u&&(o=null)}),o}function h(){const e=i.useSyncExternalStore(v,a,a);return i.useEffect(()=>{f(!0)},[]),{...e,refresh:()=>f(!0)}}function m(e,r){return e.filter(t=>!t.bot||t.bot===r)}function g(e,r,t){const s=m(e,t).filter(n=>n.enabled);return r==null?s:s.filter(n=>r.includes(n.name))}function x(e,r,t){const s=r??e.filter(n=>n.enabled).map(n=>n.name);return s.includes(t)?s.filter(n=>n!==t):[...s,t]}export{h as a,m as b,x as c,g as m,d as u};
1
+ import{r as i}from"./styles-BHtUK2qB.js";import{n as p}from"./App-BgFOjdcx.js";let l={servers:null,error:!1},o=null,u=0;const c=new Set,a=()=>l,v=e=>(c.add(e),()=>{c.delete(e)});function d(e){u+=1,o=null,l={servers:e.map(({name:r,enabled:t,bot:s,offFor:n})=>({name:r,enabled:!!t,...s?{bot:s}:{},...n?.length?{offFor:n}:{}})),error:!1};for(const r of c)r()}function f(e=!1){if(!e&&l.servers&&!l.error)return Promise.resolve(l.servers);if(!e&&o)return o;const r=++u;return o=p("/api/mcp/servers").then(t=>(r===u&&d(t.servers??[]),l.servers??[])).catch(()=>{if(r===u){l={...l,error:!0};for(const t of c)t()}return l.servers??[]}).finally(()=>{r===u&&(o=null)}),o}function h(){const e=i.useSyncExternalStore(v,a,a);return i.useEffect(()=>{f(!0)},[]),{...e,refresh:()=>f(!0)}}function m(e,r){return e.filter(t=>!t.bot||t.bot===r)}function g(e,r,t){const s=m(e,t).filter(n=>n.enabled);return r==null?s:s.filter(n=>r.includes(n.name))}function x(e,r,t){const s=r??e.filter(n=>n.enabled).map(n=>n.name);return s.includes(t)?s.filter(n=>n!==t):[...s,t]}export{h as a,m as b,x as c,g as m,d as u};