@puddle-code/cli 0.5.6 → 0.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -7
- package/dist/host-control.mjs +20 -1
- package/dist/index.js +51 -6
- package/dist/public/assets/App-B8Qq_mnE.js +14 -0
- package/dist/public/assets/{CompilationCommandForm-DXHvwQ8Y.js → CompilationCommandForm--aglvHpg.js} +1 -1
- package/dist/public/assets/Dashboard-CLdNA8WP.js +1 -0
- package/dist/public/assets/DraftRecovery-Da7OryXQ.js +1 -0
- package/dist/public/assets/EditorTabClose-CQ73_M1i.js +1 -0
- package/dist/public/assets/{FileCloseScope-DoZ0oLf8.js → FileCloseScope-B527gWqW.js} +1 -1
- package/dist/public/assets/{FileEditorSettingsMenu-BbRHII96.js → FileEditorSettingsMenu-X23c7860.js} +1 -1
- package/dist/public/assets/{FindWidget-ET5pwkkB.js → FindWidget-FJWGUnZT.js} +1 -1
- package/dist/public/assets/HuddlePane-BLBAcqwy.js +219 -0
- package/dist/public/assets/{LazyTerminal-DnrWO9aI.js → LazyTerminal-Cu5V6ejk.js} +2 -2
- package/dist/public/assets/{NotebookWidget-BDdx0BOy.js → NotebookWidget-CXmf3IRw.js} +2 -2
- package/dist/public/assets/{PaneEditorBody-C1uu9cRG.js → PaneEditorBody-DdnVw9lV.js} +19 -19
- package/dist/public/assets/{PdfViewer-DLCPKybn.js → PdfViewer-CSMNKPo1.js} +1 -1
- package/dist/public/assets/ReadOnlyDiff-BwUPy5CW.js +2 -0
- package/dist/public/assets/{ReleaseNotesDialog-B9fRaZNN.js → ReleaseNotesDialog-B1DpXA1c.js} +1 -1
- package/dist/public/assets/Ripple-D1mXgP5b.js +11 -0
- package/dist/public/assets/SettingsDialog-Dxyi7dhn.js +8 -0
- package/dist/public/assets/{Terminal-BP1tyPdf.js → Terminal-J5WMTjuY.js} +6 -6
- package/dist/public/assets/Workspace-DQDh6TQ7.js +20 -0
- package/dist/public/assets/api-DhfvolrJ.js +1 -0
- package/dist/public/assets/auth-BPXeEntX.js +1 -0
- package/dist/public/assets/{button-D-qeQvl5.js → button-BNH9tKwf.js} +1 -1
- package/dist/public/assets/{chevron-right-DUkOv15w.js → chevron-right-6pjfw_yV.js} +1 -1
- package/dist/public/assets/{colour-picker-DZdAiaVI.js → colour-picker-Dwq4M4eT.js} +1 -1
- package/dist/public/assets/{command-BeX8pm7h.js → command-RRKOl81e.js} +1 -1
- package/dist/public/assets/{content-state-CROLtMfN.js → content-state-PQEVgsS8.js} +1 -1
- package/dist/public/assets/{context-NsaMZKAN.js → context-CvPVX4oN.js} +1 -1
- package/dist/public/assets/context-menu-CaNn4t1W.js +1 -0
- package/dist/public/assets/{control-tray-CjoJunx1.js → control-tray-jUtkASPS.js} +1 -1
- package/dist/public/assets/dialog-DfdBRe6G.js +41 -0
- package/dist/public/assets/{disclosure-CpSwsC7J.js → disclosure-oYVpfMYO.js} +1 -1
- package/dist/public/assets/dist-CNoWjXWo.js +1 -0
- package/dist/public/assets/dist-DMpqv5CF.js +1 -0
- package/dist/public/assets/{drafts-CBbjQQbz.js → drafts-CqDYmkTF.js} +1 -1
- package/dist/public/assets/editor-context-Bijx3uIG.js +5 -0
- package/dist/public/assets/editor-links-Djdkea3i.js +1 -0
- package/dist/public/assets/{editor-sync-BOfDr2yY.js → editor-sync-C6zSf7t5.js} +1 -1
- package/dist/public/assets/{errors-CviT-mvB.js → errors-SnGDjajv.js} +1 -1
- package/dist/public/assets/expanding-content-CKYjs3iT.js +1 -0
- package/dist/public/assets/{file-editor-settings-BXTs1F7S.js → file-editor-settings-XayiLMfU.js} +1 -1
- package/dist/public/assets/{file-links-CgOYgoMC.js → file-links-CEjYCLBn.js} +1 -1
- package/dist/public/assets/forward-link-BT0QTRVB.js +1 -0
- package/dist/public/assets/hotkeys-B417biB9.js +1 -0
- package/dist/public/assets/index-C0F5B-UN.js +10 -0
- package/dist/public/assets/index-CbJEmhvZ.css +2 -0
- package/dist/public/assets/{react-dom-cJyBB_A4.js → jsx-runtime-ffCh33zF.js} +1 -1
- package/dist/public/assets/local-store-DKFKEHML.js +276 -0
- package/dist/public/assets/notification-delivery-yJcsFWYx.js +1 -0
- package/dist/public/assets/{popover-Okyclsx8.js → popover-CNEMQBFf.js} +1 -1
- package/dist/public/assets/{preferences-CvSHA-AA.js → preferences-BP2Incj1.js} +1 -1
- package/dist/public/assets/{profile-icons-BI2xFWcB.js → profile-icons-BmQVYS_o.js} +1 -1
- package/dist/public/assets/profile-store-BnferXV3.js +1 -0
- package/dist/public/assets/project-actions-DX_j3cML.js +1 -0
- package/dist/public/assets/project-drag-DZbLfoWj.js +1 -0
- package/dist/public/assets/{protocol-support-iXloAH0N.js → protocol-support-DIWnYJkt.js} +1 -1
- package/dist/public/assets/queries-C9DYtGQW.js +1 -0
- package/dist/public/assets/{render-rich-content-fo4uQVWR.js → render-rich-content-Br9yR6jZ.js} +2 -2
- package/dist/public/assets/{scroll-restoration-C_ly1bKS.js → scroll-restoration-C-VTTLs8.js} +1 -1
- package/dist/public/assets/select-DHaYbZVV.js +1 -0
- package/dist/public/assets/selection-actions-DX3EnNRv.js +1 -0
- package/dist/public/assets/{session-display-BUDNzNmg.js → session-display-DHxCigRa.js} +1 -1
- package/dist/public/assets/session-order-BK0vJanT.js +1 -0
- package/dist/public/assets/state-BegCSQn_.js +1 -0
- package/dist/public/assets/{switch-CGrhQUXr.js → switch-DZ2lisDt.js} +1 -1
- package/dist/public/assets/{tooltip-Ek-eHPZu.js → tooltip-CtT-5xHL.js} +1 -1
- package/dist/public/assets/use-arrangement-ready-CMe547fb.js +1 -0
- package/dist/public/assets/use-desktop-state-xeH1nq63.js +2 -0
- package/dist/public/assets/view-state-store-Cr1BaTzj.js +1 -0
- package/dist/public/assets/window-context-DddmcmmO.js +2 -0
- package/dist/public/assets/{ws-CDXOuBYB.js → ws-fD2y3o7n.js} +1 -1
- package/dist/public/index.html +6 -6
- package/dist/pudl.js +20 -1
- package/package.json +1 -1
- package/dist/public/assets/App-nkMPe95U.js +0 -16
- package/dist/public/assets/Dashboard-CoGS2W82.js +0 -1
- package/dist/public/assets/DraftRecovery-B8Ld4_1b.js +0 -1
- package/dist/public/assets/EditorTabClose-CGYLU9GK.js +0 -1
- package/dist/public/assets/HuddlePane-LF3pjMQM.js +0 -219
- package/dist/public/assets/ReadOnlyDiff-C7ZSVRt-.js +0 -2
- package/dist/public/assets/Ripple-Dzg6tdOM.js +0 -11
- package/dist/public/assets/SettingsDialog-wkV1PX96.js +0 -8
- package/dist/public/assets/Workspace-BAWfBTc9.js +0 -20
- package/dist/public/assets/api-CrP4jl9e.js +0 -1
- package/dist/public/assets/auth-1SSLu56b.js +0 -1
- package/dist/public/assets/dialog-CTN-Lln6.js +0 -41
- package/dist/public/assets/dist-BOS6OKSE.js +0 -1
- package/dist/public/assets/dist-BcrNV8NP.js +0 -1
- package/dist/public/assets/dist-NuV8HBEc.js +0 -1
- package/dist/public/assets/editor-context-T5zIHY3K.js +0 -5
- package/dist/public/assets/expanding-content-91gc88rm.js +0 -1
- package/dist/public/assets/forward-link-qOyuWj08.js +0 -1
- package/dist/public/assets/hotkeys-nP8gYtE7.js +0 -1
- package/dist/public/assets/index-BB_BPKbu.css +0 -2
- package/dist/public/assets/index-CYyz1r9Q.js +0 -10
- package/dist/public/assets/jsx-runtime-By8HlURe.js +0 -1
- package/dist/public/assets/local-store-Dy1Cd8sn.js +0 -276
- package/dist/public/assets/notification-delivery-CtlAdV8W.js +0 -1
- package/dist/public/assets/profile-store-D4lZiXgL.js +0 -2
- package/dist/public/assets/project-actions-Ck504AFM.js +0 -1
- package/dist/public/assets/project-drag-BnkK15qk.js +0 -1
- package/dist/public/assets/queries-BSkHGZG8.js +0 -1
- package/dist/public/assets/select-DzQdQNsv.js +0 -1
- package/dist/public/assets/selection-actions-CWu4uTBo.js +0 -1
- package/dist/public/assets/session-order-b3nCJcCG.js +0 -1
- package/dist/public/assets/state-CuUqRNo7.js +0 -1
- package/dist/public/assets/use-arrangement-ready-1vmV5np6.js +0 -1
- package/dist/public/assets/use-desktop-state-CBTzsmlz.js +0 -2
- package/dist/public/assets/view-state-store-Dqk7M5ei.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{C as n}from"./protocol-support-iXloAH0N.js";import{Dn as r,M as i,N as a,On as o,P as s,Tn as c,r as l,wn as u,xn as d}from"./local-store-Dy1Cd8sn.js";import{s as f,t as p}from"./LazyTerminal-DnrWO9aI.js";import{n as m,o as h,r as g,s as _}from"./theme-swfNLod9.js";import{t as v}from"./jsx-runtime-By8HlURe.js";import{i as y,n as b,t as x}from"./api-CrP4jl9e.js";import{i as S,l as C}from"./profile-store-D4lZiXgL.js";import{At as ee,St as te,V as ne,ht as w,it as T,k as re,r as ie,rt as E}from"./queries-BSkHGZG8.js";import{t as ae}from"./utils-B6KiDbIe.js";import{i as oe,o as se,r as ce,s as le,t as ue}from"./dialog-CTN-Lln6.js";import{i as D,n as de,r as fe}from"./colour-picker-DZdAiaVI.js";import{t as O}from"./createLucideIcon-DyMAgLa3.js";import{n as pe}from"./profile-icons-BI2xFWcB.js";import{a as me}from"./session-display-BUDNzNmg.js";import{t as k}from"./ws-CDXOuBYB.js";function he(e,t){return`[${f(t)}] ${e}`.slice(0,160)}function ge(e){return e}var A=e(t(),1);function _e(e,t){let n=w(t);return ve({filters:{...e,status:`pending`}},n).length}function j(e,t){return e.findAll(t.filters).map(e=>t.select?t.select(e):e.state)}function ve(e={},t){let n=w(t).getMutationCache(),r=A.useRef(e),i=A.useRef(null);return i.current===null&&(i.current=j(n,e)),A.useEffect(()=>{r.current=e}),A.useSyncExternalStore(A.useCallback(e=>n.subscribe(()=>{let t=ee(i.current,j(n,r.current));i.current!==t&&(i.current=t,te.schedule(e))}),[n]),()=>i.current,()=>i.current)}var ye=O(`alarm-clock`,[[`circle`,{cx:`12`,cy:`13`,r:`8`,key:`3y4lt7`}],[`path`,{d:`M12 9v4l2 2`,key:`1c63tq`}],[`path`,{d:`M5 3 2 6`,key:`18tl5t`}],[`path`,{d:`m22 6-3-3`,key:`1opdir`}],[`path`,{d:`M6.38 18.7 4 21`,key:`17xu3x`}],[`path`,{d:`M17.64 18.67 20 21`,key:`kv2oe2`}]]),be=O(`amphora`,[[`path`,{d:`M10 2v5.632c0 .424-.272.795-.653.982A6 6 0 0 0 6 14c.006 4 3 7 5 8`,key:`1h8rid`}],[`path`,{d:`M10 5H8a2 2 0 0 0 0 4h.68`,key:`3ezsi6`}],[`path`,{d:`M14 2v5.632c0 .424.272.795.652.982A6 6 0 0 1 18 14c0 4-3 7-5 8`,key:`yt6q09`}],[`path`,{d:`M14 5h2a2 2 0 0 1 0 4h-.68`,key:`8f95yk`}],[`path`,{d:`M18 22H6`,key:`mg6kv4`}],[`path`,{d:`M9 2h6`,key:`1jrp98`}]]),xe=O(`anvil`,[[`path`,{d:`M7 10H6a4 4 0 0 1-4-4 1 1 0 0 1 1-1h4`,key:`1hjpb6`}],[`path`,{d:`M7 5a1 1 0 0 1 1-1h13a1 1 0 0 1 1 1 7 7 0 0 1-7 7H8a1 1 0 0 1-1-1z`,key:`1qn45f`}],[`path`,{d:`M9 12v5`,key:`3anwtq`}],[`path`,{d:`M15 12v5`,key:`5xh3zn`}],[`path`,{d:`M5 20a3 3 0 0 1 3-3h8a3 3 0 0 1 3 3 1 1 0 0 1-1 1H6a1 1 0 0 1-1-1`,key:`1fi4x8`}]]),Se=O(`apple`,[[`path`,{d:`M12 6.528V3a1 1 0 0 1 1-1h0`,key:`11qiee`}],[`path`,{d:`M18.237 21A15 15 0 0 0 22 11a6 6 0 0 0-10-4.472A6 6 0 0 0 2 11a15.1 15.1 0 0 0 3.763 10 3 3 0 0 0 3.648.648 5.5 5.5 0 0 1 5.178 0A3 3 0 0 0 18.237 21`,key:`110c12`}]]),Ce=O(`armchair`,[[`path`,{d:`M19 9V6a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2v3`,key:`irtipd`}],[`path`,{d:`M3 16a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-5a2 2 0 0 0-4 0v1.5a.5.5 0 0 1-.5.5h-9a.5.5 0 0 1-.5-.5V11a2 2 0 0 0-4 0z`,key:`1qyhux`}],[`path`,{d:`M5 18v2`,key:`ppbyun`}],[`path`,{d:`M19 18v2`,key:`gy7782`}]]),we=O(`axe`,[[`path`,{d:`m14 12-8.381 8.38a1 1 0 0 1-3.001-3L11 9`,key:`5z9253`}],[`path`,{d:`M15 15.5a.5.5 0 0 0 .5.5A6.5 6.5 0 0 0 22 9.5a.5.5 0 0 0-.5-.5h-1.672a2 2 0 0 1-1.414-.586l-5.062-5.062a1.205 1.205 0 0 0-1.704 0L9.352 5.648a1.205 1.205 0 0 0 0 1.704l5.062 5.062A2 2 0 0 1 15 13.828z`,key:`19zklq`}]]),Te=O(`banana`,[[`path`,{d:`M4 13c3.5-2 8-2 10 2a5.5 5.5 0 0 1 8 5`,key:`1cscit`}],[`path`,{d:`M5.15 17.89c5.52-1.52 8.65-6.89 7-12C11.55 4 11.5 2 13 2c3.22 0 5 5.5 5 8 0 6.5-4.2 12-10.49 12C5.11 22 2 22 2 20c0-1.5 1.14-1.55 3.15-2.11Z`,key:`1y1nbv`}]]),Ee=O(`bath`,[[`path`,{d:`M10 4 8 6`,key:`1rru8s`}],[`path`,{d:`M17 19v2`,key:`ts1sot`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}],[`path`,{d:`M7 19v2`,key:`12npes`}],[`path`,{d:`M9 5 7.621 3.621A2.121 2.121 0 0 0 4 5v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5`,key:`14ym8i`}]]),De=O(`beef`,[[`path`,{d:`M16.4 13.7A6.5 6.5 0 1 0 6.28 6.6c-1.1 3.13-.78 3.9-3.18 6.08A3 3 0 0 0 5 18c4 0 8.4-1.8 11.4-4.3`,key:`cisjcv`}],[`path`,{d:`m18.5 6 2.19 4.5a6.48 6.48 0 0 1-2.29 7.2C15.4 20.2 11 22 7 22a3 3 0 0 1-2.68-1.66L2.4 16.5`,key:`5byaag`}],[`circle`,{cx:`12.5`,cy:`8.5`,r:`2.5`,key:`9738u8`}]]),Oe=O(`beer`,[[`path`,{d:`M17 11h1a3 3 0 0 1 0 6h-1`,key:`1yp76v`}],[`path`,{d:`M9 12v6`,key:`1u1cab`}],[`path`,{d:`M13 12v6`,key:`1sugkk`}],[`path`,{d:`M14 7.5c-1 0-1.44.5-3 .5s-2-.5-3-.5-1.72.5-2.5.5a2.5 2.5 0 0 1 0-5c.78 0 1.57.5 2.5.5S9.44 2 11 2s2 1.5 3 1.5 1.72-.5 2.5-.5a2.5 2.5 0 0 1 0 5c-.78 0-1.5-.5-2.5-.5Z`,key:`1510fo`}],[`path`,{d:`M5 8v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8`,key:`19jb7n`}]]),ke=O(`biceps-flexed`,[[`path`,{d:`M12.409 13.017A5 5 0 0 1 22 15c0 3.866-4 7-9 7-4.077 0-8.153-.82-10.371-2.462-.426-.316-.631-.832-.62-1.362C2.118 12.723 2.627 2 10 2a3 3 0 0 1 3 3 2 2 0 0 1-2 2c-1.105 0-1.64-.444-2-1`,key:`1pmlyh`}],[`path`,{d:`M15 14a5 5 0 0 0-7.584 2`,key:`5rb254`}],[`path`,{d:`M9.964 6.825C8.019 7.977 9.5 13 8 15`,key:`kbvsx9`}]]),Ae=O(`bone`,[[`path`,{d:`M17 10c.7-.7 1.69 0 2.5 0a2.5 2.5 0 1 0 0-5 .5.5 0 0 1-.5-.5 2.5 2.5 0 1 0-5 0c0 .81.7 1.8 0 2.5l-7 7c-.7.7-1.69 0-2.5 0a2.5 2.5 0 0 0 0 5c.28 0 .5.22.5.5a2.5 2.5 0 1 0 5 0c0-.81-.7-1.8 0-2.5Z`,key:`w610uw`}]]),je=O(`boom-box`,[[`path`,{d:`M4 9V5a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v4`,key:`vvzvr1`}],[`path`,{d:`M8 8v1`,key:`xcqmfk`}],[`path`,{d:`M12 8v1`,key:`1rj8u4`}],[`path`,{d:`M16 8v1`,key:`1q12zr`}],[`rect`,{width:`20`,height:`12`,x:`2`,y:`9`,rx:`2`,key:`igpb89`}],[`circle`,{cx:`8`,cy:`15`,r:`2`,key:`fa4a8s`}],[`circle`,{cx:`16`,cy:`15`,r:`2`,key:`14c3ya`}]]),Me=O(`briefcase-business`,[[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2`,key:`1ksdt3`}],[`path`,{d:`M22 13a18.15 18.15 0 0 1-20 0`,key:`12hx5q`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`6`,rx:`2`,key:`i6l2r4`}]]),Ne=O(`candy-cane`,[[`path`,{d:`m10.8 5 2.111 4.223`,key:`11kb8w`}],[`path`,{d:`M17.75 7 15 2.1`,key:`12x7e8`}],[`path`,{d:`m4.874 14.647 2.12 4.24`,key:`ccpt4b`}],[`path`,{d:`M5.7 21a2 2 0 0 1-3.5-2l8.6-14a6 6 0 0 1 10.4 6 2 2 0 1 1-3.464-2 2 2 0 1 0-3.464-2z`,key:`u5e8z4`}],[`path`,{d:`m7.906 9.712 2.005 4.411`,key:`1k0qph`}]]),Pe=O(`candy`,[[`path`,{d:`M10 7v10.9`,key:`1gynux`}],[`path`,{d:`M14 6.1V17`,key:`116kdf`}],[`path`,{d:`M16 7V3a1 1 0 0 1 1.707-.707 2.5 2.5 0 0 0 2.152.717 1 1 0 0 1 1.131 1.131 2.5 2.5 0 0 0 .717 2.152A1 1 0 0 1 21 8h-4`,key:`gpb6xx`}],[`path`,{d:`M16.536 7.465a5 5 0 0 0-7.072 0l-2 2a5 5 0 0 0 0 7.07 5 5 0 0 0 7.072 0l2-2a5 5 0 0 0 0-7.07`,key:`1tsln4`}],[`path`,{d:`M8 17v4a1 1 0 0 1-1.707.707 2.5 2.5 0 0 0-2.152-.717 1 1 0 0 1-1.131-1.131 2.5 2.5 0 0 0-.717-2.152A1 1 0 0 1 3 16h4`,key:`qexcha`}]]),Fe=O(`carrot`,[[`path`,{d:`M15 16a1 1 0 0 0-7-7q-4 4-5.987 12.385a.5.5 0 0 0 .602.602Q11 20 15 16l-3-3`,key:`1ta62j`}],[`path`,{d:`M15 9q4 4 7 0-3-4-7 0 4-4 0-7-4 3 0 7`,key:`1svf7i`}],[`path`,{d:`m8 15-2.58-2.58`,key:`7t238r`}]]),Ie=O(`chef-hat`,[[`path`,{d:`M17 21a1 1 0 0 0 1-1v-5.35c0-.457.316-.844.727-1.041a4 4 0 0 0-2.134-7.589 5 5 0 0 0-9.186 0 4 4 0 0 0-2.134 7.588c.411.198.727.585.727 1.041V20a1 1 0 0 0 1 1Z`,key:`1qvrer`}],[`path`,{d:`M6 17h12`,key:`1jwigz`}]]),Le=O(`cherry`,[[`path`,{d:`M2 17a5 5 0 0 0 10 0c0-2.76-2.5-5-5-3-2.5-2-5 .24-5 3Z`,key:`cvxqlc`}],[`path`,{d:`M12 17a5 5 0 0 0 10 0c0-2.76-2.5-5-5-3-2.5-2-5 .24-5 3Z`,key:`1ostrc`}],[`path`,{d:`M7 14c3.22-2.91 4.29-8.75 5-12 1.66 2.38 4.94 9 5 12`,key:`hqx58h`}],[`path`,{d:`M22 9c-4.29 0-7.14-2.33-10-7 5.71 0 10 4.67 10 7Z`,key:`eykp1o`}]]),Re=O(`citrus`,[[`path`,{d:`M21.66 17.67a1.08 1.08 0 0 1-.04 1.6A12 12 0 0 1 4.73 2.38a1.1 1.1 0 0 1 1.61-.04z`,key:`4ite01`}],[`path`,{d:`M19.65 15.66A8 8 0 0 1 8.35 4.34`,key:`1gxipu`}],[`path`,{d:`m14 10-5.5 5.5`,key:`92pfem`}],[`path`,{d:`M14 17.85V10H6.15`,key:`xqmtsk`}]]),ze=O(`clapperboard`,[[`path`,{d:`m12.296 3.464 3.02 3.956`,key:`qash78`}],[`path`,{d:`M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3z`,key:`1h7j8b`}],[`path`,{d:`M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`4lm6w1`}],[`path`,{d:`m6.18 5.276 3.1 3.899`,key:`zjj9t3`}]]),Be=O(`clover`,[[`path`,{d:`M16.17 7.83 2 22`,key:`t58vo8`}],[`path`,{d:`M4.02 12a2.827 2.827 0 1 1 3.81-4.17A2.827 2.827 0 1 1 12 4.02a2.827 2.827 0 1 1 4.17 3.81A2.827 2.827 0 1 1 19.98 12a2.827 2.827 0 1 1-3.81 4.17A2.827 2.827 0 1 1 12 19.98a2.827 2.827 0 1 1-4.17-3.81A1 1 0 1 1 4 12`,key:`17k36q`}],[`path`,{d:`m7.83 7.83 8.34 8.34`,key:`1d7sxk`}]]),Ve=O(`cookie`,[[`path`,{d:`M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5`,key:`laymnq`}],[`path`,{d:`M8.5 8.5v.01`,key:`ue8clq`}],[`path`,{d:`M16 15.5v.01`,key:`14dtrp`}],[`path`,{d:`M12 12v.01`,key:`u5ubse`}],[`path`,{d:`M11 17v.01`,key:`1hyl5a`}],[`path`,{d:`M7 14v.01`,key:`uct60s`}]]),He=O(`croissant`,[[`path`,{d:`M10.2 18H4.774a1.5 1.5 0 0 1-1.352-.97 11 11 0 0 1 .132-6.487`,key:`14kkz9`}],[`path`,{d:`M18 10.2V4.774a1.5 1.5 0 0 0-.97-1.352 11 11 0 0 0-6.486.132`,key:`1g7v07`}],[`path`,{d:`M18 5a4 3 0 0 1 4 3 2 2 0 0 1-2 2 10 10 0 0 0-5.139 1.42`,key:`ratg6b`}],[`path`,{d:`M5 18a3 4 0 0 0 3 4 2 2 0 0 0 2-2 10 10 0 0 1 1.42-5.14`,key:`4454f0`}],[`path`,{d:`M8.709 2.554a10 10 0 0 0-6.155 6.155 1.5 1.5 0 0 0 .676 1.626l9.807 5.42a2 2 0 0 0 2.718-2.718l-5.42-9.807a1.5 1.5 0 0 0-1.626-.676`,key:`qmemie`}]]),Ue=O(`dice-5`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`path`,{d:`M16 8h.01`,key:`cr5u4v`}],[`path`,{d:`M8 8h.01`,key:`1e4136`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}],[`path`,{d:`M16 16h.01`,key:`1f9h7w`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}]]),We=O(`drama`,[[`path`,{d:`M10 11h.01`,key:`d2at3l`}],[`path`,{d:`M14 6h.01`,key:`k028ub`}],[`path`,{d:`M18 6h.01`,key:`1v4wsw`}],[`path`,{d:`M6.5 13.1h.01`,key:`1748ia`}],[`path`,{d:`M22 5c0 9-4 12-6 12s-6-3-6-12c0-2 2-3 6-3s6 1 6 3`,key:`172yzv`}],[`path`,{d:`M17.4 9.9c-.8.8-2 .8-2.8 0`,key:`1obv0w`}],[`path`,{d:`M10.1 7.1C9 7.2 7.7 7.7 6 8.6c-3.5 2-4.7 3.9-3.7 5.6 4.5 7.8 9.5 8.4 11.2 7.4.9-.5 1.9-2.1 1.9-4.7`,key:`rqjl8i`}],[`path`,{d:`M9.1 16.5c.3-1.1 1.4-1.7 2.4-1.4`,key:`1mr6wy`}]]),Ge=O(`drum`,[[`path`,{d:`m2 2 8 8`,key:`1v6059`}],[`path`,{d:`m22 2-8 8`,key:`173r8a`}],[`ellipse`,{cx:`12`,cy:`9`,rx:`10`,ry:`5`,key:`liohsx`}],[`path`,{d:`M7 13.4v7.9`,key:`1yi6u9`}],[`path`,{d:`M12 14v8`,key:`1tn2tj`}],[`path`,{d:`M17 13.4v7.9`,key:`eqz2v3`}],[`path`,{d:`M2 9v8a10 5 0 0 0 20 0V9`,key:`1750ul`}]]),Ke=O(`dumbbell`,[[`path`,{d:`M17.596 12.768a2 2 0 1 0 2.829-2.829l-1.768-1.767a2 2 0 0 0 2.828-2.829l-2.828-2.828a2 2 0 0 0-2.829 2.828l-1.767-1.768a2 2 0 1 0-2.829 2.829z`,key:`9m4mmf`}],[`path`,{d:`m2.5 21.5 1.4-1.4`,key:`17g3f0`}],[`path`,{d:`m20.1 3.9 1.4-1.4`,key:`1qn309`}],[`path`,{d:`M5.343 21.485a2 2 0 1 0 2.829-2.828l1.767 1.768a2 2 0 1 0 2.829-2.829l-6.364-6.364a2 2 0 1 0-2.829 2.829l1.768 1.767a2 2 0 0 0-2.828 2.829z`,key:`1t2c92`}],[`path`,{d:`m9.6 14.4 4.8-4.8`,key:`6umqxw`}]]),qe=O(`egg`,[[`path`,{d:`M12 2C8 2 4 8 4 14a8 8 0 0 0 16 0c0-6-4-12-8-12`,key:`1le142`}]]),Je=O(`footprints`,[[`path`,{d:`M4 16v-2.38C4 11.5 2.97 10.5 3 8c.03-2.72 1.49-6 4.5-6C9.37 2 10 3.8 10 5.5c0 3.11-2 5.66-2 8.68V16a2 2 0 1 1-4 0Z`,key:`1dudjm`}],[`path`,{d:`M20 20v-2.38c0-2.12 1.03-3.12 1-5.62-.03-2.72-1.49-6-4.5-6C14.63 6 14 7.8 14 9.5c0 3.11 2 5.66 2 8.68V20a2 2 0 1 0 4 0Z`,key:`l2t8xc`}],[`path`,{d:`M16 17h4`,key:`1dejxt`}],[`path`,{d:`M4 13h4`,key:`1bwh8b`}]]),Ye=O(`forklift`,[[`path`,{d:`M12 12H5a2 2 0 0 0-2 2v5`,key:`7zsz91`}],[`path`,{d:`M15 19h7`,key:`1askl3`}],[`path`,{d:`M16 19V2`,key:`1gf9nk`}],[`path`,{d:`M6 12V7a2 2 0 0 1 2-2h2.172a2 2 0 0 1 1.414.586l3.828 3.828A2 2 0 0 1 16 10.828`,key:`enx9tf`}],[`path`,{d:`M7 19h4`,key:`fumhkk`}],[`circle`,{cx:`13`,cy:`19`,r:`2`,key:`wjnkru`}],[`circle`,{cx:`5`,cy:`19`,r:`2`,key:`v8kfzx`}]]),Xe=O(`gavel`,[[`path`,{d:`m14 13-8.381 8.38a1 1 0 0 1-3.001-3l8.384-8.381`,key:`pgg06f`}],[`path`,{d:`m16 16 6-6`,key:`vzrcl6`}],[`path`,{d:`m21.5 10.5-8-8`,key:`a17d9x`}],[`path`,{d:`m8 8 6-6`,key:`18bi4p`}],[`path`,{d:`m8.5 7.5 8 8`,key:`1oyaui`}]]),Ze=O(`glasses`,[[`circle`,{cx:`6`,cy:`15`,r:`4`,key:`vux9w4`}],[`circle`,{cx:`18`,cy:`15`,r:`4`,key:`18o8ve`}],[`path`,{d:`M14 15a2 2 0 0 0-2-2 2 2 0 0 0-2 2`,key:`1ag4bs`}],[`path`,{d:`M2.5 13 5 7c.7-1.3 1.4-2 3-2`,key:`1hm1gs`}],[`path`,{d:`M21.5 13 19 7c-.7-1.3-1.5-2-3-2`,key:`1r31ai`}]]),Qe=O(`graduation-cap`,[[`path`,{d:`M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z`,key:`j76jl0`}],[`path`,{d:`M22 10v6`,key:`1lu8f3`}],[`path`,{d:`M6 12.5V16a6 3 0 0 0 12 0v-3.5`,key:`1r8lef`}]]),$e=O(`ham`,[[`path`,{d:`M13.144 21.144A7.274 10.445 45 1 0 2.856 10.856`,key:`1k1t7q`}],[`path`,{d:`M13.144 21.144A7.274 4.365 45 0 0 2.856 10.856a7.274 4.365 45 0 0 10.288 10.288`,key:`153t1g`}],[`path`,{d:`M16.565 10.435 18.6 8.4a2.501 2.501 0 1 0 1.65-4.65 2.5 2.5 0 1 0-4.66 1.66l-2.024 2.025`,key:`gzrt0n`}],[`path`,{d:`m8.5 16.5-1-1`,key:`otr954`}]]),et=O(`hammer`,[[`path`,{d:`m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9`,key:`1hayfq`}],[`path`,{d:`m18 15 4-4`,key:`16gjal`}],[`path`,{d:`m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5`,key:`15ts47`}]]),tt=O(`hand-metal`,[[`path`,{d:`M18 12.5V10a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1.4`,key:`wc6myp`}],[`path`,{d:`M14 11V9a2 2 0 1 0-4 0v2`,key:`94qvcw`}],[`path`,{d:`M10 10.5V5a2 2 0 1 0-4 0v9`,key:`m1ah89`}],[`path`,{d:`m7 15-1.76-1.76a2 2 0 0 0-2.83 2.82l3.6 3.6C7.5 21.14 9.2 22 12 22h2a8 8 0 0 0 8-8V7a2 2 0 1 0-4 0v5`,key:`t1skq1`}]]),nt=O(`ice-cream-bowl`,[[`path`,{d:`M12 17c5 0 8-2.69 8-6H4c0 3.31 3 6 8 6m-4 4h8m-4-3v3M5.14 11a3.5 3.5 0 1 1 6.71 0`,key:`1uxfcu`}],[`path`,{d:`M12.14 11a3.5 3.5 0 1 1 6.71 0`,key:`4k3m1s`}],[`path`,{d:`M15.5 6.5a3.5 3.5 0 1 0-7 0`,key:`zmuahr`}]]),M=O(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),rt=O(`lamp-desk`,[[`path`,{d:`M10.293 2.293a1 1 0 0 1 1.414 0l2.5 2.5 5.994 1.227a1 1 0 0 1 .506 1.687l-7 7a1 1 0 0 1-1.687-.506l-1.227-5.994-2.5-2.5a1 1 0 0 1 0-1.414z`,key:`sb8slu`}],[`path`,{d:`m14.207 4.793-3.414 3.414`,key:`m2x3oj`}],[`path`,{d:`M3 20a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1z`,key:`8b3myj`}],[`path`,{d:`m9.086 6.5-4.793 4.793a1 1 0 0 0-.18 1.17L7 18`,key:`43s6cu`}]]),it=O(`lasso`,[[`path`,{d:`M3.704 14.467a10 8 0 1 1 3.115 2.375`,key:`wxgc5m`}],[`path`,{d:`M7 22a5 5 0 0 1-2-3.994`,key:`1xp6a4`}],[`circle`,{cx:`5`,cy:`16`,r:`2`,key:`18csp3`}]]),at=O(`lollipop`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}],[`path`,{d:`M11 11a2 2 0 0 0 4 0 4 4 0 0 0-8 0 6 6 0 0 0 12 0`,key:`107gwy`}]]),ot=O(`magnet`,[[`path`,{d:`m12 15 4 4`,key:`lnac28`}],[`path`,{d:`M2.352 10.648a1.205 1.205 0 0 0 0 1.704l2.296 2.296a1.205 1.205 0 0 0 1.704 0l6.029-6.029a1 1 0 1 1 3 3l-6.029 6.029a1.205 1.205 0 0 0 0 1.704l2.296 2.296a1.205 1.205 0 0 0 1.704 0l6.365-6.367A1 1 0 0 0 8.716 4.282z`,key:`nlhkjb`}],[`path`,{d:`m5 8 4 4`,key:`j6kj7e`}]]),st=O(`origami`,[[`path`,{d:`M12 12V4a1 1 0 0 1 1-1h6.297a1 1 0 0 1 .651 1.759l-4.696 4.025`,key:`1bx4vc`}],[`path`,{d:`m12 21-7.414-7.414A2 2 0 0 1 4 12.172V6.415a1.002 1.002 0 0 1 1.707-.707L20 20.009`,key:`1h3km6`}],[`path`,{d:`m12.214 3.381 8.414 14.966a1 1 0 0 1-.167 1.199l-1.168 1.163a1 1 0 0 1-.706.291H6.351a1 1 0 0 1-.625-.219L3.25 18.8a1 1 0 0 1 .631-1.781l4.165.027`,key:`1hj4wg`}]]),ct=O(`panda`,[[`path`,{d:`M11.25 17.25h1.5L12 18z`,key:`1wmwwj`}],[`path`,{d:`m15 12 2 2`,key:`k60wz4`}],[`path`,{d:`M18 6.5a.5.5 0 0 0-.5-.5`,key:`1ch4h4`}],[`path`,{d:`M20.69 9.67a4.5 4.5 0 1 0-7.04-5.5 8.35 8.35 0 0 0-3.3 0 4.5 4.5 0 1 0-7.04 5.5C2.49 11.2 2 12.88 2 14.5 2 19.47 6.48 22 12 22s10-2.53 10-7.5c0-1.62-.48-3.3-1.3-4.83`,key:`1c660l`}],[`path`,{d:`M6 6.5a.495.495 0 0 1 .5-.5`,key:`eviuep`}],[`path`,{d:`m9 12-2 2`,key:`326nkw`}]]),lt=O(`party-popper`,[[`path`,{d:`M5.8 11.3 2 22l10.7-3.79`,key:`gwxi1d`}],[`path`,{d:`M4 3h.01`,key:`1vcuye`}],[`path`,{d:`M22 8h.01`,key:`1mrtc2`}],[`path`,{d:`M15 2h.01`,key:`1cjtqr`}],[`path`,{d:`M22 20h.01`,key:`1mrys2`}],[`path`,{d:`m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10`,key:`hbicv8`}],[`path`,{d:`m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17`,key:`1i94pl`}],[`path`,{d:`m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7`,key:`1cofks`}],[`path`,{d:`M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z`,key:`4kbmks`}]]),ut=O(`pickaxe`,[[`path`,{d:`m14 13-8.381 8.38a1 1 0 0 1-3.001-3L11 9.999`,key:`1lw9ds`}],[`path`,{d:`M15.973 4.027A13 13 0 0 0 5.902 2.373c-1.398.342-1.092 2.158.277 2.601a19.9 19.9 0 0 1 5.822 3.024`,key:`ffj4ej`}],[`path`,{d:`M16.001 11.999a19.9 19.9 0 0 1 3.024 5.824c.444 1.369 2.26 1.676 2.603.278A13 13 0 0 0 20 8.069`,key:`8tj4zw`}],[`path`,{d:`M18.352 3.352a1.205 1.205 0 0 0-1.704 0l-5.296 5.296a1.205 1.205 0 0 0 0 1.704l2.296 2.296a1.205 1.205 0 0 0 1.704 0l5.296-5.296a1.205 1.205 0 0 0 0-1.704z`,key:`hh6h97`}]]),dt=O(`popcorn`,[[`path`,{d:`M18 8a2 2 0 0 0 0-4 2 2 0 0 0-4 0 2 2 0 0 0-4 0 2 2 0 0 0-4 0 2 2 0 0 0 0 4`,key:`10td1f`}],[`path`,{d:`M10 22 9 8`,key:`yjptiv`}],[`path`,{d:`m14 22 1-14`,key:`8jwc8b`}],[`path`,{d:`M20 8c.5 0 .9.4.8 1l-2.6 12c-.1.5-.7 1-1.2 1H7c-.6 0-1.1-.4-1.2-1L3.2 9c-.1-.6.3-1 .8-1Z`,key:`1qo33t`}]]),ft=O(`rat`,[[`path`,{d:`M13 22H4a2 2 0 0 1 0-4h12`,key:`bt3f23`}],[`path`,{d:`M13.236 18a3 3 0 0 0-2.2-5`,key:`1tbvmo`}],[`path`,{d:`M16 9h.01`,key:`1bdo4e`}],[`path`,{d:`M16.82 3.94a3 3 0 1 1 3.237 4.868l1.815 2.587a1.5 1.5 0 0 1-1.5 2.1l-2.872-.453a3 3 0 0 0-3.5 3`,key:`9ch7kn`}],[`path`,{d:`M17 4.988a3 3 0 1 0-5.2 2.052A7 7 0 0 0 4 14.015 4 4 0 0 0 8 18`,key:`3s7e9i`}]]),pt=O(`rocking-chair`,[[`path`,{d:`m15 13 3.708 7.416`,key:`1edxn9`}],[`path`,{d:`M3 19a15 15 0 0 0 18 0`,key:`d0d1c4`}],[`path`,{d:`m3 2 3.21 9.633A2 2 0 0 0 8.109 13H18`,key:`tpa4et`}],[`path`,{d:`m9 13-3.708 7.416`,key:`1oplxx`}]]),mt=O(`sandwich`,[[`path`,{d:`m2.37 11.223 8.372-6.777a2 2 0 0 1 2.516 0l8.371 6.777`,key:`f1wd0e`}],[`path`,{d:`M21 15a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-5.25`,key:`1pfu07`}],[`path`,{d:`M3 15a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h9`,key:`1oq9qw`}],[`path`,{d:`m6.67 15 6.13 4.6a2 2 0 0 0 2.8-.4l3.15-4.2`,key:`1fnwu5`}],[`rect`,{width:`20`,height:`4`,x:`2`,y:`11`,rx:`1`,key:`itshg`}]]),ht=O(`scissors`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M8.12 8.12 12 12`,key:`1alkpv`}],[`path`,{d:`M20 4 8.12 15.88`,key:`xgtan2`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M14.8 14.8 20 20`,key:`ptml3r`}]]),N=O(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),gt=O(`shell`,[[`path`,{d:`M14 11a2 2 0 1 1-4 0 4 4 0 0 1 8 0 6 6 0 0 1-12 0 8 8 0 0 1 16 0 10 10 0 1 1-20 0 11.93 11.93 0 0 1 2.42-7.22 2 2 0 1 1 3.16 2.44`,key:`1cn552`}]]),_t=O(`shrimp`,[[`path`,{d:`M11 12h.01`,key:`1lr4k6`}],[`path`,{d:`M13 22c.5-.5 1.12-1 2.5-1-1.38 0-2-.5-2.5-1`,key:`fatpdi`}],[`path`,{d:`M14 2a3.28 3.28 0 0 1-3.227 1.798l-6.17-.561A2.387 2.387 0 1 0 4.387 8H15.5a1 1 0 0 1 0 13 1 1 0 0 0 0-5H12a7 7 0 0 1-7-7V8`,key:`kehrqe`}],[`path`,{d:`M14 8a8.5 8.5 0 0 1 0 8`,key:`1imjx2`}],[`path`,{d:`M16 16c2 0 4.5-4 4-6`,key:`z0nejz`}]]),vt=O(`skull`,[[`path`,{d:`m12.5 17-.5-1-.5 1h1z`,key:`3me087`}],[`path`,{d:`M15 22a1 1 0 0 0 1-1v-1a2 2 0 0 0 1.56-3.25 8 8 0 1 0-11.12 0A2 2 0 0 0 8 20v1a1 1 0 0 0 1 1z`,key:`1o5pge`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}]]),yt=O(`soup`,[[`path`,{d:`M12 21a9 9 0 0 0 9-9H3a9 9 0 0 0 9 9Z`,key:`4rw317`}],[`path`,{d:`M7 21h10`,key:`1b0cd5`}],[`path`,{d:`M19.5 12 22 6`,key:`shfsr5`}],[`path`,{d:`M16.25 3c.27.1.8.53.75 1.36-.06.83-.93 1.2-1 2.02-.05.78.34 1.24.73 1.62`,key:`rpc6vp`}],[`path`,{d:`M11.25 3c.27.1.8.53.74 1.36-.05.83-.93 1.2-.98 2.02-.06.78.33 1.24.72 1.62`,key:`1lf63m`}],[`path`,{d:`M6.25 3c.27.1.8.53.75 1.36-.06.83-.93 1.2-1 2.02-.05.78.34 1.24.74 1.62`,key:`97tijn`}]]),bt=O(`spade`,[[`path`,{d:`M12 18v4`,key:`jadmvz`}],[`path`,{d:`M2 14.499a5.5 5.5 0 0 0 9.591 3.675.6.6 0 0 1 .818.001A5.5 5.5 0 0 0 22 14.5c0-2.29-1.5-4-3-5.5l-5.492-5.312a2 2 0 0 0-3-.02L5 8.999c-1.5 1.5-3 3.2-3 5.5`,key:`1aw2pz`}]]),xt=O(`squirrel`,[[`path`,{d:`M15.236 22a3 3 0 0 0-2.2-5`,key:`21bitc`}],[`path`,{d:`M16 20a3 3 0 0 1 3-3h1a2 2 0 0 0 2-2v-2a4 4 0 0 0-4-4V4`,key:`oh0fg0`}],[`path`,{d:`M18 13h.01`,key:`9veqaj`}],[`path`,{d:`M18 6a4 4 0 0 0-4 4 7 7 0 0 0-7 7c0-5 4-5 4-10.5a4.5 4.5 0 1 0-9 0 2.5 2.5 0 0 0 5 0C7 10 3 11 3 17c0 2.8 2.2 5 5 5h10`,key:`980v8a`}]]),St=O(`swords`,[[`polyline`,{points:`14.5 17.5 3 6 3 3 6 3 17.5 14.5`,key:`1hfsw2`}],[`line`,{x1:`13`,x2:`19`,y1:`19`,y2:`13`,key:`1vrmhu`}],[`line`,{x1:`16`,x2:`20`,y1:`16`,y2:`20`,key:`1bron3`}],[`line`,{x1:`19`,x2:`21`,y1:`21`,y2:`19`,key:`13pww6`}],[`polyline`,{points:`14.5 6.5 18 3 21 3 21 6 17.5 9.5`,key:`hbey2j`}],[`line`,{x1:`5`,x2:`9`,y1:`14`,y2:`18`,key:`1hf58s`}],[`line`,{x1:`7`,x2:`4`,y1:`17`,y2:`20`,key:`pidxm4`}],[`line`,{x1:`3`,x2:`5`,y1:`19`,y2:`21`,key:`1pehsh`}]]),Ct=O(`umbrella`,[[`path`,{d:`M12 13v7a2 2 0 0 0 4 0`,key:`rpgb42`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M20.992 13a1 1 0 0 0 .97-1.274 10.284 10.284 0 0 0-19.923 0A1 1 0 0 0 3 13z`,key:`124nyo`}]]),wt=O(`volleyball`,[[`path`,{d:`M11 7a16 16 20 0 1 10.98 4.362`,key:`1mmfx7`}],[`path`,{d:`M12 12a13 13 0 0 1-8.66 5`,key:`14sm5y`}],[`path`,{d:`M16.83 13.634a16 16 0 0 1-9.267 7.328`,key:`j0eyj5`}],[`path`,{d:`M20.66 17A13 13 0 0 0 12 12a13 13 0 0 1 0-10`,key:`qaetsw`}],[`path`,{d:`M8.17 15.366a16 16 0 0 1-1.713-11.69`,key:`17ewdd`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Tt=O(`wand-sparkles`,[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]]),Et=O(`worm`,[[`path`,{d:`m19 12-1.5 3`,key:`9bcu4o`}],[`path`,{d:`M19.63 18.81 22 20`,key:`121v98`}],[`path`,{d:`M6.47 8.23a1.68 1.68 0 0 1 2.44 1.93l-.64 2.08a6.76 6.76 0 0 0 10.16 7.67l.42-.27a1 1 0 1 0-2.73-4.21l-.42.27a1.76 1.76 0 0 1-2.63-1.99l.64-2.08A6.66 6.66 0 0 0 3.94 3.9l-.7.4a1 1 0 1 0 2.55 4.34z`,key:`1tij6q`}]]),P=v();function Dt({icon:e,colour:t,className:n}){let r=ae(`size-4 shrink-0`,t?de(t):`text-fg-muted`,n);return(0,P.jsx)(e&&pe[e]||me,{className:r,style:fe(t)})}function F(e,t,n){let r=e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16)),i=r(t);return`#`+r(e).map((e,t)=>Math.round(e*n+i[t]*(1-n)).toString(16).padStart(2,`0`)).join(``)}var Ot={navy:`--identity-navy`,gold:`--identity-gold`,blue:`--ansi-blue`,green:`--ansi-green`,red:`--ansi-red`,violet:`--ansi-magenta`,cyan:`--ansi-cyan`};function I(e){return[1,3,5].reduce((t,n,r)=>{let i=parseInt(e.slice(n,n+2),16)/255;return t+(i<=.04045?i/12.92:((i+.055)/1.055)**2.4)*[.2126,.7152,.0722][r]},0)}function L(e,t,n,r=4.5){let i=t.map(I);for(let t=0;t<=100;t++){let a=F(e,n,1-t/100),o=I(a);if(i.every(e=>(Math.max(o,e)+.05)/(Math.min(o,e)+.05)>=r))return a}return n}function kt(e,t,n){let r=Ot[e],i=D(e);if(!r&&!i)return{};let a=i?e:n(r),o=n(`--host-shade`),s=n(`--host-paper`),c=t===`dark`,l=c?o:s,u=c?F(a,s,.18):F(a,o,.45),d=c?F(a,s,.4):F(a,o,.65),f=c?a:F(a,o,.75),p=c?F(a,s,.55):F(u,s,.76),m=n(`--bg-base`),h=c?s:o,g=F(a,F(h,m,c?.08:.06),c?.13:.05),_=F(g,h,c?.92:.96),v=F(g,n(`--bg-surface`),1/3),y=F(_,n(`--bg-elevated`),1/3),b=F(_,n(`--bg-tray`),1/3),x=[l,m,v,y,b],S=L(F(a,b,.3),x,h,1.5);return u=L(u,x,h),d=L(d,x,h),p=L(p,x,h),f=L(f,x,h),{"--bg-surface":v,"--bg-elevated":y,"--bg-tray":b,"--border":S,"--text-primary":u,"--text-secondary":d,"--text-muted":p,"--text-gold":f,"--explorer-foreground":u,"--explorer-folder":u,"--accent":f,"--accent-hover":u,"--focus-ring":f,"--nav-selection":f,"--nav-selection-ink":l,"--action":u,"--action-hover":d,"--action-ink":l,"--selection":f+(c?`4d`:`33`),"--explorer-selection":f+`2e`,"--explorer-hover":f+`0d`}}var R=[{name:`alarm-clock`,Icon:ye},{name:`amphora`,Icon:be},{name:`apple`,Icon:Se},{name:`armchair`,Icon:Ce},{name:`axe`,Icon:we},{name:`banana`,Icon:Te},{name:`bath`,Icon:Ee},{name:`beef`,Icon:De},{name:`beer`,Icon:Oe},{name:`biceps-flexed`,Icon:ke},{name:`bone`,Icon:Ae},{name:`boom-box`,Icon:je},{name:`briefcase-business`,Icon:Me},{name:`candy`,Icon:Pe},{name:`candy-cane`,Icon:Ne},{name:`carrot`,Icon:Fe},{name:`cherry`,Icon:Le},{name:`chef-hat`,Icon:Ie},{name:`citrus`,Icon:Re},{name:`clapperboard`,Icon:ze},{name:`clover`,Icon:Be},{name:`cookie`,Icon:Ve},{name:`croissant`,Icon:He},{name:`dice5`,Icon:Ue},{name:`drama`,Icon:We},{name:`drum`,Icon:Ge},{name:`dumbbell`,Icon:Ke},{name:`egg`,Icon:qe},{name:`footprints`,Icon:Je},{name:`forklift`,Icon:Ye},{name:`gavel`,Icon:Xe},{name:`glasses`,Icon:Ze},{name:`graduation-cap`,Icon:Qe},{name:`ham`,Icon:$e},{name:`hammer`,Icon:et},{name:`hand-metal`,Icon:tt},{name:`ice-cream-bowl`,Icon:nt},{name:`key-round`,Icon:M},{name:`lamp-desk`,Icon:rt},{name:`lasso`,Icon:it},{name:`lollipop`,Icon:at},{name:`magnet`,Icon:ot},{name:`origami`,Icon:st},{name:`panda`,Icon:ct},{name:`party-popper`,Icon:lt},{name:`pickaxe`,Icon:ut},{name:`popcorn`,Icon:dt},{name:`rat`,Icon:ft},{name:`rocking-chair`,Icon:pt},{name:`sandwich`,Icon:mt},{name:`scissors`,Icon:ht},{name:`shell`,Icon:gt},{name:`shrimp`,Icon:_t},{name:`skull`,Icon:vt},{name:`soup`,Icon:yt},{name:`spade`,Icon:bt},{name:`squirrel`,Icon:xt},{name:`swords`,Icon:St},{name:`umbrella`,Icon:Ct},{name:`volleyball`,Icon:wt},{name:`wand-sparkles`,Icon:Tt},{name:`worm`,Icon:Et},{name:`anvil`,Icon:xe}],z=Object.fromEntries(R.map(({name:e,Icon:t})=>[e,t]));function B(e=!0){let t=S(),n=ne(e?t??void 0:void 0),r=n.data?.hostColour;return{ready:e&&n.isSuccess,icon:n.data?.hostIcon,colour:d.some(e=>e===r)||D(r)?r:null}}function V({icon:e,className:t=`size-4 shrink-0`}){return(0,P.jsx)(e&&Object.hasOwn(z,e)&&z[e]||N,{className:t,"aria-hidden":`true`})}function At({enabled:e=!0}){let{colour:t}=B(e);return(0,A.useLayoutEffect)(()=>{let e=document.documentElement,n=[],r=()=>{for(let t of n)e.style.removeProperty(t);n=[],delete e.dataset.hostColour},i=()=>{if(r(),!t)return;let i=kt(t,g(),m());n=Object.keys(i);for(let[t,n]of Object.entries(i))e.style.setProperty(t,n);e.dataset.hostColour=t};i();let a=_(i,{first:!0});return h(),()=>{a(),r(),h()}},[t]),null}function jt(){let e=re(),{icon:t,colour:n,ready:r}=B(),i=ie(e.data),a=(0,A.useRef)(null);return(0,A.useLayoutEffect)(()=>{let e=document.documentElement,t=a.current?.querySelector(`svg`);if(!(!r||!i||!t))return e.dataset.desktopHostIdentity=JSON.stringify({name:i,colour:n,icon:[...t.children].map(e=>({tag:e.localName,attrs:Object.fromEntries([...e.attributes].filter(e=>e.name!==`class`).map(e=>[e.name,e.value]))}))}),()=>{delete e.dataset.desktopHostIdentity}},[r,i,t,n]),(0,P.jsx)(`span`,{hidden:!0,ref:a,children:(0,P.jsx)(V,{icon:t})})}function Mt({stream:e,label:t,hint:n,onClose:r}){let[i,a]=(0,A.useState)(null);return(0,P.jsx)(ue,{open:!0,onOpenChange:e=>!e&&r(),children:(0,P.jsxs)(ce,{className:`h-[85vh] max-w-[calc(100vw-4rem)]`,children:[(0,P.jsxs)(se,{children:[(0,P.jsxs)(le,{children:[t,` — login`]}),(0,P.jsx)(oe,{children:i===null?`Complete the agent’s login flow below.${n===void 0?` The account shows as logged in once it finishes cleanly.`:` ${n}`}`:`The login exited with code ${i} without completing. The output above may say why; close this and try again.`})]}),(0,P.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden rounded-md bg-ground p-1`,children:(0,P.jsx)(p,{stream:e,onExit:e=>e===0?r():a(e)})})]})})}function Nt(e){let t=e?.catalogue,n=t?.releases.latest;if(e?.availability!==`ready`||!t)return[];let r=[],i=t.releases.components?.daemon??n,a=t.releases.components?.runtime??n;return i?.host_asset&&c(i.version,t.daemon_version)&&r.push({component:`daemon`,version:i.version}),a?.host_asset&&t.runtime_default&&c(a.version,t.runtime_default.version)&&r.push({component:`runtime`,version:a.version}),r}function H(e){return e.staged&&!e.dispatched&&[`staged`,`preflight`,`approved`].includes(e.phase)}function Pt(e,t){let n=e?.result?.operation;if(e?.availability!==`ready`||!e.result?.ok||!n||!H(n)||!t?.ok||t.operation?.id!==n.id||t.operation.revision!==n.revision)return null;let r=t.review;if(!r)return null;let i=r.interruption_fingerprint,a=r.fingerprint??i;return!a||!r.can_apply&&!i||i&&!e.capabilities.interruption_approval?null:{action:`apply`,reference:{id:n.id,revision:n.revision},fingerprint:a,...i?{interruption_approval:i}:{}}}function Ft(e){let t=e?.result?.operation;return!!t&&!u(t.phase)}function It(e){let t=e.result?.operation;return e.availability===`unavailable`&&e.observation===`recorded`&&e.capabilities.offline_continuation&&e.result?.ok&&t?.dispatched&&!u(t.phase)?{action:`continue-offline`,reference:{id:t.id,revision:t.revision}}:null}var Lt={checking:`Checking update`,downloading:`Downloading`,staged:`Downloaded and verified`,preflight:`Ready for review`,approved:`Approved`,dispatching:`Starting update`,applying:`Applying update`,verifying:`Verifying update`,complete:`Update complete`,blocked:`Update blocked`,cancelled:`Update cancelled`,superseded:`Update replaced`,failed:`Update failed`,recovery_required:`Recovery required`,rolled_back:`Update rolled back`},Rt=class{offered=new Set;take(e,t){return t.filter(({component:t,version:n})=>{let r=JSON.stringify([e,t,n]);return this.offered.has(r)?!1:(this.offered.add(r),!0)})}};function U(){return l()?.scope??`local`}function W(e){let t=l(),i=t?.generation,a=t?`/api/host/updates`:`/frontend/updates`,o=()=>{if(!e)throw Error(`Host updates require host-approved device access.`);if(l()!==t||t?.generation!==i)throw Error(`Host update connection changed. Refresh status before continuing.`)};return async(e,i)=>{o(),t&&e&&s.parse(e);let c=a;e||(!t||n(r.parse(await b(`GET`,`/api/version`,void 0,i)).protocol,{major:26,minor:2}))&&(c+=`?components=1`);let l;try{l=e?await b(`POST`,a,e,i):await b(`GET`,c,void 0,i)}catch(t){if(e||c===a||!(t instanceof x)||![400,403].includes(t.status))throw t;l=await b(`GET`,a,void 0,i)}return o(),l}}function zt(e,t){let n=[`frontend-host-updates`,t],r,i=()=>{let t=e.getQueryData(n);if(t?.availability!==`ready`||t.observation===`recorded`||!t.catalogue)return;let i=JSON.stringify([t.catalogue.daemon_version,t.catalogue.runtime_default?.version??null]);i!==r&&(r=i,e.invalidateQueries({queryKey:[`release-notes`]}))},a=e.getQueryCache().subscribe(e=>{e.type===`updated`&&e.query.queryKey[0]===n[0]&&e.query.queryKey[1]===t&&i()});return i(),a}function G(){return[`frontend-host-updates`,U()]}function K(){let e=l(),t=T({queryKey:[`host-update-access`,U(),e?.generation],queryFn:async({signal:e})=>{let t=r.parse(await b(`GET`,`/api/version`,void 0,e));return t.protocol.major>=26&&t.remote_host_updates===!0},enabled:!!e,staleTime:1/0,retry:!1});return!e||t.data===!0}function Bt(e=!l()){let t=W(e);return ge({queryKey:G(),queryFn:async({signal:e})=>a.parse(await t(void 0,e)),enabled:e,retry:!1,staleTime:5e3,refetchInterval:e=>e.state.error instanceof x&&e.state.error.status===404?!1:[`checking`,`downloading`,`dispatching`,`applying`,`verifying`].includes(e.state.data?.result?.operation?.phase??``)||e.state.data?.catalogue?.releases.state===`checking`?2e3:6e4})}function Vt(e,t=!l()){let n=G(),r=W(t);return{mutationKey:[`frontend-host-update-action`,U()],retry:!1,networkMode:`always`,mutationFn:async e=>i.parse(await r(e)),onMutate:async()=>{await e.cancelQueries({queryKey:n})},onSuccess:t=>{e.setQueryData(n,e=>e&&{...e,result:t})},onSettled:async()=>{await e.invalidateQueries({queryKey:n})}}}function Ht(){return T(Bt(K()))}function Ut(){let e=w(),t=K(),n=[`frontend-host-update-action`,U()],r=_e({mutationKey:n}),i=E(Vt(e,t));return{...i,busy:r>0,act:t=>{e.isMutating({mutationKey:n})||i.mutate(t)}}}function Wt(){let e=w(),t=U();(0,A.useEffect)(()=>{let n=[`frontend-host-updates`,t],r=()=>{e.invalidateQueries({queryKey:n}),e.invalidateQueries({queryKey:[`release-notes`]})},i=k.onHostUpdatesChanged(r),a=zt(e,t),o=k.onConnectionChange(e=>{e&&r()});return()=>{i(),a(),o()}},[e,t])}var q=e=>e&&typeof e==`object`?e:{},J=[{id:`appearance`,label:`Appearance`,fields:[{key:`theme`,store:`theme`},{key:`cursorPackage`,store:`client`},{key:`uiFontSize`,store:`client`},{key:`terminalFontSize`,store:`client`},{key:`rippleEnabled`,store:`client`},{key:`editorFontSize`,store:`client`},{key:`density`,store:`client`},{key:`reduceMotion`,store:`client`},{key:`showHostOnFocus`,store:`client`},{key:`terminalScrollback`,store:`client`},{key:`projectBasedLayout`,store:`client`},{key:`showAllProjectSessions`,store:`client`}]},{id:`profile`,label:`Profile`,fields:[{key:`branch_prefix`,store:`profileColumn`},{key:`icon`,store:`profileColumn`},{key:`icon_colour`,store:`profileColumn`}]},{id:`sessions`,label:`Sessions`,fields:[{key:`onboardingTemplate`,store:`profileSettings`},{key:`concurrentTemplate`,store:`profileSettings`},{key:`restartTemplate`,store:`profileSettings`},{key:`tabTitleTemplate`,store:`profileSettings`},{key:`sessionDefaults`,store:`profileSettings`},{key:`allowSkipPermissions`,store:`profileSettings`},{key:`captureSessionEnv`,store:`profileSettings`}]},{id:`editor`,label:`Editor`,fields:[{key:`editorTabSize`,store:`client`},{key:`editorWordWrap`,store:`client`},{key:`editorLinkSshHost`,store:`client`}]},{id:`hotkeys`,label:`Hotkeys`,fields:[{key:`hotkeys`,store:`profileSettings`}]},{id:`notifications`,label:`Notifications`,fields:[{key:`notifications`,store:`profileSettings`,pick:e=>{let{desktop:t,sound:n,when_focused:r}=q(e);return{desktop:t,sound:n,...r===void 0?{}:{when_focused:r}}},mergeInto:(e,t)=>({...q(t),...q(e)})}]},{id:`scratchpad`,label:`Scratchpad (profile-wide entries)`,fields:[{key:`entries`,store:`scratchpad`}]}];function Y(e){return e.filter(e=>e.scope===`profile`).map(e=>({title:e.title,body:e.body,tags:e.tags,agent_type:e.agent_type}))}function Gt(e){return JSON.stringify([e.title??``,e.body,e.tags,e.agent_type??``])}function Kt(e,t){if(!Array.isArray(e))return[];let n=new Set(Y(t).map(Gt)),r=new Set,i=[];for(let t of e){let e=q(t);if(typeof e.body!=`string`||e.body.length===0)continue;let a={title:typeof e.title==`string`&&e.title!==``?e.title:null,body:e.body,tags:Array.isArray(e.tags)?e.tags.filter(e=>typeof e==`string`):[],agent_type:typeof e.agent_type==`string`?e.agent_type:null},o=Gt(a);n.has(o)||r.has(o)||(r.add(o),i.push(a))}return i}function qt(e,t){switch(e.store){case`client`:return t.client[e.key];case`theme`:return t.theme;case`profileSettings`:return t.profileSettings[e.key];case`profileColumn`:return t.profile[e.key];case`scratchpad`:return Y(t.scratchpad)}}function Jt(e,t){let n={};for(let r of J){if(!e.includes(r.id))continue;let i={};for(let e of r.fields){let n=qt(e,t);n!==void 0&&(i[e.key]=e.pick?e.pick(n):n)}Object.keys(i).length>0&&(n[r.id]=i)}return n}function Yt(e,t,n,r){if(!e||typeof e!=`object`)return[];let i=e,a={},o={},s={},c=[];for(let e of J){if(r&&!r.includes(e.id))continue;let l=i[e.id];if(!l||typeof l!=`object`)continue;let u=l,d=!1;for(let r of e.fields){if(!(r.key in u))continue;let e=u[r.key];if(r.store===`scratchpad`){let r=Kt(e,n.scratchpad);r.length>0&&(t.createScratchpad(r),d=!0);continue}d=!0;let i=r.mergeInto?r.mergeInto(e,r.store===`profileSettings`?n.profileSettings[r.key]:void 0):e;r.store===`client`?a[r.key]=i:r.store===`theme`?t.setTheme(i):r.store===`profileSettings`?o[r.key]=i:s[r.key]=i}d&&c.push(e.label)}return Object.keys(a).length>0&&t.setClient(a),Object.keys(o).length>0&&t.patchProfileSettings(o),Object.keys(s).length>0&&t.patchProfileColumns(s),c}var Xt={version:1,profiles:{}};function Zt(e,t){return e.profiles[t]??{enabled:!0,groups:J.map(e=>e.id),doc:{},updatedAt:new Date(0).toISOString()}}async function Qt(){try{let e=await fetch(`/frontend/local-sync`,{headers:y(),cache:`no-store`});return e.ok?{available:!0,file:await e.json()}:{available:!1,file:Xt}}catch{return{available:!1,file:Xt}}}function $t(){return T({queryKey:[`local-sync`],queryFn:Qt,staleTime:5e3,refetchOnWindowFocus:!0,retry:!1})}function en(){let e=w();return E({mutationFn:async e=>{let t=await fetch(`/frontend/local-sync`,{method:`PUT`,headers:{...y(),"content-type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(`The local sync store did not accept the write.`);return await t.json()},onSuccess:t=>e.setQueryData([`local-sync`],{available:!0,file:t})})}function tn(){return C()?.showNotification?`unverified`:typeof Notification>`u`?`unsupported`:Notification.permission}async function nn(e,t){let n;try{return await Promise.race([e,new Promise((e,r)=>{n=setTimeout(()=>r(Error(t)),1e4)})])}finally{clearTimeout(n)}}var X;async function rn(){return!(`serviceWorker`in navigator)||!window.isSecureContext?null:(X||=an().catch(e=>{throw X=void 0,e}),X)}async function an(){let e=await nn(navigator.serviceWorker.register(`/notification-worker.js`),`Notification support did not respond. Reload Puddle and try again.`);if(e.active)return e;let t=e.installing??e.waiting;if(!t)throw Error(`Notification support could not start. Reload and try again.`);return await new Promise((e,n)=>{let r=r=>{clearTimeout(a),t.removeEventListener(`statechange`,i),r?n(r):e()},i=()=>{t.state===`activated`?r():t.state===`redundant`&&r(Error(`Notification support could not start.`))},a=setTimeout(()=>r(Error(`Notification support timed out.`)),1e4);t.addEventListener(`statechange`,i),i()}),e}async function on(e,t){if(!e.active)throw Error(`Notification support is not active.`);await new Promise((n,r)=>{let i=new MessageChannel,a=e=>{clearTimeout(o),i.port1.close(),e?r(e):n()},o=setTimeout(()=>a(Error(`Notification delivery timed out.`)),1e4);i.port1.onmessage=e=>a(e.data?.ok?void 0:Error(`The browser could not deliver the notification. Check system permissions.`)),e.active.postMessage({t:`show-notification`,request:t},[i.port2])})}var sn={state:`unverified`,message:null},Z=new Set,Q=new Map,cn=!1,ln=!1;function un(e,t){Q.set(e,t),Q.size>64&&Q.delete(Q.keys().next().value)}function $(e){sn=e;for(let e of Z)e();return e}function dn(){return(0,A.useSyncExternalStore)(e=>(Z.add(e),()=>{Z.delete(e)}),()=>sn)}async function fn(){let e=C();if(e?.notificationStatus)try{$(o.parse(await e.notificationStatus()))}catch{$({state:`failed`,message:`Could not read desktop notification delivery status.`})}}async function pn(e,t,n){try{let r=C();if(r?.showNotification){!cn&&r.onNotificationClick&&(r.onNotificationClick((e,t)=>{t||Q.get(e)?.(),Q.delete(e)}),cn=!0),un(e.id,t);let{target:i,...a}=e;return $(o.parse(await r.showNotification({...a,...r.notificationTargets?{target:i}:{},...r.notificationSubtitles&&n?{title:`${n.host} · ${n.project.name}`.slice(0,160),subtitle:e.title}:{}})))}if(typeof Notification>`u`)return $({state:`unsupported`,message:`This browser cannot show notifications.`});if(Notification.permission!==`granted`)return $({state:`failed`,message:`Allow notifications for Puddle in browser settings.`});let i=n?{...e,title:he(e.title,n.project)}:e,a=await rn();return a?(ln||=(navigator.serviceWorker.addEventListener(`message`,e=>{e.data?.t!==`notification-click`||typeof e.data.id!=`string`||(e.data.target||Q.get(e.data.id)?.(),Q.delete(e.data.id))}),!0),un(e.id,t),await on(a,i),$({state:`shown`,message:null})):await new Promise(n=>{let r=new Notification(i.title,{body:e.body,tag:e.id,silent:!0}),a=setTimeout(()=>n($({state:`unverified`,message:`Delivery has not been confirmed. Check system notification settings.`})),5e3);r.onshow=()=>{clearTimeout(a),n($({state:`shown`,message:null}))},r.onerror=()=>{clearTimeout(a),n($({state:`failed`,message:`The browser could not deliver the notification. Check system permissions.`}))},r.onclick=()=>{window.focus(),t(),r.close()}})}catch(e){return $({state:`failed`,message:e instanceof Error?e.message:`Notification delivery failed.`})}}export{N as A,Mt as C,B as D,V as E,R as O,Ft as S,At as T,Nt as _,Zt as a,Lt as b,J as c,K as d,Ut as f,Rt as g,U as h,tn as i,M as j,Dt as k,Yt as l,Ht as m,fn as n,$t as o,Wt as p,dn as r,en as s,pn as t,Jt as u,H as v,jt as w,Pt as x,It as y};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/use-desktop-state-CBTzsmlz.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-CZI7_Jkm.js","assets/local-store-Dy1Cd8sn.js","assets/client-settings-BdKglwtW.js","assets/preload-helper-Czpn1I53.js","assets/queries-BSkHGZG8.js","assets/jsx-runtime-By8HlURe.js","assets/api-CrP4jl9e.js","assets/auth-1SSLu56b.js","assets/errors-CviT-mvB.js","assets/dist-BOS6OKSE.js","assets/react-dom-cJyBB_A4.js","assets/preview-kind-CJ9RTgbs.js","assets/content-state-CROLtMfN.js","assets/debounce-B9DrqirV.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./react-dom-cJyBB_A4.js";import{h as r,m as i,t as a}from"./local-store-Dy1Cd8sn.js";import{t as o}from"./preload-helper-Czpn1I53.js";var s=e(n(),1),c=e(t(),1);async function l(){let e=u()?.windows?.reload;e?await e():window.location.reload()}function u(){return window.puddleDesktop}function d(){let[e,t]=(0,c.useState)({fullScreen:!1,animate:!1});return(0,c.useEffect)(()=>{let e=u();if(!e)return;let n=!0;e.isFullScreen?.()?.then(e=>{n&&t({fullScreen:e,animate:!1})});let r=e.onFullScreenChange?.(e=>t({fullScreen:e,animate:!0}));return()=>{n=!1,r?.()}},[]),e}var f=[`keydown`,`keyup`,`beforeinput`,`pointerdown`,`drop`],p=e=>{e.preventDefault(),e.stopImmediatePropagation()};function m(e){let t=document.getElementById(`root`);t&&(t.inert=e);for(let t of f)e?window.addEventListener(t,p,!0):window.removeEventListener(t,p,!0);e&&document.activeElement instanceof HTMLElement&&document.activeElement.blur()}var h=null,g=null,_=!1,v=new Set,y=e=>(v.add(e),()=>{v.delete(e)});function b(e){(0,s.flushSync)(()=>{_=e;for(let e of v)e()})}function x(){return h}function S(){if(!g){let e=u()?.windows;g=e?e.context().then(async e=>{h={identity:r.parse(e.identity),hostId:e.hostId,...e.stagingTransfer?{stagingTransfer:i.parse(e.stagingTransfer)}:{},...e.stagingArrangement?{stagingArrangement:i.parse(e.stagingArrangement)}:{}},(h.stagingTransfer||h.stagingArrangement)&&m(!0);let{registerDesktopWindowLifecycle:t}=await o(async()=>{let{registerDesktopWindowLifecycle:e}=await import(`./use-desktop-state-CBTzsmlz.js`).then(e=>e.s);return{registerDesktopWindowLifecycle:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]));await t()}):Promise.resolve()}return g}function C({children:e}){let t=(0,c.useSyncExternalStore)(y,()=>_),[n,r]=(0,c.useState)(()=>!u()?.windows||h!==null),[i,a]=(0,c.useState)(null);if((0,c.useEffect)(()=>{let e=!0;return S().then(()=>{e&&r(!0)},t=>{e&&a(t instanceof Error?t:Error(`Could not restore this window`))}),()=>{e=!1}},[]),i)throw i;return n&&!t?e:null}var w=a(`puddle.profile-id`);function T(){return(0,c.useSyncExternalStore)(w.subscribe,E)}function E(){let e=x()?.identity;if(e&&e.kind!==`host`)return e.profileId;let t=w.get();return t!==null&&/^[0-9a-f]{10}$/.test(t)?t:null}function D(e){let t=x()?.identity;t&&t.kind!==`host`||(window.location.pathname!==`/`&&window.history.replaceState(null,``,`/`),w.set(e))}export{C as a,m as c,d,T as i,u as l,w as n,x as o,D as r,b as s,E as t,l as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-QTnfLwEv.js";import{Q as t}from"./local-store-Dy1Cd8sn.js";import{c as n,l as r,n as i,o as a,s as o,t as s}from"./profile-store-D4lZiXgL.js";import{n as c,t as l}from"./queries-BSkHGZG8.js";import{Z as u,d,r as f,u as p}from"./use-desktop-state-CBTzsmlz.js";var m=e({handleProjectCommand:()=>_,navigateProjectRoute:()=>h,openProjectWindow:()=>g,returnProjectWindow:()=>v});function h(e){let t=/\/session\/([^/]+)$/.exec(e)?.[1];window.history.replaceState({...window.history.state,key:crypto.randomUUID(),usr:t?{notificationSession:t}:null},``,e),window.dispatchEvent(new PopStateEvent(`popstate`))}async function g(e,i){let o=r()?.windows;if(!o?.projects||!o.transfers)throw Error(`Project windows are unavailable`);if(await o.projects.focus({profileId:e,projectId:i}))return;if(a()?.identity.kind!==`host`||s()!==e)throw Error(`The project profile changed`);let d=f(e);if(!d)throw Error(`Window working set is unavailable`);let m=await l(u);if(await d.load(async()=>(await c(e))?.ui_state??t.parse({})),s()!==e)throw Error(`The project profile changed`);let g=/^\/project\/([0-9a-f]{10})/.exec(window.location.pathname)?.[1],_=g===i?`/`:window.location.pathname;await p(d,o.transfers,o.projects,i,new Map(m.map(e=>[e.id,e.project_id])),g??i,_,n),h(_)}async function _(e){let t=a()?.identity;if(!t||t.kind!==`host`&&t.profileId!==e.profileId)throw Error(`This window belongs to another profile`);t.kind===`host`&&s()!==e.profileId&&i.set(e.profileId),e.kind===`navigate-project`?h(e.route):await g(e.profileId,e.projectId)}async function v(){let e=r(),t=a()?.identity,i=e?.windows?.transfers;if(t?.kind!==`project`||!e?.closeWindow)throw Error(`Project return is unavailable`);let s=(i?.prepareProjectDock&&i.dockTargets?await i.dockTargets(t.profileId):[]).find(e=>e.identity.kind===`host`);if(!s){e.closeWindow();return}let c=f(t.profileId);if(!c||!i)throw Error(`Window working set is unavailable`);await d(c,i,t.projectId,s.identity.id,n,o)}export{v as a,m as i,h as n,g as r,_ as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{Q as n,l as r}from"./local-store-Dy1Cd8sn.js";import{t as i}from"./jsx-runtime-By8HlURe.js";import{i as a,l as o,o as s,t as c}from"./profile-store-D4lZiXgL.js";import{V as l,i as ee,n as u}from"./queries-BSkHGZG8.js";import{Y as d,o as f}from"./use-desktop-state-CBTzsmlz.js";import{t as p}from"./utils-B6KiDbIe.js";import{t as te}from"./createLucideIcon-DyMAgLa3.js";import{a as m,t as ne}from"./session-display-BUDNzNmg.js";import{n as h}from"./errors-CviT-mvB.js";import{t as g}from"./debounce-B9DrqirV.js";var _=te(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),v=e(t(),1),y=i();function re({initial:e,maxLength:t,className:n,fitContent:r=!1,onCommit:i,onCancel:a}){let[o,s]=(0,v.useState)(e),c=(0,y.jsx)(`input`,{autoFocus:!0,value:o,maxLength:t,onFocus:e=>e.currentTarget.select(),onChange:e=>s(e.target.value),onBlur:()=>i(o),onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`?i(o):e.key===`Escape`&&a()},className:p(`bg-transparent outline-none`,r?`col-start-1 row-start-1 w-0 min-w-full p-0`:n)});return r?(0,y.jsxs)(`span`,{className:p(`inline-grid min-w-px`,n),children:[(0,y.jsx)(`span`,{"aria-hidden":`true`,className:`invisible col-start-1 row-start-1 whitespace-pre`,children:o||``}),c]}):c}function b(e){return{onClick:e=>{e.detail===2&&e.preventDefault()},onDoubleClick:t=>{t.preventDefault(),e()}}}var x=null;function ie(e){return x=e,()=>{x===e&&(x=null)}}function S(){x?.()}var C=null;function w(e){return C=e,()=>{C===e&&(C=null)}}async function ae(e){if(!C)throw Error(`Open a project before opening a path.`);await C(e)}function oe(){let e=l(a()??void 0).data?.tabTitleTemplate;return(0,v.useCallback)(t=>ne(t,e),[e])}var T=(0,v.createContext)({open:()=>void 0,handler:null,setHandler:()=>void 0});function se({children:e}){let[t,n]=(0,v.useState)(null),r=(0,v.useCallback)(e=>n(()=>e),[]),i=(0,v.useCallback)(e=>t?.(e),[t]),a=(0,v.useMemo)(()=>({open:i,handler:t,setHandler:r}),[i,t,r]);return(0,y.jsx)(T.Provider,{value:a,children:e})}function ce(){return(0,v.useContext)(T)}var E=new Map;function le(e,t){let n={text:t},r=()=>{document.title=E.get(`workspace`)?.text??E.get(`shell`)?.text??`Puddle`};return E.set(e,n),r(),()=>{E.get(e)===n&&(E.delete(e),r())}}function ue(e,t){(0,v.useEffect)(()=>le(e,t),[e,t])}function de({className:e,strokeScale:t=1}){return(0,y.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:e,fill:`none`,stroke:`currentColor`,strokeWidth:1.8*t,strokeLinecap:`round`,"aria-hidden":!0,children:[(0,y.jsx)(`line`,{x1:`12`,y1:`12`,x2:`22`,y2:`12`}),(0,y.jsx)(`line`,{x1:`12`,y1:`12`,x2:`17`,y2:`20.66`}),(0,y.jsx)(`line`,{x1:`12`,y1:`12`,x2:`7`,y2:`20.66`}),(0,y.jsx)(`line`,{x1:`12`,y1:`12`,x2:`2`,y2:`12`}),(0,y.jsx)(`line`,{x1:`12`,y1:`12`,x2:`7`,y2:`3.34`}),(0,y.jsx)(`line`,{x1:`12`,y1:`12`,x2:`17`,y2:`3.34`}),(0,y.jsx)(`line`,{x1:`12`,y1:`12`,x2:`17.63`,y2:`15.25`}),(0,y.jsx)(`line`,{x1:`12`,y1:`12`,x2:`12`,y2:`18.5`}),(0,y.jsx)(`line`,{x1:`12`,y1:`12`,x2:`6.37`,y2:`15.25`}),(0,y.jsx)(`line`,{x1:`12`,y1:`12`,x2:`6.37`,y2:`8.75`}),(0,y.jsx)(`line`,{x1:`12`,y1:`12`,x2:`12`,y2:`5.5`}),(0,y.jsx)(`line`,{x1:`12`,y1:`12`,x2:`17.63`,y2:`8.75`})]})}function D({className:e,strokeScale:t=1}){return(0,y.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:e,fill:`none`,stroke:`currentColor`,strokeWidth:1.6*t,"aria-hidden":!0,children:[(0,y.jsx)(`ellipse`,{cx:`12`,cy:`12`,rx:`4`,ry:`9`}),(0,y.jsx)(`ellipse`,{cx:`12`,cy:`12`,rx:`4`,ry:`9`,transform:`rotate(60 12 12)`}),(0,y.jsx)(`ellipse`,{cx:`12`,cy:`12`,rx:`4`,ry:`9`,transform:`rotate(120 12 12)`})]})}function O({className:e,strokeScale:t=1}){return(0,y.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:e,fill:`none`,stroke:`currentColor`,strokeWidth:1.8*t,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:[(0,y.jsx)(`path`,{d:`M8 4H4v16h4`}),(0,y.jsx)(`path`,{d:`M16 4h4v16h-4`}),(0,y.jsx)(`rect`,{x:`10.5`,y:`10.5`,width:`3`,height:`3`,fill:`currentColor`,stroke:`none`})]})}function k({className:e}){return(0,y.jsx)(`svg`,{viewBox:`0 0 24 24`,className:e,fill:`currentColor`,"aria-hidden":!0,children:(0,y.jsx)(`path`,{d:`M12 1.5c0 5.8 4.7 10.5 10.5 10.5C16.7 12 12 16.7 12 22.5 12 16.7 7.3 12 1.5 12 7.3 12 12 7.3 12 1.5Z`})})}function A({type:e,className:t,strokeScale:n=1}){switch(e){case`claude-code`:return(0,y.jsx)(de,{className:t,strokeScale:n});case`codex`:return(0,y.jsx)(D,{className:t,strokeScale:n});case`opencode`:return(0,y.jsx)(O,{className:t,strokeScale:n});case`gemini-cli`:return(0,y.jsx)(k,{className:t});default:return(0,y.jsx)(m,{className:t,strokeWidth:2*n})}}var j=new Set,M=!1,N=null;function P(){for(let e of j)e()}function F(e){return j.add(e),()=>j.delete(e)}function I(e){M!==e&&(M=e,P())}function L(){I(!M)}function R(){return(0,v.useSyncExternalStore)(F,()=>M)}function z(e){N=e,P()}function B(){return(0,v.useSyncExternalStore)(F,()=>N)}function V(e){return JSON.stringify(H(e))}function H(e){return e===null?null:e.kind===`leaf`?e.tabs.length===0?null:{t:e.tabs.map(d)}:{d:e.direction,s:e.sizes.map(e=>Math.round(e*10)/10),c:e.children.map(H)}}var U=new Set,W=!1,G=null;function K(){for(let e of U)e()}function q(e){return U.add(e),()=>U.delete(e)}function J(e){W!==e&&(W=e,K())}function fe(){J(!W)}function pe(){return(0,v.useSyncExternalStore)(q,()=>W)}function me(e){G=e,K()}function he(){return(0,v.useSyncExternalStore)(q,()=>G)}var ge=2e3,Y=n.parse({});function X(e){return`puddle.ws.${e}`}function Z(e){if(e===null)return{kind:`absent`};try{return{kind:`present`,snapshot:n.parse(JSON.parse(e))}}catch{return{kind:`corrupt`}}}function _e(){let e=a(),t=f(e),n=t!==null,[r,i]=(0,v.useState)(!1),[o,s]=(0,v.useState)(Y),c=(0,v.useRef)(o);c.current=o;let l=(0,v.useRef)(null),d=(0,v.useMemo)(()=>g((e,t)=>{ee(e,t).catch(e=>console.warn(`ui-state save failed: ${e.message}`))},ge),[]);return(0,v.useEffect)(()=>{if(n)return;if(e===null){l.current=null;return}let t=X(e);l.current=t;let r=!1;i(!1),s(Y);let a;try{a=Z(sessionStorage.getItem(t)),a.kind===`corrupt`&&sessionStorage.removeItem(t)}catch(e){console.warn(`ui-state read failed: ${e.message}`),a={kind:`absent`}}return a.kind===`present`?(s(a.snapshot),i(!0)):u(e).then(e=>{r||(e&&s(e.ui_state),i(!0))}).catch(e=>{console.warn(`ui-state load failed: ${e.message}`),r||i(!0)}),()=>{r=!0,d.flush()}},[e,d,n]),t||{loaded:r,snapshot:o,current:()=>c.current,update(t){if(e===null)return;let n={...c.current,...t};c.current=n,s(n);let r=l.current??X(e);d(e,n);try{sessionStorage.setItem(r,JSON.stringify(n))}catch(e){console.warn(`ui-state write failed: ${e.message}`)}}}}var Q=`application/x-puddle-project-window`;function $(e){let t=s()?.identity;return t?.kind===`project`&&t.projectId===e&&o()?.windows?.transfers?.beginProjectDrag!==void 0}function ve(e,t){if(!$(t))return!1;let n=s();if(n.identity.kind!==`project`)return!1;let{profileId:r}=n.identity,i=crypto.randomUUID();return e.setData(Q,JSON.stringify({token:i,sourceId:n.identity.id,hostId:n.hostId,profileId:r})),e.effectAllowed=`move`,o().windows.transfers.beginProjectDrag({token:i,profileId:r,projectId:t}).catch(h),!0}async function ye(e){if(e.length>4096)throw Error(`Project drag is too large`);let t=r.parse(JSON.parse(e)),n=s(),i=o()?.windows?.transfers;if(n?.identity.kind!==`host`||!i?.dropProject)throw Error(`Return the project to a host window`);if(n.hostId!==t.hostId)throw Error(`Cannot transfer between hosts`);if(c()!==t.profileId)throw Error(`Select the same profile in the host before returning the project`);await i.dropProject({token:t.token,sourceId:t.sourceId,profileId:t.profileId})}function be(){let e=(0,v.useRef)(null),[t,n]=(0,v.useState)(!1),r=s()?.identity.kind===`host`&&o()?.windows?.transfers?.dropProject!==void 0;return(0,v.useEffect)(()=>{let t=e.current;if(!r||!t)return;let i,a=()=>{clearTimeout(i),n(!1)},o=e=>e.dataTransfer?.types.includes(Q),s=e=>{o(e)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`move`,n(!0),clearTimeout(i),i=setTimeout(a,750))},c=e=>{t.contains(e.relatedTarget)||a()},l=e=>{o(e)&&(e.preventDefault(),e.stopPropagation(),a(),ye(e.dataTransfer.getData(Q)).catch(h))};return t.addEventListener(`dragenter`,s,!0),t.addEventListener(`dragover`,s,!0),t.addEventListener(`dragleave`,c,!0),t.addEventListener(`drop`,l,!0),window.addEventListener(`dragend`,a),window.addEventListener(`blur`,a),()=>{clearTimeout(i),t.removeEventListener(`dragenter`,s,!0),t.removeEventListener(`dragover`,s,!0),t.removeEventListener(`dragleave`,c,!0),t.removeEventListener(`drop`,l,!0),window.removeEventListener(`dragend`,a),window.removeEventListener(`blur`,a)}},[r]),{ref:e,active:t,enabled:r}}export{ae as C,re as D,ie as E,b as O,oe as S,S as T,R as _,_e as a,se as b,J as c,pe as d,V as f,B as g,L as h,Z as i,_ as k,fe as l,I as m,$ as n,X as o,z as p,be as r,me as s,ve as t,he as u,A as v,w,ce as x,ue as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-By8HlURe.js";import{n as r}from"./api-CrP4jl9e.js";var i=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},a=new class extends i{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},o={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},s=new class{#e=o;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function c(e){setTimeout(e,0)}var l=typeof window>`u`||`Deno`in globalThis;function u(){}function d(e,t){return typeof e==`function`?e(t):e}function f(e){return typeof e==`number`&&e>=0&&e!==1/0}function p(e,t){return Math.max(e+(t||0)-Date.now(),0)}function m(e,t){return typeof e==`function`?e(t):e}function h(e,t){return typeof e==`function`?e(t):e}function g(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==v(o,t.options))return!1}else if(!b(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function _(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(y(t.options.mutationKey)!==y(a))return!1}else if(!b(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function v(e,t){return(t?.queryKeyHashFn||y)(e)}function y(e){return JSON.stringify(e,(e,t)=>T(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function b(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>b(e[n],t[n])):!1}var x=Object.prototype.hasOwnProperty;function S(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=w(e)&&w(t);if(!r&&!(T(e)&&T(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:x.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=S(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function C(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function w(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function T(e){if(!ee(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!ee(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function ee(e){return Object.prototype.toString.call(e)===`[object Object]`}function te(e){return new Promise(t=>{s.setTimeout(t,e)})}function E(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:S(e,t)}function ne(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function re(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var D=Symbol();function ie(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===D?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function O(e,t){return typeof e==`function`?e(...t):!!e}function ae(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var k=(()=>{let e=()=>l;return{isServer(){return e()},setIsServer(t){e=t}}})();function A(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var oe=c;function se(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=oe,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var j=se(),M=new class extends i{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function ce(e){return Math.min(1e3*2**e,3e4)}function le(e){return(e??`online`)!==`online`||M.isOnline()}var N=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function ue(e){let t=!1,n=0,r,i=A(),o=()=>i.status!==`pending`,s=t=>{if(!o()){let n=new N(t);p(n),e.onCancel?.(n)}},c=()=>{t=!0},l=()=>{t=!1},u=()=>a.isFocused()&&(e.networkMode===`always`||M.isOnline())&&e.canRun(),d=()=>le(e.networkMode)&&e.canRun(),f=e=>{o()||(r?.(),i.resolve(e))},p=e=>{o()||(r?.(),i.reject(e))},m=()=>new Promise(t=>{r=e=>{(o()||u())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,o()||e.onContinue?.()}),h=()=>{if(o())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(f).catch(r=>{if(o())return;let i=e.retry??(k.isServer()?0:3),a=e.retryDelay??ce,s=typeof a==`function`?a(n,r):a,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){p(r);return}n++,e.onFail?.(n,r),te(s).then(()=>u()?void 0:m()).then(()=>{t?p(r):h()})})};return{promise:i,status:()=>i.status,cancel:s,continue:()=>(r?.(),i),cancelRetry:c,continueRetry:l,canStart:d,start:()=>(d()?h():m().then(h),i)}}var P=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),f(this.gcTime)&&(this.#e=s.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(k.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(s.clearTimeout(this.#e),this.#e=void 0)}};function de(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{ae(e,()=>t.signal,()=>n=!0)},u=ie(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?re:ne;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?I:F,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:F(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function F(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function I(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function fe(e,t){return t?F(e,t)!=null:!1}function pe(e,t){return!t||!e.getPreviousPageParam?!1:I(e,t)!=null}var me=class extends P{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=z(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=z(this.options);e.data!==void 0&&(this.setState(R(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=E(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(u).catch(u):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>h(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===D||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>m(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!p(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=ie(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?de(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=ue({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof N&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof N){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...L(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...R(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),j.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function L(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:le(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function R(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function z(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var B=class extends i{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=A(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),V(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return H(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return H(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof h(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!C(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&U(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||h(this.options.enabled,this.#t)!==h(t.enabled,this.#t)||m(this.options.staleTime,this.#t)!==m(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||h(this.options.enabled,this.#t)!==h(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return ge(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(u)),t}#g(){this.#b();let e=m(this.options.staleTime,this.#t);if(k.isServer()||this.#r.isStale||!f(e))return;let t=p(this.#r.dataUpdatedAt,e)+1;this.#d=s.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(k.isServer()||h(this.options.enabled,this.#t)===!1||!f(this.#p)||this.#p===0)&&(this.#f=s.setInterval(()=>{(this.options.refetchIntervalInBackground||a.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(s.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(s.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&V(e,t),o=i&&U(e,n,t,r);(a||o)&&(l={...l,...L(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let g=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,g=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=E(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!g)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=E(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let _=l.fetchStatus===`fetching`,v=m===`pending`,y=m===`error`,b=v&&_,x=d!==void 0,S={status:m,fetchStatus:l.fetchStatus,isPending:v,isSuccess:m===`success`,isError:y,isInitialLoading:b,isLoading:b,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:_,isRefetching:_&&!v,isLoadingError:y&&!x,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:y&&x,isStale:W(e,t),refetch:this.refetch,promise:this.#o,isEnabled:h(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=S.data!==void 0,r=S.status===`error`&&!t,i=e=>{r?e.reject(S.error):t&&e.resolve(S.data)},a=()=>{let e=this.#o=S.promise=A();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||S.data!==o.value)&&a();break;case`rejected`:(!r||S.error!==o.reason)&&a();break}}return S}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!C(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){j.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function he(e,t){return h(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&h(t.retryOnMount,e)===!1)}function V(e,t){return he(e,t)||e.state.data!==void 0&&H(e,t,t.refetchOnMount)}function H(e,t,n){if(h(t.enabled,e)!==!1&&m(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&W(e,t)}return!1}function U(e,t,n,r){return(e!==t||h(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&W(e,n)}function W(e,t){return h(t.enabled,e)!==!1&&e.isStaleByTime(m(t.staleTime,e))}function ge(e,t){return!C(e.getCurrentResult(),t)}var _e=class extends P{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||ve(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=ue({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),j.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function ve(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var ye=class extends i{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),C(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&y(t.mutationKey)!==y(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??ve();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){j.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},G=e(t(),1),be=n(),xe=G.createContext(void 0),K=e=>{let t=G.useContext(xe);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Se=({client:e,children:t})=>(G.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,be.jsx)(xe.Provider,{value:e,children:t})),Ce=G.createContext(!1),we=()=>G.useContext(Ce);Ce.Provider;function Te(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Ee=G.createContext(Te()),De=()=>G.useContext(Ee),Oe=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?O(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},ke=e=>{G.useEffect(()=>{e.clearReset()},[e])},Ae=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||O(n,[e.error,r])),je=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Me=(e,t)=>e.isLoading&&e.isFetching&&!t,q=(e,t)=>e?.suspense&&t.isPending,J=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Ne(e,t,n){let r=we(),i=De(),a=K(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,je(o),Oe(o,i,s),ke(i);let l=!a.getQueryCache().get(o.queryHash),[d]=G.useState(()=>new t(a,o)),f=d.getOptimisticResult(o),p=!r&&c;if(G.useSyncExternalStore(G.useCallback(e=>{let t=p?d.subscribe(j.batchCalls(e)):u;return d.updateResult(),t},[d,p]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),G.useEffect(()=>{d.setOptions(o)},[o,d]),q(o,f))throw J(o,d,i);if(Ae({result:f,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw f.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,f),o.experimental_prefetchInRender&&!k.isServer()&&Me(f,r)&&(l?J(o,d,i):s?.promise)?.catch(u).finally(()=>{d.updateResult()}),o.notifyOnChangeProps?f:d.trackResult(f)}function Y(e,t){return Ne(e,B,t)}function X(e,t){let n=K(t),[r]=G.useState(()=>new ye(n,e));G.useEffect(()=>{r.setOptions(e)},[r,e]);let i=G.useSyncExternalStore(G.useCallback(e=>r.subscribe(j.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=G.useCallback((e,t)=>{r.mutate(e,t).catch(u)},[r]);if(i.error&&O(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var Pe=12,Z=typeof document<`u`?document.hasFocus():!0;typeof window<`u`&&(window.addEventListener(`focus`,()=>{Z=!0}),window.addEventListener(`blur`,()=>{Z=!1}),a.setEventListener(e=>{let t=()=>e(void 0);return window.addEventListener(`visibilitychange`,t,!1),window.addEventListener(`focus`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t),window.removeEventListener(`focus`,t)}}));function Q(e){return()=>Z?e:e*Pe}function Fe(){return Y({queryKey:[`profiles`],queryFn:()=>r(`GET`,`/api/profiles`)})}function Ie(e){return Y({queryKey:[`profile-settings`,e],queryFn:()=>r(`GET`,`/api/profiles/${e}/settings`),enabled:e!==void 0})}function Le(e){return Y({queryKey:[`accounts`,e],queryFn:()=>r(`GET`,`/api/accounts?profile=${e}`),enabled:e!==void 0})}function Re(e){return Y({queryKey:[`account-usage`,e],queryFn:()=>r(`GET`,`/api/accounts/${e}/usage`),enabled:e!==void 0,staleTime:15e3})}function ze(){return Y({queryKey:[`repos`],queryFn:()=>r(`GET`,`/api/repos`)})}function Be(e,t=!0){return Y({queryKey:[`projects`,e??`all`],queryFn:()=>r(`GET`,e===void 0?`/api/projects`:`/api/projects?profile=${e}`),enabled:t})}function Ve(e){return Y({queryKey:[`project`,e],queryFn:()=>r(`GET`,`/api/projects/${e}`),enabled:e!==void 0,placeholderData:e=>e})}function He(e){return r(`POST`,`/api/projects/${e}/conversations/refresh`)}function Ue(e){return Y({queryKey:[`sessions`,e],queryFn:()=>r(`GET`,`/api/sessions?project=${e}`),enabled:e!==void 0})}var We={queryKey:[`sessions`,`all`],queryFn:()=>r(`GET`,`/api/sessions`)};function Ge(e=!0){return Y({...We,enabled:e})}function Ke(e){return e.fetchQuery({...We,staleTime:0})}function qe(){return Y({queryKey:[`config`],queryFn:()=>r(`GET`,`/api/config`)})}function Je(e){return Y({queryKey:[`repo-branches`,e],queryFn:()=>r(`GET`,`/api/repos/${e}/branches`),enabled:e!==void 0,staleTime:3e4})}function Ye(e,t=1e4){return Y({queryKey:[`repo-worktrees`,e],queryFn:()=>r(`GET`,`/api/repos/${e}/worktrees`),enabled:e!==void 0,staleTime:t})}function Xe(e,t){let n=K();return X({mutationFn:t=>r(`DELETE`,`/api/repos/${e}/worktrees?path=${encodeURIComponent(t)}`),onSuccess:r=>{n.setQueryData([`repo-worktrees`,e],r),n.invalidateQueries({queryKey:[`project`,t]})}})}function Ze(e,t){let n=K();return X({mutationFn:({name:t,confirm:n})=>{let i=new URLSearchParams({name:t});return n&&i.set(`confirm`,`1`),r(`DELETE`,`/api/repos/${e}/branches?${i.toString()}`)},onSuccess:r=>{n.setQueryData([`repo-worktrees`,e],r),n.invalidateQueries({queryKey:[`project`,t]})}})}function Qe(e){return Y({queryKey:[`fs-dirs`,e],queryFn:()=>r(`GET`,`/api/fs/dirs?prefix=${encodeURIComponent(e)}`),enabled:e.startsWith(`/`)||e.startsWith(`~`),placeholderData:e=>e,staleTime:1e4})}function $e(){return Y({queryKey:[`version`],queryFn:()=>r(`GET`,`/api/version`),staleTime:1/0})}function et(){return Y({queryKey:[`host`],queryFn:()=>r(`GET`,`/api/host`),staleTime:1/0})}function tt(e){return e?e.displayName||e.hostname:void 0}function nt(){return Y({queryKey:[`agents`],queryFn:()=>r(`GET`,`/api/agents`),staleTime:3e4,refetchOnWindowFocus:!0})}function rt(){let e=K();return X({mutationFn:e=>r(`POST`,`/api/profiles`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`profiles`]})})}function it(e){let t=K();return X({mutationFn:t=>r(`PATCH`,`/api/profiles/${e}/settings`,t),onSuccess:n=>t.setQueryData([`profile-settings`,e],n)})}function at(){let e=K();return X({mutationFn:({id:e,...t})=>r(`PATCH`,`/api/profiles/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`profiles`]})})}function ot(){let e=K();return X({mutationFn:({id:e,...t})=>r(`PATCH`,`/api/accounts/${e}`,t),onSuccess:t=>{e.invalidateQueries({queryKey:[`accounts`,t.profile_id]}),e.invalidateQueries({queryKey:[`account-usage`,t.id]})}})}function st(){let e=K();return X({mutationFn:e=>r(`DELETE`,`/api/profiles/${e}`),onSuccess:()=>e.clear()})}function ct(){let e=K();return X({mutationFn:e=>r(`DELETE`,`/api/accounts/${e}`),onSuccess:()=>void e.invalidateQueries({queryKey:[`accounts`]})})}function lt(){let e=K();return X({mutationFn:e=>r(`POST`,`/api/accounts`,e),onSuccess:t=>void e.invalidateQueries({queryKey:[`accounts`,t.profile_id]})})}function ut(){return X({mutationFn:e=>r(`POST`,`/api/accounts/${e}/login`)})}function dt(){let e=K();return X({mutationFn:e=>r(`POST`,`/api/repos`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function ft(){let e=K();return X({mutationFn:({id:e,...t})=>r(`PATCH`,`/api/repos/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function pt(){let e=K();return X({mutationFn:e=>r(`POST`,`/api/repos/${e}/fetch`),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function mt(){let e=K();return X({mutationFn:e=>r(`POST`,`/api/projects`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`projects`]})})}function ht(){let e=K();return X({mutationFn:({id:e,...t})=>r(`PATCH`,`/api/projects/${e}`,t),onSuccess:t=>{e.setQueryData([`project`,t.id],e=>e&&{...e,project:t}),e.invalidateQueries({queryKey:[`projects`]})}})}function gt(e,t){return Y({queryKey:[`scratchpad`,e,t??`none`],queryFn:()=>r(`GET`,`/api/scratchpad?profile=${e}${t?`&project=${t}`:``}`),enabled:e!==void 0})}function _t(){let e=K();return X({mutationFn:e=>r(`POST`,`/api/scratchpad`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function vt(){let e=K();return X({mutationFn:({id:e,...t})=>r(`PATCH`,`/api/scratchpad/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function yt(){let e=K();return X({mutationFn:e=>r(`DELETE`,`/api/scratchpad/${e}`),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function bt(e,t){return Y({queryKey:[`layouts`,e,t??`none`],queryFn:()=>r(`GET`,`/api/layouts?profile=${e}${t?`&project=${t}`:``}`),enabled:e!==void 0})}function xt(){let e=K();return X({mutationFn:e=>r(`POST`,`/api/layouts`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`layouts`]})})}function St(){let e=K();return X({mutationFn:({id:e,...t})=>r(`PATCH`,`/api/layouts/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`layouts`]})})}function Ct(){let e=K();return X({mutationFn:e=>r(`DELETE`,`/api/layouts/${e}`),onSuccess:()=>void e.invalidateQueries({queryKey:[`layouts`]})})}function $(e,t){e.invalidateQueries({queryKey:[`sessions`]}),e.invalidateQueries({queryKey:[`project`,t.project_id]})}function wt(){let e=K();return X({mutationFn:e=>r(`POST`,`/api/sessions`,e),retry:!1,onSuccess:t=>$(e,t)})}function Tt(e){let t=K();return X({mutationFn:t=>r(`POST`,`/api/sessions/${t}/${e}`),onSuccess:e=>$(t,e)})}function Et(){let e=K();return X({mutationFn:({sessionId:e,accountId:t})=>r(`POST`,`/api/sessions/${e}/migrate`,{account_id:t}),onSuccess:t=>$(e,t)})}function Dt(){let e=K();return X({mutationFn:({sessionId:e,accountId:t})=>r(`POST`,`/api/sessions/${e}/handoff`,{account_id:t}),onSuccess:(t,{sessionId:n})=>{$(e,t),e.invalidateQueries({queryKey:[`session`,n]})}})}function Ot(){let e=K();return X({mutationFn:e=>r(`POST`,`/api/sessions/${e}/archive`),onSuccess:t=>$(e,t)})}function kt(){let e=K();return X({mutationFn:e=>r(`POST`,`/api/sessions/${e}/unarchive`),onSuccess:t=>$(e,t)})}function At(){let e=K();return X({mutationFn:({sessionId:e,title:t})=>r(`PATCH`,`/api/sessions/${e}`,{title:t}),onSuccess:t=>$(e,t)})}function jt(){let e=K();return X({mutationFn:e=>r(`PATCH`,`/api/config`,e),onSuccess:(t,n)=>{e.setQueryData([`config`],t),`displayName`in n&&e.invalidateQueries({queryKey:[`host`]})}})}async function Mt(e){try{return await r(`GET`,`/api/profiles/${e}/state`)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`no_state`)return null;throw e}}function Nt(e,t){return r(`PUT`,`/api/profiles/${e}/state`,{ui_state:t})}function Pt(e,t){return Y({queryKey:[`ports`,e],queryFn:()=>r(`GET`,`/api/sessions/${e}/ports`),enabled:e!==void 0&&t,refetchInterval:Q(5e3),refetchIntervalInBackground:!1})}function Ft(e,t){return Y({queryKey:[`session-env`,e],queryFn:()=>r(`GET`,`/api/sessions/${e}/env`),enabled:e!==void 0&&t,refetchInterval:Q(5e3),refetchIntervalInBackground:!1})}function It(){let e=K();return X({mutationFn:e=>r(`DELETE`,`/api/sessions/${e}/env`),onSuccess:(t,n)=>{e.setQueryData([`session-env`,n],{vars:[]})}})}export{Pt as $,bt as A,S as At,vt as B,Ct as C,d as Ct,pt as D,g as Dt,Qe as E,_ as Et,St as F,i as Ft,Xe as G,Fe as H,at as I,Ye as J,At as K,it as L,Et as M,C as Mt,ot as N,D as Nt,Dt as O,u as Ot,jt as P,a as Pt,Ft as Q,ht as R,Ze as S,j as St,yt as T,v as Tt,Ve as U,Ie as V,Be as W,gt as X,ze as Y,Tt as Z,dt as _,B as _t,He as a,Ne as at,$e as b,pe as bt,nt as c,q as ct,It as d,ke as dt,Ue as et,qe as f,De as ft,mt as g,_e as gt,rt as h,K as ht,Nt as i,Y as it,ut as j,m as jt,et as k,b as kt,Ge as l,Oe as lt,xt as m,Se as mt,Mt as n,Q as nt,Re as o,je as ot,lt as p,we as pt,Je as q,tt as r,X as rt,Le as s,J as st,Ke as t,kt as tt,Ot as u,Ae as ut,_t as v,me as vt,st as w,y as wt,ct as x,M as xt,wt as y,fe as yt,ft as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./react-dom-cJyBB_A4.js";import{t as r}from"./jsx-runtime-By8HlURe.js";import{t as i}from"./utils-B6KiDbIe.js";import{C as a,E as o,S as s,T as c,_ as l,b as u,f as d,g as f,h as p,m,p as h,v as g,x as _,y as v}from"./dialog-CTN-Lln6.js";import{o as y,r as b}from"./x-CbfJFzGo.js";import{_ as x,a as S,c as C,g as w,h as T,l as E,m as D,n as O,p as k,s as A,t as j}from"./dist-NuV8HBEc.js";import{t as ee}from"./createLucideIcon-DyMAgLa3.js";import{t as te}from"./chevron-down--sjpQEHH.js";var M=e(n(),1),N=e(t(),1),P=r(),F=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),I=`VisuallyHidden`,L=N.forwardRef((e,t)=>(0,P.jsx)(a.span,{...e,ref:t,style:{...F,...e.style}}));L.displayName=I;var R=L,z=ee(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]);function B(e){let t=N.useRef({value:e,previous:e});return N.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function V(e,[t,n]){return Math.min(n,Math.max(t,e))}var H=[` `,`Enter`,`ArrowUp`,`ArrowDown`],ne=[` `,`Enter`],U=`Select`,[W,G,re]=O(U),[K,ie]=c(U,[re,x]),q=x(),[ae,J]=K(U),[oe,se]=K(U),ce=`SelectProvider`;function le(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:p,required:m,form:h,internal_do_not_use_render:g}=e,_=q(t),[y,b]=N.useState(null),[x,S]=N.useState(null),[C,T]=N.useState(!1),E=j(l),[D,O]=f({prop:r,defaultProp:i??!1,onChange:a,caller:U}),[k,A]=f({prop:o,defaultProp:s,onChange:c,caller:U}),ee=N.useRef(null),te=N.useRef(k);N.useEffect(()=>{let e=h?y?.ownerDocument.getElementById(h):y?.form;if(e instanceof HTMLFormElement){let t=()=>A(te.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[h,y,A]);let M=!y||!!h||!!y.closest(`form`),[F,I]=N.useState(new Set),L=v(),R=Array.from(F).map(e=>e.props.value).join(`;`),z=N.useCallback(e=>{I(t=>new Set(t).add(e))},[]),B=N.useCallback(e=>{I(t=>{let n=new Set(t);return n.delete(e),n})},[]),V={required:m,trigger:y,onTriggerChange:b,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:T,contentId:L,value:k,onValueChange:A,open:D,onOpenChange:O,dir:E,triggerPointerDownPosRef:ee,disabled:p,name:u,autoComplete:d,form:h,nativeOptions:F,nativeSelectKey:R,isFormControl:M};return(0,P.jsx)(w,{..._,children:(0,P.jsx)(ae,{scope:t,...V,children:(0,P.jsx)(W.Provider,{scope:t,children:(0,P.jsx)(oe,{scope:t,onNativeOptionAdd:z,onNativeOptionRemove:B,children:it(g)?g(V):n})})})})}le.displayName=ce;var ue=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,P.jsx)(le,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,P.jsxs)(P.Fragment,{children:[n,e?(0,P.jsx)(rt,{__scopeSelect:t}):null]})})};ue.displayName=U;var de=`SelectTrigger`,fe=N.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,s=q(n),c=J(de,n),l=c.disabled||r,u=y(t,c.onTriggerChange),d=G(n),f=N.useRef(`touch`),[p,m,h]=ot(e=>{let t=d().filter(e=>!e.disabled),n=st(t,e,t.find(e=>e.value===c.value));n!==void 0&&c.onValueChange(n.value)}),g=e=>{l||(c.onOpenChange(!0),h()),e&&(c.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,P.jsx)(k,{asChild:!0,...s,children:(0,P.jsx)(a.button,{type:`button`,role:`combobox`,"aria-controls":c.open?c.contentId:void 0,"aria-expanded":c.open,"aria-required":c.required,"aria-autocomplete":`none`,dir:c.dir,"data-state":c.open?`open`:`closed`,disabled:l,"data-disabled":l?``:void 0,"data-placeholder":at(c.value)?``:void 0,...i,ref:u,onClick:o(i.onClick,e=>{e.currentTarget.focus(),f.current!==`mouse`&&g(e)}),onPointerDown:o(i.onPointerDown,e=>{f.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(g(e),e.preventDefault())}),onKeyDown:o(i.onKeyDown,e=>{let t=p.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&m(e.key),!(t&&e.key===` `)&&H.includes(e.key)&&(g(),e.preventDefault())})})})});fe.displayName=de;var pe=`SelectValue`,me=N.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:o,placeholder:s=``,...c}=e,l=J(pe,n),{onValueNodeHasChildrenChange:d}=l,f=o!==void 0,p=y(t,l.onValueNodeChange);u(()=>{d(f)},[d,f]);let m=at(l.value);return(0,P.jsx)(a.span,{...c,asChild:!m&&c.asChild,ref:p,style:{pointerEvents:`none`},children:(0,P.jsx)(N.Fragment,{children:m?s:o},m?`placeholder`:`value`)})});me.displayName=pe;var he=`SelectIcon`,ge=N.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,P.jsx)(a.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});ge.displayName=he;var _e=`SelectPortal`,[ve,ye]=K(_e,{forceMount:void 0}),be=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,P.jsx)(ve,{scope:e.__scopeSelect,forceMount:n,children:(0,P.jsx)(g,{asChild:!0,...r})})};be.displayName=_e;var Y=`SelectContent`,xe=N.forwardRef((e,t)=>{let n=ye(Y,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=J(Y,e.__scopeSelect),[o,s]=N.useState();return u(()=>{s(new DocumentFragment)},[]),(0,P.jsx)(l,{present:r||a.open,children:({present:e})=>e?(0,P.jsx)(Ee,{...i,ref:t}):(0,P.jsx)(Se,{...i,fragment:o})})});xe.displayName=Y;var Se=N.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?M.createPortal((0,P.jsx)(Ce,{scope:n,children:(0,P.jsx)(W.Slot,{scope:n,children:(0,P.jsx)(`div`,{ref:t,children:r})})}),i):null});Se.displayName=`SelectContentFragment`;var X=10,[Ce,Z]=K(Y),we=`SelectContentImpl`,Te=b(`SelectContent.RemoveScroll`),Ee=N.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:s,side:c,sideOffset:l,align:u,alignOffset:f,arrowPadding:g,collisionBoundary:v,collisionPadding:b,sticky:x,hideWhenDetached:S,avoidCollisions:C,...w}=e,T=J(Y,n),[E,D]=N.useState(null),[O,k]=N.useState(null),A=y(t,D),[j,ee]=N.useState(null),[te,M]=N.useState(null),F=G(n),[I,L]=N.useState(!1),R=N.useRef(!1);N.useEffect(()=>{if(E)return h(E)},[E]),p();let z=N.useCallback(e=>{let[t,...n]=F().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&O&&(O.scrollTop=0),n===r&&O&&(O.scrollTop=O.scrollHeight),n?.focus(),document.activeElement!==i))return},[F,O]),B=N.useCallback(()=>z([j,E]),[z,j,E]);N.useEffect(()=>{I&&B()},[I,B]);let{onOpenChange:V,triggerPointerDownPosRef:H}=T;N.useEffect(()=>{if(E){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(H.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(H.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(E)||V(!1),document.removeEventListener(`pointermove`,t),H.current=null};return H.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[E,V,H]),N.useEffect(()=>{let e=()=>V(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[V]);let[ne,U]=ot(e=>{let t=F().filter(e=>!e.disabled),n=st(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),W=N.useCallback((e,t,n)=>{let r=!R.current&&!n;(T.value!==void 0&&T.value===t||r)&&(ee(e),r&&(R.current=!0))},[T.value]),re=N.useCallback(()=>E?.focus(),[E]),K=N.useCallback((e,t,n)=>{let r=!R.current&&!n;(T.value!==void 0&&T.value===t||r)&&M(e)},[T.value]),ie=r===`popper`?Ae:Oe,q=ie===Ae?{side:c,sideOffset:l,align:u,alignOffset:f,arrowPadding:g,collisionBoundary:v,collisionPadding:b,sticky:x,hideWhenDetached:S,avoidCollisions:C}:{};return(0,P.jsx)(Ce,{scope:n,content:E,viewport:O,onViewportChange:k,itemRefCallback:W,selectedItem:j,onItemLeave:re,itemTextRefCallback:K,focusSelectedItem:B,selectedItemText:te,position:r,isPositioned:I,searchRef:ne,children:(0,P.jsx)(d,{as:Te,allowPinchZoom:!0,children:(0,P.jsx)(m,{asChild:!0,trapped:T.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:o(i,e=>{T.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,P.jsx)(_,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:(0,P.jsx)(ie,{role:`listbox`,id:T.contentId,"data-state":T.open?`open`:`closed`,dir:T.dir,onContextMenu:e=>e.preventDefault(),...w,...q,onPlaced:()=>L(!0),ref:A,style:{display:`flex`,flexDirection:`column`,outline:`none`,...w.style},onKeyDown:o(w.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&U(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=F().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>z(t)),e.preventDefault()}})})})})})})});Ee.displayName=we;var De=`SelectItemAlignedPosition`,Oe=N.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,o=J(Y,n),s=Z(Y,n),[c,l]=N.useState(null),[d,f]=N.useState(null),p=y(t,f),m=G(n),h=N.useRef(!1),g=N.useRef(!0),{viewport:_,selectedItem:v,selectedItemText:b,focusSelectedItem:x}=s,S=N.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&d&&_&&v&&b){let e=o.trigger.getBoundingClientRect(),t=d.getBoundingClientRect(),n=o.valueNode.getBoundingClientRect(),i=b.getBoundingClientRect();if(o.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-X,d=V(a,[X,Math.max(X,u-l)]);c.style.minWidth=s+`px`,c.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-X,d=V(a,[X,Math.max(X,u-l)]);c.style.minWidth=s+`px`,c.style.right=d+`px`}let a=m(),s=window.innerHeight-X*2,l=_.scrollHeight,u=window.getComputedStyle(d),f=parseInt(u.borderTopWidth,10),p=parseInt(u.paddingTop,10),g=parseInt(u.borderBottomWidth,10),y=parseInt(u.paddingBottom,10),x=f+p+l+y+g,S=Math.min(v.offsetHeight*5,x),C=window.getComputedStyle(_),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-X,D=s-E,O=v.offsetHeight/2,k=v.offsetTop+O,A=f+p+k,j=x-A;if(A<=E){let e=a.length>0&&v===a[a.length-1].ref.current;c.style.bottom=`0px`;let t=d.clientHeight-_.offsetTop-_.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+g);c.style.height=n+`px`}else{let e=a.length>0&&v===a[0].ref.current;c.style.top=`0px`;let t=Math.max(E,f+_.offsetTop+(e?w:0)+O)+j;c.style.height=t+`px`,_.scrollTop=A-E+_.offsetTop}c.style.margin=`${X}px 0`,c.style.minHeight=S+`px`,c.style.maxHeight=s+`px`,r?.(),requestAnimationFrame(()=>h.current=!0)}},[m,o.trigger,o.valueNode,c,d,_,v,b,o.dir,r]);u(()=>S(),[S]);let[C,w]=N.useState();return u(()=>{d&&w(window.getComputedStyle(d).zIndex)},[d]),(0,P.jsx)(je,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:h,onScrollButtonChange:N.useCallback(e=>{e&&g.current===!0&&(S(),x?.(),g.current=!1)},[S,x]),children:(0,P.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:C},children:(0,P.jsx)(a.div,{...i,ref:p,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Oe.displayName=De;var ke=`SelectPopperPosition`,Ae=N.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=X,...a}=e,o=q(n);return(0,P.jsx)(T,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});Ae.displayName=ke;var[je,Me]=K(Y,{}),Ne=`SelectViewport`,Pe=N.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,s=Z(Ne,n),c=Me(Ne,n),l=y(t,s.onViewportChange),u=N.useRef(0);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,P.jsx)(W.Slot,{scope:n,children:(0,P.jsx)(a.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:l,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:o(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=c;if(r?.current&&n){let e=Math.abs(u.current-t.scrollTop);if(e>0){let r=window.innerHeight-X*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}u.current=t.scrollTop})})})]})});Pe.displayName=Ne;var Fe=`SelectGroup`,[Ie,Le]=K(Fe),Re=N.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=v();return(0,P.jsx)(Ie,{scope:n,id:i,children:(0,P.jsx)(a.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Re.displayName=Fe;var ze=`SelectLabel`,Be=N.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Le(ze,n);return(0,P.jsx)(a.div,{id:i.id,...r,ref:t})});Be.displayName=ze;var Q=`SelectItem`,[Ve,He]=K(Q),Ue=N.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:c,...l}=e,u=J(Q,n),d=Z(Q,n),f=u.value===r,[p,m]=N.useState(c??``),[h,g]=N.useState(!1),_=y(t,s(e=>d.itemRefCallback?.(e,r,i))),b=v(),x=N.useRef(`touch`),S=()=>{i||(u.onValueChange(r),u.onOpenChange(!1))};return(0,P.jsx)(Ve,{scope:n,value:r,disabled:i,textId:b,isSelected:f,onItemTextChange:N.useCallback(e=>{m(t=>t||(e?.textContent??``).trim())},[]),children:(0,P.jsx)(W.ItemSlot,{scope:n,value:r,disabled:i,textValue:p,children:(0,P.jsx)(a.div,{role:`option`,"aria-labelledby":b,"data-highlighted":h?``:void 0,"aria-selected":f&&h,"data-state":f?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...l,ref:_,onFocus:o(l.onFocus,()=>g(!0)),onBlur:o(l.onBlur,()=>g(!1)),onClick:o(l.onClick,()=>{x.current!==`mouse`&&S()}),onPointerUp:o(l.onPointerUp,()=>{x.current===`mouse`&&S()}),onPointerDown:o(l.onPointerDown,e=>{x.current=e.pointerType}),onPointerMove:o(l.onPointerMove,e=>{x.current=e.pointerType,i?d.onItemLeave?.():x.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:o(l.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:o(l.onKeyDown,e=>{i||e.target!==e.currentTarget||d.searchRef?.current!==``&&e.key===` `||(ne.includes(e.key)&&S(),e.key===` `&&e.preventDefault())})})})})});Ue.displayName=Q;var $=`SelectItemText`,We=N.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...o}=e,c=J($,n),l=Z($,n),d=He($,n),f=se($,n),[p,m]=N.useState(null),h=s(e=>l.itemTextRefCallback?.(e,d.value,d.disabled)),g=y(t,m,d.onItemTextChange,h),_=p?.textContent,v=N.useMemo(()=>(0,P.jsx)(`option`,{value:d.value,disabled:d.disabled,children:_},d.value),[d.disabled,d.value,_]),{onNativeOptionAdd:b,onNativeOptionRemove:x}=f;return u(()=>(b(v),()=>x(v)),[b,x,v]),(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(a.span,{id:d.textId,...o,ref:g}),d.isSelected&&c.valueNode&&!c.valueNodeHasChildren&&!at(c.value)?M.createPortal(o.children,c.valueNode):null]})});We.displayName=$;var Ge=`SelectItemIndicator`,Ke=N.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return He(Ge,n).isSelected?(0,P.jsx)(a.span,{"aria-hidden":!0,...r,ref:t}):null});Ke.displayName=Ge;var qe=`SelectScrollUpButton`,Je=N.forwardRef((e,t)=>{let n=Z(qe,e.__scopeSelect),r=Me(qe,e.__scopeSelect),[i,a]=N.useState(!1),o=y(t,r.onScrollButtonChange);return u(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,P.jsx)(Ze,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Je.displayName=qe;var Ye=`SelectScrollDownButton`,Xe=N.forwardRef((e,t)=>{let n=Z(Ye,e.__scopeSelect),r=Me(Ye,e.__scopeSelect),[i,a]=N.useState(!1),o=y(t,r.onScrollButtonChange);return u(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,P.jsx)(Ze,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});Xe.displayName=Ye;var Ze=N.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,s=Z(`SelectScrollButton`,n),c=N.useRef(null),l=G(n),d=N.useCallback(()=>{c.current!==null&&(window.clearInterval(c.current),c.current=null)},[]);return N.useEffect(()=>()=>d(),[d]),u(()=>{l().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[l]),(0,P.jsx)(a.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:o(i.onPointerDown,()=>{c.current===null&&(c.current=window.setInterval(r,50))}),onPointerMove:o(i.onPointerMove,()=>{s.onItemLeave?.(),c.current===null&&(c.current=window.setInterval(r,50))}),onPointerLeave:o(i.onPointerLeave,()=>{d()})})}),Qe=`SelectSeparator`,$e=N.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,P.jsx)(a.div,{"aria-hidden":!0,...r,ref:t})});$e.displayName=Qe;var et=`SelectArrow`,tt=N.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=q(n);return Z(et,n).position===`popper`?(0,P.jsx)(D,{...i,...r,ref:t}):null});tt.displayName=et;var nt=`SelectBubbleInput`,rt=N.forwardRef(({__scopeSelect:e,...t},n)=>{let r=J(nt,e),{value:i,onValueChange:o,required:s,disabled:c,name:l,autoComplete:u,form:d}=r,{nativeOptions:f,nativeSelectKey:p}=r,m=N.useRef(null),h=y(n,m),g=i??``,_=B(g),v=Array.from(f).some(e=>(e.props.value??``)===``);return N.useEffect(()=>{let e=m.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(_!==g&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,g),e.dispatchEvent(t)}},[_,g]),(0,P.jsxs)(a.select,{"aria-hidden":!0,required:s,tabIndex:-1,name:l,autoComplete:u,disabled:c,form:d,onChange:e=>o(e.target.value),...t,style:{...F,...t.style},ref:h,defaultValue:g,children:[at(i)&&!v?(0,P.jsx)(`option`,{value:``}):null,Array.from(f)]},p)});rt.displayName=nt;function it(e){return typeof e==`function`}function at(e){return e===``||e===void 0}function ot(e){let t=s(e),n=N.useRef(``),r=N.useRef(0),i=N.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=N.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return N.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function st(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=ct(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function ct(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var lt=ue,ut=me;function dt({className:e,children:t,...n}){return(0,P.jsxs)(fe,{className:i(`flex h-[var(--ui-field-height)] w-full cursor-pointer items-center justify-between gap-2 px-2.5 [&>span]:truncate`,S,e),...n,children:[t,(0,P.jsx)(ge,{asChild:!0,children:(0,P.jsx)(te,{className:`size-3.5 shrink-0 text-fg-muted`})})]})}function ft({className:e,children:t,position:n=`popper`,...r}){return(0,P.jsx)(be,{children:(0,P.jsx)(xe,{position:n,sideOffset:4,className:i(`z-50 max-h-72 min-w-[var(--radix-select-trigger-width)] max-w-[var(--radix-select-content-available-width)] overflow-y-auto`,E,`overlay-select-motion`,e),...r,children:(0,P.jsx)(Pe,{children:t})})})}function pt({className:e,children:t,detail:n,...r}){return(0,P.jsxs)(Ue,{className:i(C,A,`py-1.5 pl-7 pr-2`,e),...r,children:[(0,P.jsx)(`span`,{className:`absolute left-2 flex size-3.5 items-center justify-center`,children:(0,P.jsx)(Ke,{children:(0,P.jsx)(z,{className:`size-3.5`})})}),(0,P.jsx)(We,{children:t}),n]})}export{ut as a,R as c,dt as i,ft as n,B as o,pt as r,z as s,lt as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{Dn as n,H as r,S as i,V as a,jn as o,k as s,n as c,r as l,x as u}from"./local-store-Dy1Cd8sn.js";import{t as d}from"./jsx-runtime-By8HlURe.js";import{r as f}from"./index-CYyz1r9Q.js";import{n as p}from"./api-CrP4jl9e.js";import{n as m}from"./dist-BOS6OKSE.js";import{t as h}from"./x-CbfJFzGo.js";import{t as g}from"./button-D-qeQvl5.js";import{t as _}from"./createLucideIcon-DyMAgLa3.js";import{t as v}from"./copy-CGsu8426.js";import{t as y}from"./ws-CDXOuBYB.js";var b=_(`clipboard-paste`,[[`path`,{d:`M11 14h10`,key:`1w8e9d`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v1.344`,key:`1e62lh`}],[`path`,{d:`m17 18 4-4-4-4`,key:`z2g111`}],[`path`,{d:`M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113`,key:`bjbb7m`}],[`rect`,{x:`8`,y:`2`,width:`8`,height:`4`,rx:`1`,key:`ublpy`}]]),x=_(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]);function S(){return f.get()}var C=a.options.join(`,`),w=u.imageBytes,T=20*1024*1024;async function E(e,t,n){n?.throwIfAborted();let r=a.safeParse(e.type);if(!r.success)throw Error(`Choose a PNG, JPEG, GIF or WebP image.`);if(e.size===0)throw Error(`This image is empty.`);if(e.size>T)throw Error(`Choose an image smaller than 20 MiB.`);if(!t||e.size<=w)return{blob:e,mime:r.data,resized:!1};if(r.data===`image/gif`)throw Error(`Choose a GIF no larger than 4 MiB for remote access.`);let i=await createImageBitmap(e);try{n?.throwIfAborted();let e=document.createElement(`canvas`),t=e.getContext(`2d`);if(!t)throw Error(`Could not prepare this image.`);let o=r.data===`image/jpeg`?`image/jpeg`:`image/webp`,s=Math.min(1,2048/Math.max(i.width,i.height));for(let r=0;r<8;r++){e.width=Math.max(1,Math.round(i.width*s)),e.height=Math.max(1,Math.round(i.height*s)),t.drawImage(i,0,0,e.width,e.height);for(let t of[.85,.7,.55]){let r=await new Promise(n=>e.toBlob(n,o,t));if(n?.throwIfAborted(),r&&r.size<=w)return{blob:r,mime:a.parse(r.type),resized:!0}}s*=.75}throw Error(`This image is too large to attach remotely. Choose a smaller image.`)}finally{i.close()}}var D=new WeakSet,ee=Math.floor((s.requestBytes-1024)*3/4);async function O(e,t,a,s,c,l,d){let f=e.generation,p=()=>{if(l?.throwIfAborted(),c(),e.generation!==f)throw Error(`The connection changed; the image upload was interrupted.`)};if(p(),!a.size||a.size>u.imageBytes)throw Error(`The prepared image must be no larger than 4 MiB.`);if(D.has(e))throw Error(`An image upload is already in progress.`);D.add(e);let m=crypto.randomUUID(),h=`/api/worktrees/${t}/paste-upload`,g=!1,_=!1,v=async(t,n,r)=>{p();let i=await e.request(t,n,r,l),a=await i.json();if(p(),!i.ok){let e=o.safeParse(a);throw Error(e.success?e.data.error.message:`The image upload failed.`)}return a},y=e=>v(`POST`,h,e),b=async e=>{let t=new Uint8Array(await e.arrayBuffer());return p(),btoa(Array.from(t,e=>String.fromCharCode(e)).join(``))};try{let e=n.parse(await v(`GET`,`/api/version`));if(d?.(0,a.size),!e.remote_image_uploads){if(a.size>ee)throw Error(`Update the host connector to upload images larger than 191 KiB.`);let e=await b(a),n=r.parse(await v(`POST`,`/api/worktrees/${t}/paste`,{mime:s,data:e}));return d?.(a.size,a.size),n}if(g=!0,i.parse(await y({action:`start`,upload:m,mime:s,size:a.size})).received!==0)throw Error(`Invalid image upload acknowledgement.`);for(let e=0;e<a.size;e+=u.chunkBytes){let t=a.slice(e,e+u.chunkBytes),n=await b(t),r=i.parse(await y({action:`chunk`,upload:m,offset:e,data:n}));if(r.received!==e+t.size)throw Error(`Invalid image upload acknowledgement.`);d?.(r.received,a.size)}let o=r.parse(await y({action:`finish`,upload:m}));return _=!0,o}finally{if(g&&!_&&e.generation===f)try{c(),e.request(`POST`,h,{action:`cancel`,upload:m}).catch(()=>{})}catch{}D.delete(e)}}function k(e,t,n){if(t.startsWith(`login-`)||t===`home`)return!1;let r=Array.from(e.clipboardData?.items??[]);if(r.some(e=>e.type===`text/plain`))return!1;let i=r.find(e=>e.kind===`file`&&e.type.startsWith(`image/`));if(!i)return!1;let a=i.getAsFile();return a?(A(a,t,n).then(({resized:e})=>{e&&m(`Image resized for remote access`)}).catch(e=>{m.error(e instanceof Error?`Image paste failed: ${e.message}`:`Image paste failed`)}),!0):!1}async function A(e,t,n,i={}){if(t.startsWith(`login-`)||t===`home`)throw Error(`Open a project terminal to attach an image.`);let a=l(),o=a?.generation,s=()=>{if(l()!==a||a?.generation!==o||!y.isConnected())throw Error(`The terminal connection changed; the image was not inserted.`)};i.signal?.throwIfAborted(),s(),i.onProgress?.({stage:`preparing`});let{blob:c,mime:u,resized:d}=await E(e,a!==null,i.signal);s();let f=a?await O(a,t,c,u,s,i.signal,(e,t)=>i.onProgress?.(e===t?{stage:`saving`}:{stage:`uploading`,received:e,total:t})):await(async()=>{let e=await j(c);return s(),i.signal?.throwIfAborted(),r.parse(await p(`POST`,`/api/worktrees/${t}/paste`,{mime:u,data:e}))})();return i.signal?.throwIfAborted(),s(),i.onProgress?.({stage:`inserting`}),i.insert?i.insert(`${f.path} `):a?await a.input(t,n,`${f.path} `):y.write(t,n,`${f.path} `),{resized:d}}function j(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result).replace(/^data:[^,]*,/,``)),r.onerror=()=>n(r.error??Error(`could not read the clipboard image`)),r.readAsDataURL(e)})}var M=e(t(),1),N={ctrl:1,alt:2,shift:4},P=/^(?:\[[ABCD]|O[ABCD]|\[1;([2-8])[ABCD])$/,F=e=>e.startsWith(`\x1B`)?P.exec(e.slice(1)):null;function I(e){return!e.startsWith(`\x1B`)||e===`\x1B`||F(e)!==null||e===`\x1B[Z`}function L(e,t){if(!t)return e;let n=(t&N.ctrl)!==0,r=(t&N.alt)!==0,i=(t&N.shift)!==0,a=!!i|(r?2:0)|(n?4:0),o=F(e);if(o)return`\x1b[1;${1+(a|(o[1]?Number(o[1])-1:0))}${e.slice(-1)}`;if(!I(e))return e;if(e===` `||e===`\x1B[Z`)return i||e===`\x1B[Z`?`\x1B[Z`:` `;if(e===`\r`&&i)return`\x1b[13;${1+a}u`;if(i&&e.length===1){let t="`1234567890-=[]\\;',./".indexOf(e);t===-1?/[a-z]/.test(e)&&(e=e.toUpperCase()):e=`~!@#$%^&*()_+{}|:"<>?`[t]}if(n&&e.length===1){let t=e.toUpperCase().charCodeAt(0);t>=64&&t<=95?e=String.fromCharCode(t-64):e===` `?e=`\0`:e===`?`&&(e=``)}return r?`\x1b${e}`:e}function te(e){return e.length===3&&(e.startsWith(`\x1B[`)||e.startsWith(`\x1BO`))&&`ABCD`.includes(e[2])}var R=new Map,z=new Map,B=new Map,V=new Map,H=new Set,U=e=>(H.add(e),()=>{H.delete(e)}),W=()=>{for(let e of H)e()},G=(e,t)=>c(JSON.stringify([e,t]));function K(e,t){return(0,M.useSyncExternalStore)(U,()=>R.has(G(e,t)))}function q(e,t,n,r,i){let a=G(e,t);return R.set(a,n),r&&z.set(a,r),i?B.set(a,i):B.delete(a),W(),()=>{R.get(a)===n&&(R.delete(a),z.delete(a),B.delete(a),V.delete(a),W())}}function J(e,t){z.get(G(e,t))?.()}function Y(e,t){return(0,M.useSyncExternalStore)(U,()=>V.get(G(e,t))??0)}function X(e,t,n){let r=G(e,t);V.set(r,(V.get(r)??0)^n),W()}function Z(e,t,n){let r=G(e,t),i=V.get(r)??0;return!i||!I(n)?n:(V.delete(r),W(),L(n,i))}async function ne(e,t,n,r=!1){let i=G(e,t),a=R.get(i);if(!a)throw Error(`Wait for the terminal to attach; nothing was sent`);let o=r?`${a(n)}\r`:Z(e,t,n);!r&&te(o)&&B.get(i)?.()&&(o=`\x1bO${o.slice(-1)}`),await Q(e,t,o)}async function re(e,t,n){let r=G(e,t),i=R.get(r),a=l(),o=a?.generation;if(!i||!n()||!y.isConnected())throw Error(`Wait for the terminal to attach; nothing was pasted.`);let s;try{let n=navigator.clipboard.readText();J(e,t),s=await n}catch{throw Error(`Could not read the clipboard. Allow clipboard access or use your keyboard’s Paste action.`)}if(!n()||R.get(r)!==i||l()!==a||a?.generation!==o||!y.isConnected())throw Error(`The terminal changed; nothing was pasted. Try again in the active terminal.`);s&&await Q(e,t,i(s))}async function Q(e,t,n){let r=l();if(r)await r.input(e,t,n);else{if(!y.isConnected())throw Error(`Terminal is disconnected; nothing was sent`);y.write(e,t,n)}}var $=d();function ie({text:e,label:t,clear:n,paste:r}){let[i,a]=(0,M.useState)(!1);return(0,$.jsxs)(`div`,{role:`toolbar`,"aria-label":t,onPointerDown:e=>e.preventDefault(),className:`absolute right-2 top-2 z-20 flex gap-1 rounded-md bg-elevated p-1 shadow-lg`,children:[(0,$.jsxs)(g,{variant:`ghost`,size:`sm`,disabled:!e||i,onClick:async()=>{try{await navigator.clipboard.writeText(e),n()}catch{m.error(`Could not copy the selection. Try again.`)}},children:[(0,$.jsx)(v,{}),` Copy`]}),r&&(0,$.jsxs)(g,{variant:`ghost`,size:`sm`,disabled:i,onClick:async()=>{if(!i){a(!0);try{await r(),n()}catch(e){m.error(e instanceof Error?e.message:`Could not paste. Try again.`)}finally{a(!1)}}},children:[(0,$.jsx)(b,{}),` Paste`]}),(0,$.jsx)(g,{variant:`ghost`,size:`icon`,"aria-label":`Clear selection`,disabled:i,onClick:n,children:(0,$.jsx)(h,{})})]})}export{q as a,K as c,k as d,A as f,x as h,re as i,Y as l,S as m,Z as n,ne as o,C as p,J as r,X as s,ie as t,N as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import"./local-store-Dy1Cd8sn.js";import{t as n}from"./jsx-runtime-By8HlURe.js";import{n as r,t as i}from"./motion-Bd_MB9cH.js";import{t as a}from"./utils-B6KiDbIe.js";import{C as o,E as s,T as c,g as l}from"./dialog-CTN-Lln6.js";import{c as u,l as d,s as f}from"./dist-NuV8HBEc.js";import{t as p}from"./chevron-right-DUkOv15w.js";import{t as m}from"./createLucideIcon-DyMAgLa3.js";import{_ as h,a as ee,c as te,d as ne,f as re,g,h as _,i as ie,l as ae,m as oe,n as v,o as se,p as y,r as b,s as x,t as S,u as C}from"./dist-BcrNV8NP.js";var w=e(t(),1),T=0,E=new Set,D=()=>T>0;function ce(e,t,n){if(i()||!t){e();return}for(let e of E)e.cancel();E.clear();let r=new Map([...document.querySelectorAll(`[data-workspace-pane]`)].filter(e=>!e.closest(`[data-motion-snapshot]`)).map(e=>[e.dataset.workspacePane,e.getBoundingClientRect()]));T++;try{e()}finally{requestAnimationFrame(()=>{if(T--,i())return;let e=n();if(!e)return;let a=e.closest(`[data-workspace-pane]`),o=(e,t,n)=>{let r=e.getBoundingClientRect();if(!r.width||!r.height)return;let i=t.left-r.left,a=t.top-r.top,o=Math.max(.02,t.width/r.width),s=Math.max(.02,t.height/r.height),c=e.animate((n?[{transform:`translate(${i}px, ${a}px) scale(${o}, ${s})`,opacity:.4,offset:0},{transform:`translate(${i*.25}px, ${a*.35}px) scale(${o+(1-o)*.85}, ${s+(1-s)*.5})`,opacity:1,offset:.55},{transform:`none`,opacity:1,offset:1}]:[{transform:`translate(${i}px, ${a}px)`,width:`${t.width}px`,height:`${t.height}px`},{transform:`none`,width:`${r.width}px`,height:`${r.height}px`}]).map(e=>({...e,transformOrigin:`top left`})),{duration:320,easing:`cubic-bezier(0.2, 0.7, 0.2, 1)`});c.effect?.updateTiming({fill:`none`}),E.add(c),c.finished.then(()=>E.delete(c),()=>E.delete(c))};for(let e of document.querySelectorAll(`[data-workspace-pane]`)){if(e.closest(`[data-motion-snapshot]`))continue;let n=r.get(e.dataset.workspacePane);if(e===a&&!n)o(e,t,!0);else if(n){let t=e.getBoundingClientRect();(n.x!==t.x||n.y!==t.y||n.width!==t.width||n.height!==t.height)&&o(e,n,!1)}}a&&e!==a&&r.has(a.dataset.workspacePane)&&o(e,t,!0);let s=new MutationObserver(()=>{if(i())for(let e of E)e.cancel()});s.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-reduce-motion`]}),Promise.allSettled([...E].map(e=>e.finished)).then(()=>s.disconnect())})}}var O=n(),le=class extends w.Component{live=(0,w.createRef)();layers=(0,w.createRef)();animations=[];clear=()=>{this.animations.forEach(e=>e.cancel()),this.animations=[],this.layers.current?.replaceChildren()};getSnapshotBeforeUpdate(e){if(e.motionKey===this.props.motionKey||e.presentKeys?.includes(this.props.motionKey)&&this.props.presentKeys?.includes(e.motionKey)||e.preview&&this.props.preview||this.props.reduced||D())return null;let t=this.live.current;if(!t||!t.getBoundingClientRect().width)return null;let n=t.cloneNode(!0),r=t.querySelectorAll(`canvas`);n.querySelectorAll(`canvas`).forEach((e,t)=>{let n=r[t];if(!(!n||!n.width||!n.height))try{e.getContext(`2d`)?.drawImage(n,0,0)}catch{}}),n.querySelectorAll(`[data-motion-snapshot]`).forEach(e=>e.remove()),n.querySelectorAll(`iframe, audio, video, object, embed`).forEach(e=>e.remove());for(let e of[n,...n.querySelectorAll(`*`)])for(let t of e.getAttributeNames())(t===`id`||t===`autofocus`||t.startsWith(`data-`))&&e.removeAttribute(t);n.inert=!0,n.setAttribute(`aria-hidden`,`true`),n.dataset.motionSnapshot=``;let i=getComputedStyle(t),a=t.getBoundingClientRect();return n.style.width=`${a.width}px`,n.style.height=`${a.height}px`,n.style.opacity=i.opacity,n.style.scale=i.scale,n}componentDidUpdate(e,t,n){if(this.props.reduced||D()||e.motionKey!==this.props.motionKey&&e.presentKeys?.includes(this.props.motionKey)&&this.props.presentKeys?.includes(e.motionKey)||e.preview&&this.props.preview&&e.motionKey!==this.props.motionKey){this.clear();return}if(e.motionKey===this.props.motionKey)return;this.clear();let r=this.live.current;if(!r)return;n&&(this.layers.current?.append(n),this.animations.push(n.animate([{opacity:n.style.opacity,scale:n.style.scale},{opacity:0,scale:`0.97`}],{duration:180,easing:`ease-in`,fill:`forwards`})));let i=r.animate([{opacity:0,scale:`0.97`},{opacity:1,scale:`1`}],{duration:180,easing:`ease-out`});this.animations.push(i),i.finished.then(()=>{this.animations.includes(i)&&this.clear()},()=>{})}componentWillUnmount(){this.clear()}render(){return(0,O.jsxs)(`div`,{className:a(`relative min-h-0 min-w-0`,this.props.className),"data-content-motion":!0,children:[(0,O.jsx)(`div`,{ref:this.live,className:`size-full min-h-0 min-w-0`,children:this.props.children}),(0,O.jsx)(`div`,{ref:this.layers,className:`pointer-events-none absolute inset-0 z-30 overflow-hidden`,inert:!0,"aria-hidden":`true`})]})}};function ue(e){return(0,O.jsx)(le,{...e,reduced:r()})}var de=m(`corner-left-up`,[[`path`,{d:`M14 9 9 4 4 9`,key:`1af5af`}],[`path`,{d:`M20 20h-7a4 4 0 0 1-4-4V4`,key:`1blwi3`}]]),k=`ContextMenu`,[A,fe]=c(k,[h]),j=h(),[M,N]=A(k),P=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,dir:a,modal:o=!0}=e,s=w.useRef(!1);{let e=w.useRef(!1);w.useEffect(()=>{i===!0&&!s.current&&!e.current&&(e.current=!0,console.warn("ContextMenu: The `open` prop has been set to `true` before the user has interacted with the trigger, so its position is indeterminate. This is likely unintended and will result in the menu being anchored to the top-left corner of the viewport."))},[i])}let[c,u]=l({prop:i,defaultProp:!1,onChange:r,caller:k}),d=j(t);return(0,O.jsx)(M,{scope:t,open:c,onOpenChange:u,modal:o,hasInteractedRef:s,children:(0,O.jsx)(re,{...d,dir:a,open:c,onOpenChange:u,modal:o,children:n})})};P.displayName=k;var F=`ContextMenuTrigger`,I=w.forwardRef((e,t)=>{let{__scopeContextMenu:n,disabled:r=!1,...i}=e,a=N(F,n),c=j(n),[l,u]=w.useState({x:0,y:0}),d=w.useMemo(()=>({current:{getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...l})}}),[l]),f=w.useRef(0),p=w.useCallback(()=>window.clearTimeout(f.current),[]),m=e=>{a.hasInteractedRef.current=!0,u({x:e.clientX,y:e.clientY}),a.onOpenChange(!0)};return w.useEffect(()=>p,[p]),w.useEffect(()=>void(r&&p()),[r,p]),(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(S,{...c,virtualRef:d}),(0,O.jsx)(o.span,{"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,...i,ref:t,style:{WebkitTouchCallout:`none`,...e.style},onContextMenu:r?e.onContextMenu:s(e.onContextMenu,e=>{p(),m(e),e.preventDefault()}),onPointerDown:r?e.onPointerDown:s(e.onPointerDown,X(e=>{p(),a.open&&a.onOpenChange(!1),f.current=window.setTimeout(()=>m(e),700)})),onPointerMove:r?e.onPointerMove:s(e.onPointerMove,X(p)),onPointerCancel:r?e.onPointerCancel:s(e.onPointerCancel,X(p)),onPointerUp:r?e.onPointerUp:s(e.onPointerUp,X(p))})]})});I.displayName=F;var L=`ContextMenuPortal`,R=e=>{let{__scopeContextMenu:t,...n}=e,r=j(t);return(0,O.jsx)(ae,{...r,...n})};R.displayName=L;var z=`ContextMenuContent`,B=w.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=N(z,n),a=j(n),o=w.useRef(!1);return(0,O.jsx)(ie,{...a,...r,ref:t,side:`right`,sideOffset:2,align:`start`,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),!t.defaultPrevented&&o.current&&t.preventDefault(),o.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),!t.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});B.displayName=z;var V=`ContextMenuGroup`,H=w.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=j(n);return(0,O.jsx)(ee,{...i,...r,ref:t})});H.displayName=V;var pe=`ContextMenuLabel`,me=w.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=j(n);return(0,O.jsx)(te,{...i,...r,ref:t})});me.displayName=pe;var he=`ContextMenuItem`,U=w.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=j(n);return(0,O.jsx)(se,{...i,...r,ref:t})});U.displayName=he;var ge=`ContextMenuCheckboxItem`,_e=w.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=j(n);return(0,O.jsx)(b,{...i,...r,ref:t})});_e.displayName=ge;var ve=`ContextMenuRadioGroup`,ye=w.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=j(n);return(0,O.jsx)(C,{...i,...r,ref:t})});ye.displayName=ve;var be=`ContextMenuRadioItem`,xe=w.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=j(n);return(0,O.jsx)(ne,{...i,...r,ref:t})});xe.displayName=be;var W=`ContextMenuItemIndicator`,Se=w.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=j(n);return(0,O.jsx)(x,{...i,...r,ref:t})});Se.displayName=W;var Ce=`ContextMenuSeparator`,G=w.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=j(n);return(0,O.jsx)(y,{...i,...r,ref:t})});G.displayName=Ce;var we=`ContextMenuArrow`,Te=w.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=j(n);return(0,O.jsx)(v,{...i,...r,ref:t})});Te.displayName=we;var K=`ContextMenuSub`,q=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,defaultOpen:a}=e,o=j(t),[s,c]=l({prop:i,defaultProp:a??!1,onChange:r,caller:K});return(0,O.jsx)(oe,{...o,open:s,onOpenChange:c,children:n})};q.displayName=K;var Ee=`ContextMenuSubTrigger`,J=w.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=j(n);return(0,O.jsx)(g,{...i,...r,ref:t})});J.displayName=Ee;var De=`ContextMenuSubContent`,Y=w.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=j(n);return(0,O.jsx)(_,{...i,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Y.displayName=De;function X(e){return t=>t.pointerType===`mouse`?void 0:e(t)}var Oe=P,ke=I,Z=R,Ae=B,je=U,Me=G,Ne=q,Pe=J,Fe=Y,Ie=Oe,Le=ke,Re=Ne;function ze({className:e,...t}){return(0,O.jsx)(Z,{children:(0,O.jsx)(Ae,{className:a(`z-50 min-w-36 overflow-hidden`,d,`overlay-context-menu-motion`,e),...t})})}function Be({className:e,...t}){return(0,O.jsx)(je,{className:a(u,f,`[&_svg]:size-3.5`,e),...t})}function Ve({className:e,children:t,...n}){return(0,O.jsxs)(Pe,{className:a(u,f,`data-[state=open]:bg-action data-[state=open]:text-action-ink [&_svg]:size-3.5`,e),...n,children:[t,(0,O.jsx)(p,{className:`ml-auto`})]})}function He({className:e,...t}){return(0,O.jsx)(Z,{children:(0,O.jsx)(Fe,{className:a(`z-50 min-w-36 overflow-hidden`,d,`overlay-context-menu-motion`,e),...t})})}function Ue({className:e,...t}){return(0,O.jsx)(Me,{className:a(`-mx-1 my-1 h-px bg-border`,e),...t})}function We(){return{onClick:e=>{e.detail===2&&e.preventDefault()},onDoubleClick:e=>{e.preventDefault(),e.currentTarget.dispatchEvent(new MouseEvent(`contextmenu`,{bubbles:!0,cancelable:!0,clientX:e.clientX,clientY:e.clientY,button:2}))}}}function Q(e){let t=Date.parse(e.created_at);return Number.isNaN(t)?0:t}function Ge(e,t){let n=new Map(t.map((e,t)=>[e,t])),r=[],i=[];for(let t of e)(n.has(t.id)?r:i).push(t);return r.sort((e,t)=>n.get(e.id)-n.get(t.id)),i.sort((e,t)=>Q(t)-Q(e)),[...i,...r]}function $(e,t,n){if(t===n)return[...e];let r=e.filter(e=>e!==t),i=r.indexOf(n);return i===-1?[...e]:(r.splice(i,0,t),r)}function Ke(e,t,n){if(t===n)return null;let r=e.find(e=>e.sessions.some(e=>e.id===t));if(!r||!r.sessions.some(e=>e.id===n))return null;let i=e.flatMap(e=>e.sessions.map(e=>e.id)),a=$(i,t,n);return a.some((e,t)=>e!==i[t])?a:null}function qe(e,t){let n=new Set(e);return[...e,...t.filter(e=>!n.has(e))]}export{Ie as a,Ue as c,Ve as d,Le as f,ce as g,ue as h,$ as i,Re as l,de as m,Ke as n,ze as o,We as p,Ge as r,Be as s,qe as t,He as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{C as e}from"./protocol-support-iXloAH0N.js";import{$t as t,In as n,Mn as r,Pn as i,Qt as a,Rn as o,Xt as s,en as c,pn as l,r as u}from"./local-store-Dy1Cd8sn.js";import{t as d}from"./jsx-runtime-By8HlURe.js";import{n as f}from"./api-CrP4jl9e.js";import{l as p}from"./profile-store-D4lZiXgL.js";import{b as m,ht as h,it as g,rt as _}from"./queries-BSkHGZG8.js";import{t as v}from"./createLucideIcon-DyMAgLa3.js";import{t as y}from"./view-state-store-Dqk7M5ei.js";var b=v(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),x=v(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),S=v(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),C=v(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),w=v(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),T=v(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),E=v(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),D=v(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),O=v(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),k=v(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),A=v(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),j=d();function M({className:e}){return(0,j.jsx)(`svg`,{viewBox:`0 0 2000 2000`,fill:`none`,"aria-hidden":`true`,className:e,children:(0,j.jsxs)(`g`,{stroke:`currentColor`,strokeWidth:120,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,j.jsx)(`circle`,{cx:`1197.64`,cy:`716.31`,r:`615.6`}),(0,j.jsx)(`line`,{x1:`925.58`,y1:`716.31`,x2:`925.58`,y2:`1529.88`}),(0,j.jsx)(`path`,{d:`M925.58,1529.88c0,124.93-101.28,226.21-226.21,226.21-124.93,0-226.21-101.28-226.21-226.21s101.28-226.21,226.21-226.21c124.93,0,226.21,101.28,226.21,226.21Z`}),(0,j.jsx)(`path`,{d:`M925.58,1529.88c0,204.02-165.39,369.41-369.41,369.41-204.02,0-369.41-165.39-369.41-369.41,0-204.02,165.39-369.41,369.41-369.41,204.02,0,369.41,165.39,369.41,369.41Z`}),(0,j.jsx)(`circle`,{cx:`1197.64`,cy:`716.31`,r:`272.05`})]})})}function N(){let e=p();return!e||e.windows?.huddles===!0}function P(){let t=m().data?.protocol;return!u()&&N()&&e(t,{major:28,minor:0})}function F(e,t){let n=P();return g({queryKey:[`huddle-availability`,e],queryFn:async({signal:t})=>s.parse(await f(`GET`,`/api/huddle/${e}/availability`,void 0,t)),enabled:t&&n&&!!e,retry:!1})}function I(e,t,n,r){let i=P();return g({queryKey:[`huddle-definitions`,e,t,n],queryFn:async({signal:r})=>a.parse(await f(`GET`,`/api/huddle/${e}/definitions?${new URLSearchParams({project_id:t,worktree:n})}`,void 0,r)),enabled:r&&i&&!!e&&!!n,retry:!1})}function L(e,n){let r=P();return g({queryKey:[`huddle-document`,e,n.project_id,n.worktree_path,n.huddle_id],queryFn:async({signal:r})=>t.parse(await f(`GET`,`/api/huddle/${e}/definitions/${n.huddle_id}?${new URLSearchParams({project_id:n.project_id,worktree:n.worktree_path})}`,void 0,r)),enabled:r&&!!e&&!!n.huddle_id,retry:!1})}function R(t){let n=h(),r=m().data?.protocol;return _({mutationFn:async n=>{if(!t||u()||!N())throw Error(`Huddle authoring is unavailable on this connection`);if(n.kind===`duplicate`&&!e(r,{major:28,minor:26}))throw Error(`Copying a huddle requires a supporting host`);if(n.kind===`create`&&n.value.template&&!e(r,{major:28,minor:27}))throw Error(`Huddle starters require a supporting host`);let i=n.kind===`duplicate`?`definitions/${n.value.huddle_id}/duplicate`:n.kind===`create`?`definitions`:`open`,a=n.kind===`duplicate`?{project_id:n.value.project_id,worktree:n.value.worktree,name:n.value.name,expected_digest:n.value.expected_digest}:n.value;return c.parse(await f(`POST`,`/api/huddle/${t}/${i}`,a))},retry:!1,onSuccess:({session:e})=>{n.setQueryData([`session`,e.id],e),n.invalidateQueries({queryKey:[`sessions`]}),n.invalidateQueries({queryKey:[`project`,e.project_id]})},onSettled:()=>{n.invalidateQueries({queryKey:[`huddle-definitions`]})}})}function z(e){return`${e.agent_type}/${e.label}`}function B(e){return[...e].sort((e,t)=>z(e).localeCompare(z(t),void 0,{numeric:!0,sensitivity:`base`}))}var V=o({x:n().finite().min(-4e6).max(4e6),y:n().finite().min(-4e6).max(4e6),zoom:n().finite().min(.001).max(2)}),H=o({format:i(1),selectedNode:l.nullable(),selectedEdge:l.nullable(),mode:r([`graph`,`list`]),camera:V.nullable()}),U=new y(500,`huddle`,!0);function W(e){let t=H.safeParse(e);return t.success?t.data:{format:1,selectedNode:null,selectedEdge:null,mode:`graph`,camera:null}}export{b as S,T as _,N as a,S as b,L as c,M as d,A as f,E as g,D as h,B as i,R as l,O as m,W as n,F as o,k as p,z as r,I as s,U as t,P as u,w as v,x,C as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-By8HlURe.js";import{i as r,l as i,o as a}from"./profile-store-D4lZiXgL.js";import{t as o}from"./use-desktop-state-CBTzsmlz.js";import{s}from"./session-order-b3nCJcCG.js";import{t as c}from"./createLucideIcon-DyMAgLa3.js";import{n as l}from"./errors-CviT-mvB.js";import{a as u,r as d}from"./project-actions-Ck504AFM.js";var f=c(`app-window`,[[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}],[`path`,{d:`M10 4v4`,key:`pp8u80`}],[`path`,{d:`M2 8h20`,key:`d11cs7`}],[`path`,{d:`M6 4v4`,key:`1svtjw`}]]),p=c(`archive-restore`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]]),m=c(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),h=c(`arrow-left-to-line`,[[`path`,{d:`M3 19V5`,key:`rwsyhb`}],[`path`,{d:`m13 6-6 6 6 6`,key:`1yhaz7`}],[`path`,{d:`M7 12h14`,key:`uoisry`}]]),g=n();function _({projectId:e}){let t=r(),n=i(),o=a()?.identity;return!t||!n?.windows?.projects?null:o?.kind===`project`&&o.projectId===e?n.closeWindow?(0,g.jsxs)(s,{onSelect:()=>{u().catch(l)},children:[(0,g.jsx)(h,{}),`Return project to host`]}):null:(0,g.jsxs)(s,{onSelect:()=>{d(t,e).catch(l)},children:[(0,g.jsx)(f,{}),`Open project in window`]})}var v=e(t(),1);function y(e,t){(0,v.useEffect)(()=>{e&&t&&o.mounted(e)},[e,t])}export{f as a,p as i,_ as n,m as r,y as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/project-actions-Ck504AFM.js","assets/rolldown-runtime-QTnfLwEv.js","assets/local-store-Dy1Cd8sn.js","assets/profile-store-D4lZiXgL.js","assets/react-CZI7_Jkm.js","assets/react-dom-cJyBB_A4.js","assets/preload-helper-Czpn1I53.js","assets/queries-BSkHGZG8.js","assets/jsx-runtime-By8HlURe.js","assets/api-CrP4jl9e.js","assets/auth-1SSLu56b.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{n as e,r as t}from"./rolldown-runtime-QTnfLwEv.js";import{t as n}from"./react-CZI7_Jkm.js";import{J as r,Kt as i,Q as a,X as o,d as s,f as c,p as l,s as u}from"./local-store-Dy1Cd8sn.js";import{t as d}from"./client-settings-BdKglwtW.js";import{t as f}from"./preload-helper-Czpn1I53.js";import{c as p,l as m,o as h,s as g,t as _}from"./profile-store-D4lZiXgL.js";import{Ct as v,Dt as y,Et as b,Ft as x,Nt as ee,Ot as S,Pt as te,St as C,Tt as ne,gt as re,i as ie,jt as ae,kt as oe,n as se,t as ce,vt as le,wt as ue,xt as de}from"./queries-BSkHGZG8.js";import{n as w}from"./errors-CviT-mvB.js";import{a as fe,n as pe,o as T}from"./preview-kind-CJ9RTgbs.js";import{n as E,t as me}from"./content-state-CROLtMfN.js";import{t as he}from"./debounce-B9DrqirV.js";var ge=class extends x{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new re({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=D(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=D(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=D(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=D(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){C.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>b(t,e))}findAll(e={}){return this.getAll().filter(t=>b(e,t))}notify(e){C.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return C.batch(()=>Promise.all(e.map(e=>e.continue().catch(S))))}};function D(e){return e.options.scope?.id}var _e=class extends x{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??ne(r,t),a=this.get(i);return a||(a=new le({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){C.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>y(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>y(e,t)):t}notify(e){C.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){C.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){C.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ve=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new _e,this.#t=e.mutationCache||new ge,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=te.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=de.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(ae(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=v(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return C.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;C.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return C.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=C.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(S).catch(S)}invalidateQueries(e,t={}){return C.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=C.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(S)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(S)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(ae(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(S).catch(S)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(S).catch(S)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return de.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(ue(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{oe(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(ue(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{oe(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=ne(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===ee&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},O=t(n(),1),ye=new ve({defaultOptions:{queries:{retry:1,staleTime:5e3}},mutationCache:new ge({onError:e=>w(e)})});function k(){return crypto.randomUUID()}function A(e){return e.type===`huddle`?`huddle:${e.session}`:e.type===`terminal`?`term:${e.session}`:`editor:${fe(e.tab)}`}function j(e,t){return A(e)===A(t)}function be(e){return e.type===`terminal`}function xe(e){return e.type===`editor`&&(e.tab.view===`linked`||e.tab.view===`locked`)}function M(e=[],t){let n=e.map(A),r=t&&n.includes(t)?t:n.length>0?n[0]:null;return{kind:`leaf`,id:k(),tabs:e,activeKey:r,previewKey:null}}function N(e,t,n){return{kind:`split`,id:k(),direction:e,children:t,sizes:n??t.map(()=>100/Math.max(1,t.length))}}function P(e,t){if(e.kind===`leaf`)return e.id===t?e:null;for(let n of e.children){let e=P(n,t);if(e)return e}return null}function Se(e,t){if(e.kind===`leaf`)return e.tabs.some(e=>A(e)===t)?e:null;for(let n of e.children){let e=Se(n,t);if(e)return e}return null}function F(e){return e.kind===`leaf`?[e]:e.children.flatMap(F)}function I(e){return F(e).flatMap(e=>e.tabs)}function Ce(e){return e.kind===`leaf`?[e.id]:[e.id,...e.children.flatMap(Ce)]}function we(e){let t=Ce(e);return new Set(t).size!==t.length}function Te(e){return e.kind===`leaf`?{...e,id:k()}:{...e,id:k(),children:e.children.map(Te)}}function L(e){if(!we(e))return e;let t=new Set,n=e=>{let r=t.has(e.id)?k():e.id;return t.add(r),e.kind===`leaf`?{...e,id:r}:{...e,id:r,children:e.children.map(n)}};return n(e)}function Ee(e){let t=e.tabs.map(A),n=e.activeKey&&t.includes(e.activeKey)?e.activeKey:t[0]??null,r=e.previewKey&&t.includes(e.previewKey)?e.previewKey:null;return n===e.activeKey&&r===(e.previewKey??null)?e:{...e,activeKey:n,previewKey:r}}function R(e){if(e.kind===`leaf`)return Ee(e);let t=e.children.map(R),n=[],r=[];t.forEach((t,i)=>{let a=e.sizes[i]??1;if(t.kind===`split`&&t.direction===e.direction){let e=t.sizes.reduce((e,t)=>e+t,0)||t.children.length;t.children.forEach((i,o)=>{n.push(i),r.push(a*(t.sizes[o]??1)/e)})}else n.push(t),r.push(a)});let i=[],a=[];return n.forEach((e,t)=>{e.kind===`leaf`&&e.tabs.length===0||(i.push(e),a.push(r[t]??1))}),i.length===0?M([]):i.length===1?i[0]:{...e,children:i,sizes:a}}function z(e,t,n){return e.kind===`leaf`?e.id===t?n(e):e:{...e,children:e.children.map(e=>z(e,t,n))}}function De(e,t,n){return z(e,t,e=>{if(!e.tabs.some(e=>A(e)===n))return e;let t=e.tabs.filter(e=>A(e)!==n),r=e.activeKey===n?Oe(e,n):e.activeKey;return{...e,tabs:t,activeKey:r}})}function Oe(e,t){let n=e.tabs.findIndex(e=>A(e)===t);if(n===-1)return e.activeKey;let r=e.tabs.filter(e=>A(e)!==t);return r.length===0?null:A(r[Math.min(n,r.length-1)])}function ke(e,t,n){let r=e.tabs.filter(e=>!j(e,t)),i=n===void 0?r.length:Math.max(0,Math.min(n,r.length)),a=[...r.slice(0,i),t,...r.slice(i)];return{...e,tabs:a,activeKey:A(t)}}function Ae(e,t,n,r){let i=n===`left`||n===`right`?`row`:`col`,a=n===`left`||n===`top`;return R(z(e,t,e=>{let t=M([r]);return N(i,a?[t,e]:[e,t],[50,50])}))}function je(e,t){let{fromLeafId:n,toLeafId:r,edge:i}=t;if(n===r)return e;let a=P(e,n),o=P(e,r);if(!a||!o)return e;if(i===`center`){let t=e=>e.kind===`leaf`?e.id===n?o:e.id===r?a:e:{...e,children:e.children.map(t)};return t(e)}return Me(R(z(e,n,e=>({...e,tabs:[],activeKey:null,previewKey:null}))),a,r,i)}function Me(e,t,n,r){let i=r===`left`||r===`right`?`row`:`col`,a=r===`left`||r===`top`;return R(z(e,n,e=>N(i,a?[t,e]:[e,t],[50,50])))}function Ne(e,t){let{ref:n,toLeafId:r,edge:i}=t,a=A(n),o=t.copy===!0&&!be(n),s=t.index;if(i===`center`&&s!==void 0){let t=P(e,r)?.tabs.findIndex(e=>A(e)===a)??-1;t!==-1&&t<s&&--s}let c=o?e:De(e,t.fromLeafId,a);if(i===`center`){let e=z(c,r,e=>ke(e,n,s));return!P(e,r)&&!Se(e,a)?B(R(Pe(e,n)),a):B(R(e),a)}return P(c,r)?B(Ae(c,r,i,n),a):R(M([n]))}function Pe(e,t){let n=F(e)[0];return n?z(e,n.id,e=>ke(e,t)):M([t])}function Fe(e,t,n){return R(z(e,t,e=>e.tabs.some(e=>A(e)===n)?{...e,tabs:e.tabs.filter(e=>A(e)!==n),activeKey:e.activeKey===n?Oe(e,n):e.activeKey}:e))}function Ie(e,t,n){let r=A(n);return R(z(e,t,e=>{let t=e.previewKey===r?null:e.previewKey;return e.tabs.some(e=>j(e,n))?{...e,activeKey:r,previewKey:t}:{...e,tabs:[...e.tabs,n],activeKey:r,previewKey:t}}))}function Le(e,t,n){let r=A(n);return R(z(e,t,e=>e.tabs.some(e=>A(e)===r)?{...e,tabs:e.tabs.map(e=>A(e)===r?n:e),previewKey:e.previewKey===r?null:e.previewKey}:{...e,tabs:[...e.tabs,n]}))}function Re(e,t,n){let r=A(n);return z(e,t,e=>({...e,tabs:e.tabs.map(e=>A(e)===r?n:e)}))}function ze(e,t,n){let r=fe(t),i=e=>e.kind===`split`?{...e,children:e.children.map(i)}:{...e,tabs:e.tabs.map(e=>e.type===`editor`&&fe(e.tab)===r?{...e,tab:{...e.tab,compile_mode:n}}:e)};return i(e)}function Be(e,t){return e.type!==`editor`||t.type!==`editor`||e.tab.view!==`preview`||t.tab.view!==void 0||pe(t.tab.path)===null?t:{...t,tab:{...t.tab,view:`preview`}}}function Ve(e,t,n){let r=A(n);return R(z(e,t,e=>{if(e.tabs.some(e=>j(e,n)))return{...e,activeKey:r};let t=e.previewKey?e.tabs.findIndex(t=>A(t)===e.previewKey):-1,i=t>=0?e.tabs[t]:void 0,a=e.tabs.length>1&&i!==void 0&&i.type===`editor`&&!xe(i),o=i?Be(i,n):n,s=a?e.tabs.map((e,n)=>n===t?o:e):[...e.tabs,o];return{...e,tabs:s,activeKey:r,previewKey:r}}))}function B(e,t){let n=e=>e.kind===`leaf`?e.previewKey===t?{...e,previewKey:null}:e:{...e,children:e.children.map(n)};return n(e)}function He(e,t,n,r){return z(e,t,e=>{let t=e.tabs.findIndex(e=>e.type===`editor`&&A(e)===n),i=t>=0?e.tabs[t]:void 0;if(i===void 0||i.type!==`editor`)return e;let a={...i,tab:{...i.tab,view:r}},o=A(a);if(o===n)return{...e,tabs:e.tabs.map((e,n)=>n===t?a:e)};let s=e.tabs.some((e,n)=>n!==t&&A(e)===o),c=s?e.tabs.filter((e,n)=>n!==t):e.tabs.map((e,n)=>n===t?a:e);return{...e,tabs:c,activeKey:e.activeKey===n?o:e.activeKey,previewKey:e.previewKey===n?s?null:o:e.previewKey??null}})}function Ue(e,t){let n=T(e);return n!==`commit`&&n!==`untitled`&&e.session===t.session&&e.path===t.path&&e.root===t.root}function We(e,t,n){if(n===t.path)return e;let r=!1,i=e=>{if(e.kind===`split`){let t=e.children.map(i);return t.some((t,n)=>t!==e.children[n])?{...e,children:t}:e}let a=new Map,o=!1,s=e.tabs.map(e=>{if(e.type!==`editor`||!Ue(e.tab,t))return e;let r={...e,tab:{...e.tab,path:n}};return a.set(A(e),A(r)),o=!0,r});if(!o)return e;r=!0;let c=e.activeKey,l=e.previewKey??null;return{...e,tabs:s,activeKey:c===null?null:a.get(c)??c,previewKey:l===null?null:a.get(l)??l}},a=i(e);return r?a:e}function Ge(e){if(e.type!==`editor`)return null;let t=e.tab,n=T(t);return n!==`file`&&n!==`external`||t.view===`linked`||t.view===`locked`||pe(t.path)===null?null:t}function Ke(e,t){let n=Ge(t);if(!n)return e;let r=!1,i=e=>{if(e.kind===`split`)return{...e,children:e.children.map(i)};let t=!1,a=e.tabs.map(e=>{if(e.type!==`editor`||!xe(e))return e;let r=e.tab;return r.session===n.session&&r.path===n.path&&(r.root??``)===(n.root??``)&&T(r)===T(n)?e:(t=!0,{type:`editor`,tab:{session:n.session,path:n.path,...n.kind===void 0?{}:{kind:n.kind},...n.root===void 0?{}:{root:n.root},view:r.view}})});return t?(r=!0,{...e,tabs:a}):e},a=i(e);return r?a:e}function qe(e,t){return e.session===t.session&&e.path===t.path&&(e.root??``)===(t.root??``)&&T(e)===T(t)}function Je(e,t,n){let r=F(e).flatMap(e=>e.tabs.flatMap(n=>n.type!==`editor`||n.tab.view===`linked`||n.tab.view===`locked`||!qe(n.tab,t)?[]:[{leafId:e.id,ref:n}]));return r.find(({leafId:e})=>e===n)??r.find(({ref:e})=>(e.tab.view??`source`)===`source`)??r[0]??null}function Ye(e,t,n){return z(e,t,e=>e.tabs.some(e=>A(e)===n)?{...e,activeKey:n}:e)}function Xe(e,t,n){function r(e){return e.kind===`leaf`?e:e.id===t&&n.length===e.children.length?{...e,children:e.children.map(r),sizes:[...n]}:{...e,children:e.children.map(r)}}return r(e)}function Ze(e){let t=e.type===`editor`?e.tab.session:e.session;return t===`00000000-0000-0000-0000-000000000000`?null:t}function Qe(e){return t=>{let n=Ze(t);return n===null||e.has(n)}}function V(e,t){let n=e=>e.kind===`leaf`?{...e,tabs:e.tabs.filter(t)}:{...e,children:e.children.map(n)};return R(n(e))}function $e(e){let t=new Set,n=[];for(let r of e){let e=R(V(r,e=>!t.has(A(e)))),i=I(e);if(i.length!==0){for(let e of i)t.add(A(e));n.push(e)}}return n.length===0?M([]):L(n.length===1?n[0]:R(N(`row`,n)))}function H(e){let t=e.editor_tabs.map(e=>({type:`editor`,tab:e})),n=e.session_tabs.map(e=>({type:`terminal`,session:e})),r=e.active_editor_tab?A({type:`editor`,tab:e.active_editor_tab}):null,i=e.active_session?`term:${e.active_session}`:null;if(t.length===0&&n.length===0)return M([]);if(t.length===0)return M(n,i);if(n.length===0)return M(t,r);let a=e.layout,o=typeof a.editor==`number`?a.editor:40,s=typeof a.session==`number`?a.session:60;return R(N(`col`,[M(t,r),M(n,i)],[o,s]))}var et={layout_tree:null,active_session:null,layout_ref:null};function tt(e){return e.type===`editor`?e.tab.session:e.session}function nt(e,t){let n=new Set;for(let[r,i]of Object.entries(e))if(!(r===t||!i.layout_tree))for(let e of I(i.layout_tree))e.type===`terminal`&&n.add(e.session);return[...n]}function U(e,t){let n=e.project_layouts[t];return{...e,layout_tree:n?.layout_tree??null,active_session:n?.active_session??null,layout_ref:n?.layout_ref??null,session_tabs:[],editor_tabs:[],active_editor_tab:null}}function rt(e,t,n){return n?{loaded:e.loaded,snapshot:U(e.snapshot,t),current:()=>U(e.current(),t),update(n){let r={},i={...n};if(`layout_tree`in n&&(r.layout_tree=n.layout_tree??null,delete i.layout_tree),`active_session`in n&&(r.active_session=n.active_session??null,delete i.active_session),`layout_ref`in n&&(r.layout_ref=n.layout_ref??null,delete i.layout_ref),Object.keys(r).length>0){let n=e.current().project_layouts;i.project_layouts={...n,[t]:{...n[t]??et,...r}}}Object.keys(i).length>0&&e.update(i)}}:e}function it(e,t,n,r){let i=e.layout_tree??H(e),a={};for(let o of t)a[o]={layout_tree:Te(V(i,e=>{let i=tt(e);return i===`00000000-0000-0000-0000-000000000000`?o===(r??t[0]):n.get(i)===o})),active_session:e.active_session!==null&&n.get(e.active_session)===o?e.active_session:null,layout_ref:null};return{layout_mode:`project`,project_layouts:a}}function at(e,t,n={}){return{...e,...t,...n}}function ot(e,t,n){let r=t.layout_tree?V(t.layout_tree,e=>{let t=tt(e);return t===`00000000-0000-0000-0000-000000000000`||n.alive.has(t)}):null,i=t.active_session!==null&&n.alive.has(t.active_session)?t.active_session:null;if(t.scope===`profile`)return{projectBased:!1,patch:{layout_mode:`profile`,layout_tree:r,active_session:i,layout_ref:t.id}};let a=t.project_id??n.currentProject??n.projectIds[0]??``,o={layout_tree:r,active_session:i,layout_ref:t.id};if((e.layout_mode??`profile`)===`project`)return{projectBased:!0,patch:{project_layouts:{...e.project_layouts,[a]:o}}};let s=it(e,n.projectIds,n.sessionProject,a);return{projectBased:!0,patch:{...s,project_layouts:at(s.project_layouts??{},e.project_layouts,{[a]:o})}}}function st(e,t){let n=e.project_layouts,r=[...t.filter(e=>e in n),...Object.keys(n).filter(e=>!t.includes(e))].map(e=>n[e]);return{layout_mode:`profile`,project_layouts:{},layout_tree:$e(r.map(e=>e.layout_tree).filter(e=>e!==null)),active_session:r.map(e=>e.active_session).find(e=>e!==null)??null,layout_ref:null}}function W(e,t,n,r,i){let a={};for(let[o,s]of Object.entries(e)){let e=o.indexOf(`[`);if(!(e<0))try{let c=JSON.parse(o.slice(e));if(!Array.isArray(c)||c.length!==3||typeof c[0]!=`string`)continue;let l=JSON.parse(c[0]);if(!Array.isArray(l)||l.length!==3||typeof l[0]!=`string`||typeof l[1]!=`string`||typeof l[2]!=`string`||i!==void 0&&!i.has(l[2])||!l[0].endsWith(`:${n}`))continue;let u=t.get(l[1]);if(!u)continue;let d=`${l[0].slice(0,-n.length)}${r}`;a[o.slice(0,e)+JSON.stringify([JSON.stringify([d,u,l[2]]),...c.slice(1)])]=s}catch{}}return a}function G(e,t){return new Set(e?t.filter(t=>I(e).some(e=>o(e,t))).map(E):[])}function ct(e,t){return e.kind===`leaf`?e.id===t?M():e:R({...e,children:e.children.map(e=>ct(e,t))})}function lt(e,t,n){let r=e.snapshot,i=r.layout_mode===`project`?U(r,t):r,a=i.layout_tree,o=a&&P(a,n);if(!a||!o)throw Error(`The pane has changed; try opening it again`);let s=ct(a,n),c=i.active_session&&I(s).some(e=>e.type!==`editor`&&e.session===i.active_session)?i.active_session:null,l=r.layout_mode===`project`?{...r,project_layouts:{...r.project_layouts,[t]:{...r.project_layouts[t],layout_tree:s,active_session:c}}}:{...r,layout_tree:s,active_session:c},u=o.tabs.find(e=>A(e)===o.activeKey);return K(e,l,{...i,layout_mode:`profile`,layout_tree:o,project_layouts:{},session_tabs:[],editor_tabs:[],active_editor_tab:null,active_session:u&&u.type!==`editor`?u.session:null,layout_ref:null},t)}function ut(e,t,n,r){let i=e.snapshot,a=A(n),o=l(n),s=(i.layout_mode===`project`?[t,...Object.keys(i.project_layouts).filter(e=>e!==t)].map(e=>({id:e,snapshot:U(i,e)})):[{id:t,snapshot:i}]).flatMap(e=>(e.snapshot.layout_tree?F(e.snapshot.layout_tree):[]).filter(e=>(!r||r===e.id)&&e.tabs.some(e=>l(e)===o)).map(t=>({scope:e,leaf:t}))).at(0);if(r&&!s)throw Error(`The tab has changed; try opening it again`);let c=s?.leaf.tabs.find(e=>l(e)===o)??n,u=M([c]);s&&(u.id=s.leaf.id);let d=i;if(s){let e=Fe(s.scope.snapshot.layout_tree,s.leaf.id,a),t=s.scope.snapshot.active_session,n=t&&I(e).some(e=>e.type!==`editor`&&e.session===t)?t:null;d=i.layout_mode===`project`?{...i,project_layouts:{...i.project_layouts,[s.scope.id]:{...i.project_layouts[s.scope.id],layout_tree:e,active_session:n}}}:{...i,layout_tree:e,active_session:n}}let f={...i.layout_mode===`project`?U(i,t):i,layout_mode:`profile`,project_layouts:{},layout_tree:u,session_tabs:[],editor_tabs:[],active_editor_tab:null,layout_ref:null,active_session:c.type===`editor`?null:c.session};return K(e,d,f,s?.scope.id??t)}function K(e,t,n,r){let i=G(n.layout_tree,e.buffers),a=G(t.layout_mode===`project`?null:t.layout_tree,e.buffers);if(t.layout_mode===`project`)for(let n of Object.values(t.project_layouts))for(let t of G(n.layout_tree,e.buffers))a.add(t);return{source:{snapshot:t,buffers:e.buffers.filter(e=>!i.has(E(e))||a.has(E(e))),views:e.views},destination:{snapshot:n,buffers:e.buffers.filter(e=>i.has(E(e))),views:{...e.views,...W(e.views,new Map(F(n.layout_tree).map(e=>[e.id,e.id])),e.snapshot.layout_mode===`project`?`project:${r}`:`profile`,`profile`)}}}}function dt(e,t){let n=new Map(e.buffers.map(e=>[E(e),e]));for(let e of t.buffers){let t=E(e),r=n.get(t);if(r&&(r.content!==e.content||r.baseMtimeMs!==e.baseMtimeMs||!i(r.baseRevision,e.baseRevision)))throw Error(`Both windows have different unsaved edits to ${e.path}`);n.set(t,e)}return[...n.values()]}function q(e,t,n){let r=e.layout_mode===`project`&&n!==void 0,i=r?e.project_layouts[n]?.layout_tree:e.layout_tree,a=i?I(i):[],s=t.filter(e=>!a.some(t=>o(t,e))).map(e=>({type:`editor`,tab:{session:e.session,path:e.path,...e.root===void 0?{}:{root:e.root},kind:e.session===`00000000-0000-0000-0000-000000000000`?`untitled`:`file`,view:`source`}}));if(!s.length)return e;let c=M(s),l=i?L(R(N(`row`,[i,c]))):c;return r?{...e,project_layouts:{...e.project_layouts,[n]:{...e.project_layouts[n]??{active_session:null,layout_ref:null},layout_tree:l}}}:{...e,layout_tree:l}}function J(e,t,n,r){let i=e.snapshot,a=i.layout_mode===`project`?U(i,t):i,o=a.layout_tree??H(a),s=e=>{let i=e.type===`editor`?e.tab.session:e.session;return i===`00000000-0000-0000-0000-000000000000`?t===r:n.get(i)===t},c=i.layout_mode===`project`?o:V(o,s),u=new Set(I(c).map(l)),d=Object.fromEntries(Object.entries(i.project_layouts).map(([e,t])=>[e,{...t,layout_tree:t.layout_tree?V(t.layout_tree,e=>!u.has(l(e))):null,active_session:t.active_session&&I(c).some(e=>e.type!==`editor`&&e.session===t.active_session)?null:t.active_session}])),f=i.layout_mode===`project`?M():V(o,e=>!s(e)),p=(e,t)=>t!==null&&I(e).some(e=>e.type!==`editor`&&e.session===t);return K(e,i.layout_mode===`project`?{...i,project_layouts:{...i.project_layouts,[t]:{layout_tree:f,active_session:null,layout_ref:null}}}:{...i,layout_tree:f,project_layouts:d,active_session:p(f,i.active_session)?i.active_session:null},{...a,layout_tree:c,layout_mode:`profile`,project_layouts:{},session_tabs:[],editor_tabs:[],active_editor_tab:null,active_session:p(c,a.active_session)?a.active_session:null,layout_ref:i.layout_mode===`project`?a.layout_ref:null},t)}function ft(e,t,n){if(t.snapshot.layout_mode!==`profile`||!t.snapshot.layout_tree)throw Error(`The returned project has no isolated workspace`);let r=dt(e,t),i=e.snapshot,a=i.layout_mode===`project`?U(i,n):i,o=t.snapshot.layout_tree,s=new Set(I(o).flatMap(e=>e.type===`terminal`?[e.session]:[])),c=e=>V(e,e=>e.type!==`terminal`||!s.has(e.session)),l=c(a.layout_tree??H(a)),u=new Set,d=e=>{e&&(u.add(e.id),e.kind===`split`&&e.children.forEach(d))};d(l),i.layout_mode===`project`&&Object.values(i.project_layouts).forEach(e=>d(e.layout_tree));let f=new Map,p=e=>{let t=e.id;for(;u.has(t);)t=crypto.randomUUID();return u.add(t),e.kind===`leaf`?(f.set(e.id,t),{...e,id:t}):{...e,id:t,children:e.children.map(p)}},m=p(o),h=I(l).length?R({kind:`split`,id:crypto.randomUUID(),direction:`row`,children:[l,m],sizes:[50,50]}):m,g=t.snapshot,_={...i,layout:g.layout,explorer_pin:g.explorer_pin,explorer_open:g.explorer_open,sidebar_mode:g.sidebar_mode,sidebar_collapsed:g.sidebar_collapsed,sessions_collapsed:g.sessions_collapsed,session_order:[...new Set([...g.session_order,...i.session_order])]};if(i.layout_mode===`project`){let e={...i.project_layouts};for(let[t,r]of Object.entries(e))t===n||!r.layout_tree||(e[t]={...r,layout_tree:c(r.layout_tree),active_session:r.active_session&&s.has(r.active_session)?null:r.active_session});e[n]={layout_tree:h,active_session:g.active_session,layout_ref:g.layout_ref},_={..._,project_layouts:e}}else{let e={...i.project_layouts};delete e[n];for(let[t,n]of Object.entries(e))n.layout_tree&&(e[t]={...n,layout_tree:c(n.layout_tree),active_session:n.active_session&&s.has(n.active_session)?null:n.active_session});_={..._,layout_tree:h,project_layouts:e,active_session:g.active_session}}return _=q(_,t.buffers,n),{snapshot:_,buffers:r,views:{...e.views,...W(t.views,f,`profile`,i.layout_mode===`project`?`project:${n}`:`profile`)}}}function pt(e){return e.layout_mode===`project`?Object.entries(e.project_layouts).map(([e,t])=>({scope:`project:${e}`,tree:t.layout_tree})):[{scope:`profile`,tree:e.layout_tree}]}function mt(e,t,n){return{...e,layout_mode:t?.layout_mode??`profile`,layout_tree:t?.layout_tree??M(),active_session:t?.active_session??null,project_layouts:Object.fromEntries(Object.entries(t?.project_layouts??{}).map(([e,t])=>[e,{...t,layout_ref:null}])),layout_ref:n??null,session_tabs:[],editor_tabs:[],active_editor_tab:null}}function ht(e,t,n,r,i,a){let o={...t?.project_layouts[n]??{layout_tree:M(),active_session:null},layout_ref:a??null};if(e.layout_mode===`project`)return{...e,project_layouts:{...e.project_layouts,[n]:o}};let s=J({snapshot:e,buffers:[],views:{}},n,r,i??``).source.snapshot,c=[s.layout_tree,o.layout_tree].filter(e=>e!==null).filter(e=>I(e).length>0),l=c.length?L(R(c.length===1?c[0]:N(`row`,c))):M();return{...e,layout_tree:l,active_session:o.active_session??s.active_session,project_layouts:{...e.project_layouts,[n]:o},session_tabs:[],editor_tabs:[],active_editor_tab:null}}function gt(e,t){let n={...e.views};for(let r of t)for(let t of pt(r.snapshot))if(t.tree){for(let i of pt(e.snapshot))if(i.tree)for(let e of F(t.tree))for(let a of F(i.tree)){let o=new Set(a.tabs.map(l)),s=new Set(e.tabs.filter(e=>o.has(l(e))).map(A));s.size&&Object.assign(n,W(r.views,new Map([[e.id,a.id]]),t.scope,i.scope,s))}}return n}var _t=(e,t)=>e.content===t.content&&e.baseMtimeMs===t.baseMtimeMs&&i(e.baseRevision,t.baseRevision),vt=e=>/^\/project\/([0-9a-f]{10})/.exec(e??``)?.[1];function yt(e,t,n){let r=t.entries.flatMap(e=>(e.version?.content.buffers??[]).map(t=>({entry:e,buffer:t}))),i=new Map;for(let{buffer:e}of r){let t=E(e),n=i.get(t)??[];n.some(t=>_t(t,e))||n.push(e),i.set(t,n)}let a=new Map(e.map(e=>[e.identity.id,new Set(r.filter(({buffer:t})=>pt(e.content.snapshot).flatMap(({tree:e})=>e?I(e):[]).some(e=>o(e,t))).map(({buffer:e})=>E(e)))]));for(let n of e){let e=t.entries.find(e=>e.identity.id===n.identity.id);for(let t of a.get(n.identity.id)){let r=i.get(t);if(!r?.length)continue;let a=e?.version?.content.buffers.find(e=>E(e)===t);if(!a&&r.length>1)throw Error(`Windows have different unsaved edits to ${r[0].path}; keep their separate windows or resolve those edits first`);n.content.buffers.push(a??r[0])}}for(let{entry:i,buffer:a}of r){let r=E(a);if(e.some(e=>e.content.buffers.some(e=>E(e)===r&&_t(e,a))))continue;let o=t.request.scope===`project`&&i.identity.kind!==`host`?t.request.projectId:n.get(a.session)??(i.identity.kind===`host`?vt(i.route):i.identity.projectId),s=e.find(e=>e.identity.id===i.identity.id);if(t.request.scope===`project`&&i.identity.kind===`host`&&o!==t.request.projectId&&s){s.content.buffers.push(a);continue}let c=e.find(e=>e.identity.kind===`project`&&e.identity.projectId===o),l=(s?.identity.kind===`host`?c??s:s)??c??e.find(e=>e.identity.kind===`host`),u=l.content.buffers.find(e=>E(e)===r);if(u&&!_t(u,a))throw Error(`Both windows have different unsaved edits to ${a.path}`);u||l.content.buffers.push(a);let d=l.identity.kind===`host`?o??vt(l.route):l.identity.projectId;if(l.content.snapshot.layout_mode===`project`&&(d??=Object.keys(l.content.snapshot.project_layouts)[0],!d))throw Error(`Open a project before recovering these unsaved files into its layout`);l.content.snapshot=q(l.content.snapshot,[a],d),l.identity.kind===`host`&&d&&l.route===`/`&&(l.route=`/project/${d}`)}}function bt(e,t){let{request:n}=e,r=e.entries.find(t=>t.identity.id===e.ownerId);if(r?.identity.kind!==`host`||!r.version)throw Error(`The host layout has not loaded`);let i=[],o=new Map(e.slots.map(e=>[e.identity.id,e])),c=new Set([e.ownerId,...o.keys()]);for(let a of e.entries){if(!c.has(a.identity.id))continue;let e=o.get(a.identity.id),s=n.arrangement.windows.find(t=>t.key===e?.key),l=a.version?.content??{...r.version.content,buffers:[],views:{}},u=a.identity.kind===`host`,d=/^\/project\/([0-9a-f]{10})/.exec(a.route??``)?.[1],f=u&&n.scope===`project`?ht(l.snapshot,s,n.projectId,t,d,n.layoutRef):mt(l.snapshot,s,u?n.layoutRef:void 0),p=a.identity.kind===`host`?n.scope===`project`?n.projectId:s?.project_id:a.identity.projectId,m=n.arrangement.windows.some(e=>e.kind===`project`&&e.project_id===p),h=p&&(!u||!m)?`/project/${p}`:`/`;i.push({identity:a.identity,content:{snapshot:f,buffers:[],views:l.views},route:h})}yt(i,e,t);for(let t of i){let n=e.entries.filter(e=>e.version).sort((e,n)=>Number(e.identity.id===t.identity.id)-Number(n.identity.id===t.identity.id)).map(e=>e.version.content);t.content.views=gt(t.content,n)}return s.parse({changes:e.entries.map(e=>{let t=i.find(t=>t.identity.id===e.identity.id);return t?{id:e.identity.id,content:t.content,route:t.route}:{id:e.identity.id,content:{snapshot:a.parse({}),buffers:[],views:{}},route:e.route??`/`}})})}var xt=class{preference;pending;constructor(e){this.preference=e}request(e){this.pending=e}select(e,t,n,r){return r?this.pending=void 0:e!==this.preference&&(this.pending=e),this.preference=e,n!==void 0&&n===`project`===this.pending&&(this.pending=void 0),t||r?this.pending??(n===void 0?e:n===`project`):e}},St=class{profileId;bridge;content;reportError;onSaved;staged;snapshot=a.parse({});revision=0;generation=0;savedGeneration=0;ready=!1;durable=!1;frozen=!1;checkpointing=!1;loading=null;writing=null;timer;listeners=new Set;constructor(e,t,n,r,i,a=!1){this.profileId=e,this.bridge=t,this.content=n,this.reportError=r,this.onSaved=i,this.staged=a,this.frozen=a}get=()=>this.snapshot;loaded=()=>this.ready;restored=()=>this.durable;locked=()=>this.frozen;subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));notify(){for(let e of this.listeners)e()}load(e){return this.loading||=(async()=>{let t=await this.bridge.read(this.profileId);if(t)this.requireSupported(t.content.snapshot),this.durable=!0,this.revision=t.revision,this.snapshot=t.content.snapshot,this.content.restore(t.content);else{if(this.staged)throw Error(`The prepared window is no longer available`);let t=await e();this.requireSupported(t),this.snapshot=t,this.content.restore({snapshot:this.snapshot,buffers:[],views:{}})}this.ready=!0,this.notify(),t||(this.generation++,await this.flush())})().catch(e=>{throw this.loading=null,e}),this.loading}update(e){if(!this.ready)throw Error(`Window working set has not loaded`);if(this.staged)return;if(this.frozen)throw Error(`Window transfer is pending`);let t={...this.snapshot,...e};this.requireSupported(t),this.snapshot=t,this.changed(),this.notify()}requireSupported(e){if(!this.bridge.huddles&&r(e))throw Error(`Update the desktop app before opening this workspace: it contains huddle tabs`)}changed(){!this.ready||this.staged||(this.generation++,!this.frozen&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.timer=void 0,this.flush().catch(this.reportError)},250)))}flush(){if(clearTimeout(this.timer),this.timer=void 0,this.staged)return Promise.resolve();if(this.writing)return this.writing;let e=this.drain().finally(()=>{this.writing===e&&(this.writing=null)});return this.writing=e,e}async drain(){for(;this.savedGeneration<this.generation;){let e=this.generation,t={snapshot:this.snapshot,...this.content.capture(this.snapshot)},n;try{n=await this.bridge.write({profileId:this.profileId,revision:this.revision,content:t})}catch(e){let r=await this.bridge.read(this.profileId).catch(()=>null);if(!r||r.revision<=this.revision||JSON.stringify(r.content)!==JSON.stringify(t))throw e;n=r}this.revision=n.revision,this.savedGeneration=e,this.onSaved?.(n)}}async freeze(e=`transfer`){if(!this.ready||this.frozen)throw Error(`Window cannot start another transfer`);this.frozen=!0,this.checkpointing=e===`checkpoint`,this.generation++,this.notify();try{return await this.flush(),{revision:this.revision,content:{snapshot:this.snapshot,...this.content.capture(this.snapshot)}}}catch(e){throw this.frozen=!1,this.notify(),e}}resume(){!this.frozen||this.staged||(this.frozen=!1,this.checkpointing=!1,this.changed(),this.notify())}async checkpoint(){if(await this.loading,this.ready){if(this.frozen)throw Error(`A window transfer is still pending`);await this.freeze(`checkpoint`)}}resumeCheckpoint(){this.checkpointing&&this.resume()}matchesCapture(e){if(!this.frozen||this.revision!==e.revision)return!1;let t={snapshot:this.snapshot,buffers:this.content.capture(this.snapshot).buffers};return JSON.stringify(t)===JSON.stringify({snapshot:e.content.snapshot,buffers:e.content.buffers})}sealedCapture(){if(!this.ready||!this.frozen||this.writing)throw Error(`Window is not sealed`);return{revision:this.revision,content:{snapshot:this.snapshot,...this.content.capture(this.snapshot)}}}beginStaging(){if(!this.frozen||this.staged||this.writing)throw Error(`Window cannot stage a transfer`);this.staged=!0}stage(e){if(!this.frozen||!this.staged||this.writing||e.revision!==this.revision)throw Error(`Window state changed before staging`);this.snapshot=e.content.snapshot,this.content.restore(e.content),this.notify()}adopt(e,t,n){if(!this.frozen||this.writing)throw Error(`Window is not ready to adopt a transfer`);if(e.revision<this.revision)throw Error(`Window revision moved backwards`);let r=e=>JSON.stringify([e.session,e.path,e.root??null]),i=new Map(t?.content.buffers.map(e=>[r(e),e])),a=t?this.content.capture(this.snapshot).buffers.filter(e=>JSON.stringify(i.get(r(e)))!==JSON.stringify(e)):[],o=new Map(e.content.buffers.map(e=>[r(e),e]));for(let e of a)o.set(r(e),e);return this.snapshot=a.length?q(e.content.snapshot,a,n):e.content.snapshot,this.revision=e.revision,this.durable=!0,this.content.restore(a.length?{...e.content,snapshot:this.snapshot,buffers:[...o.values()]}:e.content),this.savedGeneration=this.generation,this.frozen=!1,this.staged=!1,this.checkpointing=!1,this.notify(),a.length&&(this.changed(),this.reportError(Error(`An edit finished during the move. Its latest text remains open in this window for review.`))),a.length}};function Ct(e){let t={...e.base,project_layouts:{...e.base.project_layouts}},n=(e,t)=>e?$e([e,t]):t;for(let{identity:r,snapshot:i}of e.detached)if(!(r.kind===`host`||!i.layout_tree))if(t.layout_mode===`project`){let e=t.project_layouts[r.projectId];t.project_layouts[r.projectId]={layout_tree:n(e?.layout_tree??null,i.layout_tree),active_session:e?.active_session??i.active_session,layout_ref:e?.layout_ref??null}}else t.layout_tree=n(t.layout_tree,i.layout_tree);return t}var Y=null,X=null;function wt(e){return Y=e,()=>{Y===e&&(Tt(),Y=null)}}function Tt(){X?.abort(),X=null}function Et(e){if(X)return;if(!Y)throw Error(`Wait for this pane to finish loading before closing it`);let t=new AbortController;X=t,Y(t.signal).catch(e).finally(()=>{X===t&&(X=null)})}async function Dt(e,t,n,r,i,a,o,s,c,l){let d=Promise.resolve(),f=e.onCommand(f=>{d=d.then(async()=>{let d=u.parse(f),p,m,h;try{if(d.kind===`checkpoint`){Tt(),n(!0);let e=(await Promise.allSettled([...t()].map(e=>e.checkpoint()))).find(e=>e.status===`rejected`);if(e?.status===`rejected`)throw e.reason}else if(d.kind===`review-close`)Et(r);else if(d.kind===`plan-layout`){if(!l)throw Error(`Window layout planning is unavailable`);h=await l(d)}else if(d.kind===`seal-layout`||d.kind===`stage-layout`||d.kind===`verify-layout`||d.kind===`finish-layout`){if(!c)throw Error(`This window cannot stage a layout arrangement`);m=await c(d)}else if(d.kind===`activate-tab`){if(!i)throw Error(`This window cannot activate the requested tab`);await i(d)}else if(d.kind===`resume`){for(let e of t())e.resume();n(!1)}else if(d.kind===`navigate-project`||d.kind===`open-project`){if(!s)throw Error(`Project window navigation is unavailable`);s(d)}else if(d.kind===`move-pane`||d.kind===`move-tab`||d.kind===`move-project`){if(!o)throw Error(`This window cannot move the requested pane`);o(d)}else{if(!a)throw Error(`This window cannot receive a transfer`);m=await a(d)}}catch(e){p=(e instanceof Error?e.message:`Could not save this window`).slice(0,2048)}await e.reply({id:d.id,...p?{error:p}:{},...m?{version:m}:{},...h?{arrangement:h}:{}})}).catch(r)});try{await e.ready()}catch(e){throw f(),e}return f}function Ot(e,t,n,r){return At(e,t,n,{kind:`pane`,placement:r})}function kt(e,t,n,r){return At(e,t,n,{kind:`tab`,placement:r})}function At(e,t,n,r){let{placement:i}=r,a=t.snapshot.layout_tree;if(a?.kind!==`leaf`||t.snapshot.layout_mode===`project`||Object.keys(t.snapshot.project_layouts).length!==0)throw Error(`Only an isolated pane can be docked`);if(r.kind===`tab`&&a.tabs.length!==1)throw Error(`A tab drop requires exactly one tab`);let o=dt(e,t),s=e.snapshot,c=s.layout_mode===`project`?U(s,n):s,l=c.layout_tree??H(c),u=i?.paneId??F(l).at(-1).id;if(!P(l,u))throw Error(`The destination pane has changed`);let d=new Set,f=e=>{e&&(d.add(e.id),e.kind===`split`&&e.children.forEach(f))};if(f(l),s.layout_mode===`project`)for(let e of Object.values(s.project_layouts))f(e.layout_tree);let p=r.kind===`tab`&&r.placement.edge===`center`,m=p?u:a.id;if(!p)for(;d.has(m);)m=crypto.randomUUID();let h={...a,id:m},g=new Set(a.tabs.flatMap(e=>e.type===`terminal`?[e.session]:[])),_=e=>V(e,e=>e.type!==`terminal`||!g.has(e.session)),v=e=>e.kind===`leaf`?e.id===m?e:_(e):{...e,children:e.children.map(v)},y=V(v(p?Ne(l,{ref:a.tabs[0],fromLeafId:``,toLeafId:u,edge:`center`,index:r.placement?.index,copy:!0}):Me(l,h,u,i?.edge===`center`?`right`:i?.edge??`right`)),()=>!0),b=t.snapshot.active_session&&g.has(t.snapshot.active_session)?t.snapshot.active_session:null,x;if(s.layout_mode===`project`){let e={...s.project_layouts};for(let[t,r]of Object.entries(e))t===n||!r.layout_tree||I(r.layout_tree).some(e=>e.type===`terminal`&&g.has(e.session))&&(e[t]={...r,layout_tree:_(r.layout_tree),active_session:r.active_session&&g.has(r.active_session)?null:r.active_session});e[n]={...e[n]??{layout_ref:null},layout_tree:y,active_session:b},x={...s,project_layouts:e}}else x={...s,layout_tree:y,active_session:b};return{snapshot:x,buffers:o,views:{...e.views,...W(t.views,new Map([[a.id,m]]),`profile`,s.layout_mode===`project`?`project:${n}`:`profile`,r.kind===`tab`?new Set(a.tabs.map(A)):void 0)}}}var jt=class{environment;pending=null;constructor(e){this.environment=e}async command(e){if(e.kind===`plan-pane`||e.kind===`plan-tab`||e.kind===`plan-project`)return this.plan(e);let t=this.pending;if(!t){if(e.kind===`cancel-window`)return;throw Error(`The destination plan is unavailable`)}if(e.transferId!==t.id||e.profileId!==t.profileId)throw Error(`The destination belongs to another transfer`);if(e.kind===`cancel-window`){t.staged&&this.environment.suspend(!0);let e=t.owner.adopt(t.original,t.staged??t.original,t.projectId);this.environment.navigate(t.route),this.environment.staging(),this.pending=null,this.environment.suspend(!1),this.environment.fence(!1),e&&await t.owner.flush();return}if(this.environment.activeProfile()!==t.profileId||!t.owner.matchesCapture(t.original))throw Error(`The destination changed while preparing the move`);if(t.owner.beginStaging(),this.environment.suspend(!0),await Promise.resolve(),!t.owner.matchesCapture(t.original))throw Error(`The destination changed while releasing its views`);let n=await this.environment.read(t.profileId);if(!n||JSON.stringify(n)!==JSON.stringify(t.planned))throw Error(`The prepared destination has changed`);t.owner.stage(n),t.staged=n,this.environment.staging(t.id),this.environment.navigate(t.destinationRoute),this.environment.suspend(!1)}async plan(e){if(this.pending)throw Error(`This window is already receiving a transfer`);if(this.environment.activeProfile()!==e.profileId)throw Error(`Select the same profile in the destination window before docking`);let t=await this.environment.owner(e.profileId);if(this.environment.activeProfile()!==e.profileId)throw Error(`The destination profile changed`);this.environment.fence(!0);let n;try{n=await t.freeze();let r=c.parse({revision:n.revision,content:e.kind===`plan-project`?ft(n.content,e.content,e.projectId):e.kind===`plan-pane`?Ot(n.content,e.content,e.projectId,e.placement):kt(n.content,e.content,e.projectId,e.placement)});return this.pending={id:e.transferId,profileId:e.profileId,projectId:e.projectId,owner:t,original:n,planned:r,route:this.environment.route(),destinationRoute:e.kind===`plan-project`?e.route??`/project/${e.projectId}`:`/project/${e.projectId}`},r}catch(e){throw n&&t.resume(),t.locked()||this.environment.fence(!1),e}}async committed(e,t){let n=this.pending;if(!n||n.id!==e)return!1;if(!n.staged)throw Error(`Destination has not mounted its prepared state`);let r=n.owner.adopt(t,n.staged,n.projectId);return this.pending=null,this.environment.staging(),this.environment.fence(!1),r&&await n.owner.flush(),!0}},Mt=(e,t)=>JSON.stringify(e)===JSON.stringify(t),Nt=e=>/^\/project\/([0-9a-f]{10})/.exec(e)?.[1],Pt=class{environment;mountTimeoutMs;pending=null;finished=null;constructor(e,t=8e3){this.environment=e,this.mountTimeoutMs=t}async command(e){if(this.finished?.id===e.arrangementId){if(e.kind===`finish-layout`&&e.profileId===this.finished.profileId&&e.outcome===this.finished.outcome)return;throw Error(`This layout arrangement has already finished`)}if(this.pending&&(this.pending.id!==e.arrangementId||this.pending.profileId!==e.profileId))throw Error(`This window belongs to another layout arrangement`);if(e.kind===`seal-layout`)return this.seal(e);if(e.kind===`stage-layout`)return this.stage(e);let t=this.pending;if(!t&&e.kind===`finish-layout`&&e.outcome===`cancelled`&&this.environment.initialArrangement()===e.arrangementId){let n=await this.environment.owner(e.profileId);t=this.pending={id:e.arrangementId,profileId:e.profileId,owner:n,originalRoute:this.environment.route(),mounted:!1,verified:!1}}if(!t&&e.kind===`finish-layout`&&e.outcome===`cancelled`&&!this.environment.initialArrangement()){if(this.checkProfile(e.profileId),(await this.environment.owner(e.profileId)).locked())throw Error(`Another operation still owns this window`);this.finished={id:e.arrangementId,profileId:e.profileId,outcome:`cancelled`},this.environment.fence(!1);return}if(!t)throw Error(`The window layout plan is unavailable`);if(e.kind===`finish-layout`)return this.finish(t,e.outcome);if(t.planned&&!t.mounted)throw Error(`The window has not mounted its prepared layout`);let n=t.planned??t.original;if(!n)throw Error(`The window layout capture is unavailable`);if(this.checkProfile(t.profileId),this.environment.route()!==(t.destinationRoute??t.originalRoute))throw Error(`The window route changed while applying its layout`);if(this.environment.suspend(!0),await Promise.resolve(),!t.owner.matchesCapture(n))throw Error(`The prepared layout changed while releasing its views`);return t.verified=!0,n}checkProfile(e){if(this.environment.activeProfile()!==e)throw Error(`The window profile changed while applying its layout`)}async seal(e){if(this.checkProfile(e.profileId),this.pending){if(!this.pending.original||this.pending.planned||!this.pending.owner.matchesCapture(this.pending.original))throw Error(`The window has changed since layout capture`);return this.pending.original}if(this.environment.initialArrangement())throw Error(`A prepared window cannot start another layout`);let t=await this.environment.owner(e.profileId);this.checkProfile(e.profileId),this.environment.fence(!0);try{let n=await t.freeze();if(this.pending={id:e.arrangementId,profileId:e.profileId,owner:t,original:n,originalRoute:this.environment.route(),mounted:!1,verified:!1},t.beginStaging(),this.environment.suspend(!0),await Promise.resolve(),!t.matchesCapture(n))throw Error(`The window changed while releasing its views`);return n}catch(e){throw t.locked()||this.environment.fence(!1),e}}async stage(e){this.checkProfile(e.profileId);let t=this.pending;if(!t){if(this.environment.initialArrangement()!==e.arrangementId)throw Error(`The window was not prepared for this layout`);let n=await this.environment.owner(e.profileId);this.checkProfile(e.profileId),t=this.pending={id:e.arrangementId,profileId:e.profileId,owner:n,originalRoute:this.environment.route(),mounted:!1,verified:!1}}if(t.planned){if(!Mt(t.planned,e.version)||t.destinationRoute!==e.route)throw Error(`The prepared window layout changed`);if(!t.mounted)throw Error(`The prepared window did not finish mounting`);return t.planned}if(this.environment.fence(!0),this.environment.suspend(!0),await Promise.resolve(),!t.owner.matchesCapture(t.original??e.version))throw Error(`The window changed before staging its layout`);let n=await this.environment.read(e.profileId);if(this.checkProfile(e.profileId),!n||!Mt(n,e.version))throw Error(`The durable prepared window layout changed`);t.owner.stage(n),t.planned=n,t.verified=!1,t.destinationRoute=e.route,this.environment.staging(t.id),this.environment.navigate(e.route);let r=new Promise((e,n)=>{let r=setTimeout(()=>{t.ready=void 0,n(Error(`The prepared window did not finish mounting`))},this.mountTimeoutMs);t.ready=()=>{clearTimeout(r),e()}});try{return this.environment.suspend(!1),await r,this.checkProfile(e.profileId),n}catch(e){throw t.ready?.(),t.ready=void 0,this.environment.suspend(!0),e}}mounted(e){let t=this.pending;!t?.planned||t.profileId!==e||this.environment.activeProfile()!==e||t.destinationRoute!==this.environment.route()||!t.ready||(t.mounted=!0,t.ready(),t.ready=void 0)}async finish(e,t){if(t===`committed`&&this.checkProfile(e.profileId),t===`committed`&&(!e.verified||!e.planned))throw Error(`The layout must be verified before accepting its commit`);if(this.environment.suspend(!0),await Promise.resolve(),t===`cancelled`&&!e.original){let t=await this.environment.read(e.profileId),n=e.planned&&e.owner.matchesCapture(e.planned),r=e.owner.sealedCapture();if(!n){let n=new Set(r.content.buffers.map(E));for(let e of t?.content.buffers??[])n.has(E(e))||(r.content.buffers.push(e),n.add(E(e)));r.content.snapshot=q(r.content.snapshot,r.content.buffers,Nt(this.environment.route())),e.owner.stage(r)}return e.planned=r,e.destinationRoute=this.environment.route(),e.mounted=!0,e.verified=!1,e.planned}let n=t===`committed`?{...e.planned,revision:e.planned.revision+1}:e.original,r=await this.environment.read(e.profileId);if(!r||!Mt(r,n))throw Error(`The durable layout outcome has not been confirmed`);let i=t===`committed`?e.destinationRoute:e.originalRoute,a=e.owner.adopt(r,e.planned??e.original,Nt(i));this.environment.navigate(i),this.environment.staging(),this.finished={id:e.id,profileId:e.profileId,outcome:t},this.pending=null,this.environment.suspend(!1),this.environment.fence(!1),a&&await e.owner.flush()}};async function Ft(e,t,n,r,i,a,o,s){await Z(e,{...t,preparePane:e=>n.prepare(e)},r,e=>J(e,r,i,a),s,o)}async function It(e,t,n,r,i,a){if(!t.prepareProjectDock)throw Error(`Project docking is unavailable`);i(!0);let o,s=!1;try{o=await e.freeze(),e.beginStaging(),a(!0),await Promise.resolve(),e.adopt(o,o,n),s=!0,await Z(e,{...t,preparePane:e=>t.prepareProjectDock({...e,destinationId:r})},n,e=>({destination:e,source:{snapshot:{...e.snapshot,layout_mode:`profile`,layout_tree:M(),project_layouts:{},session_tabs:[],editor_tabs:[],active_session:null,active_editor_tab:null,layout_ref:null},buffers:[],views:{}}}),i)}catch(t){throw!s&&o&&e.adopt(o,o,n),e.locked()||(a(!1),i(!1)),t}}async function Lt(e,t,n,r,i){await Z(e,t,n,e=>lt(e,n,r),i)}function Rt(e,t,n,r,i,a,o){return Z(e,t,n,e=>ut(e,n,r,a),i,o).then(()=>void 0)}async function zt(e,t,n,r,i,a,o,s,c){if(!t.prepareDock||!t.retire)throw Error(`Pane docking is unavailable`);await Vt(e,t,await Z(e,{...t,preparePane:e=>t.prepareDock({...e,destinationId:i,placement:s,destinationProjectId:c})},n,e=>lt(e,n,r),a),n,a,o)}async function Bt(e,t,n,r,i,a,o,s,c,l){if(!t.prepareTabDock)throw Error(`Tab window transfers are unavailable`);let u=await Z(e,{...t,preparePane:e=>t.prepareTabDock({...e,...i})},n,e=>ut(e,n,r,c),a,l);s&&await Vt(e,t,u,n,a,o)}async function Vt(e,t,n,r,i,a){if(!t.retire)return;i(!0);let o;try{let i=await e.freeze();o=i,e.beginStaging(),a(!0),await Promise.resolve(),e.adopt(i,i,r);let s=await e.freeze();o=s;let c=s.content.snapshot,l=c.layout_mode===`project`?Object.values(c.project_layouts).map(e=>e.layout_tree):[c.layout_tree];if(s.content.buffers.length||l.some(e=>e&&I(e).length)){e.adopt(s),s.content.buffers.length&&(e.update(q(c,s.content.buffers,r)),await e.flush());return}await t.retire({...n,revision:s.revision})}catch(t){throw o&&e.locked()?e.adopt(o,o,r):e.resume(),t}finally{e.locked()||(a(!1),i(!1))}}async function Z(e,t,n,r,i,a){if(!e.loaded()||e.locked())throw Error(`The workspace is not ready to detach`);let o={id:crypto.randomUUID(),profileId:e.profileId},s,c=async t=>{e.adopt(t,s,n)&&await e.flush()};i(!0);try{s=await e.freeze();let i=r(s.content);if(await t.preparePane({...o,projectId:n,revision:s.revision,...i,...a?{sourceRoute:a}:{}}),!e.matchesCapture(s))throw Error(`The pane changed while opening its window; please try again`);await c(await t.commit(o))}catch(n){if(!e.locked())throw n;let r=await t.observe(o).catch(()=>null);if(r?.status===`committed`&&r.version)return await c(r.version),o;if(r?.status===`prepared`){let e=await t.cancel(o);if(e.status===`committed`&&e.version)return await c(e.version),o;if(e.status!==`cancelled`)throw Error(`Could not confirm cancellation; the pane has been kept in place`,{cause:n})}else if(!r)throw Error(`Could not confirm the transfer outcome; reload this window to recover its saved state`,{cause:n});throw e.resume(),n}finally{e.locked()||i(!1)}return o}var Ht=e({arrangementParticipant:()=>qt,desktopProjectLayoutMode:()=>Xt,desktopWorkingSet:()=>$,destinationTransfer:()=>Jt,registerDesktopWindowLifecycle:()=>Yt,requestDesktopProjectLayoutMode:()=>Zt,useDesktopUiState:()=>Qt}),Q=new Map,Ut=new Map,Wt=a.parse({}),Gt=()=>()=>void 0,Kt=async e=>{let t=$(e);if(!t)throw Error(`Window working set is unavailable`);return await t.load(async()=>(await se(e))?.ui_state??Wt),t},qt=new Pt({activeProfile:_,owner:Kt,read:e=>m().windows.read(e),initialArrangement:()=>h()?.stagingArrangement,fence:p,suspend:g,staging:e=>{let t=h();t&&(e?t.stagingArrangement=e:delete t.stagingArrangement)},route:()=>window.location.pathname,navigate:e=>window.history.replaceState(null,``,e)}),Jt=new jt({activeProfile:_,owner:Kt,read:e=>m().windows.read(e),fence:p,suspend:g,staging:e=>{let t=h();t&&(e?t.stagingTransfer=e:delete t.stagingTransfer)},route:()=>window.location.pathname,navigate:e=>window.history.replaceState(null,``,e)});async function Yt(){let e=m()?.windows?.lifecycle;e&&await Dt(e,()=>[...Q.values()].map(e=>({checkpoint:()=>e.checkpoint(),resume:()=>e.resumeCheckpoint()})),e=>p(e||[...Q.values()].some(e=>e.locked())),w,async({profileId:e,ref:t})=>{let n=$(e);if(!n)throw Error(`Window working set is unavailable`);await n.load(async()=>{throw Error(`Window working set is unavailable`)});let r=n.get().layout_tree,i=l(t),a=r&&F(r).find(e=>e.tabs.some(e=>l(e)===i)),o=a?.tabs.find(e=>l(e)===i);if(!r||!a||!o)throw Error(`The tab is no longer in this window`);n.update({layout_tree:Ye(r,a.id,A(o))})},e=>Jt.command(e),e=>{let t=h(),n=$(e.profileId),r=m()?.windows?.transfers;if(!t||e.kind===`move-pane`&&(t.identity.kind!==`pane`||t.identity.projectId!==e.projectId)||e.kind===`move-project`&&(t.identity.kind!==`project`||t.identity.projectId!==e.projectId)||t.identity.kind!==`host`&&t.identity.profileId!==e.profileId||_()!==e.profileId||!n?.loaded()||n.locked()||!r)throw Error(`The dragged pane is no longer available`);let i=window.location.pathname.split(`/session/`)[0];if(e.kind===`move-project`){It(n,r,e.projectId,e.destinationId,p,g).catch(w);return}(e.kind===`move-tab`?Bt(n,r,e.projectId,e.ref,{destinationId:e.destinationId,destinationProjectId:e.destinationProjectId,placement:e.placement},p,g,t.identity.kind===`pane`,e.paneId,i):zt(n,r,e.projectId,e.paneId,e.destinationId,p,g,e.placement,e.destinationProjectId)).then(()=>{e.kind===`move-tab`&&window.location.pathname!==i&&(window.history.replaceState(null,``,i),window.dispatchEvent(new PopStateEvent(`popstate`)))}).catch(w)},e=>{f(async()=>{let{handleProjectCommand:e}=await import(`./project-actions-Ck504AFM.js`).then(e=>e.i);return{handleProjectCommand:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(({handleProjectCommand:t})=>t(e)).catch(w)},e=>qt.command(e),async e=>{if(h()?.identity.id!==e.ownerId||_()!==e.request.profileId)throw Error(`The layout owner changed`);let t=await ce(ye);if(_()!==e.request.profileId)throw Error(`The layout profile changed`);return bt(e,new Map(t.map(e=>[e.id,e.project_id])))})}function $(e){let t=m()?.windows;if(!t||!h())return null;let n=Q.get(e);if(!n){let r=me(e),i=he(t=>{ie(e,Ct(t)).catch(w)},2e3);n=new St(e,t,r,w,e=>{e.seed&&i(e.seed)},h()?.stagingTransfer!==void 0||h()?.stagingArrangement!==void 0);let a=n;r.subscribe(()=>a.changed()),Q.set(e,n),Ut.set(e,new xt(d().projectBasedLayout))}return n}function Xt(e){let t=_(),n=h(),r=t?Q.get(t):void 0;return!t||n?.identity.kind!==`host`||!r?null:Ut.get(t).select(e,r.restored(),r.get().layout_mode,n.stagingArrangement!==void 0)}function Zt(e){let t=_();t&&h()?.identity.kind===`host`&&Ut.get(t)?.request(e)}function Qt(e){let t=(0,O.useMemo)(()=>e?$(e):null,[e]),n=(0,O.useSyncExternalStore)(t?.subscribe??Gt,t?.get??(()=>Wt)),r=(0,O.useSyncExternalStore)(t?.subscribe??Gt,t?.loaded??(()=>!1)),[i,a]=(0,O.useState)(null);if((0,O.useEffect)(()=>{if(!t||!e)return;let n=!0;return t.load(async()=>{if(h()?.identity.kind!==`host`)throw Error(`This detached workspace could not be restored`);return(await se(e))?.ui_state??Wt}).catch(e=>{n&&a(e instanceof Error?e:Error(`Could not restore this workspace`))}),()=>{n=!1,t.flush().catch(w)}},[t,e]),i)throw i;return t?{loaded:r,snapshot:n,current:t.get,update:e=>t.update(e)}:null}export{je as A,Ve as B,Le as C,H as D,Qe as E,Se as F,Ke as G,V as H,Ge as I,Je as J,ze as K,M as L,P as M,I as N,Fe as O,Ye as P,N as R,st as S,F as T,We as U,B as V,Xe as W,Re as X,A as Y,ye as Z,ot as _,Zt as a,rt as b,zt as c,It as d,Rt as f,ft as g,J as h,Jt as i,Ne as j,L as k,Lt as l,wt as m,Xt as n,Qt as o,Tt as p,He as q,$ as r,Ht as s,qt as t,Ft as u,at as v,Ie as w,it as x,nt as y,R as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{n}from"./local-store-Dy1Cd8sn.js";import{o as r,t as i}from"./profile-store-D4lZiXgL.js";import{t as a}from"./content-state-CROLtMfN.js";var o=e(t(),1),s=(0,o.createContext)(``);function c(e,t){let r=(0,o.useContext)(s);return n(JSON.stringify([r,e,t]))}var l=class{limit;namespace;persistBrowser;entries=new Map;browserLoaded=!1;browserWrite=null;constructor(e=500,t,n=!1){this.limit=e,this.namespace=t,this.persistBrowser=n}loadBrowser(){if(!(!this.persistBrowser||!this.namespace||this.browserLoaded)){this.browserLoaded=!0;try{let e=sessionStorage.getItem(`puddle.views.${this.namespace}`);if(e&&e.length<=1024*1024&&new TextEncoder().encode(e).length<=1024*1024){let t=JSON.parse(e);if(Array.isArray(t)&&t.length<=this.limit)for(let e of t)Array.isArray(e)&&e.length===2&&typeof e[0]==`string`&&e[0].length<=1024&&this.entries.set(e[0],e[1])}}catch{}typeof window<`u`&&window.addEventListener(`pagehide`,this.flushBrowser)}}flushBrowser=()=>{if(this.browserWrite!==null&&clearTimeout(this.browserWrite),this.browserWrite=null,!(!this.persistBrowser||!this.namespace))try{let e=JSON.stringify([...this.entries]);e.length<=1024*1024&&new TextEncoder().encode(e).length<=1024*1024&&sessionStorage.setItem(`puddle.views.${this.namespace}`,e)}catch{}};desktopState(){if(!this.namespace||!r())return null;let e=i();return e?a(e):null}trim(){for(;this.entries.size>this.limit;){let e=this.entries.keys().next().value;if(e===void 0)break;this.entries.delete(e)}}get(e){let t=this.desktopState();t||this.loadBrowser();let n=t?t.view(`${this.namespace}:${e}`):this.entries.get(e);return n!==void 0&&(this.entries.delete(e),this.entries.set(e,n),this.trim()),n}set(e,t){let n=this.desktopState();n||this.loadBrowser(),n?.setView(`${this.namespace}:${e}`,t),this.entries.delete(e),this.entries.set(e,t),this.trim(),!n&&this.persistBrowser&&this.browserWrite===null&&(this.browserWrite=setTimeout(this.flushBrowser,250))}copyKeys(e){let t=this.desktopState();t||this.loadBrowser();let n=`${this.namespace}:`,r=t?Object.entries(t.viewSnapshot()).filter(([e])=>e.startsWith(n)).map(([e,t])=>[e.slice(n.length),t]):[...this.entries];for(let[t,n]of r){let r=e(t);r&&r!==t&&this.set(r,n)}}};export{s as n,c as r,l as t};
|