@nathanstephenson/flow 0.1.10-beta.5 → 0.1.10-beta.6
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/build/backend-worker-chunks/{chunk-JOI2POLP.mjs → chunk-U73G6KK4.mjs} +18 -0
- package/build/backend-worker-chunks/{claude-GY27HBAY.mjs → claude-THGSOTC2.mjs} +7 -1
- package/build/backend-worker-chunks/{pi-JV6MWPW7.mjs → pi-5LAWIJNE.mjs} +82 -3
- package/build/backend-worker.mjs +7 -3
- package/dist/backend/claude/index.js +6 -0
- package/dist/backend/fake/index.js +6 -0
- package/dist/backend/pi/index.js +34 -2
- package/dist/backend/pi/plan-limits.js +41 -0
- package/dist/backend/plan-limits.js +17 -0
- package/dist/backend/worker/entry.js +4 -1
- package/dist/backend/worker/index.js +5 -0
- package/dist/backend/worker/protocol.js +2 -1
- package/dist/build-id +1 -1
- package/dist/cli/bootstrap.js +1 -1
- package/dist/client/context-usage.js +1 -1
- package/dist/client/markdown.js +3 -2
- package/dist/daemon/config-store.js +1 -0
- package/dist/daemon/config.js +31 -2
- package/dist/daemon/github-image.js +18 -0
- package/dist/daemon/host.js +147 -6
- package/dist/daemon/runtime.js +1 -1
- package/dist/daemon/server.js +26 -0
- package/dist/daemon/skills.js +24 -0
- package/dist/daemon/spend-ledger.js +118 -0
- package/dist/daemon/summariser.js +11 -4
- package/dist/daemon/tour.js +42 -0
- package/dist/daemon/workflow-builder.js +3 -1
- package/dist/daemon/workflow-execution-resources.js +1 -1
- package/dist/daemon/workflow-routes.js +19 -0
- package/dist/daemon/workflow-schedules.js +6 -5
- package/dist/protocol/plan-limits.js +1 -0
- package/dist/protocol/spend.js +2 -0
- package/dist/workflows/scheduler.js +26 -14
- package/dist/workflows/store.js +16 -2
- package/package.json +1 -1
- package/web/dist/assets/index-BhfJhrVJ.js +51 -0
- package/web/dist/assets/index-BvkM2cWL.css +2 -0
- package/web/dist/assets/{settings-mcp-BwOPXAfH.js → settings-mcp-3cgqQB28.js} +1 -1
- package/web/dist/assets/{settings-workflows-DocTa31_.js → settings-workflows-Cutm8isB.js} +1 -1
- package/web/dist/assets/{workflows-DJqUuGyg.js → workflows-D6oEUUhj.js} +3 -3
- package/web/dist/assets/{workflows-pane-oM1fO_BC.js → workflows-pane-KIdSDKJB.js} +1 -1
- package/web/dist/index.html +3 -3
- package/web/dist/assets/index-BqZ_iUmY.css +0 -2
- package/web/dist/assets/index-CxdSb7k0.js +0 -51
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{a as e,i as t,n,r,t as i}from"./rolldown-runtime-B0Z9INg1.js";import{$n as a,$t as o,A as s,An as c,Bn as l,C as u,E as d,En as f,Er as p,Gn as m,Hn as h,In as g,J as _,Jn as v,K as y,Kn as b,Kt as x,Mn as S,N as C,Nn as w,O as T,Or as E,P as D,Pn as O,Q as k,Qn as A,Rn as j,S as M,T as N,Tn as P,U as F,Un as I,Vn as L,Wn as R,Xn as ee,Y as z,Yn as B,Z as te,Zn as V,_ as ne,an as re,bn as ie,cr as ae,ct as oe,dr as se,et as ce,fr as le,ft as ue,g as de,gn as fe,gt as pe,ht as me,i as he,in as ge,j as _e,jn as ve,kn as ye,kr as be,l as xe,mn as Se,mt as Ce,nt as we,on as Te,ot as Ee,q as De,rn as Oe,rt as ke,sn as Ae,sr as je,st as Me,tn as Ne,tt as Pe,ur as Fe,v as Ie,wn as Le,wr as Re,x as ze,xn as Be,y as Ve,yn as He,yr as Ue,z as We}from"./workflow-api-BfExddae.js";import{$ as Ge,A as Ke,At as qe,B as Je,Ct as Ye,D as Xe,Dt as Ze,E as Qe,Et as $e,F as et,J as tt,K as nt,M as rt,Nt as it,O as at,Ot as ot,P as st,Q as ct,St as lt,Tt as ut,X as dt,Y as ft,Z as pt,a as mt,at as ht,bt as gt,c as _t,ct as vt,dt as yt,et as bt,ft as xt,gt as St,ht as Ct,it as wt,j as Tt,k as Et,kt as Dt,lt as Ot,mt as kt,n as At,ot as jt,pt as Mt,q as Nt,r as Pt,rt as Ft,s as It,st as Lt,t as Rt,tt as zt,ut as Bt,vt as Vt,wt as Ht,xt as Ut,yt as Wt}from"./switch-B00FEUA7.js";function Gt(e){if(!e)return;let{used:t,window:n}=e;return n>0?`context ${Math.round(t/n*100)}%`:`${t} tokens`}function Kt(e){if(!e||e.window<=0)return;let{used:t,window:n,spend:r}=e,i=[{label:`Context`,value:`${Math.round(t/n*100)}% · ${Jt(t)}/${Jt(n)} tokens`}];if(!r)return i;if(i.push({label:`Spent`,value:`${Jt(r.tokens)} tokens · ${qt(r.costUSD)}`}),i.push({label:`Cache reads`,value:`${Jt(r.cached)} of ${Jt(r.tokens)}`}),r.models.length>1)for(let e of r.models)i.push({label:e.id,value:`${Jt(e.tokens)} · ${qt(e.costUSD)}`,model:!0});return i}function qt(e){return e>=.01?`$${e.toFixed(2)}`:e===0?`$0.00`:`$${e.toFixed(4)}`}function Jt(e){return e>=1e6?`${Math.round(e/1e5)/10}M`:e>=1e3?`${Math.round(e/1e3)}k`:`${e}`}function Yt(e){return e.lifecycle===`live`?e.awaiting?`awaiting`:e.turnInFlight?`running`:`idle`:e.lifecycle}function Xt(e){return e===`running`||e===`awaiting`}function Zt(e){return e.status===`settled`||e.status===`ended`?`filed-away`:e.attention?.group===`needs-input`?`needs-input`:e.attention?.group===`unread`?`unread`:e.status===`running`||e.status===`awaiting`||$t(e)?`working`:e.status===`idle`?`idle`:`dormant`}function Qt(e){switch(e){case`needs-input`:return`Needs input`;case`unread`:return`Unread`;case`working`:return`Working`;case`idle`:return`Idle`;case`dormant`:return`Dormant`;case`filed-away`:return`Filed away`}}function $t(e){return e.status===`idle`&&e.activeSubagents+e.activeBackgroundCalls+(e.activeWorkflows??0)>0}function en(e){return e!==`settled`&&e!==`ended`}function tn(e){return e===`dormant`||e===`settled`}function nn(e){let t={tokens:0,cached:0,costUSD:0,models:[]};for(let n of e){t.tokens+=n.tokens,t.cached+=n.cached,t.costUSD+=n.costUSD;for(let e of n.models){let n=t.models.find(t=>t.id===e.id);n?(n.tokens+=e.tokens,n.cached+=e.cached,n.costUSD+=e.costUSD):t.models.push({...e})}}return t}function rn(){return{status:`idle`,lifecycle:`live`,turnInFlight:!1,entries:[],queue:[],activeSubagents:0,activeBackgroundCalls:0,lastSeq:0}}function an(e){return e===`running`||e===`waiting`}function on(e,t=rn()){let n=t;for(let t of e)n=cn(n,t);return n}function sn(e,t){for(let n=e.length-1;n>=0;n--){let r=e[n];if(r.kind===`user`&&r.producer===void 0)return e;if(r.kind===`assistant`&&r.producer===void 0){if(r.endedAt===t)return e;let i=e.slice();return i[n]={...r,endedAt:t},i}}return e}function cn(e,t){let n=ln(e,t.event,t.at);return n===void 0?{...e,lastSeq:t.seq}:n===e?e:{...n,status:Yt({lifecycle:n.lifecycle,turnInFlight:n.turnInFlight,awaiting:n.asking!==void 0&&n.asking.producer===void 0||n.authorising!==void 0&&n.authorising.producer===void 0}),lastSeq:t.seq}}function ln(e,t,n){switch(t.type){case`session_started`:return{...e,backend:t.backend,scope:t.scope,capabilities:t.capabilities,...t.permissionMode?{permissionMode:t.permissionMode}:{},...t.worktree===void 0?{}:{worktree:t.worktree}};case`capabilities_changed`:return{...e,capabilities:t.capabilities};case`user_message`:return{...e,spoken:!0,entries:hn(e.entries,{kind:`user`,id:t.id,...t.fromSessionId===void 0?{text:t.text}:{text:t.text.slice(t.text.indexOf(`
|
|
2
|
-
`)+1),fromSessionId:t.fromSessionId},...t.attachments===void 0?{}:{attachments:t.attachments},at:n})};case`subagent_instruction`:return{...e,entries:hn(e.entries,{kind:`user`,id:t.id,text:t.text,producer:t.producer,at:n})};case`turn_started`:return{...e,turnInFlight:!0};case`message`:return{...e,entries:hn(e.entries,{kind:`assistant`,id:t.id,text:t.text,final:t.final,...mn(t)})};case`thinking`:return{...e,entries:hn(e.entries,{kind:`thinking`,id:t.id,text:t.text,final:t.final,...mn(t)})};case`tool_started`:return{...e,entries:hn(e.entries,{kind:`tool`,id:t.callId,name:t.name,input:t.input,status:`running`,...mn(t)})};case`tool_updated`:return{...e,entries:gn(e.entries,t.callId,e=>({...e,update:t.update}))};case`tool_ended`:return{...e,entries:gn(e.entries,t.callId,e=>({...e,result:t.result,status:t.isError?`error`:`complete`}))};case`subagent`:{let r=e.entries.find(e=>e.kind===`subagent`&&e.id===t.subagentId),i=r!==void 0&&an(r.status),a=an(t.state),o=a?void 0:r?.endedAt??n;return{...e,activeSubagents:e.activeSubagents+ +!!a-+!!i,entries:hn(e.entries,{kind:`subagent`,id:t.subagentId,name:t.name,...t.description===void 0?{}:{description:t.description},...t.model===void 0?{}:{model:t.model},...t.effort===void 0?{}:{effort:t.effort},...t.producer===void 0?{}:{producer:t.producer},status:t.state,...t.state===`waiting`?{waitingOn:t.on}:{},startedAt:r?.startedAt??n,...o===void 0?{}:{endedAt:o}})}}case`background_call`:{let r=e.entries.find(e=>e.kind===`background_call`&&e.id===t.callId),i=r?.status===`running`,a=t.state===`running`,o=a?void 0:r?.endedAt??n;return{...e,activeBackgroundCalls:e.activeBackgroundCalls+ +!!a-+!!i,entries:hn(e.entries,{kind:`background_call`,id:t.callId,tool:t.tool,status:t.state,...mn(t),startedAt:r?.startedAt??n,...o===void 0?{}:{endedAt:o}})}}case`enquiry`:{let n=t.state===`asked`,r=n&&e.asking?.askId===t.askId?e.asking:n?{askId:t.askId,questions:t.questions,...t.context===void 0?{}:{context:t.context},...t.producer===void 0?{}:{producer:t.producer}}:e.asking?.askId===t.askId?void 0:e.asking;return{...e,...r===void 0?{asking:void 0}:{asking:r},entries:hn(e.entries,{kind:`enquiry`,id:t.askId,questions:t.questions,status:t.state,...t.state===`answered`?{answers:t.answers}:{},...t.context===void 0?{}:{context:t.context},...t.producer===void 0?{}:{producer:t.producer}})}}case`permission`:{let n=t.state===`asked`?e.authorising??{callId:t.callId,tool:t.tool,...t.context===void 0?{}:{context:t.context},...t.allowAlways===void 0?{}:{allowAlways:t.allowAlways},...t.authorizationScope===void 0?{}:{authorizationScope:t.authorizationScope},...t.producer===void 0?{}:{producer:t.producer}}:e.authorising?.callId===t.callId?pn(e.entries,t.callId):e.authorising;return{...e,...n===void 0?{authorising:void 0}:{authorising:n},entries:gn(e.entries,t.callId,e=>({...e,authorisation:fn(t),...t.context===void 0?{}:{permissionContext:t.context},...t.allowAlways===void 0?{}:{allowAlways:t.allowAlways},...t.authorizationScope===void 0?{}:{authorizationScope:t.authorizationScope}}))}}case`turn_ended`:return{...e,entries:sn(e.entries,n),turnInFlight:!1,asking:e.asking?.producer===void 0?void 0:e.asking,authorising:e.authorising?.producer===void 0?void 0:e.authorising};case`queue_changed`:return{...e,queue:[...t.pending],queuedMessages:e.queuedMessages?.length===t.pending.length&&e.queuedMessages.every((e,n)=>e.text===t.pending[n]&&e.id===t.ids?.[n]&&(e.attachments?.length??0)===(t.attachments?.[n]?.length??0)&&(e.attachments??[]).every((e,r)=>e===t.attachments?.[n]?.[r]))?e.queuedMessages:t.pending.map((e,n)=>({id:t.ids?.[n],text:e,...t.attachments?.[n]?.length?{attachments:t.attachments[n]}:{}}))};case`workflow_spend`:{let n={...e.workflowSpend,[t.executionId]:t.spend},r=nn([...e.parentSpend?[e.parentSpend]:[],...Object.values(n)]);return{...e,workflowSpend:n,spend:r,...e.contextUsage?{contextUsage:{...e.contextUsage,spend:r}}:{}}}case`context_usage`:{let n=t.spend||e.workflowSpend?nn([...t.spend?[t.spend]:[],...Object.values(e.workflowSpend??{})]):void 0;return{...e,...t.spend?{parentSpend:t.spend}:{},...n?{spend:n}:{},contextUsage:{used:t.used,window:t.window,...n===void 0?{}:{spend:n}}}}case`model_changed`:return{...e,model:t.model};case`permission_mode_changed`:return{...e,permissionMode:t.mode};case`effort_changed`:return{...e,effort:t.effort};case`branch_changed`:return{...e,branch:t.branch};case`notice`:return{...e,entries:[...e.entries,{kind:`notice`,id:`notice-${e.entries.length}`,level:t.level,text:t.text,...t.sessionId===void 0?{}:{sessionId:t.sessionId}}]};case`compacting`:return t.active?{...e,compacting:!0}:un(e);case`compacted`:return{...un(e),entries:[...e.entries,{kind:`marker`,id:`compacted-${e.entries.length}`,marker:`compacted`,text:dn(t.trigger,t.before,t.after)}]};case`session_dormant`:return{...e,lifecycle:`dormant`,turnInFlight:!1,queue:[],queuedMessages:[],asking:void 0,authorising:void 0,entries:[...e.entries,{kind:`marker`,id:`dormant-${e.entries.length}`,marker:`dormant`,text:`Dormant: ${t.reason}`}]};case`session_settled`:return{...e,lifecycle:`settled`,turnInFlight:!1,queue:[],queuedMessages:[],asking:void 0,authorising:void 0,entries:[...e.entries,{kind:`marker`,id:`settled-${e.entries.length}`,marker:`settled`,text:`Settled`}]};case`rewound`:{let n=e.entries.findIndex(e=>e.kind===`user`&&e.id===t.userMessageId),r=t.restore===`files`?`Files rewound`:t.restore===`both`?`Rewound conversation and files`:`Rewound conversation`;return{...e,entries:[...n<0||t.restore===`files`?e.entries:e.entries.map((e,t)=>t<n||e.rewound?e:{...e,rewound:!0}),{kind:`marker`,id:`rewound-${e.entries.length}`,marker:`rewound`,text:r}]}}case`forked`:return{...e,entries:[...e.entries,{kind:`marker`,id:`forked-${e.entries.length}`,marker:`forked`,text:`Forked`,fromSessionId:t.fromSessionId}]};case`revived`:return{...e,...t.scope===void 0?{}:{scope:t.scope},lifecycle:`live`,turnInFlight:!1,entries:[...e.entries,{kind:`marker`,id:`revived-${t.fromSeq}`,marker:`revived`,text:`Revived from seq ${t.fromSeq}`}]};case`session_ended`:return{...e,lifecycle:`ended`,turnInFlight:!1,endedReason:t.reason,asking:void 0,authorising:void 0}}}function un(e){if(!e.compacting)return e;let{compacting:t,...n}=e;return n}function dn(e,t,n){let r=e===`auto`?`Compacted automatically`:`Compacted`;return n===void 0?`${r}, from ${Jt(t)} tokens`:`${r}, ${Jt(t)} → ${Jt(n)} tokens`}function fn(e){return e.state===`asked`?`asked`:e.state===`aborted`||e.decision===`deny`?`denied`:e.decision===`always`?`always`:`allowed`}function pn(e,t){let n=e.find(e=>e.kind===`tool`&&e.id!==t&&e.authorisation===`asked`);return n?.kind===`tool`?{callId:n.id,tool:n.name,...n.permissionContext===void 0?{}:{context:n.permissionContext},...n.allowAlways===void 0?{}:{allowAlways:n.allowAlways},...n.authorizationScope===void 0?{}:{authorizationScope:n.authorizationScope},...n.producer===void 0?{}:{producer:n.producer}}:void 0}function mn(e){return e.producer===void 0?{}:{producer:e.producer}}function hn(e,t){let n=e.findIndex(e=>e.kind===t.kind&&e.id===t.id);if(n<0)return[...e,t];let r=[...e];return r[n]=t,r}function gn(e,t,n){let r=e.findIndex(e=>e.kind===`tool`&&e.id===t);if(r<0)return e;let i=e[r];if(!i||i.kind!==`tool`)return e;let a=[...e];return a[r]=n(i),a}var H=e(be(),1),_n=e(E(),1);function vn(e){return`${e.kind}:${e.id}`}var U=Re();function yn(e,t){let n=/\/worktrees\/([^/]+)\/[^/]+$/.exec(e)?.[1];return n===void 0?void 0:t.find(e=>e.name===n)?.path}var bn=it(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),xn=it(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),Sn=it(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Cn=it(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),wn=it(`file-pen`,[[`path`,{d:`M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34`,key:`o6klzx`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z`,key:`zhnas1`}]]),Tn=it(`file-plus`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]),En=it(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Dn=it(`folder-search`,[[`path`,{d:`M10.7 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 2v4.1`,key:`1bw5m7`}],[`path`,{d:`m21 21-1.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]),On=it(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),kn=it(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),An=it(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),jn=it(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Mn=it(`message-circle-question-mark`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Nn=it(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),Pn=it(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Fn=it(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),In=it(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),Ln=it(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),Rn=it(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),zn=it(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function Bn(e){let t=e.trim();return t.startsWith(`/`)||t.startsWith(`~`)?`completion`:`search`}function Vn(e){return e.trim()!==``}function Hn(e){let t=[];for(let n of e){let e=t[t.length-1];if(e&&e.group===n.group){e.items.push(n);continue}t.push({group:n.group,items:[n]})}return t}function Un(e,t){if(t===void 0||t===``)return e;let n=t.endsWith(`/`)?t:`${t}/`;if(!e.startsWith(n))return e;let r=e.slice(n.length);return r===``?e:r}function Wn(e,t){return t!=null&&!x(t)?0:typeof e==`function`?e():e}function Gn(e,t,n){let r=Wn(e,n);return typeof r==`number`?r:r?.[t]}function Kn(e){return typeof e==`function`?e():e}function qn(e,t){return t||e===`click`||e===`mousedown`}function Jn(e){return e?.includes(`mouse`)&&e!==`mousedown`}var Yn=H.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new ie,currentIdRef:{current:null},currentContextRef:{current:null}});function Xn(e,t){e.current=t.current}function Zn(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=H.useRef(n),a=H.useRef(n),o=H.useRef(null),s=H.useRef(null),c=Be();return V(()=>{if(a.current=n,!o.current){i.current=n;return}i.current={open:Gn(i.current,`open`),close:Gn(n,`close`)}},[n,o,i,a]),(0,U.jsx)(Yn.Provider,{value:H.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function Qn(e,t={open:!1}){let{open:n}=t,r=`rootStore`in e?e.rootStore:e,i=r.useState(`floatingId`),{currentIdRef:a,delayRef:o,timeoutMs:s,initialDelayRef:c,currentContextRef:l,hasProvider:u,timeout:f}=H.useContext(Yn),[p,m]=H.useState(!1),h=H.useRef(n);return V(()=>{h.current=n},[n]),V(()=>{function e(){l.current?.setIsInstantPhase(!1),a.current=null,l.current=null,o.current=c.current,f.clear()}if(a.current&&!n&&a.current===i){if(m(!1),s){let t=i;return f.start(s,()=>{r.select(`open`)||a.current&&a.current!==t||e()}),()=>{(h.current||a.current!==t)&&f.clear()}}e()}},[n,i,a,o,s,c,l,f,r]),V(()=>{if(!n)return;let e=l.current,t=a.current;f.clear(),l.current={onOpenChange:r.setOpen,setIsInstantPhase:m},a.current=i,o.current={open:0,close:Gn(c.current,`close`)},t!==null&&t!==i?(m(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,d(F))):(m(!1),e?.setIsInstantPhase(!1))},[n,i,r,a,o,c,l,f]),V(()=>()=>{if(a.current===i){if(l.current=null,!h.current)return;a.current=null,Xn(o,c),f.clear()}},[l,a,o,i,c,f]),H.useMemo(()=>({hasProvider:u,delayRef:o,isInstantPhase:p}),[u,o,p])}function $n(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function er(e){return e!=null&&e.clientX!=null}function tr(e,t={}){let{enabled:n=!0,axis:r=`both`}=t,i=`rootStore`in e?e.rootStore:e,a=i.useState(`open`),o=i.useState(`floatingElement`),s=i.useState(`domReferenceElement`),c=i.context.dataRef,l=H.useRef(!1),u=H.useRef(null),[d,f]=H.useState(),[p,m]=H.useState([]),h=A(e=>{i.set(`positionReference`,e)}),g=A((e,t,n)=>{l.current||c.current.openEvent&&!er(c.current.openEvent)||i.set(`positionReference`,$n(n??s,{x:e,y:t,axis:r,dataRef:c,pointerType:d}))}),_=A(e=>{a?u.current||(g(e.clientX,e.clientY,e.currentTarget),m([])):g(e.clientX,e.clientY,e.currentTarget)}),v=x(d)?o:a;H.useEffect(()=>{if(!n){h(s);return}if(!v)return;function e(){u.current?.(),u.current=null}let t=ae(o);function r(t){let n=Ae(t);Te(o,n)?e():g(t.clientX,t.clientY)}return!c.current.openEvent||er(c.current.openEvent)?u.current=Le(t,`mousemove`,r):h(s),e},[v,n,o,c,s,i,g,h,p]),H.useEffect(()=>()=>{i.set(`positionReference`,null)},[i]),H.useEffect(()=>{n&&!o&&(l.current=!1)},[n,o]),H.useEffect(()=>{!n&&a&&(l.current=!0)},[n,a]);let y=H.useMemo(()=>{function e(e){f(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:_,onMouseEnter:_}},[_]);return H.useMemo(()=>n?{reference:y,trigger:y}:{},[n,y])}function nr(){return new Wt({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new Ft,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function rr(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:nr(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:L,inactiveTriggerProps:L,popupProps:L}}function ir(e,t,n=!1){return new Wt({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0})}var ar=e=>e.triggerIdProp??e.activeTriggerId,or=e=>e.openProp??e.open,sr=e=>(e.popupElement?.id??e.floatingId)||void 0;function cr(e,t){return t!==void 0&&or(e)&&ar(e)===t}function lr(e,t){return cr(e,t)?!0:t!==void 0&&or(e)&&ar(e)==null&&e.triggerCount===1}var ur={open:or,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:ar,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:sr,isTriggerActive:(e,t)=>t!==void 0&&ar(e)===t,isOpenedByTrigger:(e,t)=>cr(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&ar(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>lr(e,t)?sr(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement},dr=S();function fr(e){let t=H.useCallback(t=>e===void 0?h:e.subscribeStore(t),[e]),n=H.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,dr.useSyncExternalStore)(t,n,()=>e?.serverStore)}var pr=He&&fe;function mr(e,t={}){let{enabled:n=!0,delay:r}=t,i=`rootStore`in e?e.rootStore:e,{events:a,dataRef:o}=i.context,s=H.useRef(!1),c=H.useRef(null),l=H.useRef(!0),u=Be();H.useEffect(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=ae(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&se(e)&&e===re(b(e))&&(s.current=!0)}function a(){l.current=!0}function o(){l.current=!1}return P(Le(t,`blur`,r),pr&&Le(t,`keydown`,a,!0),pr&&Le(t,`pointerdown`,o,!0))},[i,n]),H.useEffect(()=>{if(!n)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=i.select(`domReferenceElement`);Fe(e)&&(c.current=e,s.current=!0)}}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[a,n,i]);let f=H.useMemo(()=>{function e(){s.current=!1,c.current=null}return{onMouseLeave(){e()},onFocus(t){let n=t.currentTarget;if(s.current){if(c.current===n)return;e()}let a=Ae(t.nativeEvent);if(Fe(a)){if(pr&&!t.relatedTarget){if(!l.current&&!Oe(a))return}else if(!ge(a))return}let o=Ne(t.relatedTarget,i.context.triggerElements),{nativeEvent:f,currentTarget:p}=t,m=typeof r==`function`?r():r;if(i.select(`open`)&&o||m===0||m===void 0){i.setOpen(!0,d(De,f,p));return}u.start(m,()=>{s.current||i.setOpen(!0,d(De,f,p))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=Fe(n)&&n.hasAttribute(N(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;u.start(0,()=>{let e=i.select(`domReferenceElement`),t=re(b(e));!n&&t===e||Te(o.current.floatingContext?.refs.floating.current,t)||Te(e,t)||a||Ne(n??t,i.context.triggerElements)||i.setOpen(!1,d(De,r))})}}},[o,r,i,u]);return H.useMemo(()=>n?{reference:f,trigger:f}:{},[n,f])}var hr=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new ie,this.restTimeout=new ie,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},gr=new WeakMap;function _r(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&gr.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),gr.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function vr(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=gr.get(n);a&&a!==e&&_r(a),_r(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,gr.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function yr(e){let t=e.context.dataRef.current,n=a(()=>t.hoverInteractionState??hr.create()).current;return t.hoverInteractionState||=n,w(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function br(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=`rootStore`in e?e.rootStore:e,s=a.useState(`open`),c=a.useState(`floatingElement`),l=a.useState(`domReferenceElement`),{dataRef:u}=a.context,f=Ze(),p=$e(),m=yr(a),h=Be(),g=A(()=>qn(u.current.openEvent?.type,m.interactedInside)),v=A(()=>Jn(u.current.openEvent?.type)),y=A(()=>{_r(m)});V(()=>{s||(m.pointerType=void 0,m.restTimeoutPending=!1,m.interactedInside=!1,y())},[s,m,y]),H.useEffect(()=>y,[y]),V(()=>{if(n&&s&&m.handleCloseOptions?.blockPointerEvents&&v()&&Fe(l)&&c){let e=l,t=c,n=b(c),r=f?.nodesRef.current.find(e=>e.id===p)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=m.pointerEventsScopeElement===t?null:m.pointerEventsScopeElement,a=r===t?null:r,o=m.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body;return vr(m,{scopeElement:o,referenceElement:e,floatingElement:t}),()=>{y()}}},[n,s,l,c,m,v,f,p,y]),H.useEffect(()=>{if(!n)return;function e(){return!!(f&&p&&qe(f.nodesRef.current,p).length>0)}function t(e){let t=Gn(r,`close`,m.pointerType),n=()=>{a.setOpen(!1,d(_,e)),f?.events.emit(`floating.closed`,e)};t?m.openChangeTimeout.start(t,n):(m.openChangeTimeout.clear(),n())}function s(e){let t=Ae(e);if(!o(t)){m.interactedInside=!1;return}m.interactedInside=t?.closest(`[aria-haspopup]`)!=null}function l(){m.openChangeTimeout.clear(),h.clear(),f?.events.off(`floating.closed`,x),y()}function b(n){if(e()&&f){f.events.on(`floating.closed`,x);return}if(Ne(n.relatedTarget,a.context.triggerElements))return;let r=u.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(f&&r&&Fe(o)&&qe(f.nodesRef.current,r,!1).some(e=>Te(e.context?.elements.floating,o)))){if(m.handler){m.handler(n);return}y(),v()&&!g()&&t(n)}}function x(t){!f||!p||e()||h.start(0,()=>{f.events.off(`floating.closed`,x),a.setOpen(!1,d(_,t)),f.events.emit(`floating.closed`,t)})}let S=c;return P(S&&Le(S,`mouseenter`,l),S&&Le(S,`mouseleave`,b),S&&Le(S,`pointerdown`,s,!0),()=>{f?.events.off(`floating.closed`,x)})},[n,c,a,u,r,i,v,g,y,m,f,p,h])}var xr={current:null};function Sr(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=xr,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:f,isClosing:p,shouldOpen:m,guardStaleOpen:h=!1}=t,g=`rootStore`in e?e.rootStore:e,{dataRef:v,events:y}=g.context,S=Ze(l),C=yr(g),w=H.useRef(!1),T=Dt(i),E=Dt(r),D=Dt(o),O=Dt(n),k=Dt(m),j=Dt(p),M=A(()=>qn(v.current.openEvent?.type,C.interactedInside)),N=A(()=>k.current?.()!==!1),F=A((e,t,n)=>{let r=g.context.triggerElements;if(r.hasElement(t))return!e||!Te(e,t);if(!Fe(n))return!1;let i=n;return r.hasMatchingElement(e=>Te(e,i))&&(!e||!Te(e,i))}),I=A(()=>{C.handler&&=(b(g.select(`domReferenceElement`)).removeEventListener(`mousemove`,C.handler),void 0)}),L=A(()=>{_r(C)});return u&&(C.handleCloseOptions=T.current?.__options),H.useEffect(()=>I,[I]),H.useEffect(()=>{if(!n)return;function e(e){e.open?w.current=!1:(w.current=e.reason===_,I(),C.openChangeTimeout.clear(),C.restTimeout.clear(),C.blockMouseMove=!0,C.restTimeoutPending=!1)}return y.on(`openchange`,e),()=>{y.off(`openchange`,e)}},[n,y,C,I]),H.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=Gn(E.current,`close`,C.pointerType);n?C.openChangeTimeout.start(n,()=>{g.setOpen(!1,d(_,e)),S?.events.emit(`floating.closed`,e)}):t&&(C.openChangeTimeout.clear(),g.setOpen(!1,d(_,e)),S?.events.emit(`floating.closed`,e))}let t=c.current??(u?g.select(`domReferenceElement`):null);if(!Fe(t))return;function r(e){if(C.openChangeTimeout.clear(),C.blockMouseMove=!1,a&&!x(C.pointerType))return;let t=Kn(D.current),n=Gn(E.current,`open`,C.pointerType),r=Ae(e),i=e.currentTarget??null,o=g.select(`domReferenceElement`),s=i;if(Fe(r)&&!g.context.triggerElements.hasElement(r)){for(let e of g.context.triggerElements.elements())if(Te(e,r)){s=e;break}}Fe(i)&&Fe(o)&&!g.context.triggerElements.hasElement(i)&&Te(i,o)&&(s=o);let c=s!=null&&F(o,s,r),l=g.select(`open`),u=j.current?.()??g.select(`transitionStatus`)===`ending`,f=!l&&u&&w.current,p=!c&&Fe(s)&&Fe(o)&&Te(o,s)&&f,m=t>0&&!n,h=c&&(l||f)||p,v=!l||c;if(h){N()&&g.setOpen(!0,d(_,e,s));return}m||(n?C.openChangeTimeout.start(n,()=>{v&&N()&&g.setOpen(!0,d(_,e,s))}):v&&N()&&g.setOpen(!0,d(_,e,s)))}function i(t){if(M()){L();return}I();let n=g.select(`domReferenceElement`),r=b(n);C.restTimeout.clear(),C.restTimeoutPending=!1;let i=v.current.floatingContext??f?.();if(!Ne(t.relatedTarget,g.context.triggerElements)){if(T.current&&i){g.select(`open`)||C.openChangeTimeout.clear();let n=c.current;C.handler=T.current({...i,tree:S,x:t.clientX,y:t.clientY,onClose(){L(),I(),O.current&&!M()&&n===g.select(`domReferenceElement`)&&e(t,!0)}}),r.addEventListener(`mousemove`,C.handler),C.handler(t);return}(C.pointerType!==`touch`||!Te(g.select(`floatingElement`),t.relatedTarget))&&e(t)}}function o(e){Te(t,e.relatedTarget)||(C.openChangeTimeout.clear(),C.restTimeout.clear(),C.restTimeoutPending=!1)}let l=h?Le(t,`mouseout`,o):void 0;return s?P(Le(t,`mousemove`,r,{once:!0}),Le(t,`mouseenter`,r),Le(t,`mouseleave`,i),l):P(Le(t,`mouseenter`,r),Le(t,`mouseleave`,i),l)},[I,L,v,E,g,n,T,C,u,F,M,a,s,D,c,S,O,f,j,N,h]),H.useMemo(()=>{if(!n)return;function e(e){C.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=g.select(`domReferenceElement`),i=g.select(`open`),o=F(r,n,e.target);if(a&&!x(C.pointerType))return;if(i&&o&&C.handleCloseOptions?.blockPointerEvents){let e=g.select(`floatingElement`);if(e){let t=C.handleCloseOptions?.getScope?.()??n.ownerDocument.body;vr(C,{scopeElement:t,referenceElement:n,floatingElement:e})}}let s=Kn(D.current);if(i&&!o||s===0||!o&&C.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;C.restTimeout.clear();function c(){if(C.restTimeoutPending=!1,M())return;let e=g.select(`open`);!C.blockMouseMove&&(!e||o)&&N()&&g.setOpen(!0,d(_,t,n))}C.pointerType===`touch`?_n.flushSync(()=>{c()}):o&&i?c():(C.restTimeoutPending=!0,C.restTimeout.start(s,c))}}},[n,C,M,F,a,g,D,N])}var Cr=.1,wr=Cr*Cr,Tr=.5;function Er(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function Dr(e,t,n,r,i,a,o,s,c,l){let u=!1;return Er(e,t,n,r,i,a)&&(u=!u),Er(e,t,i,a,o,s)&&(u=!u),Er(e,t,o,s,c,l)&&(u=!u),Er(e,t,c,l,n,r)&&(u=!u),u}function Or(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function kr(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function Ar(e={}){let{blockPointerEvents:t=!1}=e,n=new ie,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*wr;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=Ae(r),g=r.type===`mouseleave`,_=Te(u,h),v=Te(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&Fe(r.relatedTarget)&&Te(u,r.relatedTarget))return;function y(){return!!(s&&qe(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=kr(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=kr(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=kr(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=kr(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!Or(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?Tr/2:Tr*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+Tr+1,o=C||T?S.bottom-Tr:S.top,s=C?T?S.bottom-Tr:S.top:S.bottom-Tr;M=Dr(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?Tr/2:Tr*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-Tr,o=C||T?S.top+Tr:S.bottom,s=C?T?S.top+Tr:S.bottom:S.top+Tr;M=Dr(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?Tr/2:Tr*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+Tr+1,o=w||E?S.right-Tr:S.left,s=w?E?S.right-Tr:S.left:S.right-Tr;M=Dr(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?Tr/2:Tr*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-Tr,o=w||E?S.left+Tr:S.right,s=w?E?S.left+Tr:S.right:S.left+Tr;M=Dr(d,f,a,r,a,i,o,S.top,s,S.bottom);break}}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}function jr(){let{config:e,refresh:t}=Ue(),{save:n,saving:r}=Ve(),i=e.projectList??[],a=e.projectCandidates??[],o=e.projects?.root??``,s=e.projects?.include??[],c=(0,H.useCallback)((e,r)=>{(async()=>{await n({projects:{include:e}},r)&&await t()})()},[n,t]),l=t=>{let n=Un(t,e.projects?.root===void 0?void 0:e.scope);s.includes(n)||c([...s,n],`Project added.`)};return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Mr,{included:i,onRemove:e=>c(s.filter((t,n)=>n!==e),`Project removed.`)}),(0,U.jsx)(Nr,{candidates:a,hasRoot:e.projects?.root!==void 0,onAdd:l}),(0,U.jsx)(Fr,{onAdd:l}),(0,U.jsx)(Ir,{current:o,saving:r,onSave:n,onSaved:t})]})}function Mr({included:e,onRemove:t}){return(0,U.jsx)(Ie,{title:`Projects · ${e.length}`,description:e.length===0?`Nothing yet. A Project is one you have opted into — add one below, and it becomes an option in the New Agent Session view.`:`What the New Agent Session view offers, in this order.`,children:e.length===0?null:(0,U.jsx)(`div`,{className:`flex flex-col`,children:e.map((e,n)=>(0,U.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 border-b py-1.5 last:border-b-0`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,U.jsx)(`span`,{className:`font-mono text-xs`,children:e.group===void 0?e.name:`${e.group}/${e.name}`}),e.missing?(0,U.jsx)(`span`,{className:`text-xs text-destructive`,children:`directory is gone`}):null]}),(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground`,children:e.path}),(0,U.jsx)(O,{variant:`ghost`,size:`icon-sm`,"aria-label":`Remove ${e.name}`,onClick:()=>t(n),children:(0,U.jsx)(zn,{"aria-hidden":!0})})]})]},e.path))})})}function Nr({candidates:e,hasRoot:t,onAdd:n}){return t?(0,U.jsx)(Ie,{title:`Found beneath the Project Root · ${e.length}`,description:`Repositories Flow can see but is not offering. Add the ones you work in.`,children:e.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Nothing left to add. Either everything found is already a Project, or the Project Root holds no git repositories within three levels.`}):(0,U.jsx)(`div`,{className:`flex flex-col gap-2`,children:Hn(e).map(e=>(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e.group===void 0?null:(0,U.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:e.group}),(0,U.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.items.map(e=>(0,U.jsxs)(O,{variant:`outline`,size:`sm`,className:`font-mono text-xs font-normal`,onClick:()=>n(e.path),children:[(0,U.jsx)(Pn,{"aria-hidden":!0}),e.name]},e.path))})]},e.group??``))})}):null}function Pr(e){let[t,n]=(0,H.useState)(void 0),r=(0,H.useRef)(``);return(0,H.useEffect)(()=>{if(r.current=e,!Vn(e)){n(void 0);return}let t=new AbortController,i=setTimeout(()=>{(async()=>{try{let i=await p(`/api/directories?q=${encodeURIComponent(e)}`,{signal:t.signal});if(!i.ok)return;let a=await i.json();a.query===r.current&&n(a)}catch{}})()},150);return()=>{t.abort(),clearTimeout(i)}},[e]),t}function Fr({onAdd:e}){let[t,n]=(0,H.useState)(``),r=Pr(t),i=Bn(t);return(0,U.jsxs)(Ie,{title:`Add any directory`,description:(0,U.jsxs)(U.Fragment,{children:[`Type a name to search beneath the Project Root — repositories included, so`,` `,(0,U.jsx)(`code`,{className:`font-mono text-xs`,children:`packages/api`}),` inside a monorepo is reachable. Start with `,(0,U.jsx)(`code`,{className:`font-mono text-xs`,children:`/`}),` or`,` `,(0,U.jsx)(`code`,{className:`font-mono text-xs`,children:`~`}),` to complete a path anywhere on this machine instead.`]}),children:[(0,U.jsx)(he,{className:`font-mono`,value:t,onChange:e=>n(e.target.value),placeholder:`api, or /home/you/elsewhere`,spellCheck:!1}),r===void 0?null:r.paths.length===0?(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i===`completion`?`No directory there.`:`Nothing beneath the Project Root matches.`}):(0,U.jsxs)(`div`,{className:`flex flex-col`,children:[(0,U.jsxs)(`span`,{className:`pb-1 text-xs text-muted-foreground`,children:[i===`completion`?`Directories here`:`Found beneath the Project Root`,r.truncated?` — showing the first few, keep typing`:null]}),r.paths.map(t=>(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b py-1 last:border-b-0`,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:t}),(0,U.jsxs)(O,{variant:`ghost`,size:`sm`,onClick:()=>{e(t),n(``)},children:[(0,U.jsx)(Pn,{"aria-hidden":!0}),`Add`]})]},t))]})]})}function Ir({current:e,saving:t,onSave:n,onSaved:r}){let[i,a]=(0,H.useState)(e);return(0,H.useEffect)(()=>a(e),[e]),(0,U.jsxs)(Ie,{title:`Project Root`,description:(0,U.jsxs)(U.Fragment,{children:[`The directory Flow looks beneath for candidates, and the one it reports as its default Scope. Absolute, or starting with`,` `,(0,U.jsx)(`code`,{className:`font-mono text-xs`,children:`~`}),`. A Project outside it can still be added by path.`]}),children:[(0,U.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-sm font-medium`,children:`Where your repositories live`}),(0,U.jsx)(he,{className:`font-mono`,value:i,onChange:e=>a(e.target.value),placeholder:`~/workspace`,spellCheck:!1})]}),(0,U.jsx)(de,{dirty:i.trim()!==e,saving:t,onSave:()=>{(async()=>{let e=i.trim()===``?`Project Root cleared.`:`Project Root saved.`;await n({projects:{root:i.trim()}},e)&&await r()})()},onReset:()=>a(e)})]})}var Lr=H.createContext(void 0);function Rr(e){let t=H.useContext(Lr);if(!e&&t===void 0)throw Error(B(27));return t}var zr=H.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=Rr(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`),d={open:c,transitionStatus:s.useState(`transitionStatus`)};return j(`div`,e,{state:d,ref:[s.context.backdropRef,t],stateAttributesMapping:ft,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),Br=H.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...c}=e,l=Rr(),u=l.useState(`open`),{getButtonProps:f,buttonRef:p}=R({disabled:a,native:o}),m={disabled:a};function h(e){u&&l.setOpen(!1,d(s,e.nativeEvent))}return j(`button`,e,{state:m,ref:[t,p],props:[{onClick:h},c,f]})}),Vr=H.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=Rr(),c=xe(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),j(`p`,e,{ref:t,props:[{id:c},o]})}),Hr=H.createContext(void 0);function Ur(){let e=H.useContext(Hr);if(e===void 0)throw Error(B(26));return e}var Wr={...tt,...Ee,nestedDialogOpen(e){return e?{"data-nested-dialog-open":``}:null}},Gr=H.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=Rr(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),y=c.useState(`titleElementId`),b=c.useState(`transitionStatus`),x=c.useState(`role`),S=d.useState(`floatingId`);Ur(),we({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let C=o===void 0?vt(c.context.popupRef):o,w=g>0,T=c.useStateSetter(`popupElement`),E=j(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:w},props:[f,{id:S,"aria-labelledby":y,"aria-describedby":l,role:x,...wt,hidden:!m,onKeyDown(e){Je.has(e.key)&&e.stopPropagation()},style:{"--nested-dialogs":g}},s],ref:[t,c.context.popupRef,T],stateAttributesMapping:Wr});return(0,U.jsx)(lt,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:C,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:E})}),Kr=H.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=Rr(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,U.jsx)(Hr.Provider,{value:n,children:(0,U.jsxs)(u,{ref:t,...r,children:[a&&o===!0&&(0,U.jsx)(et,{ref:i.context.internalBackdropRef,inert:Me(!s)}),e.children]})}):null});function qr({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`disablePointerDismissal`),a=e.useState(`modal`),o=e.useState(`popupElement`),s=e.useState(`floatingRootContext`),[c,l]=H.useState(0),[u,d]=H.useState(0),f=c===0,p=gt(s,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:a===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0)return!1;if(`touches`in t){if(t.type===`touchend`){if(t.changedTouches.length!==1||t.touches.length!==0)return!1}else if(t.touches.length!==1)return!1}let n=Ae(t);if(f&&!i){if(a){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||Te(n,o)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:f});return st(r&&a===!0,o),e.useContextCallback(`onNestedDialogOpen`,(e,t)=>{l(e),d(t)}),V(()=>(t?.onNestedDialogOpen&&(r?t.onNestedDialogOpen(c+1,u+ +!!n):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,c,u,t]),xt(e,{activeTriggerProps:p.reference,inactiveTriggerProps:p.trigger,popupProps:p.floating,nestedOpenDialogCount:c,nestedOpenDrawerCount:u}),null}var Jr={...ur,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role},Yr=class extends f{constructor(e,t,n){let r=new Ft,i=Xr(e,r,t,n);super(i,Zr(r),Jr)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let n={open:e};Ot(n,e,t.trigger),this.update(n)}};function Xr(e,t,n,r=!1){let i={...rr(),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e};return i.floatingRootContext=ir(t,n,r),i}function Zr(e){return{popupRef:H.createRef(),backdropRef:H.createRef(),internalBackdropRef:H.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function Qr(e,t){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:f,defaultTriggerId:p=null}=t,m=e===`drawer`,h=e===`alert-dialog`,g=h?!0:c,_=h||s,v=h?`alertdialog`:`dialog`,y=Rr(!0),b={modal:g,disablePointerDismissal:_,nested:y!=null,role:v},x=Mt((e,t)=>new Yr({open:i,openProp:r,activeTriggerId:p,triggerIdProp:f,...b},e,t),!0);x.useControlledProp(`openProp`,r),x.useControlledProp(`triggerIdProp`,f),x.useSyncedValues(b),x.useContextCallback(`onOpenChange`,a),x.useContextCallback(`onOpenChangeComplete`,o);let S=x.useState(`open`),C=x.useState(`mounted`),w=x.useState(`payload`);kt(x,S),Bt(x);let{forceUnmount:T}=yt(S,x);H.useImperativeHandle(l,()=>({unmount:T,close:()=>x.setOpen(!1,d(D))}),[T,x]);let E=S||C;return(0,U.jsxs)(Lr.Provider,{value:x,children:[u&&(0,U.jsx)(ht,{handle:u,store:x}),E&&(0,U.jsx)(qr,{store:x,parentContext:y?.context,isDrawer:m}),typeof n==`function`?n({payload:w}):n]})}function $r(e){return Qr(`dialog`,e)}var ei=H.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=Rr(),c=xe(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),j(`h2`,e,{ref:t,props:[{id:c},o]})}),ti=H.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,payload:c,handle:l,...u}=e,d=Rr(!0),f=fr(l)??d;if(!f)throw Error(B(79));let p=xe(s),m=f.useState(`floatingRootContext`),h=f.useState(`isOpenedByTrigger`,p),g=f.useState(`triggerPopupId`,p),_=H.useRef(null),{registerTrigger:v,isMountedByThisTrigger:y}=Ct(p,_,f,{payload:c}),{getButtonProps:b,buttonRef:x}=R({disabled:a,native:o}),S=Ut(m),C=rt(()=>f.select(`open`),e=>{f.set(`openMethod`,e)}),w={disabled:a,open:h},T=f.useState(`triggerProps`,y);return j(`button`,e,{state:w,ref:[x,t,v,_],props:[S.reference,T,C,{[k]:``,id:p,"aria-haspopup":`dialog`,"aria-expanded":h,"aria-controls":g},u,b],stateAttributesMapping:pt})});function ni({...e}){return(0,U.jsx)($r,{"data-slot":`dialog`,...e})}function ri({...e}){return(0,U.jsx)(ti,{"data-slot":`dialog-trigger`,...e})}function ii({...e}){return(0,U.jsx)(Kr,{"data-slot":`dialog-portal`,...e})}function ai({className:e,...t}){return(0,U.jsx)(zr,{"data-slot":`dialog-overlay`,className:g(`fixed inset-0 isolate z-50 bg-black/30 duration-100 supports-backdrop-filter:backdrop-blur-sm data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function oi({className:e,children:t,showCloseButton:n=!0,...r}){return(0,U.jsxs)(ii,{children:[(0,U.jsx)(ai,{}),(0,U.jsxs)(Gr,{"data-slot":`dialog-content`,className:g(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-6 rounded-[min(var(--radius-4xl),24px)] bg-popover p-6 text-sm text-popover-foreground shadow-xl ring-1 ring-foreground/5 duration-100 outline-none sm:max-w-md dark:ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[t,n&&(0,U.jsxs)(Br,{"data-slot":`dialog-close`,render:(0,U.jsx)(O,{variant:`ghost`,className:`absolute top-4 right-4 bg-secondary`,size:`icon-sm`}),children:[(0,U.jsx)(zn,{}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function si({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`dialog-header`,className:g(`flex flex-col gap-1.5`,e),...t})}function ci({className:e,showCloseButton:t=!1,children:n,...r}){return(0,U.jsxs)(`div`,{"data-slot":`dialog-footer`,className:g(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,U.jsx)(Br,{render:(0,U.jsx)(O,{variant:`outline`}),children:`Close`})]})}function li({className:e,...t}){return(0,U.jsx)(ei,{"data-slot":`dialog-title`,className:g(`font-heading text-base leading-none font-medium`,e),...t})}function ui({className:e,...t}){return(0,U.jsx)(Vr,{"data-slot":`dialog-description`,className:g(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function di({session:e,onClose:t}){let{connection:n,config:r}=Ue(),[i,a]=(0,H.useState)(e.suggestedScope??``),[o,s]=(0,H.useState)(()=>yn(e.scope,r.projectList??[])??``),[c,l]=(0,H.useState)(void 0),[u,d]=(0,H.useState)(!1),f=i.trim()!==``&&(!e.worktree||o.trim()!==``),p=async()=>{d(!0),l(void 0);try{await n.command({type:`relocate`,sessionId:e.id,scope:i.trim(),...e.worktree?{repo:o.trim()}:{}}),await n.command({type:`revive`,sessionId:e.id}),t()}catch(e){l(e instanceof Error?e.message:String(e))}finally{d(!1)}};return(0,U.jsx)(ni,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,U.jsxs)(oi,{className:`sm:max-w-lg`,children:[(0,U.jsxs)(si,{children:[(0,U.jsx)(li,{children:`Relocate Agent Session`}),(0,U.jsx)(ui,{children:`Its Scope no longer exists. Choose where its files are now.`})]}),(0,U.jsx)(ne,{label:`Old Scope`,children:e.scope}),(0,U.jsx)(fi,{label:`Scope`,value:i,onChange:a}),e.worktree?(0,U.jsx)(fi,{label:`Repository`,value:o,onChange:s}):null,c===void 0?null:(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:c}),(0,U.jsxs)(ci,{children:[(0,U.jsx)(O,{variant:`outline`,onClick:t,children:`Cancel`}),(0,U.jsx)(O,{disabled:!f||u,onClick:()=>void p(),children:`Relocate and revive`})]})]})})}function fi({label:e,value:t,onChange:n}){let r=Pr(t),i=(0,H.useId)();return(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(`label`,{htmlFor:i,className:`text-sm font-medium`,children:e}),(0,U.jsx)(he,{id:i,className:`font-mono`,value:t,onChange:e=>n(e.target.value),placeholder:`/path/to/folder`,spellCheck:!1}),r?.paths.filter(e=>e!==t).slice(0,5).map(e=>(0,U.jsx)(O,{variant:`ghost`,size:`sm`,className:`justify-start font-mono text-xs`,onClick:()=>n(e),children:e},e))]})}var pi=new Map;function mi(e,t){pi.set(e,structuredClone(t))}function hi(e){let t=pi.get(e);return t&&structuredClone(t)}function gi(e){pi.delete(e)}function _i(e){for(let t of pi.keys())e.has(t)||pi.delete(t)}var vi=2e3,yi=3e4,bi=(0,H.createContext)(void 0);function xi(){let e=(0,H.useContext)(bi);if(!e)throw Error(`useAgentSessions outside SessionsProvider`);return e}function Si({children:e}){let{connection:t}=Ue(),[n,r]=(0,H.useState)([]),[i,a]=(0,H.useState)(!1),[o,s]=(0,H.useState)(void 0),c=(0,H.useRef)(()=>{});(0,H.useEffect)(()=>{let e=!1,n,i,o=0,s=0,l=0,u=e=>{n&&clearTimeout(n),n=setTimeout(()=>void d(),e)},d=async()=>{if(e||document.hidden)return;i?.abort(),i=new AbortController;let n=++o;try{let i=await t.listSessions();if(e||n<=s)return;s=n,l=0,_i(new Set(i.map(e=>e.id))),r(i),a(!0),u(vi)}catch{if(e)return;a(!0),l+=1,u(Math.min(yi,vi*2**l))}},f=()=>{document.hidden||d()};return c.current=()=>void d(),d(),document.addEventListener(`visibilitychange`,f),()=>{e=!0,c.current=()=>{},n&&clearTimeout(n),i?.abort(),document.removeEventListener(`visibilitychange`,f)}},[t]);let l=(0,H.useCallback)(()=>c.current(),[]),u=n.find(e=>e.id===o);return(0,U.jsxs)(bi.Provider,{value:{sessions:n,loaded:i,nudge:l,relocate:s},children:[e,u?(0,U.jsx)(di,{session:u,onClose:()=>{s(void 0),l()}}):null]})}function Ci(){let{connection:e}=Ue(),{nudge:t,relocate:n}=xi();return(0,H.useCallback)(async r=>{try{let n=await e.command(r);return t(),n}catch(e){if(e.code===`scope_missing`&&`sessionId`in r){n(r.sessionId),t();return}ze.error(`${r.type} failed`,e instanceof Error?e.message:String(e)),t();return}},[e,t,n])}var wi=[`general`,`projects`,`permissions`,`providers`,`appearance`,`keyboard`,`workflows`,`secrets`,`mcp`],Ti={sessionId:void 0};function Ei(e){let[t=``,n=``]=e.replace(/^#\/?/,``).split(`?`,2),r=t.split(`/`).filter(e=>e!==``);if(r[0]===`settings`)return{sessionId:void 0,settings:ki(r[1])};let i=Di(r),a=new URLSearchParams(n).get(`settings`);return a===null?i:{...i,settings:ki(a)}}function Di(e){if(e[0]===`schedules`){let t={sessionId:void 0,schedules:!0};if(e[1]===`occurrences`){let n=Ai(e[2]??``);return n?{...t,occurrenceId:n}:t}let n=Ai(e[1]??``);return n?{...t,scheduleId:n}:t}if(e[0]===`new`&&e[1])return{sessionId:void 0,backend:Ai(e[1])};if(e[0]!==`s`||e[1]===void 0)return Ti;let t=Ai(e[1]);return{sessionId:t===``?void 0:t}}function Oi(e){let t=e.schedules?`#/schedules${e.occurrenceId?`/occurrences/${encodeURIComponent(e.occurrenceId)}`:e.scheduleId?`/${encodeURIComponent(e.scheduleId)}`:``}`:e.sessionId===void 0?e.backend?`#/new/${encodeURIComponent(e.backend)}`:``:`#/s/${encodeURIComponent(e.sessionId)}`;return e.settings===void 0?t:`${t||`#/`}?settings=${e.settings}`}function ki(e){return wi.find(t=>t===Ai(e??``))??wi[0]}function Ai(e){try{return decodeURIComponent(e)}catch{return``}}function ji(e){return e.title||e.id}var Mi=60,Ni=[{key:`description`,shape:`text`},{key:`command`,shape:`text`},{key:`questions`,shape:`questions`},{key:`file_path`,shape:`path`},{key:`notebook_path`,shape:`path`},{key:`pattern`,shape:`text`},{key:`url`,shape:`text`},{key:`query`,shape:`text`},{key:`path`,shape:`path`},{key:`prompt`,shape:`text`}],Pi=Ni.filter(({key:e})=>e!==`description`);function Fi(e){return Li(e,Mi)}function Ii(e){return Li(e,1/0,Pi)}function Li(e,t,n=Ni){if(!e||typeof e!=`object`)return;let r=e;for(let e of n){let n=r[e.key];if(e.shape===`questions`){let e=Ri(n,t);if(e!==void 0)return e;continue}if(typeof n==`string`&&n.trim()!==``)return e.shape===`path`?Bi(n.trim(),t):zi(n,t)}let i=Object.values(r).filter(e=>typeof e==`string`),a=i.length===1?i[0]:void 0;return a&&a.trim()!==``?zi(a,t):void 0}function Ri(e,t){if(!Array.isArray(e)||e.length===0)return;let n=e[0];if(!n||typeof n!=`object`)return;let r=n.question;if(typeof r!=`string`||r.trim()===``)return;let i=e.length-1;return zi(i>0?`${r} (+${i} more)`:r,t)}function zi(e,t){let n=e.replace(/\s+/g,` `).trim();return n.length<=t?n:`${n.slice(0,t-1)}…`}function Bi(e,t){return e.length<=t?e:`…${e.slice(-(t-1))}`}var Vi=H.createContext(void 0);function Hi(e){let t=H.useContext(Vi);if(t===void 0&&!e)throw Error(B(72));return t}var Ui={...ur,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},Wi=class extends f{constructor(e,t,n){let r=new Ft;super(Gi(e,r,t,n),Ki(r),Ui)}setOpen=(e,t)=>{jt(this,e,t,{extraState:{openChangeReason:t.reason}})};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,d(z,e))}};function Gi(e,t,n,r=!1){let i={...rr(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e};return i.floatingRootContext=ir(t,n,r),i}function Ki(e){return{popupRef:H.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}var qi=ye(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:f=null,children:p}=e,m=Mt((e,t)=>new Wi({open:n,openProp:r,activeTriggerId:f,triggerIdProp:u},e,t));m.useControlledProp(`openProp`,r),m.useControlledProp(`triggerIdProp`,u),m.useContextCallback(`onOpenChange`,s),m.useContextCallback(`onOpenChangeComplete`,c);let h=m.useState(`open`),g=!t&&h,_=m.useState(`activeTriggerId`),v=m.useState(`mounted`),y=m.useState(`payload`);m.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i,disabled:t}),Bt(m,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:b,transitionStatus:x}=yt(g,m),S=m.useState(`isInstantPhase`),C=m.useState(`instantType`),w=m.useState(`lastOpenChangeReason`),T=H.useRef(null);V(()=>{h&&t&&m.setOpen(!1,d(_e))},[h,t,m]),V(()=>{x===`ending`&&w===`none`||x!==`ending`&&S?(C!==`delay`&&(T.current=C),m.set(`instantType`,`delay`)):T.current!==null&&(m.set(`instantType`,T.current),T.current=null)},[x,S,w,C,m]),V(()=>{g&&(_??m.set(`payload`,void 0))},[m,_,g]),H.useImperativeHandle(o,()=>({unmount:b,close:()=>m.setOpen(!1,d(D))}),[b,m]);let E=g||v||!t&&a!==`none`;return(0,U.jsxs)(Vi.Provider,{value:m,children:[l&&(0,U.jsx)(ht,{handle:l,store:m}),E&&(0,U.jsx)(Ji,{store:m,disabled:t,trackCursorAxis:a}),typeof p==`function`?p({payload:y}):p]})});function Ji({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=gt(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=tr(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n}),o=H.useMemo(()=>ee(a.reference,i.reference),[a.reference,i.reference]);return xt(e,{activeTriggerProps:o,inactiveTriggerProps:o,popupProps:i.floating??L}),null}var Yi=H.createContext(void 0);function Xi(){return H.useContext(Yi)}var Zi=`data-base-ui-tooltip-trigger`;function Qi(e){if(`composedPath`in e){let t=e.composedPath();for(let e=0;e<t.length;e+=1){let n=t[e];if(Fe(n))return n}}let t=e.target;return Fe(t)?t:null}function $i(e){let t=e;for(;t;){let e=t.closest(`[${Zi}]`);if(e)return e;let n=t.getRootNode();t=`host`in n&&Fe(n.host)?n.host:null}return null}var ea=c(function(e,t){let{render:n,className:r,style:i,handle:a,payload:o,disabled:s,delay:c,closeOnClick:l=!0,closeDelay:u,id:f,...p}=e,m=Hi(!0),h=fr(a)??m;if(!h)throw Error(B(82));let g=xe(f),v=h.useState(`isTriggerActive`,g),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`floatingRootContext`),S=H.useRef(null),C=c??600,w=u??0,{registerTrigger:T,isMountedByThisTrigger:E}=Ct(g,S,h,{payload:o,closeOnClick:l,closeDelay:w}),D=Xi(),{delayRef:O,isInstantPhase:k,hasProvider:A}=Qn(b,{open:y}),M=yr(b);h.useSyncedValue(`isInstantPhase`,k);let N=h.useState(`disabled`),P=s??N,F=Dt(P),I=h.useState(`trackCursorAxis`),L=h.useState(`disableHoverablePopup`),R=H.useRef(!1),ee=Be(),z=H.useRef(void 0);function te(){return A?Gn(O.current,`open`)===0?0:c??D??600:C}function V(e){let t=S.current;if(!t||!e)return!1;let n=$i(e);return n!==null&&n!==t&&Te(t,n)}function ne(e){let t=V(e);return R.current=t,t&&(M.openChangeTimeout.clear(),M.restTimeout.clear(),M.restTimeoutPending=!1,ee.clear()),t}let re=Sr(b,{enabled:!P,mouseOnly:!0,move:!1,handleClose:!L&&I!==`both`?Ar():null,restMs:te,delay(){return u==null&&A?{close:Gn(O.current,`close`)}:{close:w}},triggerElementRef:S,isActiveTrigger:v,isClosing:()=>h.select(`transitionStatus`)===`ending`,shouldOpen(){return!R.current}}),ie=mr(b,{enabled:!P}).reference,ae=e=>{let t=R.current,n=Qi(e),r=ne(n),i=S.current,a=i&&n&&Te(i,n);if(r&&h.select(`open`)&&h.select(`lastOpenChangeReason`)===`trigger-hover`){h.setOpen(!1,d(_,e));return}if(t&&!r&&a&&!F.current&&!h.select(`open`)&&i&&x(z.current)){let t=()=>{!R.current&&!F.current&&!h.select(`open`)&&h.setOpen(!0,d(_,e,i))},n=te();n===0?(ee.clear(),t()):ee.start(n,t)}},oe=h.useState(`triggerProps`,E);return j(`button`,e,{state:{open:y},ref:[t,T,S],props:[re,ie,E||I!==`none`?oe:void 0,{onMouseOver(e){ae(e.nativeEvent)},onFocus(e){V(Qi(e.nativeEvent))&&e.preventBaseUIHandler()},onMouseLeave(){R.current=!1,ee.clear(),z.current=void 0},onPointerEnter(e){z.current=e.pointerType},onPointerDown(e){z.current=e.pointerType,h.set(`closeOnClick`,l),l&&!h.select(`open`)&&h.cancelPendingOpen(e.nativeEvent)},onClick(e){l&&!h.select(`open`)&&h.cancelPendingOpen(e.nativeEvent)},id:g,"data-trigger-disabled":P?``:void 0,[Zi]:P?void 0:``},p],stateAttributesMapping:pt})}),ta=H.createContext(void 0);function na(){let e=H.useContext(ta);if(e===void 0)throw Error(B(70));return e}var ra=H.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return Hi().useState(`mounted`)||n?(0,U.jsx)(ta.Provider,{value:n,children:(0,U.jsx)(M,{ref:t,...r})}):null}),ia=H.createContext(void 0);function aa(){let e=H.useContext(ia);if(e===void 0)throw Error(B(71));return e}var oa=H.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=Pe,style:g,..._}=e,v=Hi(),y=na(),b=v.useState(`open`),x=v.useState(`mounted`),S=v.useState(`trackCursorAxis`),C=v.useState(`disableHoverablePopup`),w=v.useState(`floatingRootContext`),T=v.useState(`instantType`),E=v.useState(`transitionStatus`),D=v.useState(`adaptiveOrigin`),O=ct({anchor:i,positionMethod:a,floatingRootContext:w,mounted:x,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:y,collisionAvoidance:h,adaptiveOrigin:D}),k=H.useMemo(()=>({open:b,side:O.side,align:O.align,anchorHidden:O.anchorHidden,instant:S===`none`?T:`tracking-cursor`}),[b,O.side,O.align,O.anchorHidden,S,T]),A=nt(e,k,{styles:O.positionerStyles,transitionStatus:E,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!x,inert:!b||S===`both`||C});return(0,U.jsx)(ia.Provider,{value:O,children:A})}),sa=H.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=Hi(),{side:s,align:c}=aa(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`),m=o.useState(`disabled`),h=o.useState(`closeDelay`);we({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),br(p,{enabled:!m,closeDelay:h});let g=o.useStateSetter(`popupElement`);return j(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,g],props:[wt,f,Nt(d),a],stateAttributesMapping:ft})}),ca=H.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=Hi(),{arrowRef:s,side:c,align:l,arrowUncentered:u,arrowStyles:d}=aa(),f={open:o.useState(`open`),side:c,align:l,uncentered:u,instant:o.useState(`instantType`)};return j(`div`,e,{state:f,ref:[t,s],props:[{style:d,"aria-hidden":!0},a],stateAttributesMapping:tt})}),la=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=H.useMemo(()=>({open:t,close:n}),[t,n]);return(0,U.jsx)(Yi.Provider,{value:t,children:(0,U.jsx)(Zn,{delay:i,timeoutMs:r,children:e.children})})};function ua({delay:e=0,...t}){return(0,U.jsx)(la,{"data-slot":`tooltip-provider`,delay:e,...t})}function da({...e}){return(0,U.jsx)(qi,{"data-slot":`tooltip`,...e})}function fa({...e}){return(0,U.jsx)(ea,{"data-slot":`tooltip-trigger`,...e})}function pa({className:e,side:t=`top`,sideOffset:n=4,align:r=`center`,alignOffset:i=0,children:a,...o}){return(0,U.jsx)(ra,{children:(0,U.jsx)(oa,{align:r,alignOffset:i,side:t,sideOffset:n,className:`isolate z-50`,children:(0,U.jsxs)(sa,{"data-slot":`tooltip-content`,className:g(`z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-xl bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-lg data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...o,children:[a,(0,U.jsx)(ca,{className:`z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:translate-x-[1.5px] data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:translate-x-[-1.5px] data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:translate-x-[-1.5px] data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:translate-x-[1.5px] data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5`})]})})})}var ma=H.createContext(void 0);function ha(e){let t=H.useContext(ma);if(t===void 0&&!e)throw Error(B(33));return t}var ga=H.createContext(void 0);function _a(e){let t=H.useContext(ga);if(t===void 0&&!e)throw Error(B(36));return t}var va=H.createContext(void 0);function ya(e=!0){let t=H.useContext(va);if(t===void 0&&!e)throw Error(B(25));return t}function ba(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),u=a.useState(`open`),d=ya(!0),f=d!==void 0;return H.useMemo(()=>({id:r,role:`menuitem`,tabIndex:u&&n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:We})},onMouseUp(e){if(d){let t=d.initialCursorPointRef.current;if(d.initialCursorPointRef.current=null,f&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||f&&!He&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!f||e.button===2)&&c.type===`regular-item`&&m(s.current,e,{detail:1})}}),[t,n,r,l,i,u,a,o,s,d,f,c])}var xa={type:`regular-item`};function Sa(e){let{closeOnClick:t,disabled:n,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=H.useRef(null),{getButtonProps:d,buttonRef:f}=R({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=ba({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=H.useCallback(e=>ee(p,{onMouseEnter(){c.type===`submenu-trigger`&&c.setActive()}},e,d),[p,d,c]),h=I(u,f);return H.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var Ca=H.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,d=Ke({guess:!0,label:a}),f=ha(!0),p=xe(i),{store:m}=_a(),h=m.useState(`disabled`),g=s||h,_=m.useState(`isActive`,d.index),v=m.useState(`itemProps`),{getItemProps:y,itemRef:b}=Sa({closeOnClick:c,disabled:g,highlighted:_,id:p,store:m,nativeButton:o,nodeId:f?.context.nodeId,itemMetadata:xa});return j(`div`,e,{state:{disabled:g,highlighted:_},props:[v,u,y],ref:[b,t,d.ref]})}),wa=H.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s}=_a(),{side:c,align:l}=ha(),u=Et(!0)!=null,f=s.useState(`open`),p=s.useState(`transitionStatus`),m=s.useState(`popupProps`),h=s.useState(`mounted`),g=s.useState(`instantType`),_=s.useState(`activeTriggerElement`),v=s.useState(`parent`),y=s.useState(`lastOpenChangeReason`),b=s.useState(`rootId`),x=s.useState(`floatingRootContext`),S=s.useState(`floatingTreeRoot`),C=s.useState(`closeDelay`),w=s.useState(`hoverEnabled`),T=s.useState(`disabled`),E=s.useState(`openMethod`),D=v.type===`context-menu`;we({open:f,ref:s.context.popupRef,onComplete(){f&&s.context.onOpenChangeComplete?.(!0)}}),H.useEffect(()=>{function e(e){s.setOpen(!1,d(e.reason,e.domEvent))}return S.events.on(`close`,e),()=>{S.events.off(`close`,e)}},[S.events,s]),br(x,{enabled:w&&!T&&!D&&v.type!==`menubar`,closeDelay:C});let O=s.useStateSetter(`popupElement`),k={transitionStatus:p,side:c,align:l,open:f,nested:v.type===`menu`,instant:g},A=j(`div`,e,{state:k,ref:[t,s.context.popupRef,O],stateAttributesMapping:ft,props:[m,{onKeyDown(e){u&&Je.has(e.key)&&e.stopPropagation()}},Nt(p),o,{"data-rootownerid":b}]}),M=v.type===void 0||D;return(_||v.type===`menubar`&&y!==`outside-press`)&&(M=!0),(0,U.jsx)(lt,{context:x,openInteractionType:E,modal:D,disabled:!h,returnFocus:a===void 0?M:a,initialFocus:v.type!==`menu`,restoreFocus:!0,externalTree:v.type===`menubar`?void 0:S,previousFocusableElement:_,nextFocusableElement:v.type===void 0?s.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:v.type===void 0?s.context.beforeContentFocusGuardRef:void 0,children:A})}),Ta=H.createContext(void 0);function Ea(){let e=H.useContext(Ta);if(e===void 0)throw Error(B(32));return e}var Da=H.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=_a();return i.useState(`mounted`)||n?(0,U.jsx)(Ta.Provider,{value:n,children:(0,U.jsx)(u,{ref:t,...r})}):null}),Oa=H.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:f=5,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:h=!1,collisionAvoidance:g=ce,style:_,...v}=e,{store:b}=_a(),x=Ea(),S=ya(!0),C=b.useState(`parent`),w=b.useState(`floatingRootContext`),T=b.useState(`floatingTreeRoot`),E=b.useState(`mounted`),D=b.useState(`open`),O=b.useState(`modal`),k=b.useState(`openMethod`),A=b.useState(`activeTriggerElement`),j=b.useState(`transitionStatus`),M=b.useState(`positionerElement`),N=b.useState(`instantType`),P=b.useState(`adaptiveOrigin`),F=b.useState(`lastOpenChangeReason`),I=b.useState(`floatingNodeId`),L=b.useState(`floatingParentNodeId`),R=w.useState(`domReferenceElement`),ee=H.useRef(null),z=ke(M),B=n,te=c,ne=l,re=s,ie=g;C.type===`context-menu`&&(B=n??C.context?.anchor,re??=`start`,!o&&re!==`center`&&(ne=e.alignOffset??2,te=e.sideOffset??-5));let ae=o,oe=re;C.type===`menu`?(ae??=`inline-end`,oe??=`start`,ie=e.collisionAvoidance??Pe):C.type===`menubar`&&(ae??=C.context.orientation===`vertical`?`inline-end`:`bottom`,oe??=`start`);let se=C.type===`context-menu`,le=ct({anchor:B,floatingRootContext:w,positionMethod:S?`fixed`:r,mounted:E,side:ae,sideOffset:te,align:oe,alignOffset:ne,arrowPadding:se?0:p,collisionBoundary:u,collisionPadding:f,sticky:m,nodeId:I,keepMounted:x,disableAnchorTracking:h,collisionAvoidance:ie,shift:se?{crossAxis:!(`side`in ie&&ie.side===`flip`),rootBoundary:`layoutViewport`}:void 0,externalTree:T,adaptiveOrigin:P});H.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===I&&b.set(`hoverEnabled`,!1),e.nodeId!==I&&e.parentNodeId===b.select(`floatingParentNodeId`)&&b.setOpen(!1,d(y)))}return T.events.on(`menuopenchange`,e),()=>{T.events.off(`menuopenchange`,e)}},[b,T.events,I]),H.useEffect(()=>{if(b.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==b.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;b.setOpen(!1,d(t))}return T.events.on(`menuopenchange`,e),()=>{T.events.off(`menuopenchange`,e)}},[T.events,b]);let ue=Be();H.useEffect(()=>{D||ue.clear()},[D,ue]),H.useEffect(()=>{function e(e){if(!(!D||e.nodeId!==b.select(`floatingParentNodeId`))){if(e.target&&A&&A!==e.target){let e=b.select(`closeDelay`);e>0?ue.isStarted()||ue.start(e,()=>{b.setOpen(!1,d(y))}):b.setOpen(!1,d(y))}else ue.clear()}}return T.events.on(`itemhover`,e),()=>{T.events.off(`itemhover`,e)}},[T.events,D,A,b,ue]),H.useEffect(()=>{let e={open:D,nodeId:I,parentNodeId:L,reason:b.select(`lastOpenChangeReason`)};T.events.emit(`menuopenchange`,e)},[T.events,D,b,I,L]),V(()=>{let e=R,t=ee.current;if(e&&(ee.current=e),t&&e&&e!==t){b.set(`instantType`,void 0);let e=new AbortController;return z(()=>{b.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[R,z,b]);let de={open:D,side:le.side,align:le.align,anchorHidden:le.anchorHidden,nested:C.type===`menu`,instant:N},fe=C.type===`menubar`&&C.context.modal;Xe(D&&(fe||O&&F!==`trigger-hover`),k===`touch`,M,A);let pe=nt(e,de,{styles:le.positionerStyles,transitionStatus:j,props:v,refs:[t,b.useStateSetter(`positionerElement`)],hidden:!E,inert:!D}),me=E&&C.type!==`menu`&&(C.type!==`menubar`&&O&&F!==`trigger-hover`||C.type===`menubar`&&C.context.modal),he=null;return C.type===`menubar`?he=C.context.contentElement:C.type===void 0&&(he=A),(0,U.jsxs)(ma.Provider,{value:le,children:[me&&(0,U.jsx)(et,{ref:C.type===`context-menu`||C.type===`nested-context-menu`?C.context.internalBackdropRef:null,inert:Me(!D),cutout:he}),(0,U.jsx)(Ye,{id:I,children:(0,U.jsx)(at,{elementsRef:b.context.itemDomElements,labelsRef:b.context.itemLabels,children:pe})})]})}),ka=H.createContext(null);function Aa(e){let t=H.useContext(ka);if(t===null&&!e)throw Error(B(5));return t}var ja={...ur,disabled:e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0),openMethod:e=>e.openMethod,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId,activeIndex:e=>e.activeIndex,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)}},Ma=class extends f{constructor(e){super({...Pa(),...e},Na(),ja),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);(t!==i||n!==a||r!==o)&&(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}unsubscribeParentListener=null};function Na(){return{positionerRef:H.createRef(),popupRef:H.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:H.createRef(),beforeContentFocusGuardRef:H.createRef(),onOpenChangeComplete:void 0,triggerElements:new Ft}}function Pa(){return{...rr(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new ot,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:L,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0}}var Fa=H.createContext(void 0);function Ia(){return H.useContext(Fa)}var La=ye(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:o=!1,modal:s,loopFocus:c=!0,orientation:u=`vertical`,actionsRef:f,closeParentOnEsc:p=!1,handle:m,triggerId:h,defaultTriggerId:g=null,highlightItemOnHover:_=!0}=e,v=ya(!0),y=_a(!0),b=Aa(!0),x=Ia(),S=H.useMemo(()=>x&&y?{type:`menu`,store:y.store}:b?{type:`menubar`,context:b}:v&&!y?{type:`context-menu`,context:v}:{type:void 0},[v,y,b,x]),C=Ra({open:a,openProp:n,activeTriggerId:g,triggerIdProp:h,parent:S});C.useControlledProp(`openProp`,n),C.useControlledProp(`triggerIdProp`,h),C.useContextCallback(`onOpenChangeComplete`,i);let w=te(),T=te(),E=C.useState(`floatingTreeRoot`),O=ut(E),k=$e(),j=C.useState(`open`),M=C.useState(`activeTriggerElement`),N=C.useState(`positionerElement`),P=C.useState(`hoverEnabled`),F=C.useState(`disabled`),I=C.useState(`lastOpenChangeReason`),R=C.useState(`parent`),z=C.useState(`activeIndex`),B=C.useState(`payload`),ne=C.useState(`floatingParentNodeId`),re=H.useRef(null),ie=H.useRef(R.type!==`context-menu`),ae=Be(),oe=H.useRef(!0),se=Be(),ce=ne!=null,{openMethod:le,triggerProps:ue}=Tt(j);C.useSyncedValues({disabled:o,highlightItemOnHover:_,modal:R.type===void 0?s:void 0,openMethod:le,rootId:w}),Bt(C);let{forceUnmount:de}=yt(j,C,()=>{C.set(`allowMouseEnter`,!1)});V(()=>{v&&!y?C.update({parent:{type:`context-menu`,context:v},floatingNodeId:O,floatingParentNodeId:k}):y&&C.update({floatingNodeId:O,floatingParentNodeId:k})},[v,y,O,k,C]),H.useEffect(()=>{if(j||(re.current=null),R.type===`context-menu`){if(!j){ae.clear(),ie.current=!1;return}ae.start(500,()=>{ie.current=!0})}},[ae,j,R.type]),V(()=>{!j&&!P&&C.set(`hoverEnabled`,!0)},[j,P,C]);let fe=A((e,t)=>{let n=t.reason;if(!e&&!C.select(`open`)||j===e&&t.trigger===M&&I===n)return;let i=Lt(t);if(!e&&t.trigger==null&&(t.trigger=M??void 0),r?.(e,t),t.isCanceled)return;C.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&a?.type===`click`&&a.pointerType===`touch`&&!oe.current)return;e&&n===`trigger-focus`?(oe.current=!1,se.start(300,()=>{oe.current=!0})):(oe.current=!0,se.clear());let o=(n===`trigger-press`||n===`item-press`)&&a.detail===0,s=!e&&(n===`escape-key`||n==null),c={open:e,openChangeReason:n};re.current=t.event,Ot(c,e,t.trigger,i()),C.update(c),R.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?C.set(`instantType`,`group`):o||s?C.set(`instantType`,o?`click`:`dismiss`):C.set(`instantType`,void 0)}),pe=Vt({popupStore:C,floatingId:T,nested:k!=null,onOpenChange:fe}),me=pe.context.events;V(()=>{let e=({open:e,eventDetails:t})=>fe(e,t);return me.on(`setOpen`,e),()=>{me?.off(`setOpen`,e)}},[me,fe]);let he=H.useCallback(()=>{C.setOpen(!1,d(D))},[C]);H.useImperativeHandle(f,()=>({unmount:de,close:he}),[de,he]);let ge;R.type===`context-menu`&&(ge=R.context),H.useImperativeHandle(ge?.positionerRef,()=>N,[N]),H.useImperativeHandle(ge?.actionsRef,()=>({setOpen:fe}),[fe]);let _e=gt(pe,{enabled:!F,bubbles:{escapeKey:p&&R.type===`menu`},outsidePress(){return R.type!==`context-menu`||re.current?.type===`contextmenu`||ie.current},externalTree:ce?E:void 0}),ve=Ge(),ye=H.useCallback(e=>{C.select(`activeIndex`)!==e&&C.set(`activeIndex`,e)},[C]),be=zt(pe,{enabled:!F,listRef:C.context.itemDomElements,activeIndex:z,nested:R.type!==void 0,loopFocus:c,orientation:u,parentOrientation:R.type===`menubar`?R.context.orientation:void 0,rtl:ve===`rtl`,disabledIndices:l,onNavigate:ye,openOnArrowKeyDown:R.type!==`context-menu`,externalTree:ce?E:void 0,focusItemOnHover:_}),xe=H.useCallback(e=>{C.context.typingRef.current=e},[C]),Se=bt(pe,{enabled:!F,listRef:C.context.itemLabels,elementsRef:C.context.itemDomElements,activeIndex:z,resetMs:500,onMatch:e=>{j&&e!==z&&C.set(`activeIndex`,e)},onTyping:xe}),Ce=H.useMemo(()=>{let e=ee(Se.reference,be.reference,_e.reference,{onMouseMove(){C.set(`allowMouseEnter`,!0)}},ue);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=j,e},[C,Se.reference,be.reference,_e.reference,ue,j]),we=H.useMemo(()=>{let e=ee(be.trigger,_e.trigger,ue);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[be.trigger,_e.trigger,ue]),Te=H.useMemo(()=>ee(wt,{id:T,role:`menu`,"aria-labelledby":M?.id,onMouseMove(){C.set(`allowMouseEnter`,!0),R.type===`menu`&&C.set(`hoverEnabled`,!1)},onClick(){C.select(`hoverEnabled`)&&C.set(`hoverEnabled`,!1)},onKeyDown(e){let t=C.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},Se.floating,be.floating,_e.floating),[M,T,R.type,C,Se.floating,be.floating,_e.floating]),Ee=be.item??L;xt(C,{floatingRootContext:pe,activeTriggerProps:Ce,inactiveTriggerProps:we,popupProps:Te,itemProps:Ee});let De=H.useMemo(()=>({store:C,parent:S}),[C,S]),Oe=(0,U.jsxs)(ga.Provider,{value:De,children:[m&&(0,U.jsx)(ht,{handle:m,store:C}),typeof t==`function`?t({payload:B}):t]});return R.type===void 0||R.type===`context-menu`?(0,U.jsx)(Ht,{externalTree:E,children:Oe}):Oe});function Ra(e){return a(()=>new Ma(e)).current}function za(e){let t=_a().store,n=H.useMemo(()=>({parentMenu:t}),[t]);return(0,U.jsx)(Fa.Provider,{value:n,children:(0,U.jsx)(La,{...e})})}function Ba(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=v(),{ref:i,index:a}=Ke(e),o=n===a,s=H.useRef(null),c=I(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}function Va(e){let{render:t,className:n,style:r,state:i=L,props:a=l,refs:o=l,metadata:s,stateAttributesMapping:c,tag:u=`div`,...d}=e,{compositeProps:f,compositeRef:p}=Ba({metadata:s});return j(u,e,{state:i,ref:[p,...o],props:[f,...a,d],stateAttributesMapping:c})}function Ha(e){if(se(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!le(e))return Ha(je(e))}function Ua(e,t){let n=H.useRef(null);function r(t){_n.flushSync(()=>{e.setOpen(!1,d(C,t.nativeEvent,t.currentTarget))}),me(n.current)?.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&pe(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{_n.flushSync(()=>{e.setOpen(!1,d(C,n.nativeEvent,n.currentTarget))});let i=Ce(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&Te(r,i);){let e=i;if(i=ue(i),i===e)break}i?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function Wa(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=H.useRef(!1);return H.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,b(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:L,[t,n,r])}var Ga=c(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,openOnHover:c,delay:l=100,closeDelay:u=0,handle:d,payload:f,...p}=e,m=_a(!0),h=fr(d)??m?.store;if(!h)throw Error(B(85));let g=xe(s),_=h.useState(`isTriggerActive`,g),y=h.useState(`floatingRootContext`),x=h.useState(`isOpenedByTrigger`,g),S=h.useState(`triggerPopupId`,g),C=H.useRef(null),w=qa(),E=v(!0),D=Ze(),O=H.useMemo(()=>D??new ot,[D]),k=ut(O),M=$e(),{registerTrigger:N,isMountedByThisTrigger:P}=Ct(g,C,h,{payload:f,closeDelay:u,parent:w,floatingTreeRoot:O,floatingNodeId:k,floatingParentNodeId:M,keyboardEventRelay:E?.relayKeyboardEvent}),F=w.type===`menubar`,I=h.useState(`disabled`),z=a||I||F&&w.context.disabled,{getButtonProps:te,buttonRef:V}=R({disabled:z,native:o});H.useEffect(()=>{!x&&w.type===void 0&&(h.context.allowMouseUpTriggerRef.current=!1)},[h,x,w.type]);let ne=H.useRef(null),re=Be(),ie=A(e=>{if(!ne.current)return;re.clear(),h.context.allowMouseUpTriggerRef.current=!1;let t=e.target;Te(ne.current,t)||Te(h.select(`positionerElement`),t)||t===ne.current||(t==null||Ha(t)!==h.select(`rootId`))&&(Qe(e,ne.current)||O.events.emit(`close`,{domEvent:e,reason:T}))});H.useEffect(()=>{x&&h.select(`lastOpenChangeReason`)===`trigger-hover`&&b(ne.current).addEventListener(`mouseup`,ie,{once:!0})},[x,ie,h]);let ae=F&&w.context.hasSubmenuOpen,se=Sr(y,{enabled:(c??ae)&&!z&&(!F||ae&&!P),handleClose:Ar({blockPointerEvents:!F}),mouseOnly:!0,move:!1,restMs:w.type===void 0?l:void 0,delay:{close:u},triggerElementRef:C,externalTree:O,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),ce=Ka(x,h.select(`lastOpenChangeReason`)),le=Ut(y,{enabled:!z,event:x&&F?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:w.type===void 0&&ce}),ue=mr(y,{enabled:!z&&ae}),de=Wa({open:x,enabled:F,mouseDownAction:`open`}),fe=H.useMemo(()=>ee(ue.reference,le.reference),[ue.reference,le.reference]),pe=h.useState(`triggerProps`,P),{preFocusGuardRef:me,handlePreFocusGuardFocus:he,handleFocusTargetFocus:ge}=Ua(h,C),_e={disabled:z,open:x},ve=[ne,t,V,N,C],ye=[fe,se??L,pe,{"aria-haspopup":`menu`,"aria-controls":S,id:g,onMouseDown:e=>{h.select(`open`)||(re.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),b(e.currentTarget).addEventListener(`mouseup`,ie,{once:!0}))}},F?{role:`menuitem`}:{},de,p,te],be=j(`button`,e,{enabled:!F,stateAttributesMapping:dt,state:_e,ref:ve,props:ye});return F?(0,U.jsx)(Va,{tag:`button`,render:n,className:r,style:i,state:_e,refs:ve,props:ye,stateAttributesMapping:dt}):x?(0,U.jsxs)(H.Fragment,{children:[(0,U.jsx)(oe,{ref:me,onFocus:he},`${g}-pre-focus-guard`),(0,U.jsx)(H.Fragment,{children:be},g),(0,U.jsx)(oe,{ref:h.context.triggerFocusTargetRef,onFocus:ge},`${g}-post-focus-guard`)]}):(0,U.jsx)(H.Fragment,{children:be},g)});function Ka(e,t){let n=Be(),[r,i]=H.useState(!1);return V(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function qa(){let e=Aa(!0);return H.useMemo(()=>e?{type:`menubar`,context:e}:{type:void 0},[e])}var Ja=H.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return j(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})}),Ya={"aria-expanded":void 0},Xa=H.forwardRef(function(e,t){let{render:n,className:r,style:i,label:a,id:o,nativeButton:s=!1,openOnHover:c=!0,delay:l=100,closeDelay:u=0,disabled:d=!1,...f}=e,p=Ia();if(!p?.parentMenu)throw Error(B(37));let m=Ke({guess:!0,label:a}),h=ha(),{store:g}=_a(),_=xe(o),v=g.useState(`open`),y=g.useState(`floatingRootContext`),b=g.useState(`floatingTreeRoot`),x=g.useState(`triggerPopupId`,_),S=St(_,g),C=H.useCallback(e=>{let t=S(e);return e!==null&&g.select(`open`)&&g.select(`activeTriggerId`)==null&&g.update({activeTriggerId:_,activeTriggerElement:e,closeDelay:u}),t},[S,u,g,_]),w=H.useRef(null),T=H.useCallback(e=>{w.current=e,g.set(`activeTriggerElement`,e)},[g]);g.useSyncedValue(`closeDelay`,u);let E=p.parentMenu,D=g.useState(`disabled`),O=E.useState(`disabled`),k=d||D||O,A=E.useState(`itemProps`),M=E.useState(`isActive`,m.index),N=H.useMemo(()=>({type:`submenu-trigger`,setActive(){E.select(`highlightItemOnHover`)&&E.set(`activeIndex`,m.index)}}),[E,m.index]),{getItemProps:P,itemRef:F}=Sa({closeOnClick:!1,disabled:k,highlighted:M,id:_,store:g,typingRef:E.context.typingRef,nativeButton:s,itemMetadata:N,nodeId:h?.context.nodeId}),I=Sr(y,{enabled:g.useState(`hoverEnabled`)&&c&&!k,handleClose:Ar({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:l,delay:{open:l,close:u},shouldOpen:l>0?()=>E.select(`allowMouseEnter`):void 0,triggerElementRef:w,externalTree:b,isClosing:()=>g.select(`transitionStatus`)===`ending`,guardStaleOpen:!0}),R=Ut(y,{enabled:!k,event:`mousedown`,toggle:!c,ignoreMouse:c,stickIfOpen:!1}).reference??L,ee=g.useState(`triggerProps`,!0);delete ee.id;let z={disabled:k,highlighted:M,open:v},te=g.useState(`openMethod`),V=g.useState(`lastOpenChangeReason`)===`list-navigation`||te===`keyboard`;return j(`div`,e,{state:z,stateAttributesMapping:pt,props:[R,I,ee,A,v&&V&&Se?Ya:void 0,{"aria-controls":x,tabIndex:v||M?0:-1,onBlur(){M&&E.set(`activeIndex`,null)}},f,P],ref:[t,m.ref,F,C,T]})});function Za({...e}){return(0,U.jsx)(La,{"data-slot":`dropdown-menu`,...e})}function Qa({className:e,...t}){return(0,U.jsx)(Ga,{"data-slot":`dropdown-menu-trigger`,className:e,...t})}function $a({align:e=`start`,alignOffset:t=0,side:n=`bottom`,sideOffset:r=4,className:i,...a}){return(0,U.jsx)(Da,{children:(0,U.jsx)(Oa,{className:`isolate z-50 outline-none`,align:e,alignOffset:t,side:n,sideOffset:r,children:(0,U.jsx)(wa,{"data-slot":`dropdown-menu-content`,className:g(`z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-2xl bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/5 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95`,i),...a})})})}function eo({className:e,inset:t,variant:n=`default`,...r}){return(0,U.jsx)(Ca,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:g(`group/dropdown-menu-item relative flex min-h-7 cursor-default items-center gap-2 rounded-xl px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function to({...e}){return(0,U.jsx)(za,{"data-slot":`dropdown-menu-sub`,...e})}function no({className:e,inset:t,children:n,...r}){return(0,U.jsxs)(Xa,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":t,className:g(`relative flex min-h-7 cursor-default items-center gap-2 rounded-xl px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-popup-open:bg-accent data-popup-open:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,U.jsx)(Cn,{className:`ml-auto`})]})}function ro({align:e=`start`,alignOffset:t=-3,side:n=`right`,sideOffset:r=0,className:i,...a}){return(0,U.jsx)($a,{"data-slot":`dropdown-menu-sub-content`,className:g(`w-auto min-w-[96px] rounded-2xl bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/5 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,i),align:e,alignOffset:t,side:n,sideOffset:r,...a})}function io({className:e,...t}){return(0,U.jsx)(Ja,{"data-slot":`dropdown-menu-separator`,className:g(`-mx-1 my-1 h-px bg-border/50`,e),...t})}var ao=6e4,oo=60*ao,so=24*oo;function co(e,t=Date.now()){if(!e)return``;let n=Date.parse(e);if(Number.isNaN(n))return``;let r=Math.max(0,t-n);return r<ao?`just now`:r<oo?`${Math.floor(r/ao)}m`:r<so?`${Math.floor(r/oo)}h`:new Date(n).toISOString().slice(0,10)}function lo(e){if(!e||typeof e!=`object`)return;let t=e,n=typeof t.old_string==`string`?t.old_string:void 0,r=typeof t.new_string==`string`?t.new_string:typeof t.content==`string`?t.content:void 0;if(n!==void 0||r!==void 0)return{...typeof t.file_path==`string`?{path:t.file_path}:{},removed:fo(n),added:fo(r)}}function uo(e,t){let n=!!t?.trim();if(!n){let t=/^--- [^\n]*\n\+\+\+ [^\n]*\n/m.test(e),n=/^@@ -\d+(?:,\d+)? \+\d+(?:,\d+)? @@/m.test(e);if(!t||!n)return}let r=0,i=0;return(e.match(/[^\n]*\n|[^\n]+$/g)??[]).map(e=>{let t=/^@@ -\d+(?:,(\d+))? \+\d+(?:,(\d+))? @@/.exec(e);if(t)return r=Number(t[1]??1),i=Number(t[2]??1),{text:e,kind:`context`};let a=r>0||i>0,o=`context`;return(a||n)&&(e.startsWith(`-`)&&(a||!e.startsWith(`--- `))&&(o=`removed`),e.startsWith(`+`)&&(a||!e.startsWith(`+++ `))&&(o=`added`)),a&&((o===`removed`||e.startsWith(` `))&&(r=Math.max(0,r-1)),(o===`added`||e.startsWith(` `))&&(i=Math.max(0,i-1))),{text:e,kind:o}})}function fo(e){if(!e)return[];let t=e.split(`
|
|
2
|
+
`)+1),fromSessionId:t.fromSessionId},...t.attachments===void 0?{}:{attachments:t.attachments},at:n})};case`subagent_instruction`:return{...e,entries:hn(e.entries,{kind:`user`,id:t.id,text:t.text,producer:t.producer,at:n})};case`turn_started`:return{...e,turnInFlight:!0};case`message`:return{...e,entries:hn(e.entries,{kind:`assistant`,id:t.id,text:t.text,final:t.final,...mn(t)})};case`thinking`:return{...e,entries:hn(e.entries,{kind:`thinking`,id:t.id,text:t.text,final:t.final,...mn(t)})};case`tool_started`:return{...e,entries:hn(e.entries,{kind:`tool`,id:t.callId,name:t.name,input:t.input,status:`running`,...mn(t)})};case`tool_updated`:return{...e,entries:gn(e.entries,t.callId,e=>({...e,update:t.update}))};case`tool_ended`:return{...e,entries:gn(e.entries,t.callId,e=>({...e,result:t.result,status:t.isError?`error`:`complete`}))};case`subagent`:{let r=e.entries.find(e=>e.kind===`subagent`&&e.id===t.subagentId),i=r!==void 0&&an(r.status),a=an(t.state),o=a?void 0:r?.endedAt??n;return{...e,activeSubagents:e.activeSubagents+ +!!a-+!!i,entries:hn(e.entries,{kind:`subagent`,id:t.subagentId,name:t.name,...t.description===void 0?{}:{description:t.description},...t.model===void 0?{}:{model:t.model},...t.effort===void 0?{}:{effort:t.effort},...t.producer===void 0?{}:{producer:t.producer},status:t.state,...t.state===`waiting`?{waitingOn:t.on}:{},startedAt:r?.startedAt??n,...o===void 0?{}:{endedAt:o}})}}case`background_call`:{let r=e.entries.find(e=>e.kind===`background_call`&&e.id===t.callId),i=r?.status===`running`,a=t.state===`running`,o=a?void 0:r?.endedAt??n;return{...e,activeBackgroundCalls:e.activeBackgroundCalls+ +!!a-+!!i,entries:hn(e.entries,{kind:`background_call`,id:t.callId,tool:t.tool,status:t.state,...mn(t),startedAt:r?.startedAt??n,...o===void 0?{}:{endedAt:o}})}}case`enquiry`:{let n=t.state===`asked`,r=n&&e.asking?.askId===t.askId?e.asking:n?{askId:t.askId,questions:t.questions,...t.context===void 0?{}:{context:t.context},...t.producer===void 0?{}:{producer:t.producer}}:e.asking?.askId===t.askId?void 0:e.asking;return{...e,...r===void 0?{asking:void 0}:{asking:r},entries:hn(e.entries,{kind:`enquiry`,id:t.askId,questions:t.questions,status:t.state,...t.state===`answered`?{answers:t.answers}:{},...t.context===void 0?{}:{context:t.context},...t.producer===void 0?{}:{producer:t.producer}})}}case`permission`:{let n=t.state===`asked`?e.authorising??{callId:t.callId,tool:t.tool,...t.context===void 0?{}:{context:t.context},...t.allowAlways===void 0?{}:{allowAlways:t.allowAlways},...t.authorizationScope===void 0?{}:{authorizationScope:t.authorizationScope},...t.producer===void 0?{}:{producer:t.producer}}:e.authorising?.callId===t.callId?pn(e.entries,t.callId):e.authorising;return{...e,...n===void 0?{authorising:void 0}:{authorising:n},entries:gn(e.entries,t.callId,e=>({...e,authorisation:fn(t),...t.context===void 0?{}:{permissionContext:t.context},...t.allowAlways===void 0?{}:{allowAlways:t.allowAlways},...t.authorizationScope===void 0?{}:{authorizationScope:t.authorizationScope}}))}}case`turn_ended`:return{...e,entries:sn(e.entries,n),turnInFlight:!1,asking:e.asking?.producer===void 0?void 0:e.asking,authorising:e.authorising?.producer===void 0?void 0:e.authorising};case`queue_changed`:return{...e,queue:[...t.pending],queuedMessages:e.queuedMessages?.length===t.pending.length&&e.queuedMessages.every((e,n)=>e.text===t.pending[n]&&e.id===t.ids?.[n]&&(e.attachments?.length??0)===(t.attachments?.[n]?.length??0)&&(e.attachments??[]).every((e,r)=>e===t.attachments?.[n]?.[r]))?e.queuedMessages:t.pending.map((e,n)=>({id:t.ids?.[n],text:e,...t.attachments?.[n]?.length?{attachments:t.attachments[n]}:{}}))};case`workflow_spend`:{let n={...e.workflowSpend,[t.executionId]:t.spend},r=nn([...e.parentSpend?[e.parentSpend]:[],...Object.values(n)]);return{...e,workflowSpend:n,spend:r,...e.contextUsage?{contextUsage:{...e.contextUsage,spend:r}}:{}}}case`context_usage`:{let n=t.spend||e.workflowSpend?nn([...t.spend?[t.spend]:[],...Object.values(e.workflowSpend??{})]):void 0;return{...e,...t.spend?{parentSpend:t.spend}:{},...n?{spend:n}:{},contextUsage:{used:t.used,window:t.window,...n===void 0?{}:{spend:n}}}}case`model_changed`:return{...e,model:t.model};case`permission_mode_changed`:return{...e,permissionMode:t.mode};case`effort_changed`:return{...e,effort:t.effort};case`branch_changed`:return{...e,branch:t.branch};case`notice`:return{...e,entries:[...e.entries,{kind:`notice`,id:`notice-${e.entries.length}`,level:t.level,text:t.text,...t.sessionId===void 0?{}:{sessionId:t.sessionId}}]};case`compacting`:return t.active?{...e,compacting:!0}:un(e);case`compacted`:return{...un(e),entries:[...e.entries,{kind:`marker`,id:`compacted-${e.entries.length}`,marker:`compacted`,text:dn(t.trigger,t.before,t.after)}]};case`session_dormant`:return{...e,lifecycle:`dormant`,turnInFlight:!1,queue:[],queuedMessages:[],asking:void 0,authorising:void 0,entries:[...e.entries,{kind:`marker`,id:`dormant-${e.entries.length}`,marker:`dormant`,text:`Dormant: ${t.reason}`}]};case`session_settled`:return{...e,lifecycle:`settled`,turnInFlight:!1,queue:[],queuedMessages:[],asking:void 0,authorising:void 0,entries:[...e.entries,{kind:`marker`,id:`settled-${e.entries.length}`,marker:`settled`,text:`Settled`}]};case`rewound`:{let n=e.entries.findIndex(e=>e.kind===`user`&&e.id===t.userMessageId),r=t.restore===`files`?`Files rewound`:t.restore===`both`?`Rewound conversation and files`:`Rewound conversation`;return{...e,entries:[...n<0||t.restore===`files`?e.entries:e.entries.map((e,t)=>t<n||e.rewound?e:{...e,rewound:!0}),{kind:`marker`,id:`rewound-${e.entries.length}`,marker:`rewound`,text:r}]}}case`forked`:return{...e,entries:[...e.entries,{kind:`marker`,id:`forked-${e.entries.length}`,marker:`forked`,text:`Forked`,fromSessionId:t.fromSessionId}]};case`revived`:return{...e,...t.scope===void 0?{}:{scope:t.scope},lifecycle:`live`,turnInFlight:!1,entries:[...e.entries,{kind:`marker`,id:`revived-${t.fromSeq}`,marker:`revived`,text:`Revived from seq ${t.fromSeq}`}]};case`session_ended`:return{...e,lifecycle:`ended`,turnInFlight:!1,endedReason:t.reason,asking:void 0,authorising:void 0}}}function un(e){if(!e.compacting)return e;let{compacting:t,...n}=e;return n}function dn(e,t,n){let r=e===`auto`?`Compacted automatically`:`Compacted`;return n===void 0?`${r}, from ${Jt(t)} tokens`:`${r}, ${Jt(t)} → ${Jt(n)} tokens`}function fn(e){return e.state===`asked`?`asked`:e.state===`aborted`||e.decision===`deny`?`denied`:e.decision===`always`?`always`:`allowed`}function pn(e,t){let n=e.find(e=>e.kind===`tool`&&e.id!==t&&e.authorisation===`asked`);return n?.kind===`tool`?{callId:n.id,tool:n.name,...n.permissionContext===void 0?{}:{context:n.permissionContext},...n.allowAlways===void 0?{}:{allowAlways:n.allowAlways},...n.authorizationScope===void 0?{}:{authorizationScope:n.authorizationScope},...n.producer===void 0?{}:{producer:n.producer}}:void 0}function mn(e){return e.producer===void 0?{}:{producer:e.producer}}function hn(e,t){let n=e.findIndex(e=>e.kind===t.kind&&e.id===t.id);if(n<0)return[...e,t];let r=[...e];return r[n]=t,r}function gn(e,t,n){let r=e.findIndex(e=>e.kind===`tool`&&e.id===t);if(r<0)return e;let i=e[r];if(!i||i.kind!==`tool`)return e;let a=[...e];return a[r]=n(i),a}var H=e(be(),1),_n=e(E(),1);function vn(e){return`${e.kind}:${e.id}`}var U=Re();function yn(e,t){let n=/\/worktrees\/([^/]+)\/[^/]+$/.exec(e)?.[1];return n===void 0?void 0:t.find(e=>e.name===n)?.path}var bn=it(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),xn=it(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),Sn=it(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Cn=it(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),wn=it(`file-pen`,[[`path`,{d:`M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34`,key:`o6klzx`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z`,key:`zhnas1`}]]),Tn=it(`file-plus`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]),En=it(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Dn=it(`folder-search`,[[`path`,{d:`M10.7 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 2v4.1`,key:`1bw5m7`}],[`path`,{d:`m21 21-1.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]),On=it(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),kn=it(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),An=it(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),jn=it(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Mn=it(`message-circle-question-mark`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Nn=it(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),Pn=it(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Fn=it(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),In=it(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),Ln=it(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),Rn=it(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),zn=it(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function Bn(e){let t=e.trim();return t.startsWith(`/`)||t.startsWith(`~`)?`completion`:`search`}function Vn(e){return e.trim()!==``}function Hn(e){let t=[];for(let n of e){let e=t[t.length-1];if(e&&e.group===n.group){e.items.push(n);continue}t.push({group:n.group,items:[n]})}return t}function Un(e,t){if(t===void 0||t===``)return e;let n=t.endsWith(`/`)?t:`${t}/`;if(!e.startsWith(n))return e;let r=e.slice(n.length);return r===``?e:r}function Wn(e,t){return t!=null&&!x(t)?0:typeof e==`function`?e():e}function Gn(e,t,n){let r=Wn(e,n);return typeof r==`number`?r:r?.[t]}function Kn(e){return typeof e==`function`?e():e}function qn(e,t){return t||e===`click`||e===`mousedown`}function Jn(e){return e?.includes(`mouse`)&&e!==`mousedown`}var Yn=H.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new ie,currentIdRef:{current:null},currentContextRef:{current:null}});function Xn(e,t){e.current=t.current}function Zn(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=H.useRef(n),a=H.useRef(n),o=H.useRef(null),s=H.useRef(null),c=Be();return V(()=>{if(a.current=n,!o.current){i.current=n;return}i.current={open:Gn(i.current,`open`),close:Gn(n,`close`)}},[n,o,i,a]),(0,U.jsx)(Yn.Provider,{value:H.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function Qn(e,t={open:!1}){let{open:n}=t,r=`rootStore`in e?e.rootStore:e,i=r.useState(`floatingId`),{currentIdRef:a,delayRef:o,timeoutMs:s,initialDelayRef:c,currentContextRef:l,hasProvider:u,timeout:f}=H.useContext(Yn),[p,m]=H.useState(!1),h=H.useRef(n);return V(()=>{h.current=n},[n]),V(()=>{function e(){l.current?.setIsInstantPhase(!1),a.current=null,l.current=null,o.current=c.current,f.clear()}if(a.current&&!n&&a.current===i){if(m(!1),s){let t=i;return f.start(s,()=>{r.select(`open`)||a.current&&a.current!==t||e()}),()=>{(h.current||a.current!==t)&&f.clear()}}e()}},[n,i,a,o,s,c,l,f,r]),V(()=>{if(!n)return;let e=l.current,t=a.current;f.clear(),l.current={onOpenChange:r.setOpen,setIsInstantPhase:m},a.current=i,o.current={open:0,close:Gn(c.current,`close`)},t!==null&&t!==i?(m(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,d(F))):(m(!1),e?.setIsInstantPhase(!1))},[n,i,r,a,o,c,l,f]),V(()=>()=>{if(a.current===i){if(l.current=null,!h.current)return;a.current=null,Xn(o,c),f.clear()}},[l,a,o,i,c,f]),H.useMemo(()=>({hasProvider:u,delayRef:o,isInstantPhase:p}),[u,o,p])}function $n(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function er(e){return e!=null&&e.clientX!=null}function tr(e,t={}){let{enabled:n=!0,axis:r=`both`}=t,i=`rootStore`in e?e.rootStore:e,a=i.useState(`open`),o=i.useState(`floatingElement`),s=i.useState(`domReferenceElement`),c=i.context.dataRef,l=H.useRef(!1),u=H.useRef(null),[d,f]=H.useState(),[p,m]=H.useState([]),h=A(e=>{i.set(`positionReference`,e)}),g=A((e,t,n)=>{l.current||c.current.openEvent&&!er(c.current.openEvent)||i.set(`positionReference`,$n(n??s,{x:e,y:t,axis:r,dataRef:c,pointerType:d}))}),_=A(e=>{a?u.current||(g(e.clientX,e.clientY,e.currentTarget),m([])):g(e.clientX,e.clientY,e.currentTarget)}),v=x(d)?o:a;H.useEffect(()=>{if(!n){h(s);return}if(!v)return;function e(){u.current?.(),u.current=null}let t=ae(o);function r(t){let n=Ae(t);Te(o,n)?e():g(t.clientX,t.clientY)}return!c.current.openEvent||er(c.current.openEvent)?u.current=Le(t,`mousemove`,r):h(s),e},[v,n,o,c,s,i,g,h,p]),H.useEffect(()=>()=>{i.set(`positionReference`,null)},[i]),H.useEffect(()=>{n&&!o&&(l.current=!1)},[n,o]),H.useEffect(()=>{!n&&a&&(l.current=!0)},[n,a]);let y=H.useMemo(()=>{function e(e){f(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:_,onMouseEnter:_}},[_]);return H.useMemo(()=>n?{reference:y,trigger:y}:{},[n,y])}function nr(){return new Wt({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new Ft,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function rr(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:nr(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:L,inactiveTriggerProps:L,popupProps:L}}function ir(e,t,n=!1){return new Wt({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0})}var ar=e=>e.triggerIdProp??e.activeTriggerId,or=e=>e.openProp??e.open,sr=e=>(e.popupElement?.id??e.floatingId)||void 0;function cr(e,t){return t!==void 0&&or(e)&&ar(e)===t}function lr(e,t){return cr(e,t)?!0:t!==void 0&&or(e)&&ar(e)==null&&e.triggerCount===1}var ur={open:or,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:ar,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:sr,isTriggerActive:(e,t)=>t!==void 0&&ar(e)===t,isOpenedByTrigger:(e,t)=>cr(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&ar(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>lr(e,t)?sr(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement},dr=S();function fr(e){let t=H.useCallback(t=>e===void 0?h:e.subscribeStore(t),[e]),n=H.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,dr.useSyncExternalStore)(t,n,()=>e?.serverStore)}var pr=He&&fe;function mr(e,t={}){let{enabled:n=!0,delay:r}=t,i=`rootStore`in e?e.rootStore:e,{events:a,dataRef:o}=i.context,s=H.useRef(!1),c=H.useRef(null),l=H.useRef(!0),u=Be();H.useEffect(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=ae(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&se(e)&&e===re(b(e))&&(s.current=!0)}function a(){l.current=!0}function o(){l.current=!1}return P(Le(t,`blur`,r),pr&&Le(t,`keydown`,a,!0),pr&&Le(t,`pointerdown`,o,!0))},[i,n]),H.useEffect(()=>{if(!n)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=i.select(`domReferenceElement`);Fe(e)&&(c.current=e,s.current=!0)}}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[a,n,i]);let f=H.useMemo(()=>{function e(){s.current=!1,c.current=null}return{onMouseLeave(){e()},onFocus(t){let n=t.currentTarget;if(s.current){if(c.current===n)return;e()}let a=Ae(t.nativeEvent);if(Fe(a)){if(pr&&!t.relatedTarget){if(!l.current&&!Oe(a))return}else if(!ge(a))return}let o=Ne(t.relatedTarget,i.context.triggerElements),{nativeEvent:f,currentTarget:p}=t,m=typeof r==`function`?r():r;if(i.select(`open`)&&o||m===0||m===void 0){i.setOpen(!0,d(De,f,p));return}u.start(m,()=>{s.current||i.setOpen(!0,d(De,f,p))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=Fe(n)&&n.hasAttribute(N(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;u.start(0,()=>{let e=i.select(`domReferenceElement`),t=re(b(e));!n&&t===e||Te(o.current.floatingContext?.refs.floating.current,t)||Te(e,t)||a||Ne(n??t,i.context.triggerElements)||i.setOpen(!1,d(De,r))})}}},[o,r,i,u]);return H.useMemo(()=>n?{reference:f,trigger:f}:{},[n,f])}var hr=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new ie,this.restTimeout=new ie,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},gr=new WeakMap;function _r(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&gr.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),gr.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function vr(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=gr.get(n);a&&a!==e&&_r(a),_r(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,gr.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function yr(e){let t=e.context.dataRef.current,n=a(()=>t.hoverInteractionState??hr.create()).current;return t.hoverInteractionState||=n,w(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function br(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=`rootStore`in e?e.rootStore:e,s=a.useState(`open`),c=a.useState(`floatingElement`),l=a.useState(`domReferenceElement`),{dataRef:u}=a.context,f=Ze(),p=$e(),m=yr(a),h=Be(),g=A(()=>qn(u.current.openEvent?.type,m.interactedInside)),v=A(()=>Jn(u.current.openEvent?.type)),y=A(()=>{_r(m)});V(()=>{s||(m.pointerType=void 0,m.restTimeoutPending=!1,m.interactedInside=!1,y())},[s,m,y]),H.useEffect(()=>y,[y]),V(()=>{if(n&&s&&m.handleCloseOptions?.blockPointerEvents&&v()&&Fe(l)&&c){let e=l,t=c,n=b(c),r=f?.nodesRef.current.find(e=>e.id===p)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=m.pointerEventsScopeElement===t?null:m.pointerEventsScopeElement,a=r===t?null:r,o=m.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body;return vr(m,{scopeElement:o,referenceElement:e,floatingElement:t}),()=>{y()}}},[n,s,l,c,m,v,f,p,y]),H.useEffect(()=>{if(!n)return;function e(){return!!(f&&p&&qe(f.nodesRef.current,p).length>0)}function t(e){let t=Gn(r,`close`,m.pointerType),n=()=>{a.setOpen(!1,d(_,e)),f?.events.emit(`floating.closed`,e)};t?m.openChangeTimeout.start(t,n):(m.openChangeTimeout.clear(),n())}function s(e){let t=Ae(e);if(!o(t)){m.interactedInside=!1;return}m.interactedInside=t?.closest(`[aria-haspopup]`)!=null}function l(){m.openChangeTimeout.clear(),h.clear(),f?.events.off(`floating.closed`,x),y()}function b(n){if(e()&&f){f.events.on(`floating.closed`,x);return}if(Ne(n.relatedTarget,a.context.triggerElements))return;let r=u.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(f&&r&&Fe(o)&&qe(f.nodesRef.current,r,!1).some(e=>Te(e.context?.elements.floating,o)))){if(m.handler){m.handler(n);return}y(),v()&&!g()&&t(n)}}function x(t){!f||!p||e()||h.start(0,()=>{f.events.off(`floating.closed`,x),a.setOpen(!1,d(_,t)),f.events.emit(`floating.closed`,t)})}let S=c;return P(S&&Le(S,`mouseenter`,l),S&&Le(S,`mouseleave`,b),S&&Le(S,`pointerdown`,s,!0),()=>{f?.events.off(`floating.closed`,x)})},[n,c,a,u,r,i,v,g,y,m,f,p,h])}var xr={current:null};function Sr(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=xr,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:f,isClosing:p,shouldOpen:m,guardStaleOpen:h=!1}=t,g=`rootStore`in e?e.rootStore:e,{dataRef:v,events:y}=g.context,S=Ze(l),C=yr(g),w=H.useRef(!1),T=Dt(i),E=Dt(r),D=Dt(o),O=Dt(n),k=Dt(m),j=Dt(p),M=A(()=>qn(v.current.openEvent?.type,C.interactedInside)),N=A(()=>k.current?.()!==!1),F=A((e,t,n)=>{let r=g.context.triggerElements;if(r.hasElement(t))return!e||!Te(e,t);if(!Fe(n))return!1;let i=n;return r.hasMatchingElement(e=>Te(e,i))&&(!e||!Te(e,i))}),I=A(()=>{C.handler&&=(b(g.select(`domReferenceElement`)).removeEventListener(`mousemove`,C.handler),void 0)}),L=A(()=>{_r(C)});return u&&(C.handleCloseOptions=T.current?.__options),H.useEffect(()=>I,[I]),H.useEffect(()=>{if(!n)return;function e(e){e.open?w.current=!1:(w.current=e.reason===_,I(),C.openChangeTimeout.clear(),C.restTimeout.clear(),C.blockMouseMove=!0,C.restTimeoutPending=!1)}return y.on(`openchange`,e),()=>{y.off(`openchange`,e)}},[n,y,C,I]),H.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=Gn(E.current,`close`,C.pointerType);n?C.openChangeTimeout.start(n,()=>{g.setOpen(!1,d(_,e)),S?.events.emit(`floating.closed`,e)}):t&&(C.openChangeTimeout.clear(),g.setOpen(!1,d(_,e)),S?.events.emit(`floating.closed`,e))}let t=c.current??(u?g.select(`domReferenceElement`):null);if(!Fe(t))return;function r(e){if(C.openChangeTimeout.clear(),C.blockMouseMove=!1,a&&!x(C.pointerType))return;let t=Kn(D.current),n=Gn(E.current,`open`,C.pointerType),r=Ae(e),i=e.currentTarget??null,o=g.select(`domReferenceElement`),s=i;if(Fe(r)&&!g.context.triggerElements.hasElement(r)){for(let e of g.context.triggerElements.elements())if(Te(e,r)){s=e;break}}Fe(i)&&Fe(o)&&!g.context.triggerElements.hasElement(i)&&Te(i,o)&&(s=o);let c=s!=null&&F(o,s,r),l=g.select(`open`),u=j.current?.()??g.select(`transitionStatus`)===`ending`,f=!l&&u&&w.current,p=!c&&Fe(s)&&Fe(o)&&Te(o,s)&&f,m=t>0&&!n,h=c&&(l||f)||p,v=!l||c;if(h){N()&&g.setOpen(!0,d(_,e,s));return}m||(n?C.openChangeTimeout.start(n,()=>{v&&N()&&g.setOpen(!0,d(_,e,s))}):v&&N()&&g.setOpen(!0,d(_,e,s)))}function i(t){if(M()){L();return}I();let n=g.select(`domReferenceElement`),r=b(n);C.restTimeout.clear(),C.restTimeoutPending=!1;let i=v.current.floatingContext??f?.();if(!Ne(t.relatedTarget,g.context.triggerElements)){if(T.current&&i){g.select(`open`)||C.openChangeTimeout.clear();let n=c.current;C.handler=T.current({...i,tree:S,x:t.clientX,y:t.clientY,onClose(){L(),I(),O.current&&!M()&&n===g.select(`domReferenceElement`)&&e(t,!0)}}),r.addEventListener(`mousemove`,C.handler),C.handler(t);return}(C.pointerType!==`touch`||!Te(g.select(`floatingElement`),t.relatedTarget))&&e(t)}}function o(e){Te(t,e.relatedTarget)||(C.openChangeTimeout.clear(),C.restTimeout.clear(),C.restTimeoutPending=!1)}let l=h?Le(t,`mouseout`,o):void 0;return s?P(Le(t,`mousemove`,r,{once:!0}),Le(t,`mouseenter`,r),Le(t,`mouseleave`,i),l):P(Le(t,`mouseenter`,r),Le(t,`mouseleave`,i),l)},[I,L,v,E,g,n,T,C,u,F,M,a,s,D,c,S,O,f,j,N,h]),H.useMemo(()=>{if(!n)return;function e(e){C.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=g.select(`domReferenceElement`),i=g.select(`open`),o=F(r,n,e.target);if(a&&!x(C.pointerType))return;if(i&&o&&C.handleCloseOptions?.blockPointerEvents){let e=g.select(`floatingElement`);if(e){let t=C.handleCloseOptions?.getScope?.()??n.ownerDocument.body;vr(C,{scopeElement:t,referenceElement:n,floatingElement:e})}}let s=Kn(D.current);if(i&&!o||s===0||!o&&C.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;C.restTimeout.clear();function c(){if(C.restTimeoutPending=!1,M())return;let e=g.select(`open`);!C.blockMouseMove&&(!e||o)&&N()&&g.setOpen(!0,d(_,t,n))}C.pointerType===`touch`?_n.flushSync(()=>{c()}):o&&i?c():(C.restTimeoutPending=!0,C.restTimeout.start(s,c))}}},[n,C,M,F,a,g,D,N])}var Cr=.1,wr=Cr*Cr,Tr=.5;function Er(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function Dr(e,t,n,r,i,a,o,s,c,l){let u=!1;return Er(e,t,n,r,i,a)&&(u=!u),Er(e,t,i,a,o,s)&&(u=!u),Er(e,t,o,s,c,l)&&(u=!u),Er(e,t,c,l,n,r)&&(u=!u),u}function Or(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function kr(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function Ar(e={}){let{blockPointerEvents:t=!1}=e,n=new ie,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*wr;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=Ae(r),g=r.type===`mouseleave`,_=Te(u,h),v=Te(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&Fe(r.relatedTarget)&&Te(u,r.relatedTarget))return;function y(){return!!(s&&qe(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=kr(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=kr(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=kr(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=kr(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!Or(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?Tr/2:Tr*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+Tr+1,o=C||T?S.bottom-Tr:S.top,s=C?T?S.bottom-Tr:S.top:S.bottom-Tr;M=Dr(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?Tr/2:Tr*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-Tr,o=C||T?S.top+Tr:S.bottom,s=C?T?S.top+Tr:S.bottom:S.top+Tr;M=Dr(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?Tr/2:Tr*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+Tr+1,o=w||E?S.right-Tr:S.left,s=w?E?S.right-Tr:S.left:S.right-Tr;M=Dr(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?Tr/2:Tr*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-Tr,o=w||E?S.left+Tr:S.right,s=w?E?S.left+Tr:S.right:S.left+Tr;M=Dr(d,f,a,r,a,i,o,S.top,s,S.bottom);break}}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}function jr(){let{config:e,refresh:t}=Ue(),{save:n,saving:r}=Ve(),i=e.projectList??[],a=e.projectCandidates??[],o=e.projects?.root??``,s=e.projects?.include??[],c=(0,H.useCallback)((e,r)=>{(async()=>{await n({projects:{include:e}},r)&&await t()})()},[n,t]),l=t=>{let n=Un(t,e.projects?.root===void 0?void 0:e.scope);s.includes(n)||c([...s,n],`Project added.`)};return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Mr,{included:i,onRemove:e=>c(s.filter((t,n)=>n!==e),`Project removed.`)}),(0,U.jsx)(Nr,{candidates:a,hasRoot:e.projects?.root!==void 0,onAdd:l}),(0,U.jsx)(Fr,{onAdd:l}),(0,U.jsx)(Ir,{current:o,saving:r,onSave:n,onSaved:t})]})}function Mr({included:e,onRemove:t}){return(0,U.jsx)(Ie,{title:`Projects · ${e.length}`,description:e.length===0?`Nothing yet. A Project is one you have opted into — add one below, and it becomes an option in the New Agent Session view.`:`What the New Agent Session view offers, in this order.`,children:e.length===0?null:(0,U.jsx)(`div`,{className:`flex flex-col`,children:e.map((e,n)=>(0,U.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 border-b py-1.5 last:border-b-0`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,U.jsx)(`span`,{className:`font-mono text-xs`,children:e.group===void 0?e.name:`${e.group}/${e.name}`}),e.missing?(0,U.jsx)(`span`,{className:`text-xs text-destructive`,children:`directory is gone`}):null]}),(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground`,children:e.path}),(0,U.jsx)(O,{variant:`ghost`,size:`icon-sm`,"aria-label":`Remove ${e.name}`,onClick:()=>t(n),children:(0,U.jsx)(zn,{"aria-hidden":!0})})]})]},e.path))})})}function Nr({candidates:e,hasRoot:t,onAdd:n}){return t?(0,U.jsx)(Ie,{title:`Found beneath the Project Root · ${e.length}`,description:`Repositories Flow can see but is not offering. Add the ones you work in.`,children:e.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Nothing left to add. Either everything found is already a Project, or the Project Root holds no git repositories within three levels.`}):(0,U.jsx)(`div`,{className:`flex flex-col gap-2`,children:Hn(e).map(e=>(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e.group===void 0?null:(0,U.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:e.group}),(0,U.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.items.map(e=>(0,U.jsxs)(O,{variant:`outline`,size:`sm`,className:`font-mono text-xs font-normal`,onClick:()=>n(e.path),children:[(0,U.jsx)(Pn,{"aria-hidden":!0}),e.name]},e.path))})]},e.group??``))})}):null}function Pr(e){let[t,n]=(0,H.useState)(void 0),r=(0,H.useRef)(``);return(0,H.useEffect)(()=>{if(r.current=e,!Vn(e)){n(void 0);return}let t=new AbortController,i=setTimeout(()=>{(async()=>{try{let i=await p(`/api/directories?q=${encodeURIComponent(e)}`,{signal:t.signal});if(!i.ok)return;let a=await i.json();a.query===r.current&&n(a)}catch{}})()},150);return()=>{t.abort(),clearTimeout(i)}},[e]),t}function Fr({onAdd:e}){let[t,n]=(0,H.useState)(``),r=Pr(t),i=Bn(t);return(0,U.jsxs)(Ie,{title:`Add any directory`,description:(0,U.jsxs)(U.Fragment,{children:[`Type a name to search beneath the Project Root — repositories included, so`,` `,(0,U.jsx)(`code`,{className:`font-mono text-xs`,children:`packages/api`}),` inside a monorepo is reachable. Start with `,(0,U.jsx)(`code`,{className:`font-mono text-xs`,children:`/`}),` or`,` `,(0,U.jsx)(`code`,{className:`font-mono text-xs`,children:`~`}),` to complete a path anywhere on this machine instead.`]}),children:[(0,U.jsx)(he,{className:`font-mono`,value:t,onChange:e=>n(e.target.value),placeholder:`api, or /home/you/elsewhere`,spellCheck:!1}),r===void 0?null:r.paths.length===0?(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i===`completion`?`No directory there.`:`Nothing beneath the Project Root matches.`}):(0,U.jsxs)(`div`,{className:`flex flex-col`,children:[(0,U.jsxs)(`span`,{className:`pb-1 text-xs text-muted-foreground`,children:[i===`completion`?`Directories here`:`Found beneath the Project Root`,r.truncated?` — showing the first few, keep typing`:null]}),r.paths.map(t=>(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b py-1 last:border-b-0`,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:t}),(0,U.jsxs)(O,{variant:`ghost`,size:`sm`,onClick:()=>{e(t),n(``)},children:[(0,U.jsx)(Pn,{"aria-hidden":!0}),`Add`]})]},t))]})]})}function Ir({current:e,saving:t,onSave:n,onSaved:r}){let[i,a]=(0,H.useState)(e);return(0,H.useEffect)(()=>a(e),[e]),(0,U.jsxs)(Ie,{title:`Project Root`,description:(0,U.jsxs)(U.Fragment,{children:[`The directory Flow looks beneath for candidates, and the one it reports as its default Scope. Absolute, or starting with`,` `,(0,U.jsx)(`code`,{className:`font-mono text-xs`,children:`~`}),`. A Project outside it can still be added by path.`]}),children:[(0,U.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-sm font-medium`,children:`Where your repositories live`}),(0,U.jsx)(he,{className:`font-mono`,value:i,onChange:e=>a(e.target.value),placeholder:`~/workspace`,spellCheck:!1})]}),(0,U.jsx)(de,{dirty:i.trim()!==e,saving:t,onSave:()=>{(async()=>{let e=i.trim()===``?`Project Root cleared.`:`Project Root saved.`;await n({projects:{root:i.trim()}},e)&&await r()})()},onReset:()=>a(e)})]})}var Lr=H.createContext(void 0);function Rr(e){let t=H.useContext(Lr);if(!e&&t===void 0)throw Error(B(27));return t}var zr=H.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=Rr(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`),d={open:c,transitionStatus:s.useState(`transitionStatus`)};return j(`div`,e,{state:d,ref:[s.context.backdropRef,t],stateAttributesMapping:ft,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),Br=H.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...c}=e,l=Rr(),u=l.useState(`open`),{getButtonProps:f,buttonRef:p}=R({disabled:a,native:o}),m={disabled:a};function h(e){u&&l.setOpen(!1,d(s,e.nativeEvent))}return j(`button`,e,{state:m,ref:[t,p],props:[{onClick:h},c,f]})}),Vr=H.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=Rr(),c=xe(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),j(`p`,e,{ref:t,props:[{id:c},o]})}),Hr=H.createContext(void 0);function Ur(){let e=H.useContext(Hr);if(e===void 0)throw Error(B(26));return e}var Wr={...tt,...Ee,nestedDialogOpen(e){return e?{"data-nested-dialog-open":``}:null}},Gr=H.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=Rr(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),y=c.useState(`titleElementId`),b=c.useState(`transitionStatus`),x=c.useState(`role`),S=d.useState(`floatingId`);Ur(),we({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let C=o===void 0?vt(c.context.popupRef):o,w=g>0,T=c.useStateSetter(`popupElement`),E=j(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:w},props:[f,{id:S,"aria-labelledby":y,"aria-describedby":l,role:x,...wt,hidden:!m,onKeyDown(e){Je.has(e.key)&&e.stopPropagation()},style:{"--nested-dialogs":g}},s],ref:[t,c.context.popupRef,T],stateAttributesMapping:Wr});return(0,U.jsx)(lt,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:C,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:E})}),Kr=H.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=Rr(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,U.jsx)(Hr.Provider,{value:n,children:(0,U.jsxs)(u,{ref:t,...r,children:[a&&o===!0&&(0,U.jsx)(et,{ref:i.context.internalBackdropRef,inert:Me(!s)}),e.children]})}):null});function qr({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`disablePointerDismissal`),a=e.useState(`modal`),o=e.useState(`popupElement`),s=e.useState(`floatingRootContext`),[c,l]=H.useState(0),[u,d]=H.useState(0),f=c===0,p=gt(s,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:a===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0)return!1;if(`touches`in t){if(t.type===`touchend`){if(t.changedTouches.length!==1||t.touches.length!==0)return!1}else if(t.touches.length!==1)return!1}let n=Ae(t);if(f&&!i){if(a){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||Te(n,o)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:f});return st(r&&a===!0,o),e.useContextCallback(`onNestedDialogOpen`,(e,t)=>{l(e),d(t)}),V(()=>(t?.onNestedDialogOpen&&(r?t.onNestedDialogOpen(c+1,u+ +!!n):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,c,u,t]),xt(e,{activeTriggerProps:p.reference,inactiveTriggerProps:p.trigger,popupProps:p.floating,nestedOpenDialogCount:c,nestedOpenDrawerCount:u}),null}var Jr={...ur,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role},Yr=class extends f{constructor(e,t,n){let r=new Ft,i=Xr(e,r,t,n);super(i,Zr(r),Jr)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let n={open:e};Ot(n,e,t.trigger),this.update(n)}};function Xr(e,t,n,r=!1){let i={...rr(),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e};return i.floatingRootContext=ir(t,n,r),i}function Zr(e){return{popupRef:H.createRef(),backdropRef:H.createRef(),internalBackdropRef:H.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function Qr(e,t){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:f,defaultTriggerId:p=null}=t,m=e===`drawer`,h=e===`alert-dialog`,g=h?!0:c,_=h||s,v=h?`alertdialog`:`dialog`,y=Rr(!0),b={modal:g,disablePointerDismissal:_,nested:y!=null,role:v},x=Mt((e,t)=>new Yr({open:i,openProp:r,activeTriggerId:p,triggerIdProp:f,...b},e,t),!0);x.useControlledProp(`openProp`,r),x.useControlledProp(`triggerIdProp`,f),x.useSyncedValues(b),x.useContextCallback(`onOpenChange`,a),x.useContextCallback(`onOpenChangeComplete`,o);let S=x.useState(`open`),C=x.useState(`mounted`),w=x.useState(`payload`);kt(x,S),Bt(x);let{forceUnmount:T}=yt(S,x);H.useImperativeHandle(l,()=>({unmount:T,close:()=>x.setOpen(!1,d(D))}),[T,x]);let E=S||C;return(0,U.jsxs)(Lr.Provider,{value:x,children:[u&&(0,U.jsx)(ht,{handle:u,store:x}),E&&(0,U.jsx)(qr,{store:x,parentContext:y?.context,isDrawer:m}),typeof n==`function`?n({payload:w}):n]})}function $r(e){return Qr(`dialog`,e)}var ei=H.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=Rr(),c=xe(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),j(`h2`,e,{ref:t,props:[{id:c},o]})}),ti=H.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,payload:c,handle:l,...u}=e,d=Rr(!0),f=fr(l)??d;if(!f)throw Error(B(79));let p=xe(s),m=f.useState(`floatingRootContext`),h=f.useState(`isOpenedByTrigger`,p),g=f.useState(`triggerPopupId`,p),_=H.useRef(null),{registerTrigger:v,isMountedByThisTrigger:y}=Ct(p,_,f,{payload:c}),{getButtonProps:b,buttonRef:x}=R({disabled:a,native:o}),S=Ut(m),C=rt(()=>f.select(`open`),e=>{f.set(`openMethod`,e)}),w={disabled:a,open:h},T=f.useState(`triggerProps`,y);return j(`button`,e,{state:w,ref:[x,t,v,_],props:[S.reference,T,C,{[k]:``,id:p,"aria-haspopup":`dialog`,"aria-expanded":h,"aria-controls":g},u,b],stateAttributesMapping:pt})});function ni({...e}){return(0,U.jsx)($r,{"data-slot":`dialog`,...e})}function ri({...e}){return(0,U.jsx)(ti,{"data-slot":`dialog-trigger`,...e})}function ii({...e}){return(0,U.jsx)(Kr,{"data-slot":`dialog-portal`,...e})}function ai({className:e,...t}){return(0,U.jsx)(zr,{"data-slot":`dialog-overlay`,className:g(`fixed inset-0 isolate z-50 bg-black/30 duration-100 supports-backdrop-filter:backdrop-blur-sm data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function oi({className:e,children:t,showCloseButton:n=!0,...r}){return(0,U.jsxs)(ii,{children:[(0,U.jsx)(ai,{}),(0,U.jsxs)(Gr,{"data-slot":`dialog-content`,className:g(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-6 rounded-[min(var(--radius-4xl),24px)] bg-popover p-6 text-sm text-popover-foreground shadow-xl ring-1 ring-foreground/5 duration-100 outline-none sm:max-w-md dark:ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[t,n&&(0,U.jsxs)(Br,{"data-slot":`dialog-close`,render:(0,U.jsx)(O,{variant:`ghost`,className:`absolute top-4 right-4 bg-secondary`,size:`icon-sm`}),children:[(0,U.jsx)(zn,{}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function si({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`dialog-header`,className:g(`flex flex-col gap-1.5`,e),...t})}function ci({className:e,showCloseButton:t=!1,children:n,...r}){return(0,U.jsxs)(`div`,{"data-slot":`dialog-footer`,className:g(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,U.jsx)(Br,{render:(0,U.jsx)(O,{variant:`outline`}),children:`Close`})]})}function li({className:e,...t}){return(0,U.jsx)(ei,{"data-slot":`dialog-title`,className:g(`font-heading text-base leading-none font-medium`,e),...t})}function ui({className:e,...t}){return(0,U.jsx)(Vr,{"data-slot":`dialog-description`,className:g(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function di({session:e,onClose:t}){let{connection:n,config:r}=Ue(),[i,a]=(0,H.useState)(e.suggestedScope??``),[o,s]=(0,H.useState)(()=>yn(e.scope,r.projectList??[])??``),[c,l]=(0,H.useState)(void 0),[u,d]=(0,H.useState)(!1),f=i.trim()!==``&&(!e.worktree||o.trim()!==``),p=async()=>{d(!0),l(void 0);try{await n.command({type:`relocate`,sessionId:e.id,scope:i.trim(),...e.worktree?{repo:o.trim()}:{}}),await n.command({type:`revive`,sessionId:e.id}),t()}catch(e){l(e instanceof Error?e.message:String(e))}finally{d(!1)}};return(0,U.jsx)(ni,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,U.jsxs)(oi,{className:`sm:max-w-lg`,children:[(0,U.jsxs)(si,{children:[(0,U.jsx)(li,{children:`Relocate Agent Session`}),(0,U.jsx)(ui,{children:`Its Scope no longer exists. Choose where its files are now.`})]}),(0,U.jsx)(ne,{label:`Old Scope`,children:e.scope}),(0,U.jsx)(fi,{label:`Scope`,value:i,onChange:a}),e.worktree?(0,U.jsx)(fi,{label:`Repository`,value:o,onChange:s}):null,c===void 0?null:(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:c}),(0,U.jsxs)(ci,{children:[(0,U.jsx)(O,{variant:`outline`,onClick:t,children:`Cancel`}),(0,U.jsx)(O,{disabled:!f||u,onClick:()=>void p(),children:`Relocate and revive`})]})]})})}function fi({label:e,value:t,onChange:n}){let r=Pr(t),i=(0,H.useId)();return(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(`label`,{htmlFor:i,className:`text-sm font-medium`,children:e}),(0,U.jsx)(he,{id:i,className:`font-mono`,value:t,onChange:e=>n(e.target.value),placeholder:`/path/to/folder`,spellCheck:!1}),r?.paths.filter(e=>e!==t).slice(0,5).map(e=>(0,U.jsx)(O,{variant:`ghost`,size:`sm`,className:`justify-start font-mono text-xs`,onClick:()=>n(e),children:e},e))]})}var pi=new Map;function mi(e,t){pi.set(e,structuredClone(t))}function hi(e){let t=pi.get(e);return t&&structuredClone(t)}function gi(e){pi.delete(e)}function _i(e){for(let t of pi.keys())e.has(t)||pi.delete(t)}var vi=2e3,yi=3e4,bi=(0,H.createContext)(void 0);function xi(){let e=(0,H.useContext)(bi);if(!e)throw Error(`useAgentSessions outside SessionsProvider`);return e}function Si({children:e}){let{connection:t}=Ue(),[n,r]=(0,H.useState)([]),[i,a]=(0,H.useState)(!1),[o,s]=(0,H.useState)(void 0),c=(0,H.useRef)(()=>{});(0,H.useEffect)(()=>{let e=!1,n,i,o=0,s=0,l=0,u=e=>{n&&clearTimeout(n),n=setTimeout(()=>void d(),e)},d=async()=>{if(e||document.hidden)return;i?.abort(),i=new AbortController;let n=++o;try{let i=await t.listSessions();if(e||n<=s)return;s=n,l=0,_i(new Set(i.map(e=>e.id))),r(i),a(!0),u(vi)}catch{if(e)return;a(!0),l+=1,u(Math.min(yi,vi*2**l))}},f=()=>{document.hidden||d()};return c.current=()=>void d(),d(),document.addEventListener(`visibilitychange`,f),()=>{e=!0,c.current=()=>{},n&&clearTimeout(n),i?.abort(),document.removeEventListener(`visibilitychange`,f)}},[t]);let l=(0,H.useCallback)(()=>c.current(),[]),u=n.find(e=>e.id===o);return(0,U.jsxs)(bi.Provider,{value:{sessions:n,loaded:i,nudge:l,relocate:s},children:[e,u?(0,U.jsx)(di,{session:u,onClose:()=>{s(void 0),l()}}):null]})}function Ci(){let{connection:e}=Ue(),{nudge:t,relocate:n}=xi();return(0,H.useCallback)(async r=>{try{let n=await e.command(r);return t(),n}catch(e){if(e.code===`scope_missing`&&`sessionId`in r){n(r.sessionId),t();return}ze.error(`${r.type} failed`,e instanceof Error?e.message:String(e)),t();return}},[e,t,n])}var wi=[`general`,`projects`,`permissions`,`providers`,`appearance`,`keyboard`,`workflows`,`secrets`,`mcp`],Ti={sessionId:void 0};function Ei(e){let[t=``,n=``]=e.replace(/^#\/?/,``).split(`?`,2),r=t.split(`/`).filter(e=>e!==``);if(r[0]===`settings`)return{sessionId:void 0,settings:ki(r[1])};let i=Di(r),a=new URLSearchParams(n).get(`settings`);return a===null?i:{...i,settings:ki(a)}}function Di(e){if(e[0]===`spend`)return{sessionId:void 0,spend:!0};if(e[0]===`schedules`){let t={sessionId:void 0,schedules:!0};if(e[1]===`occurrences`){let n=Ai(e[2]??``);return n?{...t,occurrenceId:n}:t}let n=Ai(e[1]??``);return n?{...t,scheduleId:n}:t}if(e[0]===`new`&&e[1])return{sessionId:void 0,backend:Ai(e[1])};if(e[0]!==`s`||e[1]===void 0)return Ti;let t=Ai(e[1]);return{sessionId:t===``?void 0:t}}function Oi(e){let t=e.spend?`#/spend`:e.schedules?`#/schedules${e.occurrenceId?`/occurrences/${encodeURIComponent(e.occurrenceId)}`:e.scheduleId?`/${encodeURIComponent(e.scheduleId)}`:``}`:e.sessionId===void 0?e.backend?`#/new/${encodeURIComponent(e.backend)}`:``:`#/s/${encodeURIComponent(e.sessionId)}`;return e.settings===void 0?t:`${t||`#/`}?settings=${e.settings}`}function ki(e){return wi.find(t=>t===Ai(e??``))??wi[0]}function Ai(e){try{return decodeURIComponent(e)}catch{return``}}function ji(e){return e.title||e.id}var Mi=60,Ni=[{key:`description`,shape:`text`},{key:`command`,shape:`text`},{key:`questions`,shape:`questions`},{key:`file_path`,shape:`path`},{key:`notebook_path`,shape:`path`},{key:`pattern`,shape:`text`},{key:`url`,shape:`text`},{key:`query`,shape:`text`},{key:`path`,shape:`path`},{key:`prompt`,shape:`text`}],Pi=Ni.filter(({key:e})=>e!==`description`);function Fi(e){return Li(e,Mi)}function Ii(e){return Li(e,1/0,Pi)}function Li(e,t,n=Ni){if(!e||typeof e!=`object`)return;let r=e;for(let e of n){let n=r[e.key];if(e.shape===`questions`){let e=Ri(n,t);if(e!==void 0)return e;continue}if(typeof n==`string`&&n.trim()!==``)return e.shape===`path`?Bi(n.trim(),t):zi(n,t)}let i=Object.values(r).filter(e=>typeof e==`string`),a=i.length===1?i[0]:void 0;return a&&a.trim()!==``?zi(a,t):void 0}function Ri(e,t){if(!Array.isArray(e)||e.length===0)return;let n=e[0];if(!n||typeof n!=`object`)return;let r=n.question;if(typeof r!=`string`||r.trim()===``)return;let i=e.length-1;return zi(i>0?`${r} (+${i} more)`:r,t)}function zi(e,t){let n=e.replace(/\s+/g,` `).trim();return n.length<=t?n:`${n.slice(0,t-1)}…`}function Bi(e,t){return e.length<=t?e:`…${e.slice(-(t-1))}`}var Vi=H.createContext(void 0);function Hi(e){let t=H.useContext(Vi);if(t===void 0&&!e)throw Error(B(72));return t}var Ui={...ur,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},Wi=class extends f{constructor(e,t,n){let r=new Ft;super(Gi(e,r,t,n),Ki(r),Ui)}setOpen=(e,t)=>{jt(this,e,t,{extraState:{openChangeReason:t.reason}})};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,d(z,e))}};function Gi(e,t,n,r=!1){let i={...rr(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e};return i.floatingRootContext=ir(t,n,r),i}function Ki(e){return{popupRef:H.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}var qi=ye(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:f=null,children:p}=e,m=Mt((e,t)=>new Wi({open:n,openProp:r,activeTriggerId:f,triggerIdProp:u},e,t));m.useControlledProp(`openProp`,r),m.useControlledProp(`triggerIdProp`,u),m.useContextCallback(`onOpenChange`,s),m.useContextCallback(`onOpenChangeComplete`,c);let h=m.useState(`open`),g=!t&&h,_=m.useState(`activeTriggerId`),v=m.useState(`mounted`),y=m.useState(`payload`);m.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i,disabled:t}),Bt(m,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:b,transitionStatus:x}=yt(g,m),S=m.useState(`isInstantPhase`),C=m.useState(`instantType`),w=m.useState(`lastOpenChangeReason`),T=H.useRef(null);V(()=>{h&&t&&m.setOpen(!1,d(_e))},[h,t,m]),V(()=>{x===`ending`&&w===`none`||x!==`ending`&&S?(C!==`delay`&&(T.current=C),m.set(`instantType`,`delay`)):T.current!==null&&(m.set(`instantType`,T.current),T.current=null)},[x,S,w,C,m]),V(()=>{g&&(_??m.set(`payload`,void 0))},[m,_,g]),H.useImperativeHandle(o,()=>({unmount:b,close:()=>m.setOpen(!1,d(D))}),[b,m]);let E=g||v||!t&&a!==`none`;return(0,U.jsxs)(Vi.Provider,{value:m,children:[l&&(0,U.jsx)(ht,{handle:l,store:m}),E&&(0,U.jsx)(Ji,{store:m,disabled:t,trackCursorAxis:a}),typeof p==`function`?p({payload:y}):p]})});function Ji({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=gt(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=tr(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n}),o=H.useMemo(()=>ee(a.reference,i.reference),[a.reference,i.reference]);return xt(e,{activeTriggerProps:o,inactiveTriggerProps:o,popupProps:i.floating??L}),null}var Yi=H.createContext(void 0);function Xi(){return H.useContext(Yi)}var Zi=`data-base-ui-tooltip-trigger`;function Qi(e){if(`composedPath`in e){let t=e.composedPath();for(let e=0;e<t.length;e+=1){let n=t[e];if(Fe(n))return n}}let t=e.target;return Fe(t)?t:null}function $i(e){let t=e;for(;t;){let e=t.closest(`[${Zi}]`);if(e)return e;let n=t.getRootNode();t=`host`in n&&Fe(n.host)?n.host:null}return null}var ea=c(function(e,t){let{render:n,className:r,style:i,handle:a,payload:o,disabled:s,delay:c,closeOnClick:l=!0,closeDelay:u,id:f,...p}=e,m=Hi(!0),h=fr(a)??m;if(!h)throw Error(B(82));let g=xe(f),v=h.useState(`isTriggerActive`,g),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`floatingRootContext`),S=H.useRef(null),C=c??600,w=u??0,{registerTrigger:T,isMountedByThisTrigger:E}=Ct(g,S,h,{payload:o,closeOnClick:l,closeDelay:w}),D=Xi(),{delayRef:O,isInstantPhase:k,hasProvider:A}=Qn(b,{open:y}),M=yr(b);h.useSyncedValue(`isInstantPhase`,k);let N=h.useState(`disabled`),P=s??N,F=Dt(P),I=h.useState(`trackCursorAxis`),L=h.useState(`disableHoverablePopup`),R=H.useRef(!1),ee=Be(),z=H.useRef(void 0);function te(){return A?Gn(O.current,`open`)===0?0:c??D??600:C}function V(e){let t=S.current;if(!t||!e)return!1;let n=$i(e);return n!==null&&n!==t&&Te(t,n)}function ne(e){let t=V(e);return R.current=t,t&&(M.openChangeTimeout.clear(),M.restTimeout.clear(),M.restTimeoutPending=!1,ee.clear()),t}let re=Sr(b,{enabled:!P,mouseOnly:!0,move:!1,handleClose:!L&&I!==`both`?Ar():null,restMs:te,delay(){return u==null&&A?{close:Gn(O.current,`close`)}:{close:w}},triggerElementRef:S,isActiveTrigger:v,isClosing:()=>h.select(`transitionStatus`)===`ending`,shouldOpen(){return!R.current}}),ie=mr(b,{enabled:!P}).reference,ae=e=>{let t=R.current,n=Qi(e),r=ne(n),i=S.current,a=i&&n&&Te(i,n);if(r&&h.select(`open`)&&h.select(`lastOpenChangeReason`)===`trigger-hover`){h.setOpen(!1,d(_,e));return}if(t&&!r&&a&&!F.current&&!h.select(`open`)&&i&&x(z.current)){let t=()=>{!R.current&&!F.current&&!h.select(`open`)&&h.setOpen(!0,d(_,e,i))},n=te();n===0?(ee.clear(),t()):ee.start(n,t)}},oe=h.useState(`triggerProps`,E);return j(`button`,e,{state:{open:y},ref:[t,T,S],props:[re,ie,E||I!==`none`?oe:void 0,{onMouseOver(e){ae(e.nativeEvent)},onFocus(e){V(Qi(e.nativeEvent))&&e.preventBaseUIHandler()},onMouseLeave(){R.current=!1,ee.clear(),z.current=void 0},onPointerEnter(e){z.current=e.pointerType},onPointerDown(e){z.current=e.pointerType,h.set(`closeOnClick`,l),l&&!h.select(`open`)&&h.cancelPendingOpen(e.nativeEvent)},onClick(e){l&&!h.select(`open`)&&h.cancelPendingOpen(e.nativeEvent)},id:g,"data-trigger-disabled":P?``:void 0,[Zi]:P?void 0:``},p],stateAttributesMapping:pt})}),ta=H.createContext(void 0);function na(){let e=H.useContext(ta);if(e===void 0)throw Error(B(70));return e}var ra=H.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return Hi().useState(`mounted`)||n?(0,U.jsx)(ta.Provider,{value:n,children:(0,U.jsx)(M,{ref:t,...r})}):null}),ia=H.createContext(void 0);function aa(){let e=H.useContext(ia);if(e===void 0)throw Error(B(71));return e}var oa=H.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=Pe,style:g,..._}=e,v=Hi(),y=na(),b=v.useState(`open`),x=v.useState(`mounted`),S=v.useState(`trackCursorAxis`),C=v.useState(`disableHoverablePopup`),w=v.useState(`floatingRootContext`),T=v.useState(`instantType`),E=v.useState(`transitionStatus`),D=v.useState(`adaptiveOrigin`),O=ct({anchor:i,positionMethod:a,floatingRootContext:w,mounted:x,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:y,collisionAvoidance:h,adaptiveOrigin:D}),k=H.useMemo(()=>({open:b,side:O.side,align:O.align,anchorHidden:O.anchorHidden,instant:S===`none`?T:`tracking-cursor`}),[b,O.side,O.align,O.anchorHidden,S,T]),A=nt(e,k,{styles:O.positionerStyles,transitionStatus:E,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!x,inert:!b||S===`both`||C});return(0,U.jsx)(ia.Provider,{value:O,children:A})}),sa=H.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=Hi(),{side:s,align:c}=aa(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`),m=o.useState(`disabled`),h=o.useState(`closeDelay`);we({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),br(p,{enabled:!m,closeDelay:h});let g=o.useStateSetter(`popupElement`);return j(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,g],props:[wt,f,Nt(d),a],stateAttributesMapping:ft})}),ca=H.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=Hi(),{arrowRef:s,side:c,align:l,arrowUncentered:u,arrowStyles:d}=aa(),f={open:o.useState(`open`),side:c,align:l,uncentered:u,instant:o.useState(`instantType`)};return j(`div`,e,{state:f,ref:[t,s],props:[{style:d,"aria-hidden":!0},a],stateAttributesMapping:tt})}),la=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=H.useMemo(()=>({open:t,close:n}),[t,n]);return(0,U.jsx)(Yi.Provider,{value:t,children:(0,U.jsx)(Zn,{delay:i,timeoutMs:r,children:e.children})})};function ua({delay:e=0,...t}){return(0,U.jsx)(la,{"data-slot":`tooltip-provider`,delay:e,...t})}function da({...e}){return(0,U.jsx)(qi,{"data-slot":`tooltip`,...e})}function fa({...e}){return(0,U.jsx)(ea,{"data-slot":`tooltip-trigger`,...e})}function pa({className:e,side:t=`top`,sideOffset:n=4,align:r=`center`,alignOffset:i=0,children:a,...o}){return(0,U.jsx)(ra,{children:(0,U.jsx)(oa,{align:r,alignOffset:i,side:t,sideOffset:n,className:`isolate z-50`,children:(0,U.jsxs)(sa,{"data-slot":`tooltip-content`,className:g(`z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-xl bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-lg data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...o,children:[a,(0,U.jsx)(ca,{className:`z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:translate-x-[1.5px] data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:translate-x-[-1.5px] data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:translate-x-[-1.5px] data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:translate-x-[1.5px] data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5`})]})})})}var ma=H.createContext(void 0);function ha(e){let t=H.useContext(ma);if(t===void 0&&!e)throw Error(B(33));return t}var ga=H.createContext(void 0);function _a(e){let t=H.useContext(ga);if(t===void 0&&!e)throw Error(B(36));return t}var va=H.createContext(void 0);function ya(e=!0){let t=H.useContext(va);if(t===void 0&&!e)throw Error(B(25));return t}function ba(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),u=a.useState(`open`),d=ya(!0),f=d!==void 0;return H.useMemo(()=>({id:r,role:`menuitem`,tabIndex:u&&n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:We})},onMouseUp(e){if(d){let t=d.initialCursorPointRef.current;if(d.initialCursorPointRef.current=null,f&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||f&&!He&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!f||e.button===2)&&c.type===`regular-item`&&m(s.current,e,{detail:1})}}),[t,n,r,l,i,u,a,o,s,d,f,c])}var xa={type:`regular-item`};function Sa(e){let{closeOnClick:t,disabled:n,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=H.useRef(null),{getButtonProps:d,buttonRef:f}=R({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=ba({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=H.useCallback(e=>ee(p,{onMouseEnter(){c.type===`submenu-trigger`&&c.setActive()}},e,d),[p,d,c]),h=I(u,f);return H.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var Ca=H.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,d=Ke({guess:!0,label:a}),f=ha(!0),p=xe(i),{store:m}=_a(),h=m.useState(`disabled`),g=s||h,_=m.useState(`isActive`,d.index),v=m.useState(`itemProps`),{getItemProps:y,itemRef:b}=Sa({closeOnClick:c,disabled:g,highlighted:_,id:p,store:m,nativeButton:o,nodeId:f?.context.nodeId,itemMetadata:xa});return j(`div`,e,{state:{disabled:g,highlighted:_},props:[v,u,y],ref:[b,t,d.ref]})}),wa=H.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s}=_a(),{side:c,align:l}=ha(),u=Et(!0)!=null,f=s.useState(`open`),p=s.useState(`transitionStatus`),m=s.useState(`popupProps`),h=s.useState(`mounted`),g=s.useState(`instantType`),_=s.useState(`activeTriggerElement`),v=s.useState(`parent`),y=s.useState(`lastOpenChangeReason`),b=s.useState(`rootId`),x=s.useState(`floatingRootContext`),S=s.useState(`floatingTreeRoot`),C=s.useState(`closeDelay`),w=s.useState(`hoverEnabled`),T=s.useState(`disabled`),E=s.useState(`openMethod`),D=v.type===`context-menu`;we({open:f,ref:s.context.popupRef,onComplete(){f&&s.context.onOpenChangeComplete?.(!0)}}),H.useEffect(()=>{function e(e){s.setOpen(!1,d(e.reason,e.domEvent))}return S.events.on(`close`,e),()=>{S.events.off(`close`,e)}},[S.events,s]),br(x,{enabled:w&&!T&&!D&&v.type!==`menubar`,closeDelay:C});let O=s.useStateSetter(`popupElement`),k={transitionStatus:p,side:c,align:l,open:f,nested:v.type===`menu`,instant:g},A=j(`div`,e,{state:k,ref:[t,s.context.popupRef,O],stateAttributesMapping:ft,props:[m,{onKeyDown(e){u&&Je.has(e.key)&&e.stopPropagation()}},Nt(p),o,{"data-rootownerid":b}]}),M=v.type===void 0||D;return(_||v.type===`menubar`&&y!==`outside-press`)&&(M=!0),(0,U.jsx)(lt,{context:x,openInteractionType:E,modal:D,disabled:!h,returnFocus:a===void 0?M:a,initialFocus:v.type!==`menu`,restoreFocus:!0,externalTree:v.type===`menubar`?void 0:S,previousFocusableElement:_,nextFocusableElement:v.type===void 0?s.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:v.type===void 0?s.context.beforeContentFocusGuardRef:void 0,children:A})}),Ta=H.createContext(void 0);function Ea(){let e=H.useContext(Ta);if(e===void 0)throw Error(B(32));return e}var Da=H.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=_a();return i.useState(`mounted`)||n?(0,U.jsx)(Ta.Provider,{value:n,children:(0,U.jsx)(u,{ref:t,...r})}):null}),Oa=H.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:f=5,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:h=!1,collisionAvoidance:g=ce,style:_,...v}=e,{store:b}=_a(),x=Ea(),S=ya(!0),C=b.useState(`parent`),w=b.useState(`floatingRootContext`),T=b.useState(`floatingTreeRoot`),E=b.useState(`mounted`),D=b.useState(`open`),O=b.useState(`modal`),k=b.useState(`openMethod`),A=b.useState(`activeTriggerElement`),j=b.useState(`transitionStatus`),M=b.useState(`positionerElement`),N=b.useState(`instantType`),P=b.useState(`adaptiveOrigin`),F=b.useState(`lastOpenChangeReason`),I=b.useState(`floatingNodeId`),L=b.useState(`floatingParentNodeId`),R=w.useState(`domReferenceElement`),ee=H.useRef(null),z=ke(M),B=n,te=c,ne=l,re=s,ie=g;C.type===`context-menu`&&(B=n??C.context?.anchor,re??=`start`,!o&&re!==`center`&&(ne=e.alignOffset??2,te=e.sideOffset??-5));let ae=o,oe=re;C.type===`menu`?(ae??=`inline-end`,oe??=`start`,ie=e.collisionAvoidance??Pe):C.type===`menubar`&&(ae??=C.context.orientation===`vertical`?`inline-end`:`bottom`,oe??=`start`);let se=C.type===`context-menu`,le=ct({anchor:B,floatingRootContext:w,positionMethod:S?`fixed`:r,mounted:E,side:ae,sideOffset:te,align:oe,alignOffset:ne,arrowPadding:se?0:p,collisionBoundary:u,collisionPadding:f,sticky:m,nodeId:I,keepMounted:x,disableAnchorTracking:h,collisionAvoidance:ie,shift:se?{crossAxis:!(`side`in ie&&ie.side===`flip`),rootBoundary:`layoutViewport`}:void 0,externalTree:T,adaptiveOrigin:P});H.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===I&&b.set(`hoverEnabled`,!1),e.nodeId!==I&&e.parentNodeId===b.select(`floatingParentNodeId`)&&b.setOpen(!1,d(y)))}return T.events.on(`menuopenchange`,e),()=>{T.events.off(`menuopenchange`,e)}},[b,T.events,I]),H.useEffect(()=>{if(b.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==b.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;b.setOpen(!1,d(t))}return T.events.on(`menuopenchange`,e),()=>{T.events.off(`menuopenchange`,e)}},[T.events,b]);let ue=Be();H.useEffect(()=>{D||ue.clear()},[D,ue]),H.useEffect(()=>{function e(e){if(!(!D||e.nodeId!==b.select(`floatingParentNodeId`))){if(e.target&&A&&A!==e.target){let e=b.select(`closeDelay`);e>0?ue.isStarted()||ue.start(e,()=>{b.setOpen(!1,d(y))}):b.setOpen(!1,d(y))}else ue.clear()}}return T.events.on(`itemhover`,e),()=>{T.events.off(`itemhover`,e)}},[T.events,D,A,b,ue]),H.useEffect(()=>{let e={open:D,nodeId:I,parentNodeId:L,reason:b.select(`lastOpenChangeReason`)};T.events.emit(`menuopenchange`,e)},[T.events,D,b,I,L]),V(()=>{let e=R,t=ee.current;if(e&&(ee.current=e),t&&e&&e!==t){b.set(`instantType`,void 0);let e=new AbortController;return z(()=>{b.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[R,z,b]);let de={open:D,side:le.side,align:le.align,anchorHidden:le.anchorHidden,nested:C.type===`menu`,instant:N},fe=C.type===`menubar`&&C.context.modal;Xe(D&&(fe||O&&F!==`trigger-hover`),k===`touch`,M,A);let pe=nt(e,de,{styles:le.positionerStyles,transitionStatus:j,props:v,refs:[t,b.useStateSetter(`positionerElement`)],hidden:!E,inert:!D}),me=E&&C.type!==`menu`&&(C.type!==`menubar`&&O&&F!==`trigger-hover`||C.type===`menubar`&&C.context.modal),he=null;return C.type===`menubar`?he=C.context.contentElement:C.type===void 0&&(he=A),(0,U.jsxs)(ma.Provider,{value:le,children:[me&&(0,U.jsx)(et,{ref:C.type===`context-menu`||C.type===`nested-context-menu`?C.context.internalBackdropRef:null,inert:Me(!D),cutout:he}),(0,U.jsx)(Ye,{id:I,children:(0,U.jsx)(at,{elementsRef:b.context.itemDomElements,labelsRef:b.context.itemLabels,children:pe})})]})}),ka=H.createContext(null);function Aa(e){let t=H.useContext(ka);if(t===null&&!e)throw Error(B(5));return t}var ja={...ur,disabled:e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0),openMethod:e=>e.openMethod,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId,activeIndex:e=>e.activeIndex,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)}},Ma=class extends f{constructor(e){super({...Pa(),...e},Na(),ja),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);(t!==i||n!==a||r!==o)&&(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}unsubscribeParentListener=null};function Na(){return{positionerRef:H.createRef(),popupRef:H.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:H.createRef(),beforeContentFocusGuardRef:H.createRef(),onOpenChangeComplete:void 0,triggerElements:new Ft}}function Pa(){return{...rr(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new ot,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:L,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0}}var Fa=H.createContext(void 0);function Ia(){return H.useContext(Fa)}var La=ye(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:o=!1,modal:s,loopFocus:c=!0,orientation:u=`vertical`,actionsRef:f,closeParentOnEsc:p=!1,handle:m,triggerId:h,defaultTriggerId:g=null,highlightItemOnHover:_=!0}=e,v=ya(!0),y=_a(!0),b=Aa(!0),x=Ia(),S=H.useMemo(()=>x&&y?{type:`menu`,store:y.store}:b?{type:`menubar`,context:b}:v&&!y?{type:`context-menu`,context:v}:{type:void 0},[v,y,b,x]),C=Ra({open:a,openProp:n,activeTriggerId:g,triggerIdProp:h,parent:S});C.useControlledProp(`openProp`,n),C.useControlledProp(`triggerIdProp`,h),C.useContextCallback(`onOpenChangeComplete`,i);let w=te(),T=te(),E=C.useState(`floatingTreeRoot`),O=ut(E),k=$e(),j=C.useState(`open`),M=C.useState(`activeTriggerElement`),N=C.useState(`positionerElement`),P=C.useState(`hoverEnabled`),F=C.useState(`disabled`),I=C.useState(`lastOpenChangeReason`),R=C.useState(`parent`),z=C.useState(`activeIndex`),B=C.useState(`payload`),ne=C.useState(`floatingParentNodeId`),re=H.useRef(null),ie=H.useRef(R.type!==`context-menu`),ae=Be(),oe=H.useRef(!0),se=Be(),ce=ne!=null,{openMethod:le,triggerProps:ue}=Tt(j);C.useSyncedValues({disabled:o,highlightItemOnHover:_,modal:R.type===void 0?s:void 0,openMethod:le,rootId:w}),Bt(C);let{forceUnmount:de}=yt(j,C,()=>{C.set(`allowMouseEnter`,!1)});V(()=>{v&&!y?C.update({parent:{type:`context-menu`,context:v},floatingNodeId:O,floatingParentNodeId:k}):y&&C.update({floatingNodeId:O,floatingParentNodeId:k})},[v,y,O,k,C]),H.useEffect(()=>{if(j||(re.current=null),R.type===`context-menu`){if(!j){ae.clear(),ie.current=!1;return}ae.start(500,()=>{ie.current=!0})}},[ae,j,R.type]),V(()=>{!j&&!P&&C.set(`hoverEnabled`,!0)},[j,P,C]);let fe=A((e,t)=>{let n=t.reason;if(!e&&!C.select(`open`)||j===e&&t.trigger===M&&I===n)return;let i=Lt(t);if(!e&&t.trigger==null&&(t.trigger=M??void 0),r?.(e,t),t.isCanceled)return;C.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&a?.type===`click`&&a.pointerType===`touch`&&!oe.current)return;e&&n===`trigger-focus`?(oe.current=!1,se.start(300,()=>{oe.current=!0})):(oe.current=!0,se.clear());let o=(n===`trigger-press`||n===`item-press`)&&a.detail===0,s=!e&&(n===`escape-key`||n==null),c={open:e,openChangeReason:n};re.current=t.event,Ot(c,e,t.trigger,i()),C.update(c),R.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?C.set(`instantType`,`group`):o||s?C.set(`instantType`,o?`click`:`dismiss`):C.set(`instantType`,void 0)}),pe=Vt({popupStore:C,floatingId:T,nested:k!=null,onOpenChange:fe}),me=pe.context.events;V(()=>{let e=({open:e,eventDetails:t})=>fe(e,t);return me.on(`setOpen`,e),()=>{me?.off(`setOpen`,e)}},[me,fe]);let he=H.useCallback(()=>{C.setOpen(!1,d(D))},[C]);H.useImperativeHandle(f,()=>({unmount:de,close:he}),[de,he]);let ge;R.type===`context-menu`&&(ge=R.context),H.useImperativeHandle(ge?.positionerRef,()=>N,[N]),H.useImperativeHandle(ge?.actionsRef,()=>({setOpen:fe}),[fe]);let _e=gt(pe,{enabled:!F,bubbles:{escapeKey:p&&R.type===`menu`},outsidePress(){return R.type!==`context-menu`||re.current?.type===`contextmenu`||ie.current},externalTree:ce?E:void 0}),ve=Ge(),ye=H.useCallback(e=>{C.select(`activeIndex`)!==e&&C.set(`activeIndex`,e)},[C]),be=zt(pe,{enabled:!F,listRef:C.context.itemDomElements,activeIndex:z,nested:R.type!==void 0,loopFocus:c,orientation:u,parentOrientation:R.type===`menubar`?R.context.orientation:void 0,rtl:ve===`rtl`,disabledIndices:l,onNavigate:ye,openOnArrowKeyDown:R.type!==`context-menu`,externalTree:ce?E:void 0,focusItemOnHover:_}),xe=H.useCallback(e=>{C.context.typingRef.current=e},[C]),Se=bt(pe,{enabled:!F,listRef:C.context.itemLabels,elementsRef:C.context.itemDomElements,activeIndex:z,resetMs:500,onMatch:e=>{j&&e!==z&&C.set(`activeIndex`,e)},onTyping:xe}),Ce=H.useMemo(()=>{let e=ee(Se.reference,be.reference,_e.reference,{onMouseMove(){C.set(`allowMouseEnter`,!0)}},ue);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=j,e},[C,Se.reference,be.reference,_e.reference,ue,j]),we=H.useMemo(()=>{let e=ee(be.trigger,_e.trigger,ue);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[be.trigger,_e.trigger,ue]),Te=H.useMemo(()=>ee(wt,{id:T,role:`menu`,"aria-labelledby":M?.id,onMouseMove(){C.set(`allowMouseEnter`,!0),R.type===`menu`&&C.set(`hoverEnabled`,!1)},onClick(){C.select(`hoverEnabled`)&&C.set(`hoverEnabled`,!1)},onKeyDown(e){let t=C.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},Se.floating,be.floating,_e.floating),[M,T,R.type,C,Se.floating,be.floating,_e.floating]),Ee=be.item??L;xt(C,{floatingRootContext:pe,activeTriggerProps:Ce,inactiveTriggerProps:we,popupProps:Te,itemProps:Ee});let De=H.useMemo(()=>({store:C,parent:S}),[C,S]),Oe=(0,U.jsxs)(ga.Provider,{value:De,children:[m&&(0,U.jsx)(ht,{handle:m,store:C}),typeof t==`function`?t({payload:B}):t]});return R.type===void 0||R.type===`context-menu`?(0,U.jsx)(Ht,{externalTree:E,children:Oe}):Oe});function Ra(e){return a(()=>new Ma(e)).current}function za(e){let t=_a().store,n=H.useMemo(()=>({parentMenu:t}),[t]);return(0,U.jsx)(Fa.Provider,{value:n,children:(0,U.jsx)(La,{...e})})}function Ba(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=v(),{ref:i,index:a}=Ke(e),o=n===a,s=H.useRef(null),c=I(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}function Va(e){let{render:t,className:n,style:r,state:i=L,props:a=l,refs:o=l,metadata:s,stateAttributesMapping:c,tag:u=`div`,...d}=e,{compositeProps:f,compositeRef:p}=Ba({metadata:s});return j(u,e,{state:i,ref:[p,...o],props:[f,...a,d],stateAttributesMapping:c})}function Ha(e){if(se(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!le(e))return Ha(je(e))}function Ua(e,t){let n=H.useRef(null);function r(t){_n.flushSync(()=>{e.setOpen(!1,d(C,t.nativeEvent,t.currentTarget))}),me(n.current)?.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&pe(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{_n.flushSync(()=>{e.setOpen(!1,d(C,n.nativeEvent,n.currentTarget))});let i=Ce(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&Te(r,i);){let e=i;if(i=ue(i),i===e)break}i?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function Wa(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=H.useRef(!1);return H.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,b(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:L,[t,n,r])}var Ga=c(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,openOnHover:c,delay:l=100,closeDelay:u=0,handle:d,payload:f,...p}=e,m=_a(!0),h=fr(d)??m?.store;if(!h)throw Error(B(85));let g=xe(s),_=h.useState(`isTriggerActive`,g),y=h.useState(`floatingRootContext`),x=h.useState(`isOpenedByTrigger`,g),S=h.useState(`triggerPopupId`,g),C=H.useRef(null),w=qa(),E=v(!0),D=Ze(),O=H.useMemo(()=>D??new ot,[D]),k=ut(O),M=$e(),{registerTrigger:N,isMountedByThisTrigger:P}=Ct(g,C,h,{payload:f,closeDelay:u,parent:w,floatingTreeRoot:O,floatingNodeId:k,floatingParentNodeId:M,keyboardEventRelay:E?.relayKeyboardEvent}),F=w.type===`menubar`,I=h.useState(`disabled`),z=a||I||F&&w.context.disabled,{getButtonProps:te,buttonRef:V}=R({disabled:z,native:o});H.useEffect(()=>{!x&&w.type===void 0&&(h.context.allowMouseUpTriggerRef.current=!1)},[h,x,w.type]);let ne=H.useRef(null),re=Be(),ie=A(e=>{if(!ne.current)return;re.clear(),h.context.allowMouseUpTriggerRef.current=!1;let t=e.target;Te(ne.current,t)||Te(h.select(`positionerElement`),t)||t===ne.current||(t==null||Ha(t)!==h.select(`rootId`))&&(Qe(e,ne.current)||O.events.emit(`close`,{domEvent:e,reason:T}))});H.useEffect(()=>{x&&h.select(`lastOpenChangeReason`)===`trigger-hover`&&b(ne.current).addEventListener(`mouseup`,ie,{once:!0})},[x,ie,h]);let ae=F&&w.context.hasSubmenuOpen,se=Sr(y,{enabled:(c??ae)&&!z&&(!F||ae&&!P),handleClose:Ar({blockPointerEvents:!F}),mouseOnly:!0,move:!1,restMs:w.type===void 0?l:void 0,delay:{close:u},triggerElementRef:C,externalTree:O,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),ce=Ka(x,h.select(`lastOpenChangeReason`)),le=Ut(y,{enabled:!z,event:x&&F?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:w.type===void 0&&ce}),ue=mr(y,{enabled:!z&&ae}),de=Wa({open:x,enabled:F,mouseDownAction:`open`}),fe=H.useMemo(()=>ee(ue.reference,le.reference),[ue.reference,le.reference]),pe=h.useState(`triggerProps`,P),{preFocusGuardRef:me,handlePreFocusGuardFocus:he,handleFocusTargetFocus:ge}=Ua(h,C),_e={disabled:z,open:x},ve=[ne,t,V,N,C],ye=[fe,se??L,pe,{"aria-haspopup":`menu`,"aria-controls":S,id:g,onMouseDown:e=>{h.select(`open`)||(re.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),b(e.currentTarget).addEventListener(`mouseup`,ie,{once:!0}))}},F?{role:`menuitem`}:{},de,p,te],be=j(`button`,e,{enabled:!F,stateAttributesMapping:dt,state:_e,ref:ve,props:ye});return F?(0,U.jsx)(Va,{tag:`button`,render:n,className:r,style:i,state:_e,refs:ve,props:ye,stateAttributesMapping:dt}):x?(0,U.jsxs)(H.Fragment,{children:[(0,U.jsx)(oe,{ref:me,onFocus:he},`${g}-pre-focus-guard`),(0,U.jsx)(H.Fragment,{children:be},g),(0,U.jsx)(oe,{ref:h.context.triggerFocusTargetRef,onFocus:ge},`${g}-post-focus-guard`)]}):(0,U.jsx)(H.Fragment,{children:be},g)});function Ka(e,t){let n=Be(),[r,i]=H.useState(!1);return V(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function qa(){let e=Aa(!0);return H.useMemo(()=>e?{type:`menubar`,context:e}:{type:void 0},[e])}var Ja=H.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return j(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})}),Ya={"aria-expanded":void 0},Xa=H.forwardRef(function(e,t){let{render:n,className:r,style:i,label:a,id:o,nativeButton:s=!1,openOnHover:c=!0,delay:l=100,closeDelay:u=0,disabled:d=!1,...f}=e,p=Ia();if(!p?.parentMenu)throw Error(B(37));let m=Ke({guess:!0,label:a}),h=ha(),{store:g}=_a(),_=xe(o),v=g.useState(`open`),y=g.useState(`floatingRootContext`),b=g.useState(`floatingTreeRoot`),x=g.useState(`triggerPopupId`,_),S=St(_,g),C=H.useCallback(e=>{let t=S(e);return e!==null&&g.select(`open`)&&g.select(`activeTriggerId`)==null&&g.update({activeTriggerId:_,activeTriggerElement:e,closeDelay:u}),t},[S,u,g,_]),w=H.useRef(null),T=H.useCallback(e=>{w.current=e,g.set(`activeTriggerElement`,e)},[g]);g.useSyncedValue(`closeDelay`,u);let E=p.parentMenu,D=g.useState(`disabled`),O=E.useState(`disabled`),k=d||D||O,A=E.useState(`itemProps`),M=E.useState(`isActive`,m.index),N=H.useMemo(()=>({type:`submenu-trigger`,setActive(){E.select(`highlightItemOnHover`)&&E.set(`activeIndex`,m.index)}}),[E,m.index]),{getItemProps:P,itemRef:F}=Sa({closeOnClick:!1,disabled:k,highlighted:M,id:_,store:g,typingRef:E.context.typingRef,nativeButton:s,itemMetadata:N,nodeId:h?.context.nodeId}),I=Sr(y,{enabled:g.useState(`hoverEnabled`)&&c&&!k,handleClose:Ar({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:l,delay:{open:l,close:u},shouldOpen:l>0?()=>E.select(`allowMouseEnter`):void 0,triggerElementRef:w,externalTree:b,isClosing:()=>g.select(`transitionStatus`)===`ending`,guardStaleOpen:!0}),R=Ut(y,{enabled:!k,event:`mousedown`,toggle:!c,ignoreMouse:c,stickIfOpen:!1}).reference??L,ee=g.useState(`triggerProps`,!0);delete ee.id;let z={disabled:k,highlighted:M,open:v},te=g.useState(`openMethod`),V=g.useState(`lastOpenChangeReason`)===`list-navigation`||te===`keyboard`;return j(`div`,e,{state:z,stateAttributesMapping:pt,props:[R,I,ee,A,v&&V&&Se?Ya:void 0,{"aria-controls":x,tabIndex:v||M?0:-1,onBlur(){M&&E.set(`activeIndex`,null)}},f,P],ref:[t,m.ref,F,C,T]})});function Za({...e}){return(0,U.jsx)(La,{"data-slot":`dropdown-menu`,...e})}function Qa({className:e,...t}){return(0,U.jsx)(Ga,{"data-slot":`dropdown-menu-trigger`,className:e,...t})}function $a({align:e=`start`,alignOffset:t=0,side:n=`bottom`,sideOffset:r=4,className:i,...a}){return(0,U.jsx)(Da,{children:(0,U.jsx)(Oa,{className:`isolate z-50 outline-none`,align:e,alignOffset:t,side:n,sideOffset:r,children:(0,U.jsx)(wa,{"data-slot":`dropdown-menu-content`,className:g(`z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-2xl bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/5 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95`,i),...a})})})}function eo({className:e,inset:t,variant:n=`default`,...r}){return(0,U.jsx)(Ca,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:g(`group/dropdown-menu-item relative flex min-h-7 cursor-default items-center gap-2 rounded-xl px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function to({...e}){return(0,U.jsx)(za,{"data-slot":`dropdown-menu-sub`,...e})}function no({className:e,inset:t,children:n,...r}){return(0,U.jsxs)(Xa,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":t,className:g(`relative flex min-h-7 cursor-default items-center gap-2 rounded-xl px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-popup-open:bg-accent data-popup-open:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,U.jsx)(Cn,{className:`ml-auto`})]})}function ro({align:e=`start`,alignOffset:t=-3,side:n=`right`,sideOffset:r=0,className:i,...a}){return(0,U.jsx)($a,{"data-slot":`dropdown-menu-sub-content`,className:g(`w-auto min-w-[96px] rounded-2xl bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/5 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,i),align:e,alignOffset:t,side:n,sideOffset:r,...a})}function io({className:e,...t}){return(0,U.jsx)(Ja,{"data-slot":`dropdown-menu-separator`,className:g(`-mx-1 my-1 h-px bg-border/50`,e),...t})}var ao=6e4,oo=60*ao,so=24*oo;function co(e,t=Date.now()){if(!e)return``;let n=Date.parse(e);if(Number.isNaN(n))return``;let r=Math.max(0,t-n);return r<ao?`just now`:r<oo?`${Math.floor(r/ao)}m`:r<so?`${Math.floor(r/oo)}h`:new Date(n).toISOString().slice(0,10)}function lo(e){if(!e||typeof e!=`object`)return;let t=e,n=typeof t.old_string==`string`?t.old_string:void 0,r=typeof t.new_string==`string`?t.new_string:typeof t.content==`string`?t.content:void 0;if(n!==void 0||r!==void 0)return{...typeof t.file_path==`string`?{path:t.file_path}:{},removed:fo(n),added:fo(r)}}function uo(e,t){let n=!!t?.trim();if(!n){let t=/^--- [^\n]*\n\+\+\+ [^\n]*\n/m.test(e),n=/^@@ -\d+(?:,\d+)? \+\d+(?:,\d+)? @@/m.test(e);if(!t||!n)return}let r=0,i=0;return(e.match(/[^\n]*\n|[^\n]+$/g)??[]).map(e=>{let t=/^@@ -\d+(?:,(\d+))? \+\d+(?:,(\d+))? @@/.exec(e);if(t)return r=Number(t[1]??1),i=Number(t[2]??1),{text:e,kind:`context`};let a=r>0||i>0,o=`context`;return(a||n)&&(e.startsWith(`-`)&&(a||!e.startsWith(`--- `))&&(o=`removed`),e.startsWith(`+`)&&(a||!e.startsWith(`+++ `))&&(o=`added`)),a&&((o===`removed`||e.startsWith(` `))&&(r=Math.max(0,r-1)),(o===`added`||e.startsWith(` `))&&(i=Math.max(0,i-1))),{text:e,kind:o}})}function fo(e){if(!e)return[];let t=e.split(`
|
|
3
3
|
`);for(;t.length>0&&t[t.length-1]===``;)t.pop();return t}var po=[[/^mcp__/,`mcp`],[/^(bash|shell|exec|run_?command)$/,`shell`],[/^(read|read_?file|view|notebookread)$/,`read`],[/^(write|write_?file|create_?file|notebookedit)$/,`write`],[/^(edit|multi_?edit|str_replace(_based_edit_tool|_editor)?|apply_?patch)$/,`edit`],[/^(grep|search|ripgrep)$/,`search`],[/^(glob|ls|list|find|list_?directory)$/,`list`],[/^(web_?fetch|web_?search|fetch)$/,`web`],[/^(task|agent)$/,`agent`],[/^todo_?write$/,`todo`]];function mo(e){let t=e.toLowerCase();return po.find(([e])=>e.test(t))?.[1]??`other`}function ho(e){if(typeof e==`string`)return e;let t=Array.isArray(e)?e:typeof e==`object`&&e&&Array.isArray(e.content)?e.content:void 0;if(!t)return;let n=t.flatMap(e=>typeof e==`object`&&e&&typeof e.text==`string`?[e.text]:[]);return n.length>0?n.join(`
|
|
4
4
|
`):void 0}function go(e){if(e!==void 0)return e.split(`
|
|
5
5
|
`).filter(e=>e.trim()!==``).length}function _o(e,t){return`${e} ${t}${e===1?``:`s`}`}function vo(e){if(e.status===`error`)return`failed`;if(e.status!==`complete`)return;let t=lo(e.input);if(t)return`+${t.added.length} −${t.removed.length}`;let n=go(ho(e.result));if(n!==void 0)switch(mo(e.name)){case`read`:return _o(n,`line`);case`list`:return _o(n,`file`);case`search`:return _o(n,`result`);default:return}}var yo={shell:In,read:En,write:Tn,edit:wn,search:Fn,list:Dn,web:kn,agent:xn,todo:An,mcp:Nn,other:Rn};function bo({name:e,className:t}){let n=yo[mo(e)];return(0,U.jsx)(n,{"aria-hidden":!0,className:g(`size-3.5 shrink-0`,t)})}var xo={scale:1,x:0,y:0};function So(e,t,n){let r=Math.min(8,Math.max(1,e.scale));return{scale:r,x:Math.min(0,Math.max(t-t*r,e.x)),y:Math.min(0,Math.max(n-n*r,e.y))}}function Co(e,t,n,r,i,a){let o=Math.min(8,Math.max(1,e.scale*t)),s=o/e.scale;return So({scale:o,x:n-(n-e.x)*s,y:r-(r-e.y)*s},i,a)}function wo(e,t,n,r,i){return So({...e,x:e.x+t,y:e.y+n},r,i)}function To({src:e,alt:t,className:n}){return(0,U.jsxs)(ni,{children:[(0,U.jsx)(ri,{render:(0,U.jsx)(`button`,{type:`button`,"aria-label":t?`Open ${t}`:`Open image`,className:`cursor-zoom-in rounded-md outline-none focus-visible:ring-3 focus-visible:ring-ring/30`}),children:(0,U.jsx)(`img`,{src:e,alt:t,className:g(`block`,n)})}),(0,U.jsxs)(oi,{className:`w-auto max-w-[80vw] gap-0 p-2 sm:max-w-[80vw]`,children:[(0,U.jsx)(li,{className:`sr-only`,children:t||`Image`}),(0,U.jsx)(Eo,{src:e,alt:t})]})]})}function Eo({src:e,alt:t}){let n=(0,H.useRef)(null),r=(0,H.useRef)(void 0),[i,a]=(0,H.useState)(xo);(0,H.useEffect)(()=>{let e=n.current;if(!e)return;let t=t=>{t.preventDefault();let n=e.getBoundingClientRect(),r=t.deltaMode===WheelEvent.DOM_DELTA_LINE?16:1,i=t.deltaX*r,o=t.deltaY*r;a(e=>t.ctrlKey?Co(e,Math.exp(-Math.max(-50,Math.min(50,o))*.01),t.clientX-n.left,t.clientY-n.top,n.width,n.height):wo(e,-i,-o,n.width,n.height))};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[]);let o=()=>n.current.getBoundingClientRect(),s=()=>{r.current=void 0};return(0,U.jsx)(`div`,{ref:n,className:g(`relative touch-none overflow-hidden rounded-md select-none`,i.scale>1?`cursor-grab active:cursor-grabbing`:`cursor-zoom-in`),onPointerDown:e=>{e.button===0&&(e.currentTarget.setPointerCapture(e.pointerId),r.current={x:e.clientX,y:e.clientY})},onPointerMove:e=>{let t=r.current;if(!t)return;let{width:n,height:i}=o(),s=e.clientX-t.x,c=e.clientY-t.y;r.current={x:e.clientX,y:e.clientY},a(e=>wo(e,s,c,n,i))},onPointerUp:s,onPointerCancel:s,onDoubleClick:e=>{let{left:t,top:n,width:r,height:i}=o(),s=e.clientX-t,c=e.clientY-n;a(e=>e.scale>1?xo:Co(e,2,s,c,r,i))},children:(0,U.jsx)(`img`,{src:e,alt:t,draggable:!1,className:`block max-h-[calc(80dvh-1rem)] max-w-[calc(80vw-1rem)] origin-top-left will-change-transform`,style:{transform:`translate(${i.x}px, ${i.y}px) scale(${i.scale})`}})})}function Do(e){if(!e.startsWith(`/`))return;let t=/^\/([A-Za-z0-9][\w-]*(?::(?:[A-Za-z0-9][\w-]*)?)?)?/.exec(e)?.[1]??``;return{name:t,to:t.length+1}}function Oo(e){let t=Do(e);if(!t||t.name===``||t.name.endsWith(`:`))return;let n=e[t.to];if(n===void 0||n===` `||n===`
|
|
@@ -74,7 +74,7 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
74
74
|
${e}</tr>
|
|
75
75
|
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
76
76
|
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${lc(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=uc(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+lc(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=uc(e);if(i===null)return lc(n);e=i;let a=`<img src="${e}" alt="${lc(n)}"`;return t&&(a+=` title="${lc(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:lc(e.text)}},xc=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},Sc=class e{options;renderer;textRenderer;constructor(e){this.options=e||Wo,this.options.renderer=this.options.renderer||new bc,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new xc}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},Cc=class{options;block;constructor(e){this.options=e||Wo}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?yc.lex:yc.lexInline}provideParser(e=this.block){return e?Sc.parse:Sc.parseInline}},wc=new class{defaults=Uo();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Sc;Renderer=bc;TextRenderer=xc;Lexer=yc;Tokenizer=vc;Hooks=Cc;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new bc(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new vc(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Cc;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=Cc.passThroughHooks.has(n)?e=>{if(this.defaults.async&&Cc.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return yc.lex(e,t??this.defaults)}parser(e,t){return Sc.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?yc.lex:yc.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?Sc.parse:Sc.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?yc.lex:yc.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?Sc.parse:Sc.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
77
|
-
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+lc(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Tc(e,t){return wc.parse(e,t)}Tc.options=Tc.setOptions=function(e){return wc.setOptions(e),Tc.defaults=wc.defaults,Go(Tc.defaults),Tc},Tc.getDefaults=Uo,Tc.defaults=Wo;function Ec(...e){return wc.use(...e),Tc.defaults=wc.defaults,Go(Tc.defaults),Tc}Tc.use=Ec,Tc.walkTokens=function(e,t){return wc.walkTokens(e,t)},Tc.parseInline=wc.parseInline,Tc.Parser=Sc,Tc.parser=Sc.parse,Tc.Renderer=bc,Tc.TextRenderer=xc,Tc.Lexer=yc,Tc.lexer=yc.lex,Tc.Tokenizer=vc,Tc.Hooks=Cc,Tc.parse=Tc,Tc.options,Tc.setOptions,Tc.walkTokens,Tc.parseInline,Sc.parse,yc.lex;function Dc(e,t={}){if(e===``)return[];try{return jc(Tc.lexer(e),t)}catch{return[{kind:`paragraph`,inlines:[{kind:`text`,text:e}]}]}}var Oc=new Set([`http:`,`https:`,`mailto:`]);function kc(e){try{return Oc.has(new URL(e).protocol)?e:void 0}catch{return}}var Ac=[1,2,3,4,5,6];function jc(e,t){return e.flatMap(e=>Mc(e,t))}function Mc(e,t){switch(e.type){case`space`:return[];case`heading`:return[{kind:`heading`,level:Ac[e.depth-1]??6,inlines:Ic(e.tokens,t)??[]}];case`paragraph`:return[{kind:`paragraph`,inlines:Ic(e.tokens,t)??[]}];case`text`:return[{kind:`paragraph`,inlines:Ic(e.tokens,t)??Uc(e)}];case`code`:return[{kind:`code`,text:e.text,...e.lang?{lang:e.lang}:{}}];case`blockquote`:return[{kind:`quote`,blocks:jc(e.tokens??[],t)}];case`hr`:return[{kind:`rule`}];case`list`:return[Nc(e,t)];case`table`:return[Fc(e,t)];case`html`:return[{kind:`paragraph`,inlines:Vc(e.raw,t)}];default:return[{kind:`paragraph`,inlines:Uc(e)}]}}function Nc(e,t){let n=e.ordered&&typeof e.start==`number`&&e.start!==1?e.start:void 0;return{kind:`list`,ordered:e.ordered,items:e.items.map(e=>Pc(e,t)),...n===void 0?{}:{start:n}}}function Pc(e,t){let n=jc(e.tokens.filter(e=>e.type!==`checkbox`),t);if(!e.task)return n;let r={kind:`text`,text:e.checked?`[x] `:`[ ] `},[i,...a]=n;return i?.kind===`paragraph`?[{kind:`paragraph`,inlines:[r,...i.inlines]},...a]:[{kind:`paragraph`,inlines:[r]},...n]}function Fc(e,t){let n=e=>e.map(e=>Ic(e.tokens,t)??[]);return{kind:`table`,header:n(e.header),rows:e.rows.map(n),align:e.align.map(e=>e??void 0)}}function Ic(e,t){return e?.flatMap(e=>Lc(e,t))}function Lc(e,t){switch(e.type){case`text`:return Ic(e.tokens,t)??[{kind:`text`,text:e.text}];case`escape`:return[{kind:`text`,text:e.text}];case`strong`:case`em`:case`del`:return[{kind:e.type,inlines:Ic(e.tokens,t)??[]}];case`codespan`:return[{kind:`code`,text:e.text}];case`br`:return[{kind:`break`}];case`link`:return[Rc(e,t)];case`image`:return[Bc(e.href,e.text,e.raw,t)];case`html`:return Vc(e.text,t);default:return Uc(e)}}function Rc(e,t){let n=zc(e.href,t.linkBase);return n===void 0?{kind:`text`,text:e.raw}:{kind:`link`,href:n,inlines:Ic(e.tokens,t)??[{kind:`text`,text:e.text}]}}function zc(e,t){if(!t)return kc(e);try{return kc(new URL(e,t).href)}catch{return}}function Bc(e,t,n,r){let i=r.images&&e.trim()?zc(e,r.imageBase):void 0;if(!i||!/^https?:\/\//i.test(i))return{kind:`text`,text:n};let a=new URL(i),o=/^\/([^/]+)\/([^/]+)\/blob\/(.+)$/.exec(a.pathname);return a.hostname===`github.com`&&o&&(a.hostname=`raw.githubusercontent.com`,a.pathname=`/${o[1]}/${o[2]}/${o[3]}`),{kind:`image`,src:a.href,alt:t}}function Vc(e,t){let n=e.match(/<img\b(?:[^"'<>]|"[^"]*"|'[^']*')*\/?>/gi);return!t.images||!n||n.join(``).replace(/\s/g,``)!==e.replace(/\s/g,``)?[{kind:`text`,text:e}]:n.map(e=>{let n=new Map;for(let t of e.slice(4,-1).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g)){let e=t[1].toLowerCase();n.has(e)||n.set(e,Hc(t[2]??t[3]??t[4]??``))}return Bc(n.get(`src`)??``,n.get(`alt`)??`Screenshot`,e,t)})}function Hc(e){let t={amp:`&`,quot:`"`,apos:`'`,lt:`<`,gt:`>`};return e.replace(/&(#x[0-9a-f]+|#\d+|amp|quot|apos|lt|gt);/gi,(e,n)=>{if(!n.startsWith(`#`))return t[n.toLowerCase()]??e;let r=n[1]?.toLowerCase()===`x`?parseInt(n.slice(2),16):parseInt(n.slice(1),10);return r>0&&r<=1114111?String.fromCodePoint(r):e})}function Uc(e){return[{kind:`text`,text:e.raw}]}function Wc({blocks:e,query:t,trailing:n}){return(0,U.jsx)(`div`,{className:`space-y-3 text-sm leading-relaxed`,children:(0,U.jsx)(Gc,{blocks:e,query:t,trailing:n})})}function Gc({blocks:e,query:t,trailing:n}){return(0,U.jsx)(U.Fragment,{children:e.map((r,i)=>(0,U.jsx)(qc,{block:r,query:t,trailing:i===e.length-1?n:void 0},i))})}var Kc={1:`text-lg`,2:`text-base`};function qc({block:e,query:t,trailing:n}){switch(e.kind){case`paragraph`:return(0,U.jsxs)(`p`,{className:`m-0 [overflow-wrap:anywhere]`,children:[(0,U.jsx)(Zc,{inlines:e.inlines,query:t}),n]});case`heading`:{let r=`h${e.level}`;return(0,U.jsxs)(r,{className:g(Kc[e.level]??`text-sm`,`m-0 pt-1 font-heading font-semibold tracking-tight [overflow-wrap:anywhere]`),children:[(0,U.jsx)(Zc,{inlines:e.inlines,query:t}),n]})}case`code`:return(0,U.jsxs)(`div`,{className:`overflow-hidden rounded-lg border bg-muted`,children:[e.lang===void 0?null:(0,U.jsx)(`div`,{className:`border-b px-3 py-1 font-mono text-xs text-muted-foreground`,children:e.lang}),(0,U.jsx)(`pre`,{className:`overflow-x-auto p-3`,children:(0,U.jsx)(`code`,{className:`font-mono text-sm`,children:(0,U.jsx)(Ho,{text:e.text,lang:e.lang,query:t,trailing:n})})})]});case`list`:{let r=e.ordered?`ol`:`ul`;return(0,U.jsx)(r,{className:g(`m-0 space-y-1 pl-5 marker:text-muted-foreground`,e.ordered?`list-decimal`:`list-disc`),...e.start===void 0?{}:{start:e.start},children:e.items.map((r,i)=>(0,U.jsx)(`li`,{className:`space-y-2 [overflow-wrap:anywhere]`,children:(0,U.jsx)(Gc,{blocks:r,query:t,trailing:i===e.items.length-1?n:void 0})},i))})}case`quote`:return(0,U.jsx)(`blockquote`,{className:`space-y-2 border-l-2 border-border pl-3 text-muted-foreground`,children:(0,U.jsx)(Gc,{blocks:e.blocks,query:t,trailing:n})});case`table`:return(0,U.jsx)(Xc,{block:e,query:t,trailing:n});case`rule`:return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`hr`,{className:`border-border`}),n]})}}var Jc={left:`text-left`,center:`text-center`,right:`text-right`},Yc=e=>e===void 0?`text-left`:Jc[e]??`text-left`;function Xc({block:e,query:t,trailing:n}){return(0,U.jsxs)(`div`,{className:`overflow-x-auto`,children:[(0,U.jsxs)(`table`,{className:`border-collapse text-sm tabular-nums`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsx)(`tr`,{children:e.header.map((n,r)=>(0,U.jsx)(`th`,{className:g(`border-b px-2 py-1 font-semibold`,Yc(e.align[r])),children:(0,U.jsx)(Zc,{inlines:n,query:t})},r))})}),(0,U.jsx)(`tbody`,{children:e.rows.map((n,r)=>(0,U.jsx)(`tr`,{children:n.map((n,r)=>(0,U.jsx)(`td`,{className:g(`border-b border-border/50 px-2 py-1`,Yc(e.align[r])),children:(0,U.jsx)(Zc,{inlines:n,query:t})},r))},r))})]}),n]})}function Zc({inlines:e,query:t}){return(0,U.jsx)(U.Fragment,{children:e.map((e,n)=>(0,U.jsx)(Qc,{inline:e,query:t},n))})}function Qc({inline:e,query:t}){switch(e.kind){case`text`:return(0,U.jsx)(Bo,{text:e.text,query:t});case`strong`:return(0,U.jsx)(`strong`,{className:`font-semibold`,children:(0,U.jsx)(Zc,{inlines:e.inlines,query:t})});case`em`:return(0,U.jsx)(`em`,{children:(0,U.jsx)(Zc,{inlines:e.inlines,query:t})});case`del`:return(0,U.jsx)(`del`,{className:`text-muted-foreground`,children:(0,U.jsx)(Zc,{inlines:e.inlines,query:t})});case`code`:return(0,U.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-[0.9em] [overflow-wrap:anywhere]`,children:(0,U.jsx)(Bo,{text:e.text,query:t})});case`link`:return(0,U.jsx)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer noopener`,className:`underline decoration-muted-foreground underline-offset-2 hover:decoration-foreground`,children:(0,U.jsx)(Zc,{inlines:e.inlines,query:t})});case`image`:return(0,U.jsx)($c,{src:e.src,alt:e.alt},e.src);case`break`:return(0,U.jsx)(`br`,{})}}function $c({src:e,alt:t}){let[n,r]=(0,H.useState)(!1);return n?(0,U.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Image unavailable`,t?`: ${t}`:``,`. Open the pull request on GitHub to view it.`]}):(0,U.jsx)(`img`,{src:e,alt:t,loading:`lazy`,decoding:`async`,referrerPolicy:`no-referrer`,onError:()=>r(!0),className:`my-2 max-h-[36rem] max-w-full rounded border object-contain`})}var el=(0,H.createContext)(void 0),tl=el.Provider;function nl(){return(0,H.useContext)(el)}function rl(e){let t=Math.max(0,e.activeSubagents),n=Math.max(0,e.activeBackgroundCalls),r=Math.max(0,e.activeWorkflows??0),i=[t>0?`${t} agent${t===1?``:`s`}`:void 0,n>0?`${n} background call${n===1?``:`s`}`:void 0,r>0?`${r} workflow${r===1?``:`s`}`:void 0].filter(e=>e!==void 0);if(i.length!==0)return`${i.length<3?i.join(` and `):`${i.slice(0,-1).join(`, `)} and ${i.at(-1)}`} running`}function il(e){let t=rl(e);return t===void 0?e.status:`${e.status}, ${t}`}function al(e,t){switch(e.status){case`running`:return{label:`started`,at:co(e.startedAt,t)};case`complete`:return{label:`finished`,at:co(e.endedAt??e.startedAt,t)};case`aborted`:return{label:`stopped`,at:co(e.endedAt??e.startedAt,t)};case`error`:return{label:`failed`,at:co(e.endedAt??e.startedAt,t)}}}function ol(e=3e4){let[t,n]=(0,H.useState)(()=>Date.now());return(0,H.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function sl({input:e,query:t}){let n=lo(e);return n?(0,U.jsxs)(`div`,{className:`overflow-hidden rounded-md border bg-muted`,children:[n.path===void 0?null:(0,U.jsx)(cl,{path:n.path}),(0,U.jsxs)(`div`,{className:`overflow-x-auto`,children:[n.removed.map((e,n)=>(0,U.jsx)(ll,{sign:`-`,line:e,query:t,kind:`removed`},`-${n}`)),n.added.map((e,n)=>(0,U.jsx)(ll,{sign:`+`,line:e,query:t,kind:`added`},`+${n}`))]})]}):null}function cl({path:e}){let t=e.lastIndexOf(`/`);return(0,U.jsxs)(`p`,{className:`m-0 truncate border-b px-2 py-1 font-mono text-xs`,children:[(0,U.jsx)(`span`,{className:`text-muted-foreground/70`,children:t<0?``:`${e.slice(0,t)}/`}),(0,U.jsx)(`span`,{className:`text-foreground`,children:t<0?e:e.slice(t+1)})]})}function ll({sign:e,line:t,query:n,kind:r}){return(0,U.jsxs)(`div`,{className:g(`grid grid-cols-[1.25rem_minmax(0,1fr)] font-mono text-xs whitespace-pre`,Vo(r)),children:[(0,U.jsx)(`span`,{className:`pl-2 select-none`,"aria-hidden":!0,children:e}),(0,U.jsx)(`span`,{children:(0,U.jsx)(Bo,{text:t,query:n})})]})}function ul({entry:e,query:t}){let n=lo(e.input)!==void 0;return(0,U.jsxs)(U.Fragment,{children:[n?null:(0,U.jsx)(fl,{label:`input`,value:e.input,query:t}),(0,U.jsx)(fl,{label:`update`,value:e.update,query:t}),(0,U.jsx)(fl,{label:`result`,value:e.result,query:t})]})}var dl=2e4;function fl({label:e,value:t,query:n}){if(t==null||t===``)return null;let r=typeof t==`string`?t:ml(t);if(r===``)return null;let i=e!==`input`&&r.length<=dl?pl(t):void 0;return(0,U.jsxs)(`div`,{className:`mt-1.5 first:mt-0`,children:[(0,U.jsx)(`p`,{className:`m-0 mb-1 text-xs text-muted-foreground`,children:e}),i?i.map(e=>(0,U.jsx)(fl,{label:e.label,value:e.text,query:n},e.label)):(0,U.jsx)(`pre`,{className:`m-0 max-h-72 overflow-auto rounded-md border bg-muted p-2 font-mono text-xs whitespace-pre-wrap text-foreground [overflow-wrap:anywhere]`,children:r.length>dl?r:(0,U.jsx)(Ho,{text:r,query:n})})]})}function pl(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e,n=t.content;if(!Array.isArray(n))return;let r=e=>{if(!e||typeof e!=`object`)return;let t=e;return t.type===`text`&&typeof t.text==`string`&&uo(t.text)?t.text:void 0};if(!n.some(e=>r(e)!==void 0))return;let i=n.flatMap((e,t)=>{let n=r(e),i=`content ${t+1}`;if(n===void 0)return[{label:i,text:ml(e)}];let{type:a,text:o,...s}=e,c=[{label:`${i} (text)`,text:n}];return Object.keys(s).length>0&&c.push({label:`${i} metadata`,text:ml(s)}),c}),{content:a,...o}=t;return Object.keys(o).length>0&&i.push({label:`metadata`,text:ml(o)}),i}function ml(e){try{return JSON.stringify(e,null,2)??``}catch{return String(e)}}function hl(e,t){let n=new Date(e),r=n.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});return n.getFullYear()===t.getFullYear()&&n.getMonth()===t.getMonth()&&n.getDate()===t.getDate()?r:`${n.toLocaleDateString(void 0,{day:`numeric`,month:`short`,...n.getFullYear()===t.getFullYear()?{}:{year:`numeric`}})}, ${r}`}var gl=(0,H.createContext)({}),_l=gl.Provider;function vl(){return(0,H.useContext)(gl).openSession}function yl({userMessageId:e}){let{rewind:t,fork:n}=(0,H.useContext)(gl);return(0,U.jsxs)(U.Fragment,{children:[t?(0,U.jsxs)(bl,{icon:(0,U.jsx)(Ln,{"aria-hidden":!0}),label:t.blocked??`Rewind to before this message`,disabled:t.blocked!==void 0,children:[(0,U.jsx)(eo,{onClick:()=>t.run(e,`conversation`),children:`Conversation`}),t.files?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(eo,{onClick:()=>t.run(e,`files`),children:`Code`}),(0,U.jsx)(eo,{onClick:()=>t.run(e,`both`),children:`Both`})]}):null]}):null,n?(0,U.jsxs)(bl,{icon:(0,U.jsx)(On,{"aria-hidden":!0}),label:`Fork from before this message`,children:[(0,U.jsx)(eo,{onClick:()=>n.run(e,!1),children:`Same Scope`}),n.worktree?(0,U.jsx)(eo,{onClick:()=>n.run(e,!0),children:`New Worktree`}):null]}):null]})}function bl({icon:e,label:t,disabled:n=!1,children:r}){return(0,U.jsxs)(Za,{children:[(0,U.jsxs)(da,{children:[(0,U.jsx)(fa,{render:(0,U.jsx)(Qa,{disabled:n,render:(0,U.jsx)(O,{variant:`ghost`,size:`icon-xs`,"aria-label":t,children:e})})}),(0,U.jsx)(pa,{children:t})]}),(0,U.jsx)($a,{className:`min-w-40`,children:r})]})}var xl=(0,H.memo)(function(e){return e.entry.rewound?(0,U.jsx)(`div`,{className:`opacity-50`,children:Sl(e)}):Sl(e)});function Sl({entry:e,query:t,sessionId:n,background:r}){switch(e.kind){case`user`:return(0,U.jsx)(Cl,{entry:e,query:t,sessionId:n});case`assistant`:return(0,U.jsx)(Tl,{entry:e,query:t});case`thinking`:return(0,U.jsx)(Ol,{entry:e,query:t});case`tool`:return(0,U.jsx)(kl,{entry:e,query:t,background:r});case`subagent`:return(0,U.jsx)(Ml,{entry:e,query:t});case`background_call`:return(0,U.jsx)(Pl,{entry:e});case`enquiry`:return(0,U.jsx)(Al,{entry:e,query:t});case`notice`:return(0,U.jsx)(zl,{entry:e,query:t});case`marker`:return(0,U.jsx)(Vl,{entry:e});default:return null}}function Cl({entry:e,query:t,sessionId:n}){let r=(0,H.useMemo)(()=>Dc(e.text),[e.text]);return(0,U.jsxs)(`div`,{className:`group/message relative flex flex-col items-end py-3 before:absolute before:inset-y-0 before:-right-[100vw] before:-left-[100vw] before:content-['']`,children:[(0,U.jsxs)(`div`,{className:g(`relative min-w-0 max-w-[90%] rounded-2xl rounded-br-sm px-4 py-3 sm:max-w-[80%]`,e.fromSessionId===void 0&&e.producer===void 0?`bg-muted`:`border border-border bg-muted/40 text-muted-foreground`),children:[e.fromSessionId===void 0?null:(0,U.jsxs)(`p`,{className:`m-0 mb-2 text-xs text-muted-foreground`,children:[`From `,(0,U.jsx)(Rl,{sessionId:e.fromSessionId,query:t}),` · not human authorization`]}),e.producer===void 0?null:(0,U.jsx)(`p`,{className:`m-0 mb-2 text-xs text-muted-foreground`,children:`From the parent agent · not human authorization`}),e.attachments?.length?(0,U.jsx)(wl,{ids:e.attachments,sessionId:n}):null,(0,U.jsx)(Wc,{blocks:r,query:t})]}),e.at?(0,U.jsx)(El,{at:e.at,side:`right`,children:e.rewound||e.producer?null:(0,U.jsx)(`span`,{className:`inline-flex [@media(hover:hover)]:opacity-0 [@media(hover:hover)]:group-hover/message:opacity-100 focus-within:opacity-100 has-[[aria-expanded=true]]:opacity-100`,children:(0,U.jsx)(yl,{userMessageId:e.id})})}):null]})}function wl({ids:e,sessionId:t}){return(0,U.jsx)(`div`,{className:`mb-2 flex flex-wrap gap-2`,children:e.map(e=>(0,U.jsx)(To,{src:`/api/sessions/${encodeURIComponent(t)}/attachments/${encodeURIComponent(e)}`,alt:``,className:`max-h-64 max-w-full rounded-md border border-border`},e))})}function Tl({entry:e,query:t}){let n=(0,H.useMemo)(()=>Dc(e.text),[e.text]);return(0,U.jsxs)(`div`,{className:`relative`,children:[(0,U.jsx)(Hl,{children:(0,U.jsx)(Wc,{blocks:n,query:t,trailing:e.final?void 0:(0,U.jsx)(Dl,{})})}),e.endedAt?(0,U.jsx)(El,{at:e.endedAt,side:`left`}):null]})}function El({at:e,side:t,children:n}){return(0,U.jsxs)(`div`,{className:g(`relative mt-1 flex items-center gap-1 text-xs whitespace-nowrap text-muted-foreground/70`,t===`right`&&`flex-row-reverse @min-[68rem]/transcript:flex-row`,`@min-[68rem]/transcript:absolute @min-[68rem]/transcript:mt-0 @min-[68rem]/transcript:leading-[1.375rem]`,t===`right`?`text-right @min-[68rem]/transcript:bottom-6 @min-[68rem]/transcript:left-full @min-[68rem]/transcript:ml-4`:`@min-[68rem]/transcript:right-full @min-[68rem]/transcript:bottom-1 @min-[68rem]/transcript:mr-4`),children:[(0,U.jsx)(`time`,{dateTime:e,title:new Date(e).toLocaleString(),children:hl(e,new Date)}),n]})}function Dl(){return(0,U.jsx)(`span`,{className:`animate-caret-blink ml-px inline-block w-[1ch] text-primary`,"aria-hidden":!0,children:`▍`})}function Ol({entry:e,query:t}){let[n,r]=(0,H.useState)(!1),[i,a]=(0,H.useState)(!1),o=(0,H.useRef)(null),s=(0,H.useMemo)(()=>Dc(e.text),[e.text]),c=e.final&&!n,l=e.text.trim()===``;return(0,H.useLayoutEffect)(()=>{let e=o.current;if(!e||!c)return;let t=new ResizeObserver(()=>a(e.scrollHeight>e.clientHeight+1));return t.observe(e),()=>t.disconnect()},[c,l]),l?null:(0,U.jsxs)(Hl,{children:[(0,U.jsx)(`div`,{ref:o,className:g(`text-muted-foreground italic`,c&&`max-h-[4.5rem] overflow-hidden`),children:(0,U.jsx)(Wc,{blocks:s,query:t,trailing:e.final?void 0:(0,U.jsx)(Dl,{})})}),e.final&&(n||i)?(0,U.jsx)(`button`,{type:`button`,onClick:()=>r(!n),className:`mt-0.5 text-xs text-muted-foreground hover:text-foreground`,children:n?`less`:`more`}):null]})}function kl({entry:e,query:t,background:n}){let[r,i]=(0,H.useState)(void 0),a=r??e.status===`error`,o=Fi(e.input),s=Po(e.authorisation),c=vo(e);return(0,U.jsxs)(`details`,{open:a,onToggle:e=>i(e.currentTarget.open),className:`group/tool text-foreground`,children:[(0,U.jsxs)(`summary`,{className:`flex cursor-default items-center gap-2 rounded-md px-1.5 py-1 select-none hover:bg-muted/50 cursor-tilt relative [--tilt-angle-x:10deg] [--tilt-angle-y:1.5deg] [--tilt-lift:1.005]`,children:[(0,U.jsx)(bo,{name:e.name,className:e.status===`error`||n?.status===`error`?`text-destructive`:`text-muted-foreground`}),(0,U.jsx)(`span`,{className:`min-w-0 shrink-0 text-sm text-muted-foreground [overflow-wrap:anywhere]`,children:(0,U.jsx)(Ao,{name:e.name})}),o===void 0?null:(0,U.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground/80`,children:o}),s?(0,U.jsx)(`span`,{className:g(`ml-auto shrink-0 text-xs`,e.authorisation===`denied`?`text-destructive`:e.authorisation===`asked`?`text-status-awaiting`:`text-muted-foreground`),children:s}):e.status===`running`?(0,U.jsx)(jn,{"aria-label":`running`,className:`ml-auto size-3.5 shrink-0 animate-spin text-muted-foreground motion-reduce:animate-none`}):n?(0,U.jsx)(Fl,{entry:n}):c?(0,U.jsx)(`span`,{className:g(`ml-auto shrink-0 font-mono text-xs`,e.status===`error`?`text-destructive`:`text-muted-foreground`),children:c}):null]}),(0,U.jsxs)(`div`,{className:`my-1 ml-6 rounded-lg border p-3`,children:[(0,U.jsx)(sl,{input:e.input,query:t}),(0,U.jsx)(ul,{entry:e,query:t})]})]})}function Al({entry:e,query:t}){return(0,U.jsx)(`div`,{className:`text-foreground`,children:e.questions.map((n,r)=>(0,U.jsx)(jl,{entry:e,index:r,query:t},n.question))})}function jl({entry:e,index:t,query:n}){let r=e.questions[t],i=e.answers?.[t]??[],a=r.options.filter(e=>!i.includes(e.label)).map(e=>e.label);return(0,U.jsxs)(`details`,{className:`group/question`,children:[(0,U.jsxs)(`summary`,{className:`flex cursor-default items-center gap-2 rounded-md px-1.5 py-1 text-sm select-none hover:bg-muted/50 cursor-tilt relative [--tilt-angle-x:10deg] [--tilt-angle-y:1.5deg] [--tilt-lift:1.005]`,children:[(0,U.jsx)(Mn,{"aria-hidden":!0,className:g(`size-3.5 shrink-0 text-muted-foreground`,t>0&&`invisible`)}),(0,U.jsxs)(`span`,{className:`min-w-0 truncate`,children:[(0,U.jsxs)(`span`,{className:`text-muted-foreground`,children:[r.header,` `]}),i.length===0?(0,U.jsx)(`span`,{className:`text-muted-foreground italic`,children:e.status===`asked`?`waiting…`:`no answer`}):(0,U.jsx)(Bo,{text:i.join(`, `),query:n})]}),(0,U.jsx)(Cn,{"aria-hidden":!0,className:`ml-auto size-3.5 shrink-0 text-muted-foreground transition-transform group-open/question:rotate-90`})]}),(0,U.jsxs)(`div`,{className:`mt-0.5 mb-1.5 ml-7 space-y-1 text-xs text-muted-foreground [overflow-wrap:anywhere]`,children:[(0,U.jsx)(`p`,{children:(0,U.jsx)(Bo,{text:r.question,query:n})}),a.length===0?null:(0,U.jsxs)(`p`,{className:`text-muted-foreground/70`,children:[i.length===0?`Options: `:`Other options: `,(0,U.jsx)(Bo,{text:a.join(` · `),query:n})]})]})]})}function Ml({entry:e,query:t}){let n=e.waitingOn?`waiting on ${e.waitingOn}`:e.status,r=e.status===`running`||e.status===`waiting`,i=nl(),a=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(xn,{"aria-hidden":!0,className:g(`size-3.5 shrink-0`,Nl(e.status)===`error`?`text-destructive`:`text-muted-foreground`)}),(0,U.jsx)(`span`,{className:`min-w-0 text-sm text-muted-foreground [overflow-wrap:anywhere] max-sm:col-start-2 max-sm:row-start-1 max-sm:truncate`,children:e.name}),e.description===void 0?null:(0,U.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground/80 max-sm:col-start-2 max-sm:col-end-4 max-sm:row-start-2`,children:(0,U.jsx)(Bo,{text:e.description,query:t})}),(0,U.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground max-sm:col-start-3 max-sm:row-start-1`,children:[r?(0,U.jsx)(jn,{"aria-hidden":!0,className:`size-3.5 animate-spin motion-reduce:animate-none`}):null,n]})]}),o=`flex w-full items-center gap-2 rounded-md px-1.5 py-1 text-foreground max-sm:grid max-sm:grid-cols-[14px_minmax(0,1fr)_auto] max-sm:gap-y-1`;return i===void 0?(0,U.jsx)(`div`,{className:o,children:a}):(0,U.jsx)(`button`,{type:`button`,onClick:()=>i(vn(e)),className:g(o,`text-left hover:bg-muted/50 cursor-tilt relative [--tilt-angle-x:10deg] [--tilt-angle-y:1.5deg] [--tilt-lift:1.005]`),children:a})}function Nl(e){return e===`error`?`error`:e===`running`?`running`:`complete`}function Pl({entry:e}){let t=al(e,ol());return(0,U.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md px-1.5 py-1 text-foreground`,children:[(0,U.jsx)(bo,{name:e.tool,className:Il(e.status)===`error`?`text-destructive`:`text-muted-foreground`}),(0,U.jsx)(`span`,{className:`min-w-0 text-sm text-muted-foreground [overflow-wrap:anywhere]`,children:e.tool}),(0,U.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground/70`,children:`in background`}),(0,U.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[e.status===`running`?(0,U.jsx)(jn,{"aria-hidden":!0,className:`size-3.5 animate-spin motion-reduce:animate-none`}):null,t.label,` `,t.at]})]})}function Fl({entry:e}){let t=al(e,ol());return(0,U.jsxs)(`span`,{className:g(`ml-auto flex shrink-0 items-center gap-1.5 text-xs`,e.status===`error`?`text-destructive`:`text-muted-foreground`),children:[e.status===`running`?(0,U.jsx)(jn,{"aria-hidden":!0,className:`size-3.5 animate-spin motion-reduce:animate-none`}):null,(0,U.jsx)(`span`,{className:`sr-only`,children:`in background,`}),t.label,` `,t.at]})}function Il(e){return e===`error`?`error`:e===`running`?`running`:`complete`}var Ll={info:`text-muted-foreground`,warn:`text-foreground`,error:`text-destructive`};function Rl({sessionId:e,query:t}){let{sessions:n}=xi(),r=n.find(t=>t.id===e);return r?(0,U.jsx)(`a`,{href:Oi({sessionId:r.id}),className:`rounded-sm font-sans font-medium text-foreground outline-none transition-[text-shadow] duration-150 hover:[text-shadow:0_0_8px_color-mix(in_srgb,currentColor_60%,transparent)] focus-visible:ring-3 focus-visible:ring-ring/30`,children:(0,U.jsx)(Bo,{text:ji(r),query:t})}):(0,U.jsx)(`span`,{className:`text-foreground`,children:(0,U.jsx)(Bo,{text:e,query:t})})}function zl({entry:e,query:t}){let n=Ll[e.level],r=e.sessionId===void 0?-1:e.text.indexOf(e.sessionId);return(0,U.jsx)(Hl,{gutter:`!`,gutterClassName:n,children:(0,U.jsx)(`p`,{className:g(`m-0 font-mono text-sm whitespace-pre-wrap [overflow-wrap:anywhere]`,n),children:r===-1||e.sessionId===void 0?(0,U.jsx)(Bo,{text:e.text,query:t}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Bo,{text:e.text.slice(0,r),query:t}),(0,U.jsx)(Rl,{sessionId:e.sessionId,query:t}),(0,U.jsx)(Bo,{text:e.text.slice(r+e.sessionId.length),query:t})]})})})}var Bl={revived:`text-primary`,settled:`text-muted-foreground`,dormant:`text-muted-foreground`,compacted:`text-muted-foreground`,rewound:`text-muted-foreground`,forked:`text-muted-foreground`};function Vl({entry:e}){let t=Bl[e.marker],n=vl();return(0,U.jsxs)(`div`,{className:g(`flex items-center gap-2 py-2`,t),role:`separator`,"aria-label":e.text,children:[(0,U.jsx)(`span`,{className:`h-px flex-1 bg-current opacity-50`,"aria-hidden":!0}),e.fromSessionId&&n?(0,U.jsx)(O,{variant:`link`,size:`xs`,className:`h-auto p-0 text-xs text-current`,onClick:()=>n(e.fromSessionId),children:`Forked from another Agent Session`}):(0,U.jsx)(`span`,{className:`text-xs`,children:e.text}),(0,U.jsx)(`span`,{className:`h-px flex-1 bg-current opacity-50`,"aria-hidden":!0})]})}function Hl({gutter:e,gutterClassName:t,children:n}){return(0,U.jsxs)(`div`,{className:g(`py-1`,e&&`grid grid-cols-[2ch_minmax(0,1fr)] gap-0`),children:[e?(0,U.jsx)(`span`,{"aria-hidden":!0,className:g(`font-mono text-sm select-none`,t),children:e}):null,n]})}function Ul(e,t=40){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function Wl(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Gl(e,t=`|`){return e.map(e=>vu(e)).join(t)}function Kl(e,t){return typeof t==`bigint`?t.toString():t}var ql=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function Jl(e){return new ql(e)}function Yl(e){return e==null}function Xl(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Zl(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var Ql=Symbol(`evaluating`);function $l(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Ql)return r===void 0&&(r=Ql,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function eu(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function tu(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function nu(e){return tu(e._zod.def)??e._zod.def.shape}function ru(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return eu(this,t,e),e},enumerable:!0,configurable:!0})}function iu(e,t,n){t in e?eu(e,t,n):e[t]=n}function au(e,t,n,r){let i=nu(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?ru(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):iu(e,a,r?r(n.value,a):n.value))}}function ou(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?ru(e,n,()=>t[n]):iu(e,n,r.value))}}function su(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function cu(e){return JSON.stringify(e)}function lu(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var uu=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function du(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var fu=Jl(()=>{if(od.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function pu(e){if(du(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return du(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function mu(e){return pu(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var hu=new Set([`string`,`number`,`symbol`]);function gu(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function _u(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function G(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function vu(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function yu(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var bu={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},xu={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function Su(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return au(i,e,Cu(e,t)),_u(e,su(n,{shape:i,checks:[]}))}function Cu(e,t){let n=nu(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function wu(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(Cu(e,t)),a={};return au(a,e,Reflect.ownKeys(nu(e)).filter(e=>!i.has(e))),_u(e,su(n,{shape:a,checks:[]}))}function Tu(e,t){if(!pu(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=nu(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return _u(e,su(e._zod.def,{shape:Eu(e,t)}))}function Eu(e,t){let n={};return au(n,e,Reflect.ownKeys(nu(e))),ou(n,t),n}function Du(e,t){if(!pu(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return _u(e,su(e._zod.def,{shape:Eu(e,t)}))}function Ou(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return au(n,e,Reflect.ownKeys(nu(e))),au(n,t,Reflect.ownKeys(nu(t))),_u(e,su(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function ku(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Cu(t,n)):void 0,o={};return au(o,t,Reflect.ownKeys(nu(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),_u(t,su(t._zod.def,{shape:o,checks:[]}))}function Au(e,t,n){let r=n?new Set(Cu(t,n)):void 0,i={};return au(i,t,Reflect.ownKeys(nu(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),_u(t,su(t._zod.def,{shape:i}))}function ju(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Mu(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Nu(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Pu(e){return typeof e==`string`?e:e?.message}function Fu(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function Iu(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:Pu(e.inst?._zod.def?.error?.(e))??Pu(a?.(e))??Pu(t?.error?.(e))??Pu(n.customError?.(e))??Pu(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var Lu=/[\uD800-\uDBFF]/;function Ru(e){let t=e.length;if(!Lu.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function zu(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Bu(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Vu(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Hu(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Ku(e,n,r.value)}}function Uu(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Wu(e,t,n){return Uu(e,t,n,!1)}function Gu(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Uu(this,n,r(this))},set(e){Uu(this,n,e)}})}return t}function Ku(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Uu(this,t,n.bind(this))},set(e){Uu(this,t,e)}})}function qu(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Ju,Yu=!1,Xu={configurable:!0,get(){Yu=!0}};function K(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Ju!==e._zod){Ju=void 0;return}Ju=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Xu);let e=Yu;Yu=!1;try{let r=n(this);return Yu?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Yu||=e,r}catch(n){throw delete this[t],Yu||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function Zu(e,t,n,r){let i=qu(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var Qu=`~constantCatch`;function $u(e){let t=()=>e;return t[Qu]=!0,t}var ed,td={value:void 0,enumerable:!1},nd=`captureStackTrace`in Error?Error:null;function rd(e){let t=nd;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return nd=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function q(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){td.value=new a(r);try{Object.defineProperty(n,"_zod",td)}finally{td.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Hu(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?rd(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var id=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ad=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(ed=globalThis).__zod_globalConfig??(ed.__zod_globalConfig={});var od=globalThis.__zod_globalConfig;function sd(e){return e&&Object.assign(od,e),od}function cd(){let e=this._zod;return e.message??=JSON.stringify(e.def,Kl,2),e.message}function ld(e){this._zod.message=e}var ud={get:cd,set:ld,enumerable:!0,configurable:!0},dd={value:void 0,enumerable:!1},fd=new WeakSet([Object.prototype,Error.prototype]),pd=(e,t)=>{e.name=`$ZodError`,dd.value=t,Object.defineProperty(e,"issues",dd),dd.value=void 0,Object.defineProperty(e,"message",ud);let n=Object.getPrototypeOf(e);fd.has(n)||(fd.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},md=q(`$ZodError`,pd);q(`$ZodError`,pd,void 0,{Parent:Error});function hd(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function gd(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?hd(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function _d(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function vd(e,t){return{callee:t?.callee??e,Err:t?.Err}}var yd=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new id;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Iu(e,o,sd())));throw uu(n,a?.callee??t),n}return s.value};return t},bd=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Iu(e,o,sd())));throw uu(n,a?.callee??t),n}return s.value};return t},xd=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new id;return a.issues.length?Sd(e,a.issues,i):{success:!0,data:a.value}};function Sd(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>Iu(e,n,sd()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var Cd=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?Sd(e,a.issues,i):{success:!0,data:a.value}},wd=Symbol.for(`zod.compile.invalid`),Td=Symbol.for(`zod.compile.fallback`),Ed=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==wd)return!0;if(r.definite===!0&&n===void 0)return!1}return Dd(e,t,n)});function Dd(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[Td]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new id;return a.issues.length===0}var Od=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},kd=e=>{let t=yd(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,vd(n,a))};return n},Ad=e=>{let t=yd(e),n=(e,r,i,a)=>t(e,r,i,vd(n,a));return n},jd=e=>{let t=bd(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,vd(n,a))};return n},Md=e=>{let t=bd(e),n=async(e,r,i,a)=>await t(e,r,i,vd(n,a));return n},Nd=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return xd(e)(t,n,i)},Pd=e=>(t,n,r)=>xd(e)(t,n,r),Fd=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Cd(e)(t,n,i)},Id=e=>async(t,n,r)=>Cd(e)(t,n,r),Ld=/^[cC][0-9a-z]{6,}$/,Rd=/^[0-9a-z]+$/,zd=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Bd=/^[0-9a-vA-V]{20}$/,Vd=/^[A-Za-z0-9]{27}$/,Hd=/^[a-zA-Z0-9_-]{21}$/;function Ud(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Wd=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Gd=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Kd=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,qd=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Jd=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function Yd(){return new RegExp(Jd,`u`)}var Xd=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Zd=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Qd=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,$d=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ef=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,tf=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,nf=/^https?$/,rf=/^\+[1-9]\d{6,14}$/,af=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function of(e){return RegExp(`^${e}$`)}var sf=of(af);function cf(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function lf(e){return RegExp(`^${cf(e)}$`)}function uf(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${cf({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${cf({precision:e.precision})}`:n;return RegExp(`^${af}T(?:${r})$`)}var df=/^[\s\S]{0,}$/,ff=/^-?\d+$/,pf=/^-?\d+(?:\.\d+)?$/,mf=/^(?:true|false)$/i,hf=/^null$/i,gf=/^[^A-Z]*$/,_f=/^[^a-z]*$/,vf=q(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),yf=e=>{let t=e.value;return!Yl(t)&&t.length!==void 0},bf={number:`number`,bigint:`bigint`,object:`date`},xf=q(`$ZodCheckLessThan`,(e,t)=>{vf.init(e,t);let n=bf[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:bf[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Sf=q(`$ZodCheckGreaterThan`,(e,t)=>{vf.init(e,t);let n=bf[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:bf[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Cf=q(`$ZodCheckMultipleOf`,(e,t)=>{vf.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):Zl(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),wf=q(`$ZodCheckNumberFormat`,(e,t)=>{vf.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=bu[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Tf=q(`$ZodCheckMaxLength`,(e,t)=>{var n;vf.init(e,t),(n=e._zod.def).when??(n.when=yf),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Ru(r):i)<=t.maximum)return;let a=zu(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ef=q(`$ZodCheckMinLength`,(e,t)=>{var n;vf.init(e,t),(n=e._zod.def).when??(n.when=yf),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Ru(r):i)>=t.minimum)return;let a=zu(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Df=q(`$ZodCheckLengthEquals`,(e,t)=>{var n;vf.init(e,t),(n=e._zod.def).when??(n.when=yf),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Ru(r):i;if(a===t.length)return;let o=zu(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Of=q(`$ZodCheckStringFormat`,(e,t)=>{var n,r;vf.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),kf=q(`$ZodCheckRegex`,(e,t)=>{Of.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Af=q(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=gf,Of.init(e,t)}),jf=q(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=_f,Of.init(e,t)}),Mf=q(`$ZodCheckIncludes`,(e,t)=>{vf.init(e,t);let n=gu(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Nf=q(`$ZodCheckStartsWith`,(e,t)=>{vf.init(e,t);let n=RegExp(`^${gu(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Pf=q(`$ZodCheckEndsWith`,(e,t)=>{vf.init(e,t);let n=RegExp(`.*${gu(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Ff=q(`$ZodCheckOverwrite`,(e,t)=>{vf.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),If=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
77
|
+
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+lc(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Tc(e,t){return wc.parse(e,t)}Tc.options=Tc.setOptions=function(e){return wc.setOptions(e),Tc.defaults=wc.defaults,Go(Tc.defaults),Tc},Tc.getDefaults=Uo,Tc.defaults=Wo;function Ec(...e){return wc.use(...e),Tc.defaults=wc.defaults,Go(Tc.defaults),Tc}Tc.use=Ec,Tc.walkTokens=function(e,t){return wc.walkTokens(e,t)},Tc.parseInline=wc.parseInline,Tc.Parser=Sc,Tc.parser=Sc.parse,Tc.Renderer=bc,Tc.TextRenderer=xc,Tc.Lexer=yc,Tc.lexer=yc.lex,Tc.Tokenizer=vc,Tc.Hooks=Cc,Tc.parse=Tc,Tc.options,Tc.setOptions,Tc.walkTokens,Tc.parseInline,Sc.parse,yc.lex;function Dc(e,t={}){if(e===``)return[];try{return jc(Tc.lexer(e),t)}catch{return[{kind:`paragraph`,inlines:[{kind:`text`,text:e}]}]}}var Oc=new Set([`http:`,`https:`,`mailto:`]);function kc(e){try{return Oc.has(new URL(e).protocol)?e:void 0}catch{return}}var Ac=[1,2,3,4,5,6];function jc(e,t){return e.flatMap(e=>Mc(e,t))}function Mc(e,t){switch(e.type){case`space`:return[];case`heading`:return[{kind:`heading`,level:Ac[e.depth-1]??6,inlines:Ic(e.tokens,t)??[]}];case`paragraph`:return[{kind:`paragraph`,inlines:Ic(e.tokens,t)??[]}];case`text`:return[{kind:`paragraph`,inlines:Ic(e.tokens,t)??Uc(e)}];case`code`:return[{kind:`code`,text:e.text,...e.lang?{lang:e.lang}:{}}];case`blockquote`:return[{kind:`quote`,blocks:jc(e.tokens??[],t)}];case`hr`:return[{kind:`rule`}];case`list`:return[Nc(e,t)];case`table`:return[Fc(e,t)];case`html`:return[{kind:`paragraph`,inlines:Vc(e.raw,t)}];default:return[{kind:`paragraph`,inlines:Uc(e)}]}}function Nc(e,t){let n=e.ordered&&typeof e.start==`number`&&e.start!==1?e.start:void 0;return{kind:`list`,ordered:e.ordered,items:e.items.map(e=>Pc(e,t)),...n===void 0?{}:{start:n}}}function Pc(e,t){let n=jc(e.tokens.filter(e=>e.type!==`checkbox`),t);if(!e.task)return n;let r={kind:`text`,text:e.checked?`[x] `:`[ ] `},[i,...a]=n;return i?.kind===`paragraph`?[{kind:`paragraph`,inlines:[r,...i.inlines]},...a]:[{kind:`paragraph`,inlines:[r]},...n]}function Fc(e,t){let n=e=>e.map(e=>Ic(e.tokens,t)??[]);return{kind:`table`,header:n(e.header),rows:e.rows.map(n),align:e.align.map(e=>e??void 0)}}function Ic(e,t){return e?.flatMap(e=>Lc(e,t))}function Lc(e,t){switch(e.type){case`text`:return Ic(e.tokens,t)??[{kind:`text`,text:e.text}];case`escape`:return[{kind:`text`,text:e.text}];case`strong`:case`em`:case`del`:return[{kind:e.type,inlines:Ic(e.tokens,t)??[]}];case`codespan`:return[{kind:`code`,text:e.text}];case`br`:return[{kind:`break`}];case`link`:return[Rc(e,t)];case`image`:return[Bc(e.href,e.text,e.raw,t)];case`html`:return Vc(e.text,t);default:return Uc(e)}}function Rc(e,t){let n=zc(e.href,t.linkBase);return n===void 0?{kind:`text`,text:e.raw}:{kind:`link`,href:n,inlines:Ic(e.tokens,t)??[{kind:`text`,text:e.text}]}}function zc(e,t){if(!t)return kc(e);try{return kc(new URL(e,t).href)}catch{return}}function Bc(e,t,n,r){let i=r.images&&e.trim()?zc(e,r.imageBase):void 0;if(!i||!/^https?:\/\//i.test(i))return{kind:`text`,text:n};let a=new URL(i),o=/^\/([^/]+)\/([^/]+)\/(?:blob|raw)\/(.+)$/.exec(a.pathname);a.hostname===`github.com`&&o&&(a.hostname=`raw.githubusercontent.com`,a.pathname=`/${o[1]}/${o[2]}/${o[3]}`);let s=a.hostname===`raw.githubusercontent.com`||a.hostname===`github.com`&&a.pathname.startsWith(`/user-attachments/assets/`);return{kind:`image`,src:r.imageProxy&&s?`${r.imageProxy}${encodeURIComponent(a.href)}`:a.href,alt:t}}function Vc(e,t){let n=e.match(/<img\b(?:[^"'<>]|"[^"]*"|'[^']*')*\/?>/gi);return!t.images||!n||n.join(``).replace(/\s/g,``)!==e.replace(/\s/g,``)?[{kind:`text`,text:e}]:n.map(e=>{let n=new Map;for(let t of e.slice(4,-1).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g)){let e=t[1].toLowerCase();n.has(e)||n.set(e,Hc(t[2]??t[3]??t[4]??``))}return Bc(n.get(`src`)??``,n.get(`alt`)??`Screenshot`,e,t)})}function Hc(e){let t={amp:`&`,quot:`"`,apos:`'`,lt:`<`,gt:`>`};return e.replace(/&(#x[0-9a-f]+|#\d+|amp|quot|apos|lt|gt);/gi,(e,n)=>{if(!n.startsWith(`#`))return t[n.toLowerCase()]??e;let r=n[1]?.toLowerCase()===`x`?parseInt(n.slice(2),16):parseInt(n.slice(1),10);return r>0&&r<=1114111?String.fromCodePoint(r):e})}function Uc(e){return[{kind:`text`,text:e.raw}]}function Wc({blocks:e,query:t,trailing:n}){return(0,U.jsx)(`div`,{className:`space-y-3 text-sm leading-relaxed`,children:(0,U.jsx)(Gc,{blocks:e,query:t,trailing:n})})}function Gc({blocks:e,query:t,trailing:n}){return(0,U.jsx)(U.Fragment,{children:e.map((r,i)=>(0,U.jsx)(qc,{block:r,query:t,trailing:i===e.length-1?n:void 0},i))})}var Kc={1:`text-lg`,2:`text-base`};function qc({block:e,query:t,trailing:n}){switch(e.kind){case`paragraph`:return(0,U.jsxs)(`p`,{className:`m-0 [overflow-wrap:anywhere]`,children:[(0,U.jsx)(Zc,{inlines:e.inlines,query:t}),n]});case`heading`:{let r=`h${e.level}`;return(0,U.jsxs)(r,{className:g(Kc[e.level]??`text-sm`,`m-0 pt-1 font-heading font-semibold tracking-tight [overflow-wrap:anywhere]`),children:[(0,U.jsx)(Zc,{inlines:e.inlines,query:t}),n]})}case`code`:return(0,U.jsxs)(`div`,{className:`overflow-hidden rounded-lg border bg-muted`,children:[e.lang===void 0?null:(0,U.jsx)(`div`,{className:`border-b px-3 py-1 font-mono text-xs text-muted-foreground`,children:e.lang}),(0,U.jsx)(`pre`,{className:`overflow-x-auto p-3`,children:(0,U.jsx)(`code`,{className:`font-mono text-sm`,children:(0,U.jsx)(Ho,{text:e.text,lang:e.lang,query:t,trailing:n})})})]});case`list`:{let r=e.ordered?`ol`:`ul`;return(0,U.jsx)(r,{className:g(`m-0 space-y-1 pl-5 marker:text-muted-foreground`,e.ordered?`list-decimal`:`list-disc`),...e.start===void 0?{}:{start:e.start},children:e.items.map((r,i)=>(0,U.jsx)(`li`,{className:`space-y-2 [overflow-wrap:anywhere]`,children:(0,U.jsx)(Gc,{blocks:r,query:t,trailing:i===e.items.length-1?n:void 0})},i))})}case`quote`:return(0,U.jsx)(`blockquote`,{className:`space-y-2 border-l-2 border-border pl-3 text-muted-foreground`,children:(0,U.jsx)(Gc,{blocks:e.blocks,query:t,trailing:n})});case`table`:return(0,U.jsx)(Xc,{block:e,query:t,trailing:n});case`rule`:return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`hr`,{className:`border-border`}),n]})}}var Jc={left:`text-left`,center:`text-center`,right:`text-right`},Yc=e=>e===void 0?`text-left`:Jc[e]??`text-left`;function Xc({block:e,query:t,trailing:n}){return(0,U.jsxs)(`div`,{className:`overflow-x-auto`,children:[(0,U.jsxs)(`table`,{className:`border-collapse text-sm tabular-nums`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsx)(`tr`,{children:e.header.map((n,r)=>(0,U.jsx)(`th`,{className:g(`border-b px-2 py-1 font-semibold`,Yc(e.align[r])),children:(0,U.jsx)(Zc,{inlines:n,query:t})},r))})}),(0,U.jsx)(`tbody`,{children:e.rows.map((n,r)=>(0,U.jsx)(`tr`,{children:n.map((n,r)=>(0,U.jsx)(`td`,{className:g(`border-b border-border/50 px-2 py-1`,Yc(e.align[r])),children:(0,U.jsx)(Zc,{inlines:n,query:t})},r))},r))})]}),n]})}function Zc({inlines:e,query:t}){return(0,U.jsx)(U.Fragment,{children:e.map((e,n)=>(0,U.jsx)(Qc,{inline:e,query:t},n))})}function Qc({inline:e,query:t}){switch(e.kind){case`text`:return(0,U.jsx)(Bo,{text:e.text,query:t});case`strong`:return(0,U.jsx)(`strong`,{className:`font-semibold`,children:(0,U.jsx)(Zc,{inlines:e.inlines,query:t})});case`em`:return(0,U.jsx)(`em`,{children:(0,U.jsx)(Zc,{inlines:e.inlines,query:t})});case`del`:return(0,U.jsx)(`del`,{className:`text-muted-foreground`,children:(0,U.jsx)(Zc,{inlines:e.inlines,query:t})});case`code`:return(0,U.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-[0.9em] [overflow-wrap:anywhere]`,children:(0,U.jsx)(Bo,{text:e.text,query:t})});case`link`:return(0,U.jsx)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer noopener`,className:`underline decoration-muted-foreground underline-offset-2 hover:decoration-foreground`,children:(0,U.jsx)(Zc,{inlines:e.inlines,query:t})});case`image`:return(0,U.jsx)($c,{src:e.src,alt:e.alt},e.src);case`break`:return(0,U.jsx)(`br`,{})}}function $c({src:e,alt:t}){let[n,r]=(0,H.useState)(!1);return n?(0,U.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Image unavailable`,t?`: ${t}`:``,`. Open the pull request on GitHub to view it.`]}):(0,U.jsx)(`img`,{src:e,alt:t,loading:`lazy`,decoding:`async`,referrerPolicy:`no-referrer`,onError:()=>r(!0),className:`my-2 max-h-[36rem] max-w-full rounded border object-contain`})}var el=(0,H.createContext)(void 0),tl=el.Provider;function nl(){return(0,H.useContext)(el)}function rl(e){let t=Math.max(0,e.activeSubagents),n=Math.max(0,e.activeBackgroundCalls),r=Math.max(0,e.activeWorkflows??0),i=[t>0?`${t} agent${t===1?``:`s`}`:void 0,n>0?`${n} background call${n===1?``:`s`}`:void 0,r>0?`${r} workflow${r===1?``:`s`}`:void 0].filter(e=>e!==void 0);if(i.length!==0)return`${i.length<3?i.join(` and `):`${i.slice(0,-1).join(`, `)} and ${i.at(-1)}`} running`}function il(e){let t=rl(e);return t===void 0?e.status:`${e.status}, ${t}`}function al(e,t){switch(e.status){case`running`:return{label:`started`,at:co(e.startedAt,t)};case`complete`:return{label:`finished`,at:co(e.endedAt??e.startedAt,t)};case`aborted`:return{label:`stopped`,at:co(e.endedAt??e.startedAt,t)};case`error`:return{label:`failed`,at:co(e.endedAt??e.startedAt,t)}}}function ol(e=3e4){let[t,n]=(0,H.useState)(()=>Date.now());return(0,H.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function sl({input:e,query:t}){let n=lo(e);return n?(0,U.jsxs)(`div`,{className:`overflow-hidden rounded-md border bg-muted`,children:[n.path===void 0?null:(0,U.jsx)(cl,{path:n.path}),(0,U.jsxs)(`div`,{className:`overflow-x-auto`,children:[n.removed.map((e,n)=>(0,U.jsx)(ll,{sign:`-`,line:e,query:t,kind:`removed`},`-${n}`)),n.added.map((e,n)=>(0,U.jsx)(ll,{sign:`+`,line:e,query:t,kind:`added`},`+${n}`))]})]}):null}function cl({path:e}){let t=e.lastIndexOf(`/`);return(0,U.jsxs)(`p`,{className:`m-0 truncate border-b px-2 py-1 font-mono text-xs`,children:[(0,U.jsx)(`span`,{className:`text-muted-foreground/70`,children:t<0?``:`${e.slice(0,t)}/`}),(0,U.jsx)(`span`,{className:`text-foreground`,children:t<0?e:e.slice(t+1)})]})}function ll({sign:e,line:t,query:n,kind:r}){return(0,U.jsxs)(`div`,{className:g(`grid grid-cols-[1.25rem_minmax(0,1fr)] font-mono text-xs whitespace-pre`,Vo(r)),children:[(0,U.jsx)(`span`,{className:`pl-2 select-none`,"aria-hidden":!0,children:e}),(0,U.jsx)(`span`,{children:(0,U.jsx)(Bo,{text:t,query:n})})]})}function ul({entry:e,query:t}){let n=lo(e.input)!==void 0;return(0,U.jsxs)(U.Fragment,{children:[n?null:(0,U.jsx)(fl,{label:`input`,value:e.input,query:t}),(0,U.jsx)(fl,{label:`update`,value:e.update,query:t}),(0,U.jsx)(fl,{label:`result`,value:e.result,query:t})]})}var dl=2e4;function fl({label:e,value:t,query:n}){if(t==null||t===``)return null;let r=typeof t==`string`?t:ml(t);if(r===``)return null;let i=e!==`input`&&r.length<=dl?pl(t):void 0;return(0,U.jsxs)(`div`,{className:`mt-1.5 first:mt-0`,children:[(0,U.jsx)(`p`,{className:`m-0 mb-1 text-xs text-muted-foreground`,children:e}),i?i.map(e=>(0,U.jsx)(fl,{label:e.label,value:e.text,query:n},e.label)):(0,U.jsx)(`pre`,{className:`m-0 max-h-72 overflow-auto rounded-md border bg-muted p-2 font-mono text-xs whitespace-pre-wrap text-foreground [overflow-wrap:anywhere]`,children:r.length>dl?r:(0,U.jsx)(Ho,{text:r,query:n})})]})}function pl(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e,n=t.content;if(!Array.isArray(n))return;let r=e=>{if(!e||typeof e!=`object`)return;let t=e;return t.type===`text`&&typeof t.text==`string`&&uo(t.text)?t.text:void 0};if(!n.some(e=>r(e)!==void 0))return;let i=n.flatMap((e,t)=>{let n=r(e),i=`content ${t+1}`;if(n===void 0)return[{label:i,text:ml(e)}];let{type:a,text:o,...s}=e,c=[{label:`${i} (text)`,text:n}];return Object.keys(s).length>0&&c.push({label:`${i} metadata`,text:ml(s)}),c}),{content:a,...o}=t;return Object.keys(o).length>0&&i.push({label:`metadata`,text:ml(o)}),i}function ml(e){try{return JSON.stringify(e,null,2)??``}catch{return String(e)}}function hl(e,t){let n=new Date(e),r=n.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});return n.getFullYear()===t.getFullYear()&&n.getMonth()===t.getMonth()&&n.getDate()===t.getDate()?r:`${n.toLocaleDateString(void 0,{day:`numeric`,month:`short`,...n.getFullYear()===t.getFullYear()?{}:{year:`numeric`}})}, ${r}`}var gl=(0,H.createContext)({}),_l=gl.Provider;function vl(){return(0,H.useContext)(gl).openSession}function yl({userMessageId:e}){let{rewind:t,fork:n}=(0,H.useContext)(gl);return(0,U.jsxs)(U.Fragment,{children:[t?(0,U.jsxs)(bl,{icon:(0,U.jsx)(Ln,{"aria-hidden":!0}),label:t.blocked??`Rewind to before this message`,disabled:t.blocked!==void 0,children:[(0,U.jsx)(eo,{onClick:()=>t.run(e,`conversation`),children:`Conversation`}),t.files?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(eo,{onClick:()=>t.run(e,`files`),children:`Code`}),(0,U.jsx)(eo,{onClick:()=>t.run(e,`both`),children:`Both`})]}):null]}):null,n?(0,U.jsxs)(bl,{icon:(0,U.jsx)(On,{"aria-hidden":!0}),label:`Fork from before this message`,children:[(0,U.jsx)(eo,{onClick:()=>n.run(e,!1),children:`Same Scope`}),n.worktree?(0,U.jsx)(eo,{onClick:()=>n.run(e,!0),children:`New Worktree`}):null]}):null]})}function bl({icon:e,label:t,disabled:n=!1,children:r}){return(0,U.jsxs)(Za,{children:[(0,U.jsxs)(da,{children:[(0,U.jsx)(fa,{render:(0,U.jsx)(Qa,{disabled:n,render:(0,U.jsx)(O,{variant:`ghost`,size:`icon-xs`,"aria-label":t,children:e})})}),(0,U.jsx)(pa,{children:t})]}),(0,U.jsx)($a,{className:`min-w-40`,children:r})]})}var xl=(0,H.memo)(function(e){return e.entry.rewound?(0,U.jsx)(`div`,{className:`opacity-50`,children:Sl(e)}):Sl(e)});function Sl({entry:e,query:t,sessionId:n,background:r}){switch(e.kind){case`user`:return(0,U.jsx)(Cl,{entry:e,query:t,sessionId:n});case`assistant`:return(0,U.jsx)(Tl,{entry:e,query:t});case`thinking`:return(0,U.jsx)(Ol,{entry:e,query:t});case`tool`:return(0,U.jsx)(kl,{entry:e,query:t,background:r});case`subagent`:return(0,U.jsx)(Ml,{entry:e,query:t});case`background_call`:return(0,U.jsx)(Pl,{entry:e});case`enquiry`:return(0,U.jsx)(Al,{entry:e,query:t});case`notice`:return(0,U.jsx)(zl,{entry:e,query:t});case`marker`:return(0,U.jsx)(Vl,{entry:e});default:return null}}function Cl({entry:e,query:t,sessionId:n}){let r=(0,H.useMemo)(()=>Dc(e.text),[e.text]);return(0,U.jsxs)(`div`,{className:`group/message relative flex flex-col items-end py-3 before:absolute before:inset-y-0 before:-right-[100vw] before:-left-[100vw] before:content-['']`,children:[(0,U.jsxs)(`div`,{className:g(`relative min-w-0 max-w-[90%] rounded-2xl rounded-br-sm px-4 py-3 sm:max-w-[80%]`,e.fromSessionId===void 0&&e.producer===void 0?`bg-muted`:`border border-border bg-muted/40 text-muted-foreground`),children:[e.fromSessionId===void 0?null:(0,U.jsxs)(`p`,{className:`m-0 mb-2 text-xs text-muted-foreground`,children:[`From `,(0,U.jsx)(Rl,{sessionId:e.fromSessionId,query:t}),` · not human authorization`]}),e.producer===void 0?null:(0,U.jsx)(`p`,{className:`m-0 mb-2 text-xs text-muted-foreground`,children:`From the parent agent · not human authorization`}),e.attachments?.length?(0,U.jsx)(wl,{ids:e.attachments,sessionId:n}):null,(0,U.jsx)(Wc,{blocks:r,query:t})]}),e.at?(0,U.jsx)(El,{at:e.at,side:`right`,children:e.rewound||e.producer?null:(0,U.jsx)(`span`,{className:`inline-flex [@media(hover:hover)]:opacity-0 [@media(hover:hover)]:group-hover/message:opacity-100 focus-within:opacity-100 has-[[aria-expanded=true]]:opacity-100`,children:(0,U.jsx)(yl,{userMessageId:e.id})})}):null]})}function wl({ids:e,sessionId:t}){return(0,U.jsx)(`div`,{className:`mb-2 flex flex-wrap gap-2`,children:e.map(e=>(0,U.jsx)(To,{src:`/api/sessions/${encodeURIComponent(t)}/attachments/${encodeURIComponent(e)}`,alt:``,className:`max-h-64 max-w-full rounded-md border border-border`},e))})}function Tl({entry:e,query:t}){let n=(0,H.useMemo)(()=>Dc(e.text),[e.text]);return(0,U.jsxs)(`div`,{className:`relative`,children:[(0,U.jsx)(Hl,{children:(0,U.jsx)(Wc,{blocks:n,query:t,trailing:e.final?void 0:(0,U.jsx)(Dl,{})})}),e.endedAt?(0,U.jsx)(El,{at:e.endedAt,side:`left`}):null]})}function El({at:e,side:t,children:n}){return(0,U.jsxs)(`div`,{className:g(`relative mt-1 flex items-center gap-1 text-xs whitespace-nowrap text-muted-foreground/70`,t===`right`&&`flex-row-reverse @min-[68rem]/transcript:flex-row`,`@min-[68rem]/transcript:absolute @min-[68rem]/transcript:mt-0 @min-[68rem]/transcript:leading-[1.375rem]`,t===`right`?`text-right @min-[68rem]/transcript:bottom-6 @min-[68rem]/transcript:left-full @min-[68rem]/transcript:ml-4`:`@min-[68rem]/transcript:right-full @min-[68rem]/transcript:bottom-1 @min-[68rem]/transcript:mr-4`),children:[(0,U.jsx)(`time`,{dateTime:e,title:new Date(e).toLocaleString(),children:hl(e,new Date)}),n]})}function Dl(){return(0,U.jsx)(`span`,{className:`animate-caret-blink ml-px inline-block w-[1ch] text-primary`,"aria-hidden":!0,children:`▍`})}function Ol({entry:e,query:t}){let[n,r]=(0,H.useState)(!1),[i,a]=(0,H.useState)(!1),o=(0,H.useRef)(null),s=(0,H.useMemo)(()=>Dc(e.text),[e.text]),c=e.final&&!n,l=e.text.trim()===``;return(0,H.useLayoutEffect)(()=>{let e=o.current;if(!e||!c)return;let t=new ResizeObserver(()=>a(e.scrollHeight>e.clientHeight+1));return t.observe(e),()=>t.disconnect()},[c,l]),l?null:(0,U.jsxs)(Hl,{children:[(0,U.jsx)(`div`,{ref:o,className:g(`text-muted-foreground italic`,c&&`max-h-[4.5rem] overflow-hidden`),children:(0,U.jsx)(Wc,{blocks:s,query:t,trailing:e.final?void 0:(0,U.jsx)(Dl,{})})}),e.final&&(n||i)?(0,U.jsx)(`button`,{type:`button`,onClick:()=>r(!n),className:`mt-0.5 text-xs text-muted-foreground hover:text-foreground`,children:n?`less`:`more`}):null]})}function kl({entry:e,query:t,background:n}){let[r,i]=(0,H.useState)(void 0),a=r??e.status===`error`,o=Fi(e.input),s=Po(e.authorisation),c=vo(e);return(0,U.jsxs)(`details`,{open:a,onToggle:e=>i(e.currentTarget.open),className:`group/tool text-foreground`,children:[(0,U.jsxs)(`summary`,{className:`flex cursor-default items-center gap-2 rounded-md px-1.5 py-1 select-none hover:bg-muted/50 cursor-tilt relative [--tilt-angle-x:10deg] [--tilt-angle-y:1.5deg] [--tilt-lift:1.005]`,children:[(0,U.jsx)(bo,{name:e.name,className:e.status===`error`||n?.status===`error`?`text-destructive`:`text-muted-foreground`}),(0,U.jsx)(`span`,{className:`min-w-0 shrink-0 text-sm text-muted-foreground [overflow-wrap:anywhere]`,children:(0,U.jsx)(Ao,{name:e.name})}),o===void 0?null:(0,U.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground/80`,children:o}),s?(0,U.jsx)(`span`,{className:g(`ml-auto shrink-0 text-xs`,e.authorisation===`denied`?`text-destructive`:e.authorisation===`asked`?`text-status-awaiting`:`text-muted-foreground`),children:s}):e.status===`running`?(0,U.jsx)(jn,{"aria-label":`running`,className:`ml-auto size-3.5 shrink-0 animate-spin text-muted-foreground motion-reduce:animate-none`}):n?(0,U.jsx)(Fl,{entry:n}):c?(0,U.jsx)(`span`,{className:g(`ml-auto shrink-0 font-mono text-xs`,e.status===`error`?`text-destructive`:`text-muted-foreground`),children:c}):null]}),(0,U.jsxs)(`div`,{className:`my-1 ml-6 rounded-lg border p-3`,children:[(0,U.jsx)(sl,{input:e.input,query:t}),(0,U.jsx)(ul,{entry:e,query:t})]})]})}function Al({entry:e,query:t}){return(0,U.jsx)(`div`,{className:`text-foreground`,children:e.questions.map((n,r)=>(0,U.jsx)(jl,{entry:e,index:r,query:t},n.question))})}function jl({entry:e,index:t,query:n}){let r=e.questions[t],i=e.answers?.[t]??[],a=r.options.filter(e=>!i.includes(e.label)).map(e=>e.label);return(0,U.jsxs)(`details`,{className:`group/question`,children:[(0,U.jsxs)(`summary`,{className:`flex cursor-default items-center gap-2 rounded-md px-1.5 py-1 text-sm select-none hover:bg-muted/50 cursor-tilt relative [--tilt-angle-x:10deg] [--tilt-angle-y:1.5deg] [--tilt-lift:1.005]`,children:[(0,U.jsx)(Mn,{"aria-hidden":!0,className:g(`size-3.5 shrink-0 text-muted-foreground`,t>0&&`invisible`)}),(0,U.jsxs)(`span`,{className:`min-w-0 truncate`,children:[(0,U.jsxs)(`span`,{className:`text-muted-foreground`,children:[r.header,` `]}),i.length===0?(0,U.jsx)(`span`,{className:`text-muted-foreground italic`,children:e.status===`asked`?`waiting…`:`no answer`}):(0,U.jsx)(Bo,{text:i.join(`, `),query:n})]}),(0,U.jsx)(Cn,{"aria-hidden":!0,className:`ml-auto size-3.5 shrink-0 text-muted-foreground transition-transform group-open/question:rotate-90`})]}),(0,U.jsxs)(`div`,{className:`mt-0.5 mb-1.5 ml-7 space-y-1 text-xs text-muted-foreground [overflow-wrap:anywhere]`,children:[(0,U.jsx)(`p`,{children:(0,U.jsx)(Bo,{text:r.question,query:n})}),a.length===0?null:(0,U.jsxs)(`p`,{className:`text-muted-foreground/70`,children:[i.length===0?`Options: `:`Other options: `,(0,U.jsx)(Bo,{text:a.join(` · `),query:n})]})]})]})}function Ml({entry:e,query:t}){let n=e.waitingOn?`waiting on ${e.waitingOn}`:e.status,r=e.status===`running`||e.status===`waiting`,i=nl(),a=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(xn,{"aria-hidden":!0,className:g(`size-3.5 shrink-0`,Nl(e.status)===`error`?`text-destructive`:`text-muted-foreground`)}),(0,U.jsx)(`span`,{className:`min-w-0 text-sm text-muted-foreground [overflow-wrap:anywhere] max-sm:col-start-2 max-sm:row-start-1 max-sm:truncate`,children:e.name}),e.description===void 0?null:(0,U.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground/80 max-sm:col-start-2 max-sm:col-end-4 max-sm:row-start-2`,children:(0,U.jsx)(Bo,{text:e.description,query:t})}),(0,U.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground max-sm:col-start-3 max-sm:row-start-1`,children:[r?(0,U.jsx)(jn,{"aria-hidden":!0,className:`size-3.5 animate-spin motion-reduce:animate-none`}):null,n]})]}),o=`flex w-full items-center gap-2 rounded-md px-1.5 py-1 text-foreground max-sm:grid max-sm:grid-cols-[14px_minmax(0,1fr)_auto] max-sm:gap-y-1`;return i===void 0?(0,U.jsx)(`div`,{className:o,children:a}):(0,U.jsx)(`button`,{type:`button`,onClick:()=>i(vn(e)),className:g(o,`text-left hover:bg-muted/50 cursor-tilt relative [--tilt-angle-x:10deg] [--tilt-angle-y:1.5deg] [--tilt-lift:1.005]`),children:a})}function Nl(e){return e===`error`?`error`:e===`running`?`running`:`complete`}function Pl({entry:e}){let t=al(e,ol());return(0,U.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md px-1.5 py-1 text-foreground`,children:[(0,U.jsx)(bo,{name:e.tool,className:Il(e.status)===`error`?`text-destructive`:`text-muted-foreground`}),(0,U.jsx)(`span`,{className:`min-w-0 text-sm text-muted-foreground [overflow-wrap:anywhere]`,children:e.tool}),(0,U.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground/70`,children:`in background`}),(0,U.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[e.status===`running`?(0,U.jsx)(jn,{"aria-hidden":!0,className:`size-3.5 animate-spin motion-reduce:animate-none`}):null,t.label,` `,t.at]})]})}function Fl({entry:e}){let t=al(e,ol());return(0,U.jsxs)(`span`,{className:g(`ml-auto flex shrink-0 items-center gap-1.5 text-xs`,e.status===`error`?`text-destructive`:`text-muted-foreground`),children:[e.status===`running`?(0,U.jsx)(jn,{"aria-hidden":!0,className:`size-3.5 animate-spin motion-reduce:animate-none`}):null,(0,U.jsx)(`span`,{className:`sr-only`,children:`in background,`}),t.label,` `,t.at]})}function Il(e){return e===`error`?`error`:e===`running`?`running`:`complete`}var Ll={info:`text-muted-foreground`,warn:`text-foreground`,error:`text-destructive`};function Rl({sessionId:e,query:t}){let{sessions:n}=xi(),r=n.find(t=>t.id===e);return r?(0,U.jsx)(`a`,{href:Oi({sessionId:r.id}),className:`rounded-sm font-sans font-medium text-foreground outline-none transition-[text-shadow] duration-150 hover:[text-shadow:0_0_8px_color-mix(in_srgb,currentColor_60%,transparent)] focus-visible:ring-3 focus-visible:ring-ring/30`,children:(0,U.jsx)(Bo,{text:ji(r),query:t})}):(0,U.jsx)(`span`,{className:`text-foreground`,children:(0,U.jsx)(Bo,{text:e,query:t})})}function zl({entry:e,query:t}){let n=Ll[e.level],r=e.sessionId===void 0?-1:e.text.indexOf(e.sessionId);return(0,U.jsx)(Hl,{gutter:`!`,gutterClassName:n,children:(0,U.jsx)(`p`,{className:g(`m-0 font-mono text-sm whitespace-pre-wrap [overflow-wrap:anywhere]`,n),children:r===-1||e.sessionId===void 0?(0,U.jsx)(Bo,{text:e.text,query:t}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Bo,{text:e.text.slice(0,r),query:t}),(0,U.jsx)(Rl,{sessionId:e.sessionId,query:t}),(0,U.jsx)(Bo,{text:e.text.slice(r+e.sessionId.length),query:t})]})})})}var Bl={revived:`text-primary`,settled:`text-muted-foreground`,dormant:`text-muted-foreground`,compacted:`text-muted-foreground`,rewound:`text-muted-foreground`,forked:`text-muted-foreground`};function Vl({entry:e}){let t=Bl[e.marker],n=vl();return(0,U.jsxs)(`div`,{className:g(`flex items-center gap-2 py-2`,t),role:`separator`,"aria-label":e.text,children:[(0,U.jsx)(`span`,{className:`h-px flex-1 bg-current opacity-50`,"aria-hidden":!0}),e.fromSessionId&&n?(0,U.jsx)(O,{variant:`link`,size:`xs`,className:`h-auto p-0 text-xs text-current`,onClick:()=>n(e.fromSessionId),children:`Forked from another Agent Session`}):(0,U.jsx)(`span`,{className:`text-xs`,children:e.text}),(0,U.jsx)(`span`,{className:`h-px flex-1 bg-current opacity-50`,"aria-hidden":!0})]})}function Hl({gutter:e,gutterClassName:t,children:n}){return(0,U.jsxs)(`div`,{className:g(`py-1`,e&&`grid grid-cols-[2ch_minmax(0,1fr)] gap-0`),children:[e?(0,U.jsx)(`span`,{"aria-hidden":!0,className:g(`font-mono text-sm select-none`,t),children:e}):null,n]})}function Ul(e,t=40){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function Wl(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Gl(e,t=`|`){return e.map(e=>vu(e)).join(t)}function Kl(e,t){return typeof t==`bigint`?t.toString():t}var ql=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function Jl(e){return new ql(e)}function Yl(e){return e==null}function Xl(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Zl(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var Ql=Symbol(`evaluating`);function $l(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Ql)return r===void 0&&(r=Ql,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function eu(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function tu(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function nu(e){return tu(e._zod.def)??e._zod.def.shape}function ru(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return eu(this,t,e),e},enumerable:!0,configurable:!0})}function iu(e,t,n){t in e?eu(e,t,n):e[t]=n}function au(e,t,n,r){let i=nu(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?ru(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):iu(e,a,r?r(n.value,a):n.value))}}function ou(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?ru(e,n,()=>t[n]):iu(e,n,r.value))}}function su(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function cu(e){return JSON.stringify(e)}function lu(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var uu=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function du(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var fu=Jl(()=>{if(od.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function pu(e){if(du(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return du(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function mu(e){return pu(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var hu=new Set([`string`,`number`,`symbol`]);function gu(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function _u(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function G(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function vu(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function yu(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var bu={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},xu={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function Su(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return au(i,e,Cu(e,t)),_u(e,su(n,{shape:i,checks:[]}))}function Cu(e,t){let n=nu(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function wu(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(Cu(e,t)),a={};return au(a,e,Reflect.ownKeys(nu(e)).filter(e=>!i.has(e))),_u(e,su(n,{shape:a,checks:[]}))}function Tu(e,t){if(!pu(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=nu(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return _u(e,su(e._zod.def,{shape:Eu(e,t)}))}function Eu(e,t){let n={};return au(n,e,Reflect.ownKeys(nu(e))),ou(n,t),n}function Du(e,t){if(!pu(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return _u(e,su(e._zod.def,{shape:Eu(e,t)}))}function Ou(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return au(n,e,Reflect.ownKeys(nu(e))),au(n,t,Reflect.ownKeys(nu(t))),_u(e,su(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function ku(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Cu(t,n)):void 0,o={};return au(o,t,Reflect.ownKeys(nu(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),_u(t,su(t._zod.def,{shape:o,checks:[]}))}function Au(e,t,n){let r=n?new Set(Cu(t,n)):void 0,i={};return au(i,t,Reflect.ownKeys(nu(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),_u(t,su(t._zod.def,{shape:i}))}function ju(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Mu(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Nu(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Pu(e){return typeof e==`string`?e:e?.message}function Fu(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function Iu(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:Pu(e.inst?._zod.def?.error?.(e))??Pu(a?.(e))??Pu(t?.error?.(e))??Pu(n.customError?.(e))??Pu(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var Lu=/[\uD800-\uDBFF]/;function Ru(e){let t=e.length;if(!Lu.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function zu(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Bu(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Vu(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Hu(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Ku(e,n,r.value)}}function Uu(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Wu(e,t,n){return Uu(e,t,n,!1)}function Gu(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Uu(this,n,r(this))},set(e){Uu(this,n,e)}})}return t}function Ku(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Uu(this,t,n.bind(this))},set(e){Uu(this,t,e)}})}function qu(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Ju,Yu=!1,Xu={configurable:!0,get(){Yu=!0}};function K(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Ju!==e._zod){Ju=void 0;return}Ju=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Xu);let e=Yu;Yu=!1;try{let r=n(this);return Yu?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Yu||=e,r}catch(n){throw delete this[t],Yu||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function Zu(e,t,n,r){let i=qu(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var Qu=`~constantCatch`;function $u(e){let t=()=>e;return t[Qu]=!0,t}var ed,td={value:void 0,enumerable:!1},nd=`captureStackTrace`in Error?Error:null;function rd(e){let t=nd;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return nd=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function q(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){td.value=new a(r);try{Object.defineProperty(n,"_zod",td)}finally{td.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Hu(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?rd(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var id=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ad=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(ed=globalThis).__zod_globalConfig??(ed.__zod_globalConfig={});var od=globalThis.__zod_globalConfig;function sd(e){return e&&Object.assign(od,e),od}function cd(){let e=this._zod;return e.message??=JSON.stringify(e.def,Kl,2),e.message}function ld(e){this._zod.message=e}var ud={get:cd,set:ld,enumerable:!0,configurable:!0},dd={value:void 0,enumerable:!1},fd=new WeakSet([Object.prototype,Error.prototype]),pd=(e,t)=>{e.name=`$ZodError`,dd.value=t,Object.defineProperty(e,"issues",dd),dd.value=void 0,Object.defineProperty(e,"message",ud);let n=Object.getPrototypeOf(e);fd.has(n)||(fd.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},md=q(`$ZodError`,pd);q(`$ZodError`,pd,void 0,{Parent:Error});function hd(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function gd(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?hd(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function _d(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function vd(e,t){return{callee:t?.callee??e,Err:t?.Err}}var yd=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new id;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Iu(e,o,sd())));throw uu(n,a?.callee??t),n}return s.value};return t},bd=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Iu(e,o,sd())));throw uu(n,a?.callee??t),n}return s.value};return t},xd=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new id;return a.issues.length?Sd(e,a.issues,i):{success:!0,data:a.value}};function Sd(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>Iu(e,n,sd()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var Cd=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?Sd(e,a.issues,i):{success:!0,data:a.value}},wd=Symbol.for(`zod.compile.invalid`),Td=Symbol.for(`zod.compile.fallback`),Ed=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==wd)return!0;if(r.definite===!0&&n===void 0)return!1}return Dd(e,t,n)});function Dd(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[Td]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new id;return a.issues.length===0}var Od=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},kd=e=>{let t=yd(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,vd(n,a))};return n},Ad=e=>{let t=yd(e),n=(e,r,i,a)=>t(e,r,i,vd(n,a));return n},jd=e=>{let t=bd(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,vd(n,a))};return n},Md=e=>{let t=bd(e),n=async(e,r,i,a)=>await t(e,r,i,vd(n,a));return n},Nd=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return xd(e)(t,n,i)},Pd=e=>(t,n,r)=>xd(e)(t,n,r),Fd=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Cd(e)(t,n,i)},Id=e=>async(t,n,r)=>Cd(e)(t,n,r),Ld=/^[cC][0-9a-z]{6,}$/,Rd=/^[0-9a-z]+$/,zd=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Bd=/^[0-9a-vA-V]{20}$/,Vd=/^[A-Za-z0-9]{27}$/,Hd=/^[a-zA-Z0-9_-]{21}$/;function Ud(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Wd=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Gd=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Kd=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,qd=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Jd=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function Yd(){return new RegExp(Jd,`u`)}var Xd=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Zd=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Qd=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,$d=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ef=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,tf=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,nf=/^https?$/,rf=/^\+[1-9]\d{6,14}$/,af=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function of(e){return RegExp(`^${e}$`)}var sf=of(af);function cf(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function lf(e){return RegExp(`^${cf(e)}$`)}function uf(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${cf({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${cf({precision:e.precision})}`:n;return RegExp(`^${af}T(?:${r})$`)}var df=/^[\s\S]{0,}$/,ff=/^-?\d+$/,pf=/^-?\d+(?:\.\d+)?$/,mf=/^(?:true|false)$/i,hf=/^null$/i,gf=/^[^A-Z]*$/,_f=/^[^a-z]*$/,vf=q(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),yf=e=>{let t=e.value;return!Yl(t)&&t.length!==void 0},bf={number:`number`,bigint:`bigint`,object:`date`},xf=q(`$ZodCheckLessThan`,(e,t)=>{vf.init(e,t);let n=bf[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:bf[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Sf=q(`$ZodCheckGreaterThan`,(e,t)=>{vf.init(e,t);let n=bf[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:bf[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Cf=q(`$ZodCheckMultipleOf`,(e,t)=>{vf.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):Zl(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),wf=q(`$ZodCheckNumberFormat`,(e,t)=>{vf.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=bu[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Tf=q(`$ZodCheckMaxLength`,(e,t)=>{var n;vf.init(e,t),(n=e._zod.def).when??(n.when=yf),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Ru(r):i)<=t.maximum)return;let a=zu(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ef=q(`$ZodCheckMinLength`,(e,t)=>{var n;vf.init(e,t),(n=e._zod.def).when??(n.when=yf),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Ru(r):i)>=t.minimum)return;let a=zu(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Df=q(`$ZodCheckLengthEquals`,(e,t)=>{var n;vf.init(e,t),(n=e._zod.def).when??(n.when=yf),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Ru(r):i;if(a===t.length)return;let o=zu(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Of=q(`$ZodCheckStringFormat`,(e,t)=>{var n,r;vf.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),kf=q(`$ZodCheckRegex`,(e,t)=>{Of.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Af=q(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=gf,Of.init(e,t)}),jf=q(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=_f,Of.init(e,t)}),Mf=q(`$ZodCheckIncludes`,(e,t)=>{vf.init(e,t);let n=gu(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Nf=q(`$ZodCheckStartsWith`,(e,t)=>{vf.init(e,t);let n=RegExp(`^${gu(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Pf=q(`$ZodCheckEndsWith`,(e,t)=>{vf.init(e,t);let n=RegExp(`.*${gu(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Ff=q(`$ZodCheckOverwrite`,(e,t)=>{vf.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),If=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
78
78
|
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
|
|
79
79
|
`)}\n};`)(...Object.values(this.closed))}},Lf={major:4,minor:6,patch:5},Rf=q(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Lf;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=ju(t),a;for(let o of n){if(o._zod.def.when){if(Mu(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new id;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Fu(t.issues,n,e),i||=ju(t,n))});else{if(t.issues.length===n)continue;Fu(t.issues,n,e),i||=ju(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(ju(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new id;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new id;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Wu(this,`~standard`,Vf(this))},set"~standard"(e){Uu(this,`~standard`,e)}}),zf=(e,t)=>e.issues.length?{issues:e.issues.map(e=>Iu(e,t,sd()))}:{value:e.value};async function Bf(e,t){let n={async:!0};return zf(await e._zod.run({value:t,issues:[]},n),n)}function Vf(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return zf(r,n)}catch{}return Bf(e,t)},vendor:`zod`,version:1}}var Hf=q(`$ZodString`,(e,t)=>{Rf.init(e,t),e._zod.pattern=t.pattern??df,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),Uf=q(`$ZodStringFormat`,(e,t)=>{Of.init(e,t),Hf.init(e,t)}),Wf=q(`$ZodGUID`,(e,t)=>{t.pattern??=Gd,Uf.init(e,t)}),Gf=q(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Kd(e)}else t.pattern??=Kd();Uf.init(e,t)}),Kf=q(`$ZodEmail`,(e,t)=>{t.pattern??=qd,Uf.init(e,t)});function qf(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Jf(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?qf(e)||2:Yf(e,t)}function Yf(e,t){if(!t.normalize&&t.protocol?.source===nf.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var Xf=/[\t\n\r]/g;function Zf(e){return e.replace(Xf,``)}function Qf(e,t){return t.lastIndex=0,t.test(e.hostname)}function $f(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var ep=q(`$ZodURL`,(e,t)=>{Uf.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Jf(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=Zf(r);return}t.hostname&&!Qf(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!$f(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:Zf(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),tp=q(`$ZodEmoji`,(e,t)=>{t.pattern??=Yd(),Uf.init(e,t)}),np=q(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?Hd:Ud(t.length),Uf.init(e,t)}),rp=q(`$ZodCUID`,(e,t)=>{t.pattern??=Ld,Uf.init(e,t)}),ip=q(`$ZodCUID2`,(e,t)=>{t.pattern??=Rd,Uf.init(e,t)}),ap=q(`$ZodULID`,(e,t)=>{t.pattern??=zd,Uf.init(e,t)}),op=q(`$ZodXID`,(e,t)=>{t.pattern??=Bd,Uf.init(e,t)}),sp=q(`$ZodKSUID`,(e,t)=>{t.pattern??=Vd,Uf.init(e,t)}),cp=q(`$ZodISODateTime`,(e,t)=>{t.pattern??=uf(t),Uf.init(e,t)}),lp=q(`$ZodISODate`,(e,t)=>{t.pattern??=sf,Uf.init(e,t)}),up=q(`$ZodISOTime`,(e,t)=>{t.pattern??=lf(t),Uf.init(e,t)}),dp=q(`$ZodISODuration`,(e,t)=>{t.pattern??=Wd,Uf.init(e,t)}),fp=q(`$ZodIPv4`,(e,t)=>{t.pattern??=Xd,Uf.init(e,t)}),pp=/^[0-9a-fA-F:.]+$/;function mp(e){return pp.test(e)?qf(`http://[${e}]`):!1}var hp=q(`$ZodIPv6`,(e,t)=>{t.pattern??=Zd,Uf.init(e,t),e._zod.check=n=>{mp(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),gp=q(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Qd,Uf.init(e,t)});function _p(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:mp(n)}var vp=q(`$ZodCIDRv6`,(e,t)=>{t.pattern??=$d,Uf.init(e,t),e._zod.check=n=>{_p(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function yp(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var bp=/^[0-9a-zA-Z+/]*={0,2}$/,xp=q(`$ZodBase64`,(e,t)=>{t.pattern??=bp,Uf.init(e,t),e._zod.check=n=>{yp(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),Sp=/^[A-Za-z0-9_-]*$/;function Cp(e){if(!Sp.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return yp(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var wp=q(`$ZodBase64URL`,(e,t)=>{t.pattern??=Sp,Uf.init(e,t),e._zod.check=n=>{Cp(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Tp=q(`$ZodE164`,(e,t)=>{t.pattern??=rf,Uf.init(e,t)});function Ep(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var Dp=q(`$ZodJWT`,(e,t)=>{Uf.init(e,t),e._zod.check=n=>{Ep(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Op=q(`$ZodNumber`,(e,t)=>{Rf.init(e,t),e._zod.pattern=pf,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),kp=q(`$ZodNumberFormat`,(e,t)=>{wf.init(e,t),Op.init(e,t)}),Ap=q(`$ZodBoolean`,(e,t)=>{Rf.init(e,t),e._zod.pattern=mf,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),jp=q(`$ZodNull`,(e,t)=>{Rf.init(e,t),e._zod.pattern=hf,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),Mp=q(`$ZodUnknown`,(e,t)=>{Rf.init(e,t),e._zod.parse=e=>e}),Np=q(`$ZodNever`,(e,t)=>{Rf.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Pp(e,t,n){e.issues.length&&t.issues.push(...Nu(n,e.issues)),t.value[n]=e.value}var Fp=q(`$ZodArray`,(e,t)=>{Rf.init(e,t);let n=od.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>Pp(t,r,e)));else if(Pp(c,r,e),s&&c.issues.length!==0&&ju(c))break}return o.length?Promise.all(o).then(()=>r):r}});function Ip(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(!(!o&&s&&i===`optional`)){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...Nu(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var Lp=[];function Rp(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Lp,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=yu(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function zp(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(ju(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Ip(e,n,i,t,d,f))):Ip(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var Bp=q(`$ZodObject`,(e,t)=>{Rf.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=Jl(()=>Rp(t));K(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||eu(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=du,o=t.catchall,s,c=od.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(ju(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>Ip(n,t,e,r,a,o))):Ip(s,t,e,r,a,o)}return o?zp(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),Vp=q(`$ZodObjectJIT`,(e,t)=>{Bp.init(e,t);let n=e._zod.parse,r=Jl(()=>Rp(t)),i=od.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new If([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
|
|
80
80
|
let ${e}_ab = false;
|
|
@@ -143,4 +143,4 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
143
143
|
`,`
|
|
144
144
|
+`).split(`
|
|
145
145
|
`));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return(0,H.useEffect)(()=>{let n=t?.target??ZN,c=t?.actInsideInputWithModifier??!0;if(e!==null){let e=e=>{if(i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!i.current||i.current&&!c)&&jj(e))return!1;let n=eP(e.code,s);if(a.current.add(e[n]),$N(o,a.current,!1)){let n=e.composedPath?.()?.[0]||e.target,a=n?.nodeName===`BUTTON`||n?.nodeName===`A`;t.preventDefault!==!1&&(i.current||!a)&&e.preventDefault(),r(!0)}},l=e=>{let t=eP(e.code,s);$N(o,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),e.key===`Meta`&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),r(!1)};return n?.addEventListener(`keydown`,e),n?.addEventListener(`keyup`,l),window.addEventListener(`blur`,u),window.addEventListener(`contextmenu`,u),()=>{n?.removeEventListener(`keydown`,e),n?.removeEventListener(`keyup`,l),window.removeEventListener(`blur`,u),window.removeEventListener(`contextmenu`,u)}}},[e,r]),n}function $N(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function eP(e,t){return t.includes(e)?`code`:`key`}var tP=()=>{let e=wN();return(0,H.useMemo)(()=>({zoomIn:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{let{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{let{transform:[r,i,a],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??a},n),!0):!1},getViewport:()=>{let[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{let{width:r,height:i,minZoom:a,maxZoom:o,panZoom:s}=e.getState(),c=_j(t,r,i,a,o,n?.padding??.1);return s?(await s.setViewport(c,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{let{transform:r,snapGrid:i,snapToGrid:a,domNode:o}=e.getState();if(!o)return t;let{x:s,y:c}=o.getBoundingClientRect(),l={x:t.x-s,y:t.y-c},u=n.snapGrid??i;return fj(l,r,n.snapToGrid??a,u)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:i,y:a}=r.getBoundingClientRect(),o=pj(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function nP(e,t){let n=[],r=new Map,i=[];for(let t of e)if(t.type===`add`){i.push(t);continue}else if(t.type===`remove`||t.type===`replace`)r.set(t.id,[t]);else{let e=r.get(t.id);e?e.push(t):r.set(t.id,[t])}for(let e of t){let t=r.get(e.id);if(!t){n.push(e);continue}if(t[0].type===`remove`)continue;if(t[0].type===`replace`){n.push({...t[0].item});continue}let i={...e};for(let e of t)rP(e,i);n.push(i)}return i.length&&i.forEach(e=>{e.index===void 0?n.push({...e.item}):n.splice(e.index,0,{...e.item})}),n}function rP(e,t){switch(e.type){case`select`:t.selected=e.selected;break;case`position`:e.position!==void 0&&(t.position=e.position),e.dragging!==void 0&&(t.dragging=e.dragging);break;case`dimensions`:e.dimensions!==void 0&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes===`width`)&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes===`height`)&&(t.height=e.dimensions.height))),typeof e.resizing==`boolean`&&(t.resizing=e.resizing)}}function iP(e,t){return nP(e,t)}function aP(e,t){return nP(e,t)}function oP(e,t){return{id:e,type:`select`,selected:t}}function sP(e,t=new Set,n=!1){let r=[];for(let[i,a]of e){let e=t.has(i);!(a.selected===void 0&&!e)&&a.selected!==e&&(n&&(a.selected=e),r.push(oP(a.id,e)))}return r}function cP({items:e=[],lookup:t}){let n=[],r=new Map(e.map(e=>[e.id,e]));for(let[r,i]of e.entries()){let e=t.get(i.id),a=e?.internals?.userNode??e;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:`replace`}),a===void 0&&n.push({item:i,type:`add`,index:r})}for(let[e]of t)r.get(e)===void 0&&n.push({id:e,type:`remove`});return n}function lP(e){return{id:e.id,type:`remove`}}var uP=uj(`React Flow`,`https://reactflow.dev/`);function dP(e,t,n={}){return Wj(e,t,{...n,onError:n.onError??uP})}var fP=e=>RA(e),pP=e=>LA(e);function mP(e){return(0,H.forwardRef)(e)}var hP=typeof window<`u`?H.useLayoutEffect:H.useEffect;function gP(e){let[t,n]=(0,H.useState)(BigInt(0)),[r]=(0,H.useState)(()=>_P(()=>n(e=>e+BigInt(1))));return hP(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function _P(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var vP=(0,H.createContext)(null);function yP({children:e}){let t=wN(),n=gP((0,H.useCallback)(e=>{let{nodes:n=[],setNodes:r,hasDefaultNodes:i,onNodesChange:a,nodeLookup:o,fitViewQueued:s,onNodesChangeMiddlewareMap:c}=t.getState(),l=n;for(let t of e)l=typeof t==`function`?t(l):t;let u=cP({items:l,lookup:o});for(let e of c.values())u=e(u);i&&r(l),u.length>0?a?.(u):s&&window.requestAnimationFrame(()=>{let{fitViewQueued:e,nodes:n,setNodes:r}=t.getState();e&&r(n)})},[])),r=gP((0,H.useCallback)(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:i,onEdgesChange:a,edgeLookup:o}=t.getState(),s=n;for(let t of e)s=typeof t==`function`?t(s):t;i?r(s):a&&a(cP({items:s,lookup:o}))},[])),i=(0,H.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,U.jsx)(vP.Provider,{value:i,children:e})}function bP(){let e=(0,H.useContext)(vP);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var xP=e=>!!e.panZoom;function SP(){let e=tP(),t=wN(),n=bP(),r=$(xP),i=(0,H.useMemo)(()=>{let e=e=>t.getState().nodeLookup.get(e),r=e=>{n.nodeQueue.push(e)},i=e=>{n.edgeQueue.push(e)},a=e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState(),i=fP(e)?e:n.get(e.id),a=i.parentId?Sj(i.position,i.measured,i.parentId,n,r):i.position;return rj({...i,position:a,width:i.measured?.width??i.width,height:i.measured?.height??i.height})},o=(e,t,n={replace:!1})=>{r(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&fP(e)?e:{...r,...e}}return r}))},s=(e,t,n={replace:!1})=>{i(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&pP(e)?e:{...r,...e}}return r}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{let{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:r,setEdges:i,addNodes:e=>{let t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{let t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{let{nodes:e=[],edges:n=[],transform:r}=t.getState(),[i,a,o]=r;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:i,y:a,zoom:o}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{let{nodes:r,edges:i,onNodesDelete:a,onEdgesDelete:o,triggerNodeChanges:s,triggerEdgeChanges:c,onDelete:l,onBeforeDelete:u}=t.getState(),{nodes:d,edges:f}=await JA({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(lP);o?.(f),c(e)}if(m){let e=d.map(lP);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=cj(e),o=i?e:a(e),s=r!==void 0;return o?(r||t.getState().nodes).filter(r=>{let a=t.getState().nodeLookup.get(r.id);if(a&&!i&&(r.id===e.id||!a.internals.positionAbsolute))return!1;let c=rj(s?r:a),l=sj(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=cj(e)?e:a(e);if(!r)return!1;let i=sj(r,t);return n&&i>0||i>=t.width*t.height||i>=r.width*r.height},updateNode:o,updateNodeData:(e,t,n={replace:!1})=>{o(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},getNodesBounds:e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState();return VA(e,{nodeLookup:n,nodeOrigin:r})},getHandleConnections:({type:e,id:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}-${e}${n?`-${n}`:``}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}${e?n?`-${e}-${n}`:`-${e}`:``}`)?.values()??[]),fitView:async e=>{let r=t.getState().fitViewResolver??wj();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return(0,H.useMemo)(()=>({...i,...e,viewportInitialized:r}),[r])}var CP=e=>e.selected,wP=typeof window<`u`?window:void 0;function TP({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=wN(),{deleteElements:r}=SP(),i=QN(e,{actInsideInputWithModifier:!1}),a=QN(t,{target:wP});(0,H.useEffect)(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(CP),edges:e.filter(CP)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,H.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])}function EP(e){let t=wN();(0,H.useEffect)(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=Oj(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,EA.error004()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener(`resize`,n);let t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener(`resize`,n),t&&e.current&&t.unobserve(e.current)}}},[])}var DP={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},OP=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function kP({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panActivationKeyPressed:i,panOnScrollSpeed:a=.5,panOnScrollMode:o=jA.Free,zoomOnDoubleClick:s=!0,panOnDrag:c=!0,defaultViewport:l,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:p,preventScrolling:m=!0,children:h,noWheelClassName:g,noPanClassName:_,onViewportChange:v,isControlledViewport:y,paneClickDistance:b,selectionOnDrag:x}){let S=wN(),C=(0,H.useRef)(null),{userSelectionActive:w,lib:T,connectionInProgress:E}=$(OP,bN),D=QN(p),O=(0,H.useRef)();EP(C);let k=(0,H.useCallback)(e=>{v?.({x:e[0],y:e[1],zoom:e[2]}),y||S.setState({transform:e})},[v,y]);return(0,H.useEffect)(()=>{if(C.current){O.current=$M({domNode:C.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:l,onDraggingChange:e=>S.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=S.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=S.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=S.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=O.current.getViewport();return S.setState({panZoom:O.current,transform:[e,t,n],domNode:C.current.closest(`.react-flow`)}),()=>{O.current?.destroy()}}},[]),(0,H.useEffect)(()=>{O.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panActivationKeyPressed:i,panOnScrollSpeed:a,panOnScrollMode:o,zoomOnDoubleClick:s,panOnDrag:c,zoomActivationKeyPressed:D,preventScrolling:m,noPanClassName:_,userSelectionActive:w,noWheelClassName:g,lib:T,onTransformChange:k,connectionInProgress:E,selectionOnDrag:x,paneClickDistance:b})},[e,t,n,r,i,a,o,s,c,D,m,_,w,g,T,k,E,x,b]),(0,U.jsx)(`div`,{className:`react-flow__renderer`,ref:C,style:DP,children:h})}var AP=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function jP(){let{userSelectionActive:e,userSelectionRect:t}=$(AP,bN);return e&&t?(0,U.jsx)(`div`,{className:`react-flow__selection react-flow__container`,style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}var MP=(e,t)=>n=>{n.target===t.current&&e?.(n)},NP=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function PP({isSelecting:e,selectionKeyPressed:t,selectionMode:n=MA.Full,panOnDrag:r,autoPanOnSelection:i,paneClickDistance:a,selectionOnDrag:o,onSelectionStart:s,onSelectionEnd:c,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:m,children:h}){let g=(0,H.useRef)(0),_=wN(),{userSelectionActive:v,elementsSelectable:y,dragging:b,panBy:x,autoPanSpeed:S}=$(NP,bN),C=y&&(e||v),w=(0,H.useRef)(null),T=(0,H.useRef)(),E=(0,H.useRef)(new Set),D=(0,H.useRef)(new Set),O=(0,H.useRef)(!1),k=(0,H.useRef)(!1),A=(0,H.useRef)({x:0,y:0}),j=(0,H.useRef)(!1),M=e=>{if(k.current||O.current||_.getState().connection.inProgress){k.current=!1,O.current=!1;return}l?.(e),_.getState().resetSelectedElements(),_.setState({nodesSelectionActive:!1})},N=e=>{if(Array.isArray(r)&&r?.includes(2)){e.preventDefault();return}u?.(e)},P=d?e=>d(e):void 0,F=e=>{k.current&&=(e.stopPropagation(),!1)},I=n=>{if(n.pointerType===`touch`&&r!==!1&&!t)return;let{domNode:i,transform:a}=_.getState();if(T.current=i?.getBoundingClientRect(),!T.current)return;let s=n.target===w.current;if(!s&&n.target.closest(`.nokey`)||!e||!(o&&s||t)||n.button!==0||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),k.current=!1;let{x:c,y:l}=Nj(n.nativeEvent,T.current),u=fj({x:c,y:l},a);_.setState({userSelectionRect:{width:0,height:0,startX:u.x,startY:u.y,x:c,y:l}}),s||(n.stopPropagation(),n.preventDefault())};function L(e,t){let{userSelectionRect:r}=_.getState();if(!r)return;let{transform:i,nodeLookup:a,edgeLookup:o,connectionLookup:s,triggerNodeChanges:c,triggerEdgeChanges:l,defaultEdgeOptions:u}=_.getState(),d={x:r.startX,y:r.startY},{x:f,y:p}=pj(d,i),m={startX:d.x,startY:d.y,x:e<f?e:f,y:t<p?t:p,width:Math.abs(e-f),height:Math.abs(t-p)},h=E.current,g=D.current;E.current=new Set(UA(a,m,i,n===MA.Partial,!0).map(e=>e.id)),D.current=new Set;let v=u?.selectable??!0;for(let e of E.current){let t=s.get(e);if(t)for(let{edgeId:e}of t.values()){let t=o.get(e);t&&(t.selectable??v)&&D.current.add(e)}}Cj(h,E.current)||c(sP(a,E.current,!0)),Cj(g,D.current)||l(sP(o,D.current)),_.setState({userSelectionRect:m,userSelectionActive:!0,nodesSelectionActive:!1})}function R(){if(!i||!T.current)return;let[e,t]=$A(A.current,T.current,S);x({x:e,y:t}).then(e=>{if(!k.current||!e){g.current=requestAnimationFrame(R);return}let{x:t,y:n}=A.current;L(t,n),g.current=requestAnimationFrame(R)})}let ee=()=>{cancelAnimationFrame(g.current),g.current=0,j.current=!1};(0,H.useEffect)(()=>()=>ee(),[]);let z=e=>{let{userSelectionRect:n,transform:r,resetSelectedElements:i}=_.getState();if(!T.current||!n)return;let{x:o,y:c}=Nj(e.nativeEvent,T.current);A.current={x:o,y:c};let l=pj({x:n.startX,y:n.startY},r);if(!k.current){let n=t?0:a;if(Math.hypot(o-l.x,c-l.y)<=n)return;i(),s?.(e)}k.current=!0,j.current||=(R(),!0),L(o,c)},B=e=>{if(!C){e.target===w.current&&_.getState().connection.inProgress&&(O.current=!0);return}e.button===0&&(e.target?.releasePointerCapture?.(e.pointerId),!v&&e.target===w.current&&_.getState().userSelectionRect&&M?.(e),_.setState({userSelectionActive:!1,userSelectionRect:null}),k.current&&(c?.(e),_.setState({nodesSelectionActive:E.current.size>0})),ee())},te=e=>{e.target?.releasePointerCapture?.(e.pointerId),ee()},V=r===!0||Array.isArray(r)&&r.includes(0);return(0,U.jsxs)(`div`,{className:Uw([`react-flow__pane`,{draggable:V,dragging:b,selection:e}]),onClick:C?void 0:MP(M,w),onContextMenu:MP(N,w),onWheel:MP(P,w),onPointerEnter:C?void 0:f,onPointerMove:C?z:p,onPointerUp:B,onPointerCancel:C?te:void 0,onPointerDownCapture:C?I:void 0,onClickCapture:C?F:void 0,onPointerLeave:m,ref:w,style:DP,children:[h,(0,U.jsx)(jP,{})]})}function FP({id:e,store:t,unselect:n=!1,nodeRef:r}){let{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeLookup:s,onError:c}=t.getState(),l=s.get(e);if(!l){c?.(`012`,EA.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function IP({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=wN(),[c,l]=(0,H.useState)(!1),u=(0,H.useRef)();return(0,H.useEffect)(()=>{if(!t)return u.current=OM({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{FP({id:t,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}}),()=>{u.current?.destroy(),u.current=void 0}},[t,s,e]),(0,H.useEffect)(()=>{t||!e.current||!u.current||u.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:o})},[n,r,t,a,e,i,o]),c}var LP=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function RP(){let e=wN();return(0,H.useCallback)(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:s,nodeLookup:c,nodeOrigin:l}=e.getState(),u=new Map,d=LP(a),f=r?i[0]:5,p=r?i[1]:5,m=t.direction.x*f*t.factor,h=t.direction.y*p*t.factor;for(let[,e]of c){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+m,y:e.internals.positionAbsolute.y+h};r&&(t=dj(t,i));let{position:a,positionAbsolute:s}=qA({nodeId:e.id,nextPosition:t,nodeLookup:c,nodeExtent:n,nodeOrigin:l,onError:o});e.position=a,e.internals.positionAbsolute=s,u.set(e.id,e)}s(u)},[])}var zP=(0,H.createContext)(null),BP=zP.Provider;zP.Consumer;var VP=()=>(0,H.useContext)(zP),HP=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),UP=(0,H.createContext)(null);function WP({children:e}){let t=$(HP,bN);return(0,U.jsx)(UP.Provider,{value:t,children:e})}function GP(){let e=(0,H.useContext)(UP);if(!e)throw Error(`useHandleConfig must be used within a HandleConfigProvider`);return e}var KP={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},qP=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o;if(!s&&!i)return KP;let u=c?.nodeId===e&&c?.id===t&&c?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:u,clickConnecting:i?.nodeId===e&&i?.id===t&&i?.type===n,isPossibleEndHandle:a===AA.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function JP({type:e=`source`,position:t=Q.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:c,className:l,onMouseDown:u,onTouchStart:d,...f},p){let m=o||null,h=e===`target`,g=wN(),_=VP(),{connectOnClick:v,noPanClassName:y,rfId:b}=GP(),{connectingFrom:x,connectingTo:S,clickConnecting:C,isPossibleEndHandle:w,connectionInProcess:T,clickConnectionInProcess:E,valid:D}=$(qP(_,m,e),bN);_||g.getState().onError?.(`010`,EA.error010());let O=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=g.getState(),i={...t,...e};if(r){let{edges:e,setEdges:t,onError:n}=g.getState();t(dP(i,e,{onError:n}))}n?.(i),s?.(i)},k=e=>{if(!_)return;let t=Mj(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();RM.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:h,handleId:m,nodeId:_,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>g.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:O,isValidConnection:n||((...e)=>g.getState().isValidConnection?.(...e)??!0),getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?u?.(e):d?.(e)};return(0,U.jsx)(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${b}-${_}-${m}-${e}`,className:Uw([`react-flow__handle`,`react-flow__handle-${t}`,`nodrag`,y,l,{source:!h,target:h,connectable:r,connectablestart:i,connectableend:a,clickconnecting:C,connectingfrom:x,connectingto:S,valid:D,connectionindicator:r&&(!T||w)&&(T||E?a:i)}]),onMouseDown:k,onTouchStart:k,onClick:v?t=>{let{onClickConnectStart:r,onClickConnectEnd:a,connectionClickStartHandle:o,connectionMode:s,isValidConnection:c,lib:l,rfId:u,nodeLookup:d,connection:f}=g.getState();if(!_||!o&&!i)return;if(!o){r?.(t.nativeEvent,{nodeId:_,handleId:m,handleType:e}),g.setState({connectionClickStartHandle:{nodeId:_,type:e,id:m}});return}let p=kj(t.target),h=n||c,{connection:v,isValid:y}=RM.isValid(t.nativeEvent,{handle:{nodeId:_,id:m,type:e},connectionMode:s,fromNodeId:o.nodeId,fromHandleId:o.id||null,fromType:o.type,isValidConnection:h,flowId:u,doc:p,lib:l,nodeLookup:d});y&&v&&O(v);let b=structuredClone(f);delete b.inProgress,b.toPosition=b.toHandle?b.toHandle.position:null,a?.(t,b),g.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f,children:c})}var YP=(0,H.memo)(mP(JP));function XP({data:e,isConnectable:t,sourcePosition:n=Q.Bottom}){return(0,U.jsxs)(U.Fragment,{children:[e?.label,(0,U.jsx)(YP,{type:`source`,position:n,isConnectable:t})]})}function ZP({data:e,isConnectable:t,targetPosition:n=Q.Top,sourcePosition:r=Q.Bottom}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(YP,{type:`target`,position:n,isConnectable:t}),e?.label,(0,U.jsx)(YP,{type:`source`,position:r,isConnectable:t})]})}function QP(){return null}function $P({data:e,isConnectable:t,targetPosition:n=Q.Top}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(YP,{type:`target`,position:n,isConnectable:t}),e?.label]})}var eF={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},tF={input:XP,default:ZP,output:$P,group:QP};function nF(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}var rF=e=>{let{width:t,height:n,x:r,y:i}=HA(e.nodeLookup,{filter:e=>!!e.selected});return{width:lj(t)?t:null,height:lj(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function iF({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=wN(),{width:i,height:a,transformString:o,userSelectionActive:s}=$(rF,bN),c=RP(),l=(0,H.useRef)(null);(0,H.useEffect)(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(IP({nodeRef:l,disabled:!u}),!u)return null;let d=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return(0,U.jsx)(`div`,{className:Uw([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:o},children:(0,U.jsx)(`div`,{ref:l,className:`react-flow__nodesselection-rect`,onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(eF,e.key)&&(e.preventDefault(),c({direction:eF[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var aF=typeof window<`u`?window:void 0,oF=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function sF({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,paneClickDistance:s,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:h,zoomActivationKeyCode:g,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:b,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:w,autoPanOnSelection:T,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,preventScrolling:A,onSelectionContextMenu:j,noWheelClassName:M,noPanClassName:N,disableKeyboardA11y:P,onViewportChange:F,isControlledViewport:I}){let{nodesSelectionActive:L,userSelectionActive:R}=$(oF,bN),ee=QN(l,{target:aF}),z=QN(h,{target:aF}),B=z||w,te=z||b,V=u&&B!==!0,ne=ee||R||V;return TP({deleteKeyCode:c,multiSelectionKeyCode:m}),(0,U.jsx)(kP,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:te,panActivationKeyPressed:z,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:!ee&&B,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,zoomActivationKeyCode:g,preventScrolling:A,noWheelClassName:M,noPanClassName:N,onViewportChange:F,isControlledViewport:I,paneClickDistance:s,selectionOnDrag:V,children:(0,U.jsxs)(PP,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:B,autoPanOnSelection:T,isSelecting:!!ne,selectionMode:d,selectionKeyPressed:ee,paneClickDistance:s,selectionOnDrag:V,children:[e,L&&(0,U.jsx)(iF,{onSelectionContextMenu:j,noPanClassName:N,disableKeyboardA11y:P})]})})}sF.displayName=`FlowRenderer`;var cF=(0,H.memo)(sF),lF=e=>t=>e?UA(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys());function uF(e){return $((0,H.useCallback)(lF(e),[e]),bN)}var dF=e=>e.updateNodeInternals;function fF(){let e=$(dF),[t]=(0,H.useState)(()=>typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{let n=new Map;t.forEach(e=>{let t=e.target.getAttribute(`data-id`);n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return(0,H.useEffect)(()=>()=>{t?.disconnect()},[t]),t}function pF({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=wN(),a=(0,H.useRef)(null),o=(0,H.useRef)(null),s=(0,H.useRef)(e.sourcePosition),c=(0,H.useRef)(e.targetPosition),l=(0,H.useRef)(t),u=n&&!!e.internals.handleBounds;return(0,H.useEffect)(()=>{a.current&&!e.hidden&&(!u||o.current!==a.current)&&(o.current&&r?.unobserve(o.current),r?.observe(a.current),o.current=a.current)},[u,e.hidden]),(0,H.useEffect)(()=>()=>{o.current&&=(r?.unobserve(o.current),null)},[]),(0,H.useEffect)(()=>{if(a.current){let n=l.current!==t,r=s.current!==e.sourcePosition,o=c.current!==e.targetPosition;(n||r||o)&&(l.current=t,s.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function mF({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:a,onDoubleClick:o,nodesDraggable:s,elementsSelectable:c,nodesConnectable:l,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:p,disableKeyboardA11y:m,rfId:h,nodeTypes:g,nodeClickDistance:_,onError:v}){let{node:y,internals:b,isParent:x}=$(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},bN),S=y.type||`default`,C=g?.[S]||tF[S];C===void 0&&(v?.(`003`,EA.error003(S)),S=`default`,C=g?.default||tF.default);let w=!!(y.draggable||s&&y.draggable===void 0),T=!!(y.selectable||c&&y.selectable===void 0),E=!!(y.connectable||l&&y.connectable===void 0),D=!!(y.focusable||u&&y.focusable===void 0),O=wN(),k=xj(y),A=pF({node:y,nodeType:S,hasDimensions:k,resizeObserver:d}),j=IP({nodeRef:A,disabled:y.hidden||!w,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:_}),M=RP();if(y.hidden)return null;let N=bj(y),P=nF(y),F=T||w||t||n||r||i,I=n?e=>n(e,{...b.userNode}):void 0,L=r?e=>r(e,{...b.userNode}):void 0,R=i?e=>i(e,{...b.userNode}):void 0,ee=a?e=>a(e,{...b.userNode}):void 0,z=o?e=>o(e,{...b.userNode}):void 0,B=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=O.getState();T&&(!r||!w||i>0)&&FP({id:e,store:O,nodeRef:A}),t&&t(n,{...b.userNode})},te=t=>{if(!(jj(t.nativeEvent)||m)){if(OA.includes(t.key)&&T){let n=t.key===`Escape`;FP({id:e,store:O,unselect:n,nodeRef:A})}else if(w&&y.selected&&Object.prototype.hasOwnProperty.call(eF,t.key)){t.preventDefault();let{ariaLabelConfig:e}=O.getState();O.setState({ariaLiveMessage:e[`node.a11yDescription.ariaLiveMessage`]({direction:t.key.replace(`Arrow`,``).toLowerCase(),x:~~b.positionAbsolute.x,y:~~b.positionAbsolute.y})}),M({direction:eF[t.key],factor:t.shiftKey?4:1})}}},V=()=>{if(m||!A.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=O.getState();i&&(UA(new Map([[e,y]]),{x:0,y:0,width:n,height:r},t,!0).length>0||a(y.position.x+N.width/2,y.position.y+N.height/2,{zoom:t[2]}))};return(0,U.jsx)(`div`,{className:Uw([`react-flow__node`,`react-flow__node-${S}`,{[p]:w},y.className,{selected:y.selected,selectable:T,parent:x,draggable:w,dragging:j}]),ref:A,style:{zIndex:b.z,transform:`translate(${b.positionAbsolute.x}px,${b.positionAbsolute.y}px)`,pointerEvents:F?`all`:`none`,visibility:k?`visible`:`hidden`,...y.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:I,onMouseMove:L,onMouseLeave:R,onContextMenu:ee,onClick:B,onDoubleClick:z,onKeyDown:D?te:void 0,tabIndex:D?0:void 0,onFocus:D?V:void 0,role:y.ariaRole??(D?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${DN}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:(0,U.jsx)(BP,{value:e,children:(0,U.jsx)(C,{id:e,data:y.data,type:S,positionAbsoluteX:b.positionAbsolute.x,positionAbsoluteY:b.positionAbsolute.y,selected:y.selected??!1,selectable:T,draggable:w,deletable:y.deletable??!0,isConnectable:E,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:j,dragHandle:y.dragHandle,zIndex:b.z,parentId:y.parentId,...N})})})}var hF=(0,H.memo)(mF),gF=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function _F(e){let{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:i}=$(gF,bN),a=uF(e.onlyRenderVisibleElements),o=fF();return(0,U.jsx)(`div`,{className:`react-flow__nodes`,style:DP,children:a.map(a=>(0,U.jsx)(hF,{id:a,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:o,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:i},a))})}_F.displayName=`NodeRenderer`;var vF=(0,H.memo)(_F);function yF(e){return $((0,H.useCallback)(t=>{if(!e)return t.edges.map(e=>e.id);let n=[];if(t.width&&t.height)for(let e of t.edges){let r=t.nodeLookup.get(e.source),i=t.nodeLookup.get(e.target);r&&i&&Vj({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),bN)}var bF=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e}};return(0,U.jsx)(`polyline`,{className:`arrow`,style:n,strokeLinecap:`round`,fill:`none`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4`})},xF=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e,fill:e}};return(0,U.jsx)(`polyline`,{className:`arrowclosed`,style:n,strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`})},SF={[FA.Arrow]:bF,[FA.ArrowClosed]:xF};function CF(e){let t=wN();return(0,H.useMemo)(()=>Object.prototype.hasOwnProperty.call(SF,e)?SF[e]:(t.getState().onError?.(`009`,EA.error009(e)),null),[e])}var wF=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:a=`strokeWidth`,strokeWidth:o,orient:s=`auto-start-reverse`})=>{let c=CF(t);return c?(0,U.jsx)(`marker`,{className:`react-flow__arrowhead`,id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:`-10 -10 20 20`,markerUnits:a,orient:s,refX:`0`,refY:`0`,children:(0,U.jsx)(c,{color:n,strokeWidth:o})}):null},TF=({defaultColor:e,rfId:t})=>{let n=$(e=>e.edges),r=$(e=>e.defaultEdgeOptions),i=(0,H.useMemo)(()=>iM(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?(0,U.jsx)(`svg`,{className:`react-flow__marker`,"aria-hidden":`true`,children:(0,U.jsx)(`defs`,{children:i.map(e=>(0,U.jsx)(wF,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};TF.displayName=`MarkerDefinitions`;var EF=(0,H.memo)(TF);function DF({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:a,labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:c,className:l,...u}){let[d,f]=(0,H.useState)({x:1,y:0,width:0,height:0}),p=Uw([`react-flow__edge-textwrapper`,l]),m=(0,H.useRef)(null);return(0,H.useEffect)(()=>{if(m.current){let e=m.current.getBBox();f({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?(0,U.jsxs)(`g`,{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?`visible`:`hidden`,...u,children:[i&&(0,U.jsx)(`rect`,{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:`react-flow__edge-textbg`,style:a,rx:s,ry:s}),(0,U.jsx)(`text`,{className:`react-flow__edge-text`,y:d.height/2,dy:`0.3em`,ref:m,style:r,children:n}),c]}):null}DF.displayName=`EdgeText`;var OF=(0,H.memo)(DF);function kF({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{...u,d:e,fill:`none`,className:Uw([`react-flow__edge-path`,u.className])}),l?(0,U.jsx)(`path`,{d:e,fill:`none`,strokeOpacity:0,strokeWidth:l,className:`react-flow__edge-interaction`}):null,r&&lj(t)&&lj(n)?(0,U.jsx)(OF,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function AF({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===Q.Left||e===Q.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function jF({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top}){let[o,s]=AF({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=AF({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=Fj({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:c,targetControlY:l});return[`M${e},${t} C${o},${s} ${c},${l} ${r},${i}`,u,d,f,p]}function MF(e){return(0,H.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o,targetPosition:s,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})=>{let[v,y,b]=jF({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s}),x=e.isInternal?void 0:t;return(0,U.jsx)(kF,{id:x,path:v,labelX:y,labelY:b,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})})}var NF=MF({isInternal:!1}),PF=MF({isInternal:!0});NF.displayName=`SimpleBezierEdge`,PF.displayName=`SimpleBezierEdgeInternal`;function FF(e){return(0,H.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:p=Q.Bottom,targetPosition:m=Q.Top,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=Zj({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition}),S=e.isInternal?void 0:t;return(0,U.jsx)(kF,{id:S,path:y,labelX:b,labelY:x,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:v})})}var IF=FF({isInternal:!1}),LF=FF({isInternal:!0});IF.displayName=`SmoothStepEdge`,LF.displayName=`SmoothStepEdgeInternal`;function RF(e){return(0,H.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,U.jsx)(IF,{...n,id:r,pathOptions:(0,H.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var zF=RF({isInternal:!1}),BF=RF({isInternal:!0});zF.displayName=`StepEdge`,BF.displayName=`StepEdgeInternal`;function VF(e){return(0,H.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})=>{let[g,_,v]=Gj({sourceX:n,sourceY:r,targetX:i,targetY:a}),y=e.isInternal?void 0:t;return(0,U.jsx)(kF,{id:y,path:g,labelX:_,labelY:v,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})})}var HF=VF({isInternal:!1}),UF=VF({isInternal:!0});HF.displayName=`StraightEdge`,UF.displayName=`StraightEdgeInternal`;function WF(e){return(0,H.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=Q.Bottom,targetPosition:s=Q.Top,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=Rj({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature}),S=e.isInternal?void 0:t;return(0,U.jsx)(kF,{id:S,path:y,labelX:b,labelY:x,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:v})})}var GF=WF({isInternal:!1}),KF=WF({isInternal:!0});GF.displayName=`BezierEdge`,KF.displayName=`BezierEdgeInternal`;var qF={default:KF,straight:UF,step:BF,smoothstep:LF,simplebezier:PF},JF={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},YF=(e,t,n)=>n===Q.Left?e-t:n===Q.Right?e+t:e,XF=(e,t,n)=>n===Q.Top?e-t:n===Q.Bottom?e+t:e,ZF=`react-flow__edgeupdater`;function QF({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return(0,U.jsx)(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:Uw([ZF,`${ZF}-${s}`]),cx:YF(t,r,e),cy:XF(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function $F({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:c,onReconnect:l,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:p}){let m=wN(),h=(e,t)=>{if(e.button!==0)return;let{autoPanOnConnect:r,domNode:i,connectionMode:a,connectionRadius:o,lib:s,onConnectStart:c,cancelConnection:p,nodeLookup:h,rfId:g,panBy:_,updateConnection:v}=m.getState(),y=t.type===`target`;RM.onPointerDown(e.nativeEvent,{autoPanOnConnect:r,connectionMode:a,connectionRadius:o,domNode:i,handleId:t.id,nodeId:t.nodeId,nodeLookup:h,isTarget:y,edgeUpdaterType:t.type,lib:s,flowId:g,cancelConnection:p,panBy:_,isValidConnection:(...e)=>m.getState().isValidConnection?.(...e)??!0,onConnect:e=>l?.(n,e),onConnectStart:(r,i)=>{f(!0),u?.(e,n,t.type),c?.(r,i)},onConnectEnd:(...e)=>m.getState().onConnectEnd?.(...e),onReconnectEnd:(e,r)=>{f(!1),d?.(e,n,t.type,r)},updateConnection:v,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},g=e=>h(e,{nodeId:n.target,id:n.targetHandle??null,type:`target`}),_=e=>h(e,{nodeId:n.source,id:n.sourceHandle??null,type:`source`}),v=()=>p(!0),y=()=>p(!1);return(0,U.jsxs)(U.Fragment,{children:[(e===!0||e===`source`)&&(0,U.jsx)(QF,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&(0,U.jsx)(QF,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function eI({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,rfId:m,edgeTypes:h,noPanClassName:g,onError:_,disableKeyboardA11y:v}){let y=$(t=>t.edgeLookup.get(e)),b=$(e=>e.defaultEdgeOptions);y=b?{...b,...y}:y;let x=y.type||`default`,S=h?.[x]||qF[x];S===void 0&&(_?.(`011`,EA.error011(x)),x=`default`,S=h?.default||qF.default);let C=!!(y.focusable||t&&y.focusable===void 0),w=d!==void 0&&(y.reconnectable||n&&y.reconnectable===void 0),T=!!(y.selectable||r&&y.selectable===void 0),E=(0,H.useRef)(null),[D,O]=(0,H.useState)(!1),[k,A]=(0,H.useState)(!1),j=wN(),{zIndex:M=y.zIndex,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:R}=$((0,H.useCallback)(t=>{let n=t.nodeLookup.get(y.source),r=t.nodeLookup.get(y.target);if(!n||!r)return JF;let i=$j({id:e,sourceNode:n,targetNode:r,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:t.connectionMode,onError:_}),a=Bj({selected:y.selected,zIndex:y.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...i||JF,zIndex:a}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex,_]),bN),ee=(0,H.useMemo)(()=>y.markerStart?`url('#${rM(y.markerStart,m)}')`:void 0,[y.markerStart,m]),z=(0,H.useMemo)(()=>y.markerEnd?`url('#${rM(y.markerEnd,m)}')`:void 0,[y.markerEnd,m]);if(y.hidden||N===null||P===null||F===null||I===null)return null;let B=t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:a}=j.getState();T&&(j.setState({nodesSelectionActive:!1}),y.selected&&a?(r({nodes:[],edges:[y]}),E.current?.blur()):n([e])),i&&i(t,y)},te=a?e=>{a(e,{...y})}:void 0,V=o?e=>{o(e,{...y})}:void 0,ne=s?e=>{s(e,{...y})}:void 0,re=c?e=>{c(e,{...y})}:void 0,ie=l?e=>{l(e,{...y})}:void 0;return(0,U.jsx)(`svg`,{style:{zIndex:M},children:(0,U.jsxs)(`g`,{className:Uw([`react-flow__edge`,`react-flow__edge-${x}`,y.className,g,{selected:y.selected,animated:y.animated,inactive:!T&&!i,updating:D,selectable:T}]),onClick:B,onDoubleClick:te,onContextMenu:V,onMouseEnter:ne,onMouseMove:re,onMouseLeave:ie,onKeyDown:C?t=>{if(!v&&OA.includes(t.key)&&T){let{unselectNodesAndEdges:n,addSelectedEdges:r}=j.getState();t.key===`Escape`?(E.current?.blur(),n({edges:[y]})):r([e])}}:void 0,tabIndex:C?0:void 0,role:y.ariaRole??(C?`group`:`img`),"aria-roledescription":`edge`,"data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":C?`${ON}-${m}`:void 0,ref:E,...y.domAttributes,children:[!k&&(0,U.jsx)(S,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:T,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:R,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:ee,markerEnd:z,pathOptions:`pathOptions`in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),w&&(0,U.jsx)($F,{edge:y,isReconnectable:w,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:R,setUpdateHover:O,setReconnecting:A})]})})}var tI=(0,H.memo)(eI),nI=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function rI({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:h}){let{edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,onError:y}=$(nI,bN),b=yF(t);return(0,U.jsxs)(`div`,{className:`react-flow__edges`,children:[(0,U.jsx)(EF,{defaultColor:e,rfId:n}),b.map(e=>(0,U.jsx)(tI,{id:e,edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,noPanClassName:i,onReconnect:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:h},e))]})}rI.displayName=`EdgeRenderer`;var iI=(0,H.memo)(rI),aI=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function oI({children:e}){let t=wN(),n=(0,H.useRef)(null),[r]=(0,H.useState)(()=>t.getState().transform);return hP(()=>{let e=null,r=()=>{let r=t.getState().transform;e&&r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]||(e=r,n.current&&(n.current.style.transform=aI(r)))};return r(),t.subscribe(r)},[t]),(0,U.jsx)(`div`,{ref:n,className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:aI(r)},children:e})}function sI(e){let t=SP(),n=(0,H.useRef)(!1);(0,H.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var cI=e=>e.panZoom?.syncViewport;function lI(e){let t=$(cI),n=wN();return(0,H.useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function uI(e){return e.connection.inProgress?{...e.connection,to:fj(e.connection.to,e.transform)}:{...e.connection}}function dI(e){return e?t=>e(uI(t)):uI}function fI(e){return $(dI(e),bN)}var pI=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function mI({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=$(pI,bN);return a&&i&&c?(0,U.jsx)(`svg`,{style:e,width:a,height:o,className:`react-flow__connectionline react-flow__container`,children:(0,U.jsx)(`g`,{className:Uw([`react-flow__connection`,Ej(s)]),children:(0,U.jsx)(hI,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var hI=({style:e,type:t=PA.Bezier,CustomComponent:n,isValid:r})=>{let{inProgress:i,from:a,fromNode:o,fromHandle:s,fromPosition:c,to:l,toNode:u,toHandle:d,toPosition:f,pointer:p}=fI();if(!i)return;if(n)return(0,U.jsx)(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:s,fromX:a.x,fromY:a.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:f,connectionStatus:Ej(r),toNode:u,toHandle:d,pointer:p});let m=``,h={sourceX:a.x,sourceY:a.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:f};switch(t){case PA.Bezier:[m]=Rj(h);break;case PA.SimpleBezier:[m]=jF(h);break;case PA.Step:[m]=Zj({...h,borderRadius:0});break;case PA.SmoothStep:[m]=Zj(h);break;default:[m]=Gj(h)}return(0,U.jsx)(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};hI.displayName=`ConnectionLine`;var gI={};function _I(e=gI){(0,H.useRef)(e),wN(),(0,H.useEffect)(()=>{},[e])}function vI(){wN(),(0,H.useRef)(!1),(0,H.useEffect)(()=>{},[])}function yI({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:a,onEdgeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:h,connectionLineComponent:g,connectionLineContainerStyle:_,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,deleteKeyCode:w,onlyRenderVisibleElements:T,elementsSelectable:E,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,preventScrolling:j,defaultMarkerColor:M,zoomOnScroll:N,zoomOnPinch:P,panOnScroll:F,panOnScrollSpeed:I,panOnScrollMode:L,zoomOnDoubleClick:R,panOnDrag:ee,autoPanOnSelection:z,onPaneClick:B,onPaneMouseEnter:te,onPaneMouseMove:V,onPaneMouseLeave:ne,onPaneScroll:re,onPaneContextMenu:ie,paneClickDistance:ae,nodeClickDistance:oe,onEdgeContextMenu:se,onEdgeMouseEnter:ce,onEdgeMouseMove:le,onEdgeMouseLeave:ue,reconnectRadius:de,onReconnect:fe,onReconnectStart:pe,onReconnectEnd:me,noDragClassName:he,noWheelClassName:ge,noPanClassName:_e,disableKeyboardA11y:ve,nodeExtent:ye,rfId:be,viewport:xe,onViewportChange:Se,nodesDraggable:Ce}){return _I(e),_I(t),vI(),sI(n),lI(xe),(0,U.jsx)(cF,{onPaneClick:B,onPaneMouseEnter:te,onPaneMouseMove:V,onPaneMouseLeave:ne,onPaneContextMenu:ie,onPaneScroll:re,paneClickDistance:ae,deleteKeyCode:w,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,elementsSelectable:E,zoomOnScroll:N,zoomOnPinch:P,zoomOnDoubleClick:R,panOnScroll:F,panOnScrollSpeed:I,panOnScrollMode:L,panOnDrag:ee,autoPanOnSelection:z,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,onSelectionContextMenu:d,preventScrolling:j,noDragClassName:he,noWheelClassName:ge,noPanClassName:_e,disableKeyboardA11y:ve,onViewportChange:Se,isControlledViewport:!!xe,children:(0,U.jsxs)(oI,{children:[(0,U.jsx)(iI,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:fe,onReconnectStart:pe,onReconnectEnd:me,onlyRenderVisibleElements:T,onEdgeContextMenu:se,onEdgeMouseEnter:ce,onEdgeMouseMove:le,onEdgeMouseLeave:ue,reconnectRadius:de,defaultMarkerColor:M,noPanClassName:_e,disableKeyboardA11y:ve,rfId:be}),(0,U.jsx)(mI,{style:h,type:m,component:g,containerStyle:_}),(0,U.jsx)(`div`,{className:`react-flow__edgelabel-renderer`}),(0,U.jsx)(vF,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:oe,onlyRenderVisibleElements:T,noPanClassName:_e,noDragClassName:he,disableKeyboardA11y:ve,nodeExtent:ye,rfId:be,nodesDraggable:Ce}),(0,U.jsx)(`div`,{className:`react-flow__viewport-portal`})]})})}yI.displayName=`GraphView`;var bI=(0,H.memo)(yI),xI=uj(`React Flow`,`https://reactflow.dev/`),SI=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c=.5,maxZoom:l=2,nodeOrigin:u,nodeExtent:d,zIndexMode:f=`basic`}={})=>{let p=new Map,m=new Map,h=new Map,g=new Map,_=r??t??[],v=n??e??[],y=u??[0,0],b=d??DA;SM(h,g,_);let{nodesInitialized:x}=pM(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=_j(HA(p,{filter:e=>!!((e.width||e.initialWidth)&&(e.height||e.initialHeight))}),i,a,c,l,s?.padding??.1);S=[e,t,n]}return{rfId:`1`,width:i??0,height:a??0,transform:S,nodes:v,nodesInitialized:x,nodeLookup:p,parentLookup:m,edges:_,edgeLookup:g,connectionLookup:h,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:DA,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:AA.Strict,domNode:null,paneDragging:!1,noPanClassName:`nopan`,nodeOrigin:y,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:s,fitViewResolver:null,connection:{...NA},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:xI,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:kA,zIndexMode:f,defaultEdgeOptions:void 0,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map,onNodesDelete:void 0,onEdgesDelete:void 0,onDelete:void 0,onBeforeDelete:void 0,onViewportChangeStart:void 0,onViewportChange:void 0,onViewportChangeEnd:void 0,onNodeDragStart:void 0,onNodeDrag:void 0,onNodeDragStop:void 0,onSelectionDragStart:void 0,onSelectionDrag:void 0,onSelectionDragStop:void 0,onMoveStart:void 0,onMove:void 0,onMoveEnd:void 0,onConnect:void 0,onConnectStart:void 0,onConnectEnd:void 0,onClickConnectStart:void 0,onClickConnectEnd:void 0}},CI=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f})=>yN((p,m)=>{async function h(){let{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:r,width:i,height:a,minZoom:o,maxZoom:s}=m();t&&(await KA({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{...SI({nodes:e,edges:t,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:e=>{let{nodeLookup:t,parentLookup:n,nodeOrigin:r,nodeExtent:i,elevateNodesOnSelect:a,fitViewQueued:o,zIndexMode:s,nodesSelectionActive:c}=m(),{nodesInitialized:l,hasSelectedNodes:u}=pM(e,t,n,{nodeOrigin:r,nodeExtent:i,elevateNodesOnSelect:a,checkEquality:!0,zIndexMode:s}),d=c&&u;o&&l?(h(),p({nodes:e,nodesInitialized:l,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:d})):p({nodes:e,nodesInitialized:l,nodesSelectionActive:d})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=m();SM(t,n,e),p({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){let{setNodes:t}=m();t(e),p({hasDefaultNodes:!0})}if(t){let{setEdges:e}=m();e(t),p({hasDefaultEdges:!0})}},updateNodeInternals:e=>{let{triggerNodeChanges:t,nodeLookup:n,parentLookup:r,domNode:i,nodeOrigin:a,nodeExtent:o,debug:s,fitViewQueued:c,zIndexMode:l}=m(),{changes:u,updatedInternals:d}=yM(e,n,r,i,a,o,l);d&&(uM(n,r,{nodeOrigin:a,nodeExtent:o,zIndexMode:l}),c?(h(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),u?.length>0&&(s&&console.log(`React Flow: trigger node changes`,u),t?.(u)))},updateNodePositions:(e,t=!1)=>{let n=[],r=[],{nodeLookup:i,triggerNodeChanges:a,connection:o,updateConnection:s,onNodesChangeMiddlewareMap:c}=m();for(let[a,c]of e){let e=i.get(a),l=!!(e?.expandParent&&e?.parentId&&c?.position),u={id:a,type:`position`,position:l?{x:Math.max(0,c.position.x),y:Math.max(0,c.position.y)}:c.position,dragging:t};if(e&&o.inProgress&&o.fromNode.id===e.id){let t=tM(e,o.fromHandle,Q.Left,!0);s({...o,from:t})}l&&e.parentId&&n.push({id:a,parentId:e.parentId,rect:{...c.internals.positionAbsolute,width:c.measured.width??0,height:c.measured.height??0}}),r.push(u)}if(n.length>0){let{parentLookup:e,nodeOrigin:t}=m(),a=vM(n,i,e,t);r.push(...a)}for(let e of c.values())r=e(r);a(r)},triggerNodeChanges:e=>{let{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:i,debug:a}=m();e?.length&&(i&&n(iP(e,r)),a&&console.log(`React Flow: trigger node changes`,e),t?.(e))},triggerEdgeChanges:e=>{let{onEdgesChange:t,setEdges:n,edges:r,hasDefaultEdges:i,debug:a}=m();e?.length&&(i&&n(aP(e,r)),a&&console.log(`React Flow: trigger edge changes`,e),t?.(e))},addSelectedNodes:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){i(e.map(e=>oP(e,!0)));return}i(sP(r,new Set([...e]),!0)),a(sP(n))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){a(e.map(e=>oP(e,!0)));return}a(sP(n,new Set([...e]))),i(sP(r,new Set,!0))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{let{edges:n,nodes:r,nodeLookup:i,triggerNodeChanges:a,triggerEdgeChanges:o}=m(),s=e||r,c=t||n,l=[];for(let e of s){if(!e.selected)continue;let t=i.get(e.id);t&&(t.selected=!1),l.push(oP(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(oP(e.id,!1));a(l),o(u)},setMinZoom:e=>{let{panZoom:t,maxZoom:n}=m();t?.setScaleExtent([e,n]),p({minZoom:e})},setMaxZoom:e=>{let{panZoom:t,minZoom:n}=m();t?.setScaleExtent([n,e]),p({maxZoom:e})},setTranslateExtent:e=>{m().panZoom?.setTranslateExtent(e),p({translateExtent:e})},resetSelectedElements:()=>{let{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:i}=m();if(!i)return;let a=t.reduce((e,t)=>t.selected?[...e,oP(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,oP(t.id,!1)]:e,[]);n(a),r(o)},setNodeExtent:e=>{let{nodes:t,nodeLookup:n,parentLookup:r,nodeOrigin:i,elevateNodesOnSelect:a,nodeExtent:o,zIndexMode:s}=m();(e[0][0]!==o[0][0]||e[0][1]!==o[0][1]||e[1][0]!==o[1][0]||e[1][1]!==o[1][1])&&(pM(t,n,r,{nodeOrigin:i,nodeExtent:e,elevateNodesOnSelect:a,checkEquality:!1,zIndexMode:s}),p({nodeExtent:e}))},panBy:e=>{let{transform:t,width:n,height:r,panZoom:i,translateExtent:a}=m();return bM({delta:e,panZoom:i,transform:t,translateExtent:a,width:n,height:r})},setCenter:async(e,t,n)=>{let{width:r,height:i,maxZoom:a,panZoom:o}=m();if(!o)return!1;let s=n?.zoom===void 0?a:n.zoom;return await o.setViewport({x:r/2-e*s,y:i/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},cancelConnection:()=>{p({connection:{...NA}})},updateConnection:e=>{p({connection:e})},reset:()=>p({...SI()})}},Object.is);function wI({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:a,initialMinZoom:o,initialMaxZoom:s,initialFitViewOptions:c,fitView:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f,children:p}){let[m]=(0,H.useState)(()=>CI({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:l,minZoom:o,maxZoom:s,fitViewOptions:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f}));return(0,U.jsx)(SN,{value:m,children:(0,U.jsx)(yP,{children:(0,U.jsx)(WP,{children:p})})})}function TI({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:a,height:o,fitView:s,fitViewOptions:c,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p}){return(0,H.useContext)(xN)?(0,U.jsx)(U.Fragment,{children:e}):(0,U.jsx)(wI,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:o,fitView:s,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p,children:e})}var EI={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function DI({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:a,edgeTypes:o,onNodeClick:s,onEdgeClick:c,onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onSelectionChange:k,onSelectionDragStart:A,onSelectionDrag:j,onSelectionDragStop:M,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:F,onBeforeDelete:I,connectionMode:L,connectionLineType:R=PA.Bezier,connectionLineStyle:ee,connectionLineComponent:z,connectionLineContainerStyle:B,deleteKeyCode:te=`Backspace`,selectionKeyCode:V=`Shift`,selectionOnDrag:ne=!1,selectionMode:re=MA.Full,panActivationKeyCode:ie=`Space`,multiSelectionKeyCode:ae=vj()?`Meta`:`Control`,zoomActivationKeyCode:oe=vj()?`Meta`:`Control`,snapToGrid:se,snapGrid:ce,onlyRenderVisibleElements:le=!1,selectNodesOnDrag:ue,nodesDraggable:de,autoPanOnNodeFocus:fe,nodesConnectable:pe,nodesFocusable:me,nodeOrigin:he=UN,edgesFocusable:ge,edgesReconnectable:_e,elementsSelectable:ve=!0,defaultViewport:ye=WN,minZoom:be=.5,maxZoom:xe=2,translateExtent:Se=DA,preventScrolling:Ce=!0,nodeExtent:we,defaultMarkerColor:Te=`#b1b1b7`,zoomOnScroll:Ee=!0,zoomOnPinch:De=!0,panOnScroll:Oe=!1,panOnScrollSpeed:ke=.5,panOnScrollMode:Ae=jA.Free,zoomOnDoubleClick:je=!0,panOnDrag:Me=!0,onPaneClick:Ne,onPaneMouseEnter:Pe,onPaneMouseMove:Fe,onPaneMouseLeave:Ie,onPaneScroll:Le,onPaneContextMenu:Re,paneClickDistance:ze=1,nodeClickDistance:Be=0,children:Ve,onReconnect:He,onReconnectStart:Ue,onReconnectEnd:We,onEdgeContextMenu:Ge,onEdgeDoubleClick:Ke,onEdgeMouseEnter:qe,onEdgeMouseMove:Je,onEdgeMouseLeave:Ye,reconnectRadius:Xe=10,onNodesChange:Ze,onEdgesChange:Qe,noDragClassName:$e=`nodrag`,noWheelClassName:et=`nowheel`,noPanClassName:tt=`nopan`,fitView:nt,fitViewOptions:rt,connectOnClick:it,attributionPosition:at,proOptions:ot,defaultEdgeOptions:st,elevateNodesOnSelect:ct=!0,elevateEdgesOnSelect:lt=!1,disableKeyboardA11y:ut=!1,autoPanOnConnect:dt,autoPanOnNodeDrag:ft,autoPanOnSelection:pt=!0,autoPanSpeed:mt,connectionRadius:ht,isValidConnection:gt,onError:_t,style:vt,id:yt,nodeDragThreshold:bt,connectionDragThreshold:xt,viewport:St,onViewportChange:Ct,width:wt,height:Tt,colorMode:Et=`light`,debug:Dt,onScroll:Ot,ariaLabelConfig:kt,zIndexMode:At=`basic`,...jt},Mt){let Nt=yt||`1`,Pt=XN(Et),Ft=(0,H.useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:`instant`}),Ot?.(e)},[Ot]);return(0,U.jsx)(`div`,{"data-testid":`rf__wrapper`,...jt,onScroll:Ft,style:{...vt,...EI},ref:Mt,className:Uw([`react-flow`,i,Pt]),id:yt,role:`application`,children:(0,U.jsxs)(TI,{nodes:e,edges:t,width:wt,height:Tt,fitView:nt,fitViewOptions:rt,minZoom:be,maxZoom:xe,nodeOrigin:he,nodeExtent:we,zIndexMode:At,children:[(0,U.jsx)(JN,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:de,autoPanOnNodeFocus:fe,nodesConnectable:pe,nodesFocusable:me,edgesFocusable:ge,edgesReconnectable:_e,elementsSelectable:ve,elevateNodesOnSelect:ct,elevateEdgesOnSelect:lt,minZoom:be,maxZoom:xe,nodeExtent:we,onNodesChange:Ze,onEdgesChange:Qe,snapToGrid:se,snapGrid:ce,connectionMode:L,translateExtent:Se,connectOnClick:it,defaultEdgeOptions:st,fitView:nt,fitViewOptions:rt,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onSelectionDrag:j,onSelectionDragStart:A,onSelectionDragStop:M,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:tt,nodeOrigin:he,rfId:Nt,autoPanOnConnect:dt,autoPanOnNodeDrag:ft,autoPanSpeed:mt,onError:_t,connectionRadius:ht,isValidConnection:gt,selectNodesOnDrag:ue,nodeDragThreshold:bt,connectionDragThreshold:xt,onBeforeDelete:I,debug:Dt,ariaLabelConfig:kt,zIndexMode:At}),(0,U.jsx)(bI,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:R,connectionLineStyle:ee,connectionLineComponent:z,connectionLineContainerStyle:B,selectionKeyCode:V,selectionOnDrag:ne,selectionMode:re,deleteKeyCode:te,multiSelectionKeyCode:ae,panActivationKeyCode:ie,zoomActivationKeyCode:oe,onlyRenderVisibleElements:le,defaultViewport:ye,translateExtent:Se,minZoom:be,maxZoom:xe,preventScrolling:Ce,zoomOnScroll:Ee,zoomOnPinch:De,zoomOnDoubleClick:je,panOnScroll:Oe,panOnScrollSpeed:ke,panOnScrollMode:Ae,panOnDrag:Me,autoPanOnSelection:pt,onPaneClick:Ne,onPaneMouseEnter:Pe,onPaneMouseMove:Fe,onPaneMouseLeave:Ie,onPaneScroll:Le,onPaneContextMenu:Re,paneClickDistance:ze,nodeClickDistance:Be,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:F,onReconnect:He,onReconnectStart:Ue,onReconnectEnd:We,onEdgeContextMenu:Ge,onEdgeDoubleClick:Ke,onEdgeMouseEnter:qe,onEdgeMouseMove:Je,onEdgeMouseLeave:Ye,reconnectRadius:Xe,defaultMarkerColor:Te,noDragClassName:$e,noWheelClassName:et,noPanClassName:tt,rfId:Nt,disableKeyboardA11y:ut,nodeExtent:we,viewport:St,onViewportChange:Ct,nodesDraggable:de}),(0,U.jsx)(HN,{onSelectionChange:k}),Ve,(0,U.jsx)(IN,{proOptions:ot,position:at}),(0,U.jsx)(NN,{rfId:Nt,disableKeyboardA11y:ut})]})})}var OI=mP(DI);EA.error014();function kI({dimensions:e,lineWidth:t,variant:n,className:r}){return(0,U.jsx)(`path`,{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Uw([`react-flow__background-pattern`,n,r])})}function AI({radius:e,className:t}){return(0,U.jsx)(`circle`,{cx:e,cy:e,r:e,className:Uw([`react-flow__background-pattern`,`dots`,t])})}var jI;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(jI||={});var MI={[jI.Dots]:1,[jI.Lines]:1,[jI.Cross]:6},NI=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function PI({id:e,variant:t=jI.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=0,color:o,bgColor:s,style:c,className:l,patternClassName:u}){let d=(0,H.useRef)(null),{transform:f,patternId:p}=$(NI,bN),m=r||MI[t],h=t===jI.Dots,g=t===jI.Cross,_=Array.isArray(n)?n:[n,n],v=[_[0]*f[2]||1,_[1]*f[2]||1],y=m*f[2],b=Array.isArray(a)?a:[a,a],x=g?[y,y]:v,S=[b[0]*f[2]+x[0]/2,b[1]*f[2]+x[1]/2],C=`${p}${e||``}`;return(0,U.jsxs)(`svg`,{className:Uw([`react-flow__background`,l]),style:{...c,...DP,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:d,"data-testid":`rf__background`,children:[(0,U.jsx)(`pattern`,{id:C,x:f[0]%v[0],y:f[1]%v[1],width:v[0],height:v[1],patternUnits:`userSpaceOnUse`,patternTransform:`translate(-${S[0]},-${S[1]})`,children:h?(0,U.jsx)(AI,{radius:y/2,className:u}):(0,U.jsx)(kI,{dimensions:x,lineWidth:i,variant:t,className:u})}),(0,U.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${C})`})]})}PI.displayName=`Background`;var FI=(0,H.memo)(PI);function II(){return(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,children:(0,U.jsx)(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`})})}function LI(){return(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`,children:(0,U.jsx)(`path`,{d:`M0 0h32v4.2H0z`})})}function RI(){return(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`,children:(0,U.jsx)(`path`,{d:`M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z`})})}function zI(){return(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,U.jsx)(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z`})})}function BI(){return(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,U.jsx)(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z`})})}function VI({children:e,className:t,...n}){return(0,U.jsx)(`button`,{type:`button`,className:Uw([`react-flow__controls-button`,t]),...n,children:e})}var HI=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function UI({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:c,className:l,children:u,position:d=`bottom-left`,orientation:f=`vertical`,"aria-label":p}){let m=wN(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=$(HI,bN),{zoomIn:y,zoomOut:b,fitView:x}=SP();return(0,U.jsxs)(PN,{className:Uw([`react-flow__controls`,f===`horizontal`?`horizontal`:`vertical`,l]),position:d,style:e,"data-testid":`rf__controls`,"aria-label":p??v[`controls.ariaLabel`],children:[t&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(VI,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:(0,U.jsx)(II,{})}),(0,U.jsx)(VI,{onClick:()=>{b(),o?.()},className:`react-flow__controls-zoomout`,title:v[`controls.zoomOut.ariaLabel`],"aria-label":v[`controls.zoomOut.ariaLabel`],disabled:g,children:(0,U.jsx)(LI,{})})]}),n&&(0,U.jsx)(VI,{className:`react-flow__controls-fitview`,onClick:()=>{x(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:(0,U.jsx)(RI,{})}),r&&(0,U.jsx)(VI,{className:`react-flow__controls-interactive`,onClick:()=>{m.setState({nodesDraggable:!h,nodesConnectable:!h,elementsSelectable:!h}),c?.(!h)},title:v[`controls.interactive.ariaLabel`],"aria-label":v[`controls.interactive.ariaLabel`],children:h?(0,U.jsx)(BI,{}):(0,U.jsx)(zI,{})}),u]})}UI.displayName=`Controls`;var WI=(0,H.memo)(UI);function GI({id:e,x:t,y:n,width:r,height:i,style:a,color:o,strokeColor:s,strokeWidth:c,className:l,borderRadius:u,shapeRendering:d,selected:f,onClick:p}){let{background:m,backgroundColor:h}=a||{},g=o||m||h;return(0,U.jsx)(`rect`,{className:Uw([`react-flow__minimap-node`,{selected:f},l]),x:t,y:n,rx:u,ry:u,width:r,height:i,style:{fill:g,stroke:s,strokeWidth:c},shapeRendering:d,onClick:p?t=>p(t,e):void 0})}var KI=(0,H.memo)(GI),qI=e=>e.nodes.map(e=>e.id),JI=e=>e instanceof Function?e:()=>e;function YI({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=KI,onClick:o}){let s=$(qI,bN),c=JI(t),l=JI(e),u=JI(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return(0,U.jsx)(U.Fragment,{children:s.map(e=>(0,U.jsx)(ZI,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function XI({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:o,NodeComponent:s,onClick:c}){let{node:l,x:u,y:d,width:f,height:p}=$(t=>{let n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};let r=n.internals.userNode,{x:i,y:a}=n.internals.positionAbsolute,{width:o,height:s}=bj(r);return{node:r,x:i,y:a,width:o,height:s}},bN);return!l||l.hidden||!xj(l)?null:(0,U.jsx)(s,{x:u,y:d,width:f,height:p,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:i,strokeColor:n(l),strokeWidth:a,shapeRendering:o,onClick:c,id:l.id})}var ZI=(0,H.memo)(XI),QI=(0,H.memo)(YI),$I=200,eL=150,tL=e=>!e.hidden,nL=e=>{let t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]},n=!1;for(let t of e.nodeLookup.values())if(!t.hidden){n=!0;break}return{viewBB:t,boundingRect:n?aj(HA(e.nodeLookup,{filter:tL}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},rL=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,iL=(e,t)=>rL(e.viewBB,t.viewBB)&&rL(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig,aL=`react-flow__minimap-desc`;function oL({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i=``,nodeBorderRadius:a=5,nodeStrokeWidth:o,nodeComponent:s,bgColor:c,maskColor:l,maskStrokeColor:u,maskStrokeWidth:d,position:f=`bottom-right`,onClick:p,onNodeClick:m,pannable:h=!1,zoomable:g=!1,ariaLabel:_,inversePan:v,zoomStep:y=1,offsetScale:b=5}){let x=wN(),S=(0,H.useRef)(null),{boundingRect:C,panZoom:w,viewBB:T,rfId:E,translateExtent:D,flowWidth:O,flowHeight:k,ariaLabelConfig:A}=$(nL,iL),j=e?.width??$I,M=e?.height??eL,N=C.width/j,P=C.height/M,F=Math.max(N,P),I=F*j,L=F*M,R=b*F,ee=C.x-(I-C.width)/2-R,z=C.y-(L-C.height)/2-R,B=I+R*2,te=L+R*2,V=`${aL}-${E}`,ne=(0,H.useRef)(0),re=(0,H.useRef)();ne.current=F,(0,H.useEffect)(()=>{let e=x.getState().panZoom;if(S.current&&e)return re.current=zM({domNode:S.current,panZoom:e,getTransform:()=>x.getState().transform,getViewScale:()=>ne.current}),()=>{re.current?.destroy()}},[w]),(0,H.useEffect)(()=>{re.current?.update({translateExtent:D,width:O,height:k,inversePan:v,pannable:h,zoomStep:y,zoomable:g})},[h,g,v,y,D,O,k]);let ie=p?e=>{let[t,n]=re.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,ae=(0,H.useCallback)((e,t)=>{let n=x.getState().nodeLookup.get(t).internals.userNode;m?.(e,n)},[m]),oe=m?ae:void 0,se=_??A[`minimap.ariaLabel`];return(0,U.jsx)(PN,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c==`string`?c:void 0,"--xy-minimap-mask-background-color-props":typeof l==`string`?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof u==`string`?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d==`number`?d*F:void 0,"--xy-minimap-node-background-color-props":typeof r==`string`?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n==`string`?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o==`number`?o:void 0},className:Uw([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:(0,U.jsxs)(`svg`,{width:j,height:M,viewBox:`${ee} ${z} ${B} ${te}`,className:`react-flow__minimap-svg`,role:`img`,"aria-labelledby":V,ref:S,onClick:ie,children:[se&&(0,U.jsx)(`title`,{id:V,children:se}),(0,U.jsx)(QI,{onClick:oe,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),(0,U.jsx)(`path`,{className:`react-flow__minimap-mask`,d:`M${ee-R},${z-R}h${B+R*2}v${te+R*2}h${-B-R*2}z
|
|
146
|
-
M${T.x},${T.y}h${T.width}v${T.height}h${-T.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}oL.displayName=`MiniMap`,(0,H.memo)(oL);var sL=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,cL={[eN.Line]:`right`,[eN.Handle]:`bottom-right`};function lL({nodeId:e,position:t,variant:n=eN.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:g,onResizeEnd:_}){let v=VP(),y=typeof e==`string`?e:v,b=wN(),x=(0,H.useRef)(null),S=n===eN.Handle,C=$((0,H.useCallback)(sL(S&&p),[S,p]),bN),w=(0,H.useRef)(null),T=t??cL[n];(0,H.useEffect)(()=>{if(!(!x.current||!y))return w.current||=dN({domNode:x.current,nodeId:y,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=b.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=b.getState(),o=[],s={x:e.x,y:e.y},c=r.get(y);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=vM([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...Sj({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:y,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:y,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:y,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};b.getState().triggerNodeChanges([n])}}),w.current.update({controlPosition:T,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{w.current?.destroy()}},[T,s,c,l,u,d,h,g,_,m]);let E=T.split(`-`);return(0,U.jsx)(`div`,{className:Uw([`react-flow__resize-control`,`nodrag`,...E,n,r]),ref:x,style:{...i,scale:C,...o&&{[S?`backgroundColor`:`borderColor`]:o}},children:a})}(0,H.memo)(lL);var uL={workflow:gL,loop:hL},dL=[],fL={padding:.08,maxZoom:1},pL=[`true`,`false`,`failure`,`timeout`],mL=[`success`,`failure`,`timeout`];function hL({data:e}){return(0,U.jsx)(`div`,{className:`workflow-loop h-full rounded-lg border border-primary/40 bg-primary/5 p-3 text-xs`,"data-orientation":e.orientation,children:(0,U.jsxs)(`div`,{className:`workflow-loop__summary`,children:[(0,U.jsxs)(`div`,{className:`workflow-loop__heading nodrag nopan`,children:[(0,U.jsxs)(`strong`,{title:e.title,className:`line-clamp-2 min-w-0 text-sm`,children:[`Loop · `,e.title]}),(0,U.jsx)(`span`,{className:`shrink-0`,children:`Max tries`}),(0,U.jsxs)(At,{value:e.maxTries,disabled:!e.change,onValueChange:t=>t!==null&&e.change?.(t),children:[(0,U.jsx)(It,{size:`sm`,"aria-label":`Max tries · ${e.title}`,children:(0,U.jsx)(_t,{children:e.maxTries})}),(0,U.jsx)(Pt,{children:Array.from({length:100},(e,t)=>(0,U.jsx)(mt,{value:t+1,children:t+1},t+1))})]})]}),(0,U.jsx)(`p`,{className:`mt-1 text-muted-foreground`,children:e.progress??`First check included. Inner limits reset on each outer try.`})]})})}function gL({data:e}){let{step:t}=e,n=t.kind===`branch`?pL:mL,r=e.vertical?Q.Bottom:Q.Right;return(0,U.jsxs)(`div`,{"data-status":e.status,"data-orientation":e.vertical?`vertical`:`horizontal`,className:`workflow-step relative rounded-lg border bg-card p-3 text-xs text-card-foreground`,style:{width:208,height:192},children:[(0,U.jsx)(YP,{type:`target`,position:e.vertical?Q.Top:Q.Left}),(0,U.jsx)(`strong`,{title:t.name,className:`block text-sm font-semibold ${e.execution?`line-clamp-2 whitespace-normal`:`truncate`}`,children:t.name}),(0,U.jsxs)(`div`,{className:`text-muted-foreground`,children:[t.kind,` · `,e.permission]}),e.status&&(0,U.jsx)(`div`,{children:e.status.replaceAll(`-`,` `)}),(0,U.jsx)(`div`,{className:`workflow-step__outcomes ${e.vertical?`workflow-step__outcomes--vertical`:`workflow-step__outcomes--horizontal`}`,children:n.map(e=>(0,U.jsxs)(`div`,{className:`workflow-step__outcome`,"data-outcome":e,children:[(0,U.jsx)(`span`,{children:e}),(0,U.jsx)(YP,{id:e,type:`source`,position:r})]},e))})]})}function _L({definition:e,onChange:t,onSelect:n,execution:r,awaitingSteps:i=dL,selectedStepId:a,orientation:o=`horizontal`}){let[s,c]=(0,H.useState)([]),[l,u]=(0,H.useState)([]),d=a!==void 0,f=(0,H.useCallback)(({nodes:e})=>{let t=e.find(e=>e.type===`workflow`);t?n(t.id):d||n(``)},[n,d]),p=r?.id??e,m=(0,H.useMemo)(()=>{let t;try{t=Fw(r?Hw(e,o===`vertical`):e,{orientation:o})}catch{t=e.steps.map((e,t)=>({id:e.id,type:`workflow`,position:e.position??Nw(t),data:{step:e}}))}return{layout:t,edges:e.edges.map(e=>({id:e.id,source:e.from,target:e.to,sourceHandle:e.outcome,label:e.outcome,zIndex:0})),steps:new Map(e.steps.map(e=>[e.id,e]))}},[p,e.id,o]);return(0,H.useEffect)(()=>{let n=new Set(i);c(i=>{let s=new Map(i.map(e=>[e.id,e]));return m.layout.map(i=>{if(i.type===`loop`){let n=i.data.headerId,a=e.loopSettings?.[n]?.maxTries??3;return{...i,data:{title:m.steps.get(n).name,maxTries:a,orientation:o,progress:r?.loops?.[n]?Lw(r.loops[n],a):void 0,change:t?r=>t({...e,loopSettings:{...e.loopSettings,[n]:{maxTries:r}}}):void 0}}}let c=i.data.step;return{...i,selected:a===void 0?s.get(c.id)?.selected:a===c.id,data:{step:c,vertical:!!r&&o===`vertical`,execution:!!r,permission:c.permission??e.permission??`auto-accept`,status:n.has(c.id)?`awaiting-input`:r?.steps[c.id]?.status}}})})},[m,r,a,i,e,t,o]),(0,H.useEffect)(()=>{u(e=>{let t=new Set(e.filter(e=>e.selected).map(e=>e.id));return m.edges.map(e=>({...e,selected:t.has(e.id)}))})},[m]),(0,U.jsx)(`div`,{className:`workflow-canvas overflow-hidden rounded-lg border`,children:(0,U.jsxs)(OI,{nodes:s,edges:l,nodeTypes:uL,onNodesChange:e=>c(t=>iP(e,t)),onEdgesChange:e=>u(t=>aP(e,t)),onConnect:n=>{n.source&&n.target&&t?.({...e,edges:[...e.edges,{id:crypto.randomUUID(),from:n.source,to:n.target,outcome:n.sourceHandle??`success`}]})},onNodeClick:(e,t)=>t.type===`workflow`&&n(t.id),onPaneClick:t&&d?()=>n(``):void 0,onSelectionChange:r||d?void 0:f,onNodeDragStop:(n,r,i)=>t?.({...e,steps:e.steps.map(e=>{let t=(i.length?i:[r]).find(t=>t.id===e.id);return t?{...e,position:Iw(t,s)}:e})}),onDelete:({nodes:n,edges:r})=>t?.(Pw({...e,steps:e.steps.filter(e=>!n.some(t=>t.type===`workflow`&&t.id===e.id)),edges:e.edges.filter(e=>!r.some(t=>t.id===e.id)&&!n.some(t=>t.type===`workflow`&&(t.id===e.from||t.id===e.to)))})),nodesDraggable:!!t,nodesConnectable:!!t,deleteKeyCode:t?[`Backspace`,`Delete`]:null,defaultViewport:{x:32,y:e.loopSettings&&Object.keys(e.loopSettings).length?120:24,zoom:1},minZoom:r?Vw:Bw,fitView:!0,fitViewOptions:fL,zIndexMode:`manual`,children:[(0,U.jsx)(FI,{}),(0,U.jsx)(WI,{fitViewOptions:fL})]})})}export{Qa as $,_l as A,jr as At,Ao as B,bn as Bt,HC as C,$r as Ct,AC as D,Vr as Dt,IC as E,Gr as Et,Dc as F,Pn as Ft,co as G,tn as Gt,Do as H,rn as Ht,Ho as I,jn as It,eo as J,Zt as Jt,Za as K,en as Kt,Ro as L,On as Lt,il as M,zn as Mt,tl as N,In as Nt,Ul as O,Br as Ot,Wc as P,Fn as Pt,no as Q,
|
|
146
|
+
M${T.x},${T.y}h${T.width}v${T.height}h${-T.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}oL.displayName=`MiniMap`,(0,H.memo)(oL);var sL=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,cL={[eN.Line]:`right`,[eN.Handle]:`bottom-right`};function lL({nodeId:e,position:t,variant:n=eN.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:g,onResizeEnd:_}){let v=VP(),y=typeof e==`string`?e:v,b=wN(),x=(0,H.useRef)(null),S=n===eN.Handle,C=$((0,H.useCallback)(sL(S&&p),[S,p]),bN),w=(0,H.useRef)(null),T=t??cL[n];(0,H.useEffect)(()=>{if(!(!x.current||!y))return w.current||=dN({domNode:x.current,nodeId:y,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=b.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=b.getState(),o=[],s={x:e.x,y:e.y},c=r.get(y);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=vM([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...Sj({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:y,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:y,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:y,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};b.getState().triggerNodeChanges([n])}}),w.current.update({controlPosition:T,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{w.current?.destroy()}},[T,s,c,l,u,d,h,g,_,m]);let E=T.split(`-`);return(0,U.jsx)(`div`,{className:Uw([`react-flow__resize-control`,`nodrag`,...E,n,r]),ref:x,style:{...i,scale:C,...o&&{[S?`backgroundColor`:`borderColor`]:o}},children:a})}(0,H.memo)(lL);var uL={workflow:gL,loop:hL},dL=[],fL={padding:.08,maxZoom:1},pL=[`true`,`false`,`failure`,`timeout`],mL=[`success`,`failure`,`timeout`];function hL({data:e}){return(0,U.jsx)(`div`,{className:`workflow-loop h-full rounded-lg border border-primary/40 bg-primary/5 p-3 text-xs`,"data-orientation":e.orientation,children:(0,U.jsxs)(`div`,{className:`workflow-loop__summary`,children:[(0,U.jsxs)(`div`,{className:`workflow-loop__heading nodrag nopan`,children:[(0,U.jsxs)(`strong`,{title:e.title,className:`line-clamp-2 min-w-0 text-sm`,children:[`Loop · `,e.title]}),(0,U.jsx)(`span`,{className:`shrink-0`,children:`Max tries`}),(0,U.jsxs)(At,{value:e.maxTries,disabled:!e.change,onValueChange:t=>t!==null&&e.change?.(t),children:[(0,U.jsx)(It,{size:`sm`,"aria-label":`Max tries · ${e.title}`,children:(0,U.jsx)(_t,{children:e.maxTries})}),(0,U.jsx)(Pt,{children:Array.from({length:100},(e,t)=>(0,U.jsx)(mt,{value:t+1,children:t+1},t+1))})]})]}),(0,U.jsx)(`p`,{className:`mt-1 text-muted-foreground`,children:e.progress??`First check included. Inner limits reset on each outer try.`})]})})}function gL({data:e}){let{step:t}=e,n=t.kind===`branch`?pL:mL,r=e.vertical?Q.Bottom:Q.Right;return(0,U.jsxs)(`div`,{"data-status":e.status,"data-orientation":e.vertical?`vertical`:`horizontal`,className:`workflow-step relative rounded-lg border bg-card p-3 text-xs text-card-foreground`,style:{width:208,height:192},children:[(0,U.jsx)(YP,{type:`target`,position:e.vertical?Q.Top:Q.Left}),(0,U.jsx)(`strong`,{title:t.name,className:`block text-sm font-semibold ${e.execution?`line-clamp-2 whitespace-normal`:`truncate`}`,children:t.name}),(0,U.jsxs)(`div`,{className:`text-muted-foreground`,children:[t.kind,` · `,e.permission]}),e.status&&(0,U.jsx)(`div`,{children:e.status.replaceAll(`-`,` `)}),(0,U.jsx)(`div`,{className:`workflow-step__outcomes ${e.vertical?`workflow-step__outcomes--vertical`:`workflow-step__outcomes--horizontal`}`,children:n.map(e=>(0,U.jsxs)(`div`,{className:`workflow-step__outcome`,"data-outcome":e,children:[(0,U.jsx)(`span`,{children:e}),(0,U.jsx)(YP,{id:e,type:`source`,position:r})]},e))})]})}function _L({definition:e,onChange:t,onSelect:n,execution:r,awaitingSteps:i=dL,selectedStepId:a,orientation:o=`horizontal`}){let[s,c]=(0,H.useState)([]),[l,u]=(0,H.useState)([]),d=a!==void 0,f=(0,H.useCallback)(({nodes:e})=>{let t=e.find(e=>e.type===`workflow`);t?n(t.id):d||n(``)},[n,d]),p=r?.id??e,m=(0,H.useMemo)(()=>{let t;try{t=Fw(r?Hw(e,o===`vertical`):e,{orientation:o})}catch{t=e.steps.map((e,t)=>({id:e.id,type:`workflow`,position:e.position??Nw(t),data:{step:e}}))}return{layout:t,edges:e.edges.map(e=>({id:e.id,source:e.from,target:e.to,sourceHandle:e.outcome,label:e.outcome,zIndex:0})),steps:new Map(e.steps.map(e=>[e.id,e]))}},[p,e.id,o]);return(0,H.useEffect)(()=>{let n=new Set(i);c(i=>{let s=new Map(i.map(e=>[e.id,e]));return m.layout.map(i=>{if(i.type===`loop`){let n=i.data.headerId,a=e.loopSettings?.[n]?.maxTries??3;return{...i,data:{title:m.steps.get(n).name,maxTries:a,orientation:o,progress:r?.loops?.[n]?Lw(r.loops[n],a):void 0,change:t?r=>t({...e,loopSettings:{...e.loopSettings,[n]:{maxTries:r}}}):void 0}}}let c=i.data.step;return{...i,selected:a===void 0?s.get(c.id)?.selected:a===c.id,data:{step:c,vertical:!!r&&o===`vertical`,execution:!!r,permission:c.permission??e.permission??`auto-accept`,status:n.has(c.id)?`awaiting-input`:r?.steps[c.id]?.status}}})})},[m,r,a,i,e,t,o]),(0,H.useEffect)(()=>{u(e=>{let t=new Set(e.filter(e=>e.selected).map(e=>e.id));return m.edges.map(e=>({...e,selected:t.has(e.id)}))})},[m]),(0,U.jsx)(`div`,{className:`workflow-canvas overflow-hidden rounded-lg border`,children:(0,U.jsxs)(OI,{nodes:s,edges:l,nodeTypes:uL,onNodesChange:e=>c(t=>iP(e,t)),onEdgesChange:e=>u(t=>aP(e,t)),onConnect:n=>{n.source&&n.target&&t?.({...e,edges:[...e.edges,{id:crypto.randomUUID(),from:n.source,to:n.target,outcome:n.sourceHandle??`success`}]})},onNodeClick:(e,t)=>t.type===`workflow`&&n(t.id),onPaneClick:t&&d?()=>n(``):void 0,onSelectionChange:r||d?void 0:f,onNodeDragStop:(n,r,i)=>t?.({...e,steps:e.steps.map(e=>{let t=(i.length?i:[r]).find(t=>t.id===e.id);return t?{...e,position:Iw(t,s)}:e})}),onDelete:({nodes:n,edges:r})=>t?.(Pw({...e,steps:e.steps.filter(e=>!n.some(t=>t.type===`workflow`&&t.id===e.id)),edges:e.edges.filter(e=>!r.some(t=>t.id===e.id)&&!n.some(t=>t.type===`workflow`&&(t.id===e.from||t.id===e.to)))})),nodesDraggable:!!t,nodesConnectable:!!t,deleteKeyCode:t?[`Backspace`,`Delete`]:null,defaultViewport:{x:32,y:e.loopSettings&&Object.keys(e.loopSettings).length?120:24,zoom:1},minZoom:r?Vw:Bw,fitView:!0,fitViewOptions:fL,zIndexMode:`manual`,children:[(0,U.jsx)(FI,{}),(0,U.jsx)(WI,{fitViewOptions:fL})]})})}export{Qa as $,Gt as $t,_l as A,jr as At,Ao as B,bn as Bt,HC as C,$r as Ct,AC as D,Vr as Dt,IC as E,Gr as Et,Dc as F,Pn as Ft,co as G,tn as Gt,Do as H,rn as Ht,Ho as I,jn as It,eo as J,Zt as Jt,Za as K,en as Kt,Ro as L,On as Lt,il as M,zn as Mt,tl as N,In as Nt,Ul as O,Br as Ot,Wc as P,Fn as Pt,no as Q,Kt as Qt,Fo as R,Sn as Rt,iw as S,ei as St,WC as T,Kr as Tt,To as U,cn as Ut,Oo as V,vn as Vt,bo as W,on as Wt,to as X,$t as Xt,io as Y,Qt as Yt,ro as Z,Jt as Zt,uw as _,hi as _t,Lw as a,Ii as at,mw as b,li as bt,jw as c,Ti as ct,Ew as d,Ei as dt,qt as en,Ba as et,Cw as f,Si as ft,cw as g,mi as gt,dw as h,gi as ht,Rw as i,fa as it,ol as j,Hn as jt,xl as k,zr as kt,Ow as l,wi as lt,vw as m,Ci as mt,zw as n,pa as nt,Aw as o,Fi as ot,bw as p,xi as pt,$a as q,Xt as qt,Pw as r,ua as rt,kw as s,ji as st,_L as t,da as tt,Dw as u,Oi as ut,pw as v,ni as vt,qC as w,Qr as wt,lw as x,ti as xt,fw as y,oi as yt,No as z,xn as zt};
|