@xopcai/xopc 0.0.151 → 0.0.152
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/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BuO-OVfD.js → agent-avatar-dicebear-CXe2KDZj.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-Bpv3h31T.js → agents-BjLxhsVX.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-B6OU3Eol.js → app-management-settings-panel-DekP2_hC.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BaP4GFvN.js → appearance-settings-Cfd5YavF.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-DZKNIMRg.js → apps-page-PS-uUoSk.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-CJX3zIh_.js → archive-plugin-DWglUgbp.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CI1ejk_l.js → attachment-load-BJdxo2Vn.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-CjmhICbv.js → automation-suggestion-card-B-TfxjJF.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BtZl3B8m.js → automations-page-CtNevo3y.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-CZ8nOXqK.js → binary-plugins-DwrYsL8l.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-BoSfyS_j.js → block-editor-CIxjL5Kp.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-CL1UiPcb.js → browser-settings-page-QncZ-2vS.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-api-XzDKxPZ8.js → capability-presets-api-ChR2rMfo.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-Dc_uHYgl.js → capability-presets-settings-panel-_JBmJl5A.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-mALvXpJj.js → channels-settings-Bz3tyWpH.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-logo-BSjlInHT.js → connector-logo-KsRvub5G.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-Cm_E3mmI.js → connectors-page-_pT0aE0S.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-DcJc91-C.js → desktop-pet-CRCERvWy.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-CdeqTa3Q.js → desktop-pet-settings-vGrxshsU.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-Cp3fpm0k.js → directory-picker-path-field-BGPYrtx6.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-Bwj1O3zr.js → dreaming-settings-B5pzvNgs.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-D_1xpKbZ.js → extension-debug-page-BaCko1XU.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CqZNCj96.js → extension-page-TTXKCMtb.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-5MWbtQaQ.js → extension-settings-page-CEMb3uXY.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-Co_IaS34.js → gateway-config-api-Bf37OGhQ.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-kmeWm2Pt.js → gateway-settings-cu-vyeNk.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-create-dialog-FoO-R4_U.js → goal-create-dialog-C-bL8rj8.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-detail-page-CkJq7N5g.js → goal-detail-page-p5zPrlTq.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-config-api-DrtsYjXz.js → goals-config-api-D2pEoiiO.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-page-DRAN-R64.js → goals-page-D-H2u2-J.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-settings-wq9TKhIZ.js → goals-settings-BVZaBqPa.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-B5zDoHbo.js → heartbeat-settings-B-AC_uwa.js} +1 -1
- package/dist/gateway/static/root/assets/{index-apLU0Hun.js → index-DSydVlxZ.js} +6 -6
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-3tC9iD21.js → keyboard-shortcuts-settings-w0yIP0UB.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-CT-vDTLK.js → local-app-workbench-page-CTq0TIH4.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-B9ruF9GV.js → local-apps-page-srIyxJuy.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-Ca1X8X2P.js → logs-page-MQB6-NKt.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-CzuhSQAB.js → markdown-split-Du5yPuDb.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-a3R4y-EL.js → media-plugins-Cd1Rmw15.js} +1 -1
- package/dist/gateway/static/root/assets/{models-hub-panel-CbTlz9Of.js → models-hub-panel-BMg_Xqd9.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-BCxDy2dV.js → notes-page-DhfrFd89.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-workbench-z6sBX9B2.js → notes-workbench-CwJk-D7Y.js} +2 -2
- package/dist/gateway/static/root/assets/{page-tabs-CJfk6M78.js → page-tabs-HACawonJ.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-MFopTSgF.js → preview-open-alternatives-CjEZt_F5.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-DU29deIr.js → project-detail-page-Dut_micj.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-Ck3DLTlZ.js → projects-page-sTRlCEZ5.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-gLsLyAyi.js → remote-access-hub-Fx81YH7S.js} +1 -1
- package/dist/gateway/static/root/assets/{save-bar-controls-D0uhU3Z8.js → save-bar-controls-CbktHUqt.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-NGOH-7wV.js → schedule-field-BGx_Nb45.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-BJz5LoqG.js → schema-form-Cg-LJVvG.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-TmNoWpa_.js → sessions-page-DFnmyBpj.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BlWxQ6Ea.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-oDnUHnX_.js → settings-collapsible-section-yYK4O-5E.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-DND90dDt.js → settings-form-section-DPSA8tG8.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-CEJtaoQp.js → settings-loading-skeleton-ClHNJwRL.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-B1LJlRi9.js → settings-page-lPM7md10.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-CsrLuDsW.js → settings-page-layout-B_-VepeK.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-BPCJPHHY.js → setup-status-panel-hORJvGAQ.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-C1PwLh-p.js → share-preview-page-DyzplAEL.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-DCuqr7js.js → shares-settings-DO3IIgcC.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-kn1Vypcy.js → skill-reload-api-C9BqzDjZ.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-k6VIqTkK.js → skills-page-CvOIrcCJ.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-BEsrEkSx.js → system-settings-panel-eIyklo0K.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-dOypdlMf.js → typed-models-lib-BgOpEx3h.js} +1 -1
- package/dist/gateway/static/root/assets/{user-context-page-B9Y_Ciav.js → user-context-page-BG_1IrIJ.js} +1 -1
- package/dist/gateway/static/root/assets/{user-profile-fields-editor-DGC38Lx7.js → user-profile-fields-editor-CfLUK6MT.js} +1 -1
- package/dist/gateway/static/root/assets/{user-profile-settings-panel-DFkZ-tan.js → user-profile-settings-panel-BmzPREhJ.js} +1 -1
- package/dist/gateway/static/root/assets/{utils-CEIYZihF.js → utils-DbFnvDPi.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-DK6gaQsA.js → voice-api-key-field-1xyza74n.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-DSJb9Kq7.js → work-discovery-page-Dhyk4LHJ.js} +1 -1
- package/dist/gateway/static/root/assets/{work-item-detail-page-DVavwV3D.js → work-item-detail-page-CxBRnWeQ.js} +1 -1
- package/dist/gateway/static/root/assets/{work-page-foJDp0nz.js → work-page-Btq3YeCH.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BYqZpFCC.js → workflow-run-setup-panel-8HLqUALq.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-DgO0WAzs.js → workflows-page-D48bPgLI.js} +1 -1
- package/dist/gateway/static/root/index.html +1 -1
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/product-delivery.js +63 -0
- package/dist/src/agent/code-intelligence/tool-gating.d.ts +5 -0
- package/dist/src/agent/code-intelligence/tool-gating.js +6 -0
- package/dist/src/agent/tools/automation-tool.js +1 -1
- package/dist/src/agent/tools/factory.js +2 -1
- package/dist/src/agent/tools/goal-tool.js +1 -1
- package/dist/src/agent/tools/workflow-tool.js +1 -1
- package/dist/src/agent/tools/write.js +1 -1
- package/dist/src/agent/tools/xopc-use-tool.js +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/hono/routes/status.d.ts +8 -0
- package/dist/src/gateway/hono/routes/status.js +71 -1
- package/package.json +9 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CtPhh2m9.js +0 -1
package/dist/gateway/static/root/assets/{workflows-page-DgO0WAzs.js → workflows-page-D48bPgLI.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,i as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{d as a,l as o,t as s,u as c}from"./chunk-QUQL4437-DXsxWP7r.js";import{t as l}from"./cn-BQ_8x0bT.js";import{t as u}from"./check-BODqo66o.js";import{t as d}from"./copy-to-clipboard-HOJ79TWv.js";import{t as f}from"./messages-B0B40tpO.js";import{l as p,n as m}from"./locale-store-GfSwnwIZ.js";import{i as h}from"./vendor-swr-BIWyz7Rc.js";import{$c as g,A as _,B as v,Bo as y,Cs as b,Ct as x,E as S,Es as C,Et as w,F as T,Fl as E,Fs as D,G as O,I as k,J as A,Jo as j,Jr as M,K as N,L as P,Lc as F,M as I,N as L,Nl as R,O as z,Ot as B,P as V,Ps as H,Q as U,Rl as W,S as G,St as ee,Tc as te,Tt as ne,U as re,V as ie,Vr as K,W as ae,Wc as oe,X as se,Xc as ce,Y as le,Yo as ue,Ys as de,Zl as fe,Zo as pe,_t as me,ac as he,at as ge,au as _e,bt as ve,bu as ye,cc as be,da as xe,dl as q,et as Se,ft as Ce,fu as we,g as Te,gt as Ee,ht as De,it as Oe,j as ke,k as Ae,ks as je,kt as Me,lo as Ne,mt as Pe,ot as Fe,ps as Ie,pt as Le,q as Re,rl as ze,rt as Be,ru as Ve,sl as He,st as Ue,tl as We,tt as Ge,uc as Ke,uu as qe,vl as Je,wt as Ye,xc as Xe,xt as Ze,yc as Qe,ys as J,yt as $e,z as et,zl as tt}from"./index-apLU0Hun.js";import{t as nt}from"./with-selector-aYPsXwdl.js";import{t as rt}from"./page-tabs-CJfk6M78.js";import{i as it,r as at,t as ot}from"./workflow-run-setup-panel-BYqZpFCC.js";var Y=e(t(),1),X=r(),st=[`queued`,`running`,`succeeded`,`attention`],ct=new Set([`failed`,`timeout`,`cancelled`]);function lt(e){return e.metadata?.sessionKey?.trim()||null}function ut(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function dt(e,t){if(!e||typeof e!=`object`)return null;let n=e;for(let e of t){let t=n[e];if(typeof t==`string`&&t.trim())return t.trim()}return null}function ft(e,t=90){let n=e.metadata?.input?.goal?.trim()||(typeof e.metadata?.input?.payload==`string`?e.metadata.input.payload.trim():null)||dt(e.metadata?.input?.payload,[`query`,`goal`,`prompt`,`input`,`message`])||dt(e.metadata?.input?.variables,[`query`,`goal`,`prompt`,`input`,`message`]);return n?ut(n,t):null}function pt(e,t=90){return ft(e,t)??ut(e.title?.trim()||e.definitionId,t)}function mt(e,t=44){return ut(e.title?.trim()||e.definitionId,t)}function ht(e,t){let n=t.trim().toLowerCase();return n?[ft(e,500),e.title,e.definitionId,e.id].filter(Boolean).join(` `).toLowerCase().includes(n):!0}function gt(e,t){let n=t.workflowFilterId.trim();return e.filter(e=>n&&e.definitionId!==n||!T(e,t.triggerFilter??`all`)?!1:ht(e,t.searchQuery))}function _t(e){return e.completedAtMs??e.createdAtMs}function vt(e,t){return e.status===`queued`?`queued`:e.status===`running`?`running`:e.status===`succeeded`?`succeeded`:ct.has(e.status)?`attention`:null}function yt(e,t){let n=[...t];return e===`queued`?n.sort((e,t)=>e.createdAtMs-t.createdAtMs):e===`running`?n.sort((e,t)=>(t.startedAtMs??t.createdAtMs)-(e.startedAtMs??e.createdAtMs)):n.sort((e,t)=>_t(t)-_t(e))}function bt(e,t){let n={queued:[],running:[],succeeded:[],attention:[]};for(let r of e){let e=vt(r,t);e&&n[e].push(r)}return st.map(e=>{if(e===`succeeded`){let t=yt(`succeeded`,n.succeeded);return{id:e,runs:t,totalInWindow:t.length}}return{id:e,runs:yt(e,n[e])}})}function xt(e,t,n){let r=Math.round((t-e)/1e3);if(r<60)return Ge(-r,`second`,n);let i=Math.round(r/60);if(i<60)return Ge(-i,`minute`,n);let a=Math.round(i/60);return a<48?Ge(-a,`hour`,n):Ge(-Math.round(a/24),`day`,n)}function St(e){return e.status===`queued`||e.status===`running`}function Ct(e){return e.status===`failed`||e.status===`timeout`||e.status===`cancelled`}var Z=i(),wt=(0,Y.memo)(function(e){let t=(0,X.c)(76),{run:n,language:r,localeTag:i,nowMs:a,selected:o,onOpen:s,onOpenChat:c,onCancel:u,onRetry:d}=e,p=f(r).workflows,[m,h]=(0,Y.useState)(!1),g;t[0]===n?g=t[1]:(g=lt(n),t[0]=n,t[1]=g);let v=!g,y;t[2]===n?y=t[3]:(y=St(n),t[2]=n,t[3]=y);let b=y,x=n.status===`running`||n.status===`queued`,S;t[4]!==n.metrics.agentCount||t[5]!==n.metrics.doneAgentCount?(S=n.metrics.agentCount>0?Math.round(n.metrics.doneAgentCount/n.metrics.agentCount*100):0,t[4]=n.metrics.agentCount,t[5]=n.metrics.doneAgentCount,t[6]=S):S=t[6];let C=S,w=n.metrics.errorAgentCount>0,T=n.startedAtMs??n.createdAtMs,E=_(b?a-T:n.metrics.durationMs),D=I(p.taskArtifacts,{count:n.metrics.artifactCount}),O;t[7]===n?O=t[8]:(O=pt(n),t[7]=n,t[8]=O);let A=O,j;t[9]===n?j=t[10]:(j=mt(n),t[9]=n,t[10]=j);let M=j,N;t[11]!==s||t[12]!==n?(N=()=>{s(n)},t[11]=s,t[12]=n,t[13]=N):N=t[13];let P=N,F;t[14]!==v||t[15]!==c||t[16]!==n?(F=()=>{v||c(n)},t[14]=v,t[15]=c,t[16]=n,t[17]=F):F=t[17];let L=F,z=o&&`ring-1 ring-accent/30`,B;t[18]===z?B=t[19]:(B=l(`group relative min-h-24 overflow-hidden rounded-lg bg-surface-panel p-3 shadow-surface transition-colors`,z,`hover:bg-surface-hover`),t[18]=z,t[19]=B);let V;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(V=l(`w-full text-left`,Ie.focusRingPanel),t[20]=V):V=t[20];let U;t[21]===A?U=t[22]:(U=(0,Z.jsx)(`div`,{className:`line-clamp-2 text-sm font-medium leading-5 text-fg`,children:A}),t[21]=A,t[22]=U);let W;t[23]===M?W=t[24]:(W=(0,Z.jsx)(`div`,{className:`mt-1 truncate text-[11px] font-medium text-fg-muted`,children:M}),t[23]=M,t[24]=W);let G;t[25]!==U||t[26]!==W?(G=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[U,W]}),t[25]=U,t[26]=W,t[27]=G):G=t[27];let ee;t[28]===n.status?ee=t[29]:(ee=l(`shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold shadow-sm`,k(n.status)),t[28]=n.status,t[29]=ee);let te;t[30]!==i||t[31]!==a||t[32]!==T?(te=xt(T,a,i),t[30]=i,t[31]=a,t[32]=T,t[33]=te):te=t[33];let ne;t[34]===te?ne=t[35]:(ne=(0,Z.jsx)(`span`,{children:te}),t[34]=te,t[35]=ne);let re=E===`—`?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,Z.jsx)(`span`,{children:I(p.taskElapsed,{duration:E})})]}),ie;t[36]!==ne||t[37]!==re?(ie=(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-[11px] text-fg-subtle`,children:[ne,re]}),t[36]=ne,t[37]=re,t[38]=ie):ie=t[38];let K=n.metrics.artifactCount>0?(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 font-medium text-fg-muted`,children:D}):null,ae=o?(0,Z.jsx)(`span`,{className:`font-medium text-accent-fg`,children:p.taskOpenDetails}):null,oe;t[39]!==K||t[40]!==ae?(oe=(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[K,ae]}),t[39]=K,t[40]=ae,t[41]=oe):oe=t[41];let se=v&&`cursor-not-allowed text-fg-disabled hover:bg-transparent`,ce;t[42]===se?ce=t[43]:(ce=l(`rounded-md px-2 py-1 text-xs font-medium`,`text-accent-fg hover:bg-accent-soft`,Ie.focusRingPanel,se),t[42]=se,t[43]=ce);let le;t[44]!==v||t[45]!==L||t[46]!==p.continueInChat||t[47]!==ce?(le=(0,Z.jsx)(`button`,{type:`button`,className:ce,disabled:v,onClick:L,children:p.continueInChat}),t[44]=v,t[45]=L,t[46]=p.continueInChat,t[47]=ce,t[48]=le):le=t[48];let ue;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(ue=l(`rounded-md px-2 py-1 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,Ie.focusRingPanel),t[49]=ue):ue=t[49];let de;t[50]!==P||t[51]!==p.taskOpenDetails?(de=(0,Z.jsx)(`button`,{type:`button`,className:ue,onClick:P,children:p.taskOpenDetails}),t[50]=P,t[51]=p.taskOpenDetails,t[52]=de):de=t[52];let fe;t[53]!==le||t[54]!==de?(fe=(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 border-t border-edge-subtle pt-2`,children:[le,de]}),t[53]=le,t[54]=de,t[55]=fe):fe=t[55];let pe;t[56]===h?pe=t[57]:(pe=()=>h(Et),t[56]=h,t[57]=pe);let me;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Z.jsx)(R,{className:`size-4`,"aria-hidden":!0}),t[58]=me):me=t[58];let he;t[59]!==p.taskActionsAria||t[60]!==m||t[61]!==pe?(he=(0,Z.jsx)(J,{variant:`ghost`,className:`size-7 p-0 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`,"aria-label":p.taskActionsAria,"aria-expanded":m,onClick:pe,children:me}),t[59]=p.taskActionsAria,t[60]=m,t[61]=pe,t[62]=he):he=t[62];let ge;t[63]!==b||t[64]!==p.cancel||t[65]!==p.rerun||t[66]!==p.taskCloseMenu||t[67]!==m||t[68]!==u||t[69]!==d||t[70]!==n||t[71]!==h?(ge=m?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`button`,{type:`button`,className:`fixed inset-0 z-10 cursor-default`,"aria-label":p.taskCloseMenu,onClick:()=>h(!1)}),(0,Z.jsxs)(`div`,{className:`absolute right-0 z-20 mt-1 min-w-36 rounded-lg border border-edge bg-surface-panel py-1 shadow-surface`,children:[b?(0,Z.jsx)(Tt,{label:p.cancel,tone:`danger`,onClick:()=>{h(!1),u(n.id)}}):null,Ct(n)?(0,Z.jsx)(Tt,{label:p.rerun,onClick:()=>{h(!1),d(n.id)}}):null]})]}):null,t[63]=b,t[64]=p.cancel,t[65]=p.rerun,t[66]=p.taskCloseMenu,t[67]=m,t[68]=u,t[69]=d,t[70]=n,t[71]=h,t[72]=ge):ge=t[72];let _e;return t[73]!==he||t[74]!==ge?(_e=(0,Z.jsxs)(`div`,{className:`absolute right-2 top-2`,children:[he,ge]}),t[73]=he,t[74]=ge,t[75]=_e):_e=t[75],(0,Z.jsxs)(`div`,{className:B,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:P,"aria-label":`${p.taskOpenDetails}: ${A}`,"aria-current":o?`true`:void 0,className:V,children:[(0,Z.jsxs)(`div`,{className:`pr-7`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[G,(0,Z.jsx)(`span`,{className:ee,children:p.status[n.status]??n.status})]}),ie]}),x?(0,Z.jsxs)(`div`,{className:`mt-2.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-[11px] text-fg-muted`,children:[(0,Z.jsx)(`span`,{children:I(p.agentProgress,{done:n.metrics.doneAgentCount,total:n.metrics.agentCount})}),(0,Z.jsxs)(`span`,{children:[C,`%`]})]}),(0,Z.jsx)(`div`,{className:`mt-1.5 h-1.5 overflow-hidden rounded-full bg-surface-hover`,children:(0,Z.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-all`,style:{width:`${C}%`}})})]}):null,oe,w?(0,Z.jsxs)(`div`,{className:`mt-2 flex items-center gap-1 text-[11px] text-amber-700 dark:text-amber-300`,children:[(0,Z.jsx)(H,{className:`size-3 shrink-0`,"aria-hidden":!0}),I(p.runRowErrorSummary,{count:n.metrics.errorAgentCount})]}):null]}),fe,_e]})});function Tt(e){let t=(0,X.c)(8),{label:n,disabled:r,tone:i,onClick:a}=e,o=r?`cursor-not-allowed text-fg-subtle`:`text-fg hover:bg-surface-hover`,s=i===`danger`&&!r&&`text-red-600 dark:text-red-300`,c;t[0]!==o||t[1]!==s?(c=l(`block w-full px-3 py-1.5 text-left text-xs`,o,s),t[0]=o,t[1]=s,t[2]=c):c=t[2];let u;return t[3]!==r||t[4]!==n||t[5]!==a||t[6]!==c?(u=(0,Z.jsx)(`button`,{type:`button`,disabled:r,onClick:a,className:c,children:n}),t[3]=r,t[4]=n,t[5]=a,t[6]=c,t[7]=u):u=t[7],u}function Et(e){return!e}function Dt(e,t){return t.boardColumns[e]}var Ot=(0,Y.memo)(function(e){let t=(0,X.c)(17),{column:n,language:r,localeTag:i,nowMs:a,selectedRunId:o,loading:s,onOpenRun:c,onOpenRunChat:u,onCancelRun:d,onRetryRun:p}=e,m=f(r).workflows,[h,g]=(0,Y.useState)(!1),_=n.id===`succeeded`,v=_?5:n.runs.length,y;t[0]!==v||t[1]!==n.runs||t[2]!==h||t[3]!==_?(y=_&&!h?n.runs.slice(0,v):n.runs,t[0]=v,t[1]=n.runs,t[2]=h,t[3]=_,t[4]=y):y=t[4];let b=y,x=_&&n.runs.length>5&&!h,S=_&&h,C;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(C=l(`flex max-h-full w-72 min-w-72 max-w-72 shrink-0 flex-col overflow-y-auto rounded-lg bg-surface-base shadow-surface`),t[5]=C):C=t[5];let w;t[6]===n.runs.length?w=t[7]:(w=(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.runs.length}),t[6]=n.runs.length,t[7]=w);let T;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(R,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[8]=T):T=t[8];let E=s&&b.length===0?(0,Z.jsx)(kt,{}):b.length===0?(0,Z.jsx)(`div`,{className:`rounded-lg bg-surface-panel/70 px-3 py-6 text-center text-xs text-fg-subtle`,children:m.boardColumnEmpty}):b.map(e=>(0,Z.jsx)(wt,{run:e,language:r,localeTag:i,nowMs:a,selected:e.id===o,onOpen:c,onOpenChat:u,onCancel:d,onRetry:p},e.id)),D=x?(0,Z.jsx)(J,{variant:`ghost`,className:`h-8 w-full text-xs`,onClick:()=>g(!0),children:I(m.boardExpandSucceeded,{count:Math.min(n.runs.length,n.totalInWindow??n.runs.length)})}):null,O;t[9]!==S||t[10]!==m||t[11]!==g?(O=S?(0,Z.jsx)(J,{variant:`ghost`,className:`h-8 w-full text-xs`,onClick:()=>g(!1),children:m.boardCollapseSucceeded}):null,t[9]=S,t[10]=m,t[11]=g,t[12]=O):O=t[12];let k;return t[13]!==E||t[14]!==D||t[15]!==O?(k=(0,Z.jsxs)(`div`,{className:`mx-2 mt-3 grid min-h-0 min-w-0 content-start gap-2 pb-2 pr-1 [scrollbar-gutter:stable]`,children:[E,D,O]}),t[13]=E,t[14]=D,t[15]=O,t[16]=k):k=t[16],(0,Z.jsxs)(`section`,{className:C,"aria-label":Dt(n.id,m),children:[(0,Z.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-2 p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,Z.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:Dt(n.id,m)}),w]}),T]}),k]})});function kt(){let e=(0,X.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsxs)(`article`,{className:`min-h-24 rounded-lg bg-surface-panel p-3 shadow-surface`,"aria-hidden":`true`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(Ne,{className:`size-4/5`}),(0,Z.jsx)(Ne,{className:`mt-2 h-3 w-24`})]}),(0,Z.jsx)(Ne,{className:`h-5 w-14 rounded-full`})]}),(0,Z.jsx)(Ne,{className:`mt-3 h-3 w-2/3`}),(0,Z.jsx)(Ne,{className:`mt-4 h-5 w-20 rounded-full`})]}),e[0]=t):t=e[0],t}function At(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var jt=(0,Y.memo)(function(e){let t=(0,X.c)(54),{runs:n,language:r,localeTag:i,labels:a,searchQuery:o,workflowFilterId:s,triggerFilter:c,selectedRunId:l,loading:u,onOpenRun:d,onOpenRunChat:f,onCancelRun:p,onRetryRun:m,onStart:h}=e,g;t[0]===n?g=t[1]:(g=n.some(Mt),t[0]=n,t[1]=g);let _=g,v=(0,Y.useRef)(null),y=(0,Y.useRef)(null),[b,x]=(0,Y.useState)(Nt),[S,C]=(0,Y.useState)(!1),w,T;t[2]===_?(w=t[3],T=t[4]):(w=()=>{if(!_)return;let e=window.setInterval(()=>x(Date.now()),1e3);return()=>window.clearInterval(e)},T=[_],t[2]=_,t[3]=w,t[4]=T),(0,Y.useEffect)(w,T);let E;t[5]!==b||t[6]!==n||t[7]!==o||t[8]!==c||t[9]!==s?(E=bt(gt(n,{searchQuery:o,workflowFilterId:s,triggerFilter:c}),b),t[5]=b,t[6]=n,t[7]=o,t[8]=c,t[9]=s,t[10]=E):E=t[10];let D=E,O=D.reduce(Pt,0),k;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(k=e=>{let t=y.current;!t||t.pointerId!==e.pointerId||(y.current=null,C(!1),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},t[11]=k):k=t[11];let A=k,j;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>{if(e.button!==0||At(e.target))return;let t=v.current;t&&(y.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},t[12]=j):j=t[12];let M=j,N;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>{let t=y.current,n=v.current;if(!t||!n||t.pointerId!==e.pointerId)return;let r=e.clientX-t.startX;!t.active&&Math.abs(r)<5||(t.active||(t.active=!0,C(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},t[13]=N):N=t[13];let P=N;if(!u&&O===0){let e;t[14]===a.boardEmptyTitle?e=t[15]:(e=(0,Z.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:a.boardEmptyTitle}),t[14]=a.boardEmptyTitle,t[15]=e);let n;t[16]===a.boardEmptyHint?n=t[17]:(n=(0,Z.jsx)(`p`,{className:`mx-auto mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:a.boardEmptyHint}),t[16]=a.boardEmptyHint,t[17]=n);let r;t[18]!==a.boardStart||t[19]!==h?(r=(0,Z.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,Z.jsx)(J,{variant:`primary`,onClick:h,children:a.boardStart})}),t[18]=a.boardStart,t[19]=h,t[20]=r):r=t[20];let i;return t[21]!==r||t[22]!==e||t[23]!==n?(i=(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col items-center justify-center rounded-2xl border border-dashed border-edge bg-surface-panel/40 px-6 py-12 text-center`,children:[e,n,r]}),t[21]=r,t[22]=e,t[23]=n,t[24]=i):i=t[24],i}let F=S?`cursor-grabbing select-none`:`cursor-grab`,I;t[25]===F?I=t[26]:(I=[`min-h-0 h-full min-w-0 overflow-x-auto rounded-lg p-2`,F],t[25]=F,t[26]=I);let L=I.join(` `),R;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{y.current?.pointerId===e.pointerId&&(y.current=null,C(!1))},t[27]=R):R=t[27];let z;if(t[28]!==D||t[29]!==r||t[30]!==u||t[31]!==i||t[32]!==b||t[33]!==p||t[34]!==d||t[35]!==f||t[36]!==m||t[37]!==l){let e;t[39]!==r||t[40]!==u||t[41]!==i||t[42]!==b||t[43]!==p||t[44]!==d||t[45]!==f||t[46]!==m||t[47]!==l?(e=e=>(0,Z.jsx)(Ot,{column:e,language:r,localeTag:i,nowMs:b,selectedRunId:l,loading:u,onOpenRun:d,onOpenRunChat:f,onCancelRun:p,onRetryRun:m},e.id),t[39]=r,t[40]=u,t[41]=i,t[42]=b,t[43]=p,t[44]=d,t[45]=f,t[46]=m,t[47]=l,t[48]=e):e=t[48],z=D.map(e),t[28]=D,t[29]=r,t[30]=u,t[31]=i,t[32]=b,t[33]=p,t[34]=d,t[35]=f,t[36]=m,t[37]=l,t[38]=z}else z=t[38];let B;t[49]===z?B=t[50]:(B=(0,Z.jsx)(`div`,{className:`flex min-h-full min-w-max items-start gap-3 pr-4`,children:z}),t[49]=z,t[50]=B);let V;return t[51]!==L||t[52]!==B?(V=(0,Z.jsx)(`div`,{ref:v,className:L,onPointerDown:M,onPointerMove:P,onPointerUp:A,onPointerCancel:A,onLostPointerCapture:R,children:B}),t[51]=L,t[52]=B,t[53]=V):V=t[53],V});function Mt(e){return e.status===`queued`||e.status===`running`}function Nt(){return Date.now()}function Pt(e,t){return e+t.runs.length}function Ft(e,t){let n=e.metadata.estimatedAgents;return n?n.min===n.max?I(t.agentScaleExact,{count:n.min}):I(t.agentScaleRange,{min:n.min,max:n.max}):null}function It(e){let t=(0,X.c)(73),{definition:n,language:r,labels:i,onPick:a,onDetail:o,onEdit:s}=e,c;t[0]!==n||t[1]!==r?(c=U(n,r),t[0]=n,t[1]=r,t[2]=c):c=t[2];let u=c,d;t[3]!==n||t[4]!==i?(d=Ft(n,i),t[3]=n,t[4]=i,t[5]=d):d=t[5];let f=d,p=n.metadata.source===`user`,m=p?`bg-accent-soft text-accent-fg`:`bg-surface-muted text-fg-muted`,h;t[6]===m?h=t[7]:(h=l(`rounded-full px-2 py-0.5 text-[10px] font-medium`,m),t[6]=m,t[7]=h);let g=p?i.badgeUser:i.badgeBuiltin,_;t[8]!==h||t[9]!==g?(_=(0,Z.jsx)(`span`,{className:h,children:g}),t[8]=h,t[9]=g,t[10]=_):_=t[10];let v;t[11]!==n.inputSchema||t[12]!==i.inputSchemaBadge?(v=n.inputSchema?(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-surface-muted px-2 py-0.5 text-[10px] text-fg-subtle`,children:[(0,Z.jsx)(qe,{className:`size-2.5`,"aria-hidden":!0}),i.inputSchemaBadge]}):null,t[11]=n.inputSchema,t[12]=i.inputSchemaBadge,t[13]=v):v=t[13];let y;t[14]!==_||t[15]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[_,v]}),t[14]=_,t[15]=v,t[16]=y):y=t[16];let b;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(b=l(`mt-2 line-clamp-2 text-left text-sm font-semibold leading-5 text-fg hover:text-accent-fg`,Ie.focusRingPanel),t[17]=b):b=t[17];let x;t[18]!==n||t[19]!==o?(x=()=>o(n),t[18]=n,t[19]=o,t[20]=x):x=t[20];let S;t[21]!==n.title||t[22]!==x?(S=(0,Z.jsx)(`button`,{type:`button`,className:b,onClick:x,children:n.title}),t[21]=n.title,t[22]=x,t[23]=S):S=t[23];let C;t[24]!==S||t[25]!==y?(C=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[y,S]}),t[24]=S,t[25]=y,t[26]=C):C=t[26];let w=`${p?i.editWorkflow:i.copyAndEditWorkflow}: ${n.title}`,T;t[27]!==n||t[28]!==s?(T=()=>s(n),t[27]=n,t[28]=s,t[29]=T):T=t[29];let E;t[30]===p?E=t[31]:(E=p?(0,Z.jsx)(te,{className:`size-3.5`,"aria-hidden":!0}):(0,Z.jsx)(tt,{className:`size-3.5`,"aria-hidden":!0}),t[30]=p,t[31]=E);let D;t[32]!==w||t[33]!==T||t[34]!==E?(D=(0,Z.jsx)(J,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":w,onClick:T,children:E}),t[32]=w,t[33]=T,t[34]=E,t[35]=D):D=t[35];let O;t[36]!==C||t[37]!==D?(O=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[C,D]}),t[36]=C,t[37]=D,t[38]=O):O=t[38];let k=u.whenToUse||u.description||n.description,A;t[39]===k?A=t[40]:(A=(0,Z.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:k}),t[39]=k,t[40]=A);let j;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(ze,{className:`size-3`,"aria-hidden":!0}),t[41]=j):j=t[41];let M;t[42]!==n.phases.length||t[43]!==i.phaseCount?(M=I(i.phaseCount,{count:n.phases.length}),t[42]=n.phases.length,t[43]=i.phaseCount,t[44]=M):M=t[44];let N;t[45]===M?N=t[46]:(N=(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[j,M]}),t[45]=M,t[46]=N);let P;t[47]===f?P=t[48]:(P=f?(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Z.jsx)(je,{className:`size-3`,"aria-hidden":!0}),f]}):null,t[47]=f,t[48]=P);let F;t[49]!==N||t[50]!==P?(F=(0,Z.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center gap-3 pt-4 text-[11px] text-fg-subtle`,children:[N,P]}),t[49]=N,t[50]=P,t[51]=F):F=t[51];let L;t[52]!==n||t[53]!==a?(L=()=>a(n),t[52]=n,t[53]=a,t[54]=L):L=t[54];let R;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)(Xe,{className:`size-3.5`,"aria-hidden":!0}),t[55]=R):R=t[55];let z;t[56]!==i.configureAndRun||t[57]!==L?(z=(0,Z.jsxs)(J,{type:`button`,variant:`primary`,className:`h-8 flex-1 rounded-lg text-xs`,onClick:L,children:[R,i.configureAndRun]}),t[56]=i.configureAndRun,t[57]=L,t[58]=z):z=t[58];let B;t[59]!==n||t[60]!==o?(B=()=>o(n),t[59]=n,t[60]=o,t[61]=B):B=t[61];let V;t[62]!==i.viewDetails||t[63]!==B?(V=(0,Z.jsx)(J,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:B,children:i.viewDetails}),t[62]=i.viewDetails,t[63]=B,t[64]=V):V=t[64];let H;t[65]!==z||t[66]!==V?(H=(0,Z.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-edge-subtle pt-3`,children:[z,V]}),t[65]=z,t[66]=V,t[67]=H):H=t[67];let W;return t[68]!==O||t[69]!==A||t[70]!==F||t[71]!==H?(W=(0,Z.jsxs)(`article`,{className:`flex min-h-48 flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 transition-colors hover:border-edge hover:bg-surface-hover/35`,children:[O,A,F,H]}),t[68]=O,t[69]=A,t[70]=F,t[71]=H,t[72]=W):W=t[72],W}function Lt(e){let t=(0,X.c)(44),{definitions:n,runs:r,language:i,onPick:a,onDetail:o,onEdit:s}=e,[c]=(0,Y.useState)(Bt),u=f(i).workflows,d=i===`zh`?`zh-CN`:`en-US`,[p,m]=(0,Y.useState)(``),[h,g]=(0,Y.useState)(`all`),[_,v]=(0,Y.useState)(`all`),y;t[0]!==h||t[1]!==n||t[2]!==p||t[3]!==_?(y=Ae(n,p,h,_),t[0]=h,t[1]=n,t[2]=p,t[3]=_,t[4]=y):y=t[4];let b=y,x;if(t[5]!==n||t[6]!==r){let e=new Map(n.map(zt)),i=new Set;x=[...r].sort(Rt).flatMap(t=>{if(i.has(t.definitionId))return[];let n=e.get(t.definitionId);return n?(i.add(t.definitionId),[{definition:n,lastRunAtMs:t.startedAtMs??t.createdAtMs}]):[]}).slice(0,3),t[5]=n,t[6]=r,t[7]=x}else x=t[7];let S=x,C=I(u.workflowCount,{count:b.length}),w;t[8]===C?w=t[9]:(w=(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:C}),t[8]=C,t[9]=w);let T=u.sourceFilterAria,E;t[10]!==u.sources||t[11]!==v||t[12]!==_?(E=Re.map(e=>(0,Z.jsx)(`button`,{type:`button`,className:l(`h-8 rounded-md px-2.5 text-xs font-medium transition-colors`,_===e?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:text-fg`,Ie.focusRingPanel),"aria-pressed":_===e,onClick:()=>v(e),children:u.sources[e]},e)),t[10]=u.sources,t[11]=v,t[12]=_,t[13]=E):E=t[13];let D;t[14]!==u.sourceFilterAria||t[15]!==E?(D=(0,Z.jsx)(`div`,{className:`flex rounded-lg bg-surface-muted p-0.5`,role:`group`,"aria-label":T,children:E}),t[14]=u.sourceFilterAria,t[15]=E,t[16]=D):D=t[16];let O=u.categoryFilterAria,k;t[17]===g?k=t[18]:(k=e=>g(e.target.value),t[17]=g,t[18]=k);let A;t[19]===u.categories?A=t[20]:(A=re.map(e=>(0,Z.jsx)(pe,{value:e,children:u.categories[e]},e)),t[19]=u.categories,t[20]=A);let j;t[21]!==h||t[22]!==u.categoryFilterAria||t[23]!==k||t[24]!==A?(j=(0,Z.jsx)(ue,{value:h,"aria-label":O,onChange:k,className:`h-9 min-w-36 rounded-lg border border-edge bg-surface-base px-2.5 text-xs font-medium text-fg shadow-surface`,children:A}),t[21]=h,t[22]=u.categoryFilterAria,t[23]=k,t[24]=A,t[25]=j):j=t[25];let M;t[26]!==j||t[27]!==D?(M=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[D,j]}),t[26]=j,t[27]=D,t[28]=M):M=t[28];let N;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(he,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),t[29]=N):N=t[29];let P;t[30]===m?P=t[31]:(P=e=>m(e.target.value),t[30]=m,t[31]=P);let F=u.librarySearchPlaceholder,L;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(L=l(`h-10 w-full rounded-lg border border-edge bg-surface-base py-2 pl-10 pr-3 text-sm text-fg`,`placeholder:text-fg-muted`,Ie.focusRingPanel),t[32]=L):L=t[32];let R;t[33]!==u.librarySearchPlaceholder||t[34]!==p||t[35]!==P?(R=(0,Z.jsxs)(`div`,{className:`relative max-w-xl`,children:[N,(0,Z.jsx)(`input`,{value:p,onChange:P,placeholder:F,className:L})]}),t[33]=u.librarySearchPlaceholder,t[34]=p,t[35]=P,t[36]=R):R=t[36];let z;return t[37]!==b||t[38]!==u||t[39]!==i||t[40]!==o||t[41]!==s||t[42]!==a?(z=b.length===0?(0,Z.jsxs)(`div`,{className:`flex min-h-64 flex-col items-center justify-center px-4 py-12 text-center`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:u.noDefinitions}),(0,Z.jsx)(`p`,{className:`mt-1 max-w-sm text-xs leading-5 text-fg-muted`,children:u.noDefinitionsHint})]}):(0,Z.jsx)(`div`,{className:`grid grid-cols-1 gap-3 pt-4 sm:grid-cols-2 xl:grid-cols-3`,children:b.map(e=>(0,Z.jsx)(It,{definition:e,language:i,labels:u,onPick:a,onDetail:o,onEdit:s},e.id))}),t[37]=b,t[38]=u,t[39]=i,t[40]=o,t[41]=s,t[42]=a,t[43]=z):z=t[43],(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5`,children:[S.length>0&&!p&&h===`all`&&_===`all`?(0,Z.jsxs)(`section`,{"aria-labelledby":`recent-workflows-heading`,children:[(0,Z.jsx)(`h2`,{id:`recent-workflows-heading`,className:`text-sm font-semibold text-fg`,children:u.recentlyUsed}),(0,Z.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:S.map(e=>{let{definition:t,lastRunAtMs:n}=e;return(0,Z.jsxs)(`button`,{type:`button`,className:l(`flex min-w-52 flex-1 items-center justify-between gap-3 rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 text-left hover:bg-surface-hover`,`sm:max-w-sm`,Ie.focusRingPanel),onClick:()=>a(t),children:[(0,Z.jsxs)(`span`,{className:`min-w-0`,children:[(0,Z.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:t.title}),(0,Z.jsx)(`span`,{className:`mt-0.5 block text-[11px] text-fg-subtle`,children:xt(n,c,d)})]}),(0,Z.jsx)(Xe,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0})]},t.id)})})]}):null,(0,Z.jsxs)(`section`,{"aria-labelledby":`all-workflows-heading`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-edge-subtle pb-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{id:`all-workflows-heading`,className:`text-sm font-semibold text-fg`,children:u.allWorkflows}),w]}),M]}),R]}),z]})]})}function Rt(e,t){return(t.startedAtMs??t.createdAtMs)-(e.startedAtMs??e.createdAtMs)}function zt(e){return[e.id,e]}function Bt(){return Date.now()}var Vt=(0,Y.memo)(function(e){let t=(0,X.c)(108),{run:n,language:r,localeTag:i,nowMs:a,onOpen:o,onOpenChat:s,onCancel:c,onRetry:u}=e,d,p,m,h,g,v,y,b,x,S,C,w,T,E,D,O,A;if(t[0]!==r||t[1]!==i||t[2]!==a||t[3]!==o||t[4]!==n){m=f(r).workflows;let e;t[22]===n?e=t[23]:(e=St(n),t[22]=n,t[23]=e),d=e;let s;t[24]===n?s=t[25]:(s=Ct(n),t[24]=n,t[25]=s),h=s;let c;t[26]===n?c=t[27]:(c=lt(n),t[26]=n,t[27]=c),p=!!c;let u=n.startedAtMs??n.createdAtMs,j=_(d?a-u:n.metrics.durationMs),M;t[28]!==n.metrics.agentCount||t[29]!==n.metrics.doneAgentCount?(M=n.metrics.agentCount>0?Math.round(n.metrics.doneAgentCount/n.metrics.agentCount*100):0,t[28]=n.metrics.agentCount,t[29]=n.metrics.doneAgentCount,t[30]=M):M=t[30];let N=M;x=`group border-b border-edge-subtle last:border-b-0`,b=`flex min-w-0 flex-col gap-3 p-3 transition-colors hover:bg-surface-hover/55 sm:px-4 lg:flex-row lg:items-center`,O=`button`,t[31]!==o||t[32]!==n?(A=()=>o(n),t[31]=o,t[32]=n,t[33]=A):A=t[33],t[34]===Symbol.for(`react.memo_cache_sentinel`)?(v=l(`min-w-0 flex-1 text-left`,Ie.focusRingPanel),t[34]=v):v=t[34];let P=m.taskOpenDetails,F;t[35]===n?F=t[36]:(F=pt(n),t[35]=n,t[36]=F),y=`${P}: ${F}`,E=`flex min-w-0 items-start gap-3`;let L;t[37]===n.status?L=t[38]:(L=l(`mt-0.5 shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold`,k(n.status)),t[37]=n.status,t[38]=L),D=(0,Z.jsx)(`span`,{className:L,children:m.status[n.status]??n.status}),g=`min-w-0 flex-1`;let R;t[39]===n?R=t[40]:(R=pt(n),t[39]=n,t[40]=R),t[41]===R?S=t[42]:(S=(0,Z.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:R}),t[41]=R,t[42]=S);let z;t[43]===n?z=t[44]:(z=mt(n),t[43]=n,t[44]=z);let B;t[45]===z?B=t[46]:(B=(0,Z.jsx)(`span`,{className:`truncate font-medium`,children:z}),t[45]=z,t[46]=B);let V;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(`span`,{"aria-hidden":!0,children:`·`}),t[47]=V):V=t[47];let U;t[48]!==i||t[49]!==a||t[50]!==u?(U=xt(u,a,i),t[48]=i,t[49]=a,t[50]=u,t[51]=U):U=t[51];let W;t[52]===U?W=t[53]:(W=(0,Z.jsx)(`span`,{children:U}),t[52]=U,t[53]=W);let G=j===`—`?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,Z.jsx)(`span`,{children:I(m.taskElapsed,{duration:j})})]});t[54]!==B||t[55]!==W||t[56]!==G?(C=(0,Z.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-muted`,children:[B,V,W,G]}),t[54]=B,t[55]=W,t[56]=G,t[57]=C):C=t[57],w=d&&n.metrics.agentCount>0?(0,Z.jsxs)(`span`,{className:`mt-2 block max-w-md`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center justify-between text-[11px] text-fg-subtle`,children:[(0,Z.jsx)(`span`,{children:I(m.agentProgress,{done:n.metrics.doneAgentCount,total:n.metrics.agentCount})}),(0,Z.jsxs)(`span`,{className:`tabular-nums`,children:[N,`%`]})]}),(0,Z.jsx)(`span`,{className:`mt-1 block h-1.5 overflow-hidden rounded-full bg-surface-muted`,children:(0,Z.jsx)(`span`,{className:`block h-full rounded-full bg-accent transition-[width] duration-200 motion-reduce:transition-none`,style:{width:`${N}%`}})})]}):null,T=n.metrics.errorAgentCount>0?(0,Z.jsxs)(`span`,{className:`mt-2 flex items-center gap-1 text-[11px] text-amber-700 dark:text-amber-300`,children:[(0,Z.jsx)(H,{className:`size-3 shrink-0`,"aria-hidden":!0}),I(m.runRowErrorSummary,{count:n.metrics.errorAgentCount})]}):null,t[0]=r,t[1]=i,t[2]=a,t[3]=o,t[4]=n,t[5]=d,t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=v,t[11]=y,t[12]=b,t[13]=x,t[14]=S,t[15]=C,t[16]=w,t[17]=T,t[18]=E,t[19]=D,t[20]=O,t[21]=A}else d=t[5],p=t[6],m=t[7],h=t[8],g=t[9],v=t[10],y=t[11],b=t[12],x=t[13],S=t[14],C=t[15],w=t[16],T=t[17],E=t[18],D=t[19],O=t[20],A=t[21];let j;t[58]!==g||t[59]!==S||t[60]!==C||t[61]!==w||t[62]!==T?(j=(0,Z.jsxs)(`span`,{className:g,children:[S,C,w,T]}),t[58]=g,t[59]=S,t[60]=C,t[61]=w,t[62]=T,t[63]=j):j=t[63];let M;t[64]!==j||t[65]!==E||t[66]!==D?(M=(0,Z.jsxs)(`div`,{className:E,children:[D,j]}),t[64]=j,t[65]=E,t[66]=D,t[67]=M):M=t[67];let N;t[68]!==v||t[69]!==y||t[70]!==M||t[71]!==O||t[72]!==A?(N=(0,Z.jsx)(`button`,{type:O,onClick:A,className:v,"aria-label":y,children:M}),t[68]=v,t[69]=y,t[70]=M,t[71]=O,t[72]=A,t[73]=N):N=t[73];let P;t[74]!==m.rerun||t[75]!==u||t[76]!==h||t[77]!==n.id?(P=h?(0,Z.jsx)(J,{type:`button`,variant:`primary`,className:`h-8 rounded-lg text-xs`,onClick:()=>u(n.id),children:m.rerun}):null,t[74]=m.rerun,t[75]=u,t[76]=h,t[77]=n.id,t[78]=P):P=t[78];let F;t[79]!==p||t[80]!==m.continueInChat||t[81]!==s||t[82]!==n?(F=n.status===`succeeded`&&p?(0,Z.jsx)(J,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>s(n),children:m.continueInChat}):null,t[79]=p,t[80]=m.continueInChat,t[81]=s,t[82]=n,t[83]=F):F=t[83];let L;t[84]!==d||t[85]!==m.cancel||t[86]!==c||t[87]!==n.id?(L=d?(0,Z.jsx)(J,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg text-xs text-red-600 dark:text-red-300`,onClick:()=>c(n.id),children:m.cancel}):null,t[84]=d,t[85]=m.cancel,t[86]=c,t[87]=n.id,t[88]=L):L=t[88];let R;t[89]!==o||t[90]!==n?(R=()=>o(n),t[89]=o,t[90]=n,t[91]=R):R=t[91];let z;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(Ve,{className:`size-4`,"aria-hidden":!0}),t[92]=z):z=t[92];let B;t[93]!==m.taskOpenDetails||t[94]!==R?(B=(0,Z.jsx)(J,{type:`button`,variant:`ghost`,className:`size-8 p-0`,"aria-label":m.taskOpenDetails,onClick:R,children:z}),t[93]=m.taskOpenDetails,t[94]=R,t[95]=B):B=t[95];let V;t[96]!==P||t[97]!==F||t[98]!==L||t[99]!==B?(V=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-1.5 pl-7 lg:pl-0`,children:[P,F,L,B]}),t[96]=P,t[97]=F,t[98]=L,t[99]=B,t[100]=V):V=t[100];let U;t[101]!==b||t[102]!==N||t[103]!==V?(U=(0,Z.jsxs)(`div`,{className:b,children:[N,V]}),t[101]=b,t[102]=N,t[103]=V,t[104]=U):U=t[104];let W;return t[105]!==x||t[106]!==U?(W=(0,Z.jsx)(`article`,{className:x,children:U}),t[105]=x,t[106]=U,t[107]=W):W=t[107],W});function Ht(e){let t=(0,X.c)(17),{vm:n}=e,{labels:r,language:i,loading:a,ownerAgentId:o,agentOptions:c,setOwnerAgentId:l,refreshAll:u}=n,d;t[0]!==c||t[1]!==r.agentFilterAria||t[2]!==i||t[3]!==o||t[4]!==l?(d=c.length>1?(0,Z.jsx)(ue,{value:o??``,"aria-label":r.agentFilterAria,onChange:e=>l(e.target.value),className:`h-9 min-w-32 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:c.map(e=>(0,Z.jsx)(pe,{value:e.id,children:K(e,f(i).agentsSettings)},e.id))}):null,t[0]=c,t[1]=r.agentFilterAria,t[2]=i,t[3]=o,t[4]=l,t[5]=d):d=t[5];let p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Qe,{className:`size-4`,"aria-hidden":!0}),t[6]=p):p=t[6];let m;t[7]===r.addWorkflow?m=t[8]:(m=(0,Z.jsx)(J,{asChild:!0,variant:`primary`,className:`h-9 rounded-lg`,children:(0,Z.jsxs)(s,{to:`/workflows/new`,children:[p,r.addWorkflow]})}),t[7]=r.addWorkflow,t[8]=m);let h;t[9]!==r.refresh||t[10]!==a||t[11]!==u?(h=(0,Z.jsx)(xe,{className:`size-9 shrink-0 p-0`,loading:a,label:r.refresh,onClick:u}),t[9]=r.refresh,t[10]=a,t[11]=u,t[12]=h):h=t[12];let g;return t[13]!==d||t[14]!==m||t[15]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[d,m,h]}),t[13]=d,t[14]=m,t[15]=h,t[16]=g):g=t[16],g}var Ut=new Set([`failed`,`timeout`,`cancelled`]),Wt=[{id:`runs`,icon:ce},{id:`library`,icon:g}],Gt={failed:0,timeout:0,cancelled:0,running:1,queued:2,succeeded:3};function Kt(e){return Ut.has(e.status)}function qt(e,t){return t===`all`?!0:t===`attention`?Kt(e):e.status===t}function Jt(e){return[...e].sort((e,t)=>{let n=(Gt[e.status]??4)-(Gt[t.status]??4);if(n!==0)return n;if(e.status===`queued`&&t.status===`queued`)return e.createdAtMs-t.createdAtMs;let r=e.completedAtMs??e.startedAtMs??e.createdAtMs;return(t.completedAtMs??t.startedAtMs??t.createdAtMs)-r})}function Yt(e,t){return e===`Home`?`runs`:e===`End`?`library`:e===`ArrowLeft`||e===`ArrowRight`?t===`runs`?`library`:`runs`:null}function Xt(){let e=(0,X.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Ne,{className:`h-5 w-16 rounded-full`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge-subtle p-4 last:border-b-0`,"aria-hidden":`true`,children:[t,(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(Ne,{className:`h-4 w-52 max-w-full`}),(0,Z.jsx)(Ne,{className:`mt-2 h-3 w-36 max-w-full`})]}),(0,Z.jsx)(Ne,{className:`hidden h-8 w-20 rounded-lg sm:block`})]}),e[1]=n):n=e[1],n}function Zt(e){let t=(0,X.c)(30),{vm:n}=e,{language:r,localeTag:i,labels:a,hasToken:o,definitions:s,runs:c,searchQuery:u,setSearchQuery:d,workflowFilterId:f,setWorkflowFilterId:p,triggerFilter:m,setTriggerFilter:h,statusFilter:g,setStatusFilter:_,clearRunFilters:v,pageTab:x,setPageTab:S,runLayout:C,setRunLayout:w,openRunDetails:T,openRunInChat:E,openDefinitionDetails:D,openWorkflowEditor:O,startWorkflow:k,actionError:A,loading:j,error:M,cancelRun:N,retryRun:P}=n,F=y(tn),I=y(en),L=Date.now(),R=Jt(c.filter(Kt)),z;t[0]===g?z=t[1]:(z=e=>qt(e,g),t[0]=g,t[1]=z);let B=Jt(gt(c,{searchQuery:u,workflowFilterId:f,triggerFilter:m}).filter(z)),V=!!(u||f||m!==`all`||g!==`all`),U,W;if(t[2]!==I||t[3]!==o||t[4]!==a.librarySubtitle||t[5]!==a.runsSubtitle||t[6]!==a.title||t[7]!==x||t[8]!==F||t[9]!==n?(U=()=>{if(!o){I();return}return F({startExtra:null,main:(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:a.title}),(0,Z.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:x===`runs`?a.runsSubtitle:a.librarySubtitle})]}),end:(0,Z.jsx)(Ht,{vm:n})}),()=>I()},W=[I,o,a.librarySubtitle,a.runsSubtitle,a.title,x,F,n],t[2]=I,t[3]=o,t[4]=a.librarySubtitle,t[5]=a.runsSubtitle,t[6]=a.title,t[7]=x,t[8]=F,t[9]=n,t[10]=U,t[11]=W):(U=t[10],W=t[11]),(0,Y.useLayoutEffect)(U,W),!o){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Je,{className:`size-10 text-accent-fg`,"aria-hidden":!0}),t[12]=e):e=t[12];let n;t[13]===a.title?n=t[14]:(n=(0,Z.jsx)(`h1`,{className:`mt-4 text-xl font-semibold text-fg`,children:a.title}),t[13]=a.title,t[14]=n);let r;t[15]===a.needToken?r=t[16]:(r=(0,Z.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:a.needToken}),t[15]=a.needToken,t[16]=r);let i;return t[17]!==n||t[18]!==r?(i=(0,Z.jsx)(`main`,{className:`min-h-0 flex-1 overflow-auto bg-surface-panel`,children:(0,Z.jsxs)(`div`,{className:`flex w-full flex-col items-center px-3 py-16 text-center sm:px-5 xl:px-6`,children:[e,n,r]})}),t[17]=n,t[18]=r,t[19]=i):i=t[19],i}let G=a.pageTabsAria,ee=Wt.map(e=>{let{id:t,icon:n}=e;return(0,Z.jsxs)(`button`,{id:`workflow-tab-${t}`,type:`button`,role:`tab`,"aria-selected":x===t,"aria-controls":`workflow-panel-${t}`,tabIndex:x===t?0:-1,draggable:!1,className:l(`relative inline-flex shrink-0 items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`transition-transform duration-150 ease-out active:scale-95 motion-reduce:transition-none motion-reduce:active:scale-100`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,x===t?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),onClick:()=>S(t),onKeyDown:e=>{let n=Yt(e.key,t);n&&(e.preventDefault(),S(n),window.requestAnimationFrame(()=>{document.getElementById(`workflow-tab-${n}`)?.focus()}))},children:[(0,Z.jsx)(n,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:a.pageTabs[t]}),t===`runs`&&R.length>0?(0,Z.jsx)(`span`,{className:`rounded-full bg-red-500/15 px-1.5 py-0.5 text-[10px] font-semibold text-red-700 dark:text-red-300`,children:R.length}):null]},t)}),te;t[20]!==a.pageTabsAria||t[21]!==ee?(te=(0,Z.jsx)(`nav`,{className:`-mx-1 flex gap-1 overflow-x-auto px-1 pb-1`,"aria-label":G,role:`tablist`,children:ee}),t[20]=a.pageTabsAria,t[21]=ee,t[22]=te):te=t[22];let ne;t[23]!==A||t[24]!==M?(ne=A??M?(0,Z.jsx)(`div`,{className:`mt-4 rounded-lg border border-red-500/25 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,role:`alert`,children:A??M}):null,t[23]=A,t[24]=M,t[25]=ne):ne=t[25];let re=x===`runs`?(0,Z.jsxs)(`div`,{id:`workflow-panel-runs`,role:`tabpanel`,"aria-labelledby":`workflow-tab-runs`,className:`flex flex-col gap-4 py-4`,children:[R.length>0?(0,Z.jsx)(`section`,{className:`rounded-xl border border-amber-500/30 bg-amber-500/8 px-4 py-3`,"aria-labelledby":`workflow-attention-heading`,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Z.jsx)(H,{className:`mt-0.5 size-4 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`h2`,{id:`workflow-attention-heading`,className:`text-sm font-semibold text-fg`,children:a.attentionTitle}),(0,Z.jsx)(`span`,{className:`rounded-full bg-amber-500/15 px-2 py-0.5 text-[10px] font-semibold text-amber-800 dark:text-amber-200`,children:R.length})]}),(0,Z.jsxs)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:[pt(R[0]),` · `,xt(R[0].completedAtMs??R[0].createdAtMs,L,i)]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:a.attentionHint})]})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pl-7 lg:pl-0`,children:[(0,Z.jsx)(J,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>T(R[0]),children:a.attentionView}),(0,Z.jsx)(J,{type:`button`,variant:`primary`,className:`h-8 rounded-lg text-xs`,onClick:()=>void P(R[0].id),children:a.rerun})]})]})}):null,(0,Z.jsx)(`section`,{className:`flex flex-col gap-3 rounded-xl border border-edge-subtle bg-surface-base p-3`,"aria-label":a.runFiltersAria,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(`div`,{className:`relative min-w-52 flex-1 sm:max-w-sm`,children:[(0,Z.jsx)(he,{className:`pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,Z.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),placeholder:a.runsSearchPlaceholder,className:l(`h-9 w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg shadow-surface`,`placeholder:text-fg-muted`,Ie.focusRingPanel)})]}),(0,Z.jsx)(ue,{value:g,"aria-label":a.statusFilterAria,onChange:e=>_(e.target.value),className:`h-9 min-w-32 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:[`all`,`attention`,`running`,`queued`,`succeeded`].map(e=>(0,Z.jsx)(pe,{value:e,children:a.runStatuses[e]},e))}),(0,Z.jsxs)(ue,{value:m,"aria-label":a.boardTriggerFilterAria,onChange:e=>h(e.target.value),className:`h-9 min-w-[7.5rem] rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:[(0,Z.jsx)(pe,{value:`all`,children:a.boardTriggerFilterAll}),(0,Z.jsx)(pe,{value:`automation`,children:a.boardTriggerFilterAutomation}),(0,Z.jsx)(pe,{value:`webui`,children:a.boardTriggerFilterWebui}),(0,Z.jsx)(pe,{value:`chat`,children:a.boardTriggerFilterChat}),(0,Z.jsx)(pe,{value:`api`,children:a.boardTriggerFilterApi})]}),(0,Z.jsxs)(ue,{value:f,"aria-label":a.boardWorkflowFilterAria,onChange:e=>p(e.target.value),className:`h-9 min-w-40 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:[(0,Z.jsx)(pe,{value:``,children:a.boardWorkflowFilterAll}),s.map($t)]}),V?(0,Z.jsxs)(J,{type:`button`,variant:`ghost`,className:`h-9 rounded-lg text-xs`,onClick:v,children:[(0,Z.jsx)(b,{className:`size-3.5`,"aria-hidden":!0}),a.clearFilters]}):null,(0,Z.jsxs)(`div`,{className:`ml-auto flex rounded-lg bg-surface-muted p-0.5`,role:`group`,"aria-label":a.layoutAria,children:[(0,Z.jsxs)(`button`,{type:`button`,className:l(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,C===`list`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,Ie.focusRingPanel),"aria-pressed":C===`list`,onClick:()=>w(`list`),children:[(0,Z.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0}),a.runLayouts.list]}),(0,Z.jsxs)(`button`,{type:`button`,className:l(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,C===`board`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,Ie.focusRingPanel),"aria-pressed":C===`board`,onClick:()=>w(`board`),children:[(0,Z.jsx)(We,{className:`size-3.5`,"aria-hidden":!0}),a.runLayouts.board]})]})]})}),C===`list`?(0,Z.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge-subtle bg-surface-base`,"aria-labelledby":`workflow-runs-heading`,children:[(0,Z.jsxs)(`header`,{className:`flex items-start justify-between gap-3 border-b border-edge-subtle px-4 py-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{id:`workflow-runs-heading`,className:`text-sm font-semibold text-fg`,children:a.allRuns}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a.allRunsHint})]}),(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-xs font-semibold tabular-nums text-fg-muted`,children:B.length})]}),j&&B.length===0?Array.from({length:4}).map(Qt):B.length>0?B.map(e=>(0,Z.jsx)(Vt,{run:e,language:r,localeTag:i,nowMs:L,onOpen:T,onOpenChat:E,onCancel:e=>void N(e),onRetry:e=>void P(e)},e.id)):(0,Z.jsxs)(`div`,{className:`flex min-h-64 flex-col items-center justify-center px-4 py-12 text-center`,children:[(0,Z.jsx)(Je,{className:`size-8 text-fg-subtle`,"aria-hidden":!0}),(0,Z.jsx)(`h3`,{className:`mt-3 text-sm font-semibold text-fg`,children:V?a.noRunResultsTitle:a.noRunsTitle}),(0,Z.jsx)(`p`,{className:`mt-1 max-w-md text-xs leading-5 text-fg-muted`,children:V?a.noRunResultsHint:a.noRunsStartHint}),(0,Z.jsx)(J,{type:`button`,variant:V?`secondary`:`primary`,className:`mt-4 h-9 rounded-lg text-xs`,onClick:V?v:()=>S(`library`),children:V?a.clearFilters:a.chooseWorkflow})]})]}):(0,Z.jsx)(`div`,{className:`h-[min(72vh,48rem)] min-h-[24rem] w-full sm:min-h-[28rem]`,children:(0,Z.jsx)(jt,{runs:B,language:r,localeTag:i,labels:{boardEmptyTitle:a.boardEmptyTitle,boardEmptyHint:a.boardEmptyHint,boardStart:a.chooseWorkflow,loading:a.loading},searchQuery:``,workflowFilterId:``,triggerFilter:`all`,selectedRunId:null,loading:j,onOpenRun:T,onOpenRunChat:E,onCancelRun:e=>void N(e),onRetryRun:e=>void P(e),onStart:()=>S(`library`)})})]}):(0,Z.jsxs)(`section`,{id:`workflow-panel-library`,role:`tabpanel`,"aria-labelledby":`workflow-tab-library`,className:`py-5`,children:[(0,Z.jsxs)(`div`,{className:`mb-5`,children:[(0,Z.jsx)(`h2`,{id:`workflow-library-heading`,className:`text-base font-semibold text-fg`,children:a.libraryTitle}),(0,Z.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:a.libraryDescription})]}),(0,Z.jsx)(Lt,{definitions:s,runs:c,language:r,onPick:k,onDetail:D,onEdit:O})]}),ie;return t[26]!==ne||t[27]!==re||t[28]!==te?(ie=(0,Z.jsx)(`main`,{className:`min-h-0 flex-1 overflow-y-auto bg-surface-panel`,children:(0,Z.jsxs)(`div`,{className:`mx-auto flex min-h-full w-full max-w-[96rem] flex-col px-3 py-5 sm:px-5 xl:px-6`,children:[te,ne,re]})}),t[26]=ne,t[27]=re,t[28]=te,t[29]=ie):ie=t[29],ie}function Qt(e,t){return(0,Z.jsx)(Xt,{},t)}function $t(e){return(0,Z.jsx)(pe,{value:e.id,children:e.title},e.id)}function en(e){return e.clearPageHeader}function tn(e){return e.setPageHeader}function nn(){let e=(0,X.c)(114),t=m(cn),n;e[0]===t?n=e[1]:(n=f(t),e[0]=t,e[1]=n);let r=n.workflows,i=t===`zh`?`zh-CN`:`en-US`,s=p(sn),c=!!s,l=o(),[u,d]=a(),g;e[2]===u?g=e[3]:(g=u.get(`q`)??``,e[2]=u,e[3]=g);let _=g,v;e[4]===u?v=e[5]:(v=u.get(`wf`)?.trim()??``,e[4]=u,e[5]=v);let y=v,b;e[6]===u?b=e[7]:(b=u.get(`trigger`)?.trim()||`all`,e[6]=u,e[7]=b);let x=b,S,C,w,T;if(e[8]!==u){let t=u.get(`status`)?.trim()??``,n=u.get(`tab`)?.trim()??``,r=u.get(`layout`)?.trim()??``;S=u.get(`agent`)?.trim()??``,C=ae.has(n)?n:`runs`,w=N.has(r)?r:`list`,T=le.has(t)?t:`all`,e[8]=u,e[9]=S,e[10]=C,e[11]=w,e[12]=T}else S=e[9],C=e[10],w=e[11],T=e[12];let E=T,[D,k]=(0,Y.useState)(null),j;e[13]!==c||e[14]!==s?(j=c?[`workflow-agents`,s]:null,e[13]=c,e[14]=s,e[15]=j):j=e[15];let P;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(P={revalidateOnFocus:!1},e[16]=P):P=e[16];let F=h(j,M,P),I;bb0:{let e=F.data?.agents??[];if(S&&(e.length===0||e.some(e=>e.id===S))){I=S;break bb0}I=F.data?.defaultId}let L=I,R;e[17]!==c||e[18]!==s?(R=c?[`workflow-definitions`,s]:null,e[17]=c,e[18]=s,e[19]=R):R=e[19];let z;e[20]===Symbol.for(`react.memo_cache_sentinel`)?(z={revalidateOnFocus:!1},e[20]=z):z=e[20];let B=h(R,$e,z),V;e[21]!==c||e[22]!==L||e[23]!==s?(V=c&&L?[`workflow-runs`,s,L]:null,e[21]=c,e[22]=L,e[23]=s,e[24]=V):V=e[24];let H;e[25]===L?H=e[26]:(H=()=>Ze(100,{ownerAgentId:L}),e[25]=L,e[26]=H);let U;e[27]===Symbol.for(`react.memo_cache_sentinel`)?(U={revalidateOnFocus:!1,refreshInterval:an},e[27]=U):U=e[27];let W=h(V,H,U),G;e[28]===B.data?G=e[29]:(G=B.data??[],e[28]=B.data,e[29]=G);let ee=G,te;e[30]===W.data?te=e[31]:(te=W.data??[],e[30]=W.data,e[31]=te);let ne=te,re;e[32]===d?re=e[33]:(re=e=>{d(t=>{let n=new URLSearchParams(t);return e(n),n},{replace:!0})},e[32]=d,e[33]=re);let K=re,oe;e[34]===K?oe=e[35]:(oe=e=>K(t=>{let n=e.trim();n?t.set(`q`,n):t.delete(`q`)}),e[34]=K,e[35]=oe);let ce=oe,ue;e[36]===K?ue=e[37]:(ue=e=>K(t=>{let n=e.trim();n?t.set(ie,n):t.delete(ie)}),e[36]=K,e[37]=ue);let de=ue,fe;e[38]===K?fe=e[39]:(fe=e=>K(t=>{let n=e.trim();n?t.set(`wf`,n):t.delete(`wf`)}),e[38]=K,e[39]=fe);let pe=fe,me;e[40]===K?me=e[41]:(me=e=>K(t=>{e&&e!==`all`?t.set(se,e):t.delete(se)}),e[40]=K,e[41]=me);let he=me,ge;e[42]===K?ge=e[43]:(ge=e=>K(t=>{e===`runs`?t.delete(`tab`):t.set(`tab`,e)}),e[42]=K,e[43]=ge);let _e=ge,ve;e[44]===K?ve=e[45]:(ve=e=>K(t=>{e===`list`?t.delete(O):t.set(O,e)}),e[44]=K,e[45]=ve);let ye=ve,be;e[46]===K?be=e[47]:(be=e=>K(t=>{e===`all`?t.delete(A):t.set(A,e)}),e[46]=K,e[47]=be);let xe=be,q;e[48]===K?q=e[49]:(q=()=>K(rn),e[48]=K,e[49]=q);let Se=q,we=L?`?agentId=${encodeURIComponent(L)}`:``,Te;e[50]!==l||e[51]!==we?(Te=e=>l(`/workflows/${e.id}${we}`),e[50]=l,e[51]=we,e[52]=Te):Te=e[52];let Ee=Te,De=Ee,Oe;e[53]!==l||e[54]!==L||e[55]!==we?(Oe=e=>{l(e.metadata.source===`user`?`/workflows/${e.id}/edit${we}`:`/workflows/new?copy=${encodeURIComponent(e.id)}${L?`&agentId=${encodeURIComponent(L)}`:``}`)},e[53]=l,e[54]=L,e[55]=we,e[56]=Oe):Oe=e[56];let ke=Oe,Ae;e[57]!==l||e[58]!==we?(Ae=e=>l(`/workflows/runs/${e.id}${we}`),e[57]=l,e[58]=we,e[59]=Ae):Ae=e[59];let je=Ae,Me;e[60]===l?Me=e[61]:(Me=e=>{let t=lt(e);t&&l(et(t))},e[60]=l,e[61]=Me);let Ne=Me,Pe;e[62]!==r.cancelFailed||e[63]!==L||e[64]!==W?(Pe=async e=>{try{await Ce(e,{ownerAgentId:L}),await W.mutate()}catch(e){let t=e;k(t instanceof Error?t.message:r.cancelFailed)}},e[62]=r.cancelFailed,e[63]=L,e[64]=W,e[65]=Pe):Pe=e[65];let Fe=Pe,Ie;e[66]!==r.retryFailed||e[67]!==l||e[68]!==L||e[69]!==we?(Ie=async e=>{try{l(`/workflows/runs/${(await Ye(e,{ownerAgentId:L})).runId}${we}`)}catch(e){let t=e;k(t instanceof Error?t.message:r.retryFailed)}},e[66]=r.retryFailed,e[67]=l,e[68]=L,e[69]=we,e[70]=Ie):Ie=e[70];let Le=Ie,Re,ze;e[71]===W?(Re=e[72],ze=e[73]):(Re=()=>{let e=()=>void W.mutate();return window.addEventListener(`workflow-run-updated`,e),window.addEventListener(`workflow-run-error`,e),()=>{window.removeEventListener(`workflow-run-updated`,e),window.removeEventListener(`workflow-run-error`,e)}},ze=[W],e[71]=W,e[72]=Re,e[73]=ze),(0,Y.useEffect)(Re,ze);let Be;e[74]!==F||e[75]!==B||e[76]!==W?(Be=()=>{Promise.all([F.mutate(),B.mutate(),W.mutate()])},e[74]=F,e[75]=B,e[76]=W,e[77]=Be):Be=e[77];let Ve=Be,He=F.isLoading||B.isLoading||W.isLoading,Ue=F.error?.message??B.error?.message??W.error?.message??null,We;e[78]===F.data?.agents?We=e[79]:(We=F.data?.agents??[],e[78]=F.data?.agents,e[79]=We);let Ge;return e[80]!==D||e[81]!==Fe||e[82]!==Se||e[83]!==ee||e[84]!==Ue||e[85]!==c||e[86]!==r||e[87]!==t||e[88]!==He||e[89]!==i||e[90]!==Ee||e[91]!==je||e[92]!==Ne||e[93]!==ke||e[94]!==L||e[95]!==C||e[96]!==Ve||e[97]!==Le||e[98]!==w||e[99]!==ne||e[100]!==_||e[101]!==de||e[102]!==_e||e[103]!==ye||e[104]!==ce||e[105]!==xe||e[106]!==he||e[107]!==pe||e[108]!==De||e[109]!==E||e[110]!==We||e[111]!==x||e[112]!==y?(Ge={language:t,localeTag:i,labels:r,hasToken:c,searchQuery:_,setSearchQuery:ce,ownerAgentId:L,agentOptions:We,setOwnerAgentId:de,workflowFilterId:y,setWorkflowFilterId:pe,triggerFilter:x,setTriggerFilter:he,statusFilter:E,setStatusFilter:xe,clearRunFilters:Se,pageTab:C,setPageTab:_e,runLayout:w,setRunLayout:ye,definitions:ee,runs:ne,openDefinitionDetails:Ee,startWorkflow:De,openWorkflowEditor:ke,openRunDetails:je,openRunInChat:Ne,actionError:D,loading:He,error:Ue,refreshAll:Ve,cancelRun:Fe,retryRun:Le},e[80]=D,e[81]=Fe,e[82]=Se,e[83]=ee,e[84]=Ue,e[85]=c,e[86]=r,e[87]=t,e[88]=He,e[89]=i,e[90]=Ee,e[91]=je,e[92]=Ne,e[93]=ke,e[94]=L,e[95]=C,e[96]=Ve,e[97]=Le,e[98]=w,e[99]=ne,e[100]=_,e[101]=de,e[102]=_e,e[103]=ye,e[104]=ce,e[105]=xe,e[106]=he,e[107]=pe,e[108]=De,e[109]=E,e[110]=We,e[111]=x,e[112]=y,e[113]=Ge):Ge=e[113],Ge}function rn(e){e.delete(`q`),e.delete(`wf`),e.delete(se),e.delete(A)}function an(e){return e?.some(on)?3e3:0}function on(e){return e.status===`queued`||e.status===`running`}function sn(e){return e.token}function cn(e){return e.language}function ln(){let e=(0,X.c)(2),t=nn(),n;return e[0]===t?n=e[1]:(n=(0,Z.jsx)(Zt,{vm:t}),e[0]=t,e[1]=n),n}function un(e){if(typeof e==`string`||typeof e==`number`)return``+e;let t=``;if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=un(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var dn={value:()=>{}};function fn(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new pn(n)}function pn(e){this._=e}function mn(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}pn.prototype=fn.prototype={constructor:pn,on:function(e,t){var n=this._,r=mn(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=hn(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=gn(n[i],e.name,t);else if(t==null)for(i in n)n[i]=gn(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new pn(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function hn(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function gn(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=dn,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var _n={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function vn(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),_n.hasOwnProperty(t)?{space:_n[t],local:e}:e}function yn(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function bn(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function xn(e){var t=vn(e);return(t.local?bn:yn)(t)}function Sn(){}function Cn(e){return e==null?Sn:function(){return this.querySelector(e)}}function wn(e){typeof e!=`function`&&(e=Cn(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new fi(r,this._parents)}function Tn(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function En(){return[]}function Dn(e){return e==null?En:function(){return this.querySelectorAll(e)}}function On(e){return function(){return Tn(e.apply(this,arguments))}}function kn(e){e=typeof e==`function`?On(e):Dn(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new fi(r,i)}function An(e){return function(){return this.matches(e)}}function jn(e){return function(t){return t.matches(e)}}var Mn=Array.prototype.find;function Nn(e){return function(){return Mn.call(this.children,e)}}function Pn(){return this.firstElementChild}function Fn(e){return this.select(e==null?Pn:Nn(typeof e==`function`?e:jn(e)))}var In=Array.prototype.filter;function Ln(){return Array.from(this.children)}function Rn(e){return function(){return In.call(this.children,e)}}function zn(e){return this.selectAll(e==null?Ln:Rn(typeof e==`function`?e:jn(e)))}function Bn(e){typeof e!=`function`&&(e=An(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new fi(r,this._parents)}function Vn(e){return Array(e.length)}function Hn(){return new fi(this._enter||this._groups.map(Vn),this._parents)}function Un(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Un.prototype={constructor:Un,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Wn(e){return function(){return e}}function Gn(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new Un(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function Kn(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new Un(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function qn(e){return e.__data__}function Jn(e,t){if(!arguments.length)return Array.from(this,qn);var n=t?Kn:Gn,r=this._parents,i=this._groups;typeof e!=`function`&&(e=Wn(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=Yn(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new fi(o,r),o._enter=s,o._exit=c,o}function Yn(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function Xn(){return new fi(this._exit||this._groups.map(Vn),this._parents)}function Zn(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function Qn(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new fi(s,this._parents)}function $n(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function er(e){e||=tr;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new fi(i,this._parents).order()}function tr(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function nr(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function rr(){return Array.from(this)}function ir(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function ar(){let e=0;for(let t of this)++e;return e}function or(){return!this.node()}function sr(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function cr(e){return function(){this.removeAttribute(e)}}function lr(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ur(e,t){return function(){this.setAttribute(e,t)}}function dr(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function fr(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function pr(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function mr(e,t){var n=vn(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?lr:cr:typeof t==`function`?n.local?pr:fr:n.local?dr:ur)(n,t))}function hr(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function gr(e){return function(){this.style.removeProperty(e)}}function _r(e,t,n){return function(){this.style.setProperty(e,t,n)}}function vr(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function yr(e,t,n){return arguments.length>1?this.each((t==null?gr:typeof t==`function`?vr:_r)(e,t,n??``)):br(this.node(),e)}function br(e,t){return e.style.getPropertyValue(t)||hr(e).getComputedStyle(e,null).getPropertyValue(t)}function xr(e){return function(){delete this[e]}}function Sr(e,t){return function(){this[e]=t}}function Cr(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function wr(e,t){return arguments.length>1?this.each((t==null?xr:typeof t==`function`?Cr:Sr)(e,t)):this.node()[e]}function Tr(e){return e.trim().split(/^|\s+/)}function Er(e){return e.classList||new Dr(e)}function Dr(e){this._node=e,this._names=Tr(e.getAttribute(`class`)||``)}Dr.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function Or(e,t){for(var n=Er(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function kr(e,t){for(var n=Er(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function Ar(e){return function(){Or(this,e)}}function jr(e){return function(){kr(this,e)}}function Mr(e,t){return function(){(t.apply(this,arguments)?Or:kr)(this,e)}}function Nr(e,t){var n=Tr(e+``);if(arguments.length<2){for(var r=Er(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?Mr:t?Ar:jr)(n,t))}function Pr(){this.textContent=``}function Fr(e){return function(){this.textContent=e}}function Ir(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function Lr(e){return arguments.length?this.each(e==null?Pr:(typeof e==`function`?Ir:Fr)(e)):this.node().textContent}function Rr(){this.innerHTML=``}function zr(e){return function(){this.innerHTML=e}}function Br(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function Vr(e){return arguments.length?this.each(e==null?Rr:(typeof e==`function`?Br:zr)(e)):this.node().innerHTML}function Hr(){this.nextSibling&&this.parentNode.appendChild(this)}function Ur(){return this.each(Hr)}function Wr(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Gr(){return this.each(Wr)}function Kr(e){var t=typeof e==`function`?e:xn(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function qr(){return null}function Jr(e,t){var n=typeof e==`function`?e:xn(e),r=t==null?qr:typeof t==`function`?t:Cn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Yr(){var e=this.parentNode;e&&e.removeChild(this)}function Xr(){return this.each(Yr)}function Zr(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Qr(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function $r(e){return this.select(e?Qr:Zr)}function ei(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function ti(e){return function(t){e.call(this,t,this.__data__)}}function ni(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function ri(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function ii(e,t,n){return function(){var r=this.__on,i,a=ti(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function ai(e,t,n){var r=ni(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(s=t?ii:ri,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function oi(e,t,n){var r=hr(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function si(e,t){return function(){return oi(this,e,t)}}function ci(e,t){return function(){return oi(this,e,t.apply(this,arguments))}}function li(e,t){return this.each((typeof t==`function`?ci:si)(e,t))}function*ui(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var di=[null];function fi(e,t){this._groups=e,this._parents=t}function pi(){return new fi([[document.documentElement]],di)}function mi(){return this}fi.prototype=pi.prototype={constructor:fi,select:wn,selectAll:kn,selectChild:Fn,selectChildren:zn,filter:Bn,data:Jn,enter:Hn,exit:Xn,join:Zn,merge:Qn,selection:mi,order:$n,sort:er,call:nr,nodes:rr,node:ir,size:ar,empty:or,each:sr,attr:mr,style:yr,property:wr,classed:Nr,text:Lr,html:Vr,raise:Ur,lower:Gr,append:Kr,insert:Jr,remove:Xr,clone:$r,datum:ei,on:ai,dispatch:li,[Symbol.iterator]:ui};function hi(e){return typeof e==`string`?new fi([[document.querySelector(e)]],[document.documentElement]):new fi([[e]],di)}function gi(e){let t;for(;t=e.sourceEvent;)e=t;return e}function _i(e,t){if(e=gi(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var vi={passive:!1},yi={capture:!0,passive:!1};function bi(e){e.stopImmediatePropagation()}function xi(e){e.preventDefault(),e.stopImmediatePropagation()}function Si(e){var t=e.document.documentElement,n=hi(e).on(`dragstart.drag`,xi,yi);`onselectstart`in t?n.on(`selectstart.drag`,xi,yi):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function Ci(e,t){var n=e.document.documentElement,r=hi(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,xi,yi),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var wi=e=>()=>e;function Ti(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}Ti.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Ei(e){return!e.ctrlKey&&!e.button}function Di(){return this.parentNode}function Oi(e,t){return t??{x:e.x,y:e.y}}function ki(){return navigator.maxTouchPoints||`ontouchstart`in this}function Ai(){var e=Ei,t=Di,n=Oi,r=ki,i={},a=fn(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,vi).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!(u||!e.call(this,n,r))){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(hi(n.view).on(`mousemove.drag`,m,yi).on(`mouseup.drag`,h,yi),Si(n.view),bi(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(xi(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){hi(e.view).on(`mousemove.drag mouseup.drag`,null),Ci(e.view,l),xi(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r)){var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s,c;for(s=0;s<o;++s)(c=y(this,a,n,r,i[s].identifier,i[s]))&&(bi(n),c(`start`,n,i[s]))}}function _(e){var t=e.changedTouches,n=t.length,r,a;for(r=0;r<n;++r)(a=i[t[r].identifier])&&(xi(e),a(`drag`,e,t[r]))}function v(e){var t=e.changedTouches,n=t.length,r,a;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),r=0;r<n;++r)(a=i[t[r].identifier])&&(bi(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=_i(l||r,t),p,m,h;if((h=n.call(e,new Ti(`beforestart`,{sourceEvent:r,target:f,identifier:c,active:o,x:d[0],y:d[1],dx:0,dy:0,dispatch:u}),s))!=null)return p=h.x-d[0]||0,m=h.y-d[1]||0,function n(r,a,l){var g=d,_;switch(r){case`start`:i[c]=n,_=o++;break;case`end`:delete i[c],--o;case`drag`:d=_i(l||a,t),_=o;break}u.call(r,e,new Ti(r,{sourceEvent:a,subject:h,target:f,identifier:c,active:_,x:d[0]+p,y:d[1]+m,dx:d[0]-g[0],dy:d[1]-g[1],dispatch:u}),s)}}return f.filter=function(t){return arguments.length?(e=typeof t==`function`?t:wi(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:wi(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:wi(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:wi(!!e),f):r},f.on=function(){var e=a.on.apply(a,arguments);return e===a?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}function ji(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Mi(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Ni(){}var Pi=.7,Fi=1/Pi,Ii=`\\s*([+-]?\\d+)\\s*`,Li=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,Ri=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,zi=/^#([0-9a-f]{3,8})$/,Bi=RegExp(`^rgb\\(${Ii},${Ii},${Ii}\\)$`),Vi=RegExp(`^rgb\\(${Ri},${Ri},${Ri}\\)$`),Hi=RegExp(`^rgba\\(${Ii},${Ii},${Ii},${Li}\\)$`),Ui=RegExp(`^rgba\\(${Ri},${Ri},${Ri},${Li}\\)$`),Wi=RegExp(`^hsl\\(${Li},${Ri},${Ri}\\)$`),Gi=RegExp(`^hsla\\(${Li},${Ri},${Ri},${Li}\\)$`),Ki={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};ji(Ni,Zi,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:qi,formatHex:qi,formatHex8:Ji,formatHsl:Yi,formatRgb:Xi,toString:Xi});function qi(){return this.rgb().formatHex()}function Ji(){return this.rgb().formatHex8()}function Yi(){return ua(this).formatHsl()}function Xi(){return this.rgb().formatRgb()}function Zi(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=zi.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Qi(t):n===3?new na(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?$i(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?$i(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Bi.exec(e))?new na(t[1],t[2],t[3],1):(t=Vi.exec(e))?new na(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Hi.exec(e))?$i(t[1],t[2],t[3],t[4]):(t=Ui.exec(e))?$i(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Wi.exec(e))?la(t[1],t[2]/100,t[3]/100,1):(t=Gi.exec(e))?la(t[1],t[2]/100,t[3]/100,t[4]):Ki.hasOwnProperty(e)?Qi(Ki[e]):e===`transparent`?new na(NaN,NaN,NaN,0):null}function Qi(e){return new na(e>>16&255,e>>8&255,e&255,1)}function $i(e,t,n,r){return r<=0&&(e=t=n=NaN),new na(e,t,n,r)}function ea(e){return e instanceof Ni||(e=Zi(e)),e?(e=e.rgb(),new na(e.r,e.g,e.b,e.opacity)):new na}function ta(e,t,n,r){return arguments.length===1?ea(e):new na(e,t,n,r??1)}function na(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}ji(na,ta,Mi(Ni,{brighter(e){return e=e==null?Fi:Fi**+e,new na(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Pi:Pi**+e,new na(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new na(sa(this.r),sa(this.g),sa(this.b),oa(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ra,formatHex:ra,formatHex8:ia,formatRgb:aa,toString:aa}));function ra(){return`#${ca(this.r)}${ca(this.g)}${ca(this.b)}`}function ia(){return`#${ca(this.r)}${ca(this.g)}${ca(this.b)}${ca((isNaN(this.opacity)?1:this.opacity)*255)}`}function aa(){let e=oa(this.opacity);return`${e===1?`rgb(`:`rgba(`}${sa(this.r)}, ${sa(this.g)}, ${sa(this.b)}${e===1?`)`:`, ${e})`}`}function oa(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function sa(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ca(e){return e=sa(e),(e<16?`0`:``)+e.toString(16)}function la(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new fa(e,t,n,r)}function ua(e){if(e instanceof fa)return new fa(e.h,e.s,e.l,e.opacity);if(e instanceof Ni||(e=Zi(e)),!e)return new fa;if(e instanceof fa)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new fa(o,s,c,e.opacity)}function da(e,t,n,r){return arguments.length===1?ua(e):new fa(e,t,n,r??1)}function fa(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}ji(fa,da,Mi(Ni,{brighter(e){return e=e==null?Fi:Fi**+e,new fa(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Pi:Pi**+e,new fa(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new na(ha(e>=240?e-240:e+120,i,r),ha(e,i,r),ha(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new fa(pa(this.h),ma(this.s),ma(this.l),oa(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=oa(this.opacity);return`${e===1?`hsl(`:`hsla(`}${pa(this.h)}, ${ma(this.s)*100}%, ${ma(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function pa(e){return e=(e||0)%360,e<0?e+360:e}function ma(e){return Math.max(0,Math.min(1,e||0))}function ha(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var ga=e=>()=>e;function _a(e,t){return function(n){return e+n*t}}function va(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function ya(e){return(e=+e)==1?ba:function(t,n){return n-t?va(t,n,e):ga(isNaN(t)?n:t)}}function ba(e,t){var n=t-e;return n?_a(e,n):ga(isNaN(e)?t:e)}var xa=(function e(t){var n=ya(t);function r(e,t){var r=n((e=ta(e)).r,(t=ta(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=ba(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function Sa(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function Ca(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function wa(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o;for(o=0;o<r;++o)i[o]=Na(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function Ta(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Ea(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Da(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=Na(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var Oa=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ka=new RegExp(Oa.source,`g`);function Aa(e){return function(){return e}}function ja(e){return function(t){return e(t)+``}}function Ma(e,t){var n=Oa.lastIndex=ka.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=Oa.exec(e))&&(i=ka.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:Ea(r,i)})),n=ka.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?ja(c[0].x):Aa(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function Na(e,t){var n=typeof t,r;return t==null||n===`boolean`?ga(t):(n===`number`?Ea:n===`string`?(r=Zi(t))?(t=r,xa):Ma:t instanceof Zi?xa:t instanceof Date?Ta:Ca(t)?Sa:Array.isArray(t)?wa:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?Da:Ea)(e,t)}var Pa=180/Math.PI,Fa={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ia(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*Pa,skewX:Math.atan(c)*Pa,scaleX:o,scaleY:s}}var La;function Ra(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?Fa:Ia(t.a,t.b,t.c,t.d,t.e,t.f)}function za(e){return e==null||(La||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),La.setAttribute(`transform`,e),!(e=La.transform.baseVal.consolidate()))?Fa:(e=e.matrix,Ia(e.a,e.b,e.c,e.d,e.e,e.f))}function Ba(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:Ea(e,i)},{i:c-2,x:Ea(r,a)})}else (i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:Ea(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:Ea(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:Ea(e,n)},{i:s-2,x:Ea(t,r)})}else (n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var Va=Ba(Ra,`px, `,`px)`,`deg)`),Ha=Ba(za,`, `,`)`,`)`),Ua=1e-12;function Wa(e){return((e=Math.exp(e))+1/e)/2}function Ga(e){return((e=Math.exp(e))-1/e)/2}function Ka(e){return((e=Math.exp(2*e))-1)/(e+1)}var qa=(function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p<Ua)h=Math.log(u/s)/t,m=function(e){return[a+e*d,o+e*f,s*Math.exp(t*e*h)]};else{var g=Math.sqrt(p),_=(u*u-s*s+r*p)/(2*s*n*g),v=(u*u-s*s-r*p)/(2*u*n*g),y=Math.log(Math.sqrt(_*_+1)-_);h=(Math.log(Math.sqrt(v*v+1)-v)-y)/t,m=function(e){var r=e*h,i=Wa(y),c=s/(n*g)*(i*Ka(t*r+y)-Ga(y));return[a+c*d,o+c*f,s*i/Wa(t*r+y)]}}return m.duration=h*1e3*t/Math.SQRT2,m}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i})(Math.SQRT2,2,4),Ja=0,Ya=0,Xa=0,Za=1e3,Qa,$a,eo=0,to=0,no=0,ro=typeof performance==`object`&&performance.now?performance:Date,io=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function ao(){return to||=(io(oo),ro.now()+no)}function oo(){to=0}function so(){this._call=this._time=this._next=null}so.prototype=co.prototype={constructor:so,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?ao():+n)+(t==null?0:+t),!this._next&&$a!==this&&($a?$a._next=this:Qa=this,$a=this),this._call=e,this._time=n,mo()},stop:function(){this._call&&(this._call=null,this._time=1/0,mo())}};function co(e,t,n){var r=new so;return r.restart(e,t,n),r}function lo(){ao(),++Ja;for(var e=Qa,t;e;)(t=to-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ja}function uo(){to=(eo=ro.now())+no,Ja=Ya=0;try{lo()}finally{Ja=0,po(),to=0}}function fo(){var e=ro.now(),t=e-eo;t>Za&&(no-=t,eo=e)}function po(){for(var e,t=Qa,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Qa=n);$a=e,mo(r)}function mo(e){Ja||(Ya&&=clearTimeout(Ya),e-to>24?(e<1/0&&(Ya=setTimeout(uo,e-ro.now()-no)),Xa&&=clearInterval(Xa)):(Xa||=(eo=ro.now(),setInterval(fo,Za)),Ja=1,io(uo)))}function ho(e,t,n){var r=new so;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var go=fn(`start`,`end`,`cancel`,`interrupt`),_o=[];function vo(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;So(e,n,{name:t,index:r,group:i,on:go,tween:_o,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function yo(e,t){var n=xo(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function bo(e,t){var n=xo(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function xo(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function So(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=co(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return ho(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(ho(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function Co(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function wo(e){return this.each(function(){Co(this,e)})}function To(e,t){var n,r;return function(){var i=bo(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function Eo(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=bo(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function Do(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=xo(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?To:Eo)(n,e,t))}function Oo(e,t,n){var r=e._id;return e.each(function(){var e=bo(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return xo(e,r).value[t]}}function ko(e,t){var n;return(typeof t==`number`?Ea:t instanceof Zi?xa:(n=Zi(t))?(t=n,xa):Ma)(e,t)}function Ao(e){return function(){this.removeAttribute(e)}}function jo(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Mo(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function No(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function Po(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function Fo(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function Io(e,t){var n=vn(e),r=n===`transform`?Ha:ko;return this.attrTween(e,typeof t==`function`?(n.local?Fo:Po)(n,r,Oo(this,`attr.`+e,t)):t==null?(n.local?jo:Ao)(n):(n.local?No:Mo)(n,r,t))}function Lo(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Ro(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function zo(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Ro(e,i)),n}return i._value=t,i}function Bo(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Lo(e,i)),n}return i._value=t,i}function Vo(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=vn(e);return this.tween(n,(r.local?zo:Bo)(r,t))}function Ho(e,t){return function(){yo(this,e).delay=+t.apply(this,arguments)}}function Uo(e,t){return t=+t,function(){yo(this,e).delay=t}}function Wo(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Ho:Uo)(t,e)):xo(this.node(),t).delay}function Go(e,t){return function(){bo(this,e).duration=+t.apply(this,arguments)}}function Ko(e,t){return t=+t,function(){bo(this,e).duration=t}}function qo(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Go:Ko)(t,e)):xo(this.node(),t).duration}function Jo(e,t){if(typeof t!=`function`)throw Error();return function(){bo(this,e).ease=t}}function Yo(e){var t=this._id;return arguments.length?this.each(Jo(t,e)):xo(this.node(),t).ease}function Xo(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();bo(this,e).ease=n}}function Zo(e){if(typeof e!=`function`)throw Error();return this.each(Xo(this._id,e))}function Qo(e){typeof e!=`function`&&(e=An(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new Ds(r,this._parents,this._name,this._id)}function $o(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new Ds(o,this._parents,this._name,this._id)}function es(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function ts(e,t,n){var r,i,a=es(t)?yo:bo;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function ns(e,t){var n=this._id;return arguments.length<2?xo(this.node(),n).on.on(e):this.each(ts(n,e,t))}function rs(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function is(){return this.on(`end.remove`,rs(this._id))}function as(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Cn(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,vo(l[f],t,n,f,l,xo(u,n)));return new Ds(a,this._parents,t,n)}function os(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Dn(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=xo(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&vo(p,t,n,h,f,m);a.push(f),o.push(u)}return new Ds(a,o,t,n)}var ss=pi.prototype.constructor;function cs(){return new ss(this._groups,this._parents)}function ls(e,t){var n,r,i;return function(){var a=br(this,e),o=(this.style.removeProperty(e),br(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function us(e){return function(){this.style.removeProperty(e)}}function ds(e,t,n){var r,i=n+``,a;return function(){var o=br(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function fs(e,t,n){var r,i,a;return function(){var o=br(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),br(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function ps(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=bo(this,e),l=c.on,u=c.value[a]==null?s||=us(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function ms(e,t,n){var r=(e+=``)==`transform`?Va:ko;return t==null?this.styleTween(e,ls(e,r)).on(`end.style.`+e,us(e)):typeof t==`function`?this.styleTween(e,fs(e,r,Oo(this,`style.`+e,t))).each(ps(this._id,e)):this.styleTween(e,ds(e,r,t),n).on(`end.style.`+e,null)}function hs(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function gs(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&hs(e,a,n)),r}return a._value=t,a}function _s(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,gs(e,t,n??``))}function vs(e){return function(){this.textContent=e}}function ys(e){return function(){var t=e(this);this.textContent=t??``}}function bs(e){return this.tween(`text`,typeof e==`function`?ys(Oo(this,`text`,e)):vs(e==null?``:e+``))}function xs(e){return function(t){this.textContent=e.call(this,t)}}function Ss(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&xs(r)),t}return r._value=e,r}function Cs(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,Ss(e))}function ws(){for(var e=this._name,t=this._id,n=ks(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=xo(c,t);vo(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Ds(r,this._parents,e,n)}function Ts(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=bo(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var Es=0;function Ds(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Os(e){return pi().transition(e)}function ks(){return++Es}var As=pi.prototype;Ds.prototype=Os.prototype={constructor:Ds,select:as,selectAll:os,selectChild:As.selectChild,selectChildren:As.selectChildren,filter:Qo,merge:$o,selection:cs,transition:ws,call:As.call,nodes:As.nodes,node:As.node,size:As.size,empty:As.empty,each:As.each,on:ns,attr:Io,attrTween:Vo,style:ms,styleTween:_s,text:bs,textTween:Cs,remove:is,tween:Do,delay:Wo,duration:qo,ease:Yo,easeVarying:Zo,end:Ts,[Symbol.iterator]:As[Symbol.iterator]};function js(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Ms={time:null,delay:0,duration:250,ease:js};function Ns(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function Ps(e){var t,n;e instanceof Ds?(t=e._id,e=e._name):(t=ks(),(n=Ms).time=ao(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&vo(c,e,t,l,o,n||Ns(c,t));return new Ds(r,this._parents,e,t)}pi.prototype.interrupt=wo,pi.prototype.transition=Ps;var Fs=e=>()=>e;function Is(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Ls(e,t,n){this.k=e,this.x=t,this.y=n}Ls.prototype={constructor:Ls,scale:function(e){return e===1?this:new Ls(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ls(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var Rs=new Ls(1,0,0);zs.prototype=Ls.prototype;function zs(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Rs;return e.__zoom}function Bs(e){e.stopImmediatePropagation()}function Vs(e){e.preventDefault(),e.stopImmediatePropagation()}function Hs(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function Us(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute(`viewBox`)?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Ws(){return this.__zoom||Rs}function Gs(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Ks(){return navigator.maxTouchPoints||`ontouchstart`in this}function qs(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function Js(){var e=Hs,t=Us,n=qs,r=Gs,i=Ks,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=qa,l=fn(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,Ws).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,Ws),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(Rs.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new Ls(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new Ls(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new Ls(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=hi(this.that).datum();l.call(e,this.that,new Is(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=_i(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],Co(this),s.start();Vs(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=hi(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=_i(t,i),l=t.clientX,u=t.clientY;Si(t.view),Bs(t),a.mouse=[c,this.__zoom.invert(c)],Co(this),a.start();function d(e){if(Vs(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=_i(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),Ci(e.view,a.moved),Vs(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=_i(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);Vs(r),s>0?hi(this).transition().duration(s).call(x,d,c,r):hi(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(Bs(t),s=0;s<i;++s)c=r[s],l=_i(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),Co(this),a.start())}}function O(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(Vs(e),s=0;s<a;++s)c=i[s],l=_i(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function k(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(Bs(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=_i(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=hi(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:Fs(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:Fs(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:Fs(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:Fs([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}var Ys={error001:(e=`react`)=>`Seems like you have not used ${e===`svelte`?`SvelteFlowProvider`:`ReactFlowProvider`} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>`It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.`,error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>`The parent container needs a width and a height to render the graph.`,error005:()=>`Only child nodes can use a parent extent.`,error006:()=>`Can't create edge. An edge needs a source and a target.`,error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e===`source`?n:r}", edge id: ${t}.`,error010:()=>`Handle: No node id found. Make sure to only use a Handle inside a custom Node.`,error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e=`react`)=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>`useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.`,error015:()=>`It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.`,error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},Xs=[[-1/0,-1/0],[1/0,1/0]],Zs=[`Enter`,` `,`Escape`],Qs={"node.a11yDescription.default":`Press enter or space to select a node. Press delete to remove it and escape to cancel.`,"node.a11yDescription.keyboardDisabled":`Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.`,"node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":`Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.`,"controls.ariaLabel":`Control Panel`,"controls.zoomIn.ariaLabel":`Zoom In`,"controls.zoomOut.ariaLabel":`Zoom Out`,"controls.fitView.ariaLabel":`Fit View`,"controls.interactive.ariaLabel":`Toggle Interactivity`,"minimap.ariaLabel":`Mini Map`,"handle.ariaLabel":`Handle`},$s;(function(e){e.Strict=`strict`,e.Loose=`loose`})($s||={});var ec;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(ec||={});var tc;(function(e){e.Partial=`partial`,e.Full=`full`})(tc||={});var nc={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},rc;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(rc||={});var ic;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(ic||={});var Q;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(Q||={});var ac={[Q.Left]:Q.Right,[Q.Right]:Q.Left,[Q.Top]:Q.Bottom,[Q.Bottom]:Q.Top};function oc(e){return e===null?null:e?`valid`:`invalid`}var sc=e=>!!e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e,cc=e=>!!e&&typeof e==`object`&&`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),lc=e=>!!e&&typeof e==`object`&&`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),uc=(e,t=[0,0])=>{let{width:n,height:r}=Wc(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},dc=(e,t={nodeOrigin:[0,0]})=>e.length===0?{x:0,y:0,width:0,height:0}:Ec(e.reduce((e,n)=>{let r=typeof n==`string`,i=!t.nodeLookup&&!r?n:void 0;return t.nodeLookup&&(i=r?t.nodeLookup.get(n):lc(n)?n:t.nodeLookup.get(n.id)),wc(e,i?Oc(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),fc=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=wc(n,Oc(e)),r=!0)}),r?Ec(n):{x:0,y:0,width:0,height:0}},pc=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s=(t.x-n)/i,c=(t.y-r)/i,l=t.width/i,u=t.height/i,d=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??0,f=e.height??t.height??t.initialHeight??0,{x:p,y:m}=t.internals.positionAbsolute,h=Ac(s,c,l,u,p,m,i,f),g=i*f,_=a&&h>0;(!t.internals.handleBounds||_||h>=g||t.dragging)&&d.push(t)}return d},mc=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function hc(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{let i;if(t?.includeHiddenNodes){let{width:t,height:n}=Wc(e);i=t>0&&n>0}else i=!!(e.measured.width&&e.measured.height&&!e.hidden);i&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function gc({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=Vc(fc(hc(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),!0}function _c({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent)if(!s)a?.(`005`,Ys.error005());else{let e=s.measured.width,t=s.measured.height;e&&t&&(d=[[c,l],[c+e,l+t]])}else s&&Uc(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=Uc(d)?bc(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,Ys.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function vc({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=mc(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var yc=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),bc=(e={x:0,y:0},t,n)=>({x:yc(e.x,t[0][0],t[1][0]-(n?.width??0)),y:yc(e.y,t[0][1],t[1][1]-(n?.height??0))});function xc(e,t,n){let{width:r,height:i}=Wc(n),{x:a,y:o}=n.internals.positionAbsolute;return bc(e,[[a,o],[a+r,o+i]],t)}var Sc=(e,t,n)=>e<t?yc(Math.abs(e-t),1,t)/t:e>n?-yc(Math.abs(e-n),1,t)/t:0,Cc=(e,t,n=15,r=40)=>[Sc(e.x,r,t.width-r)*n,Sc(e.y,r,t.height-r)*n],wc=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Tc=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Ec=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Dc=(e,t=[0,0])=>{let{x:n,y:r}=lc(e)?e.internals.positionAbsolute:uc(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Oc=(e,t=[0,0])=>{let{x:n,y:r}=lc(e)?e.internals.positionAbsolute:uc(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},kc=(e,t)=>Ec(wc(Tc(e),Tc(t))),Ac=(e,t,n,r,i,a,o,s)=>{let c=Math.max(0,Math.min(e+n,i+o)-Math.max(e,i)),l=Math.max(0,Math.min(t+r,a+s)-Math.max(t,a));return Math.ceil(c*l)},jc=(e,t)=>Ac(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),Mc=e=>Nc(e.width)&&Nc(e.height)&&Nc(e.x)&&Nc(e.y),Nc=e=>!isNaN(e)&&isFinite(e),Pc=(e,t)=>(e,t)=>{},Fc=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Ic=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?Fc(s,o):s},Lc=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function Rc(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function zc(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=Rc(e,n),i=Rc(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=Rc(e.top??e.y??0,n),i=Rc(e.bottom??e.y??0,n),a=Rc(e.left??e.x??0,t),o=Rc(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Bc(e,t,n,r,i,a){let{x:o,y:s}=Lc(e,[t,n,r]),{x:c,y:l}=Lc({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var Vc=(e,t,n,r,i,a)=>{let o=zc(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=yc(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=Bc(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},Hc=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function Uc(e){return e!=null&&e!==`parent`}function Wc(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Gc(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Kc(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function qc(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Jc(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function Yc(e){return{...Qs,...e||{}}}function Xc(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=nl(e),s=Ic({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?Fc(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var Zc=e=>({width:e.offsetWidth,height:e.offsetHeight}),Qc=e=>e?.getRootNode?.()||window?.document,$c=[`INPUT`,`SELECT`,`TEXTAREA`];function el(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?$c.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var tl=e=>`clientX`in e,nl=(e,t)=>{let n=tl(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},rl=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...Zc(t)}})};function il({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function al(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function ol({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case Q.Left:return[t-al(t-r,a),n];case Q.Right:return[t+al(r-t,a),n];case Q.Top:return[t,n-al(n-i,a)];case Q.Bottom:return[t,n+al(i-n,a)]}}function sl({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top,curvature:o=.25}){let[s,c]=ol({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=ol({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=il({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function cl({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function ll({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:a=`basic`}){return a===`manual`?r:(i&&n?r+1e3:r)+Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0)}function ul({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=wc(Oc(e),Oc(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),jc({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},Ec(a))>0}var dl=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,fl=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),pl=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,Ys.error006()),t;let r=n.getEdgeId||dl,i;return i=sc(e)?{...e}:{...e,id:r(e)},fl(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function ml({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=cl({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var hl={[Q.Left]:{x:-1,y:0},[Q.Right]:{x:1,y:0},[Q.Top]:{x:0,y:-1},[Q.Bottom]:{x:0,y:1}},gl=({source:e,sourcePosition:t=Q.Bottom,target:n})=>t===Q.Left||t===Q.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},_l=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function vl({source:e,sourcePosition:t=Q.Bottom,target:n,targetPosition:r=Q.Top,center:i,offset:a,stepPosition:o}){let s=hl[t],c=hl[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=gl({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=cl({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]<u[e];(s[f]===1&&(!t&&n||t&&r)||s[f]!==1&&(!t&&r||t&&n))&&(m=f===`x`?i:o)}let d={x:l.x+_.x,y:l.y+_.y},y={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(y.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...x.x!==m[0].x||x.y!==m[0].y?[x]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],h,g,y,b]}function yl(e,t,n,r){let i=Math.min(_l(e,t)/2,_l(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${a+i*t},${o}Q ${a},${o} ${a},${o+i*r}`}let s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function bl({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=vl({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:a,center:{x:s,y:c},offset:l,stepPosition:u}),g=`M${d[0].x} ${d[0].y}`;for(let e=1;e<d.length-1;e++)g+=yl(d[e-1],d[e],d[e+1],o);return g+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[g,f,p,m,h]}function xl(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Sl(e){let{sourceNode:t,targetNode:n}=e;if(!xl(t)||!xl(n))return null;let r=t.internals.handleBounds||Cl(t.handles),i=n.internals.handleBounds||Cl(n.handles),a=Tl(r?.source??[],e.sourceHandle),o=Tl(e.connectionMode===$s.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,Ys.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||Q.Bottom,c=o?.position||Q.Top,l=wl(t,a,s),u=wl(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function Cl(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,r.type===`source`?t.push(r):r.type===`target`&&n.push(r);return{source:t,target:n}}function wl(e,t,n=Q.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:o,height:s}=t??Wc(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case Q.Top:return{x:i+o/2,y:a};case Q.Right:return{x:i+o,y:a+s/2};case Q.Bottom:return{x:i+o/2,y:a+s};case Q.Left:return{x:i,y:a+s/2}}}function Tl(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function El(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function Dl(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=El(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var Ol=1e3,kl=10,Al={nodeOrigin:[0,0],nodeExtent:Xs,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},jl={...Al,checkEquality:!0};function Ml(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function Nl(e,t,n){let r=Ml(Al,n);for(let n of e.values())if(n.parentId)Rl(n,e,t,r);else{let e=bc(uc(n,r.nodeOrigin),Uc(n.extent)?n.extent:r.nodeExtent,Wc(n));n.internals.positionAbsolute=e}}function Pl(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function Fl(e){return e===`manual`}function Il(e,t,n,r={}){let i=Ml(jl,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!Fl(i.zIndexMode)?Ol:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=bc(uc(u,i.nodeOrigin),Uc(u.extent)?u.extent:i.nodeExtent,Wc(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:Pl(u,e),z:zl(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}(e.measured===void 0||e.measured.width===void 0||e.measured.height===void 0)&&!e.hidden&&(c=!1),u.parentId&&Rl(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function Ll(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Rl(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=Ml(Al,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Ll(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*kl),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=Bl(e,u,o,s,a&&!Fl(c)?Ol:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function zl(e,t,n){let r=Nc(e.zIndex)?e.zIndex:0;return Fl(n)?r:r+(e.selected?t:0)}function Bl(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=Wc(e),l=uc(e,n),u=Uc(e.extent)?bc(l,e.extent,c):l,d=bc({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=xc(d,c,t));let f=zl(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function Vl(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=kc(a.get(n.parentId)?.expandedRect??Dc(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=Wc(a),l=a.origin??r,u=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,d=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,f=Math.max(c.width,Math.round(t.width)),p=Math.max(c.height,Math.round(t.height)),m=(f-c.width)*l[0],h=(p-c.height)*l[1];(u>0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width<t.width||c.height<t.height||u||d)&&i.push({id:o,type:`dimensions`,setAttributes:!0,dimensions:{width:f+(u?l[0]*u-m:0),height:p+(d?l[1]*d-h:0)}})}),i}function Hl(e,t,n,r,i,a,o){let s=r?.querySelector(`.xyflow__viewport`),c=!1;if(!s)return{changes:[],updatedInternals:c};let l=[],u=window.getComputedStyle(s),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(let r of e.values()){let e=t.get(r.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),c=!0;continue}let s=Zc(r.nodeElement),u=e.measured.width!==s.width||e.measured.height!==s.height;if(s.width&&s.height&&(u||!e.internals.handleBounds||r.force)){let p=r.nodeElement.getBoundingClientRect(),m=Uc(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;if(e.parentId&&e.extent===`parent`){let n=t.get(e.parentId);n&&(h=xc(h,s,n))}else m&&(h=bc(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:rl(`source`,r.nodeElement,p,d,e.id),target:rl(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&Rl(g,t,n,{nodeOrigin:i,zIndexMode:o}),c=!0,u&&(l.push({id:e.id,type:`dimensions`,dimensions:s}),e.expandParent&&e.parentId&&f.push({id:e.id,parentId:e.parentId,rect:Dc(g,i)}))}}if(f.length>0){let e=Vl(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function Ul({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return!1;let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function Wl(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function Gl(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;Wl(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),Wl(`target`,s,c,e,i,o),t.set(r.id,r)}}function Kl(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:Kl(n,t):!1}function ql(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function Jl(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!Kl(o,e))&&(o.draggable||t&&o.draggable===void 0)){let t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}function Yl({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function Xl({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=Fc(a,t);return{x:o.x-a.x,y:o.y-a.y}}function Zl({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:x=0}){f=hi(v);function S({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?Tc(fc(s)):null,x=v&&l?Xl({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:Fc(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=_c({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=Yl({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function C(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=Cc(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&S(a)),o=requestAnimationFrame(C)}function w(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0,(!m||!y)&&!o&&b&&(i.get(b)?.selected||_()),y&&m&&b&&e?.(b);let v=Xc(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=Jl(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=Yl({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=Ai().clickDistance(x).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&w(e),a=Xc(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=nl(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=Xc(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,C()),!d){let t=nl(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=nl(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!d||p){p&&s.size>0&&t().updateNodePositions(s,!1);return}if(c=!1,d=!1,cancelAnimationFrame(o),s.size>0){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=Yl({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!ql(t,`.${g}`,v))&&(!_||ql(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function Ql(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())jc(i,Dc(e))>0&&r.push(e);return r}var $l=250;function eu(e,t,n,r){let i=[],a=1/0,o=Ql(e,n,t+$l);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=wl(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function tu(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...wl(o,c,c.position,!0)}:c}function nu(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function ru(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var iu=()=>!0;function au(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=iu,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=Qc(e.target),E=0,D,{x:O,y:k}=nl(e),A=nu(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=tu(i,A,r,c,t);if(!N)return;let P=nl(e,j),F=!1,I=null,L=!1,R=null;function z(){if(!u||!j)return;let[e,t]=Cc(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(z)}let B={...N,nodeId:i,type:A,position:N.position},V=c.get(i),H={inProgress:!0,isValid:null,from:wl(V,B,Q.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:V,to:P,toHandle:null,toPosition:ac[B.position],toNode:null,pointer:P};function U(){M=!0,y(H),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&U();function W(e){if(!M){let{x:t,y:n}=nl(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;U()}if(!x()||!B){G(e);return}let a=b();P=nl(e,j),D=eu(Ic(P,a,!1,[1,1]),n,c,B),F||=(z(),!0);let s=ou(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});R=s.handleDomNode,I=s.connection,L=ru(!!D,s.isValid);let u=c.get(i),f=u?wl(u,B,Q.Left,!0):H.from,p={...H,from:f,isValid:L,to:s.toHandle&&L?Lc({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:L&&s.toHandle?s.toHandle.position:ac[B.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),H=p}function G(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||R)&&I&&L&&h?.(I);let{inProgress:t,...n}=H,r={...n,toPosition:H.toHandle?H.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),F=!1,L=!1,I=null,R=null,T.removeEventListener(`mousemove`,W),T.removeEventListener(`mouseup`,G),T.removeEventListener(`touchmove`,W),T.removeEventListener(`touchend`,G)}}T.addEventListener(`mousemove`,W),T.addEventListener(`mouseup`,G),T.addEventListener(`touchmove`,W),T.addEventListener(`touchend`,G)}function ou(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=iu,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=nl(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=nu(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===$s.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=tu(t,e,a,u,n,!0)}return _}var su={onPointerDown:au,isValid:ou};function cu({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=hi(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&Hc()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=Js().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:_i}}var lu=e=>({x:e.x,y:e.y,zoom:e.k}),uu=({x:e,y:t,zoom:n})=>Rs.translate(e,t).scale(n),du=(e,t)=>e.target.closest(`.${t}`),fu=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),pu=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,mu=(e,t=0,n=pu,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},hu=e=>{let t=e.ctrlKey&&Hc()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function gu({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(du(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=_i(u),t=d*2**hu(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===ec.Vertical?0:u.deltaX*f,m=i===ec.Horizontal?0:u.deltaY*f;!Hc()&&u.shiftKey&&i!==ec.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=lu(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c?.(u,h):(e.isPanScrolling=!0,s?.(u,h)),e.panScrollTimeout=setTimeout(()=>{l?.(u,h),e.isPanScrolling=!1},150)}}function _u({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=du(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function vu({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=lu(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function yu({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&fu(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,lu(a.transform))}}function bu({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&fu(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=lu(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function xu({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:a,userSelectionActive:o,noWheelClassName:s,noPanClassName:c,lib:l,connectionInProgress:u}){return d=>{let f=e||t,p=n&&d.ctrlKey,m=d.type===`wheel`;if(d.button===1&&d.type===`mousedown`&&(du(d,`${l}-flow__node`)||du(d,`${l}-flow__edge`)))return!0;if(!r&&!f&&!i&&!a&&!n||o||u&&!m||du(d,s)&&m||du(d,c)&&(!m||i&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type===`touchstart`&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!i&&!p&&m||!r&&(d.type===`mousedown`||d.type===`touchstart`)||Array.isArray(r)&&!r.includes(d.button)&&d.type===`mousedown`)return!1;let h=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&h}}function Su({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=[[0,0],[u.width,u.height]];(typeof ResizeObserver<`u`?new ResizeObserver(e=>{let t=e[0];t&&(d=[[0,0],[t.contentRect.width,t.contentRect.height]])}):null)?.observe(e);let f=Js().extent(()=>d).scaleExtent([t,n]).translateExtent(r),p=hi(e).call(f);y({x:i.x,y:i.y,zoom:yc(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let m=p.on(`wheel.zoom`),h=p.on(`dblclick.zoom`);f.wheelDelta(hu);async function g(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?Na:qa).transform(mu(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function _({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:d,panOnScrollSpeed:g,preventScrolling:_,zoomOnPinch:y,zoomOnScroll:b,zoomOnDoubleClick:x,zoomActivationKeyPressed:S,lib:C,onTransformChange:w,connectionInProgress:T,paneClickDistance:E,selectionOnDrag:D}){r&&!l.isZoomingOrPanning&&v();let O=i&&!S&&!r;f.clickDistance(D?1/0:!Nc(E)||E<0?0:E);let k=O?gu({zoomPanValues:l,noWheelClassName:e,d3Selection:p,d3Zoom:f,panOnScrollMode:d,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):_u({noWheelClassName:e,preventScrolling:_,d3ZoomHandler:m});p.on(`wheel.zoom`,k,{passive:!1});let A=vu({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});f.on(`start`,A);let j=yu({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});f.on(`zoom`,j);let M=bu({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});f.on(`end`,M);let N=xu({zoomActivationKeyPressed:S,panOnDrag:u,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:C,connectionInProgress:T});f.filter(N),x?p.on(`dblclick.zoom`,h):p.on(`dblclick.zoom`,null)}function v(){f.on(`zoom`,null)}async function y(e,t,n){let r=uu(e),i=f?.constrain()(r,t,n);return i&&await g(i),i}async function b(e,t){let n=uu(e);return await g(n,t),n}function x(e){if(p){let t=uu(e),n=p.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&f?.transform(p,t,null,{sync:!0})}}function S(){let e=p?zs(p.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}async function C(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?Na:qa).scaleTo(mu(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function w(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?Na:qa).scaleBy(mu(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function T(e){f?.scaleExtent(e)}function E(e){f?.translateExtent(e)}function D(e){let t=!Nc(e)||e<0?0:e;f?.clickDistance(t)}return{update:_,destroy:v,setViewport:b,setViewportConstrained:y,getViewport:S,scaleTo:C,scaleBy:w,setScaleExtent:T,setTranslateExtent:E,syncViewport:x,setClickDistance:D}}var Cu;(function(e){e.Line=`line`,e.Handle=`handle`})(Cu||={});function wu({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function Tu(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function Eu(e,t){return Math.max(0,t-e)}function Du(e,t){return Math.max(0,e-t)}function Ou(e,t,n){return Math.max(0,t-e,e-n)}function ku(e,t){return e?!t:t}function Au(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=Ou(E,h,g),j=Ou(D,_,v);if(o){let e=0,t=0;c&&w<0?e=Eu(y+w+O,o[0][0]):!c&&w>0&&(e=Du(y+E+O,o[1][0])),l&&T<0?t=Eu(b+T+k,o[0][1]):!l&&T>0&&(t=Du(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=Du(y+w,s[0][0]):!c&&w<0&&(e=Eu(y+E,s[1][0])),l&&T>0?t=Du(b+T,s[0][1]):!l&&T<0&&(t=Eu(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=Ou(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?Du(b+k+E/C,o[1][1])*C:Eu(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?Eu(b+E/C,s[1][1])*C:Du(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=Ou(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?Du(y+D*C+O,o[1][0])/C:Eu(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?Eu(y+D*C,s[1][0])/C:Du(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=(ku(c,l)?-w:w)/C:w=(ku(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let M=c?y+w:y,N=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+M,y:a[1]*T*(l?-1:1)+N}}var ju={width:0,height:0,x:0,y:0},Mu={...ju,pointerX:0,pointerY:0,aspectRatio:1};function Nu(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function Pu({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=hi(e),o={controlDirection:Tu(`bottom-right`),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:e,boundaries:s,keepAspectRatio:c,resizeDirection:l,onResizeStart:u,onResize:d,onResizeEnd:f,shouldResize:p}){let m={...ju},h={...Mu};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:Tu(e)};let g,_=null,v=[],y,b,x,S=!1,C=Ai().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:l,ySnapped:d}=Xc(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...m,pointerX:l,pointerY:d,aspectRatio:m.width/m.height},y=void 0,b=Uc(g.extent)?g.extent:void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId)),y&&g.extent===`parent`&&(b=[[0,0],[y.measured.width,y.measured.height]]),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=Nu(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...m})}).on(`drag`,e=>{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),c=Xc(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),l=[];if(!g)return;let{x:u,y:f,width:C,height:w}=m,T={},E=g.origin??s,{width:D,height:O,x:k,y:A}=Au(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,E,b,x),j=D!==C,M=O!==w,N=k!==u&&j,P=A!==f&&M;if(!N&&!P&&!j&&!M)return;if((N||P||E[0]===1||E[1]===1)&&(T.x=N?k:m.x,T.y=P?A:m.y,m.x=T.x,m.y=T.y,v.length>0)){let e=k-u,t=A-f;for(let n of v)n.position={x:n.position.x-e+E[0]*(D-C),y:n.position.y-t+E[1]*(O-w)},l.push(n)}if((j||M)&&(T.width=j&&(!o.resizeDirection||o.resizeDirection===`horizontal`)?D:m.width,T.height=M&&(!o.resizeDirection||o.resizeDirection===`vertical`)?O:m.height,m.width=T.width,m.height=T.height),y&&g.expandParent){let e=E[0]*(T.width??0);T.x&&T.x<e&&(m.x=e,h.x-=T.x-e);let t=E[1]*(T.height??0);T.y&&T.y<t&&(m.y=t,h.y-=T.y-t)}let F=wu({width:m.width,prevWidth:C,height:m.height,prevHeight:w,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),I={...m,direction:F};p?.(e,I)!==!1&&(S=!0,d?.(e,I),r(T,l))}).on(`end`,e=>{S&&=(f?.(e,{...m}),i?.({...m}),!1)});a.call(C)}function c(){a.on(`.drag`,null)}return{update:s,destroy:c}}var Fu=e(nt(),1),Iu=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},Lu=e=>e?Iu(e):Iu,{useDebugValue:Ru}=Y.default,{useSyncExternalStoreWithSelector:zu}=Fu.default,Bu=e=>e;function Vu(e,t=Bu,n){let r=zu(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Ru(r),r}var Hu=(e,t)=>{let n=Lu(e),r=(e,r=t)=>Vu(n,e,r);return Object.assign(r,n),r},Uu=(e,t)=>e?Hu(e,t):Hu;function Wu(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}n();var Gu=(0,Y.createContext)(null),Ku=Gu.Provider,qu=Ys.error001(`react`);function $(e,t){let n=(0,Y.useContext)(Gu);if(n===null)throw Error(qu);return Vu(n,e,t)}function Ju(){let e=(0,Y.useContext)(Gu);if(e===null)throw Error(qu);return(0,Y.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var Yu={display:`none`},Xu={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},Zu=`react-flow__node-desc`,Qu=`react-flow__edge-desc`,$u=`react-flow__aria-live`,ed=e=>e.ariaLiveMessage,td=e=>e.ariaLabelConfig;function nd({rfId:e}){let t=$(ed);return(0,Z.jsx)(`div`,{id:`${$u}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:Xu,children:t})}function rd({rfId:e,disableKeyboardA11y:t}){let n=$(td);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{id:`${Zu}-${e}`,style:Yu,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,Z.jsx)(`div`,{id:`${Qu}-${e}`,style:Yu,children:n[`edge.a11yDescription.default`]}),!t&&(0,Z.jsx)(nd,{rfId:e})]})}var id=(0,Y.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>(0,Z.jsx)(`div`,{className:un([`react-flow__panel`,n,...`${e}`.split(`-`)]),style:r,ref:a,...i,children:t}));id.displayName=`Panel`;var ad=`https://reactflow.dev?utm_source=attribution`;function od({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:(0,Z.jsx)(id,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${ad}`,children:(0,Z.jsx)(`a`,{href:ad,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var sd=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},cd=e=>e.id;function ld(e,t){return Wu(e.selectedNodes.map(cd),t.selectedNodes.map(cd))&&Wu(e.selectedEdges.map(cd),t.selectedEdges.map(cd))}function ud({onSelectionChange:e}){let t=Ju(),{selectedNodes:n,selectedEdges:r}=$(sd,ld);return(0,Y.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var dd=e=>!!e.onSelectionChangeHandlers;function fd({onSelectionChange:e}){let t=$(dd);return e||t?(0,Z.jsx)(ud,{onSelectionChange:e}):null}var pd=[0,0],md={x:0,y:0,zoom:1},hd=[...`nodes.edges.defaultNodes.defaultEdges.onConnect.onConnectStart.onConnectEnd.onClickConnectStart.onClickConnectEnd.nodesDraggable.autoPanOnNodeFocus.nodesConnectable.nodesFocusable.edgesFocusable.edgesReconnectable.elevateNodesOnSelect.elevateEdgesOnSelect.minZoom.maxZoom.nodeExtent.onNodesChange.onEdgesChange.elementsSelectable.connectionMode.snapGrid.snapToGrid.translateExtent.connectOnClick.defaultEdgeOptions.fitView.fitViewOptions.onNodesDelete.onEdgesDelete.onDelete.onNodeDrag.onNodeDragStart.onNodeDragStop.onSelectionDrag.onSelectionDragStart.onSelectionDragStop.onMoveStart.onMove.onMoveEnd.noPanClassName.nodeOrigin.autoPanOnConnect.autoPanOnNodeDrag.onError.connectionRadius.isValidConnection.selectNodesOnDrag.nodeDragThreshold.connectionDragThreshold.onBeforeDelete.debug.autoPanSpeed.ariaLabelConfig.zIndexMode`.split(`.`),`rfId`],gd=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),_d={translateExtent:Xs,nodeOrigin:pd,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function vd(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=$(gd,Wu),l=Ju();(0,Y.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=_d,s()}),[]);let u=(0,Y.useRef)(_d);return(0,Y.useEffect)(()=>{for(let s of hd){let c=e[s];c!==u.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`ariaLabelConfig`?l.setState({ariaLabelConfig:Yc(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},hd.map(t=>e[t])),null}function yd(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function bd(e){let[t,n]=(0,Y.useState)(e===`system`?null:e);return(0,Y.useEffect)(()=>{if(e!==`system`){n(e);return}let t=yd(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?yd()?.matches?`dark`:`light`:t}var xd=typeof document<`u`?document:null;function Sd(e=null,t={target:xd,actInsideInputWithModifier:!0}){let[n,r]=(0,Y.useState)(!1),i=(0,Y.useRef)(!1),a=(0,Y.useRef)(new Set([])),[o,s]=(0,Y.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(`+`,`
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,i as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{d as a,l as o,t as s,u as c}from"./chunk-QUQL4437-DXsxWP7r.js";import{t as l}from"./cn-BQ_8x0bT.js";import{t as u}from"./check-BODqo66o.js";import{t as d}from"./copy-to-clipboard-HOJ79TWv.js";import{t as f}from"./messages-B0B40tpO.js";import{l as p,n as m}from"./locale-store-GfSwnwIZ.js";import{i as h}from"./vendor-swr-BIWyz7Rc.js";import{$c as g,A as _,B as v,Bo as y,Cs as b,Ct as x,E as S,Es as C,Et as w,F as T,Fl as E,Fs as D,G as O,I as k,J as A,Jo as j,Jr as M,K as N,L as P,Lc as F,M as I,N as L,Nl as R,O as z,Ot as B,P as V,Ps as H,Q as U,Rl as W,S as G,St as ee,Tc as te,Tt as ne,U as re,V as ie,Vr as K,W as ae,Wc as oe,X as se,Xc as ce,Y as le,Yo as ue,Ys as de,Zl as fe,Zo as pe,_t as me,ac as he,at as ge,au as _e,bt as ve,bu as ye,cc as be,da as xe,dl as q,et as Se,ft as Ce,fu as we,g as Te,gt as Ee,ht as De,it as Oe,j as ke,k as Ae,ks as je,kt as Me,lo as Ne,mt as Pe,ot as Fe,ps as Ie,pt as Le,q as Re,rl as ze,rt as Be,ru as Ve,sl as He,st as Ue,tl as We,tt as Ge,uc as Ke,uu as qe,vl as Je,wt as Ye,xc as Xe,xt as Ze,yc as Qe,ys as J,yt as $e,z as et,zl as tt}from"./index-DSydVlxZ.js";import{t as nt}from"./with-selector-aYPsXwdl.js";import{t as rt}from"./page-tabs-HACawonJ.js";import{i as it,r as at,t as ot}from"./workflow-run-setup-panel-8HLqUALq.js";var Y=e(t(),1),X=r(),st=[`queued`,`running`,`succeeded`,`attention`],ct=new Set([`failed`,`timeout`,`cancelled`]);function lt(e){return e.metadata?.sessionKey?.trim()||null}function ut(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function dt(e,t){if(!e||typeof e!=`object`)return null;let n=e;for(let e of t){let t=n[e];if(typeof t==`string`&&t.trim())return t.trim()}return null}function ft(e,t=90){let n=e.metadata?.input?.goal?.trim()||(typeof e.metadata?.input?.payload==`string`?e.metadata.input.payload.trim():null)||dt(e.metadata?.input?.payload,[`query`,`goal`,`prompt`,`input`,`message`])||dt(e.metadata?.input?.variables,[`query`,`goal`,`prompt`,`input`,`message`]);return n?ut(n,t):null}function pt(e,t=90){return ft(e,t)??ut(e.title?.trim()||e.definitionId,t)}function mt(e,t=44){return ut(e.title?.trim()||e.definitionId,t)}function ht(e,t){let n=t.trim().toLowerCase();return n?[ft(e,500),e.title,e.definitionId,e.id].filter(Boolean).join(` `).toLowerCase().includes(n):!0}function gt(e,t){let n=t.workflowFilterId.trim();return e.filter(e=>n&&e.definitionId!==n||!T(e,t.triggerFilter??`all`)?!1:ht(e,t.searchQuery))}function _t(e){return e.completedAtMs??e.createdAtMs}function vt(e,t){return e.status===`queued`?`queued`:e.status===`running`?`running`:e.status===`succeeded`?`succeeded`:ct.has(e.status)?`attention`:null}function yt(e,t){let n=[...t];return e===`queued`?n.sort((e,t)=>e.createdAtMs-t.createdAtMs):e===`running`?n.sort((e,t)=>(t.startedAtMs??t.createdAtMs)-(e.startedAtMs??e.createdAtMs)):n.sort((e,t)=>_t(t)-_t(e))}function bt(e,t){let n={queued:[],running:[],succeeded:[],attention:[]};for(let r of e){let e=vt(r,t);e&&n[e].push(r)}return st.map(e=>{if(e===`succeeded`){let t=yt(`succeeded`,n.succeeded);return{id:e,runs:t,totalInWindow:t.length}}return{id:e,runs:yt(e,n[e])}})}function xt(e,t,n){let r=Math.round((t-e)/1e3);if(r<60)return Ge(-r,`second`,n);let i=Math.round(r/60);if(i<60)return Ge(-i,`minute`,n);let a=Math.round(i/60);return a<48?Ge(-a,`hour`,n):Ge(-Math.round(a/24),`day`,n)}function St(e){return e.status===`queued`||e.status===`running`}function Ct(e){return e.status===`failed`||e.status===`timeout`||e.status===`cancelled`}var Z=i(),wt=(0,Y.memo)(function(e){let t=(0,X.c)(76),{run:n,language:r,localeTag:i,nowMs:a,selected:o,onOpen:s,onOpenChat:c,onCancel:u,onRetry:d}=e,p=f(r).workflows,[m,h]=(0,Y.useState)(!1),g;t[0]===n?g=t[1]:(g=lt(n),t[0]=n,t[1]=g);let v=!g,y;t[2]===n?y=t[3]:(y=St(n),t[2]=n,t[3]=y);let b=y,x=n.status===`running`||n.status===`queued`,S;t[4]!==n.metrics.agentCount||t[5]!==n.metrics.doneAgentCount?(S=n.metrics.agentCount>0?Math.round(n.metrics.doneAgentCount/n.metrics.agentCount*100):0,t[4]=n.metrics.agentCount,t[5]=n.metrics.doneAgentCount,t[6]=S):S=t[6];let C=S,w=n.metrics.errorAgentCount>0,T=n.startedAtMs??n.createdAtMs,E=_(b?a-T:n.metrics.durationMs),D=I(p.taskArtifacts,{count:n.metrics.artifactCount}),O;t[7]===n?O=t[8]:(O=pt(n),t[7]=n,t[8]=O);let A=O,j;t[9]===n?j=t[10]:(j=mt(n),t[9]=n,t[10]=j);let M=j,N;t[11]!==s||t[12]!==n?(N=()=>{s(n)},t[11]=s,t[12]=n,t[13]=N):N=t[13];let P=N,F;t[14]!==v||t[15]!==c||t[16]!==n?(F=()=>{v||c(n)},t[14]=v,t[15]=c,t[16]=n,t[17]=F):F=t[17];let L=F,z=o&&`ring-1 ring-accent/30`,B;t[18]===z?B=t[19]:(B=l(`group relative min-h-24 overflow-hidden rounded-lg bg-surface-panel p-3 shadow-surface transition-colors`,z,`hover:bg-surface-hover`),t[18]=z,t[19]=B);let V;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(V=l(`w-full text-left`,Ie.focusRingPanel),t[20]=V):V=t[20];let U;t[21]===A?U=t[22]:(U=(0,Z.jsx)(`div`,{className:`line-clamp-2 text-sm font-medium leading-5 text-fg`,children:A}),t[21]=A,t[22]=U);let W;t[23]===M?W=t[24]:(W=(0,Z.jsx)(`div`,{className:`mt-1 truncate text-[11px] font-medium text-fg-muted`,children:M}),t[23]=M,t[24]=W);let G;t[25]!==U||t[26]!==W?(G=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[U,W]}),t[25]=U,t[26]=W,t[27]=G):G=t[27];let ee;t[28]===n.status?ee=t[29]:(ee=l(`shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold shadow-sm`,k(n.status)),t[28]=n.status,t[29]=ee);let te;t[30]!==i||t[31]!==a||t[32]!==T?(te=xt(T,a,i),t[30]=i,t[31]=a,t[32]=T,t[33]=te):te=t[33];let ne;t[34]===te?ne=t[35]:(ne=(0,Z.jsx)(`span`,{children:te}),t[34]=te,t[35]=ne);let re=E===`—`?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,Z.jsx)(`span`,{children:I(p.taskElapsed,{duration:E})})]}),ie;t[36]!==ne||t[37]!==re?(ie=(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-[11px] text-fg-subtle`,children:[ne,re]}),t[36]=ne,t[37]=re,t[38]=ie):ie=t[38];let K=n.metrics.artifactCount>0?(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 font-medium text-fg-muted`,children:D}):null,ae=o?(0,Z.jsx)(`span`,{className:`font-medium text-accent-fg`,children:p.taskOpenDetails}):null,oe;t[39]!==K||t[40]!==ae?(oe=(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[K,ae]}),t[39]=K,t[40]=ae,t[41]=oe):oe=t[41];let se=v&&`cursor-not-allowed text-fg-disabled hover:bg-transparent`,ce;t[42]===se?ce=t[43]:(ce=l(`rounded-md px-2 py-1 text-xs font-medium`,`text-accent-fg hover:bg-accent-soft`,Ie.focusRingPanel,se),t[42]=se,t[43]=ce);let le;t[44]!==v||t[45]!==L||t[46]!==p.continueInChat||t[47]!==ce?(le=(0,Z.jsx)(`button`,{type:`button`,className:ce,disabled:v,onClick:L,children:p.continueInChat}),t[44]=v,t[45]=L,t[46]=p.continueInChat,t[47]=ce,t[48]=le):le=t[48];let ue;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(ue=l(`rounded-md px-2 py-1 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,Ie.focusRingPanel),t[49]=ue):ue=t[49];let de;t[50]!==P||t[51]!==p.taskOpenDetails?(de=(0,Z.jsx)(`button`,{type:`button`,className:ue,onClick:P,children:p.taskOpenDetails}),t[50]=P,t[51]=p.taskOpenDetails,t[52]=de):de=t[52];let fe;t[53]!==le||t[54]!==de?(fe=(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 border-t border-edge-subtle pt-2`,children:[le,de]}),t[53]=le,t[54]=de,t[55]=fe):fe=t[55];let pe;t[56]===h?pe=t[57]:(pe=()=>h(Et),t[56]=h,t[57]=pe);let me;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Z.jsx)(R,{className:`size-4`,"aria-hidden":!0}),t[58]=me):me=t[58];let he;t[59]!==p.taskActionsAria||t[60]!==m||t[61]!==pe?(he=(0,Z.jsx)(J,{variant:`ghost`,className:`size-7 p-0 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`,"aria-label":p.taskActionsAria,"aria-expanded":m,onClick:pe,children:me}),t[59]=p.taskActionsAria,t[60]=m,t[61]=pe,t[62]=he):he=t[62];let ge;t[63]!==b||t[64]!==p.cancel||t[65]!==p.rerun||t[66]!==p.taskCloseMenu||t[67]!==m||t[68]!==u||t[69]!==d||t[70]!==n||t[71]!==h?(ge=m?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`button`,{type:`button`,className:`fixed inset-0 z-10 cursor-default`,"aria-label":p.taskCloseMenu,onClick:()=>h(!1)}),(0,Z.jsxs)(`div`,{className:`absolute right-0 z-20 mt-1 min-w-36 rounded-lg border border-edge bg-surface-panel py-1 shadow-surface`,children:[b?(0,Z.jsx)(Tt,{label:p.cancel,tone:`danger`,onClick:()=>{h(!1),u(n.id)}}):null,Ct(n)?(0,Z.jsx)(Tt,{label:p.rerun,onClick:()=>{h(!1),d(n.id)}}):null]})]}):null,t[63]=b,t[64]=p.cancel,t[65]=p.rerun,t[66]=p.taskCloseMenu,t[67]=m,t[68]=u,t[69]=d,t[70]=n,t[71]=h,t[72]=ge):ge=t[72];let _e;return t[73]!==he||t[74]!==ge?(_e=(0,Z.jsxs)(`div`,{className:`absolute right-2 top-2`,children:[he,ge]}),t[73]=he,t[74]=ge,t[75]=_e):_e=t[75],(0,Z.jsxs)(`div`,{className:B,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:P,"aria-label":`${p.taskOpenDetails}: ${A}`,"aria-current":o?`true`:void 0,className:V,children:[(0,Z.jsxs)(`div`,{className:`pr-7`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[G,(0,Z.jsx)(`span`,{className:ee,children:p.status[n.status]??n.status})]}),ie]}),x?(0,Z.jsxs)(`div`,{className:`mt-2.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-[11px] text-fg-muted`,children:[(0,Z.jsx)(`span`,{children:I(p.agentProgress,{done:n.metrics.doneAgentCount,total:n.metrics.agentCount})}),(0,Z.jsxs)(`span`,{children:[C,`%`]})]}),(0,Z.jsx)(`div`,{className:`mt-1.5 h-1.5 overflow-hidden rounded-full bg-surface-hover`,children:(0,Z.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-all`,style:{width:`${C}%`}})})]}):null,oe,w?(0,Z.jsxs)(`div`,{className:`mt-2 flex items-center gap-1 text-[11px] text-amber-700 dark:text-amber-300`,children:[(0,Z.jsx)(H,{className:`size-3 shrink-0`,"aria-hidden":!0}),I(p.runRowErrorSummary,{count:n.metrics.errorAgentCount})]}):null]}),fe,_e]})});function Tt(e){let t=(0,X.c)(8),{label:n,disabled:r,tone:i,onClick:a}=e,o=r?`cursor-not-allowed text-fg-subtle`:`text-fg hover:bg-surface-hover`,s=i===`danger`&&!r&&`text-red-600 dark:text-red-300`,c;t[0]!==o||t[1]!==s?(c=l(`block w-full px-3 py-1.5 text-left text-xs`,o,s),t[0]=o,t[1]=s,t[2]=c):c=t[2];let u;return t[3]!==r||t[4]!==n||t[5]!==a||t[6]!==c?(u=(0,Z.jsx)(`button`,{type:`button`,disabled:r,onClick:a,className:c,children:n}),t[3]=r,t[4]=n,t[5]=a,t[6]=c,t[7]=u):u=t[7],u}function Et(e){return!e}function Dt(e,t){return t.boardColumns[e]}var Ot=(0,Y.memo)(function(e){let t=(0,X.c)(17),{column:n,language:r,localeTag:i,nowMs:a,selectedRunId:o,loading:s,onOpenRun:c,onOpenRunChat:u,onCancelRun:d,onRetryRun:p}=e,m=f(r).workflows,[h,g]=(0,Y.useState)(!1),_=n.id===`succeeded`,v=_?5:n.runs.length,y;t[0]!==v||t[1]!==n.runs||t[2]!==h||t[3]!==_?(y=_&&!h?n.runs.slice(0,v):n.runs,t[0]=v,t[1]=n.runs,t[2]=h,t[3]=_,t[4]=y):y=t[4];let b=y,x=_&&n.runs.length>5&&!h,S=_&&h,C;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(C=l(`flex max-h-full w-72 min-w-72 max-w-72 shrink-0 flex-col overflow-y-auto rounded-lg bg-surface-base shadow-surface`),t[5]=C):C=t[5];let w;t[6]===n.runs.length?w=t[7]:(w=(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.runs.length}),t[6]=n.runs.length,t[7]=w);let T;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(R,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[8]=T):T=t[8];let E=s&&b.length===0?(0,Z.jsx)(kt,{}):b.length===0?(0,Z.jsx)(`div`,{className:`rounded-lg bg-surface-panel/70 px-3 py-6 text-center text-xs text-fg-subtle`,children:m.boardColumnEmpty}):b.map(e=>(0,Z.jsx)(wt,{run:e,language:r,localeTag:i,nowMs:a,selected:e.id===o,onOpen:c,onOpenChat:u,onCancel:d,onRetry:p},e.id)),D=x?(0,Z.jsx)(J,{variant:`ghost`,className:`h-8 w-full text-xs`,onClick:()=>g(!0),children:I(m.boardExpandSucceeded,{count:Math.min(n.runs.length,n.totalInWindow??n.runs.length)})}):null,O;t[9]!==S||t[10]!==m||t[11]!==g?(O=S?(0,Z.jsx)(J,{variant:`ghost`,className:`h-8 w-full text-xs`,onClick:()=>g(!1),children:m.boardCollapseSucceeded}):null,t[9]=S,t[10]=m,t[11]=g,t[12]=O):O=t[12];let k;return t[13]!==E||t[14]!==D||t[15]!==O?(k=(0,Z.jsxs)(`div`,{className:`mx-2 mt-3 grid min-h-0 min-w-0 content-start gap-2 pb-2 pr-1 [scrollbar-gutter:stable]`,children:[E,D,O]}),t[13]=E,t[14]=D,t[15]=O,t[16]=k):k=t[16],(0,Z.jsxs)(`section`,{className:C,"aria-label":Dt(n.id,m),children:[(0,Z.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-2 p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,Z.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:Dt(n.id,m)}),w]}),T]}),k]})});function kt(){let e=(0,X.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsxs)(`article`,{className:`min-h-24 rounded-lg bg-surface-panel p-3 shadow-surface`,"aria-hidden":`true`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(Ne,{className:`size-4/5`}),(0,Z.jsx)(Ne,{className:`mt-2 h-3 w-24`})]}),(0,Z.jsx)(Ne,{className:`h-5 w-14 rounded-full`})]}),(0,Z.jsx)(Ne,{className:`mt-3 h-3 w-2/3`}),(0,Z.jsx)(Ne,{className:`mt-4 h-5 w-20 rounded-full`})]}),e[0]=t):t=e[0],t}function At(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var jt=(0,Y.memo)(function(e){let t=(0,X.c)(54),{runs:n,language:r,localeTag:i,labels:a,searchQuery:o,workflowFilterId:s,triggerFilter:c,selectedRunId:l,loading:u,onOpenRun:d,onOpenRunChat:f,onCancelRun:p,onRetryRun:m,onStart:h}=e,g;t[0]===n?g=t[1]:(g=n.some(Mt),t[0]=n,t[1]=g);let _=g,v=(0,Y.useRef)(null),y=(0,Y.useRef)(null),[b,x]=(0,Y.useState)(Nt),[S,C]=(0,Y.useState)(!1),w,T;t[2]===_?(w=t[3],T=t[4]):(w=()=>{if(!_)return;let e=window.setInterval(()=>x(Date.now()),1e3);return()=>window.clearInterval(e)},T=[_],t[2]=_,t[3]=w,t[4]=T),(0,Y.useEffect)(w,T);let E;t[5]!==b||t[6]!==n||t[7]!==o||t[8]!==c||t[9]!==s?(E=bt(gt(n,{searchQuery:o,workflowFilterId:s,triggerFilter:c}),b),t[5]=b,t[6]=n,t[7]=o,t[8]=c,t[9]=s,t[10]=E):E=t[10];let D=E,O=D.reduce(Pt,0),k;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(k=e=>{let t=y.current;!t||t.pointerId!==e.pointerId||(y.current=null,C(!1),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},t[11]=k):k=t[11];let A=k,j;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>{if(e.button!==0||At(e.target))return;let t=v.current;t&&(y.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},t[12]=j):j=t[12];let M=j,N;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>{let t=y.current,n=v.current;if(!t||!n||t.pointerId!==e.pointerId)return;let r=e.clientX-t.startX;!t.active&&Math.abs(r)<5||(t.active||(t.active=!0,C(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},t[13]=N):N=t[13];let P=N;if(!u&&O===0){let e;t[14]===a.boardEmptyTitle?e=t[15]:(e=(0,Z.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:a.boardEmptyTitle}),t[14]=a.boardEmptyTitle,t[15]=e);let n;t[16]===a.boardEmptyHint?n=t[17]:(n=(0,Z.jsx)(`p`,{className:`mx-auto mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:a.boardEmptyHint}),t[16]=a.boardEmptyHint,t[17]=n);let r;t[18]!==a.boardStart||t[19]!==h?(r=(0,Z.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,Z.jsx)(J,{variant:`primary`,onClick:h,children:a.boardStart})}),t[18]=a.boardStart,t[19]=h,t[20]=r):r=t[20];let i;return t[21]!==r||t[22]!==e||t[23]!==n?(i=(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col items-center justify-center rounded-2xl border border-dashed border-edge bg-surface-panel/40 px-6 py-12 text-center`,children:[e,n,r]}),t[21]=r,t[22]=e,t[23]=n,t[24]=i):i=t[24],i}let F=S?`cursor-grabbing select-none`:`cursor-grab`,I;t[25]===F?I=t[26]:(I=[`min-h-0 h-full min-w-0 overflow-x-auto rounded-lg p-2`,F],t[25]=F,t[26]=I);let L=I.join(` `),R;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{y.current?.pointerId===e.pointerId&&(y.current=null,C(!1))},t[27]=R):R=t[27];let z;if(t[28]!==D||t[29]!==r||t[30]!==u||t[31]!==i||t[32]!==b||t[33]!==p||t[34]!==d||t[35]!==f||t[36]!==m||t[37]!==l){let e;t[39]!==r||t[40]!==u||t[41]!==i||t[42]!==b||t[43]!==p||t[44]!==d||t[45]!==f||t[46]!==m||t[47]!==l?(e=e=>(0,Z.jsx)(Ot,{column:e,language:r,localeTag:i,nowMs:b,selectedRunId:l,loading:u,onOpenRun:d,onOpenRunChat:f,onCancelRun:p,onRetryRun:m},e.id),t[39]=r,t[40]=u,t[41]=i,t[42]=b,t[43]=p,t[44]=d,t[45]=f,t[46]=m,t[47]=l,t[48]=e):e=t[48],z=D.map(e),t[28]=D,t[29]=r,t[30]=u,t[31]=i,t[32]=b,t[33]=p,t[34]=d,t[35]=f,t[36]=m,t[37]=l,t[38]=z}else z=t[38];let B;t[49]===z?B=t[50]:(B=(0,Z.jsx)(`div`,{className:`flex min-h-full min-w-max items-start gap-3 pr-4`,children:z}),t[49]=z,t[50]=B);let V;return t[51]!==L||t[52]!==B?(V=(0,Z.jsx)(`div`,{ref:v,className:L,onPointerDown:M,onPointerMove:P,onPointerUp:A,onPointerCancel:A,onLostPointerCapture:R,children:B}),t[51]=L,t[52]=B,t[53]=V):V=t[53],V});function Mt(e){return e.status===`queued`||e.status===`running`}function Nt(){return Date.now()}function Pt(e,t){return e+t.runs.length}function Ft(e,t){let n=e.metadata.estimatedAgents;return n?n.min===n.max?I(t.agentScaleExact,{count:n.min}):I(t.agentScaleRange,{min:n.min,max:n.max}):null}function It(e){let t=(0,X.c)(73),{definition:n,language:r,labels:i,onPick:a,onDetail:o,onEdit:s}=e,c;t[0]!==n||t[1]!==r?(c=U(n,r),t[0]=n,t[1]=r,t[2]=c):c=t[2];let u=c,d;t[3]!==n||t[4]!==i?(d=Ft(n,i),t[3]=n,t[4]=i,t[5]=d):d=t[5];let f=d,p=n.metadata.source===`user`,m=p?`bg-accent-soft text-accent-fg`:`bg-surface-muted text-fg-muted`,h;t[6]===m?h=t[7]:(h=l(`rounded-full px-2 py-0.5 text-[10px] font-medium`,m),t[6]=m,t[7]=h);let g=p?i.badgeUser:i.badgeBuiltin,_;t[8]!==h||t[9]!==g?(_=(0,Z.jsx)(`span`,{className:h,children:g}),t[8]=h,t[9]=g,t[10]=_):_=t[10];let v;t[11]!==n.inputSchema||t[12]!==i.inputSchemaBadge?(v=n.inputSchema?(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-surface-muted px-2 py-0.5 text-[10px] text-fg-subtle`,children:[(0,Z.jsx)(qe,{className:`size-2.5`,"aria-hidden":!0}),i.inputSchemaBadge]}):null,t[11]=n.inputSchema,t[12]=i.inputSchemaBadge,t[13]=v):v=t[13];let y;t[14]!==_||t[15]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[_,v]}),t[14]=_,t[15]=v,t[16]=y):y=t[16];let b;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(b=l(`mt-2 line-clamp-2 text-left text-sm font-semibold leading-5 text-fg hover:text-accent-fg`,Ie.focusRingPanel),t[17]=b):b=t[17];let x;t[18]!==n||t[19]!==o?(x=()=>o(n),t[18]=n,t[19]=o,t[20]=x):x=t[20];let S;t[21]!==n.title||t[22]!==x?(S=(0,Z.jsx)(`button`,{type:`button`,className:b,onClick:x,children:n.title}),t[21]=n.title,t[22]=x,t[23]=S):S=t[23];let C;t[24]!==S||t[25]!==y?(C=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[y,S]}),t[24]=S,t[25]=y,t[26]=C):C=t[26];let w=`${p?i.editWorkflow:i.copyAndEditWorkflow}: ${n.title}`,T;t[27]!==n||t[28]!==s?(T=()=>s(n),t[27]=n,t[28]=s,t[29]=T):T=t[29];let E;t[30]===p?E=t[31]:(E=p?(0,Z.jsx)(te,{className:`size-3.5`,"aria-hidden":!0}):(0,Z.jsx)(tt,{className:`size-3.5`,"aria-hidden":!0}),t[30]=p,t[31]=E);let D;t[32]!==w||t[33]!==T||t[34]!==E?(D=(0,Z.jsx)(J,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":w,onClick:T,children:E}),t[32]=w,t[33]=T,t[34]=E,t[35]=D):D=t[35];let O;t[36]!==C||t[37]!==D?(O=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[C,D]}),t[36]=C,t[37]=D,t[38]=O):O=t[38];let k=u.whenToUse||u.description||n.description,A;t[39]===k?A=t[40]:(A=(0,Z.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:k}),t[39]=k,t[40]=A);let j;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(ze,{className:`size-3`,"aria-hidden":!0}),t[41]=j):j=t[41];let M;t[42]!==n.phases.length||t[43]!==i.phaseCount?(M=I(i.phaseCount,{count:n.phases.length}),t[42]=n.phases.length,t[43]=i.phaseCount,t[44]=M):M=t[44];let N;t[45]===M?N=t[46]:(N=(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[j,M]}),t[45]=M,t[46]=N);let P;t[47]===f?P=t[48]:(P=f?(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Z.jsx)(je,{className:`size-3`,"aria-hidden":!0}),f]}):null,t[47]=f,t[48]=P);let F;t[49]!==N||t[50]!==P?(F=(0,Z.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center gap-3 pt-4 text-[11px] text-fg-subtle`,children:[N,P]}),t[49]=N,t[50]=P,t[51]=F):F=t[51];let L;t[52]!==n||t[53]!==a?(L=()=>a(n),t[52]=n,t[53]=a,t[54]=L):L=t[54];let R;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)(Xe,{className:`size-3.5`,"aria-hidden":!0}),t[55]=R):R=t[55];let z;t[56]!==i.configureAndRun||t[57]!==L?(z=(0,Z.jsxs)(J,{type:`button`,variant:`primary`,className:`h-8 flex-1 rounded-lg text-xs`,onClick:L,children:[R,i.configureAndRun]}),t[56]=i.configureAndRun,t[57]=L,t[58]=z):z=t[58];let B;t[59]!==n||t[60]!==o?(B=()=>o(n),t[59]=n,t[60]=o,t[61]=B):B=t[61];let V;t[62]!==i.viewDetails||t[63]!==B?(V=(0,Z.jsx)(J,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:B,children:i.viewDetails}),t[62]=i.viewDetails,t[63]=B,t[64]=V):V=t[64];let H;t[65]!==z||t[66]!==V?(H=(0,Z.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-edge-subtle pt-3`,children:[z,V]}),t[65]=z,t[66]=V,t[67]=H):H=t[67];let W;return t[68]!==O||t[69]!==A||t[70]!==F||t[71]!==H?(W=(0,Z.jsxs)(`article`,{className:`flex min-h-48 flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 transition-colors hover:border-edge hover:bg-surface-hover/35`,children:[O,A,F,H]}),t[68]=O,t[69]=A,t[70]=F,t[71]=H,t[72]=W):W=t[72],W}function Lt(e){let t=(0,X.c)(44),{definitions:n,runs:r,language:i,onPick:a,onDetail:o,onEdit:s}=e,[c]=(0,Y.useState)(Bt),u=f(i).workflows,d=i===`zh`?`zh-CN`:`en-US`,[p,m]=(0,Y.useState)(``),[h,g]=(0,Y.useState)(`all`),[_,v]=(0,Y.useState)(`all`),y;t[0]!==h||t[1]!==n||t[2]!==p||t[3]!==_?(y=Ae(n,p,h,_),t[0]=h,t[1]=n,t[2]=p,t[3]=_,t[4]=y):y=t[4];let b=y,x;if(t[5]!==n||t[6]!==r){let e=new Map(n.map(zt)),i=new Set;x=[...r].sort(Rt).flatMap(t=>{if(i.has(t.definitionId))return[];let n=e.get(t.definitionId);return n?(i.add(t.definitionId),[{definition:n,lastRunAtMs:t.startedAtMs??t.createdAtMs}]):[]}).slice(0,3),t[5]=n,t[6]=r,t[7]=x}else x=t[7];let S=x,C=I(u.workflowCount,{count:b.length}),w;t[8]===C?w=t[9]:(w=(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:C}),t[8]=C,t[9]=w);let T=u.sourceFilterAria,E;t[10]!==u.sources||t[11]!==v||t[12]!==_?(E=Re.map(e=>(0,Z.jsx)(`button`,{type:`button`,className:l(`h-8 rounded-md px-2.5 text-xs font-medium transition-colors`,_===e?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:text-fg`,Ie.focusRingPanel),"aria-pressed":_===e,onClick:()=>v(e),children:u.sources[e]},e)),t[10]=u.sources,t[11]=v,t[12]=_,t[13]=E):E=t[13];let D;t[14]!==u.sourceFilterAria||t[15]!==E?(D=(0,Z.jsx)(`div`,{className:`flex rounded-lg bg-surface-muted p-0.5`,role:`group`,"aria-label":T,children:E}),t[14]=u.sourceFilterAria,t[15]=E,t[16]=D):D=t[16];let O=u.categoryFilterAria,k;t[17]===g?k=t[18]:(k=e=>g(e.target.value),t[17]=g,t[18]=k);let A;t[19]===u.categories?A=t[20]:(A=re.map(e=>(0,Z.jsx)(pe,{value:e,children:u.categories[e]},e)),t[19]=u.categories,t[20]=A);let j;t[21]!==h||t[22]!==u.categoryFilterAria||t[23]!==k||t[24]!==A?(j=(0,Z.jsx)(ue,{value:h,"aria-label":O,onChange:k,className:`h-9 min-w-36 rounded-lg border border-edge bg-surface-base px-2.5 text-xs font-medium text-fg shadow-surface`,children:A}),t[21]=h,t[22]=u.categoryFilterAria,t[23]=k,t[24]=A,t[25]=j):j=t[25];let M;t[26]!==j||t[27]!==D?(M=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[D,j]}),t[26]=j,t[27]=D,t[28]=M):M=t[28];let N;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(he,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),t[29]=N):N=t[29];let P;t[30]===m?P=t[31]:(P=e=>m(e.target.value),t[30]=m,t[31]=P);let F=u.librarySearchPlaceholder,L;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(L=l(`h-10 w-full rounded-lg border border-edge bg-surface-base py-2 pl-10 pr-3 text-sm text-fg`,`placeholder:text-fg-muted`,Ie.focusRingPanel),t[32]=L):L=t[32];let R;t[33]!==u.librarySearchPlaceholder||t[34]!==p||t[35]!==P?(R=(0,Z.jsxs)(`div`,{className:`relative max-w-xl`,children:[N,(0,Z.jsx)(`input`,{value:p,onChange:P,placeholder:F,className:L})]}),t[33]=u.librarySearchPlaceholder,t[34]=p,t[35]=P,t[36]=R):R=t[36];let z;return t[37]!==b||t[38]!==u||t[39]!==i||t[40]!==o||t[41]!==s||t[42]!==a?(z=b.length===0?(0,Z.jsxs)(`div`,{className:`flex min-h-64 flex-col items-center justify-center px-4 py-12 text-center`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:u.noDefinitions}),(0,Z.jsx)(`p`,{className:`mt-1 max-w-sm text-xs leading-5 text-fg-muted`,children:u.noDefinitionsHint})]}):(0,Z.jsx)(`div`,{className:`grid grid-cols-1 gap-3 pt-4 sm:grid-cols-2 xl:grid-cols-3`,children:b.map(e=>(0,Z.jsx)(It,{definition:e,language:i,labels:u,onPick:a,onDetail:o,onEdit:s},e.id))}),t[37]=b,t[38]=u,t[39]=i,t[40]=o,t[41]=s,t[42]=a,t[43]=z):z=t[43],(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5`,children:[S.length>0&&!p&&h===`all`&&_===`all`?(0,Z.jsxs)(`section`,{"aria-labelledby":`recent-workflows-heading`,children:[(0,Z.jsx)(`h2`,{id:`recent-workflows-heading`,className:`text-sm font-semibold text-fg`,children:u.recentlyUsed}),(0,Z.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:S.map(e=>{let{definition:t,lastRunAtMs:n}=e;return(0,Z.jsxs)(`button`,{type:`button`,className:l(`flex min-w-52 flex-1 items-center justify-between gap-3 rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 text-left hover:bg-surface-hover`,`sm:max-w-sm`,Ie.focusRingPanel),onClick:()=>a(t),children:[(0,Z.jsxs)(`span`,{className:`min-w-0`,children:[(0,Z.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:t.title}),(0,Z.jsx)(`span`,{className:`mt-0.5 block text-[11px] text-fg-subtle`,children:xt(n,c,d)})]}),(0,Z.jsx)(Xe,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0})]},t.id)})})]}):null,(0,Z.jsxs)(`section`,{"aria-labelledby":`all-workflows-heading`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-edge-subtle pb-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{id:`all-workflows-heading`,className:`text-sm font-semibold text-fg`,children:u.allWorkflows}),w]}),M]}),R]}),z]})]})}function Rt(e,t){return(t.startedAtMs??t.createdAtMs)-(e.startedAtMs??e.createdAtMs)}function zt(e){return[e.id,e]}function Bt(){return Date.now()}var Vt=(0,Y.memo)(function(e){let t=(0,X.c)(108),{run:n,language:r,localeTag:i,nowMs:a,onOpen:o,onOpenChat:s,onCancel:c,onRetry:u}=e,d,p,m,h,g,v,y,b,x,S,C,w,T,E,D,O,A;if(t[0]!==r||t[1]!==i||t[2]!==a||t[3]!==o||t[4]!==n){m=f(r).workflows;let e;t[22]===n?e=t[23]:(e=St(n),t[22]=n,t[23]=e),d=e;let s;t[24]===n?s=t[25]:(s=Ct(n),t[24]=n,t[25]=s),h=s;let c;t[26]===n?c=t[27]:(c=lt(n),t[26]=n,t[27]=c),p=!!c;let u=n.startedAtMs??n.createdAtMs,j=_(d?a-u:n.metrics.durationMs),M;t[28]!==n.metrics.agentCount||t[29]!==n.metrics.doneAgentCount?(M=n.metrics.agentCount>0?Math.round(n.metrics.doneAgentCount/n.metrics.agentCount*100):0,t[28]=n.metrics.agentCount,t[29]=n.metrics.doneAgentCount,t[30]=M):M=t[30];let N=M;x=`group border-b border-edge-subtle last:border-b-0`,b=`flex min-w-0 flex-col gap-3 p-3 transition-colors hover:bg-surface-hover/55 sm:px-4 lg:flex-row lg:items-center`,O=`button`,t[31]!==o||t[32]!==n?(A=()=>o(n),t[31]=o,t[32]=n,t[33]=A):A=t[33],t[34]===Symbol.for(`react.memo_cache_sentinel`)?(v=l(`min-w-0 flex-1 text-left`,Ie.focusRingPanel),t[34]=v):v=t[34];let P=m.taskOpenDetails,F;t[35]===n?F=t[36]:(F=pt(n),t[35]=n,t[36]=F),y=`${P}: ${F}`,E=`flex min-w-0 items-start gap-3`;let L;t[37]===n.status?L=t[38]:(L=l(`mt-0.5 shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold`,k(n.status)),t[37]=n.status,t[38]=L),D=(0,Z.jsx)(`span`,{className:L,children:m.status[n.status]??n.status}),g=`min-w-0 flex-1`;let R;t[39]===n?R=t[40]:(R=pt(n),t[39]=n,t[40]=R),t[41]===R?S=t[42]:(S=(0,Z.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:R}),t[41]=R,t[42]=S);let z;t[43]===n?z=t[44]:(z=mt(n),t[43]=n,t[44]=z);let B;t[45]===z?B=t[46]:(B=(0,Z.jsx)(`span`,{className:`truncate font-medium`,children:z}),t[45]=z,t[46]=B);let V;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(`span`,{"aria-hidden":!0,children:`·`}),t[47]=V):V=t[47];let U;t[48]!==i||t[49]!==a||t[50]!==u?(U=xt(u,a,i),t[48]=i,t[49]=a,t[50]=u,t[51]=U):U=t[51];let W;t[52]===U?W=t[53]:(W=(0,Z.jsx)(`span`,{children:U}),t[52]=U,t[53]=W);let G=j===`—`?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,Z.jsx)(`span`,{children:I(m.taskElapsed,{duration:j})})]});t[54]!==B||t[55]!==W||t[56]!==G?(C=(0,Z.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-muted`,children:[B,V,W,G]}),t[54]=B,t[55]=W,t[56]=G,t[57]=C):C=t[57],w=d&&n.metrics.agentCount>0?(0,Z.jsxs)(`span`,{className:`mt-2 block max-w-md`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center justify-between text-[11px] text-fg-subtle`,children:[(0,Z.jsx)(`span`,{children:I(m.agentProgress,{done:n.metrics.doneAgentCount,total:n.metrics.agentCount})}),(0,Z.jsxs)(`span`,{className:`tabular-nums`,children:[N,`%`]})]}),(0,Z.jsx)(`span`,{className:`mt-1 block h-1.5 overflow-hidden rounded-full bg-surface-muted`,children:(0,Z.jsx)(`span`,{className:`block h-full rounded-full bg-accent transition-[width] duration-200 motion-reduce:transition-none`,style:{width:`${N}%`}})})]}):null,T=n.metrics.errorAgentCount>0?(0,Z.jsxs)(`span`,{className:`mt-2 flex items-center gap-1 text-[11px] text-amber-700 dark:text-amber-300`,children:[(0,Z.jsx)(H,{className:`size-3 shrink-0`,"aria-hidden":!0}),I(m.runRowErrorSummary,{count:n.metrics.errorAgentCount})]}):null,t[0]=r,t[1]=i,t[2]=a,t[3]=o,t[4]=n,t[5]=d,t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=v,t[11]=y,t[12]=b,t[13]=x,t[14]=S,t[15]=C,t[16]=w,t[17]=T,t[18]=E,t[19]=D,t[20]=O,t[21]=A}else d=t[5],p=t[6],m=t[7],h=t[8],g=t[9],v=t[10],y=t[11],b=t[12],x=t[13],S=t[14],C=t[15],w=t[16],T=t[17],E=t[18],D=t[19],O=t[20],A=t[21];let j;t[58]!==g||t[59]!==S||t[60]!==C||t[61]!==w||t[62]!==T?(j=(0,Z.jsxs)(`span`,{className:g,children:[S,C,w,T]}),t[58]=g,t[59]=S,t[60]=C,t[61]=w,t[62]=T,t[63]=j):j=t[63];let M;t[64]!==j||t[65]!==E||t[66]!==D?(M=(0,Z.jsxs)(`div`,{className:E,children:[D,j]}),t[64]=j,t[65]=E,t[66]=D,t[67]=M):M=t[67];let N;t[68]!==v||t[69]!==y||t[70]!==M||t[71]!==O||t[72]!==A?(N=(0,Z.jsx)(`button`,{type:O,onClick:A,className:v,"aria-label":y,children:M}),t[68]=v,t[69]=y,t[70]=M,t[71]=O,t[72]=A,t[73]=N):N=t[73];let P;t[74]!==m.rerun||t[75]!==u||t[76]!==h||t[77]!==n.id?(P=h?(0,Z.jsx)(J,{type:`button`,variant:`primary`,className:`h-8 rounded-lg text-xs`,onClick:()=>u(n.id),children:m.rerun}):null,t[74]=m.rerun,t[75]=u,t[76]=h,t[77]=n.id,t[78]=P):P=t[78];let F;t[79]!==p||t[80]!==m.continueInChat||t[81]!==s||t[82]!==n?(F=n.status===`succeeded`&&p?(0,Z.jsx)(J,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>s(n),children:m.continueInChat}):null,t[79]=p,t[80]=m.continueInChat,t[81]=s,t[82]=n,t[83]=F):F=t[83];let L;t[84]!==d||t[85]!==m.cancel||t[86]!==c||t[87]!==n.id?(L=d?(0,Z.jsx)(J,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg text-xs text-red-600 dark:text-red-300`,onClick:()=>c(n.id),children:m.cancel}):null,t[84]=d,t[85]=m.cancel,t[86]=c,t[87]=n.id,t[88]=L):L=t[88];let R;t[89]!==o||t[90]!==n?(R=()=>o(n),t[89]=o,t[90]=n,t[91]=R):R=t[91];let z;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(Ve,{className:`size-4`,"aria-hidden":!0}),t[92]=z):z=t[92];let B;t[93]!==m.taskOpenDetails||t[94]!==R?(B=(0,Z.jsx)(J,{type:`button`,variant:`ghost`,className:`size-8 p-0`,"aria-label":m.taskOpenDetails,onClick:R,children:z}),t[93]=m.taskOpenDetails,t[94]=R,t[95]=B):B=t[95];let V;t[96]!==P||t[97]!==F||t[98]!==L||t[99]!==B?(V=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-1.5 pl-7 lg:pl-0`,children:[P,F,L,B]}),t[96]=P,t[97]=F,t[98]=L,t[99]=B,t[100]=V):V=t[100];let U;t[101]!==b||t[102]!==N||t[103]!==V?(U=(0,Z.jsxs)(`div`,{className:b,children:[N,V]}),t[101]=b,t[102]=N,t[103]=V,t[104]=U):U=t[104];let W;return t[105]!==x||t[106]!==U?(W=(0,Z.jsx)(`article`,{className:x,children:U}),t[105]=x,t[106]=U,t[107]=W):W=t[107],W});function Ht(e){let t=(0,X.c)(17),{vm:n}=e,{labels:r,language:i,loading:a,ownerAgentId:o,agentOptions:c,setOwnerAgentId:l,refreshAll:u}=n,d;t[0]!==c||t[1]!==r.agentFilterAria||t[2]!==i||t[3]!==o||t[4]!==l?(d=c.length>1?(0,Z.jsx)(ue,{value:o??``,"aria-label":r.agentFilterAria,onChange:e=>l(e.target.value),className:`h-9 min-w-32 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:c.map(e=>(0,Z.jsx)(pe,{value:e.id,children:K(e,f(i).agentsSettings)},e.id))}):null,t[0]=c,t[1]=r.agentFilterAria,t[2]=i,t[3]=o,t[4]=l,t[5]=d):d=t[5];let p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Qe,{className:`size-4`,"aria-hidden":!0}),t[6]=p):p=t[6];let m;t[7]===r.addWorkflow?m=t[8]:(m=(0,Z.jsx)(J,{asChild:!0,variant:`primary`,className:`h-9 rounded-lg`,children:(0,Z.jsxs)(s,{to:`/workflows/new`,children:[p,r.addWorkflow]})}),t[7]=r.addWorkflow,t[8]=m);let h;t[9]!==r.refresh||t[10]!==a||t[11]!==u?(h=(0,Z.jsx)(xe,{className:`size-9 shrink-0 p-0`,loading:a,label:r.refresh,onClick:u}),t[9]=r.refresh,t[10]=a,t[11]=u,t[12]=h):h=t[12];let g;return t[13]!==d||t[14]!==m||t[15]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[d,m,h]}),t[13]=d,t[14]=m,t[15]=h,t[16]=g):g=t[16],g}var Ut=new Set([`failed`,`timeout`,`cancelled`]),Wt=[{id:`runs`,icon:ce},{id:`library`,icon:g}],Gt={failed:0,timeout:0,cancelled:0,running:1,queued:2,succeeded:3};function Kt(e){return Ut.has(e.status)}function qt(e,t){return t===`all`?!0:t===`attention`?Kt(e):e.status===t}function Jt(e){return[...e].sort((e,t)=>{let n=(Gt[e.status]??4)-(Gt[t.status]??4);if(n!==0)return n;if(e.status===`queued`&&t.status===`queued`)return e.createdAtMs-t.createdAtMs;let r=e.completedAtMs??e.startedAtMs??e.createdAtMs;return(t.completedAtMs??t.startedAtMs??t.createdAtMs)-r})}function Yt(e,t){return e===`Home`?`runs`:e===`End`?`library`:e===`ArrowLeft`||e===`ArrowRight`?t===`runs`?`library`:`runs`:null}function Xt(){let e=(0,X.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Ne,{className:`h-5 w-16 rounded-full`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge-subtle p-4 last:border-b-0`,"aria-hidden":`true`,children:[t,(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(Ne,{className:`h-4 w-52 max-w-full`}),(0,Z.jsx)(Ne,{className:`mt-2 h-3 w-36 max-w-full`})]}),(0,Z.jsx)(Ne,{className:`hidden h-8 w-20 rounded-lg sm:block`})]}),e[1]=n):n=e[1],n}function Zt(e){let t=(0,X.c)(30),{vm:n}=e,{language:r,localeTag:i,labels:a,hasToken:o,definitions:s,runs:c,searchQuery:u,setSearchQuery:d,workflowFilterId:f,setWorkflowFilterId:p,triggerFilter:m,setTriggerFilter:h,statusFilter:g,setStatusFilter:_,clearRunFilters:v,pageTab:x,setPageTab:S,runLayout:C,setRunLayout:w,openRunDetails:T,openRunInChat:E,openDefinitionDetails:D,openWorkflowEditor:O,startWorkflow:k,actionError:A,loading:j,error:M,cancelRun:N,retryRun:P}=n,F=y(tn),I=y(en),L=Date.now(),R=Jt(c.filter(Kt)),z;t[0]===g?z=t[1]:(z=e=>qt(e,g),t[0]=g,t[1]=z);let B=Jt(gt(c,{searchQuery:u,workflowFilterId:f,triggerFilter:m}).filter(z)),V=!!(u||f||m!==`all`||g!==`all`),U,W;if(t[2]!==I||t[3]!==o||t[4]!==a.librarySubtitle||t[5]!==a.runsSubtitle||t[6]!==a.title||t[7]!==x||t[8]!==F||t[9]!==n?(U=()=>{if(!o){I();return}return F({startExtra:null,main:(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:a.title}),(0,Z.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:x===`runs`?a.runsSubtitle:a.librarySubtitle})]}),end:(0,Z.jsx)(Ht,{vm:n})}),()=>I()},W=[I,o,a.librarySubtitle,a.runsSubtitle,a.title,x,F,n],t[2]=I,t[3]=o,t[4]=a.librarySubtitle,t[5]=a.runsSubtitle,t[6]=a.title,t[7]=x,t[8]=F,t[9]=n,t[10]=U,t[11]=W):(U=t[10],W=t[11]),(0,Y.useLayoutEffect)(U,W),!o){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Je,{className:`size-10 text-accent-fg`,"aria-hidden":!0}),t[12]=e):e=t[12];let n;t[13]===a.title?n=t[14]:(n=(0,Z.jsx)(`h1`,{className:`mt-4 text-xl font-semibold text-fg`,children:a.title}),t[13]=a.title,t[14]=n);let r;t[15]===a.needToken?r=t[16]:(r=(0,Z.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:a.needToken}),t[15]=a.needToken,t[16]=r);let i;return t[17]!==n||t[18]!==r?(i=(0,Z.jsx)(`main`,{className:`min-h-0 flex-1 overflow-auto bg-surface-panel`,children:(0,Z.jsxs)(`div`,{className:`flex w-full flex-col items-center px-3 py-16 text-center sm:px-5 xl:px-6`,children:[e,n,r]})}),t[17]=n,t[18]=r,t[19]=i):i=t[19],i}let G=a.pageTabsAria,ee=Wt.map(e=>{let{id:t,icon:n}=e;return(0,Z.jsxs)(`button`,{id:`workflow-tab-${t}`,type:`button`,role:`tab`,"aria-selected":x===t,"aria-controls":`workflow-panel-${t}`,tabIndex:x===t?0:-1,draggable:!1,className:l(`relative inline-flex shrink-0 items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`transition-transform duration-150 ease-out active:scale-95 motion-reduce:transition-none motion-reduce:active:scale-100`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,x===t?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),onClick:()=>S(t),onKeyDown:e=>{let n=Yt(e.key,t);n&&(e.preventDefault(),S(n),window.requestAnimationFrame(()=>{document.getElementById(`workflow-tab-${n}`)?.focus()}))},children:[(0,Z.jsx)(n,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:a.pageTabs[t]}),t===`runs`&&R.length>0?(0,Z.jsx)(`span`,{className:`rounded-full bg-red-500/15 px-1.5 py-0.5 text-[10px] font-semibold text-red-700 dark:text-red-300`,children:R.length}):null]},t)}),te;t[20]!==a.pageTabsAria||t[21]!==ee?(te=(0,Z.jsx)(`nav`,{className:`-mx-1 flex gap-1 overflow-x-auto px-1 pb-1`,"aria-label":G,role:`tablist`,children:ee}),t[20]=a.pageTabsAria,t[21]=ee,t[22]=te):te=t[22];let ne;t[23]!==A||t[24]!==M?(ne=A??M?(0,Z.jsx)(`div`,{className:`mt-4 rounded-lg border border-red-500/25 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,role:`alert`,children:A??M}):null,t[23]=A,t[24]=M,t[25]=ne):ne=t[25];let re=x===`runs`?(0,Z.jsxs)(`div`,{id:`workflow-panel-runs`,role:`tabpanel`,"aria-labelledby":`workflow-tab-runs`,className:`flex flex-col gap-4 py-4`,children:[R.length>0?(0,Z.jsx)(`section`,{className:`rounded-xl border border-amber-500/30 bg-amber-500/8 px-4 py-3`,"aria-labelledby":`workflow-attention-heading`,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Z.jsx)(H,{className:`mt-0.5 size-4 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`h2`,{id:`workflow-attention-heading`,className:`text-sm font-semibold text-fg`,children:a.attentionTitle}),(0,Z.jsx)(`span`,{className:`rounded-full bg-amber-500/15 px-2 py-0.5 text-[10px] font-semibold text-amber-800 dark:text-amber-200`,children:R.length})]}),(0,Z.jsxs)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:[pt(R[0]),` · `,xt(R[0].completedAtMs??R[0].createdAtMs,L,i)]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:a.attentionHint})]})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pl-7 lg:pl-0`,children:[(0,Z.jsx)(J,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>T(R[0]),children:a.attentionView}),(0,Z.jsx)(J,{type:`button`,variant:`primary`,className:`h-8 rounded-lg text-xs`,onClick:()=>void P(R[0].id),children:a.rerun})]})]})}):null,(0,Z.jsx)(`section`,{className:`flex flex-col gap-3 rounded-xl border border-edge-subtle bg-surface-base p-3`,"aria-label":a.runFiltersAria,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(`div`,{className:`relative min-w-52 flex-1 sm:max-w-sm`,children:[(0,Z.jsx)(he,{className:`pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,Z.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),placeholder:a.runsSearchPlaceholder,className:l(`h-9 w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg shadow-surface`,`placeholder:text-fg-muted`,Ie.focusRingPanel)})]}),(0,Z.jsx)(ue,{value:g,"aria-label":a.statusFilterAria,onChange:e=>_(e.target.value),className:`h-9 min-w-32 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:[`all`,`attention`,`running`,`queued`,`succeeded`].map(e=>(0,Z.jsx)(pe,{value:e,children:a.runStatuses[e]},e))}),(0,Z.jsxs)(ue,{value:m,"aria-label":a.boardTriggerFilterAria,onChange:e=>h(e.target.value),className:`h-9 min-w-[7.5rem] rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:[(0,Z.jsx)(pe,{value:`all`,children:a.boardTriggerFilterAll}),(0,Z.jsx)(pe,{value:`automation`,children:a.boardTriggerFilterAutomation}),(0,Z.jsx)(pe,{value:`webui`,children:a.boardTriggerFilterWebui}),(0,Z.jsx)(pe,{value:`chat`,children:a.boardTriggerFilterChat}),(0,Z.jsx)(pe,{value:`api`,children:a.boardTriggerFilterApi})]}),(0,Z.jsxs)(ue,{value:f,"aria-label":a.boardWorkflowFilterAria,onChange:e=>p(e.target.value),className:`h-9 min-w-40 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:[(0,Z.jsx)(pe,{value:``,children:a.boardWorkflowFilterAll}),s.map($t)]}),V?(0,Z.jsxs)(J,{type:`button`,variant:`ghost`,className:`h-9 rounded-lg text-xs`,onClick:v,children:[(0,Z.jsx)(b,{className:`size-3.5`,"aria-hidden":!0}),a.clearFilters]}):null,(0,Z.jsxs)(`div`,{className:`ml-auto flex rounded-lg bg-surface-muted p-0.5`,role:`group`,"aria-label":a.layoutAria,children:[(0,Z.jsxs)(`button`,{type:`button`,className:l(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,C===`list`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,Ie.focusRingPanel),"aria-pressed":C===`list`,onClick:()=>w(`list`),children:[(0,Z.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0}),a.runLayouts.list]}),(0,Z.jsxs)(`button`,{type:`button`,className:l(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,C===`board`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,Ie.focusRingPanel),"aria-pressed":C===`board`,onClick:()=>w(`board`),children:[(0,Z.jsx)(We,{className:`size-3.5`,"aria-hidden":!0}),a.runLayouts.board]})]})]})}),C===`list`?(0,Z.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge-subtle bg-surface-base`,"aria-labelledby":`workflow-runs-heading`,children:[(0,Z.jsxs)(`header`,{className:`flex items-start justify-between gap-3 border-b border-edge-subtle px-4 py-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{id:`workflow-runs-heading`,className:`text-sm font-semibold text-fg`,children:a.allRuns}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a.allRunsHint})]}),(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-xs font-semibold tabular-nums text-fg-muted`,children:B.length})]}),j&&B.length===0?Array.from({length:4}).map(Qt):B.length>0?B.map(e=>(0,Z.jsx)(Vt,{run:e,language:r,localeTag:i,nowMs:L,onOpen:T,onOpenChat:E,onCancel:e=>void N(e),onRetry:e=>void P(e)},e.id)):(0,Z.jsxs)(`div`,{className:`flex min-h-64 flex-col items-center justify-center px-4 py-12 text-center`,children:[(0,Z.jsx)(Je,{className:`size-8 text-fg-subtle`,"aria-hidden":!0}),(0,Z.jsx)(`h3`,{className:`mt-3 text-sm font-semibold text-fg`,children:V?a.noRunResultsTitle:a.noRunsTitle}),(0,Z.jsx)(`p`,{className:`mt-1 max-w-md text-xs leading-5 text-fg-muted`,children:V?a.noRunResultsHint:a.noRunsStartHint}),(0,Z.jsx)(J,{type:`button`,variant:V?`secondary`:`primary`,className:`mt-4 h-9 rounded-lg text-xs`,onClick:V?v:()=>S(`library`),children:V?a.clearFilters:a.chooseWorkflow})]})]}):(0,Z.jsx)(`div`,{className:`h-[min(72vh,48rem)] min-h-[24rem] w-full sm:min-h-[28rem]`,children:(0,Z.jsx)(jt,{runs:B,language:r,localeTag:i,labels:{boardEmptyTitle:a.boardEmptyTitle,boardEmptyHint:a.boardEmptyHint,boardStart:a.chooseWorkflow,loading:a.loading},searchQuery:``,workflowFilterId:``,triggerFilter:`all`,selectedRunId:null,loading:j,onOpenRun:T,onOpenRunChat:E,onCancelRun:e=>void N(e),onRetryRun:e=>void P(e),onStart:()=>S(`library`)})})]}):(0,Z.jsxs)(`section`,{id:`workflow-panel-library`,role:`tabpanel`,"aria-labelledby":`workflow-tab-library`,className:`py-5`,children:[(0,Z.jsxs)(`div`,{className:`mb-5`,children:[(0,Z.jsx)(`h2`,{id:`workflow-library-heading`,className:`text-base font-semibold text-fg`,children:a.libraryTitle}),(0,Z.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:a.libraryDescription})]}),(0,Z.jsx)(Lt,{definitions:s,runs:c,language:r,onPick:k,onDetail:D,onEdit:O})]}),ie;return t[26]!==ne||t[27]!==re||t[28]!==te?(ie=(0,Z.jsx)(`main`,{className:`min-h-0 flex-1 overflow-y-auto bg-surface-panel`,children:(0,Z.jsxs)(`div`,{className:`mx-auto flex min-h-full w-full max-w-[96rem] flex-col px-3 py-5 sm:px-5 xl:px-6`,children:[te,ne,re]})}),t[26]=ne,t[27]=re,t[28]=te,t[29]=ie):ie=t[29],ie}function Qt(e,t){return(0,Z.jsx)(Xt,{},t)}function $t(e){return(0,Z.jsx)(pe,{value:e.id,children:e.title},e.id)}function en(e){return e.clearPageHeader}function tn(e){return e.setPageHeader}function nn(){let e=(0,X.c)(114),t=m(cn),n;e[0]===t?n=e[1]:(n=f(t),e[0]=t,e[1]=n);let r=n.workflows,i=t===`zh`?`zh-CN`:`en-US`,s=p(sn),c=!!s,l=o(),[u,d]=a(),g;e[2]===u?g=e[3]:(g=u.get(`q`)??``,e[2]=u,e[3]=g);let _=g,v;e[4]===u?v=e[5]:(v=u.get(`wf`)?.trim()??``,e[4]=u,e[5]=v);let y=v,b;e[6]===u?b=e[7]:(b=u.get(`trigger`)?.trim()||`all`,e[6]=u,e[7]=b);let x=b,S,C,w,T;if(e[8]!==u){let t=u.get(`status`)?.trim()??``,n=u.get(`tab`)?.trim()??``,r=u.get(`layout`)?.trim()??``;S=u.get(`agent`)?.trim()??``,C=ae.has(n)?n:`runs`,w=N.has(r)?r:`list`,T=le.has(t)?t:`all`,e[8]=u,e[9]=S,e[10]=C,e[11]=w,e[12]=T}else S=e[9],C=e[10],w=e[11],T=e[12];let E=T,[D,k]=(0,Y.useState)(null),j;e[13]!==c||e[14]!==s?(j=c?[`workflow-agents`,s]:null,e[13]=c,e[14]=s,e[15]=j):j=e[15];let P;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(P={revalidateOnFocus:!1},e[16]=P):P=e[16];let F=h(j,M,P),I;bb0:{let e=F.data?.agents??[];if(S&&(e.length===0||e.some(e=>e.id===S))){I=S;break bb0}I=F.data?.defaultId}let L=I,R;e[17]!==c||e[18]!==s?(R=c?[`workflow-definitions`,s]:null,e[17]=c,e[18]=s,e[19]=R):R=e[19];let z;e[20]===Symbol.for(`react.memo_cache_sentinel`)?(z={revalidateOnFocus:!1},e[20]=z):z=e[20];let B=h(R,$e,z),V;e[21]!==c||e[22]!==L||e[23]!==s?(V=c&&L?[`workflow-runs`,s,L]:null,e[21]=c,e[22]=L,e[23]=s,e[24]=V):V=e[24];let H;e[25]===L?H=e[26]:(H=()=>Ze(100,{ownerAgentId:L}),e[25]=L,e[26]=H);let U;e[27]===Symbol.for(`react.memo_cache_sentinel`)?(U={revalidateOnFocus:!1,refreshInterval:an},e[27]=U):U=e[27];let W=h(V,H,U),G;e[28]===B.data?G=e[29]:(G=B.data??[],e[28]=B.data,e[29]=G);let ee=G,te;e[30]===W.data?te=e[31]:(te=W.data??[],e[30]=W.data,e[31]=te);let ne=te,re;e[32]===d?re=e[33]:(re=e=>{d(t=>{let n=new URLSearchParams(t);return e(n),n},{replace:!0})},e[32]=d,e[33]=re);let K=re,oe;e[34]===K?oe=e[35]:(oe=e=>K(t=>{let n=e.trim();n?t.set(`q`,n):t.delete(`q`)}),e[34]=K,e[35]=oe);let ce=oe,ue;e[36]===K?ue=e[37]:(ue=e=>K(t=>{let n=e.trim();n?t.set(ie,n):t.delete(ie)}),e[36]=K,e[37]=ue);let de=ue,fe;e[38]===K?fe=e[39]:(fe=e=>K(t=>{let n=e.trim();n?t.set(`wf`,n):t.delete(`wf`)}),e[38]=K,e[39]=fe);let pe=fe,me;e[40]===K?me=e[41]:(me=e=>K(t=>{e&&e!==`all`?t.set(se,e):t.delete(se)}),e[40]=K,e[41]=me);let he=me,ge;e[42]===K?ge=e[43]:(ge=e=>K(t=>{e===`runs`?t.delete(`tab`):t.set(`tab`,e)}),e[42]=K,e[43]=ge);let _e=ge,ve;e[44]===K?ve=e[45]:(ve=e=>K(t=>{e===`list`?t.delete(O):t.set(O,e)}),e[44]=K,e[45]=ve);let ye=ve,be;e[46]===K?be=e[47]:(be=e=>K(t=>{e===`all`?t.delete(A):t.set(A,e)}),e[46]=K,e[47]=be);let xe=be,q;e[48]===K?q=e[49]:(q=()=>K(rn),e[48]=K,e[49]=q);let Se=q,we=L?`?agentId=${encodeURIComponent(L)}`:``,Te;e[50]!==l||e[51]!==we?(Te=e=>l(`/workflows/${e.id}${we}`),e[50]=l,e[51]=we,e[52]=Te):Te=e[52];let Ee=Te,De=Ee,Oe;e[53]!==l||e[54]!==L||e[55]!==we?(Oe=e=>{l(e.metadata.source===`user`?`/workflows/${e.id}/edit${we}`:`/workflows/new?copy=${encodeURIComponent(e.id)}${L?`&agentId=${encodeURIComponent(L)}`:``}`)},e[53]=l,e[54]=L,e[55]=we,e[56]=Oe):Oe=e[56];let ke=Oe,Ae;e[57]!==l||e[58]!==we?(Ae=e=>l(`/workflows/runs/${e.id}${we}`),e[57]=l,e[58]=we,e[59]=Ae):Ae=e[59];let je=Ae,Me;e[60]===l?Me=e[61]:(Me=e=>{let t=lt(e);t&&l(et(t))},e[60]=l,e[61]=Me);let Ne=Me,Pe;e[62]!==r.cancelFailed||e[63]!==L||e[64]!==W?(Pe=async e=>{try{await Ce(e,{ownerAgentId:L}),await W.mutate()}catch(e){let t=e;k(t instanceof Error?t.message:r.cancelFailed)}},e[62]=r.cancelFailed,e[63]=L,e[64]=W,e[65]=Pe):Pe=e[65];let Fe=Pe,Ie;e[66]!==r.retryFailed||e[67]!==l||e[68]!==L||e[69]!==we?(Ie=async e=>{try{l(`/workflows/runs/${(await Ye(e,{ownerAgentId:L})).runId}${we}`)}catch(e){let t=e;k(t instanceof Error?t.message:r.retryFailed)}},e[66]=r.retryFailed,e[67]=l,e[68]=L,e[69]=we,e[70]=Ie):Ie=e[70];let Le=Ie,Re,ze;e[71]===W?(Re=e[72],ze=e[73]):(Re=()=>{let e=()=>void W.mutate();return window.addEventListener(`workflow-run-updated`,e),window.addEventListener(`workflow-run-error`,e),()=>{window.removeEventListener(`workflow-run-updated`,e),window.removeEventListener(`workflow-run-error`,e)}},ze=[W],e[71]=W,e[72]=Re,e[73]=ze),(0,Y.useEffect)(Re,ze);let Be;e[74]!==F||e[75]!==B||e[76]!==W?(Be=()=>{Promise.all([F.mutate(),B.mutate(),W.mutate()])},e[74]=F,e[75]=B,e[76]=W,e[77]=Be):Be=e[77];let Ve=Be,He=F.isLoading||B.isLoading||W.isLoading,Ue=F.error?.message??B.error?.message??W.error?.message??null,We;e[78]===F.data?.agents?We=e[79]:(We=F.data?.agents??[],e[78]=F.data?.agents,e[79]=We);let Ge;return e[80]!==D||e[81]!==Fe||e[82]!==Se||e[83]!==ee||e[84]!==Ue||e[85]!==c||e[86]!==r||e[87]!==t||e[88]!==He||e[89]!==i||e[90]!==Ee||e[91]!==je||e[92]!==Ne||e[93]!==ke||e[94]!==L||e[95]!==C||e[96]!==Ve||e[97]!==Le||e[98]!==w||e[99]!==ne||e[100]!==_||e[101]!==de||e[102]!==_e||e[103]!==ye||e[104]!==ce||e[105]!==xe||e[106]!==he||e[107]!==pe||e[108]!==De||e[109]!==E||e[110]!==We||e[111]!==x||e[112]!==y?(Ge={language:t,localeTag:i,labels:r,hasToken:c,searchQuery:_,setSearchQuery:ce,ownerAgentId:L,agentOptions:We,setOwnerAgentId:de,workflowFilterId:y,setWorkflowFilterId:pe,triggerFilter:x,setTriggerFilter:he,statusFilter:E,setStatusFilter:xe,clearRunFilters:Se,pageTab:C,setPageTab:_e,runLayout:w,setRunLayout:ye,definitions:ee,runs:ne,openDefinitionDetails:Ee,startWorkflow:De,openWorkflowEditor:ke,openRunDetails:je,openRunInChat:Ne,actionError:D,loading:He,error:Ue,refreshAll:Ve,cancelRun:Fe,retryRun:Le},e[80]=D,e[81]=Fe,e[82]=Se,e[83]=ee,e[84]=Ue,e[85]=c,e[86]=r,e[87]=t,e[88]=He,e[89]=i,e[90]=Ee,e[91]=je,e[92]=Ne,e[93]=ke,e[94]=L,e[95]=C,e[96]=Ve,e[97]=Le,e[98]=w,e[99]=ne,e[100]=_,e[101]=de,e[102]=_e,e[103]=ye,e[104]=ce,e[105]=xe,e[106]=he,e[107]=pe,e[108]=De,e[109]=E,e[110]=We,e[111]=x,e[112]=y,e[113]=Ge):Ge=e[113],Ge}function rn(e){e.delete(`q`),e.delete(`wf`),e.delete(se),e.delete(A)}function an(e){return e?.some(on)?3e3:0}function on(e){return e.status===`queued`||e.status===`running`}function sn(e){return e.token}function cn(e){return e.language}function ln(){let e=(0,X.c)(2),t=nn(),n;return e[0]===t?n=e[1]:(n=(0,Z.jsx)(Zt,{vm:t}),e[0]=t,e[1]=n),n}function un(e){if(typeof e==`string`||typeof e==`number`)return``+e;let t=``;if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=un(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var dn={value:()=>{}};function fn(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new pn(n)}function pn(e){this._=e}function mn(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}pn.prototype=fn.prototype={constructor:pn,on:function(e,t){var n=this._,r=mn(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=hn(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=gn(n[i],e.name,t);else if(t==null)for(i in n)n[i]=gn(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new pn(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function hn(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function gn(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=dn,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var _n={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function vn(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),_n.hasOwnProperty(t)?{space:_n[t],local:e}:e}function yn(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function bn(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function xn(e){var t=vn(e);return(t.local?bn:yn)(t)}function Sn(){}function Cn(e){return e==null?Sn:function(){return this.querySelector(e)}}function wn(e){typeof e!=`function`&&(e=Cn(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new fi(r,this._parents)}function Tn(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function En(){return[]}function Dn(e){return e==null?En:function(){return this.querySelectorAll(e)}}function On(e){return function(){return Tn(e.apply(this,arguments))}}function kn(e){e=typeof e==`function`?On(e):Dn(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new fi(r,i)}function An(e){return function(){return this.matches(e)}}function jn(e){return function(t){return t.matches(e)}}var Mn=Array.prototype.find;function Nn(e){return function(){return Mn.call(this.children,e)}}function Pn(){return this.firstElementChild}function Fn(e){return this.select(e==null?Pn:Nn(typeof e==`function`?e:jn(e)))}var In=Array.prototype.filter;function Ln(){return Array.from(this.children)}function Rn(e){return function(){return In.call(this.children,e)}}function zn(e){return this.selectAll(e==null?Ln:Rn(typeof e==`function`?e:jn(e)))}function Bn(e){typeof e!=`function`&&(e=An(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new fi(r,this._parents)}function Vn(e){return Array(e.length)}function Hn(){return new fi(this._enter||this._groups.map(Vn),this._parents)}function Un(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Un.prototype={constructor:Un,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Wn(e){return function(){return e}}function Gn(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new Un(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function Kn(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new Un(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function qn(e){return e.__data__}function Jn(e,t){if(!arguments.length)return Array.from(this,qn);var n=t?Kn:Gn,r=this._parents,i=this._groups;typeof e!=`function`&&(e=Wn(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=Yn(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new fi(o,r),o._enter=s,o._exit=c,o}function Yn(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function Xn(){return new fi(this._exit||this._groups.map(Vn),this._parents)}function Zn(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function Qn(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new fi(s,this._parents)}function $n(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function er(e){e||=tr;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new fi(i,this._parents).order()}function tr(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function nr(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function rr(){return Array.from(this)}function ir(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function ar(){let e=0;for(let t of this)++e;return e}function or(){return!this.node()}function sr(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function cr(e){return function(){this.removeAttribute(e)}}function lr(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ur(e,t){return function(){this.setAttribute(e,t)}}function dr(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function fr(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function pr(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function mr(e,t){var n=vn(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?lr:cr:typeof t==`function`?n.local?pr:fr:n.local?dr:ur)(n,t))}function hr(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function gr(e){return function(){this.style.removeProperty(e)}}function _r(e,t,n){return function(){this.style.setProperty(e,t,n)}}function vr(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function yr(e,t,n){return arguments.length>1?this.each((t==null?gr:typeof t==`function`?vr:_r)(e,t,n??``)):br(this.node(),e)}function br(e,t){return e.style.getPropertyValue(t)||hr(e).getComputedStyle(e,null).getPropertyValue(t)}function xr(e){return function(){delete this[e]}}function Sr(e,t){return function(){this[e]=t}}function Cr(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function wr(e,t){return arguments.length>1?this.each((t==null?xr:typeof t==`function`?Cr:Sr)(e,t)):this.node()[e]}function Tr(e){return e.trim().split(/^|\s+/)}function Er(e){return e.classList||new Dr(e)}function Dr(e){this._node=e,this._names=Tr(e.getAttribute(`class`)||``)}Dr.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function Or(e,t){for(var n=Er(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function kr(e,t){for(var n=Er(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function Ar(e){return function(){Or(this,e)}}function jr(e){return function(){kr(this,e)}}function Mr(e,t){return function(){(t.apply(this,arguments)?Or:kr)(this,e)}}function Nr(e,t){var n=Tr(e+``);if(arguments.length<2){for(var r=Er(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?Mr:t?Ar:jr)(n,t))}function Pr(){this.textContent=``}function Fr(e){return function(){this.textContent=e}}function Ir(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function Lr(e){return arguments.length?this.each(e==null?Pr:(typeof e==`function`?Ir:Fr)(e)):this.node().textContent}function Rr(){this.innerHTML=``}function zr(e){return function(){this.innerHTML=e}}function Br(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function Vr(e){return arguments.length?this.each(e==null?Rr:(typeof e==`function`?Br:zr)(e)):this.node().innerHTML}function Hr(){this.nextSibling&&this.parentNode.appendChild(this)}function Ur(){return this.each(Hr)}function Wr(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Gr(){return this.each(Wr)}function Kr(e){var t=typeof e==`function`?e:xn(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function qr(){return null}function Jr(e,t){var n=typeof e==`function`?e:xn(e),r=t==null?qr:typeof t==`function`?t:Cn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Yr(){var e=this.parentNode;e&&e.removeChild(this)}function Xr(){return this.each(Yr)}function Zr(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Qr(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function $r(e){return this.select(e?Qr:Zr)}function ei(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function ti(e){return function(t){e.call(this,t,this.__data__)}}function ni(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function ri(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function ii(e,t,n){return function(){var r=this.__on,i,a=ti(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function ai(e,t,n){var r=ni(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(s=t?ii:ri,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function oi(e,t,n){var r=hr(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function si(e,t){return function(){return oi(this,e,t)}}function ci(e,t){return function(){return oi(this,e,t.apply(this,arguments))}}function li(e,t){return this.each((typeof t==`function`?ci:si)(e,t))}function*ui(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var di=[null];function fi(e,t){this._groups=e,this._parents=t}function pi(){return new fi([[document.documentElement]],di)}function mi(){return this}fi.prototype=pi.prototype={constructor:fi,select:wn,selectAll:kn,selectChild:Fn,selectChildren:zn,filter:Bn,data:Jn,enter:Hn,exit:Xn,join:Zn,merge:Qn,selection:mi,order:$n,sort:er,call:nr,nodes:rr,node:ir,size:ar,empty:or,each:sr,attr:mr,style:yr,property:wr,classed:Nr,text:Lr,html:Vr,raise:Ur,lower:Gr,append:Kr,insert:Jr,remove:Xr,clone:$r,datum:ei,on:ai,dispatch:li,[Symbol.iterator]:ui};function hi(e){return typeof e==`string`?new fi([[document.querySelector(e)]],[document.documentElement]):new fi([[e]],di)}function gi(e){let t;for(;t=e.sourceEvent;)e=t;return e}function _i(e,t){if(e=gi(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var vi={passive:!1},yi={capture:!0,passive:!1};function bi(e){e.stopImmediatePropagation()}function xi(e){e.preventDefault(),e.stopImmediatePropagation()}function Si(e){var t=e.document.documentElement,n=hi(e).on(`dragstart.drag`,xi,yi);`onselectstart`in t?n.on(`selectstart.drag`,xi,yi):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function Ci(e,t){var n=e.document.documentElement,r=hi(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,xi,yi),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var wi=e=>()=>e;function Ti(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}Ti.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Ei(e){return!e.ctrlKey&&!e.button}function Di(){return this.parentNode}function Oi(e,t){return t??{x:e.x,y:e.y}}function ki(){return navigator.maxTouchPoints||`ontouchstart`in this}function Ai(){var e=Ei,t=Di,n=Oi,r=ki,i={},a=fn(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,vi).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!(u||!e.call(this,n,r))){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(hi(n.view).on(`mousemove.drag`,m,yi).on(`mouseup.drag`,h,yi),Si(n.view),bi(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(xi(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){hi(e.view).on(`mousemove.drag mouseup.drag`,null),Ci(e.view,l),xi(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r)){var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s,c;for(s=0;s<o;++s)(c=y(this,a,n,r,i[s].identifier,i[s]))&&(bi(n),c(`start`,n,i[s]))}}function _(e){var t=e.changedTouches,n=t.length,r,a;for(r=0;r<n;++r)(a=i[t[r].identifier])&&(xi(e),a(`drag`,e,t[r]))}function v(e){var t=e.changedTouches,n=t.length,r,a;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),r=0;r<n;++r)(a=i[t[r].identifier])&&(bi(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=_i(l||r,t),p,m,h;if((h=n.call(e,new Ti(`beforestart`,{sourceEvent:r,target:f,identifier:c,active:o,x:d[0],y:d[1],dx:0,dy:0,dispatch:u}),s))!=null)return p=h.x-d[0]||0,m=h.y-d[1]||0,function n(r,a,l){var g=d,_;switch(r){case`start`:i[c]=n,_=o++;break;case`end`:delete i[c],--o;case`drag`:d=_i(l||a,t),_=o;break}u.call(r,e,new Ti(r,{sourceEvent:a,subject:h,target:f,identifier:c,active:_,x:d[0]+p,y:d[1]+m,dx:d[0]-g[0],dy:d[1]-g[1],dispatch:u}),s)}}return f.filter=function(t){return arguments.length?(e=typeof t==`function`?t:wi(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:wi(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:wi(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:wi(!!e),f):r},f.on=function(){var e=a.on.apply(a,arguments);return e===a?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}function ji(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Mi(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Ni(){}var Pi=.7,Fi=1/Pi,Ii=`\\s*([+-]?\\d+)\\s*`,Li=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,Ri=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,zi=/^#([0-9a-f]{3,8})$/,Bi=RegExp(`^rgb\\(${Ii},${Ii},${Ii}\\)$`),Vi=RegExp(`^rgb\\(${Ri},${Ri},${Ri}\\)$`),Hi=RegExp(`^rgba\\(${Ii},${Ii},${Ii},${Li}\\)$`),Ui=RegExp(`^rgba\\(${Ri},${Ri},${Ri},${Li}\\)$`),Wi=RegExp(`^hsl\\(${Li},${Ri},${Ri}\\)$`),Gi=RegExp(`^hsla\\(${Li},${Ri},${Ri},${Li}\\)$`),Ki={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};ji(Ni,Zi,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:qi,formatHex:qi,formatHex8:Ji,formatHsl:Yi,formatRgb:Xi,toString:Xi});function qi(){return this.rgb().formatHex()}function Ji(){return this.rgb().formatHex8()}function Yi(){return ua(this).formatHsl()}function Xi(){return this.rgb().formatRgb()}function Zi(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=zi.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Qi(t):n===3?new na(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?$i(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?$i(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Bi.exec(e))?new na(t[1],t[2],t[3],1):(t=Vi.exec(e))?new na(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Hi.exec(e))?$i(t[1],t[2],t[3],t[4]):(t=Ui.exec(e))?$i(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Wi.exec(e))?la(t[1],t[2]/100,t[3]/100,1):(t=Gi.exec(e))?la(t[1],t[2]/100,t[3]/100,t[4]):Ki.hasOwnProperty(e)?Qi(Ki[e]):e===`transparent`?new na(NaN,NaN,NaN,0):null}function Qi(e){return new na(e>>16&255,e>>8&255,e&255,1)}function $i(e,t,n,r){return r<=0&&(e=t=n=NaN),new na(e,t,n,r)}function ea(e){return e instanceof Ni||(e=Zi(e)),e?(e=e.rgb(),new na(e.r,e.g,e.b,e.opacity)):new na}function ta(e,t,n,r){return arguments.length===1?ea(e):new na(e,t,n,r??1)}function na(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}ji(na,ta,Mi(Ni,{brighter(e){return e=e==null?Fi:Fi**+e,new na(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Pi:Pi**+e,new na(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new na(sa(this.r),sa(this.g),sa(this.b),oa(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ra,formatHex:ra,formatHex8:ia,formatRgb:aa,toString:aa}));function ra(){return`#${ca(this.r)}${ca(this.g)}${ca(this.b)}`}function ia(){return`#${ca(this.r)}${ca(this.g)}${ca(this.b)}${ca((isNaN(this.opacity)?1:this.opacity)*255)}`}function aa(){let e=oa(this.opacity);return`${e===1?`rgb(`:`rgba(`}${sa(this.r)}, ${sa(this.g)}, ${sa(this.b)}${e===1?`)`:`, ${e})`}`}function oa(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function sa(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ca(e){return e=sa(e),(e<16?`0`:``)+e.toString(16)}function la(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new fa(e,t,n,r)}function ua(e){if(e instanceof fa)return new fa(e.h,e.s,e.l,e.opacity);if(e instanceof Ni||(e=Zi(e)),!e)return new fa;if(e instanceof fa)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new fa(o,s,c,e.opacity)}function da(e,t,n,r){return arguments.length===1?ua(e):new fa(e,t,n,r??1)}function fa(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}ji(fa,da,Mi(Ni,{brighter(e){return e=e==null?Fi:Fi**+e,new fa(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Pi:Pi**+e,new fa(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new na(ha(e>=240?e-240:e+120,i,r),ha(e,i,r),ha(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new fa(pa(this.h),ma(this.s),ma(this.l),oa(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=oa(this.opacity);return`${e===1?`hsl(`:`hsla(`}${pa(this.h)}, ${ma(this.s)*100}%, ${ma(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function pa(e){return e=(e||0)%360,e<0?e+360:e}function ma(e){return Math.max(0,Math.min(1,e||0))}function ha(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var ga=e=>()=>e;function _a(e,t){return function(n){return e+n*t}}function va(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function ya(e){return(e=+e)==1?ba:function(t,n){return n-t?va(t,n,e):ga(isNaN(t)?n:t)}}function ba(e,t){var n=t-e;return n?_a(e,n):ga(isNaN(e)?t:e)}var xa=(function e(t){var n=ya(t);function r(e,t){var r=n((e=ta(e)).r,(t=ta(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=ba(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function Sa(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function Ca(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function wa(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o;for(o=0;o<r;++o)i[o]=Na(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function Ta(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Ea(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Da(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=Na(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var Oa=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ka=new RegExp(Oa.source,`g`);function Aa(e){return function(){return e}}function ja(e){return function(t){return e(t)+``}}function Ma(e,t){var n=Oa.lastIndex=ka.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=Oa.exec(e))&&(i=ka.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:Ea(r,i)})),n=ka.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?ja(c[0].x):Aa(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function Na(e,t){var n=typeof t,r;return t==null||n===`boolean`?ga(t):(n===`number`?Ea:n===`string`?(r=Zi(t))?(t=r,xa):Ma:t instanceof Zi?xa:t instanceof Date?Ta:Ca(t)?Sa:Array.isArray(t)?wa:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?Da:Ea)(e,t)}var Pa=180/Math.PI,Fa={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ia(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*Pa,skewX:Math.atan(c)*Pa,scaleX:o,scaleY:s}}var La;function Ra(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?Fa:Ia(t.a,t.b,t.c,t.d,t.e,t.f)}function za(e){return e==null||(La||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),La.setAttribute(`transform`,e),!(e=La.transform.baseVal.consolidate()))?Fa:(e=e.matrix,Ia(e.a,e.b,e.c,e.d,e.e,e.f))}function Ba(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:Ea(e,i)},{i:c-2,x:Ea(r,a)})}else (i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:Ea(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:Ea(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:Ea(e,n)},{i:s-2,x:Ea(t,r)})}else (n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var Va=Ba(Ra,`px, `,`px)`,`deg)`),Ha=Ba(za,`, `,`)`,`)`),Ua=1e-12;function Wa(e){return((e=Math.exp(e))+1/e)/2}function Ga(e){return((e=Math.exp(e))-1/e)/2}function Ka(e){return((e=Math.exp(2*e))-1)/(e+1)}var qa=(function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p<Ua)h=Math.log(u/s)/t,m=function(e){return[a+e*d,o+e*f,s*Math.exp(t*e*h)]};else{var g=Math.sqrt(p),_=(u*u-s*s+r*p)/(2*s*n*g),v=(u*u-s*s-r*p)/(2*u*n*g),y=Math.log(Math.sqrt(_*_+1)-_);h=(Math.log(Math.sqrt(v*v+1)-v)-y)/t,m=function(e){var r=e*h,i=Wa(y),c=s/(n*g)*(i*Ka(t*r+y)-Ga(y));return[a+c*d,o+c*f,s*i/Wa(t*r+y)]}}return m.duration=h*1e3*t/Math.SQRT2,m}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i})(Math.SQRT2,2,4),Ja=0,Ya=0,Xa=0,Za=1e3,Qa,$a,eo=0,to=0,no=0,ro=typeof performance==`object`&&performance.now?performance:Date,io=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function ao(){return to||=(io(oo),ro.now()+no)}function oo(){to=0}function so(){this._call=this._time=this._next=null}so.prototype=co.prototype={constructor:so,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?ao():+n)+(t==null?0:+t),!this._next&&$a!==this&&($a?$a._next=this:Qa=this,$a=this),this._call=e,this._time=n,mo()},stop:function(){this._call&&(this._call=null,this._time=1/0,mo())}};function co(e,t,n){var r=new so;return r.restart(e,t,n),r}function lo(){ao(),++Ja;for(var e=Qa,t;e;)(t=to-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ja}function uo(){to=(eo=ro.now())+no,Ja=Ya=0;try{lo()}finally{Ja=0,po(),to=0}}function fo(){var e=ro.now(),t=e-eo;t>Za&&(no-=t,eo=e)}function po(){for(var e,t=Qa,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Qa=n);$a=e,mo(r)}function mo(e){Ja||(Ya&&=clearTimeout(Ya),e-to>24?(e<1/0&&(Ya=setTimeout(uo,e-ro.now()-no)),Xa&&=clearInterval(Xa)):(Xa||=(eo=ro.now(),setInterval(fo,Za)),Ja=1,io(uo)))}function ho(e,t,n){var r=new so;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var go=fn(`start`,`end`,`cancel`,`interrupt`),_o=[];function vo(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;So(e,n,{name:t,index:r,group:i,on:go,tween:_o,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function yo(e,t){var n=xo(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function bo(e,t){var n=xo(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function xo(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function So(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=co(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return ho(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(ho(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function Co(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function wo(e){return this.each(function(){Co(this,e)})}function To(e,t){var n,r;return function(){var i=bo(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function Eo(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=bo(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function Do(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=xo(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?To:Eo)(n,e,t))}function Oo(e,t,n){var r=e._id;return e.each(function(){var e=bo(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return xo(e,r).value[t]}}function ko(e,t){var n;return(typeof t==`number`?Ea:t instanceof Zi?xa:(n=Zi(t))?(t=n,xa):Ma)(e,t)}function Ao(e){return function(){this.removeAttribute(e)}}function jo(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Mo(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function No(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function Po(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function Fo(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function Io(e,t){var n=vn(e),r=n===`transform`?Ha:ko;return this.attrTween(e,typeof t==`function`?(n.local?Fo:Po)(n,r,Oo(this,`attr.`+e,t)):t==null?(n.local?jo:Ao)(n):(n.local?No:Mo)(n,r,t))}function Lo(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Ro(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function zo(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Ro(e,i)),n}return i._value=t,i}function Bo(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Lo(e,i)),n}return i._value=t,i}function Vo(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=vn(e);return this.tween(n,(r.local?zo:Bo)(r,t))}function Ho(e,t){return function(){yo(this,e).delay=+t.apply(this,arguments)}}function Uo(e,t){return t=+t,function(){yo(this,e).delay=t}}function Wo(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Ho:Uo)(t,e)):xo(this.node(),t).delay}function Go(e,t){return function(){bo(this,e).duration=+t.apply(this,arguments)}}function Ko(e,t){return t=+t,function(){bo(this,e).duration=t}}function qo(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Go:Ko)(t,e)):xo(this.node(),t).duration}function Jo(e,t){if(typeof t!=`function`)throw Error();return function(){bo(this,e).ease=t}}function Yo(e){var t=this._id;return arguments.length?this.each(Jo(t,e)):xo(this.node(),t).ease}function Xo(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();bo(this,e).ease=n}}function Zo(e){if(typeof e!=`function`)throw Error();return this.each(Xo(this._id,e))}function Qo(e){typeof e!=`function`&&(e=An(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new Ds(r,this._parents,this._name,this._id)}function $o(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new Ds(o,this._parents,this._name,this._id)}function es(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function ts(e,t,n){var r,i,a=es(t)?yo:bo;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function ns(e,t){var n=this._id;return arguments.length<2?xo(this.node(),n).on.on(e):this.each(ts(n,e,t))}function rs(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function is(){return this.on(`end.remove`,rs(this._id))}function as(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Cn(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,vo(l[f],t,n,f,l,xo(u,n)));return new Ds(a,this._parents,t,n)}function os(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Dn(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=xo(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&vo(p,t,n,h,f,m);a.push(f),o.push(u)}return new Ds(a,o,t,n)}var ss=pi.prototype.constructor;function cs(){return new ss(this._groups,this._parents)}function ls(e,t){var n,r,i;return function(){var a=br(this,e),o=(this.style.removeProperty(e),br(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function us(e){return function(){this.style.removeProperty(e)}}function ds(e,t,n){var r,i=n+``,a;return function(){var o=br(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function fs(e,t,n){var r,i,a;return function(){var o=br(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),br(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function ps(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=bo(this,e),l=c.on,u=c.value[a]==null?s||=us(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function ms(e,t,n){var r=(e+=``)==`transform`?Va:ko;return t==null?this.styleTween(e,ls(e,r)).on(`end.style.`+e,us(e)):typeof t==`function`?this.styleTween(e,fs(e,r,Oo(this,`style.`+e,t))).each(ps(this._id,e)):this.styleTween(e,ds(e,r,t),n).on(`end.style.`+e,null)}function hs(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function gs(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&hs(e,a,n)),r}return a._value=t,a}function _s(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,gs(e,t,n??``))}function vs(e){return function(){this.textContent=e}}function ys(e){return function(){var t=e(this);this.textContent=t??``}}function bs(e){return this.tween(`text`,typeof e==`function`?ys(Oo(this,`text`,e)):vs(e==null?``:e+``))}function xs(e){return function(t){this.textContent=e.call(this,t)}}function Ss(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&xs(r)),t}return r._value=e,r}function Cs(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,Ss(e))}function ws(){for(var e=this._name,t=this._id,n=ks(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=xo(c,t);vo(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Ds(r,this._parents,e,n)}function Ts(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=bo(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var Es=0;function Ds(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Os(e){return pi().transition(e)}function ks(){return++Es}var As=pi.prototype;Ds.prototype=Os.prototype={constructor:Ds,select:as,selectAll:os,selectChild:As.selectChild,selectChildren:As.selectChildren,filter:Qo,merge:$o,selection:cs,transition:ws,call:As.call,nodes:As.nodes,node:As.node,size:As.size,empty:As.empty,each:As.each,on:ns,attr:Io,attrTween:Vo,style:ms,styleTween:_s,text:bs,textTween:Cs,remove:is,tween:Do,delay:Wo,duration:qo,ease:Yo,easeVarying:Zo,end:Ts,[Symbol.iterator]:As[Symbol.iterator]};function js(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Ms={time:null,delay:0,duration:250,ease:js};function Ns(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function Ps(e){var t,n;e instanceof Ds?(t=e._id,e=e._name):(t=ks(),(n=Ms).time=ao(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&vo(c,e,t,l,o,n||Ns(c,t));return new Ds(r,this._parents,e,t)}pi.prototype.interrupt=wo,pi.prototype.transition=Ps;var Fs=e=>()=>e;function Is(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Ls(e,t,n){this.k=e,this.x=t,this.y=n}Ls.prototype={constructor:Ls,scale:function(e){return e===1?this:new Ls(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ls(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var Rs=new Ls(1,0,0);zs.prototype=Ls.prototype;function zs(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Rs;return e.__zoom}function Bs(e){e.stopImmediatePropagation()}function Vs(e){e.preventDefault(),e.stopImmediatePropagation()}function Hs(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function Us(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute(`viewBox`)?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Ws(){return this.__zoom||Rs}function Gs(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Ks(){return navigator.maxTouchPoints||`ontouchstart`in this}function qs(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function Js(){var e=Hs,t=Us,n=qs,r=Gs,i=Ks,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=qa,l=fn(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,Ws).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,Ws),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(Rs.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new Ls(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new Ls(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new Ls(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=hi(this.that).datum();l.call(e,this.that,new Is(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=_i(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],Co(this),s.start();Vs(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=hi(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=_i(t,i),l=t.clientX,u=t.clientY;Si(t.view),Bs(t),a.mouse=[c,this.__zoom.invert(c)],Co(this),a.start();function d(e){if(Vs(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=_i(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),Ci(e.view,a.moved),Vs(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=_i(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);Vs(r),s>0?hi(this).transition().duration(s).call(x,d,c,r):hi(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(Bs(t),s=0;s<i;++s)c=r[s],l=_i(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),Co(this),a.start())}}function O(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(Vs(e),s=0;s<a;++s)c=i[s],l=_i(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function k(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(Bs(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=_i(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=hi(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:Fs(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:Fs(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:Fs(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:Fs([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}var Ys={error001:(e=`react`)=>`Seems like you have not used ${e===`svelte`?`SvelteFlowProvider`:`ReactFlowProvider`} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>`It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.`,error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>`The parent container needs a width and a height to render the graph.`,error005:()=>`Only child nodes can use a parent extent.`,error006:()=>`Can't create edge. An edge needs a source and a target.`,error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e===`source`?n:r}", edge id: ${t}.`,error010:()=>`Handle: No node id found. Make sure to only use a Handle inside a custom Node.`,error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e=`react`)=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>`useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.`,error015:()=>`It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.`,error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},Xs=[[-1/0,-1/0],[1/0,1/0]],Zs=[`Enter`,` `,`Escape`],Qs={"node.a11yDescription.default":`Press enter or space to select a node. Press delete to remove it and escape to cancel.`,"node.a11yDescription.keyboardDisabled":`Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.`,"node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":`Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.`,"controls.ariaLabel":`Control Panel`,"controls.zoomIn.ariaLabel":`Zoom In`,"controls.zoomOut.ariaLabel":`Zoom Out`,"controls.fitView.ariaLabel":`Fit View`,"controls.interactive.ariaLabel":`Toggle Interactivity`,"minimap.ariaLabel":`Mini Map`,"handle.ariaLabel":`Handle`},$s;(function(e){e.Strict=`strict`,e.Loose=`loose`})($s||={});var ec;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(ec||={});var tc;(function(e){e.Partial=`partial`,e.Full=`full`})(tc||={});var nc={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},rc;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(rc||={});var ic;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(ic||={});var Q;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(Q||={});var ac={[Q.Left]:Q.Right,[Q.Right]:Q.Left,[Q.Top]:Q.Bottom,[Q.Bottom]:Q.Top};function oc(e){return e===null?null:e?`valid`:`invalid`}var sc=e=>!!e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e,cc=e=>!!e&&typeof e==`object`&&`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),lc=e=>!!e&&typeof e==`object`&&`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),uc=(e,t=[0,0])=>{let{width:n,height:r}=Wc(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},dc=(e,t={nodeOrigin:[0,0]})=>e.length===0?{x:0,y:0,width:0,height:0}:Ec(e.reduce((e,n)=>{let r=typeof n==`string`,i=!t.nodeLookup&&!r?n:void 0;return t.nodeLookup&&(i=r?t.nodeLookup.get(n):lc(n)?n:t.nodeLookup.get(n.id)),wc(e,i?Oc(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),fc=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=wc(n,Oc(e)),r=!0)}),r?Ec(n):{x:0,y:0,width:0,height:0}},pc=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s=(t.x-n)/i,c=(t.y-r)/i,l=t.width/i,u=t.height/i,d=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??0,f=e.height??t.height??t.initialHeight??0,{x:p,y:m}=t.internals.positionAbsolute,h=Ac(s,c,l,u,p,m,i,f),g=i*f,_=a&&h>0;(!t.internals.handleBounds||_||h>=g||t.dragging)&&d.push(t)}return d},mc=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function hc(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{let i;if(t?.includeHiddenNodes){let{width:t,height:n}=Wc(e);i=t>0&&n>0}else i=!!(e.measured.width&&e.measured.height&&!e.hidden);i&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function gc({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=Vc(fc(hc(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),!0}function _c({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent)if(!s)a?.(`005`,Ys.error005());else{let e=s.measured.width,t=s.measured.height;e&&t&&(d=[[c,l],[c+e,l+t]])}else s&&Uc(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=Uc(d)?bc(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,Ys.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function vc({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=mc(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var yc=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),bc=(e={x:0,y:0},t,n)=>({x:yc(e.x,t[0][0],t[1][0]-(n?.width??0)),y:yc(e.y,t[0][1],t[1][1]-(n?.height??0))});function xc(e,t,n){let{width:r,height:i}=Wc(n),{x:a,y:o}=n.internals.positionAbsolute;return bc(e,[[a,o],[a+r,o+i]],t)}var Sc=(e,t,n)=>e<t?yc(Math.abs(e-t),1,t)/t:e>n?-yc(Math.abs(e-n),1,t)/t:0,Cc=(e,t,n=15,r=40)=>[Sc(e.x,r,t.width-r)*n,Sc(e.y,r,t.height-r)*n],wc=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Tc=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Ec=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Dc=(e,t=[0,0])=>{let{x:n,y:r}=lc(e)?e.internals.positionAbsolute:uc(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Oc=(e,t=[0,0])=>{let{x:n,y:r}=lc(e)?e.internals.positionAbsolute:uc(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},kc=(e,t)=>Ec(wc(Tc(e),Tc(t))),Ac=(e,t,n,r,i,a,o,s)=>{let c=Math.max(0,Math.min(e+n,i+o)-Math.max(e,i)),l=Math.max(0,Math.min(t+r,a+s)-Math.max(t,a));return Math.ceil(c*l)},jc=(e,t)=>Ac(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),Mc=e=>Nc(e.width)&&Nc(e.height)&&Nc(e.x)&&Nc(e.y),Nc=e=>!isNaN(e)&&isFinite(e),Pc=(e,t)=>(e,t)=>{},Fc=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Ic=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?Fc(s,o):s},Lc=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function Rc(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function zc(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=Rc(e,n),i=Rc(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=Rc(e.top??e.y??0,n),i=Rc(e.bottom??e.y??0,n),a=Rc(e.left??e.x??0,t),o=Rc(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Bc(e,t,n,r,i,a){let{x:o,y:s}=Lc(e,[t,n,r]),{x:c,y:l}=Lc({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var Vc=(e,t,n,r,i,a)=>{let o=zc(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=yc(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=Bc(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},Hc=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function Uc(e){return e!=null&&e!==`parent`}function Wc(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Gc(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Kc(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function qc(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Jc(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function Yc(e){return{...Qs,...e||{}}}function Xc(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=nl(e),s=Ic({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?Fc(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var Zc=e=>({width:e.offsetWidth,height:e.offsetHeight}),Qc=e=>e?.getRootNode?.()||window?.document,$c=[`INPUT`,`SELECT`,`TEXTAREA`];function el(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?$c.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var tl=e=>`clientX`in e,nl=(e,t)=>{let n=tl(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},rl=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...Zc(t)}})};function il({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function al(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function ol({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case Q.Left:return[t-al(t-r,a),n];case Q.Right:return[t+al(r-t,a),n];case Q.Top:return[t,n-al(n-i,a)];case Q.Bottom:return[t,n+al(i-n,a)]}}function sl({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top,curvature:o=.25}){let[s,c]=ol({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=ol({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=il({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function cl({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function ll({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:a=`basic`}){return a===`manual`?r:(i&&n?r+1e3:r)+Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0)}function ul({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=wc(Oc(e),Oc(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),jc({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},Ec(a))>0}var dl=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,fl=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),pl=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,Ys.error006()),t;let r=n.getEdgeId||dl,i;return i=sc(e)?{...e}:{...e,id:r(e)},fl(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function ml({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=cl({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var hl={[Q.Left]:{x:-1,y:0},[Q.Right]:{x:1,y:0},[Q.Top]:{x:0,y:-1},[Q.Bottom]:{x:0,y:1}},gl=({source:e,sourcePosition:t=Q.Bottom,target:n})=>t===Q.Left||t===Q.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},_l=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function vl({source:e,sourcePosition:t=Q.Bottom,target:n,targetPosition:r=Q.Top,center:i,offset:a,stepPosition:o}){let s=hl[t],c=hl[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=gl({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=cl({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]<u[e];(s[f]===1&&(!t&&n||t&&r)||s[f]!==1&&(!t&&r||t&&n))&&(m=f===`x`?i:o)}let d={x:l.x+_.x,y:l.y+_.y},y={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(y.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...x.x!==m[0].x||x.y!==m[0].y?[x]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],h,g,y,b]}function yl(e,t,n,r){let i=Math.min(_l(e,t)/2,_l(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${a+i*t},${o}Q ${a},${o} ${a},${o+i*r}`}let s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function bl({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=vl({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:a,center:{x:s,y:c},offset:l,stepPosition:u}),g=`M${d[0].x} ${d[0].y}`;for(let e=1;e<d.length-1;e++)g+=yl(d[e-1],d[e],d[e+1],o);return g+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[g,f,p,m,h]}function xl(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Sl(e){let{sourceNode:t,targetNode:n}=e;if(!xl(t)||!xl(n))return null;let r=t.internals.handleBounds||Cl(t.handles),i=n.internals.handleBounds||Cl(n.handles),a=Tl(r?.source??[],e.sourceHandle),o=Tl(e.connectionMode===$s.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,Ys.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||Q.Bottom,c=o?.position||Q.Top,l=wl(t,a,s),u=wl(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function Cl(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,r.type===`source`?t.push(r):r.type===`target`&&n.push(r);return{source:t,target:n}}function wl(e,t,n=Q.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:o,height:s}=t??Wc(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case Q.Top:return{x:i+o/2,y:a};case Q.Right:return{x:i+o,y:a+s/2};case Q.Bottom:return{x:i+o/2,y:a+s};case Q.Left:return{x:i,y:a+s/2}}}function Tl(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function El(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function Dl(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=El(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var Ol=1e3,kl=10,Al={nodeOrigin:[0,0],nodeExtent:Xs,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},jl={...Al,checkEquality:!0};function Ml(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function Nl(e,t,n){let r=Ml(Al,n);for(let n of e.values())if(n.parentId)Rl(n,e,t,r);else{let e=bc(uc(n,r.nodeOrigin),Uc(n.extent)?n.extent:r.nodeExtent,Wc(n));n.internals.positionAbsolute=e}}function Pl(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function Fl(e){return e===`manual`}function Il(e,t,n,r={}){let i=Ml(jl,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!Fl(i.zIndexMode)?Ol:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=bc(uc(u,i.nodeOrigin),Uc(u.extent)?u.extent:i.nodeExtent,Wc(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:Pl(u,e),z:zl(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}(e.measured===void 0||e.measured.width===void 0||e.measured.height===void 0)&&!e.hidden&&(c=!1),u.parentId&&Rl(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function Ll(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Rl(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=Ml(Al,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Ll(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*kl),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=Bl(e,u,o,s,a&&!Fl(c)?Ol:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function zl(e,t,n){let r=Nc(e.zIndex)?e.zIndex:0;return Fl(n)?r:r+(e.selected?t:0)}function Bl(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=Wc(e),l=uc(e,n),u=Uc(e.extent)?bc(l,e.extent,c):l,d=bc({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=xc(d,c,t));let f=zl(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function Vl(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=kc(a.get(n.parentId)?.expandedRect??Dc(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=Wc(a),l=a.origin??r,u=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,d=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,f=Math.max(c.width,Math.round(t.width)),p=Math.max(c.height,Math.round(t.height)),m=(f-c.width)*l[0],h=(p-c.height)*l[1];(u>0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width<t.width||c.height<t.height||u||d)&&i.push({id:o,type:`dimensions`,setAttributes:!0,dimensions:{width:f+(u?l[0]*u-m:0),height:p+(d?l[1]*d-h:0)}})}),i}function Hl(e,t,n,r,i,a,o){let s=r?.querySelector(`.xyflow__viewport`),c=!1;if(!s)return{changes:[],updatedInternals:c};let l=[],u=window.getComputedStyle(s),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(let r of e.values()){let e=t.get(r.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),c=!0;continue}let s=Zc(r.nodeElement),u=e.measured.width!==s.width||e.measured.height!==s.height;if(s.width&&s.height&&(u||!e.internals.handleBounds||r.force)){let p=r.nodeElement.getBoundingClientRect(),m=Uc(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;if(e.parentId&&e.extent===`parent`){let n=t.get(e.parentId);n&&(h=xc(h,s,n))}else m&&(h=bc(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:rl(`source`,r.nodeElement,p,d,e.id),target:rl(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&Rl(g,t,n,{nodeOrigin:i,zIndexMode:o}),c=!0,u&&(l.push({id:e.id,type:`dimensions`,dimensions:s}),e.expandParent&&e.parentId&&f.push({id:e.id,parentId:e.parentId,rect:Dc(g,i)}))}}if(f.length>0){let e=Vl(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function Ul({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return!1;let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function Wl(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function Gl(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;Wl(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),Wl(`target`,s,c,e,i,o),t.set(r.id,r)}}function Kl(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:Kl(n,t):!1}function ql(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function Jl(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!Kl(o,e))&&(o.draggable||t&&o.draggable===void 0)){let t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}function Yl({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function Xl({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=Fc(a,t);return{x:o.x-a.x,y:o.y-a.y}}function Zl({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:x=0}){f=hi(v);function S({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?Tc(fc(s)):null,x=v&&l?Xl({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:Fc(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=_c({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=Yl({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function C(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=Cc(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&S(a)),o=requestAnimationFrame(C)}function w(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0,(!m||!y)&&!o&&b&&(i.get(b)?.selected||_()),y&&m&&b&&e?.(b);let v=Xc(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=Jl(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=Yl({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=Ai().clickDistance(x).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&w(e),a=Xc(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=nl(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=Xc(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,C()),!d){let t=nl(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=nl(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!d||p){p&&s.size>0&&t().updateNodePositions(s,!1);return}if(c=!1,d=!1,cancelAnimationFrame(o),s.size>0){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=Yl({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!ql(t,`.${g}`,v))&&(!_||ql(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function Ql(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())jc(i,Dc(e))>0&&r.push(e);return r}var $l=250;function eu(e,t,n,r){let i=[],a=1/0,o=Ql(e,n,t+$l);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=wl(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function tu(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...wl(o,c,c.position,!0)}:c}function nu(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function ru(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var iu=()=>!0;function au(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=iu,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=Qc(e.target),E=0,D,{x:O,y:k}=nl(e),A=nu(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=tu(i,A,r,c,t);if(!N)return;let P=nl(e,j),F=!1,I=null,L=!1,R=null;function z(){if(!u||!j)return;let[e,t]=Cc(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(z)}let B={...N,nodeId:i,type:A,position:N.position},V=c.get(i),H={inProgress:!0,isValid:null,from:wl(V,B,Q.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:V,to:P,toHandle:null,toPosition:ac[B.position],toNode:null,pointer:P};function U(){M=!0,y(H),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&U();function W(e){if(!M){let{x:t,y:n}=nl(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;U()}if(!x()||!B){G(e);return}let a=b();P=nl(e,j),D=eu(Ic(P,a,!1,[1,1]),n,c,B),F||=(z(),!0);let s=ou(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});R=s.handleDomNode,I=s.connection,L=ru(!!D,s.isValid);let u=c.get(i),f=u?wl(u,B,Q.Left,!0):H.from,p={...H,from:f,isValid:L,to:s.toHandle&&L?Lc({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:L&&s.toHandle?s.toHandle.position:ac[B.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),H=p}function G(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||R)&&I&&L&&h?.(I);let{inProgress:t,...n}=H,r={...n,toPosition:H.toHandle?H.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),F=!1,L=!1,I=null,R=null,T.removeEventListener(`mousemove`,W),T.removeEventListener(`mouseup`,G),T.removeEventListener(`touchmove`,W),T.removeEventListener(`touchend`,G)}}T.addEventListener(`mousemove`,W),T.addEventListener(`mouseup`,G),T.addEventListener(`touchmove`,W),T.addEventListener(`touchend`,G)}function ou(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=iu,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=nl(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=nu(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===$s.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=tu(t,e,a,u,n,!0)}return _}var su={onPointerDown:au,isValid:ou};function cu({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=hi(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&Hc()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=Js().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:_i}}var lu=e=>({x:e.x,y:e.y,zoom:e.k}),uu=({x:e,y:t,zoom:n})=>Rs.translate(e,t).scale(n),du=(e,t)=>e.target.closest(`.${t}`),fu=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),pu=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,mu=(e,t=0,n=pu,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},hu=e=>{let t=e.ctrlKey&&Hc()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function gu({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(du(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=_i(u),t=d*2**hu(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===ec.Vertical?0:u.deltaX*f,m=i===ec.Horizontal?0:u.deltaY*f;!Hc()&&u.shiftKey&&i!==ec.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=lu(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c?.(u,h):(e.isPanScrolling=!0,s?.(u,h)),e.panScrollTimeout=setTimeout(()=>{l?.(u,h),e.isPanScrolling=!1},150)}}function _u({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=du(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function vu({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=lu(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function yu({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&fu(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,lu(a.transform))}}function bu({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&fu(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=lu(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function xu({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:a,userSelectionActive:o,noWheelClassName:s,noPanClassName:c,lib:l,connectionInProgress:u}){return d=>{let f=e||t,p=n&&d.ctrlKey,m=d.type===`wheel`;if(d.button===1&&d.type===`mousedown`&&(du(d,`${l}-flow__node`)||du(d,`${l}-flow__edge`)))return!0;if(!r&&!f&&!i&&!a&&!n||o||u&&!m||du(d,s)&&m||du(d,c)&&(!m||i&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type===`touchstart`&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!i&&!p&&m||!r&&(d.type===`mousedown`||d.type===`touchstart`)||Array.isArray(r)&&!r.includes(d.button)&&d.type===`mousedown`)return!1;let h=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&h}}function Su({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=[[0,0],[u.width,u.height]];(typeof ResizeObserver<`u`?new ResizeObserver(e=>{let t=e[0];t&&(d=[[0,0],[t.contentRect.width,t.contentRect.height]])}):null)?.observe(e);let f=Js().extent(()=>d).scaleExtent([t,n]).translateExtent(r),p=hi(e).call(f);y({x:i.x,y:i.y,zoom:yc(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let m=p.on(`wheel.zoom`),h=p.on(`dblclick.zoom`);f.wheelDelta(hu);async function g(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?Na:qa).transform(mu(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function _({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:d,panOnScrollSpeed:g,preventScrolling:_,zoomOnPinch:y,zoomOnScroll:b,zoomOnDoubleClick:x,zoomActivationKeyPressed:S,lib:C,onTransformChange:w,connectionInProgress:T,paneClickDistance:E,selectionOnDrag:D}){r&&!l.isZoomingOrPanning&&v();let O=i&&!S&&!r;f.clickDistance(D?1/0:!Nc(E)||E<0?0:E);let k=O?gu({zoomPanValues:l,noWheelClassName:e,d3Selection:p,d3Zoom:f,panOnScrollMode:d,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):_u({noWheelClassName:e,preventScrolling:_,d3ZoomHandler:m});p.on(`wheel.zoom`,k,{passive:!1});let A=vu({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});f.on(`start`,A);let j=yu({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});f.on(`zoom`,j);let M=bu({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});f.on(`end`,M);let N=xu({zoomActivationKeyPressed:S,panOnDrag:u,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:C,connectionInProgress:T});f.filter(N),x?p.on(`dblclick.zoom`,h):p.on(`dblclick.zoom`,null)}function v(){f.on(`zoom`,null)}async function y(e,t,n){let r=uu(e),i=f?.constrain()(r,t,n);return i&&await g(i),i}async function b(e,t){let n=uu(e);return await g(n,t),n}function x(e){if(p){let t=uu(e),n=p.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&f?.transform(p,t,null,{sync:!0})}}function S(){let e=p?zs(p.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}async function C(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?Na:qa).scaleTo(mu(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function w(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?Na:qa).scaleBy(mu(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function T(e){f?.scaleExtent(e)}function E(e){f?.translateExtent(e)}function D(e){let t=!Nc(e)||e<0?0:e;f?.clickDistance(t)}return{update:_,destroy:v,setViewport:b,setViewportConstrained:y,getViewport:S,scaleTo:C,scaleBy:w,setScaleExtent:T,setTranslateExtent:E,syncViewport:x,setClickDistance:D}}var Cu;(function(e){e.Line=`line`,e.Handle=`handle`})(Cu||={});function wu({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function Tu(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function Eu(e,t){return Math.max(0,t-e)}function Du(e,t){return Math.max(0,e-t)}function Ou(e,t,n){return Math.max(0,t-e,e-n)}function ku(e,t){return e?!t:t}function Au(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=Ou(E,h,g),j=Ou(D,_,v);if(o){let e=0,t=0;c&&w<0?e=Eu(y+w+O,o[0][0]):!c&&w>0&&(e=Du(y+E+O,o[1][0])),l&&T<0?t=Eu(b+T+k,o[0][1]):!l&&T>0&&(t=Du(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=Du(y+w,s[0][0]):!c&&w<0&&(e=Eu(y+E,s[1][0])),l&&T>0?t=Du(b+T,s[0][1]):!l&&T<0&&(t=Eu(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=Ou(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?Du(b+k+E/C,o[1][1])*C:Eu(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?Eu(b+E/C,s[1][1])*C:Du(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=Ou(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?Du(y+D*C+O,o[1][0])/C:Eu(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?Eu(y+D*C,s[1][0])/C:Du(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=(ku(c,l)?-w:w)/C:w=(ku(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let M=c?y+w:y,N=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+M,y:a[1]*T*(l?-1:1)+N}}var ju={width:0,height:0,x:0,y:0},Mu={...ju,pointerX:0,pointerY:0,aspectRatio:1};function Nu(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function Pu({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=hi(e),o={controlDirection:Tu(`bottom-right`),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:e,boundaries:s,keepAspectRatio:c,resizeDirection:l,onResizeStart:u,onResize:d,onResizeEnd:f,shouldResize:p}){let m={...ju},h={...Mu};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:Tu(e)};let g,_=null,v=[],y,b,x,S=!1,C=Ai().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:l,ySnapped:d}=Xc(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...m,pointerX:l,pointerY:d,aspectRatio:m.width/m.height},y=void 0,b=Uc(g.extent)?g.extent:void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId)),y&&g.extent===`parent`&&(b=[[0,0],[y.measured.width,y.measured.height]]),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=Nu(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...m})}).on(`drag`,e=>{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),c=Xc(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),l=[];if(!g)return;let{x:u,y:f,width:C,height:w}=m,T={},E=g.origin??s,{width:D,height:O,x:k,y:A}=Au(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,E,b,x),j=D!==C,M=O!==w,N=k!==u&&j,P=A!==f&&M;if(!N&&!P&&!j&&!M)return;if((N||P||E[0]===1||E[1]===1)&&(T.x=N?k:m.x,T.y=P?A:m.y,m.x=T.x,m.y=T.y,v.length>0)){let e=k-u,t=A-f;for(let n of v)n.position={x:n.position.x-e+E[0]*(D-C),y:n.position.y-t+E[1]*(O-w)},l.push(n)}if((j||M)&&(T.width=j&&(!o.resizeDirection||o.resizeDirection===`horizontal`)?D:m.width,T.height=M&&(!o.resizeDirection||o.resizeDirection===`vertical`)?O:m.height,m.width=T.width,m.height=T.height),y&&g.expandParent){let e=E[0]*(T.width??0);T.x&&T.x<e&&(m.x=e,h.x-=T.x-e);let t=E[1]*(T.height??0);T.y&&T.y<t&&(m.y=t,h.y-=T.y-t)}let F=wu({width:m.width,prevWidth:C,height:m.height,prevHeight:w,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),I={...m,direction:F};p?.(e,I)!==!1&&(S=!0,d?.(e,I),r(T,l))}).on(`end`,e=>{S&&=(f?.(e,{...m}),i?.({...m}),!1)});a.call(C)}function c(){a.on(`.drag`,null)}return{update:s,destroy:c}}var Fu=e(nt(),1),Iu=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},Lu=e=>e?Iu(e):Iu,{useDebugValue:Ru}=Y.default,{useSyncExternalStoreWithSelector:zu}=Fu.default,Bu=e=>e;function Vu(e,t=Bu,n){let r=zu(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Ru(r),r}var Hu=(e,t)=>{let n=Lu(e),r=(e,r=t)=>Vu(n,e,r);return Object.assign(r,n),r},Uu=(e,t)=>e?Hu(e,t):Hu;function Wu(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}n();var Gu=(0,Y.createContext)(null),Ku=Gu.Provider,qu=Ys.error001(`react`);function $(e,t){let n=(0,Y.useContext)(Gu);if(n===null)throw Error(qu);return Vu(n,e,t)}function Ju(){let e=(0,Y.useContext)(Gu);if(e===null)throw Error(qu);return(0,Y.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var Yu={display:`none`},Xu={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},Zu=`react-flow__node-desc`,Qu=`react-flow__edge-desc`,$u=`react-flow__aria-live`,ed=e=>e.ariaLiveMessage,td=e=>e.ariaLabelConfig;function nd({rfId:e}){let t=$(ed);return(0,Z.jsx)(`div`,{id:`${$u}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:Xu,children:t})}function rd({rfId:e,disableKeyboardA11y:t}){let n=$(td);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{id:`${Zu}-${e}`,style:Yu,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,Z.jsx)(`div`,{id:`${Qu}-${e}`,style:Yu,children:n[`edge.a11yDescription.default`]}),!t&&(0,Z.jsx)(nd,{rfId:e})]})}var id=(0,Y.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>(0,Z.jsx)(`div`,{className:un([`react-flow__panel`,n,...`${e}`.split(`-`)]),style:r,ref:a,...i,children:t}));id.displayName=`Panel`;var ad=`https://reactflow.dev?utm_source=attribution`;function od({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:(0,Z.jsx)(id,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${ad}`,children:(0,Z.jsx)(`a`,{href:ad,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var sd=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},cd=e=>e.id;function ld(e,t){return Wu(e.selectedNodes.map(cd),t.selectedNodes.map(cd))&&Wu(e.selectedEdges.map(cd),t.selectedEdges.map(cd))}function ud({onSelectionChange:e}){let t=Ju(),{selectedNodes:n,selectedEdges:r}=$(sd,ld);return(0,Y.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var dd=e=>!!e.onSelectionChangeHandlers;function fd({onSelectionChange:e}){let t=$(dd);return e||t?(0,Z.jsx)(ud,{onSelectionChange:e}):null}var pd=[0,0],md={x:0,y:0,zoom:1},hd=[...`nodes.edges.defaultNodes.defaultEdges.onConnect.onConnectStart.onConnectEnd.onClickConnectStart.onClickConnectEnd.nodesDraggable.autoPanOnNodeFocus.nodesConnectable.nodesFocusable.edgesFocusable.edgesReconnectable.elevateNodesOnSelect.elevateEdgesOnSelect.minZoom.maxZoom.nodeExtent.onNodesChange.onEdgesChange.elementsSelectable.connectionMode.snapGrid.snapToGrid.translateExtent.connectOnClick.defaultEdgeOptions.fitView.fitViewOptions.onNodesDelete.onEdgesDelete.onDelete.onNodeDrag.onNodeDragStart.onNodeDragStop.onSelectionDrag.onSelectionDragStart.onSelectionDragStop.onMoveStart.onMove.onMoveEnd.noPanClassName.nodeOrigin.autoPanOnConnect.autoPanOnNodeDrag.onError.connectionRadius.isValidConnection.selectNodesOnDrag.nodeDragThreshold.connectionDragThreshold.onBeforeDelete.debug.autoPanSpeed.ariaLabelConfig.zIndexMode`.split(`.`),`rfId`],gd=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),_d={translateExtent:Xs,nodeOrigin:pd,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function vd(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=$(gd,Wu),l=Ju();(0,Y.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=_d,s()}),[]);let u=(0,Y.useRef)(_d);return(0,Y.useEffect)(()=>{for(let s of hd){let c=e[s];c!==u.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`ariaLabelConfig`?l.setState({ariaLabelConfig:Yc(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},hd.map(t=>e[t])),null}function yd(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function bd(e){let[t,n]=(0,Y.useState)(e===`system`?null:e);return(0,Y.useEffect)(()=>{if(e!==`system`){n(e);return}let t=yd(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?yd()?.matches?`dark`:`light`:t}var xd=typeof document<`u`?document:null;function Sd(e=null,t={target:xd,actInsideInputWithModifier:!0}){let[n,r]=(0,Y.useState)(!1),i=(0,Y.useRef)(!1),a=(0,Y.useRef)(new Set([])),[o,s]=(0,Y.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(`+`,`
|
|
2
2
|
`).replace(`
|
|
3
3
|
|
|
4
4
|
`,`
|