@puddle-code/cli 0.0.22 → 0.0.23
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 +9 -36
- package/dist/index.js +1 -1
- package/dist/public/assets/{Dashboard-eGkW6-ZH.js → Dashboard-BN-mJLVe.js} +1 -1
- package/dist/public/assets/{EditorTabClose-ftyAn3hj.js → EditorTabClose-Ch3KtVBC.js} +1 -1
- package/dist/public/assets/{LazyTerminal-C0RZlCLg.js → LazyTerminal-_RNVHVuB.js} +2 -2
- package/dist/public/assets/{ModelRefcount-D-jr9qZk.js → ModelRefcount-d9iL6qbu.js} +1 -1
- package/dist/public/assets/{PaneEditorBody-DcKD_h3y.js → PaneEditorBody-QjXo23Lb.js} +1 -1
- package/dist/public/assets/{SettingsDialog-DnKM8XfN.js → SettingsDialog-Clw3WvNE.js} +1 -1
- package/dist/public/assets/{Terminal-caEYfoyF.js → Terminal-DhuY0ChG.js} +1 -1
- package/dist/public/assets/{Workspace-CLlQSOdM.js → Workspace-pgfe3zDB.js} +4 -4
- package/dist/public/assets/{buffer-store-CcaCClCj.js → buffer-store-DNAdK8WD.js} +2 -2
- package/dist/public/assets/{context-menu-B72__pRf.js → context-menu-Cbaq_jIb.js} +1 -1
- package/dist/public/assets/{cssMode-C2T_OhZu.js → cssMode-Ceo-NiFG.js} +1 -1
- package/dist/public/assets/{editor-sync-BFRyMqUU.js → editor-sync-CMMUUNfm.js} +1 -1
- package/dist/public/assets/{htmlMode-D7FIn_wE.js → htmlMode-BNgFwN9y.js} +1 -1
- package/dist/public/assets/{index-XKVW8P77.js → index-nIiWlIeN.js} +3 -3
- package/dist/public/assets/{jsonMode-Cm_XrMpQ.js → jsonMode-BgafF0C5.js} +1 -1
- package/dist/public/assets/{session-seed-DAf7EH_e.js → session-seed-BtCwWXkL.js} +1 -1
- package/dist/public/assets/ssh-mode-BwRmcmxJ.js +1 -0
- package/dist/public/assets/{tsMode-CLCblX8J.js → tsMode-DHMAQIBN.js} +1 -1
- package/dist/public/index.html +2 -2
- package/package.json +1 -1
- package/dist/public/assets/ssh-mode-B0WDpTq0.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,44 +7,17 @@ Past releases: see docs/changelogs/.
|
|
|
7
7
|
|
|
8
8
|
# Changelog
|
|
9
9
|
|
|
10
|
-
## [0.0.
|
|
10
|
+
## [0.0.23] — 2026-08-03
|
|
11
11
|
|
|
12
|
-
###
|
|
12
|
+
### Fixed
|
|
13
13
|
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
|
|
17
|
-
-
|
|
18
|
-
- Projects carry a customisable ≤5-character abbreviation (protocol 12.1) — the collapsed sidebar rail's label. Set it at creation (prefilled from the name), edit it with the name in the homescreen card's Edit dialogue, or single-click the active project's label in the sidebar to edit in place: the abbreviation on the collapsed rail, the full name on the expanded header. Clicking any other project still navigates.
|
|
19
|
-
- Single-clicking the already-selected file in the file tree starts an inline rename (Finder-style, after a beat so double-click still opens); F2 keeps working.
|
|
20
|
-
- Sessions archive by drag: drop a session — a sidebar row, a rail dot, or a centre terminal tab chip — onto the sidebar's Archived header, or onto the new archive icon at the collapsed rail's foot (clicking it expands the sidebar). The header appears during a drag even when nothing is archived yet.
|
|
21
|
-
- Saved layouts (protocol 12.2): a top-bar **Layouts** popover (between Settings and the Scratchpad, ⌥⌘L) saves and loads named snapshots of the tiling layout. The head shows the live layout — the saved name it derives from (`ui_state.layout_ref`) or "Unnamed layout", plus an honest Saved / Unsaved changes state that ignores tab focus — with Save (overwrite in place) and Save as new; the list below is the whole profile's saved catalogue (project rows labelled with their project's name), with inline rename, delete, and load, and an inline confirm before a load discards unsaved changes — computed against exactly the state the load replaces. Under project-based layout every project keeps its own current layout (each with its own name and saved/unsaved status): loading another project's layout lands in that project's slice and leaves the visible one untouched. Loading works from the dashboard too — the popover writes the persisted layout state directly and the next workspace open restores it. Layouts are profile- or project-scoped per the project-based-layout setting at save time; loading across scopes flips the setting with the union/shard conversion suppressed, and a shard never overwrites a stored per-project slice (existing slices win; shards fill only the gaps), so nothing is erased. New endpoint group `GET/POST/PATCH/DELETE /api/layouts` + `layouts` table (migration 019).
|
|
22
|
-
- The Layouts list filters by project (chips: Profile-wide plus one per project owning a layout, narrowing only), and an unnamed live layout can be saved into an existing compatible saved layout — adopting its name — behind an inline overwrite confirm.
|
|
23
|
-
- Tooltips on the top bar's Scratchpad and Profile buttons (Settings already had one; the new Layouts button ships with one).
|
|
24
|
-
- The parent-directory browse tree is now the full file tree (protocol 12.3): right-clicking above the worktree offers New File/Folder, Rename, Delete, cut/copy/paste, drag-move, drag-in upload, and Download, because the fs mutation and upload routes accept the same `?root=` override the read routes already took. Git decorations and "Open Terminal in Directory" stay worktree-only (both are worktree-scoped on the daemon), and against a daemon older than 12.3 the tree goes read-only rather than resolving those paths against the wrong directory. The browse tree also highlights the row of the active external editor tab, and the header's Refresh · Collapse Folders now drive it.
|
|
25
|
-
- The new agent / new terminal dialogue can retarget its project: the project name in the description is a dim inline dropdown (seeded from the current project, or the one whose sidebar header was right-clicked), and switching it re-seeds the branch fields against the new repository. With one project it stays plain text.
|
|
14
|
+
- Opening a project no longer blanks the page. The workspace called the
|
|
15
|
+
archive-by-drag mutation hook _after_ its loading gate returned early, so the
|
|
16
|
+
moment the gate flipped (ui state loaded, chunks warm) the hook count changed
|
|
17
|
+
mid-life and React tore the tree down with error #310. Regression in v0.0.22.
|
|
26
18
|
|
|
27
19
|
### Changed
|
|
28
20
|
|
|
29
|
-
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
- "Sync locally" is enabled by default (every group) for profiles with no stored entry; the toggle still turns it off.
|
|
33
|
-
- The Density setting does something: compact (the default) tightens vertical spacing in both sidebars — session rows, rail dots, file-tree rows — and the collapsed rail's session glyphs grew to fill their containers; comfortable keeps the previous roomier spacing.
|
|
34
|
-
- Numeric settings inputs commit on blur or Enter instead of every keystroke, so a font size can be cleared and retyped without applying mid-edit; empty or invalid input reverts.
|
|
35
|
-
- Rename gestures settled: files rename on a second single click within ~1.5 s (Finder-style; double-click still pins), while FOLDERS and the sidebar's project name/abbreviation rename on a plain double-click — folder single clicks always toggle, and a label's first click navigates as usual.
|
|
36
|
-
- The new-project "browse…" picker treats the path input as its single source of truth: navigating writes the browsed directory into the field (the picker's own path line is gone), and "choose" fills the project name from the directory's basename and closes the picker.
|
|
37
|
-
- The "All projects in the sidebar" setting became "Project-based layout" (its inverse; a stored choice migrates). The sidebar's Archived disclosure now follows the same scoping: every project's archived sessions in the default profile-based layout, only the current project's under project-based layout.
|
|
38
|
-
- Protocol major bumped to 12.0 (no schema change beyond 11.2's additive keys, on purpose): every connected daemon auto-upgrades at the next `puddle launch` handshake, so all deployments parse the project-based-layout snapshot keys instead of merely round-tripping them, and none linger on early 11.x.
|
|
39
|
-
|
|
40
|
-
### Removed
|
|
41
|
-
|
|
42
|
-
- The "browser-reserved" warnings in Settings → Hotkeys (the ⌘W/⌘T/… flagging and the intro's caveat): any combo is bindable without commentary; the conflict warning between two app shortcuts remains.
|
|
43
|
-
|
|
44
|
-
### Fixed
|
|
45
|
-
|
|
46
|
-
- Clicking anywhere on the browse tree's path line walks up a directory, instead of only the small corner icon; the line ends where the return-to-worktree button begins.
|
|
47
|
-
- Rebinding a shortcut is reflected in the copy that names it: the top bar's command field, an empty pane's palette button, the empty session list and empty dashboard all show the live command-palette binding instead of a hard-coded ⌘K, and the two draft-save prompts show the live Save binding instead of ⌘S.
|
|
48
|
-
- A file tab's hover controls no longer square off its top-right corner — their background carries the chip's own rounding.
|
|
49
|
-
- `~` paths autocomplete properly everywhere (project picker, account import path, any directory field): the daemon's tilde expansion dropped the trailing slash, so `~/` completed home's own name inside its parent instead of listing home, and any deeper `~/…/` prefix suggested nothing.
|
|
50
|
-
- Optional form fields no longer sit empty and get silently reinterpreted on submit: the profile-creation branch prefix, the new-session base branch, and the tab-title template are prefilled with the default they would have become (clearing the profile branch prefix now honestly means no prefix). Placeholders that lied were corrected — the settings branch prefix says "no prefix", the host display name shows the real hostname fallback, the editor SSH-host field shows the tunnelled host already in effect — and clearing a numeric host setting no longer PATCHes a rejected 0. The settings "Repositories" tab is now "Projects" (old #settings/repositories links still resolve).
|
|
21
|
+
- Lint enforces the Rules of Hooks (`react-hooks/rules-of-hooks`) across every
|
|
22
|
+
package's React source, so a hook after an early return fails CI instead of
|
|
23
|
+
shipping.
|
package/dist/index.js
CHANGED
|
@@ -4184,7 +4184,7 @@ import { readFileSync } from "node:fs";
|
|
|
4184
4184
|
import { dirname, join as join2 } from "node:path";
|
|
4185
4185
|
import { fileURLToPath } from "node:url";
|
|
4186
4186
|
function cliVersion() {
|
|
4187
|
-
if (true) return "0.0.
|
|
4187
|
+
if (true) return "0.0.23";
|
|
4188
4188
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
4189
4189
|
for (const candidate of [
|
|
4190
4190
|
join2(here, "..", "..", "package.json"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{f as r,g as i}from"./hotkeys-aKIAG8uQ.js";import{a}from"./api-B3lAdmrV.js";import{a as o,g as s,i as c,n as l,o as u,t as d}from"./dialog-B43iKmfK.js";import{H as f,K as p,U as m,Y as h,a as g,at as _,ct as v,et as y,o as b,r as x,st as S,t as C}from"./LazyTerminal-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{f as r,g as i}from"./hotkeys-aKIAG8uQ.js";import{a}from"./api-B3lAdmrV.js";import{a as o,g as s,i as c,n as l,o as u,t as d}from"./dialog-B43iKmfK.js";import{H as f,K as p,U as m,Y as h,a as g,at as _,ct as v,et as y,o as b,r as x,st as S,t as C}from"./LazyTerminal-_RNVHVuB.js";import{t as w}from"./utils-B6KiDbIe.js";import{A as T,O as E,c as D,j as O,k,n as A,r as j,t as M}from"./context-menu-Cbaq_jIb.js";import{r as N}from"./dist-i-QevsUb.js";import{$ as P,Mt as F,nt as I,pt as L,rt as R,tt as z,yt as B}from"./index-nIiWlIeN.js";var V=e(t(),1),H=n(),U=!1;function W(){let[e,t]=(0,V.useState)(U),[n,r]=(0,V.useState)(null);(0,V.useEffect)(()=>{if(!e)return;let t=!1;return R.spawnShell(a).then(e=>{t||r(e)}),()=>{t=!0}},[e]);let i=()=>{U=!1,t(!1),r(null)};return{open:e,term:n,toggle:()=>{e?(n&&R.killShell(a,n),i()):(U=!0,t(!0))},onExit:i}}function G({term:e,onExit:t}){return(0,H.jsx)(`div`,{className:`h-72 shrink-0 pb-6`,children:(0,H.jsx)(`div`,{className:`mx-auto size-full max-w-4xl px-6`,children:e!==null&&(0,H.jsx)(C,{stream:`home`,term:e,onExit:t})})})}var K=[{status:`running`,colour:`bg-running`},{status:`waiting_input`,colour:`bg-waiting`},{status:`interrupted`,colour:`bg-interrupted`}];function q({projectId:e}){let t=_(e),n=(0,V.useMemo)(()=>{let e=new Map;for(let n of t.data??[])e.set(n.status,(e.get(n.status)??0)+1);return e},[t.data]),r=(t.data??[]).filter(e=>e.status!==`archived`).length;return(0,H.jsxs)(`div`,{className:`flex items-center gap-3 text-2xs text-fg-muted tabular-nums`,children:[(0,H.jsxs)(`span`,{children:[r,` session`,r===1?``:`s`]}),K.map(({status:e,colour:t})=>{let r=n.get(e)??0;return r===0?null:(0,H.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(`span`,{className:`size-1.5 rounded-full ${t}`}),r,` `,e.replace(`_`,` `)]},e)})]})}function J({icon:e,label:t,onClick:n}){return(0,H.jsx)(`button`,{type:`button`,"aria-label":t,title:t,onClick:e=>{e.preventDefault(),e.stopPropagation(),n()},className:`flex items-center rounded-md p-1.5 text-fg-muted transition-colors hover:bg-ground hover:text-fg`,children:(0,H.jsx)(e,{className:`size-4`})})}function Y({project:e,repoPath:t,draggable:n,dragging:r,onDragStart:i,onDragEnd:a,onDragOver:f}){let p=m(),[h,_]=(0,V.useState)(!1),[y,b]=(0,V.useState)(e.name),[C,E]=(0,V.useState)(I(e)),k=t=>p.mutate({id:e.id,archived:t},{onError:e=>x(e)}),N=()=>{b(e.name),E(I(e)),_(!0)},P=()=>{let t=y.trim(),n=z(C);if(!t){_(!1);return}let r={...t===e.name?{}:{name:t},...n&&n!==I(e)?{abbrev:n}:{}};if(Object.keys(r).length===0){_(!1);return}p.mutate({id:e.id,...r},{onSuccess:()=>_(!1),onError:e=>x(e)})};return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(M,{children:[(0,H.jsx)(D,{asChild:!0,children:(0,H.jsxs)(`div`,{draggable:n,onDragStart:i,onDragEnd:a,onDragOver:f,className:w(`group relative transition-opacity`,r&&`opacity-50`),children:[(0,H.jsxs)(F,{draggable:!1,to:`/project/${e.id}`,className:`block rounded-lg bg-surface p-4 transition-colors hover:bg-elevated`,children:[(0,H.jsx)(`h2`,{className:`truncate pr-16 text-base font-semibold text-fg group-hover:text-accent`,children:e.name}),(0,H.jsx)(`p`,{className:`mt-1 truncate font-mono text-2xs text-fg-muted`,children:t??`…`}),(0,H.jsx)(`div`,{className:`mt-3`,children:(0,H.jsx)(q,{projectId:e.id})})]}),(0,H.jsx)(`div`,{className:`absolute right-2 top-2 hidden gap-0.5 group-hover:flex has-[[data-state=open]]:flex pointer-coarse:flex`,children:e.archived?(0,H.jsx)(J,{icon:O,label:`Reopen project`,onClick:()=>k(!1)}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(J,{icon:g,label:`Edit project`,onClick:N}),(0,H.jsx)(J,{icon:T,label:`Archive project`,onClick:()=>k(!0)})]})})]})}),(0,H.jsx)(A,{children:e.archived?(0,H.jsxs)(j,{onSelect:()=>k(!1),children:[(0,H.jsx)(O,{}),` Reopen`]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(j,{onSelect:N,children:[(0,H.jsx)(g,{}),` Edit`]}),(0,H.jsxs)(j,{onSelect:()=>k(!0),children:[(0,H.jsx)(T,{}),` Archive`]})]})})]}),(0,H.jsx)(d,{open:h,onOpenChange:_,children:(0,H.jsxs)(l,{children:[(0,H.jsx)(o,{children:(0,H.jsx)(u,{children:`Edit project`})}),(0,H.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),P()},children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(S,{htmlFor:`project-name-${e.id}`,children:`Name`}),(0,H.jsx)(v,{id:`project-name-${e.id}`,value:y,onChange:e=>b(e.target.value),autoFocus:!0})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(S,{htmlFor:`project-abbrev-${e.id}`,children:`Abbreviation`}),(0,H.jsx)(v,{id:`project-abbrev-${e.id}`,maxLength:5,value:C,onChange:e=>E(z(e.target.value)),className:`w-24 font-mono uppercase`}),(0,H.jsxs)(`p`,{className:`text-2xs text-fg-muted`,children:[`Up to `,5,` characters — the label on the collapsed sidebar rail.`]})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsx)(S,{className:`text-fg-muted`,children:`Path`}),(0,H.jsx)(`p`,{className:`truncate font-mono text-2xs text-fg-muted`,children:t??`…`})]}),(0,H.jsxs)(c,{children:[(0,H.jsx)(s,{type:`button`,variant:`ghost`,onClick:()=>_(!1),children:`Cancel`}),(0,H.jsx)(s,{type:`submit`,disabled:!y.trim()||p.isPending,children:`Save`})]})]})]})})]})}function X({icon:e,label:t,hint:n,onClick:r}){return(0,H.jsxs)(`button`,{type:`button`,onClick:r,className:`group flex flex-col rounded-lg bg-surface p-4 text-left transition-colors hover:bg-elevated`,children:[(0,H.jsxs)(`h2`,{className:`flex items-center gap-2 truncate text-base font-semibold text-fg group-hover:text-accent`,children:[(0,H.jsx)(e,{className:`size-4 shrink-0`}),t]}),(0,H.jsx)(`p`,{className:`mt-1 truncate text-2xs text-fg-muted`,children:n})]})}function Z(){let e=i(),t=h(e??void 0),n=y(),a=p(e??void 0),o=f(e??``),[s,c]=(0,V.useState)(!1),[l,u]=(0,V.useState)(null),[d,m]=(0,V.useState)(!1),g=W(),_=r(`palette.toggle`),v=e=>n.data?.find(t=>t.id===e)?.path,x=t.data??[],S=a.data?.projectOrder??[],C=E(x.filter(e=>!e.archived),S),D=x.filter(e=>e.archived),O=(e,t)=>{e!==t&&o.mutate({projectOrder:k(C.map(e=>e.id),e,t)})};return(0,H.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,H.jsxs)(`div`,{className:`mx-auto max-w-4xl p-6`,children:[x.length===0&&(0,H.jsxs)(`div`,{className:`mb-8 mt-16 flex flex-col items-center gap-3 text-center`,children:[(0,H.jsx)(b,{className:`size-8 text-fg-muted`}),(0,H.jsxs)(`p`,{className:`text-sm text-fg-secondary`,children:[`No projects yet — open one below, or press `,_,`.`]})]}),(0,H.jsxs)(`div`,{className:`grid auto-rows-fr grid-cols-1 gap-3 sm:grid-cols-2`,children:[C.map(e=>(0,H.jsx)(Y,{project:e,repoPath:v(e.repo_id),draggable:!0,dragging:l===e.id,onDragStart:()=>u(e.id),onDragEnd:()=>u(null),onDragOver:t=>{t.preventDefault(),l&&l!==e.id&&O(l,e.id)}},e.id)),(0,H.jsx)(X,{icon:B,label:`Open project`,hint:`Point at a repository on this host`,onClick:()=>c(!0)}),(0,H.jsx)(X,{icon:L,label:g.open?`Close terminal`:`Open terminal`,hint:g.open?`End the shell below`:`A shell at ~ for cloning repositories`,onClick:g.toggle})]}),D.length>0&&(0,H.jsxs)(`div`,{className:`mt-6`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>m(e=>!e),className:`flex items-center gap-1.5 px-1 py-1.5 text-2xs uppercase tracking-wide text-fg-muted transition-colors hover:text-fg`,children:[(0,H.jsx)(N,{className:w(`size-3 transition-transform`,d&&`rotate-90`)}),(0,H.jsx)(T,{className:`size-3`}),(0,H.jsx)(`span`,{children:`Archived`}),(0,H.jsx)(`span`,{className:`tabular-nums`,children:D.length})]}),d&&(0,H.jsx)(`div`,{className:`mt-2 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:D.map(e=>(0,H.jsx)(Y,{project:e,repoPath:v(e.repo_id),draggable:!1,dragging:!1,onDragStart:()=>{},onDragEnd:()=>{},onDragOver:()=>{}},e.id))})]})]})}),g.open&&(0,H.jsx)(G,{term:g.term,onExit:g.onExit}),e!==null&&(0,H.jsx)(P,{profileId:e,open:s,onOpenChange:c})]})}export{Z as Dashboard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{a as r,g as i,h as a,i as o,n as s,o as c,r as l,t as u}from"./dialog-B43iKmfK.js";import{t as d}from"./createLucideIcon-DyMAgLa3.js";import{l as f,r as p,t as m}from"./buffer-store-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{a as r,g as i,h as a,i as o,n as s,o as c,r as l,t as u}from"./dialog-B43iKmfK.js";import{t as d}from"./createLucideIcon-DyMAgLa3.js";import{l as f,r as p,t as m}from"./buffer-store-DNAdK8WD.js";import{s as h,t as g}from"./editor-sync-CMMUUNfm.js";var _=d(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),v=e(t(),1),y=n();function b(e,t,n){let r=m(e,t,n);return(0,v.useSyncExternalStore)((0,v.useCallback)(e=>f(r,e),[r]),()=>p(r))}function x({session:e,path:t,kind:n,root:r}){return b(e,t,r)&&n!==`commit`?(0,y.jsx)(_,{"aria-hidden":!0,className:`size-2 shrink-0 fill-current text-fg-muted group-hover:hidden`}):null}function S({session:e,path:t,kind:n,root:d,label:f,onClose:p}){let m=b(e,t,d)&&n!==`commit`,[_,x]=(0,v.useState)(!1),S=()=>m?x(!0):p();return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`button`,{onClick:e=>{e.stopPropagation(),S()},className:`hidden size-4 items-center justify-center rounded-sm text-fg-muted transition-colors hover:text-fg group-hover:flex pointer-coarse:flex`,"aria-label":`Close ${f}`,children:(0,y.jsx)(a,{className:`size-3`})}),(0,y.jsx)(u,{open:_,onOpenChange:e=>!e&&x(!1),children:(0,y.jsxs)(s,{children:[(0,y.jsxs)(r,{children:[(0,y.jsxs)(c,{children:[`Discard changes to `,f,`?`]}),(0,y.jsx)(l,{children:`This file has unsaved changes. Closing the tab will discard them.`})]}),(0,y.jsxs)(o,{children:[(0,y.jsx)(i,{variant:`ghost`,onClick:()=>x(!1),children:`Keep editing`}),(0,y.jsx)(i,{variant:`danger`,onClick:()=>{h(e,t,d),g(e,t,d),x(!1),p()},children:`Discard`})]})]})})]})}export{x as EditorDirtyDot,S as EditorTabClose};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Terminal-
|
|
2
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{n,t as r}from"./jsx-runtime-ffCh33zF.js";import{S as i,_ as a,v as o,y as s}from"./hotkeys-aKIAG8uQ.js";import{t as c}from"./preload-helper-Czpn1I53.js";import{S as l,n as u}from"./api-B3lAdmrV.js";import{A as d,C as f,O as p,w as m,x as h}from"./dialog-B43iKmfK.js";import{t as g}from"./utils-B6KiDbIe.js";import{t as _}from"./createLucideIcon-DyMAgLa3.js";var v=e(t(),1),y=[`top`,`right`,`bottom`,`left`],b=Math.min,x=Math.max,S=Math.round,C=Math.floor,w=e=>({x:e,y:e}),T={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function E(e,t,n){return x(e,b(t,n))}function D(e,t){return typeof e==`function`?e(t):e}function O(e){return e.split(`-`)[0]}function k(e){return e.split(`-`)[1]}function A(e){return e===`x`?`y`:`x`}function j(e){return e===`y`?`height`:`width`}function M(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function N(e){return A(M(e))}function P(e,t,n){n===void 0&&(n=!1);let r=k(e),i=N(e),a=j(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=B(o)),[o,B(o)]}function F(e){let t=B(e);return[I(e),t,I(t)]}function I(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var L=[`left`,`right`],R=[`right`,`left`],z=[`top`,`bottom`],ee=[`bottom`,`top`];function te(e,t,n){switch(e){case`top`:case`bottom`:return n?t?R:L:t?L:R;case`left`:case`right`:return t?z:ee;default:return[]}}function ne(e,t,n,r){let i=k(e),a=te(O(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(I)))),a}function B(e){let t=O(e);return T[t]+e.slice(t.length)}function re(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function ie(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:re(e)}function V(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function ae(e,t,n){let{reference:r,floating:i}=e,a=M(t),o=N(t),s=j(o),c=O(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=k(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function oe(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=D(t,e),p=ie(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=V(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=V(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var se=50,ce=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:oe},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ae(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<se&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=ae(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},le=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=D(e,t)||{};if(l==null)return{};let d=ie(u),f={x:n,y:r},p=N(i),m=j(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,x=a.reference[m]+a.reference[p]-f[p]-a.floating[m],S=f[p]-a.reference[p],C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),w=C?C[y]:0;(!w||!await(o.isElement==null?void 0:o.isElement(C)))&&(w=s.floating[y]||a.floating[m]);let T=x/2-S/2,O=w/2-h[m]/2-1,A=b(d[_],O),M=b(d[v],O),P=w-h[m]-M,F=w/2-h[m]/2+T,I=E(A,F,P),L=!c.arrow&&k(i)!=null&&F!==I&&a.reference[m]/2-(F<A?A:M)-h[m]/2<0,R=L?F<A?F-A:F-P:0;return{[p]:f[p]+R,data:{[p]:I,centerOffset:F-I-R,...L&&{alignmentOffset:R}},reset:L}}}),ue=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=D(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=O(r),_=M(o),v=O(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[B(o)]:F(o)),x=p!==`none`;!d&&x&&b.push(...ne(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=P(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==M(t))||T.every(e=>M(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=M(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function de(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function fe(e){return y.some(t=>e[t]>=0)}var pe=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=D(e,t);switch(i){case`referenceHidden`:{let e=de(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:fe(e)}}}case`escaped`:{let e=de(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:fe(e)}}}default:return{}}}}},me=new Set([`left`,`top`]);async function he(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=O(n),s=k(n),c=M(n)===`y`,l=me.has(o)?-1:1,u=a&&c?-1:1,d=D(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var ge=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await he(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},_e=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=D(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=M(i),p=A(f),m=u[p],h=u[f],g=(e,t)=>E(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},ve=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=D(e,t),u={x:n,y:r},d=M(i),f=A(d),p=u[f],m=u[d],h=D(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=me.has(O(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},ye=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=D(e,t),c=await i.detectOverflow(t,s),l=O(n),u=k(n),d=M(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=b(p-c[m],g),y=b(f-c[h],_),S=t.middlewareData.shift,C=!S,w=v,T=y;S!=null&&S.enabled.x&&(T=_),S!=null&&S.enabled.y&&(w=g),C&&!u&&(d?T=f-2*x(c.left,c.right):w=p-2*x(c.top,c.bottom)),await o({...t,availableWidth:T,availableHeight:w});let E=await i.getDimensions(a.floating);return f!==E.width||p!==E.height?{reset:{rects:!0}}:{}}}};function be(){return typeof window<`u`}function H(e){return xe(e)?(e.nodeName||``).toLowerCase():`#document`}function U(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function W(e){return((xe(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function xe(e){return be()?e instanceof Node||e instanceof U(e).Node:!1}function G(e){return be()?e instanceof Element||e instanceof U(e).Element:!1}function K(e){return be()?e instanceof HTMLElement||e instanceof U(e).HTMLElement:!1}function Se(e){return!be()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof U(e).ShadowRoot}function Ce(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=J(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function we(e){return/^(table|td|th)$/.test(H(e))}function Te(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Ee=/transform|translate|scale|rotate|perspective|filter/,De=/paint|layout|strict|content/,q=e=>!!e&&e!==`none`,Oe;function ke(e){let t=G(e)?J(e):e;return q(t.transform)||q(t.translate)||q(t.scale)||q(t.rotate)||q(t.perspective)||!je()&&(q(t.backdropFilter)||q(t.filter))||Ee.test(t.willChange||``)||De.test(t.contain||``)}function Ae(e){let t=Y(e);for(;K(t)&&!Me(t);){if(ke(t))return t;if(Te(t))return null;t=Y(t)}return null}function je(){return Oe??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Oe}function Me(e){return/^(html|body|#document)$/.test(H(e))}function J(e){return U(e).getComputedStyle(e)}function Ne(e){return G(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Y(e){if(H(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Se(e)&&e.host||W(e);return Se(t)?t.host:t}function Pe(e){let t=Y(e);return Me(t)?(e.ownerDocument||e).body:K(t)&&Ce(t)?t:Pe(t)}function Fe(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Pe(e),i=r===e.ownerDocument?.body,a=U(r);if(i){let e=Ie(a);return t.concat(a,a.visualViewport||[],Ce(r)?r:[],e&&n?Fe(e):[])}else return t.concat(r,Fe(r,[],n))}function Ie(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Le(e){let t=J(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=K(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=S(n)!==a||S(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Re(e){return G(e)?e:e.contextElement}function X(e){let t=Re(e);if(!K(t))return w(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Le(t),o=(a?S(n.width):n.width)/r,s=(a?S(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var ze=w(0);function Be(e){let t=U(e);return!je()||!t.visualViewport?ze:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ve(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===U(e)}function Z(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Re(e),o=w(1);t&&(r?G(r)&&(o=X(r)):o=X(e));let s=Ve(a,n,r)?Be(a):w(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=U(a),t=G(r)?U(r):r,n=e,i=Ie(n);for(;i&&t!==n;){let e=X(i),t=i.getBoundingClientRect(),r=J(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=U(i),i=Ie(n)}}return V({width:u,height:d,x:c,y:l})}function He(e,t){let n=Ne(e).scrollLeft;return t?t.left+n:Z(W(e)).left+n}function Ue(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-He(e,n),y:n.top+t.scrollTop}}function We(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=W(r),s=t?Te(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=w(1),u=w(0),d=K(r);if((d||!a)&&((H(r)!==`body`||Ce(o))&&(c=Ne(r)),d)){let e=Z(r);l=X(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Ue(o,c):w(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Ge(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Ke(e){let t=Ne(e),n=e.ownerDocument.body,r=x(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=x(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+He(e),o=-t.scrollTop;return J(n).direction===`rtl`&&(a+=x(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var qe=25;function Je(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=U(e),a=W(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!je()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(He(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=qe&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Ye(e,t){let n=Z(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=X(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Xe(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Je(e,n,t);else if(t===`document`)r=Ke(W(e));else if(G(t))r=Ye(t,n);else{let n=Be(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return V(r)}function Ze(e,t){let n=t.get(e);if(n)return n;let r=Fe(e,[],!1).filter(e=>G(e)&&H(e)!==`body`),i=null,a=J(e).position===`fixed`,o=a?Y(e):e;for(;G(o)&&!Me(o);){let e=J(o),t=ke(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Y(o)}return t.set(e,r),r}function Qe(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Te(t)?[]:Ze(t,this._c):[].concat(n),r],o=Xe(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Xe(t,a[e],i);s=x(n.top,s),c=b(n.right,c),l=b(n.bottom,l),u=x(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function $e(e){let{width:t,height:n}=Le(e);return{width:t,height:n}}function et(e,t,n){let r=K(t),i=W(t),a=n===`fixed`,o=Z(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=w(0);if((r||!a)&&((H(t)!==`body`||Ce(i))&&(s=Ne(t)),r)){let e=Z(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=He(i));let l=i&&!r&&!a?Ue(i,s):w(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function tt(e){return J(e).position===`static`}function nt(e,t){if(!K(e)||J(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return W(e)===n&&(n=n.ownerDocument.body),n}function rt(e,t){let n=U(e);if(Te(e))return n;if(!K(e)){let t=Y(e);for(;t&&!Me(t);){if(G(t)&&!tt(t))return t;t=Y(t)}return n}let r=nt(e,t);for(;r&&we(r)&&tt(r);)r=nt(r,t);return r&&Me(r)&&tt(r)&&!ke(r)?n:r||Ae(e)||n}var it=async function(e){let t=this.getOffsetParent||rt,n=this.getDimensions,r=await n(e.floating);return{reference:et(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function at(e){return J(e).direction===`rtl`}var ot={convertOffsetParentRelativeRectToViewportRelativeRect:We,getDocumentElement:W,getClippingRect:Qe,getOffsetParent:rt,getElementRects:it,getClientRects:Ge,getDimensions:$e,getScale:X,isElement:G,isRTL:at};function st(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ct(e,t,n){let r=null,i,a=W(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=C(d),h=C(a.clientWidth-(u+f)),g=C(a.clientHeight-(d+p)),_=C(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:x(0,b(1,c))||1},y=!0;function S(t){let n=t[0].intersectionRatio;if(!st(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(S,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(S,v)}r.observe(e)}let c=U(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function lt(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Re(e),u=i||a?[...l?Fe(l):[],...t?Fe(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?ct(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Z(e):null;c&&g();function g(){let t=Z(e);h&&!st(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var ut=ge,dt=_e,ft=ue,pt=ye,mt=pe,ht=le,gt=ve,_t=(e,t,n)=>{let r=new Map,i=n??{},a={...ot,...i.platform,_c:r};return ce(e,t,{...i,platform:a})},vt=e(n(),1),yt=typeof document<`u`?v.useLayoutEffect:function(){};function bt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!bt(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!bt(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function xt(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function St(e,t){let n=xt(e);return Math.round(t*n)/n}function Ct(e){let t=v.useRef(e);return yt(()=>{t.current=e}),t}function wt(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=v.useState(r);bt(f,r)||p(r);let[m,h]=v.useState(null),[g,_]=v.useState(null),y=v.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),b=v.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=a||m,S=o||g,C=v.useRef(null),w=v.useRef(null),T=v.useRef(u),E=c!=null,D=Ct(c),O=Ct(i),k=Ct(l),A=v.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),_t(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!bt(T.current,t)&&(T.current=t,vt.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);yt(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=v.useRef(!1);yt(()=>(j.current=!0,()=>{j.current=!1}),[]),yt(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=v.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),N=v.useMemo(()=>({reference:x,floating:S}),[x,S]),P=v.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=St(N.floating,u.x),r=St(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...xt(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return v.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var Tt=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:ht({element:r.current,padding:i}).fn(n):r?ht({element:r,padding:i}).fn(n):{}}}},Et=(e,t)=>{let n=ut(e);return{name:n.name,fn:n.fn,options:[e,t]}},Dt=(e,t)=>{let n=dt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ot=(e,t)=>({fn:gt(e).fn,options:[e,t]}),kt=(e,t)=>{let n=ft(e);return{name:n.name,fn:n.fn,options:[e,t]}},At=(e,t)=>{let n=pt(e);return{name:n.name,fn:n.fn,options:[e,t]}},jt=(e,t)=>{let n=mt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Mt=(e,t)=>{let n=Tt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Q=r(),Nt=`Arrow`,Pt=v.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,Q.jsx)(m.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,Q.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Pt.displayName=Nt;var Ft=Pt;function It(e){let[t,n]=v.useState(void 0);return h(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var Lt=`Popper`,[Rt,zt]=p(Lt),[Bt,Vt]=Rt(Lt),Ht=e=>{let{__scopePopper:t,children:n}=e,[r,i]=v.useState(null),[a,o]=v.useState(void 0);return(0,Q.jsx)(Bt,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};Ht.displayName=Lt;var Ut=`PopperAnchor`,Wt=v.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Vt(Ut,n),o=v.useRef(null),s=a.onAnchorChange,c=d(t,v.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=v.useRef(null);v.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&en(a.placementState),f=u?.[0],p=u?.[1];return r?null:(0,Q.jsx)(m.div,{"data-radix-popper-side":f,"data-radix-popper-align":p,...i,ref:c})});Wt.displayName=Ut;var Gt=`PopperContent`,[Kt,qt]=Rt(Gt),Jt=v.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:p=`partial`,hideWhenDetached:g=!1,updatePositionStrategy:_=`optimized`,onPlaced:y,...b}=e,x=Vt(Gt,n),[S,C]=v.useState(null),w=d(t,C),[T,E]=v.useState(null),D=It(T),O=D?.width??0,k=D?.height??0,A=r+(a===`center`?``:`-`+a),j=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},M=Array.isArray(l)?l:[l],N=M.length>0,P={padding:j,boundary:M.filter(Qt),altBoundary:N},{refs:F,floatingStyles:I,placement:L,isPositioned:R,middlewareData:z}=wt({strategy:`fixed`,placement:A,whileElementsMounted:(...e)=>lt(...e,{animationFrame:_===`always`}),elements:{reference:x.anchor},middleware:[Et({mainAxis:i+k,alignmentAxis:o}),c&&Dt({mainAxis:!0,crossAxis:!1,limiter:p===`partial`?Ot():void 0,...P}),c&&kt({...P}),At({...P,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),T&&Mt({element:T,padding:s}),$t({arrowWidth:O,arrowHeight:k}),g&&jt({strategy:`referenceHidden`,...P,boundary:N?P.boundary:void 0})]}),ee=x.setPlacementState;h(()=>(ee(L),()=>{ee(void 0)}),[L,ee]);let[te,ne]=en(L),B=f(y);h(()=>{R&&B?.()},[R,B]);let re=z.arrow?.x,ie=z.arrow?.y,V=z.arrow?.centerOffset!==0,[ae,oe]=v.useState();return h(()=>{S&&oe(window.getComputedStyle(S).zIndex)},[S]),(0,Q.jsx)(`div`,{ref:F.setFloating,"data-radix-popper-content-wrapper":``,style:{...I,transform:R?I.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ae,"--radix-popper-transform-origin":[z.transformOrigin?.x,z.transformOrigin?.y].join(` `),...z.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,Q.jsx)(Kt,{scope:n,placedSide:te,placedAlign:ne,onArrowChange:E,arrowX:re,arrowY:ie,shouldHideArrow:V,children:(0,Q.jsx)(m.div,{"data-side":te,"data-align":ne,...b,ref:w,style:{...b.style,animation:R?void 0:`none`}})})})});Jt.displayName=Gt;var Yt=`PopperArrow`,Xt={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Zt=v.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=qt(Yt,n),a=Xt[i.placedSide];return(0,Q.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,Q.jsx)(Ft,{...r,ref:t,style:{...r.style,display:`block`}})})});Zt.displayName=Yt;function Qt(e){return e!==null}var $t=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=en(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function en(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var tn=Ht,nn=Wt,rn=Jt,an=Zt,on=`rounded-md bg-border/50 text-sm text-fg placeholder:text-fg-muted transition-colors hover:bg-border/80 focus:bg-border/80 disabled:cursor-not-allowed disabled:opacity-50`,sn=`relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm text-fg outline-none transition-colors`,cn=`data-[highlighted]:bg-action data-[highlighted]:text-action-ink data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,ln=`data-[selected=true]:bg-action data-[selected=true]:text-action-ink data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50`;function un({className:e,type:t,...n}){return(0,Q.jsx)(`input`,{type:t,className:g(`flex h-8 w-full px-2.5`,on,e),...n})}function dn({className:e,...t}){return(0,Q.jsx)(`textarea`,{className:g(`flex min-h-16 w-full px-2.5 py-2`,on,e),...t})}var fn=`Label`,pn=v.forwardRef((e,t)=>(0,Q.jsx)(m.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));pn.displayName=fn;var mn=pn;function hn({className:e,...t}){return(0,Q.jsx)(mn,{className:g(`text-xs font-medium text-fg-secondary peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function gn(){return s({queryKey:[`profiles`],queryFn:()=>u(`GET`,`/api/profiles`)})}function _n(e){return s({queryKey:[`profile-settings`,e],queryFn:()=>u(`GET`,`/api/profiles/${e}/settings`),enabled:e!==void 0})}function vn(e){return s({queryKey:[`accounts`,e],queryFn:()=>u(`GET`,`/api/accounts?profile=${e}`),enabled:e!==void 0})}function yn(e){return s({queryKey:[`account-usage`,e],queryFn:()=>u(`GET`,`/api/accounts/${e}/usage`),enabled:e!==void 0,staleTime:15e3})}function bn(){return s({queryKey:[`repos`],queryFn:()=>u(`GET`,`/api/repos`)})}function xn(e,t=!0){return s({queryKey:[`projects`,e??`all`],queryFn:()=>u(`GET`,e===void 0?`/api/projects`:`/api/projects?profile=${e}`),enabled:t})}function Sn(e){return s({queryKey:[`project`,e],queryFn:()=>u(`GET`,`/api/projects/${e}`),enabled:e!==void 0})}function Cn(e){return s({queryKey:[`sessions`,e],queryFn:()=>u(`GET`,`/api/sessions?project=${e}`),enabled:e!==void 0})}var wn={queryKey:[`sessions`,`all`],queryFn:()=>u(`GET`,`/api/sessions`)};function Tn(e=!0){return s({...wn,enabled:e})}function En(e){return e.fetchQuery(wn)}function Dn(){return s({queryKey:[`config`],queryFn:()=>u(`GET`,`/api/config`)})}function On(e){return s({queryKey:[`repo-branches`,e],queryFn:()=>u(`GET`,`/api/repos/${e}/branches`),enabled:e!==void 0,staleTime:3e4})}function kn(e){return s({queryKey:[`repo-worktrees`,e],queryFn:()=>u(`GET`,`/api/repos/${e}/worktrees`),enabled:e!==void 0,staleTime:1e4})}function An(e,t){let n=i();return o({mutationFn:t=>u(`DELETE`,`/api/repos/${e}/worktrees?path=${encodeURIComponent(t)}`),onSuccess:r=>{n.setQueryData([`repo-worktrees`,e],r),n.invalidateQueries({queryKey:[`project`,t]})}})}function jn(e,t){let n=i();return o({mutationFn:({name:t,confirm:n})=>{let r=new URLSearchParams({name:t});return n&&r.set(`confirm`,`1`),u(`DELETE`,`/api/repos/${e}/branches?${r.toString()}`)},onSuccess:r=>{n.setQueryData([`repo-worktrees`,e],r),n.invalidateQueries({queryKey:[`project`,t]})}})}function Mn(e){return s({queryKey:[`fs-dirs`,e],queryFn:()=>u(`GET`,`/api/fs/dirs?prefix=${encodeURIComponent(e)}`),enabled:e.startsWith(`/`)||e.startsWith(`~`),placeholderData:e=>e,staleTime:1e4})}function Nn(){return s({queryKey:[`version`],queryFn:()=>u(`GET`,`/api/version`),staleTime:1/0})}function Pn(){return s({queryKey:[`host`],queryFn:()=>u(`GET`,`/api/host`),staleTime:1/0})}function Fn(e){return e?e.displayName||e.hostname:void 0}function In(){return s({queryKey:[`agents`],queryFn:()=>u(`GET`,`/api/agents`),staleTime:3e4,refetchOnWindowFocus:!0})}function Ln(){let e=i();return o({mutationFn:e=>u(`POST`,`/api/profiles`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`profiles`]})})}function Rn(e){let t=i();return o({mutationFn:t=>u(`PATCH`,`/api/profiles/${e}/settings`,t),onSuccess:n=>t.setQueryData([`profile-settings`,e],n)})}function zn(){let e=i();return o({mutationFn:({id:e,...t})=>u(`PATCH`,`/api/profiles/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`profiles`]})})}function Bn(){let e=i();return o({mutationFn:({id:e,...t})=>u(`PATCH`,`/api/accounts/${e}`,t),onSuccess:t=>{e.invalidateQueries({queryKey:[`accounts`,t.profile_id]}),e.invalidateQueries({queryKey:[`account-usage`,t.id]})}})}function Vn(){let e=i();return o({mutationFn:e=>u(`DELETE`,`/api/profiles/${e}`),onSuccess:()=>e.clear()})}function Hn(){let e=i();return o({mutationFn:e=>u(`DELETE`,`/api/accounts/${e}`),onSuccess:()=>void e.invalidateQueries({queryKey:[`accounts`]})})}function Un(){let e=i();return o({mutationFn:e=>u(`POST`,`/api/accounts`,e),onSuccess:t=>void e.invalidateQueries({queryKey:[`accounts`,t.profile_id]})})}function Wn(){return o({mutationFn:e=>u(`POST`,`/api/accounts/${e}/login`)})}function Gn(){let e=i();return o({mutationFn:e=>u(`POST`,`/api/repos`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function Kn(){let e=i();return o({mutationFn:({id:e,...t})=>u(`PATCH`,`/api/repos/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function qn(){let e=i();return o({mutationFn:e=>u(`POST`,`/api/repos/${e}/fetch`),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function Jn(){let e=i();return o({mutationFn:e=>u(`POST`,`/api/projects`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`projects`]})})}function Yn(){let e=i();return o({mutationFn:({id:e,...t})=>u(`PATCH`,`/api/projects/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`projects`]})})}function Xn(e,t){return s({queryKey:[`scratchpad`,e,t??`none`],queryFn:()=>u(`GET`,`/api/scratchpad?profile=${e}${t?`&project=${t}`:``}`),enabled:e!==void 0})}function Zn(){let e=i();return o({mutationFn:e=>u(`POST`,`/api/scratchpad`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function Qn(){let e=i();return o({mutationFn:({id:e,...t})=>u(`PATCH`,`/api/scratchpad/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function $n(){let e=i();return o({mutationFn:e=>u(`DELETE`,`/api/scratchpad/${e}`),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function er(e,t){return s({queryKey:[`layouts`,e,t??`none`],queryFn:()=>u(`GET`,`/api/layouts?profile=${e}${t?`&project=${t}`:``}`),enabled:e!==void 0})}function tr(){let e=i();return o({mutationFn:e=>u(`POST`,`/api/layouts`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`layouts`]})})}function nr(){let e=i();return o({mutationFn:({id:e,...t})=>u(`PATCH`,`/api/layouts/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`layouts`]})})}function rr(){let e=i();return o({mutationFn:e=>u(`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 ir(){let e=i();return o({mutationFn:e=>u(`POST`,`/api/sessions`,e),onSuccess:t=>$(e,t)})}function ar(e){let t=i();return o({mutationFn:t=>u(`POST`,`/api/sessions/${t}/${e}`),onSuccess:e=>$(t,e)})}function or(){let e=i();return o({mutationFn:({sessionId:e,accountId:t})=>u(`POST`,`/api/sessions/${e}/migrate`,{account_id:t}),onSuccess:t=>$(e,t)})}function sr(){let e=i();return o({mutationFn:({sessionId:e,accountId:t})=>u(`POST`,`/api/sessions/${e}/handoff`,{account_id:t}),onSuccess:(t,{sessionId:n})=>{$(e,t),e.invalidateQueries({queryKey:[`session`,n]})}})}function cr(){let e=i();return o({mutationFn:e=>u(`POST`,`/api/sessions/${e}/archive`),onSuccess:t=>$(e,t)})}function lr(){let e=i();return o({mutationFn:e=>u(`POST`,`/api/sessions/${e}/unarchive`),onSuccess:t=>$(e,t)})}function ur(){let e=i();return o({mutationFn:({sessionId:e,title:t})=>u(`PATCH`,`/api/sessions/${e}`,{title:t}),onSuccess:t=>$(e,t)})}function dr(){let e=i();return o({mutationFn:e=>u(`PATCH`,`/api/config`,e),onSuccess:(t,n)=>{e.setQueryData([`config`],t),`displayName`in n&&e.invalidateQueries({queryKey:[`host`]})}})}async function fr(e){try{return await u(`GET`,`/api/profiles/${e}/state`)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`no_state`)return null;throw e}}function pr(e,t){return u(`PUT`,`/api/profiles/${e}/state`,{ui_state:t})}function mr(e,t){return s({queryKey:[`ports`,e],queryFn:()=>u(`GET`,`/api/sessions/${e}/ports`),enabled:e!==void 0&&t,refetchInterval:a(5e3),refetchIntervalInBackground:!1})}function hr(e,t){return s({queryKey:[`session-env`,e],queryFn:()=>u(`GET`,`/api/sessions/${e}/env`),enabled:e!==void 0&&t,refetchInterval:a(5e3),refetchIntervalInBackground:!1})}function gr(){let e=i();return o({mutationFn:e=>u(`DELETE`,`/api/sessions/${e}/env`),onSuccess:(t,n)=>{e.setQueryData([`session-env`,n],{vars:[]})}})}var _r=_(`folder-git-2`,[[`path`,{d:`M18 19a5 5 0 0 1-5-5v8`,key:`sz5oeg`}],[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]),vr=_(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]);function yr({id:e,value:t,onValueChange:n,onChoose:r,hints:i,placeholder:a,className:o,hintsClassName:s,autoFocus:c}){let[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)(0),p=e=>{n(e.value),r?.(e),u(!1)};return(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(un,{id:e,value:t,onChange:e=>{n(e.target.value),u(!0),f(0)},onFocus:()=>u(!0),onBlur:()=>u(!1),onKeyDown:e=>{if(!(!l||i.length===0))if(e.key===`ArrowDown`)e.preventDefault(),f(e=>(e+1)%i.length);else if(e.key===`ArrowUp`)e.preventDefault(),f(e=>(e-1+i.length)%i.length);else if(e.key===`Enter`||e.key===`Tab`){let t=i[d]??i[0];t&&(e.preventDefault(),p(t))}else e.key===`Escape`&&(e.stopPropagation(),u(!1))},placeholder:a,className:o,autoComplete:`off`,spellCheck:!1,autoFocus:c}),l&&i.length>0&&(0,Q.jsx)(`ul`,{className:g(`absolute top-full z-10 mt-1 max-h-56 overflow-y-auto rounded-md bg-elevated p-1 shadow-xl`,s??`w-full`),children:i.map((e,t)=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`button`,{type:`button`,onMouseDown:t=>{t.preventDefault(),p(e)},onMouseEnter:()=>f(t),className:g(`relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm text-fg outline-none transition-colors`,`data-[selected=true]:bg-action data-[selected=true]:text-action-ink data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50`,`w-full font-mono text-xs`),"data-selected":t===d,children:[(0,Q.jsx)(`span`,{className:`truncate`,children:e.label??e.value}),e.badge&&(0,Q.jsx)(`span`,{className:`ml-auto shrink-0 text-2xs opacity-70`,children:e.badge})]})},e.value))})]})}function br(e){l.error(xr(e),{id:`err:${xr(e)}`})}function xr(e){return e instanceof Error&&e.message.trim()!==``?e.message:typeof e==`string`&&e.trim()!==``?e:`Something went wrong`}var Sr=(0,v.lazy)(()=>c(()=>import(`./Terminal-caEYfoyF.js`).then(e=>({default:e.Terminal})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]))),Cr=null;async function wr(){Cr=(await c(()=>import(`./Terminal-caEYfoyF.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]))).Terminal}function Tr(e){return Cr?(0,Q.jsx)(Cr,{...e}):(0,Q.jsx)(v.Suspense,{fallback:(0,Q.jsx)(`div`,{className:`size-full bg-ground`}),children:(0,Q.jsx)(Sr,{...e})})}export{kn as $,$n as A,nr as B,Zn as C,jn as D,Hn as E,er as F,Qn as G,Rn as H,Wn as I,Sn as J,_n as K,or as L,qn as M,sr as N,rr as O,Pn as P,On as Q,Bn as R,Gn as S,Nn as T,Yn as U,zn as V,Kn as W,An as X,xn as Y,ur as Z,Dn as _,tn as _t,vr as a,Cn as at,Ln as b,fr as c,un as ct,yn as d,ln as dt,bn as et,vn as f,cn as ft,gr as g,rn as gt,cr as h,an as ht,yr as i,mr as it,Mn as j,Vn as k,Fn as l,dn as lt,Tn as m,nn as mt,wr as n,ar as nt,_r as o,lr as ot,In as p,sn as pt,gn as q,br as r,hr as rt,En as s,hn as st,Tr as t,Xn as tt,pr as u,on as ut,Un as v,zt as vt,ir as w,Jn as x,tr as y,It as yt,dr as z};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Terminal-DhuY0ChG.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-CZI7_Jkm.js","assets/jsx-runtime-ffCh33zF.js","assets/api-B3lAdmrV.js","assets/utils-B6KiDbIe.js","assets/index-nIiWlIeN.js","assets/hotkeys-aKIAG8uQ.js","assets/preload-helper-Czpn1I53.js","assets/dialog-B43iKmfK.js","assets/createLucideIcon-DyMAgLa3.js","assets/index-BKVDB6Tt.css","assets/ssh-mode-BwRmcmxJ.js","assets/Terminal-BrP-ENHg.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{n,t as r}from"./jsx-runtime-ffCh33zF.js";import{S as i,_ as a,v as o,y as s}from"./hotkeys-aKIAG8uQ.js";import{t as c}from"./preload-helper-Czpn1I53.js";import{S as l,n as u}from"./api-B3lAdmrV.js";import{A as d,C as f,O as p,w as m,x as h}from"./dialog-B43iKmfK.js";import{t as g}from"./utils-B6KiDbIe.js";import{t as _}from"./createLucideIcon-DyMAgLa3.js";var v=e(t(),1),y=[`top`,`right`,`bottom`,`left`],b=Math.min,x=Math.max,S=Math.round,C=Math.floor,w=e=>({x:e,y:e}),T={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function E(e,t,n){return x(e,b(t,n))}function D(e,t){return typeof e==`function`?e(t):e}function O(e){return e.split(`-`)[0]}function k(e){return e.split(`-`)[1]}function A(e){return e===`x`?`y`:`x`}function j(e){return e===`y`?`height`:`width`}function M(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function N(e){return A(M(e))}function P(e,t,n){n===void 0&&(n=!1);let r=k(e),i=N(e),a=j(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=B(o)),[o,B(o)]}function F(e){let t=B(e);return[I(e),t,I(t)]}function I(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var L=[`left`,`right`],R=[`right`,`left`],z=[`top`,`bottom`],ee=[`bottom`,`top`];function te(e,t,n){switch(e){case`top`:case`bottom`:return n?t?R:L:t?L:R;case`left`:case`right`:return t?z:ee;default:return[]}}function ne(e,t,n,r){let i=k(e),a=te(O(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(I)))),a}function B(e){let t=O(e);return T[t]+e.slice(t.length)}function re(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function ie(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:re(e)}function V(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function ae(e,t,n){let{reference:r,floating:i}=e,a=M(t),o=N(t),s=j(o),c=O(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=k(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function oe(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=D(t,e),p=ie(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=V(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=V(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var se=50,ce=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:oe},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ae(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<se&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=ae(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},le=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=D(e,t)||{};if(l==null)return{};let d=ie(u),f={x:n,y:r},p=N(i),m=j(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,x=a.reference[m]+a.reference[p]-f[p]-a.floating[m],S=f[p]-a.reference[p],C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),w=C?C[y]:0;(!w||!await(o.isElement==null?void 0:o.isElement(C)))&&(w=s.floating[y]||a.floating[m]);let T=x/2-S/2,O=w/2-h[m]/2-1,A=b(d[_],O),M=b(d[v],O),P=w-h[m]-M,F=w/2-h[m]/2+T,I=E(A,F,P),L=!c.arrow&&k(i)!=null&&F!==I&&a.reference[m]/2-(F<A?A:M)-h[m]/2<0,R=L?F<A?F-A:F-P:0;return{[p]:f[p]+R,data:{[p]:I,centerOffset:F-I-R,...L&&{alignmentOffset:R}},reset:L}}}),ue=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=D(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=O(r),_=M(o),v=O(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[B(o)]:F(o)),x=p!==`none`;!d&&x&&b.push(...ne(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=P(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==M(t))||T.every(e=>M(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=M(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function de(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function fe(e){return y.some(t=>e[t]>=0)}var pe=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=D(e,t);switch(i){case`referenceHidden`:{let e=de(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:fe(e)}}}case`escaped`:{let e=de(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:fe(e)}}}default:return{}}}}},me=new Set([`left`,`top`]);async function he(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=O(n),s=k(n),c=M(n)===`y`,l=me.has(o)?-1:1,u=a&&c?-1:1,d=D(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var ge=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await he(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},_e=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=D(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=M(i),p=A(f),m=u[p],h=u[f],g=(e,t)=>E(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},ve=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=D(e,t),u={x:n,y:r},d=M(i),f=A(d),p=u[f],m=u[d],h=D(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=me.has(O(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},ye=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=D(e,t),c=await i.detectOverflow(t,s),l=O(n),u=k(n),d=M(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=b(p-c[m],g),y=b(f-c[h],_),S=t.middlewareData.shift,C=!S,w=v,T=y;S!=null&&S.enabled.x&&(T=_),S!=null&&S.enabled.y&&(w=g),C&&!u&&(d?T=f-2*x(c.left,c.right):w=p-2*x(c.top,c.bottom)),await o({...t,availableWidth:T,availableHeight:w});let E=await i.getDimensions(a.floating);return f!==E.width||p!==E.height?{reset:{rects:!0}}:{}}}};function be(){return typeof window<`u`}function H(e){return xe(e)?(e.nodeName||``).toLowerCase():`#document`}function U(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function W(e){return((xe(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function xe(e){return be()?e instanceof Node||e instanceof U(e).Node:!1}function G(e){return be()?e instanceof Element||e instanceof U(e).Element:!1}function K(e){return be()?e instanceof HTMLElement||e instanceof U(e).HTMLElement:!1}function Se(e){return!be()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof U(e).ShadowRoot}function Ce(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=J(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function we(e){return/^(table|td|th)$/.test(H(e))}function Te(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Ee=/transform|translate|scale|rotate|perspective|filter/,De=/paint|layout|strict|content/,q=e=>!!e&&e!==`none`,Oe;function ke(e){let t=G(e)?J(e):e;return q(t.transform)||q(t.translate)||q(t.scale)||q(t.rotate)||q(t.perspective)||!je()&&(q(t.backdropFilter)||q(t.filter))||Ee.test(t.willChange||``)||De.test(t.contain||``)}function Ae(e){let t=Y(e);for(;K(t)&&!Me(t);){if(ke(t))return t;if(Te(t))return null;t=Y(t)}return null}function je(){return Oe??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Oe}function Me(e){return/^(html|body|#document)$/.test(H(e))}function J(e){return U(e).getComputedStyle(e)}function Ne(e){return G(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Y(e){if(H(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Se(e)&&e.host||W(e);return Se(t)?t.host:t}function Pe(e){let t=Y(e);return Me(t)?(e.ownerDocument||e).body:K(t)&&Ce(t)?t:Pe(t)}function Fe(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Pe(e),i=r===e.ownerDocument?.body,a=U(r);if(i){let e=Ie(a);return t.concat(a,a.visualViewport||[],Ce(r)?r:[],e&&n?Fe(e):[])}else return t.concat(r,Fe(r,[],n))}function Ie(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Le(e){let t=J(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=K(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=S(n)!==a||S(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Re(e){return G(e)?e:e.contextElement}function X(e){let t=Re(e);if(!K(t))return w(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Le(t),o=(a?S(n.width):n.width)/r,s=(a?S(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var ze=w(0);function Be(e){let t=U(e);return!je()||!t.visualViewport?ze:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ve(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===U(e)}function Z(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Re(e),o=w(1);t&&(r?G(r)&&(o=X(r)):o=X(e));let s=Ve(a,n,r)?Be(a):w(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=U(a),t=G(r)?U(r):r,n=e,i=Ie(n);for(;i&&t!==n;){let e=X(i),t=i.getBoundingClientRect(),r=J(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=U(i),i=Ie(n)}}return V({width:u,height:d,x:c,y:l})}function He(e,t){let n=Ne(e).scrollLeft;return t?t.left+n:Z(W(e)).left+n}function Ue(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-He(e,n),y:n.top+t.scrollTop}}function We(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=W(r),s=t?Te(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=w(1),u=w(0),d=K(r);if((d||!a)&&((H(r)!==`body`||Ce(o))&&(c=Ne(r)),d)){let e=Z(r);l=X(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Ue(o,c):w(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Ge(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Ke(e){let t=Ne(e),n=e.ownerDocument.body,r=x(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=x(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+He(e),o=-t.scrollTop;return J(n).direction===`rtl`&&(a+=x(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var qe=25;function Je(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=U(e),a=W(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!je()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(He(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=qe&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Ye(e,t){let n=Z(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=X(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Xe(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Je(e,n,t);else if(t===`document`)r=Ke(W(e));else if(G(t))r=Ye(t,n);else{let n=Be(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return V(r)}function Ze(e,t){let n=t.get(e);if(n)return n;let r=Fe(e,[],!1).filter(e=>G(e)&&H(e)!==`body`),i=null,a=J(e).position===`fixed`,o=a?Y(e):e;for(;G(o)&&!Me(o);){let e=J(o),t=ke(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Y(o)}return t.set(e,r),r}function Qe(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Te(t)?[]:Ze(t,this._c):[].concat(n),r],o=Xe(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Xe(t,a[e],i);s=x(n.top,s),c=b(n.right,c),l=b(n.bottom,l),u=x(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function $e(e){let{width:t,height:n}=Le(e);return{width:t,height:n}}function et(e,t,n){let r=K(t),i=W(t),a=n===`fixed`,o=Z(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=w(0);if((r||!a)&&((H(t)!==`body`||Ce(i))&&(s=Ne(t)),r)){let e=Z(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=He(i));let l=i&&!r&&!a?Ue(i,s):w(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function tt(e){return J(e).position===`static`}function nt(e,t){if(!K(e)||J(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return W(e)===n&&(n=n.ownerDocument.body),n}function rt(e,t){let n=U(e);if(Te(e))return n;if(!K(e)){let t=Y(e);for(;t&&!Me(t);){if(G(t)&&!tt(t))return t;t=Y(t)}return n}let r=nt(e,t);for(;r&&we(r)&&tt(r);)r=nt(r,t);return r&&Me(r)&&tt(r)&&!ke(r)?n:r||Ae(e)||n}var it=async function(e){let t=this.getOffsetParent||rt,n=this.getDimensions,r=await n(e.floating);return{reference:et(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function at(e){return J(e).direction===`rtl`}var ot={convertOffsetParentRelativeRectToViewportRelativeRect:We,getDocumentElement:W,getClippingRect:Qe,getOffsetParent:rt,getElementRects:it,getClientRects:Ge,getDimensions:$e,getScale:X,isElement:G,isRTL:at};function st(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ct(e,t,n){let r=null,i,a=W(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=C(d),h=C(a.clientWidth-(u+f)),g=C(a.clientHeight-(d+p)),_=C(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:x(0,b(1,c))||1},y=!0;function S(t){let n=t[0].intersectionRatio;if(!st(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(S,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(S,v)}r.observe(e)}let c=U(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function lt(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Re(e),u=i||a?[...l?Fe(l):[],...t?Fe(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?ct(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Z(e):null;c&&g();function g(){let t=Z(e);h&&!st(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var ut=ge,dt=_e,ft=ue,pt=ye,mt=pe,ht=le,gt=ve,_t=(e,t,n)=>{let r=new Map,i=n??{},a={...ot,...i.platform,_c:r};return ce(e,t,{...i,platform:a})},vt=e(n(),1),yt=typeof document<`u`?v.useLayoutEffect:function(){};function bt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!bt(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!bt(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function xt(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function St(e,t){let n=xt(e);return Math.round(t*n)/n}function Ct(e){let t=v.useRef(e);return yt(()=>{t.current=e}),t}function wt(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=v.useState(r);bt(f,r)||p(r);let[m,h]=v.useState(null),[g,_]=v.useState(null),y=v.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),b=v.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=a||m,S=o||g,C=v.useRef(null),w=v.useRef(null),T=v.useRef(u),E=c!=null,D=Ct(c),O=Ct(i),k=Ct(l),A=v.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),_t(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!bt(T.current,t)&&(T.current=t,vt.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);yt(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=v.useRef(!1);yt(()=>(j.current=!0,()=>{j.current=!1}),[]),yt(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=v.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),N=v.useMemo(()=>({reference:x,floating:S}),[x,S]),P=v.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=St(N.floating,u.x),r=St(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...xt(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return v.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var Tt=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:ht({element:r.current,padding:i}).fn(n):r?ht({element:r,padding:i}).fn(n):{}}}},Et=(e,t)=>{let n=ut(e);return{name:n.name,fn:n.fn,options:[e,t]}},Dt=(e,t)=>{let n=dt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ot=(e,t)=>({fn:gt(e).fn,options:[e,t]}),kt=(e,t)=>{let n=ft(e);return{name:n.name,fn:n.fn,options:[e,t]}},At=(e,t)=>{let n=pt(e);return{name:n.name,fn:n.fn,options:[e,t]}},jt=(e,t)=>{let n=mt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Mt=(e,t)=>{let n=Tt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Q=r(),Nt=`Arrow`,Pt=v.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,Q.jsx)(m.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,Q.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Pt.displayName=Nt;var Ft=Pt;function It(e){let[t,n]=v.useState(void 0);return h(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var Lt=`Popper`,[Rt,zt]=p(Lt),[Bt,Vt]=Rt(Lt),Ht=e=>{let{__scopePopper:t,children:n}=e,[r,i]=v.useState(null),[a,o]=v.useState(void 0);return(0,Q.jsx)(Bt,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};Ht.displayName=Lt;var Ut=`PopperAnchor`,Wt=v.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Vt(Ut,n),o=v.useRef(null),s=a.onAnchorChange,c=d(t,v.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=v.useRef(null);v.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&en(a.placementState),f=u?.[0],p=u?.[1];return r?null:(0,Q.jsx)(m.div,{"data-radix-popper-side":f,"data-radix-popper-align":p,...i,ref:c})});Wt.displayName=Ut;var Gt=`PopperContent`,[Kt,qt]=Rt(Gt),Jt=v.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:p=`partial`,hideWhenDetached:g=!1,updatePositionStrategy:_=`optimized`,onPlaced:y,...b}=e,x=Vt(Gt,n),[S,C]=v.useState(null),w=d(t,C),[T,E]=v.useState(null),D=It(T),O=D?.width??0,k=D?.height??0,A=r+(a===`center`?``:`-`+a),j=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},M=Array.isArray(l)?l:[l],N=M.length>0,P={padding:j,boundary:M.filter(Qt),altBoundary:N},{refs:F,floatingStyles:I,placement:L,isPositioned:R,middlewareData:z}=wt({strategy:`fixed`,placement:A,whileElementsMounted:(...e)=>lt(...e,{animationFrame:_===`always`}),elements:{reference:x.anchor},middleware:[Et({mainAxis:i+k,alignmentAxis:o}),c&&Dt({mainAxis:!0,crossAxis:!1,limiter:p===`partial`?Ot():void 0,...P}),c&&kt({...P}),At({...P,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),T&&Mt({element:T,padding:s}),$t({arrowWidth:O,arrowHeight:k}),g&&jt({strategy:`referenceHidden`,...P,boundary:N?P.boundary:void 0})]}),ee=x.setPlacementState;h(()=>(ee(L),()=>{ee(void 0)}),[L,ee]);let[te,ne]=en(L),B=f(y);h(()=>{R&&B?.()},[R,B]);let re=z.arrow?.x,ie=z.arrow?.y,V=z.arrow?.centerOffset!==0,[ae,oe]=v.useState();return h(()=>{S&&oe(window.getComputedStyle(S).zIndex)},[S]),(0,Q.jsx)(`div`,{ref:F.setFloating,"data-radix-popper-content-wrapper":``,style:{...I,transform:R?I.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ae,"--radix-popper-transform-origin":[z.transformOrigin?.x,z.transformOrigin?.y].join(` `),...z.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,Q.jsx)(Kt,{scope:n,placedSide:te,placedAlign:ne,onArrowChange:E,arrowX:re,arrowY:ie,shouldHideArrow:V,children:(0,Q.jsx)(m.div,{"data-side":te,"data-align":ne,...b,ref:w,style:{...b.style,animation:R?void 0:`none`}})})})});Jt.displayName=Gt;var Yt=`PopperArrow`,Xt={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Zt=v.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=qt(Yt,n),a=Xt[i.placedSide];return(0,Q.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,Q.jsx)(Ft,{...r,ref:t,style:{...r.style,display:`block`}})})});Zt.displayName=Yt;function Qt(e){return e!==null}var $t=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=en(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function en(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var tn=Ht,nn=Wt,rn=Jt,an=Zt,on=`rounded-md bg-border/50 text-sm text-fg placeholder:text-fg-muted transition-colors hover:bg-border/80 focus:bg-border/80 disabled:cursor-not-allowed disabled:opacity-50`,sn=`relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm text-fg outline-none transition-colors`,cn=`data-[highlighted]:bg-action data-[highlighted]:text-action-ink data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,ln=`data-[selected=true]:bg-action data-[selected=true]:text-action-ink data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50`;function un({className:e,type:t,...n}){return(0,Q.jsx)(`input`,{type:t,className:g(`flex h-8 w-full px-2.5`,on,e),...n})}function dn({className:e,...t}){return(0,Q.jsx)(`textarea`,{className:g(`flex min-h-16 w-full px-2.5 py-2`,on,e),...t})}var fn=`Label`,pn=v.forwardRef((e,t)=>(0,Q.jsx)(m.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));pn.displayName=fn;var mn=pn;function hn({className:e,...t}){return(0,Q.jsx)(mn,{className:g(`text-xs font-medium text-fg-secondary peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function gn(){return s({queryKey:[`profiles`],queryFn:()=>u(`GET`,`/api/profiles`)})}function _n(e){return s({queryKey:[`profile-settings`,e],queryFn:()=>u(`GET`,`/api/profiles/${e}/settings`),enabled:e!==void 0})}function vn(e){return s({queryKey:[`accounts`,e],queryFn:()=>u(`GET`,`/api/accounts?profile=${e}`),enabled:e!==void 0})}function yn(e){return s({queryKey:[`account-usage`,e],queryFn:()=>u(`GET`,`/api/accounts/${e}/usage`),enabled:e!==void 0,staleTime:15e3})}function bn(){return s({queryKey:[`repos`],queryFn:()=>u(`GET`,`/api/repos`)})}function xn(e,t=!0){return s({queryKey:[`projects`,e??`all`],queryFn:()=>u(`GET`,e===void 0?`/api/projects`:`/api/projects?profile=${e}`),enabled:t})}function Sn(e){return s({queryKey:[`project`,e],queryFn:()=>u(`GET`,`/api/projects/${e}`),enabled:e!==void 0})}function Cn(e){return s({queryKey:[`sessions`,e],queryFn:()=>u(`GET`,`/api/sessions?project=${e}`),enabled:e!==void 0})}var wn={queryKey:[`sessions`,`all`],queryFn:()=>u(`GET`,`/api/sessions`)};function Tn(e=!0){return s({...wn,enabled:e})}function En(e){return e.fetchQuery(wn)}function Dn(){return s({queryKey:[`config`],queryFn:()=>u(`GET`,`/api/config`)})}function On(e){return s({queryKey:[`repo-branches`,e],queryFn:()=>u(`GET`,`/api/repos/${e}/branches`),enabled:e!==void 0,staleTime:3e4})}function kn(e){return s({queryKey:[`repo-worktrees`,e],queryFn:()=>u(`GET`,`/api/repos/${e}/worktrees`),enabled:e!==void 0,staleTime:1e4})}function An(e,t){let n=i();return o({mutationFn:t=>u(`DELETE`,`/api/repos/${e}/worktrees?path=${encodeURIComponent(t)}`),onSuccess:r=>{n.setQueryData([`repo-worktrees`,e],r),n.invalidateQueries({queryKey:[`project`,t]})}})}function jn(e,t){let n=i();return o({mutationFn:({name:t,confirm:n})=>{let r=new URLSearchParams({name:t});return n&&r.set(`confirm`,`1`),u(`DELETE`,`/api/repos/${e}/branches?${r.toString()}`)},onSuccess:r=>{n.setQueryData([`repo-worktrees`,e],r),n.invalidateQueries({queryKey:[`project`,t]})}})}function Mn(e){return s({queryKey:[`fs-dirs`,e],queryFn:()=>u(`GET`,`/api/fs/dirs?prefix=${encodeURIComponent(e)}`),enabled:e.startsWith(`/`)||e.startsWith(`~`),placeholderData:e=>e,staleTime:1e4})}function Nn(){return s({queryKey:[`version`],queryFn:()=>u(`GET`,`/api/version`),staleTime:1/0})}function Pn(){return s({queryKey:[`host`],queryFn:()=>u(`GET`,`/api/host`),staleTime:1/0})}function Fn(e){return e?e.displayName||e.hostname:void 0}function In(){return s({queryKey:[`agents`],queryFn:()=>u(`GET`,`/api/agents`),staleTime:3e4,refetchOnWindowFocus:!0})}function Ln(){let e=i();return o({mutationFn:e=>u(`POST`,`/api/profiles`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`profiles`]})})}function Rn(e){let t=i();return o({mutationFn:t=>u(`PATCH`,`/api/profiles/${e}/settings`,t),onSuccess:n=>t.setQueryData([`profile-settings`,e],n)})}function zn(){let e=i();return o({mutationFn:({id:e,...t})=>u(`PATCH`,`/api/profiles/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`profiles`]})})}function Bn(){let e=i();return o({mutationFn:({id:e,...t})=>u(`PATCH`,`/api/accounts/${e}`,t),onSuccess:t=>{e.invalidateQueries({queryKey:[`accounts`,t.profile_id]}),e.invalidateQueries({queryKey:[`account-usage`,t.id]})}})}function Vn(){let e=i();return o({mutationFn:e=>u(`DELETE`,`/api/profiles/${e}`),onSuccess:()=>e.clear()})}function Hn(){let e=i();return o({mutationFn:e=>u(`DELETE`,`/api/accounts/${e}`),onSuccess:()=>void e.invalidateQueries({queryKey:[`accounts`]})})}function Un(){let e=i();return o({mutationFn:e=>u(`POST`,`/api/accounts`,e),onSuccess:t=>void e.invalidateQueries({queryKey:[`accounts`,t.profile_id]})})}function Wn(){return o({mutationFn:e=>u(`POST`,`/api/accounts/${e}/login`)})}function Gn(){let e=i();return o({mutationFn:e=>u(`POST`,`/api/repos`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function Kn(){let e=i();return o({mutationFn:({id:e,...t})=>u(`PATCH`,`/api/repos/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function qn(){let e=i();return o({mutationFn:e=>u(`POST`,`/api/repos/${e}/fetch`),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function Jn(){let e=i();return o({mutationFn:e=>u(`POST`,`/api/projects`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`projects`]})})}function Yn(){let e=i();return o({mutationFn:({id:e,...t})=>u(`PATCH`,`/api/projects/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`projects`]})})}function Xn(e,t){return s({queryKey:[`scratchpad`,e,t??`none`],queryFn:()=>u(`GET`,`/api/scratchpad?profile=${e}${t?`&project=${t}`:``}`),enabled:e!==void 0})}function Zn(){let e=i();return o({mutationFn:e=>u(`POST`,`/api/scratchpad`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function Qn(){let e=i();return o({mutationFn:({id:e,...t})=>u(`PATCH`,`/api/scratchpad/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function $n(){let e=i();return o({mutationFn:e=>u(`DELETE`,`/api/scratchpad/${e}`),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function er(e,t){return s({queryKey:[`layouts`,e,t??`none`],queryFn:()=>u(`GET`,`/api/layouts?profile=${e}${t?`&project=${t}`:``}`),enabled:e!==void 0})}function tr(){let e=i();return o({mutationFn:e=>u(`POST`,`/api/layouts`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`layouts`]})})}function nr(){let e=i();return o({mutationFn:({id:e,...t})=>u(`PATCH`,`/api/layouts/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`layouts`]})})}function rr(){let e=i();return o({mutationFn:e=>u(`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 ir(){let e=i();return o({mutationFn:e=>u(`POST`,`/api/sessions`,e),onSuccess:t=>$(e,t)})}function ar(e){let t=i();return o({mutationFn:t=>u(`POST`,`/api/sessions/${t}/${e}`),onSuccess:e=>$(t,e)})}function or(){let e=i();return o({mutationFn:({sessionId:e,accountId:t})=>u(`POST`,`/api/sessions/${e}/migrate`,{account_id:t}),onSuccess:t=>$(e,t)})}function sr(){let e=i();return o({mutationFn:({sessionId:e,accountId:t})=>u(`POST`,`/api/sessions/${e}/handoff`,{account_id:t}),onSuccess:(t,{sessionId:n})=>{$(e,t),e.invalidateQueries({queryKey:[`session`,n]})}})}function cr(){let e=i();return o({mutationFn:e=>u(`POST`,`/api/sessions/${e}/archive`),onSuccess:t=>$(e,t)})}function lr(){let e=i();return o({mutationFn:e=>u(`POST`,`/api/sessions/${e}/unarchive`),onSuccess:t=>$(e,t)})}function ur(){let e=i();return o({mutationFn:({sessionId:e,title:t})=>u(`PATCH`,`/api/sessions/${e}`,{title:t}),onSuccess:t=>$(e,t)})}function dr(){let e=i();return o({mutationFn:e=>u(`PATCH`,`/api/config`,e),onSuccess:(t,n)=>{e.setQueryData([`config`],t),`displayName`in n&&e.invalidateQueries({queryKey:[`host`]})}})}async function fr(e){try{return await u(`GET`,`/api/profiles/${e}/state`)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`no_state`)return null;throw e}}function pr(e,t){return u(`PUT`,`/api/profiles/${e}/state`,{ui_state:t})}function mr(e,t){return s({queryKey:[`ports`,e],queryFn:()=>u(`GET`,`/api/sessions/${e}/ports`),enabled:e!==void 0&&t,refetchInterval:a(5e3),refetchIntervalInBackground:!1})}function hr(e,t){return s({queryKey:[`session-env`,e],queryFn:()=>u(`GET`,`/api/sessions/${e}/env`),enabled:e!==void 0&&t,refetchInterval:a(5e3),refetchIntervalInBackground:!1})}function gr(){let e=i();return o({mutationFn:e=>u(`DELETE`,`/api/sessions/${e}/env`),onSuccess:(t,n)=>{e.setQueryData([`session-env`,n],{vars:[]})}})}var _r=_(`folder-git-2`,[[`path`,{d:`M18 19a5 5 0 0 1-5-5v8`,key:`sz5oeg`}],[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]),vr=_(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]);function yr({id:e,value:t,onValueChange:n,onChoose:r,hints:i,placeholder:a,className:o,hintsClassName:s,autoFocus:c}){let[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)(0),p=e=>{n(e.value),r?.(e),u(!1)};return(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(un,{id:e,value:t,onChange:e=>{n(e.target.value),u(!0),f(0)},onFocus:()=>u(!0),onBlur:()=>u(!1),onKeyDown:e=>{if(!(!l||i.length===0))if(e.key===`ArrowDown`)e.preventDefault(),f(e=>(e+1)%i.length);else if(e.key===`ArrowUp`)e.preventDefault(),f(e=>(e-1+i.length)%i.length);else if(e.key===`Enter`||e.key===`Tab`){let t=i[d]??i[0];t&&(e.preventDefault(),p(t))}else e.key===`Escape`&&(e.stopPropagation(),u(!1))},placeholder:a,className:o,autoComplete:`off`,spellCheck:!1,autoFocus:c}),l&&i.length>0&&(0,Q.jsx)(`ul`,{className:g(`absolute top-full z-10 mt-1 max-h-56 overflow-y-auto rounded-md bg-elevated p-1 shadow-xl`,s??`w-full`),children:i.map((e,t)=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`button`,{type:`button`,onMouseDown:t=>{t.preventDefault(),p(e)},onMouseEnter:()=>f(t),className:g(`relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm text-fg outline-none transition-colors`,`data-[selected=true]:bg-action data-[selected=true]:text-action-ink data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50`,`w-full font-mono text-xs`),"data-selected":t===d,children:[(0,Q.jsx)(`span`,{className:`truncate`,children:e.label??e.value}),e.badge&&(0,Q.jsx)(`span`,{className:`ml-auto shrink-0 text-2xs opacity-70`,children:e.badge})]})},e.value))})]})}function br(e){l.error(xr(e),{id:`err:${xr(e)}`})}function xr(e){return e instanceof Error&&e.message.trim()!==``?e.message:typeof e==`string`&&e.trim()!==``?e:`Something went wrong`}var Sr=(0,v.lazy)(()=>c(()=>import(`./Terminal-DhuY0ChG.js`).then(e=>({default:e.Terminal})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]))),Cr=null;async function wr(){Cr=(await c(()=>import(`./Terminal-DhuY0ChG.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]))).Terminal}function Tr(e){return Cr?(0,Q.jsx)(Cr,{...e}):(0,Q.jsx)(v.Suspense,{fallback:(0,Q.jsx)(`div`,{className:`size-full bg-ground`}),children:(0,Q.jsx)(Sr,{...e})})}export{kn as $,$n as A,nr as B,Zn as C,jn as D,Hn as E,er as F,Qn as G,Rn as H,Wn as I,Sn as J,_n as K,or as L,qn as M,sr as N,rr as O,Pn as P,On as Q,Bn as R,Gn as S,Nn as T,Yn as U,zn as V,Kn as W,An as X,xn as Y,ur as Z,Dn as _,tn as _t,vr as a,Cn as at,Ln as b,fr as c,un as ct,yn as d,ln as dt,bn as et,vn as f,cn as ft,gr as g,rn as gt,cr as h,an as ht,yr as i,mr as it,Mn as j,Vn as k,Fn as l,dn as lt,Tn as m,nn as mt,wr as n,ar as nt,_r as o,lr as ot,In as p,sn as pt,gn as q,br as r,hr as rt,En as s,hn as st,Tr as t,Xn as tt,pr as u,on as ut,Un as v,zt as vt,ir as w,Jn as x,tr as y,It as yt,dr as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{a as n,s as r,t as i}from"./buffer-store-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{a as n,s as r,t as i}from"./buffer-store-DNAdK8WD.js";var a=e(t(),1);function o({buffers:e}){let t=(0,a.useRef)(new Set);return(0,a.useEffect)(()=>{let a=new Set(e.map(e=>i(e.session,e.path,e.root))),o=t.current;for(let e of a)o.has(e)||(r(e),o.add(e));for(let e of[...o])a.has(e)||(n(e),o.delete(e))},[e]),(0,a.useEffect)(()=>()=>{for(let e of t.current)n(e);t.current.clear()},[]),null}export{o as ModelRefcount};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{c as r,f as i,g as a}from"./hotkeys-aKIAG8uQ.js";import{C as o,D as s,E as c,T as l,c as u,f as d,i as f,m as p,n as m,p as h,s as g,t as _,w as v,x as y,y as b}from"./preview-kind-CT1bv1az.js";import{t as x}from"./preload-helper-Czpn1I53.js";import{S,r as C,t as ee}from"./api-B3lAdmrV.js";import{t as te}from"./createLucideIcon-DyMAgLa3.js";import{A as ne,H as re,U as ie,W as ae,a as oe,k as se}from"./index-XKVW8P77.js";import{i as ce,r as le}from"./editor.api2-4X9Vh9Zw.js";import{a as ue,c as de,d as w,f as fe,i as pe,l as me,n as he,o as ge,r as _e,s as ve,t as ye,u as be}from"./buffer-store-CcaCClCj.js";import{a as T,c as xe,i as Se,l as Ce,n as we,o as Te,r as Ee,s as De}from"./editor-sync-BFRyMqUU.js";import{r as Oe}from"./buffer-logic-BrpRsL1b.js";var ke=te(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),E=e(t(),1);function Ae(e){return!e}function je(e){let t=e.split(`+`),n=t.pop()??``,r=0;for(let e of t)e===`meta`?r|=ce.CtrlCmd:e===`ctrl`?r|=ce.WinCtrl:e===`alt`?r|=ce.Alt:e===`shift`&&(r|=ce.Shift);let i=le[/^Key[A-Z]$/.test(n)?`Key${n.slice(3)}`:/^Digit[0-9]$/.test(n)?`Digit${n.slice(5)}`:n];return typeof i==`number`?r|i:null}function Me(e,t){let n=je(r(`editor.save`));n!==null&&e.addCommand(n,()=>t.onSave());let i=je(r(`editor.wordWrap`));e.addAction({id:`puddle.toggleWordWrap`,label:`Toggle Word Wrap`,keybindings:i===null?[]:[i],run:()=>ie({editorWordWrap:Ae(re().editorWordWrap)})})}function Ne(e,t,n,r){let i=ye(e,t,r),a=s(e,t,{root:r}),o=l(e,r),[c,u]=(0,E.useState)(null),[d,f]=(0,E.useState)(!1),p=(0,E.useRef)(!1),m=(0,E.useRef)(null),h=(0,E.useRef)(null),g=(0,E.useRef)(n);g.current=n;let _=(0,E.useRef)(!1),v=(0,E.useCallback)((e,t)=>{h.current?.cancel(),_.current=!0;try{ge(i,e,t)}finally{_.current=!1}},[i]),y=(0,E.useSyncExternalStore)((0,E.useCallback)(e=>me(i,e),[i]),()=>_e(i)),b=(0,E.useSyncExternalStore)((0,E.useCallback)(e=>Te(i,e),[i]),()=>T(i));(0,E.useEffect)(()=>{let n=a.data;if(!n||n.binary||n.content===null||p.current)return;p.current=!0;let o=de(i)!==void 0,s=he(e,t,n.content,n.mtime_ms,r);u(s),!o&&Ce(e,t,r).then(e=>{e&&(e.base_mtime_ms===n.mtime_ms?Oe(s,e.content)&&f(!0):S(`This file has an unsaved draft from an earlier version.`,{description:`The file changed on disk since the draft was saved.`,duration:12e3,action:{label:`Restore draft`,onClick:()=>{Oe(s,e.content)&&f(!0)}}}))})},[a.data,i,e,t,r]),(0,E.useEffect)(()=>{if(!c)return;let n=xe(e,t,r);h.current=n;let a=c.onDidChangeContent(()=>{_.current||(n(c.getValue(),de(i)??0),we(e,t,r))});return()=>{n.flush(),a.dispose(),h.current=null}},[c,i,e,t,r]),(0,E.useEffect)(()=>{!c||!b.savedElsewhere||_e(i)||a.refetch().then(e=>{_e(i)||(e.data&&e.data.content!==null&&v(e.data.content,e.data.mtime_ms),Se(i))})},[b.savedElsewhere,c,i]),(0,E.useEffect)(()=>{let e=a.data;!c||!e||e.content===null||!_e(i)&&e.mtime_ms!==de(i)&&v(e.content,e.mtime_ms)},[a.data,c,i]);let x=(0,E.useCallback)((n,a)=>{pe(i,n,a),h.current?.cancel(),De(e,t,r),Ee(e,t,a,r),f(!1)},[i,e,t,r]),C=(0,E.useCallback)(()=>{a.refetch().then(n=>{n.data&&n.data.content!==null&&v(n.data.content,n.data.mtime_ms),De(e,t,r),f(!1)})},[i,e,t,v]),te=(0,E.useCallback)((e,n)=>{o.mutate({path:t,content:e},{onSuccess:e=>x(n,e.mtime_ms),onError:e=>S.error(e instanceof Error?e.message:`Overwrite failed`)})},[o,t,x]),ne=(0,E.useCallback)(()=>{if(!c||!_e(i))return;let e=c.getValue(),n=c.getAlternativeVersionId();o.mutate({path:t,content:e,expected_mtime_ms:de(i)},{onSuccess:e=>x(n,e.mtime_ms),onError:t=>{t instanceof ee&&t.status===409&&t.code===`stale_file`?S.error(`File changed on disk (probably the agent)`,{duration:1/0,action:{label:`Reload`,onClick:()=>C()},cancel:{label:`Overwrite`,onClick:()=>te(e,n)}}):S.error(t instanceof Error?t.message:`Save failed`)}})},[c,i,o,t,x,C,te]),re=(0,E.useRef)(ne);re.current=ne;let ie=(0,E.useCallback)(()=>{let n=m.current,i=g.current;r===void 0&&(!n||!i||i.session!==e||i.path!==t||(n.revealLineInCenter(i.line),n.setPosition({lineNumber:i.line,column:i.column??1}),n.focus()))},[e,t,r]),ae=(0,E.useCallback)(e=>{m.current=e,Me(e,{onSave:()=>re.current()}),ie()},[ie]);(0,E.useEffect)(()=>{ie()},[n,c,ie]);let oe=(0,E.useCallback)(()=>{C()},[C]),se,ce=null;a.data?.binary?se=`binary`:a.error?a.error instanceof ee&&a.error.status===413?se=`too-large`:(se=`error`,ce=a.error instanceof Error?a.error.message:`Failed to load file`):se=c?`ready`:`loading`;let le=y&&b.savedElsewhere?`saved-elsewhere`:y&&b.dirtyElsewhere?`dirty-elsewhere`:null;return{status:se,errorMessage:ce,model:c,dirty:y,restoredNotice:d,discardRestore:oe,peerBadge:le,save:ne,onMount:ae}}var D=n();function Pe({message:e,session:t,path:n,root:r,download:i}){return(0,D.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 bg-ground text-sm text-fg-muted`,children:[(0,D.jsx)(`span`,{children:e}),i&&(0,D.jsxs)(`button`,{type:`button`,onClick:()=>void b(t,n,r).catch(e=>S.error(e instanceof Error?e.message:`Download failed`)),className:`flex items-center gap-1.5 text-fg-secondary transition-colors hover:text-fg`,children:[(0,D.jsx)(ke,{className:`size-4`}),`Download`]})]})}function Fe({session:e,path:t,reveal:n,root:r}){let i=ae(),a=Ne(e,t,n,r),o=(0,E.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);if(a.status===`binary`)return(0,D.jsx)(Pe,{message:`Binary file — use Download`,session:e,path:t,root:r,download:!0});if(a.status===`too-large`)return(0,D.jsx)(Pe,{message:`File too large to edit — use Download`,session:e,path:t,root:r,download:!0});if(a.status===`error`)return(0,D.jsx)(Pe,{message:a.errorMessage??`Failed to load file`,session:e,path:t,root:r});let s=a.peerBadge===`saved-elsewhere`?`Saved in another window`:a.peerBadge===`dirty-elsewhere`?`Also being edited in another window`:null;return(0,D.jsxs)(`div`,{className:`flex h-full flex-col bg-ground`,children:[a.restoredNotice&&(0,D.jsxs)(`div`,{className:`flex items-center gap-3 bg-elevated px-3 py-1.5 text-xs text-fg-secondary`,children:[(0,D.jsx)(`span`,{children:`Restored unsaved changes`}),(0,D.jsx)(`button`,{type:`button`,onClick:a.discardRestore,className:`text-fg-muted transition-colors hover:text-fg`,children:`Discard`})]}),s&&(0,D.jsx)(`div`,{className:`bg-surface px-3 py-1 text-xs text-fg-muted`,children:s}),(0,D.jsx)(`div`,{className:`min-h-0 flex-1`,children:a.model&&(0,D.jsx)(w,{path:a.model.uri.toString(),defaultValue:a.model.getValue(),theme:`puddle`,keepCurrentModel:!0,onMount:e=>a.onMount(e),loading:(0,D.jsx)(`div`,{className:`p-3 text-xs text-fg-muted`,children:`…`}),options:{automaticLayout:!0,fontFamily:o,fontSize:i.editorFontSize,tabSize:i.editorTabSize,wordWrap:i.editorWordWrap?`on`:`off`,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})})]})}function Ie({children:e}){return(0,D.jsx)(`div`,{className:`flex h-full items-center justify-center px-4 text-xs text-fg-muted`,children:e})}function Le(e,t){let n=(0,E.useRef)(t);n.current=t,(0,E.useEffect)(()=>(ve(e),()=>{n.current?.(),ue(e)}),[e])}function Re(e,t,n,r){let i=r.split(`/`).map(encodeURIComponent).join(`/`);return`${e}://${encodeURIComponent(t)}/${encodeURIComponent(n)}/${i}`}function ze({session:e,refName:t,path:n,content:r}){let i=ae(),a=(0,E.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);return(0,D.jsx)(w,{path:Re(`puddle-view`,e,t,n),defaultValue:r,theme:be,loading:(0,D.jsx)(Ie,{children:`…`}),options:{readOnly:!0,automaticLayout:!0,fontFamily:a,fontSize:i.editorFontSize,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})}function Be({session:e,against:t,path:n}){let r=v(e,t,n);return r.isPending?(0,D.jsx)(Ie,{children:`…`}):r.error?(0,D.jsx)(Ie,{children:r.error instanceof Error?r.error.message:`Failed to load`}):r.data.binary?(0,D.jsx)(Ie,{children:`Binary file — deleted`}):(0,D.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,D.jsx)(`div`,{className:`bg-surface px-4 py-1 text-xs text-fg-muted`,children:`Deleted`}),(0,D.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,D.jsx)(ze,{session:e,refName:t,path:n,content:r.data.content??``})})]})}function Ve({session:e,against:t,path:n,basePath:r}){let i=ae(),a=Ne(e,n,null),o=v(e,t,r),s=(0,E.useRef)(null);Le(ye(e,n),()=>{let e=s.current;if(!e)return;let t=e.getModel();e.setModel(null),t?.original.dispose(),s.current=null});let c=(0,E.useRef)(a.save);c.current=a.save;let l=(0,E.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]),u=o.error instanceof ee&&o.error.status===404;return a.status===`binary`||o.data?.binary?(0,D.jsx)(Ie,{children:`Binary file`}):a.status===`too-large`?(0,D.jsx)(Ie,{children:`File too large to show`}):a.status===`error`?(0,D.jsx)(Ie,{children:a.errorMessage??`Failed to load file`}):u?(0,D.jsx)(Fe,{session:e,path:n,reveal:null}):o.isPending||!a.model?(0,D.jsx)(Ie,{children:`…`}):o.error?(0,D.jsx)(Ie,{children:o.error instanceof Error?o.error.message:`Failed to load base`}):(0,D.jsx)(fe,{modifiedModelPath:a.model.uri.toString(),originalModelPath:Re(`puddle-base`,e,t,r),original:o.data.content??``,language:a.model.getLanguageId(),theme:be,keepCurrentModifiedModel:!0,loading:(0,D.jsx)(Ie,{children:`…`}),onMount:e=>{s.current=e,e.onDidDispose(()=>{s.current=null}),e.getModifiedEditor().addCommand(ce.CtrlCmd|le.KeyS,()=>c.current())},options:{readOnly:!1,originalEditable:!1,renderSideBySide:!0,automaticLayout:!0,fontFamily:l,fontSize:i.editorFontSize,wordWrap:i.editorWordWrap?`on`:`off`,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})}function He({session:e,path:t}){return Le(ye(e,t)),(0,D.jsx)(Fe,{session:e,path:t,reveal:null})}function Ue({session:e,against:t,entry:n}){switch(n.status){case`added`:return(0,D.jsx)(He,{session:e,path:n.path});case`deleted`:return(0,D.jsx)(Be,{session:e,against:t,path:n.path});case`modified`:case`renamed`:return(0,D.jsx)(Ve,{session:e,against:t,path:n.path,basePath:n.old_path??n.path});default:return null}}function We({session:e,sha:t,path:n}){let r=v(e,t,n);return r.isPending?(0,D.jsx)(Ie,{children:`…`}):r.error?(0,D.jsx)(Ie,{children:r.error instanceof Error?r.error.message:`Failed to load file`}):r.data.binary?(0,D.jsx)(Ie,{children:`Binary file`}):(0,D.jsx)(ze,{session:e,refName:t,path:n,content:r.data.content??``})}function Ge({session:e,originalRef:t,originalPath:n,originalContent:r,modifiedRef:i,modifiedPath:a,modifiedContent:o}){let s=ae(),c=(0,E.useRef)(null),l=(0,E.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);return(0,E.useEffect)(()=>()=>{let e=c.current;if(!e)return;let t=e.getModel();e.setModel(null),t?.original.dispose(),t?.modified.dispose(),c.current=null},[]),(0,D.jsx)(fe,{originalModelPath:Re(`puddle-hist-orig`,e,t,n),modifiedModelPath:Re(`puddle-hist-mod`,e,i,a),original:r,modified:o,theme:be,keepCurrentOriginalModel:!0,keepCurrentModifiedModel:!0,loading:(0,D.jsx)(Ie,{children:`…`}),onMount:e=>{c.current=e,e.onDidDispose(()=>{c.current=null})},options:{readOnly:!0,originalEditable:!1,renderSideBySide:!0,automaticLayout:!0,fontFamily:l,fontSize:s.editorFontSize,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})}function Ke({session:e,sha:t,path:n,basePath:r}){let i=v(e,`${t}^`,r),a=v(e,t,n);return i.error instanceof ee&&i.error.status===404?(0,D.jsx)(We,{session:e,sha:t,path:n}):i.isPending||a.isPending?(0,D.jsx)(Ie,{children:`…`}):i.error?(0,D.jsx)(Ie,{children:i.error instanceof Error?i.error.message:`Failed to load original`}):a.error?(0,D.jsx)(Ie,{children:a.error instanceof Error?a.error.message:`Failed to load file`}):i.data.binary||a.data.binary?(0,D.jsx)(Ie,{children:`Binary file`}):(0,D.jsx)(Ge,{session:e,originalRef:`${t}^`,originalPath:r,originalContent:i.data.content??``,modifiedRef:t,modifiedPath:n,modifiedContent:a.data.content??``})}function qe({session:e,sha:t,entry:n,isRootCommit:r}){switch(p(n.status,r)){case`added`:return(0,D.jsx)(We,{session:e,sha:t,path:n.path});case`deleted`:return(0,D.jsx)(Be,{session:e,against:`${t}^`,path:n.path});case`modified`:case`renamed`:return(0,D.jsx)(Ke,{session:e,sha:t,path:n.path,basePath:n.old_path??n.path});default:return null}}function Je({session:e,sha:t,path:n}){let r=o(e,t);if(r.isPending)return(0,D.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:`Loading commit…`});if(r.error)return(0,D.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:r.error instanceof Error?r.error.message:`Failed to load commit`});let i=r.data.files.find(e=>e.path===n);return i?(0,D.jsx)(`div`,{className:`h-full`,children:(0,D.jsx)(qe,{session:e,sha:t,entry:i,isRootCommit:r.data.parents.length===0})}):(0,D.jsxs)(`div`,{className:`flex h-full items-center justify-center px-4 text-center text-xs text-fg-muted`,children:[(0,D.jsx)(`span`,{className:`font-mono`,children:n}),` is not part of `,t.slice(0,7),`.`]})}function Ye({session:e,path:t}){let n=c(e);if(n.isPending)return(0,D.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:`Loading diff…`});if(n.error)return(0,D.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:n.error instanceof Error?n.error.message:`Failed to load diff`});let r=n.data.entries.find(e=>e.path===t);return r?(0,D.jsx)(`div`,{className:`h-full`,children:(0,D.jsx)(Ue,{session:e,against:n.data.against,entry:r})}):(0,D.jsxs)(`div`,{className:`flex h-full items-center justify-center px-4 text-center text-xs text-fg-muted`,children:[`No changes to `,(0,D.jsx)(`span`,{className:`mx-1 font-mono`,children:t}),` against the base.`]})}var Xe=800;function Ze({name:e}){let t=ae(),n=a(),r=h(n,e),o=i(`editor.save`),s=(0,E.useRef)(null),c=(0,E.useRef)(null),l=(0,E.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);if((0,E.useEffect)(()=>{if(n===null)return;let t=oe(t=>{d(n,e,t).catch(e=>S.error(e instanceof Error?e.message:`Draft not saved`))},Xe);return c.current=t,()=>{t.flush(),c.current=null}},[n,e]),n===null)return null;if(r.error)return(0,D.jsx)(`div`,{className:`flex h-full items-center justify-center bg-ground text-sm text-fg-muted`,children:r.error instanceof Error?r.error.message:`Failed to load the draft`});if(r.data===void 0)return(0,D.jsx)(`div`,{className:`p-3 text-xs text-fg-muted`,children:`…`});let f=()=>{let t=s.current;t&&(c.current?.flush(),u({name:e,content:t.getValue()}))};return(0,D.jsxs)(`div`,{className:`flex h-full flex-col bg-ground`,children:[(0,D.jsxs)(`div`,{className:`bg-surface px-3 py-1 text-xs text-fg-muted`,children:[`Draft — not in any worktree; `,o,` saves it into one`]}),(0,D.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,D.jsx)(w,{path:`puddle-untitled://${n}/${e}`,defaultValue:r.data.content,theme:be,keepCurrentModel:!1,loading:(0,D.jsx)(`div`,{className:`p-3 text-xs text-fg-muted`,children:`…`}),onMount:t=>{s.current=t,g(e,t.getValue()),Me(t,{onSave:f})},onChange:t=>{let n=t??``;g(e,n),c.current?.(n)},options:{automaticLayout:!0,fontFamily:l,fontSize:t.editorFontSize,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})})]})}function Qe(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function $e(e){if(Array.isArray(e))return e}function et(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function tt(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{c as r,f as i,g as a}from"./hotkeys-aKIAG8uQ.js";import{C as o,D as s,E as c,T as l,c as u,f as d,i as f,m as p,n as m,p as h,s as g,t as _,w as v,x as y,y as b}from"./preview-kind-CT1bv1az.js";import{t as x}from"./preload-helper-Czpn1I53.js";import{S,r as C,t as ee}from"./api-B3lAdmrV.js";import{t as te}from"./createLucideIcon-DyMAgLa3.js";import{A as ne,H as re,U as ie,W as ae,a as oe,k as se}from"./index-nIiWlIeN.js";import{i as ce,r as le}from"./editor.api2-4X9Vh9Zw.js";import{a as ue,c as de,d as w,f as fe,i as pe,l as me,n as he,o as ge,r as _e,s as ve,t as ye,u as be}from"./buffer-store-DNAdK8WD.js";import{a as T,c as xe,i as Se,l as Ce,n as we,o as Te,r as Ee,s as De}from"./editor-sync-CMMUUNfm.js";import{r as Oe}from"./buffer-logic-BrpRsL1b.js";var ke=te(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),E=e(t(),1);function Ae(e){return!e}function je(e){let t=e.split(`+`),n=t.pop()??``,r=0;for(let e of t)e===`meta`?r|=ce.CtrlCmd:e===`ctrl`?r|=ce.WinCtrl:e===`alt`?r|=ce.Alt:e===`shift`&&(r|=ce.Shift);let i=le[/^Key[A-Z]$/.test(n)?`Key${n.slice(3)}`:/^Digit[0-9]$/.test(n)?`Digit${n.slice(5)}`:n];return typeof i==`number`?r|i:null}function Me(e,t){let n=je(r(`editor.save`));n!==null&&e.addCommand(n,()=>t.onSave());let i=je(r(`editor.wordWrap`));e.addAction({id:`puddle.toggleWordWrap`,label:`Toggle Word Wrap`,keybindings:i===null?[]:[i],run:()=>ie({editorWordWrap:Ae(re().editorWordWrap)})})}function Ne(e,t,n,r){let i=ye(e,t,r),a=s(e,t,{root:r}),o=l(e,r),[c,u]=(0,E.useState)(null),[d,f]=(0,E.useState)(!1),p=(0,E.useRef)(!1),m=(0,E.useRef)(null),h=(0,E.useRef)(null),g=(0,E.useRef)(n);g.current=n;let _=(0,E.useRef)(!1),v=(0,E.useCallback)((e,t)=>{h.current?.cancel(),_.current=!0;try{ge(i,e,t)}finally{_.current=!1}},[i]),y=(0,E.useSyncExternalStore)((0,E.useCallback)(e=>me(i,e),[i]),()=>_e(i)),b=(0,E.useSyncExternalStore)((0,E.useCallback)(e=>Te(i,e),[i]),()=>T(i));(0,E.useEffect)(()=>{let n=a.data;if(!n||n.binary||n.content===null||p.current)return;p.current=!0;let o=de(i)!==void 0,s=he(e,t,n.content,n.mtime_ms,r);u(s),!o&&Ce(e,t,r).then(e=>{e&&(e.base_mtime_ms===n.mtime_ms?Oe(s,e.content)&&f(!0):S(`This file has an unsaved draft from an earlier version.`,{description:`The file changed on disk since the draft was saved.`,duration:12e3,action:{label:`Restore draft`,onClick:()=>{Oe(s,e.content)&&f(!0)}}}))})},[a.data,i,e,t,r]),(0,E.useEffect)(()=>{if(!c)return;let n=xe(e,t,r);h.current=n;let a=c.onDidChangeContent(()=>{_.current||(n(c.getValue(),de(i)??0),we(e,t,r))});return()=>{n.flush(),a.dispose(),h.current=null}},[c,i,e,t,r]),(0,E.useEffect)(()=>{!c||!b.savedElsewhere||_e(i)||a.refetch().then(e=>{_e(i)||(e.data&&e.data.content!==null&&v(e.data.content,e.data.mtime_ms),Se(i))})},[b.savedElsewhere,c,i]),(0,E.useEffect)(()=>{let e=a.data;!c||!e||e.content===null||!_e(i)&&e.mtime_ms!==de(i)&&v(e.content,e.mtime_ms)},[a.data,c,i]);let x=(0,E.useCallback)((n,a)=>{pe(i,n,a),h.current?.cancel(),De(e,t,r),Ee(e,t,a,r),f(!1)},[i,e,t,r]),C=(0,E.useCallback)(()=>{a.refetch().then(n=>{n.data&&n.data.content!==null&&v(n.data.content,n.data.mtime_ms),De(e,t,r),f(!1)})},[i,e,t,v]),te=(0,E.useCallback)((e,n)=>{o.mutate({path:t,content:e},{onSuccess:e=>x(n,e.mtime_ms),onError:e=>S.error(e instanceof Error?e.message:`Overwrite failed`)})},[o,t,x]),ne=(0,E.useCallback)(()=>{if(!c||!_e(i))return;let e=c.getValue(),n=c.getAlternativeVersionId();o.mutate({path:t,content:e,expected_mtime_ms:de(i)},{onSuccess:e=>x(n,e.mtime_ms),onError:t=>{t instanceof ee&&t.status===409&&t.code===`stale_file`?S.error(`File changed on disk (probably the agent)`,{duration:1/0,action:{label:`Reload`,onClick:()=>C()},cancel:{label:`Overwrite`,onClick:()=>te(e,n)}}):S.error(t instanceof Error?t.message:`Save failed`)}})},[c,i,o,t,x,C,te]),re=(0,E.useRef)(ne);re.current=ne;let ie=(0,E.useCallback)(()=>{let n=m.current,i=g.current;r===void 0&&(!n||!i||i.session!==e||i.path!==t||(n.revealLineInCenter(i.line),n.setPosition({lineNumber:i.line,column:i.column??1}),n.focus()))},[e,t,r]),ae=(0,E.useCallback)(e=>{m.current=e,Me(e,{onSave:()=>re.current()}),ie()},[ie]);(0,E.useEffect)(()=>{ie()},[n,c,ie]);let oe=(0,E.useCallback)(()=>{C()},[C]),se,ce=null;a.data?.binary?se=`binary`:a.error?a.error instanceof ee&&a.error.status===413?se=`too-large`:(se=`error`,ce=a.error instanceof Error?a.error.message:`Failed to load file`):se=c?`ready`:`loading`;let le=y&&b.savedElsewhere?`saved-elsewhere`:y&&b.dirtyElsewhere?`dirty-elsewhere`:null;return{status:se,errorMessage:ce,model:c,dirty:y,restoredNotice:d,discardRestore:oe,peerBadge:le,save:ne,onMount:ae}}var D=n();function Pe({message:e,session:t,path:n,root:r,download:i}){return(0,D.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 bg-ground text-sm text-fg-muted`,children:[(0,D.jsx)(`span`,{children:e}),i&&(0,D.jsxs)(`button`,{type:`button`,onClick:()=>void b(t,n,r).catch(e=>S.error(e instanceof Error?e.message:`Download failed`)),className:`flex items-center gap-1.5 text-fg-secondary transition-colors hover:text-fg`,children:[(0,D.jsx)(ke,{className:`size-4`}),`Download`]})]})}function Fe({session:e,path:t,reveal:n,root:r}){let i=ae(),a=Ne(e,t,n,r),o=(0,E.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);if(a.status===`binary`)return(0,D.jsx)(Pe,{message:`Binary file — use Download`,session:e,path:t,root:r,download:!0});if(a.status===`too-large`)return(0,D.jsx)(Pe,{message:`File too large to edit — use Download`,session:e,path:t,root:r,download:!0});if(a.status===`error`)return(0,D.jsx)(Pe,{message:a.errorMessage??`Failed to load file`,session:e,path:t,root:r});let s=a.peerBadge===`saved-elsewhere`?`Saved in another window`:a.peerBadge===`dirty-elsewhere`?`Also being edited in another window`:null;return(0,D.jsxs)(`div`,{className:`flex h-full flex-col bg-ground`,children:[a.restoredNotice&&(0,D.jsxs)(`div`,{className:`flex items-center gap-3 bg-elevated px-3 py-1.5 text-xs text-fg-secondary`,children:[(0,D.jsx)(`span`,{children:`Restored unsaved changes`}),(0,D.jsx)(`button`,{type:`button`,onClick:a.discardRestore,className:`text-fg-muted transition-colors hover:text-fg`,children:`Discard`})]}),s&&(0,D.jsx)(`div`,{className:`bg-surface px-3 py-1 text-xs text-fg-muted`,children:s}),(0,D.jsx)(`div`,{className:`min-h-0 flex-1`,children:a.model&&(0,D.jsx)(w,{path:a.model.uri.toString(),defaultValue:a.model.getValue(),theme:`puddle`,keepCurrentModel:!0,onMount:e=>a.onMount(e),loading:(0,D.jsx)(`div`,{className:`p-3 text-xs text-fg-muted`,children:`…`}),options:{automaticLayout:!0,fontFamily:o,fontSize:i.editorFontSize,tabSize:i.editorTabSize,wordWrap:i.editorWordWrap?`on`:`off`,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})})]})}function Ie({children:e}){return(0,D.jsx)(`div`,{className:`flex h-full items-center justify-center px-4 text-xs text-fg-muted`,children:e})}function Le(e,t){let n=(0,E.useRef)(t);n.current=t,(0,E.useEffect)(()=>(ve(e),()=>{n.current?.(),ue(e)}),[e])}function Re(e,t,n,r){let i=r.split(`/`).map(encodeURIComponent).join(`/`);return`${e}://${encodeURIComponent(t)}/${encodeURIComponent(n)}/${i}`}function ze({session:e,refName:t,path:n,content:r}){let i=ae(),a=(0,E.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);return(0,D.jsx)(w,{path:Re(`puddle-view`,e,t,n),defaultValue:r,theme:be,loading:(0,D.jsx)(Ie,{children:`…`}),options:{readOnly:!0,automaticLayout:!0,fontFamily:a,fontSize:i.editorFontSize,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})}function Be({session:e,against:t,path:n}){let r=v(e,t,n);return r.isPending?(0,D.jsx)(Ie,{children:`…`}):r.error?(0,D.jsx)(Ie,{children:r.error instanceof Error?r.error.message:`Failed to load`}):r.data.binary?(0,D.jsx)(Ie,{children:`Binary file — deleted`}):(0,D.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,D.jsx)(`div`,{className:`bg-surface px-4 py-1 text-xs text-fg-muted`,children:`Deleted`}),(0,D.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,D.jsx)(ze,{session:e,refName:t,path:n,content:r.data.content??``})})]})}function Ve({session:e,against:t,path:n,basePath:r}){let i=ae(),a=Ne(e,n,null),o=v(e,t,r),s=(0,E.useRef)(null);Le(ye(e,n),()=>{let e=s.current;if(!e)return;let t=e.getModel();e.setModel(null),t?.original.dispose(),s.current=null});let c=(0,E.useRef)(a.save);c.current=a.save;let l=(0,E.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]),u=o.error instanceof ee&&o.error.status===404;return a.status===`binary`||o.data?.binary?(0,D.jsx)(Ie,{children:`Binary file`}):a.status===`too-large`?(0,D.jsx)(Ie,{children:`File too large to show`}):a.status===`error`?(0,D.jsx)(Ie,{children:a.errorMessage??`Failed to load file`}):u?(0,D.jsx)(Fe,{session:e,path:n,reveal:null}):o.isPending||!a.model?(0,D.jsx)(Ie,{children:`…`}):o.error?(0,D.jsx)(Ie,{children:o.error instanceof Error?o.error.message:`Failed to load base`}):(0,D.jsx)(fe,{modifiedModelPath:a.model.uri.toString(),originalModelPath:Re(`puddle-base`,e,t,r),original:o.data.content??``,language:a.model.getLanguageId(),theme:be,keepCurrentModifiedModel:!0,loading:(0,D.jsx)(Ie,{children:`…`}),onMount:e=>{s.current=e,e.onDidDispose(()=>{s.current=null}),e.getModifiedEditor().addCommand(ce.CtrlCmd|le.KeyS,()=>c.current())},options:{readOnly:!1,originalEditable:!1,renderSideBySide:!0,automaticLayout:!0,fontFamily:l,fontSize:i.editorFontSize,wordWrap:i.editorWordWrap?`on`:`off`,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})}function He({session:e,path:t}){return Le(ye(e,t)),(0,D.jsx)(Fe,{session:e,path:t,reveal:null})}function Ue({session:e,against:t,entry:n}){switch(n.status){case`added`:return(0,D.jsx)(He,{session:e,path:n.path});case`deleted`:return(0,D.jsx)(Be,{session:e,against:t,path:n.path});case`modified`:case`renamed`:return(0,D.jsx)(Ve,{session:e,against:t,path:n.path,basePath:n.old_path??n.path});default:return null}}function We({session:e,sha:t,path:n}){let r=v(e,t,n);return r.isPending?(0,D.jsx)(Ie,{children:`…`}):r.error?(0,D.jsx)(Ie,{children:r.error instanceof Error?r.error.message:`Failed to load file`}):r.data.binary?(0,D.jsx)(Ie,{children:`Binary file`}):(0,D.jsx)(ze,{session:e,refName:t,path:n,content:r.data.content??``})}function Ge({session:e,originalRef:t,originalPath:n,originalContent:r,modifiedRef:i,modifiedPath:a,modifiedContent:o}){let s=ae(),c=(0,E.useRef)(null),l=(0,E.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);return(0,E.useEffect)(()=>()=>{let e=c.current;if(!e)return;let t=e.getModel();e.setModel(null),t?.original.dispose(),t?.modified.dispose(),c.current=null},[]),(0,D.jsx)(fe,{originalModelPath:Re(`puddle-hist-orig`,e,t,n),modifiedModelPath:Re(`puddle-hist-mod`,e,i,a),original:r,modified:o,theme:be,keepCurrentOriginalModel:!0,keepCurrentModifiedModel:!0,loading:(0,D.jsx)(Ie,{children:`…`}),onMount:e=>{c.current=e,e.onDidDispose(()=>{c.current=null})},options:{readOnly:!0,originalEditable:!1,renderSideBySide:!0,automaticLayout:!0,fontFamily:l,fontSize:s.editorFontSize,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})}function Ke({session:e,sha:t,path:n,basePath:r}){let i=v(e,`${t}^`,r),a=v(e,t,n);return i.error instanceof ee&&i.error.status===404?(0,D.jsx)(We,{session:e,sha:t,path:n}):i.isPending||a.isPending?(0,D.jsx)(Ie,{children:`…`}):i.error?(0,D.jsx)(Ie,{children:i.error instanceof Error?i.error.message:`Failed to load original`}):a.error?(0,D.jsx)(Ie,{children:a.error instanceof Error?a.error.message:`Failed to load file`}):i.data.binary||a.data.binary?(0,D.jsx)(Ie,{children:`Binary file`}):(0,D.jsx)(Ge,{session:e,originalRef:`${t}^`,originalPath:r,originalContent:i.data.content??``,modifiedRef:t,modifiedPath:n,modifiedContent:a.data.content??``})}function qe({session:e,sha:t,entry:n,isRootCommit:r}){switch(p(n.status,r)){case`added`:return(0,D.jsx)(We,{session:e,sha:t,path:n.path});case`deleted`:return(0,D.jsx)(Be,{session:e,against:`${t}^`,path:n.path});case`modified`:case`renamed`:return(0,D.jsx)(Ke,{session:e,sha:t,path:n.path,basePath:n.old_path??n.path});default:return null}}function Je({session:e,sha:t,path:n}){let r=o(e,t);if(r.isPending)return(0,D.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:`Loading commit…`});if(r.error)return(0,D.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:r.error instanceof Error?r.error.message:`Failed to load commit`});let i=r.data.files.find(e=>e.path===n);return i?(0,D.jsx)(`div`,{className:`h-full`,children:(0,D.jsx)(qe,{session:e,sha:t,entry:i,isRootCommit:r.data.parents.length===0})}):(0,D.jsxs)(`div`,{className:`flex h-full items-center justify-center px-4 text-center text-xs text-fg-muted`,children:[(0,D.jsx)(`span`,{className:`font-mono`,children:n}),` is not part of `,t.slice(0,7),`.`]})}function Ye({session:e,path:t}){let n=c(e);if(n.isPending)return(0,D.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:`Loading diff…`});if(n.error)return(0,D.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:n.error instanceof Error?n.error.message:`Failed to load diff`});let r=n.data.entries.find(e=>e.path===t);return r?(0,D.jsx)(`div`,{className:`h-full`,children:(0,D.jsx)(Ue,{session:e,against:n.data.against,entry:r})}):(0,D.jsxs)(`div`,{className:`flex h-full items-center justify-center px-4 text-center text-xs text-fg-muted`,children:[`No changes to `,(0,D.jsx)(`span`,{className:`mx-1 font-mono`,children:t}),` against the base.`]})}var Xe=800;function Ze({name:e}){let t=ae(),n=a(),r=h(n,e),o=i(`editor.save`),s=(0,E.useRef)(null),c=(0,E.useRef)(null),l=(0,E.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);if((0,E.useEffect)(()=>{if(n===null)return;let t=oe(t=>{d(n,e,t).catch(e=>S.error(e instanceof Error?e.message:`Draft not saved`))},Xe);return c.current=t,()=>{t.flush(),c.current=null}},[n,e]),n===null)return null;if(r.error)return(0,D.jsx)(`div`,{className:`flex h-full items-center justify-center bg-ground text-sm text-fg-muted`,children:r.error instanceof Error?r.error.message:`Failed to load the draft`});if(r.data===void 0)return(0,D.jsx)(`div`,{className:`p-3 text-xs text-fg-muted`,children:`…`});let f=()=>{let t=s.current;t&&(c.current?.flush(),u({name:e,content:t.getValue()}))};return(0,D.jsxs)(`div`,{className:`flex h-full flex-col bg-ground`,children:[(0,D.jsxs)(`div`,{className:`bg-surface px-3 py-1 text-xs text-fg-muted`,children:[`Draft — not in any worktree; `,o,` saves it into one`]}),(0,D.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,D.jsx)(w,{path:`puddle-untitled://${n}/${e}`,defaultValue:r.data.content,theme:be,keepCurrentModel:!1,loading:(0,D.jsx)(`div`,{className:`p-3 text-xs text-fg-muted`,children:`…`}),onMount:t=>{s.current=t,g(e,t.getValue()),Me(t,{onSave:f})},onChange:t=>{let n=t??``;g(e,n),c.current?.(n)},options:{automaticLayout:!0,fontFamily:l,fontSize:t.editorFontSize,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})})]})}function Qe(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function $e(e){if(Array.isArray(e))return e}function et(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function tt(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function nt(e,t){return $e(e)||et(e,t)||rt(e,t)||tt()}function rt(e,t){if(e){if(typeof e==`string`)return Qe(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qe(e,t):void 0}}var it=Object.entries,at=Object.setPrototypeOf,ot=Object.isFrozen,st=Object.getPrototypeOf,ct=Object.getOwnPropertyDescriptor,lt=Object.freeze,ut=Object.seal,dt=Object.create,ft=typeof Reflect<`u`&&Reflect,pt=ft.apply,mt=ft.construct;lt||=function(e){return e},ut||=function(e){return e},pt||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},mt||=function(e){return new e(...[...arguments].slice(1))};var ht=Ft(Array.prototype.forEach),gt=Ft(Array.prototype.lastIndexOf),_t=Ft(Array.prototype.pop),vt=Ft(Array.prototype.push),yt=Ft(Array.prototype.splice),bt=Array.isArray,xt=Ft(String.prototype.toLowerCase),St=Ft(String.prototype.toString),Ct=Ft(String.prototype.match),wt=Ft(String.prototype.replace),Tt=Ft(String.prototype.indexOf),Et=Ft(String.prototype.trim),Dt=Ft(Number.prototype.toString),Ot=Ft(Boolean.prototype.toString),kt=typeof BigInt>`u`?null:Ft(BigInt.prototype.toString),At=typeof Symbol>`u`?null:Ft(Symbol.prototype.toString),jt=Ft(Object.prototype.hasOwnProperty),Mt=Ft(Object.prototype.toString),Nt=Ft(RegExp.prototype.test),Pt=It(TypeError);function Ft(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return pt(e,t,n)}}function It(e){return function(){return mt(e,[...arguments])}}function O(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:xt;if(at&&at(e,null),!bt(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(ot(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Lt(e){for(let t=0;t<e.length;t++)jt(e,t)||(e[t]=null);return e}function Rt(e){let t=dt(null);for(let r of it(e)){var n=nt(r,2);let i=n[0],a=n[1];jt(e,i)&&(bt(a)?t[i]=Lt(a):a&&typeof a==`object`&&a.constructor===Object?t[i]=Rt(a):t[i]=a)}return t}function zt(e){switch(typeof e){case`string`:return e;case`number`:return Dt(e);case`boolean`:return Ot(e);case`bigint`:return kt?kt(e):`0`;case`symbol`:return At?At(e):`Symbol()`;case`undefined`:return Mt(e);case`function`:case`object`:{if(e===null)return Mt(e);let t=e,n=Bt(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:Mt(e)}return Mt(e)}default:return Mt(e)}}function Bt(e,t){for(;e!==null;){let n=ct(e,t);if(n){if(n.get)return Ft(n.get);if(typeof n.value==`function`)return Ft(n.value)}e=st(e)}function n(){return null}return n}function Vt(e){try{return Nt(e,``),!0}catch{return!1}}var Ht=lt(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),Ut=lt(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),Wt=lt([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),Gt=lt([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),Kt=lt(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),qt=lt([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Jt=lt([`#text`]),Yt=lt(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),Xt=lt(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),Zt=lt(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),Qt=lt([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),$t=ut(/{{[\w\W]*|^[\w\W]*}}/g),en=ut(/<%[\w\W]*|^[\w\W]*%>/g),tn=ut(/\${[\w\W]*/g),nn=ut(/^data-[\-\w.\u00B7-\uFFFF]+$/),rn=ut(/^aria-[\-\w]+$/),an=ut(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),on=ut(/^(?:\w+script|data):/i),sn=ut(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),cn=ut(/^html$/i),ln=ut(/^[a-z][.\w]*(-[.\w]+)+$/i),un=ut(/<[/\w!]/g),dn=ut(/<[/\w]/g),fn=ut(/<\/no(script|embed|frames)/i),pn=ut(/\/>/i),mn={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},hn=function(){return typeof window>`u`?null:window},gn=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},_n=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},vn=function(e,t,n,r){return jt(e,t)&&bt(e[t])?O(r.base?Rt(r.base):{},e[t],r.transform):n};function yn(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:hn(),t=e=>yn(e);if(t.version=`3.4.12`,t.removed=[],!e||!e.document||e.document.nodeType!==mn.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=Bt(d,`cloneNode`),p=Bt(d,`remove`),m=Bt(d,`nextSibling`),h=Bt(d,`childNodes`),g=Bt(d,`parentNode`),_=Bt(d,`shadowRoot`),v=Bt(d,`attributes`),y=o&&o.prototype?Bt(o.prototype,`nodeType`):null,b=o&&o.prototype?Bt(o.prototype,`nodeName`):null;if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let x,S=``,C,ee=!1,te=0,ne=function(){if(te>0)throw Pt(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},re=function(e){ne(),te++;try{return x.createHTML(e)}finally{te--}},ie=function(e){ne(),te++;try{return x.createScriptURL(e)}finally{te--}},ae=function(){return ee||=(C=gn(u,i),!0),C},oe=n,se=oe.implementation,ce=oe.createNodeIterator,le=oe.createDocumentFragment,ue=oe.getElementsByTagName,de=r.importNode,w=_n();t.isSupported=typeof it==`function`&&typeof g==`function`&&se&&se.createHTMLDocument!==void 0;let fe=$t,pe=en,me=tn,he=nn,ge=rn,_e=on,ve=sn,ye=ln,be=an,T=null,xe=O({},[...Ht,...Ut,...Wt,...Kt,...Jt]),Se=null,Ce=O({},[...Yt,...Xt,...Zt,...Qt]),we=Object.seal(dt(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Te=null,Ee=null,De=Object.seal(dt(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Oe=!0,ke=!0,E=!1,Ae=!0,je=!1,Me=!0,Ne=!1,D=!1,Pe=null,Fe=null,Ie=!1,Le=!1,Re=!1,ze=!1,Be=!0,Ve=!1,He=`user-content-`,Ue=!0,We=!1,Ge={},Ke=null,qe=O({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),Je=null,Ye=O({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Xe=null,Ze=O({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Qe=`http://www.w3.org/1998/Math/MathML`,$e=`http://www.w3.org/2000/svg`,et=`http://www.w3.org/1999/xhtml`,tt=et,nt=!1,rt=null,at=O({},[Qe,$e,et],St),ot=lt([`mi`,`mo`,`mn`,`ms`,`mtext`]),st=O({},ot),ct=lt([`annotation-xml`]),ft=O({},ct),pt=O({},[`title`,`style`,`font`,`a`,`script`]),mt=null,Dt=[`application/xhtml+xml`,`text/html`],Ot=null,kt=null,At=n.createElement(`form`),Mt=function(e){return e instanceof RegExp||e instanceof Function},Ft=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(kt&&kt===e)return;(!e||typeof e!=`object`)&&(e={}),e=Rt(e),mt=Dt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,Ot=mt===`application/xhtml+xml`?St:xt,T=vn(e,`ALLOWED_TAGS`,xe,{transform:Ot}),Se=vn(e,`ALLOWED_ATTR`,Ce,{transform:Ot}),rt=vn(e,`ALLOWED_NAMESPACES`,at,{transform:St}),Xe=vn(e,`ADD_URI_SAFE_ATTR`,Ze,{transform:Ot,base:Ze}),Je=vn(e,`ADD_DATA_URI_TAGS`,Ye,{transform:Ot,base:Ye}),Ke=vn(e,`FORBID_CONTENTS`,qe,{transform:Ot}),Te=vn(e,`FORBID_TAGS`,Rt({}),{transform:Ot}),Ee=vn(e,`FORBID_ATTR`,Rt({}),{transform:Ot}),Ge=jt(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?Rt(e.USE_PROFILES):e.USE_PROFILES:!1,Oe=e.ALLOW_ARIA_ATTR!==!1,ke=e.ALLOW_DATA_ATTR!==!1,E=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ae=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,je=e.SAFE_FOR_TEMPLATES||!1,Me=e.SAFE_FOR_XML!==!1,Ne=e.WHOLE_DOCUMENT||!1,Le=e.RETURN_DOM||!1,Re=e.RETURN_DOM_FRAGMENT||!1,ze=e.RETURN_TRUSTED_TYPE||!1,Ie=e.FORCE_BODY||!1,Be=e.SANITIZE_DOM!==!1,Ve=e.SANITIZE_NAMED_PROPS||!1,Ue=e.KEEP_CONTENT!==!1,We=e.IN_PLACE||!1,be=Vt(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:an,tt=typeof e.NAMESPACE==`string`?e.NAMESPACE:et,st=jt(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?Rt(e.MATHML_TEXT_INTEGRATION_POINTS):O({},ot),ft=jt(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?Rt(e.HTML_INTEGRATION_POINTS):O({},ct);let t=jt(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?Rt(e.CUSTOM_ELEMENT_HANDLING):dt(null);if(we=dt(null),jt(t,`tagNameCheck`)&&Mt(t.tagNameCheck)&&(we.tagNameCheck=t.tagNameCheck),jt(t,`attributeNameCheck`)&&Mt(t.attributeNameCheck)&&(we.attributeNameCheck=t.attributeNameCheck),jt(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(we.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),ut(we),je&&(ke=!1),Re&&(Le=!0),Ge&&(T=O({},Jt),Se=dt(null),Ge.html===!0&&(O(T,Ht),O(Se,Yt)),Ge.svg===!0&&(O(T,Ut),O(Se,Xt),O(Se,Qt)),Ge.svgFilters===!0&&(O(T,Wt),O(Se,Xt),O(Se,Qt)),Ge.mathMl===!0&&(O(T,Kt),O(Se,Zt),O(Se,Qt))),De.tagCheck=null,De.attributeCheck=null,jt(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?De.tagCheck=e.ADD_TAGS:bt(e.ADD_TAGS)&&(T===xe&&(T=Rt(T)),O(T,e.ADD_TAGS,Ot))),jt(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?De.attributeCheck=e.ADD_ATTR:bt(e.ADD_ATTR)&&(Se===Ce&&(Se=Rt(Se)),O(Se,e.ADD_ATTR,Ot))),jt(e,`ADD_URI_SAFE_ATTR`)&&bt(e.ADD_URI_SAFE_ATTR)&&O(Xe,e.ADD_URI_SAFE_ATTR,Ot),jt(e,`FORBID_CONTENTS`)&&bt(e.FORBID_CONTENTS)&&(Ke===qe&&(Ke=Rt(Ke)),O(Ke,e.FORBID_CONTENTS,Ot)),jt(e,`ADD_FORBID_CONTENTS`)&&bt(e.ADD_FORBID_CONTENTS)&&(Ke===qe&&(Ke=Rt(Ke)),O(Ke,e.ADD_FORBID_CONTENTS,Ot)),Ue&&(T[`#text`]=!0),Ne&&O(T,[`html`,`head`,`body`]),T.table&&(O(T,[`tbody`]),delete Te.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Pt(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Pt(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=x;x=e.TRUSTED_TYPES_POLICY;try{S=re(``)}catch(e){throw x=t,e}}else e.TRUSTED_TYPES_POLICY===null?(x=void 0,S=``):(x===void 0&&(x=ae()),x&&typeof S==`string`&&(S=re(``)));lt&<(e),kt=e},It=O({},[...Ut,...Wt,...Gt]),Lt=O({},[...Kt,...qt]),bn=function(e,t,n){return t.namespaceURI===et?e===`svg`:t.namespaceURI===Qe?e===`svg`&&(n===`annotation-xml`||st[n]):!!It[e]},xn=function(e,t,n){return t.namespaceURI===et?e===`math`:t.namespaceURI===$e?e===`math`&&ft[n]:!!Lt[e]},Sn=function(e,t,n){return t.namespaceURI===$e&&!ft[n]||t.namespaceURI===Qe&&!st[n]?!1:!Lt[e]&&(pt[e]||!It[e])},Cn=function(e){let t=g(e);(!t||!t.tagName)&&(t={namespaceURI:tt,tagName:`template`});let n=xt(e.tagName),r=xt(t.tagName);return rt[e.namespaceURI]?e.namespaceURI===$e?bn(n,t,r):e.namespaceURI===Qe?xn(n,t,r):e.namespaceURI===et?Sn(n,t,r):!!(mt===`application/xhtml+xml`&&rt[e.namespaceURI]):!1},wn=function(e){vt(t.removed,{element:e});try{g(e).removeChild(e)}catch{if(p(e),!g(e))throw Pt(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},Tn=function(e){Dn(e);let t=h(e);if(t){let e=[];ht(t,t=>{vt(e,t)}),ht(e,e=>{try{p(e)}catch{}})}let n=v(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;if(typeof i==`string`)try{e.removeAttribute(i)}catch{}}},k=function(e,n){try{vt(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{vt(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(Le||Re)try{wn(n)}catch{}else try{n.setAttribute(e,``)}catch{}},En=function(e){let t=v(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;if(!(typeof i!=`string`||Se[Ot(i)]))try{e.removeAttribute(i)}catch{}}},Dn=function(e){let t=[e];for(;t.length>0;){let e=t.pop();(y?y(e):e.nodeType)===mn.element&&En(e);let n=h(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},On=function(e){if(!Me)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=y?y(e):e.nodeType;if(n===mn.processingInstruction||n===mn.comment&&Nt(dn,e.data)){try{p(e)}catch{}continue}if(n===mn.element){let t=e,n=Ot(b?b(e):e.nodeName);try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&n!==`label`&&n!==`output`&&t.removeAttribute(`for`)}catch{}}let r=h(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},kn=function(e){let t=null,r=null;if(Ie)e=`<remove></remove>`+e;else{let t=Ct(e,/^[\r\n\t ]+/);r=t&&t[0]}mt===`application/xhtml+xml`&&tt===et&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=x?re(e):e;if(tt===et)try{t=new l().parseFromString(i,mt)}catch{}if(!t||!t.documentElement){t=se.createDocument(tt,`template`,null);try{t.documentElement.innerHTML=nt?S:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),tt===et?ue.call(t,Ne?`html`:`body`)[0]:Ne?t.documentElement:a},An=function(e){return ce.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},jn=function(e){return e=wt(e,fe,` `),e=wt(e,pe,` `),e=wt(e,me,` `),e},Mn=function(e){e.normalize();let t=ce.call(e.ownerDocument||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),n=t.nextNode();for(;n;)n.data=jn(n.data),n=t.nextNode();let r=e.querySelectorAll?.call(e,`template`);r&&ht(r,e=>{Pn(e.content)&&Mn(e.content)})},Nn=function(e){let t=b?b(e):null;return typeof t!=`string`||Ot(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==v(e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==y(e)||e.childNodes!==h(e)},Pn=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return y(e)===mn.documentFragment}catch{return!1}},Fn=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return typeof y(e)==`number`}catch{return!1}};function In(e,n,r){e.length!==0&&ht(e,e=>{e.call(t,n,r,kt)})}let Ln=function(e,t){return!!(Me&&e.hasChildNodes()&&!Fn(e.firstElementChild)&&Nt(un,e.textContent)&&Nt(un,e.innerHTML)||Me&&e.namespaceURI===et&&t===`style`&&Fn(e.firstElementChild)||e.nodeType===mn.processingInstruction||Me&&e.nodeType===mn.comment&&Nt(dn,e.data))},Rn=function(e,t){if(!Te[t]&&Hn(t)&&(we.tagNameCheck instanceof RegExp&&Nt(we.tagNameCheck,t)||we.tagNameCheck instanceof Function&&we.tagNameCheck(t)))return!1;if(Ue&&!Ke[t]){let t=g(e),n=h(e);if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=We?n[i]:f(n[i],!0);t.insertBefore(r,m(e))}}}return wn(e),!0},zn=function(e,n){if(In(w.beforeSanitizeElements,e,null),e!==n&&g(e)===null)return!0;if(Nn(e))return wn(e),!0;let r=Ot(b?b(e):e.nodeName);if(In(w.uponSanitizeElement,e,{tagName:r,allowedTags:T}),e!==n&&g(e)===null)return!0;if(Ln(e,r))return wn(e),!0;if(Te[r]||!(De.tagCheck instanceof Function&&De.tagCheck(r))&&!T[r]){let t=Rn(e,r);return t===!1&&In(w.afterSanitizeElements,e,null),t}if((y?y(e):e.nodeType)===mn.element&&!Cn(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&Nt(fn,e.innerHTML))return wn(e),!0;if(je&&e.nodeType===mn.text){let n=jn(e.textContent);e.textContent!==n&&(vt(t.removed,{element:e.cloneNode()}),e.textContent=n)}return In(w.afterSanitizeElements,e,null),!1},Bn=function(e,t,r){if(Ee[t]||Me&&t===`patchsrc`||Me&&t===`for`&&e!==`label`&&e!==`output`||Be&&(t===`id`||t===`name`)&&(r in n||r in At))return!1;let i=Se[t]||De.attributeCheck instanceof Function&&De.attributeCheck(t,e);if(!(ke&&Nt(he,t))&&!(Oe&&Nt(ge,t))){if(!i){if(!(Hn(e)&&(we.tagNameCheck instanceof RegExp&&Nt(we.tagNameCheck,e)||we.tagNameCheck instanceof Function&&we.tagNameCheck(e))&&(we.attributeNameCheck instanceof RegExp&&Nt(we.attributeNameCheck,t)||we.attributeNameCheck instanceof Function&&we.attributeNameCheck(t,e))||t===`is`&&we.allowCustomizedBuiltInElements&&(we.tagNameCheck instanceof RegExp&&Nt(we.tagNameCheck,r)||we.tagNameCheck instanceof Function&&we.tagNameCheck(r))))return!1}else if(!Xe[t]&&!Nt(be,wt(r,ve,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&Tt(r,`data:`)===0&&Je[e])&&!(E&&!Nt(_e,wt(r,ve,``)))&&r)return!1}return!0},Vn=O({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Hn=function(e){return!Vn[xt(e)]&&Nt(ye,e)},Un=function(e,t,n,r){if(x&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return re(r);case`TrustedScriptURL`:return ie(r)}return r},Wn=function(e,n,r,i){try{r?e.setAttributeNS(r,n,i):e.setAttribute(n,i),Nn(e)?wn(e):_t(t.removed)}catch{k(n,e)}},Gn=function(e){In(w.beforeSanitizeAttributes,e,null);let t=e.attributes;if(!t||Nn(e))return;let n={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:Se,forceKeepAttr:void 0},r=t.length,i=Ot(e.nodeName);for(;r--;){let a=t[r],o=a.name,s=a.namespaceURI,c=a.value,l=Ot(o),u=c,d=o===`value`?u:Et(u);if(n.attrName=l,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,In(w.uponSanitizeAttribute,e,n),d=n.attrValue,Ve&&(l===`id`||l===`name`)&&Tt(d,He)!==0&&(k(o,e),d=He+d),Me&&Nt(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){k(o,e);continue}if(l===`attributename`&&Ct(d,`href`)){k(o,e);continue}if(!n.forceKeepAttr){if(!n.keepAttr){k(o,e);continue}if(!Ae&&Nt(pn,d)){k(o,e);continue}if(je&&(d=jn(d)),!Bn(i,l,d)){k(o,e);continue}d=Un(i,l,s,d),d!==u&&Wn(e,o,s,d)}}In(w.afterSanitizeAttributes,e,null)},Kn=function(e){let t=null,n=An(e);for(In(w.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(In(w.uponSanitizeShadowNode,t,null),zn(t,e),Gn(t),Pn(t.content)&&Kn(t.content),(y?y(t):t.nodeType)===mn.element){let e=_(t);Pn(e)&&(qn(e),Kn(e))}In(w.afterSanitizeShadowDOM,e,null)},qn=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){Kn(e.shadow);continue}let n=e.node,r=(y?y(n):n.nodeType)===mn.element,i=h(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=b?b(n):null;if(typeof e==`string`&&Ot(e)===`template`){let e=n.content;Pn(e)&&t.push({node:e,shadow:null})}}if(r){let e=_(n);Pn(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(nt=!e,nt&&(e=`<!-->`),typeof e!=`string`&&!Fn(e)&&(e=zt(e),typeof e!=`string`))throw Pt(`dirty is not a string, aborting`);if(!t.isSupported)return e;D?(T=Pe,Se=Fe):Ft(n),(w.uponSanitizeElement.length>0||w.uponSanitizeAttribute.length>0)&&(T=Rt(T)),w.uponSanitizeAttribute.length>0&&(Se=Rt(Se)),t.removed=[];let c=We&&typeof e!=`string`&&Fn(e);if(c){On(e);let t=b?b(e):e.nodeName;if(typeof t==`string`){let n=Ot(t);if(!T[n]||Te[n])throw Tn(e),Pt(`root node is forbidden and cannot be sanitized in-place`)}if(Nn(e))throw Tn(e),Pt(`root node is clobbered and cannot be sanitized in-place`);try{qn(e)}catch(t){throw Tn(e),t}}else if(Fn(e))i=kn(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===mn.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),qn(a);else{if(!Le&&!je&&!Ne&&e.indexOf(`<`)===-1)return x&&ze?re(e):e;if(i=kn(e),!i)return Le?null:ze?S:``}i&&Ie&&wn(i.firstChild);let l=c?e:i,u=An(l);try{for(;o=u.nextNode();)zn(o,l),Gn(o),Pn(o.content)&&Kn(o.content)}catch(n){throw c&&(Tn(e),ht(t.removed,e=>{e.element&&Dn(e.element)})),n}if(c)return ht(t.removed,e=>{e.element&&Dn(e.element)}),je&&Mn(e),e;if(Le){if(je&&Mn(i),Re)for(s=le.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(Se.shadowroot||Se.shadowrootmode)&&(s=de.call(r,s,!0)),s}let d=Ne?i.outerHTML:i.innerHTML;return Ne&&T[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&Nt(cn,i.ownerDocument.doctype.name)&&(d=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
3
3
|
`+d),je&&(d=jn(d)),x&&ze?re(d):d},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ft(e),D=!0,Pe=T,Fe=Se},t.clearConfig=function(){kt=null,D=!1,Pe=null,Fe=null,x=C,S=``},t.isValidAttribute=function(e,t,n){kt||Ft({});let r=Ot(e),i=Ot(t);return Bn(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&jt(w,e)&&vt(w[e],t)},t.removeHook=function(e,t){if(jt(w,e)){if(t!==void 0){let n=gt(w[e],t);return n===-1?void 0:yt(w[e],n,1)[0]}return _t(w[e])}},t.removeHooks=function(e){jt(w,e)&&(w[e]=[])},t.removeAllHooks=function(){w=_n()},t}var bn=yn();function xn(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Sn=xn();function Cn(e){Sn=e}var wn={exec:()=>null};function Tn(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function k(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(Dn.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var En=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),Dn={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Tn(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Tn(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Tn(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Tn(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Tn(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:Tn(e=>RegExp(`^ {0,${e}}>`))},On=/^(?:[ \t]*(?:\n|$))+/,kn=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,An=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,jn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Mn=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Nn=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Pn=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Fn=k(Pn).replace(/bull/g,Nn).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),In=k(Pn).replace(/bull/g,Nn).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Ln=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Rn=/^[^\n]+/,zn=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Bn=k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,zn).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Vn=k(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Nn).getRegex(),Hn=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,Un=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Wn=k(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,Un).replace(`tag`,Hn).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Gn=e=>k(Ln).replace(`hr`,jn).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Hn).getRegex(),Kn=Gn(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),qn=Gn(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Jn={blockquote:k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,qn).getRegex(),code:kn,def:Bn,fences:An,heading:Mn,hr:jn,html:Wn,lheading:Fn,list:Vn,newline:On,paragraph:Kn,table:wn,text:Rn},Yn=k(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,jn).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Hn).getRegex(),Xn={...Jn,lheading:In,table:Yn,paragraph:k(Ln).replace(`hr`,jn).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,Yn).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Hn).getRegex()},Zn={...Jn,html:k(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Un).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:wn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:k(Ln).replace(`hr`,jn).replace(`heading`,` *#{1,6} *[^
|
|
4
4
|
]`).replace(`lheading`,Fn).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},Qn=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,$n=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,er=/^( {2,}|\\)\n(?!\s*$)/,tr=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,nr=/[\p{P}\p{S}]/u,rr=/[\s\p{P}\p{S}]/u,ir=/[^\s\p{P}\p{S}]/u,ar=k(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,rr).getRegex(),or=/(?!~)[\p{P}\p{S}]/u,sr=/(?!~)[\s\p{P}\p{S}]/u,cr=/(?:[^\s\p{P}\p{S}]|~)/u,lr=k(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,En?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),ur=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,dr=k(ur,`u`).replace(/punct/g,nr).getRegex(),fr=k(ur,`u`).replace(/punct/g,or).getRegex(),pr=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,mr=k(pr,`gu`).replace(/notPunctSpace/g,ir).replace(/punctSpace/g,rr).replace(/punct/g,nr).getRegex(),hr=k(pr,`gu`).replace(/notPunctSpace/g,cr).replace(/punctSpace/g,sr).replace(/punct/g,or).getRegex(),gr=k(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,ir).replace(/punctSpace/g,rr).replace(/punct/g,nr).getRegex(),_r=k(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,nr).getRegex(),vr=k(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,ir).replace(/punctSpace/g,rr).replace(/punct/g,nr).getRegex(),yr=k(/\\(punct)/,`gu`).replace(/punct/g,nr).getRegex(),br=k(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),xr=k(Un).replace(`(?:-->|$)`,`-->`).getRegex(),Sr=k(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,xr).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Cr=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,wr=k(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,Cr).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Tr=k(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Cr).replace(`ref`,zn).getRegex(),Er=k(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,zn).getRegex(),Dr=k(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Tr).replace(`nolink`,Er).getRegex(),Or=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,kr={_backpedal:wn,anyPunctuation:yr,autolink:br,blockSkip:lr,br:er,code:$n,del:wn,delLDelim:wn,delRDelim:wn,emStrongLDelim:dr,emStrongRDelimAst:mr,emStrongRDelimUnd:gr,escape:Qn,link:wr,nolink:Er,punctuation:ar,reflink:Tr,reflinkSearch:Dr,tag:Sr,text:tr,url:wn},Ar={...kr,link:k(/^!?\[(label)\]\((.*?)\)/).replace(`label`,Cr).getRegex(),reflink:k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,Cr).getRegex()},jr={...kr,emStrongRDelimAst:hr,emStrongLDelim:fr,delLDelim:_r,delRDelim:vr,url:k(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,Or).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:k(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,Or).getRegex()},Mr={...jr,br:k(er).replace(`{2,}`,`*`).getRegex(),text:k(jr.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Nr={normal:Jn,gfm:Xn,pedantic:Zn},Pr={normal:kr,gfm:jr,breaks:Mr,pedantic:Ar},Fr={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},Ir=e=>Fr[e];function Lr(e,t){if(t){if(Dn.escapeTest.test(e))return e.replace(Dn.escapeReplace,Ir)}else if(Dn.escapeTestNoEncode.test(e))return e.replace(Dn.escapeReplaceNoEncode,Ir);return e}function Rr(e){try{e=encodeURI(e).replace(Dn.percentDecode,`%`)}catch{return null}return e}function zr(e,t){let n=e.replace(Dn.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(Dn.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``);for(;r<n.length;r++)n[r]=n[r].trim().replace(Dn.slashPipe,`|`);return n}function Br(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function Vr(e){let t=e.split(`
|